## Environment Set
set CurrentDir [ pwd ]
set tcl_precision 17
+
+global debugMode
+set debugMode 0
+
#puts "CurrentDir: $CurrentDir"
# Tcl/Tk library Directory
proc overviewImagePut { c fileName { mode 0 } } {
global mainImage
global overviewImage
+ global Desktop
if {$overviewImage(image) == "No"} {
} else {
image delete $overviewImage(image)
}
- set stepx [ expr $mainImage(width)/128 ]
- set stepy [ expr $mainImage(height)/128 ]
+ set stepx [ expr $mainImage(width)/$Desktop(overviewCanvasX)]
+ set stepy [ expr $mainImage(height)/$Desktop(overviewCanvasY)]
if {$stepx > $stepy } {
set step $stepx
} else {
set step $stepy
}
set overviewImage(image) [ image create photo -palette 8 ]
- $overviewImage(image) copy $mainImage(image) -from 0 0 $mainImage(width) $mainImage(height) -to 0 0 127 127 -subsample $step
+ $overviewImage(image) copy $mainImage(image) -from 0 0 $mainImage(width) $mainImage(height) -to 0 0 [expr $Desktop(overviewCanvasX) - 1 ] [expr $Desktop(overviewCanvasY) - 1] -subsample $step
$c.canvas create image 0 0 -image $overviewImage(image) -anchor nw
set overviewImage(canvas) $c.canvas
}
global Zoom
- #puts "display2SetVar Start"
+ debugPrint "display2SetVar Start"
if [ info exists thresHigh ] {
set mainImage(thresHigh) $thresHigh
}
if { [ info exists Zoom ] } {
set Roi(Zoom) $Zoom
}
- #puts "display2SetVar End"
+ debugPrint "display2SetVar End"
}
# Set
global Zoom
- #puts "display2InitVar Start"
+ debugPrint "display2InitVar Start"
set tcl_precision 17
# Canvas Area Create
- if [ info exists Desktop(mainCanvasX) ] {
- set Desktop(mainCanvasX) $Desktop(mainCanvasX)
- } else {
- set Desktop(mainCanvasX) 1999
- }
- if [ info exists Desktop(mainCanvasY) ] {
- set Desktop(mainCanvasY) $Desktop(mainCanvasY)
- } else {
- set Desktop(mainCanvasY) 1999
- }
-
-
- Canvas .overview_canvas 128 128
- Canvas .zoom_canvas 128 128
-
- scrolledCanvas .main_canvas 128 128 [ list 0 0 $Desktop(mainCanvasX) $Desktop(mainCanvasY) ]
-
- set Desktop(mainCanvas) .main_canvas
- set Desktop(overviewCanvas) .overview_canvas
- set Desktop(zoomCanvas) .zoom_canvas
-
- # mrcImage Set
- set mainImage(mainCanvas) .main_canvas
- set mainImage(overviewCanvas) .overview_canvas
- set mainImage(zoomCanvas) .zoom_canvas
-
+ set Desktop(mainCanvasX) 1999
+ set Desktop(mainCanvasY) 1999
+ set Desktop(overviewCanvasX) 128
+ set Desktop(overviewCanvasY) 128
+ set Desktop(sizeX) 128
+ set Desktop(sizeY) 128
set overviewImage(image) No
set mousePressed(endy) 0
# Roi
- set Roi(Canvas) $Desktop(mainCanvas).canvas
+ #set Roi(Canvas) $Desktop(mainCanvas).canvas
set Roi(CurrentObject) 0
set Roi(OKColor) #118866
set Roi(SelectColor) #0000ff
set Section(Win,Title) "Section Information"
- #puts "display2InitVar End"
+ debugPrint "display2InitVar End"
}
proc display2InitVarSet { filename } {
- #puts "display2InitVarSet Start"
+ debugPrint "display2InitVarSet Start"
if [ file isdirectory "~/.Eos/" ] {
- puts "Already dir"
+ debugPrint "Already dir ~/.Eos/"
} else {
- #puts "mkdir"
+ puts "~/.Eos/ is created as default dir."
file mkdir "~/.Eos"
}
- #puts "$filename"
+ debugPrint "$filename"
set fpt [ open $filename a ]
- #puts "Set Start"
+ debugPrint "Set Start"
puts $fpt {
#
# Default
# Precision
set tcl_precision 17
+# Canvas Area Create
+set Desktop(mainCanvasX) 1999
+set Desktop(mainCanvasY) 1999
+set Desktop(overviewCanvasX) 128
+set Desktop(overviewCanvasY) 128
+set Desktop(sizeX) 128
+set Desktop(sizeY) 128
+
# Image
set mainImage(thresHigh) No
set mainImage(thresLow) No
set Section(mode) normal
}
close $fpt
- puts "display2InitVarSet End"
+ debugPrint "display2InitVarSet End"
}
+
+
+proc diplay2CanvasInit { } {
+ global Desktop
+ global Roi
+ global mainImage
+
+ debugPrint "display2CanvasInit Start"
+ debugPrint "main $Desktop(mainCanvasX) $Desktop(mainCanvasY)"
+ debugPrint "overview $Desktop(overviewCanvasX) $Desktop(overviewCanvasY)"
+
+ Canvas .overview_canvas $Desktop(overviewCanvasX) $Desktop(overviewCanvasY)
+ Canvas .zoom_canvas $Desktop(overviewCanvasX) $Desktop(overviewCanvasY)
+
+ scrolledCanvas .main_canvas $Desktop(sizeX) $Desktop(sizeY) [ list 0 0 $Desktop(mainCanvasX) $Desktop(mainCanvasY) ]
+
+ set Desktop(mainCanvas) .main_canvas
+ set Desktop(overviewCanvas) .overview_canvas
+ set Desktop(zoomCanvas) .zoom_canvas
+
+ # mrcImage Set
+ set mainImage(mainCanvas) .main_canvas
+ set mainImage(overviewCanvas) .overview_canvas
+ set mainImage(zoomCanvas) .zoom_canvas
+
+ set Roi(Canvas) $Desktop(mainCanvas).canvas
+}
+
proc display2Init {} {
global mousePressed
global Roi
global defaultFile
+ # Initial Variables
display2InitVar
+ debugPrint "display2InitVar End"
+ # Load variables from defaultFile
if [ info exists defaultFile ] {
- puts "Already Exist $defaultFile"
+ debugPrint "Already Exist a variable, defaultFile"
} else {
set defaultFile "~/.Eos/Display2"
}
if [ file exists $defaultFile ] {
#
+ debugPrint "Load parameters from $defaultFile"
} else {
+ # Create initial ~/.Eos/Display2
display2InitVarSet $defaultFile
}
source $defaultFile
# from arguments
display2SetVar
-
+
+ # CanvasCreate
+ diplay2CanvasInit
+
display2MenuSet
display2MenuSet2
display2BindingSet .main_canvas.canvas
Rectangle {
if { $Roi(SizeLock) == "On" } {
global rectanglePoints
- #puts "SizeLock Start: $mousePressed(startx) $mousePressed(starty)"
+ debugPrint "SizeLock Start: $mousePressed(startx) $mousePressed(starty)"
set Roi(CurrentObject) [roiRectangleCreate $c \
[expr $mousePressed(startx)-$rectanglePoints(width) /2 ] \
[expr $mousePressed(starty)-$rectanglePoints(height)/2 ] \
$mousePressed(startx) $mousePressed(starty)]
}
default {
- puts "Not supported Shape"
+ puts stderr "Not supported Shape"
}
}
}
$mousePressed(endx) $mousePressed(endy) ]
}
default {
- puts "Not supported Shape"
+ puts stderr "Not supported Shape"
}
}
}
$mousePressed(endx) $mousePressed(endy) ]
}
default {
- puts "Not supported Shape"
+ puts stderr "Not supported Shape"
}
}
}
$Roi([subst $i],x1) $Roi([subst $i],y1) ]
}
default {
- puts "Not supported in roiAreaAllRedraw"
+ puts stderr "Not supported in roiAreaAllRedraw"
}
}
switch $Roi(MultiNumber) {
set rectanglePoints(x3) $blx
set rectanglePoints(y3) $try
- #puts $startx
- #puts $rectanglePoints(x0)
+ debugPrint "$startx $rectanglePoints(x0)"
if { $mousePressed(mode) == 2 } {
#knobShow $c $rectanglePoints(x0) $rectanglePoints(y0)
proc lineCreate { c x0 y0 x1 y1 } {
global Roi
set height [ lindex [ $c cget -scrollregion] 3 ]
- #puts $Roi(LineWidth)
+ debugPrint $Roi(LineWidth)
return [ $c create line \
[ coordGetInMainImageToCanvas $c x $x0 ] [ coordGetInMainImageToCanvas $c y $y0 ] \
[ coordGetInMainImageToCanvas $c x $x1 ] [ coordGetInMainImageToCanvas $c y $y1 ] \
if { [ fileCanBeOverwritten $Roi(InformationFile) ] } {
set Roi(fptInformationFile) [ open $Roi(InformationFile) w 0600 ]
} else {
- puts "Warning: Cannot be overwritten"
+ puts stderr "Warning: Cannot be overwritten"
return no
}
for { set i 0 } { $i < $Roi(TotalN) } { incr i } {
]
}
default {
- puts "Not supported shape at the multi mode: $Roi([subst $i],Shape)"
+ puts stderr "Not supported shape at the multi mode: $Roi([subst $i],Shape)"
}
}
puts $Roi(fptInformationFile) $oneRoi
flush $Roi(fptInformationFile)
- puts $oneRoi
+ debugPrint $oneRoi
} else {
- puts "Roi($i) doesn't exist. The last roi has not made sure yet or the number $i was not determined."
+ puts stderr "Roi($i) doesn't exist. The last roi has not made sure yet or the number $i was not determined."
}
}
close $Roi(fptInformationFile)
if { [ file exists $Roi(InformationFile) ] } {
set Roi(fptInformationFile) [ open $Roi(InformationFile) r 0600 ]
} else {
- puts "Warning: File not found: $Roi(InformationFile) "
+ puts stderr "Warning: File not found: $Roi(InformationFile) "
return no
}
for { set i 0 } { $i < $Roi(TotalN) } { incr i } {
set Roi($i,y3) [ lindex $oneLineList 9 ]
}
default {
- puts "Not supported shape at the multi mode: $Roi([subst $i],Shape)"
+ puts stderr "Not supported shape at the multi mode: $Roi([subst $i],Shape)"
}
}
incr Roi(TotalN)
if { $Roi(Extract) == "foreground" } {
eval exec [ list Display2 -i $Roi(OutputFile) & ]
} else {
- puts "Not supported because process does not run on foreground"
+ puts stderr "Not supported because process does not run on foreground"
}
}
}
if { [ fileCanBeOverwritten $Roi(MontageFile) ] } {
#
} else {
- puts "Warning: Cannot be overwritten"
+ puts stderr "Warning: Cannot be overwritten"
return no
}
#
if { $Roi(Extract) == "foreground" } {
eval exec [ list Display2 -i $Roi(MontageFile) & ]
} else {
- puts "Not supported because process does not run on foreground"
+ puts stderr "Not supported because process does not run on foreground"
}
}
}
default {
- puts "Not supported"
+ puts stderr "Not supported"
}
}
}
set auto_index(display2SetVar) [list source [file join $dir Display2Init.wish]]
set auto_index(display2InitVar) [list source [file join $dir Display2Init.wish]]
set auto_index(display2InitVarSet) [list source [file join $dir Display2Init.wish]]
+set auto_index(diplay2CanvasInit) [list source [file join $dir Display2Init.wish]]
set auto_index(display2Init) [list source [file join $dir Display2Init.wish]]
set auto_index(display2MenuSet) [list source [file join $dir Display2Menu.wish]]
set auto_index(menuFileCreate) [list source [file join $dir Display2Menu.wish]]
+
proc NotSupportedCommand { } {
puts stderr "Not supported command"
}
-proc debugPrint { s { mode 0 } } {
- if { $mode == 1} {
- puts $s; flush stdout
+proc debugPrint { s } {
+ global debugMode
+
+ if { $debugMode == 1} {
+ puts stderr $s; flush stderr
} else {
}
## Environment Set
set CurrentDir [ pwd ]
set tcl_precision 17
+
+global debugMode
+set debugMode 0
+
#puts "CurrentDir: $CurrentDir"
# Tcl/Tk library Directory
proc overviewImagePut { c fileName { mode 0 } } {
global mainImage
global overviewImage
+ global Desktop
if {$overviewImage(image) == "No"} {
} else {
image delete $overviewImage(image)
}
- set stepx [ expr $mainImage(width)/128 ]
- set stepy [ expr $mainImage(height)/128 ]
+ set stepx [ expr $mainImage(width)/$Desktop(overviewCanvasX)]
+ set stepy [ expr $mainImage(height)/$Desktop(overviewCanvasY)]
if {$stepx > $stepy } {
set step $stepx
} else {
set step $stepy
}
set overviewImage(image) [ image create photo -palette 8 ]
- $overviewImage(image) copy $mainImage(image) -from 0 0 $mainImage(width) $mainImage(height) -to 0 0 127 127 -subsample $step
+ $overviewImage(image) copy $mainImage(image) -from 0 0 $mainImage(width) $mainImage(height) -to 0 0 [expr $Desktop(overviewCanvasX) - 1 ] [expr $Desktop(overviewCanvasY) - 1] -subsample $step
$c.canvas create image 0 0 -image $overviewImage(image) -anchor nw
set overviewImage(canvas) $c.canvas
}
global Zoom
- #puts "display2SetVar Start"
+ debugPrint "display2SetVar Start"
if [ info exists thresHigh ] {
set mainImage(thresHigh) $thresHigh
}
if { [ info exists Zoom ] } {
set Roi(Zoom) $Zoom
}
- #puts "display2SetVar End"
+ debugPrint "display2SetVar End"
}
# Set
global Zoom
- #puts "display2InitVar Start"
+ debugPrint "display2InitVar Start"
set tcl_precision 17
# Canvas Area Create
- if [ info exists Desktop(mainCanvasX) ] {
- set Desktop(mainCanvasX) $Desktop(mainCanvasX)
- } else {
- set Desktop(mainCanvasX) 1999
- }
- if [ info exists Desktop(mainCanvasY) ] {
- set Desktop(mainCanvasY) $Desktop(mainCanvasY)
- } else {
- set Desktop(mainCanvasY) 1999
- }
-
-
- Canvas .overview_canvas 128 128
- Canvas .zoom_canvas 128 128
-
- scrolledCanvas .main_canvas 128 128 [ list 0 0 $Desktop(mainCanvasX) $Desktop(mainCanvasY) ]
-
- set Desktop(mainCanvas) .main_canvas
- set Desktop(overviewCanvas) .overview_canvas
- set Desktop(zoomCanvas) .zoom_canvas
-
- # mrcImage Set
- set mainImage(mainCanvas) .main_canvas
- set mainImage(overviewCanvas) .overview_canvas
- set mainImage(zoomCanvas) .zoom_canvas
-
+ set Desktop(mainCanvasX) 1999
+ set Desktop(mainCanvasY) 1999
+ set Desktop(overviewCanvasX) 128
+ set Desktop(overviewCanvasY) 128
+ set Desktop(sizeX) 128
+ set Desktop(sizeY) 128
set overviewImage(image) No
set mousePressed(endy) 0
# Roi
- set Roi(Canvas) $Desktop(mainCanvas).canvas
+ #set Roi(Canvas) $Desktop(mainCanvas).canvas
set Roi(CurrentObject) 0
set Roi(OKColor) #118866
set Roi(SelectColor) #0000ff
set Section(Win,Title) "Section Information"
- #puts "display2InitVar End"
+ debugPrint "display2InitVar End"
}
proc display2InitVarSet { filename } {
- #puts "display2InitVarSet Start"
+ debugPrint "display2InitVarSet Start"
if [ file isdirectory "~/.Eos/" ] {
- puts "Already dir ~/.Eos/"
+ debugPrint "Already dir ~/.Eos/"
} else {
- puts "~/.Eos/ is created."
+ puts "~/.Eos/ is created as default dir."
file mkdir "~/.Eos"
}
- #puts "$filename"
+ debugPrint "$filename"
set fpt [ open $filename a ]
- #puts "Set Start"
+ debugPrint "Set Start"
puts $fpt {
#
# Default
# Precision
set tcl_precision 17
+# Canvas Area Create
+set Desktop(mainCanvasX) 1999
+set Desktop(mainCanvasY) 1999
+set Desktop(overviewCanvasX) 128
+set Desktop(overviewCanvasY) 128
+set Desktop(sizeX) 128
+set Desktop(sizeY) 128
+
# Image
set mainImage(thresHigh) No
set mainImage(thresLow) No
set Section(mode) normal
}
close $fpt
- #puts "display2InitVarSet End"
+ debugPrint "display2InitVarSet End"
}
+
+
+proc diplay2CanvasInit { } {
+ global Desktop
+ global Roi
+ global mainImage
+
+ debugPrint "display2CanvasInit Start"
+ debugPrint "main $Desktop(mainCanvasX) $Desktop(mainCanvasY)"
+ debugPrint "overview $Desktop(overviewCanvasX) $Desktop(overviewCanvasY)"
+
+ Canvas .overview_canvas $Desktop(overviewCanvasX) $Desktop(overviewCanvasY)
+ Canvas .zoom_canvas $Desktop(overviewCanvasX) $Desktop(overviewCanvasY)
+
+ scrolledCanvas .main_canvas $Desktop(sizeX) $Desktop(sizeY) [ list 0 0 $Desktop(mainCanvasX) $Desktop(mainCanvasY) ]
+
+ set Desktop(mainCanvas) .main_canvas
+ set Desktop(overviewCanvas) .overview_canvas
+ set Desktop(zoomCanvas) .zoom_canvas
+
+ # mrcImage Set
+ set mainImage(mainCanvas) .main_canvas
+ set mainImage(overviewCanvas) .overview_canvas
+ set mainImage(zoomCanvas) .zoom_canvas
+
+ set Roi(Canvas) $Desktop(mainCanvas).canvas
+}
+
proc display2Init {} {
global mousePressed
global Roi
# Initial Variables
display2InitVar
+ debugPrint "display2InitVar End"
# Load variables from defaultFile
if [ info exists defaultFile ] {
- #puts "Already Exist a variable, defaultFile"
+ debugPrint "Already Exist a variable, defaultFile"
} else {
set defaultFile "~/.Eos/Display2"
}
if [ file exists $defaultFile ] {
#
- #puts "Load parameters from $defaultFile"
+ debugPrint "Load parameters from $defaultFile"
} else {
# Create initial ~/.Eos/Display2
display2InitVarSet $defaultFile
# from arguments
display2SetVar
-
+
+ # CanvasCreate
+ diplay2CanvasInit
+
display2MenuSet
display2MenuSet2
display2BindingSet .main_canvas.canvas
Rectangle {
if { $Roi(SizeLock) == "On" } {
global rectanglePoints
- #puts "SizeLock Start: $mousePressed(startx) $mousePressed(starty)"
+ debugPrint "SizeLock Start: $mousePressed(startx) $mousePressed(starty)"
set Roi(CurrentObject) [roiRectangleCreate $c \
[expr $mousePressed(startx)-$rectanglePoints(width) /2 ] \
[expr $mousePressed(starty)-$rectanglePoints(height)/2 ] \
$mousePressed(startx) $mousePressed(starty)]
}
default {
- puts "Not supported Shape"
+ puts stderr "Not supported Shape"
}
}
}
$mousePressed(endx) $mousePressed(endy) ]
}
default {
- puts "Not supported Shape"
+ puts stderr "Not supported Shape"
}
}
}
$mousePressed(endx) $mousePressed(endy) ]
}
default {
- puts "Not supported Shape"
+ puts stderr "Not supported Shape"
}
}
}
$Roi([subst $i],x1) $Roi([subst $i],y1) ]
}
default {
- puts "Not supported in roiAreaAllRedraw"
+ puts stderr "Not supported in roiAreaAllRedraw"
}
}
switch $Roi(MultiNumber) {
set rectanglePoints(x3) $blx
set rectanglePoints(y3) $try
- #puts $startx
- #puts $rectanglePoints(x0)
+ debugPrint "$startx $rectanglePoints(x0)"
if { $mousePressed(mode) == 2 } {
#knobShow $c $rectanglePoints(x0) $rectanglePoints(y0)
proc lineCreate { c x0 y0 x1 y1 } {
global Roi
set height [ lindex [ $c cget -scrollregion] 3 ]
- #puts $Roi(LineWidth)
+ debugPrint $Roi(LineWidth)
return [ $c create line \
[ coordGetInMainImageToCanvas $c x $x0 ] [ coordGetInMainImageToCanvas $c y $y0 ] \
[ coordGetInMainImageToCanvas $c x $x1 ] [ coordGetInMainImageToCanvas $c y $y1 ] \
if { [ fileCanBeOverwritten $Roi(InformationFile) ] } {
set Roi(fptInformationFile) [ open $Roi(InformationFile) w 0600 ]
} else {
- puts "Warning: Cannot be overwritten"
+ puts stderr "Warning: Cannot be overwritten"
return no
}
for { set i 0 } { $i < $Roi(TotalN) } { incr i } {
]
}
default {
- puts "Not supported shape at the multi mode: $Roi([subst $i],Shape)"
+ puts stderr "Not supported shape at the multi mode: $Roi([subst $i],Shape)"
}
}
puts $Roi(fptInformationFile) $oneRoi
flush $Roi(fptInformationFile)
- puts $oneRoi
+ debugPrint $oneRoi
} else {
- puts "Roi($i) doesn't exist. The last roi has not made sure yet or the number $i was not determined."
+ puts stderr "Roi($i) doesn't exist. The last roi has not made sure yet or the number $i was not determined."
}
}
close $Roi(fptInformationFile)
if { [ file exists $Roi(InformationFile) ] } {
set Roi(fptInformationFile) [ open $Roi(InformationFile) r 0600 ]
} else {
- puts "Warning: File not found: $Roi(InformationFile) "
+ puts stderr "Warning: File not found: $Roi(InformationFile) "
return no
}
for { set i 0 } { $i < $Roi(TotalN) } { incr i } {
set Roi($i,y3) [ lindex $oneLineList 9 ]
}
default {
- puts "Not supported shape at the multi mode: $Roi([subst $i],Shape)"
+ puts stderr "Not supported shape at the multi mode: $Roi([subst $i],Shape)"
}
}
incr Roi(TotalN)
if { $Roi(Extract) == "foreground" } {
eval exec [ list Display2 -i $Roi(OutputFile) & ]
} else {
- puts "Not supported because process does not run on foreground"
+ puts stderr "Not supported because process does not run on foreground"
}
}
}
if { [ fileCanBeOverwritten $Roi(MontageFile) ] } {
#
} else {
- puts "Warning: Cannot be overwritten"
+ puts stderr "Warning: Cannot be overwritten"
return no
}
#
if { $Roi(Extract) == "foreground" } {
eval exec [ list Display2 -i $Roi(MontageFile) & ]
} else {
- puts "Not supported because process does not run on foreground"
+ puts stderr "Not supported because process does not run on foreground"
}
}
}
default {
- puts "Not supported"
+ puts stderr "Not supported"
}
}
}