diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-07-06 19:19:41 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-07-06 19:19:41 (GMT) |
commit | a1a15326cc53e86f115e054c92bda95b01da92b1 (patch) | |
tree | 2162cd8f70b5b9c8b2c5ef0dc35bd050d6e396dd /ds9 | |
parent | 2c5f4cc8ba58a99e5c2f249805fbf53ea149b2f5 (diff) | |
download | blt-a1a15326cc53e86f115e054c92bda95b01da92b1.zip blt-a1a15326cc53e86f115e054c92bda95b01da92b1.tar.gz blt-a1a15326cc53e86f115e054c92bda95b01da92b1.tar.bz2 |
fix cube dialog
Diffstat (limited to 'ds9')
-rw-r--r-- | ds9/doc/release/r8.0.html | 1 | ||||
-rw-r--r-- | ds9/library/3d.tcl | 25 | ||||
-rw-r--r-- | ds9/library/cube.tcl | 188 | ||||
-rw-r--r-- | ds9/library/slider.tcl | 5 | ||||
-rw-r--r-- | ds9/parsers/cubeparser.tac | 1 |
5 files changed, 137 insertions, 83 deletions
diff --git a/ds9/doc/release/r8.0.html b/ds9/doc/release/r8.0.html index 38d95a3..2400ee9 100644 --- a/ds9/doc/release/r8.0.html +++ b/ds9/doc/release/r8.0.html @@ -25,6 +25,7 @@ <li><tt>06.22.2018 API: All new parser/lexer for each command, backward compatible API. Parser will detect syntax errors, and suggest legal options.</tt></li> <li><tt>06.22.2018 CATALOG: updated catalog menu items for GAIA, UCAC, and SDSS.</tt></li> <li><tt>06.25.2018 REGIONS: added support for compressed regions files.</tt></li> + <li><tt>07.06.2018 CUBE: fixed cube slice dialog slider.</tt></li> <li><tt><b>xx.xx.2018 RELEASE version 8.0b1</b></tt></li> </ol> </ol> diff --git a/ds9/library/3d.tcl b/ds9/library/3d.tcl index 2a9aa0b..df5fd8e 100644 --- a/ds9/library/3d.tcl +++ b/ds9/library/3d.tcl @@ -105,11 +105,6 @@ proc 3DDialog {} { slider $f.azslider -180 180 [msgcat::mc {Azimuth}] threed(az) \ [list 3DViewMotion] - bind $f.elslider.slider <ButtonPress-1> {3DViewButton} - bind $f.elslider.slider <ButtonRelease-1> {3DViewRelease} - bind $f.azslider.slider <ButtonPress-1> {3DViewButton} - bind $f.azslider.slider <ButtonRelease-1> {3DViewRelease} - grid $f.azslider -padx 2 -pady 2 -sticky ew grid $f.elslider -padx 2 -pady 2 -sticky ew grid columnconfigure $f 0 -weight 1 @@ -235,16 +230,6 @@ proc 3DViewPoint {} { } } -proc 3DViewButton {} { - global threed - global current - - if {$current(frame) != {}} { - $current(frame) 3d view $threed(az) $threed(el) - Lock3DCurrent - } -} - proc 3DViewMotion {} { global threed global current @@ -255,16 +240,6 @@ proc 3DViewMotion {} { } } -proc 3DViewRelease {} { - global threed - global current - - if {$current(frame) != {}} { - $current(frame) 3d view $threed(az) $threed(el) - Lock3DCurrent - } -} - proc 3DScale {} { global threed global current diff --git a/ds9/library/cube.tcl b/ds9/library/cube.tcl index 062271a..c716a86 100644 --- a/ds9/library/cube.tcl +++ b/ds9/library/cube.tcl @@ -274,26 +274,62 @@ proc CubeApply {ii} { CubeStop - if {$current(frame) != {}} { - if {[$current(frame) has fits]} { - set ss [expr int([$current(frame) get coordinates $dcube(wcs,$ii) $cube(system) image $cube(axis)])] - - if {$ss<1} { - set ss 1 - } - set depth [$current(frame) get fits depth $ii] - if {$ss>$depth} { - set ss $depth - } - set dcube(image,$ii) $ss - set dcube(wcs,$ii) [$current(frame) get coordinates $dcube(image,$ii) image $cube(system) $cube(axis)] - RGBEvalLockCurrent rgb(lock,slice) "$current(frame) update fits slice $ii $ss" - } else { - set dcube(image,$cube(axis)) 1 - set dcube(wcs,$cube(axis)) 1 - } - UpdateCube + if {$current(frame) == {}} { + return } + + if {![$current(frame) has fits]} { + return + } + + set ss $dcube(image,$ii) + if {$ss<1} { + set ss 1 + } + set depth [$current(frame) get fits depth $ii] + if {$ss>$depth} { + set ss $depth + } + + set dcube(image,$ii) $ss + set dcube(wcs,$ii) [$current(frame) get coordinates $dcube(image,$ii) image $cube(system) $cube(axis)] + RGBEvalLockCurrent rgb(lock,slice) "$current(frame) update fits slice $ii $ss" + + UpdateCube +} + +proc CubeApplyWCS {ii} { + global dcube + global cube + global current + global rgb + + CubeStop + + if {$current(frame) == {}} { + return + } + + if {![$current(frame) has fits]} { + return + } + + # will return float + set ss [expr int([$current(frame) get coordinates $dcube(wcs,$ii) $cube(system) image $ii])] + + if {$ss<1} { + set ss 1 + } + set depth [$current(frame) get fits depth $ii] + if {$ss>$depth} { + set ss $depth + } + + set dcube(image,$ii) $ss + set dcube(wcs,$ii) [$current(frame) get coordinates $dcube(image,$ii) image $cube(system) $ii] + RGBEvalLockCurrent rgb(lock,slice) "$current(frame) update fits slice $ii $ss" + + UpdateCube } proc UpdateCube {} { @@ -385,7 +421,6 @@ proc CubeDialog {} { set f [ttk::frame $w.param] set dcube(taxis) [ttk::label $f.taxis -text [msgcat::mc {Axis}]] - set dcube(tslice) [ttk::label $f.tslice -text [msgcat::mc {Slice}]] set dcube(twcs) [ttk::label $f.twcs -textvariable dcube(vcoord) \ -anchor center] for {set ii 2} {$ii<$ds9(FTY_MAXAXES)} {incr ii} { @@ -393,11 +428,13 @@ proc CubeDialog {} { -text [expr $ii+1] \ -variable cube(axis) \ -value $ii] - set dcube(lslice,$ii) [ttk::label $f.slice$ii \ - -textvariable dcube(image,$ii) \ - -width 5 -anchor center] - set dcube(sslice,$ii) [slider $f.scale$ii 0 100 {} \ - dcube(wcs,$ii) [list CubeApply $ii] 4 10] + set dcube(wcsentry,$ii) [ttk::entry $f.slice$ii \ + -textvariable dcube(wcs,$ii) -width 10] + bind $dcube(wcsentry,$ii) <Return> \ + [list CubeApplyWCS $ii] + + set dcube(slider,$ii) [slider $f.scale$ii 0 100 {} \ + dcube(image,$ii) [list CubeApply $ii] 4 10] } # Buttons @@ -505,28 +542,29 @@ proc UpdateCubeDialog {} { if {$naxes == 2} { set dcube(from,2) 1 set dcube(to,2) 1 + set dcube(from,wcs,2) 1 + set dcube(to,wcs,2) 1 } else { for {set ii 2} {$ii<$naxes} {incr ii} { - set dcube(from,$ii) 1 - set dcube(to,$ii) 1 - if {$ii==2} { # get cropped version - set ss [$current(frame) get crop 3d $cube(system)] + set ss [$current(frame) get crop 3d image] set dcube(from,$ii) [lindex $ss 0] set dcube(to,$ii) [lindex $ss 1] } else { - set depth [$current(frame) get fits depth $ii] - set dcube(from,$ii) [$current(frame) get coordinates 1 image $cube(system) $ii] - set dcube(to,$ii) [$current(frame) get coordinates $depth image $cube(system) $ii] + set dcube(from,$ii) 1 + set dcube(to,$ii) [$current(frame) get fits depth $ii] } + + set dcube(from,wcs,$ii) [$current(frame) get coordinates $dcube(from,$ii) image $cube(system) $ii] + set dcube(to,wcs,$ii) [$current(frame) get coordinates $dcube(to,$ii) image $cube(system) $ii] } } - + # forget everything - grid forget $dcube(tslice) $dcube(taxis) $dcube(twcs) + grid forget $dcube(taxis) $dcube(twcs) for {set ii 2} {$ii<$ds9(FTY_MAXAXES)} {incr ii} { - grid forget $dcube(chk,$ii) $dcube(sslice,$ii) $dcube(lslice,$ii) + grid forget $dcube(chk,$ii) $dcube(slider,$ii) $dcube(wcsentry,$ii) } # show it @@ -534,31 +572,48 @@ proc UpdateCubeDialog {} { # special chase, no checkbox grid columnconfigure $w.param 1 -weight 1 grid columnconfigure $w.param 2 -weight 0 - grid $dcube(tslice) $dcube(twcs) -padx 2 -pady 2 -sticky ew - grid $dcube(lslice,2) $dcube(sslice,2) -padx 2 -pady 2 -sticky ew + grid x $dcube(twcs) -padx 2 -pady 2 -sticky ew + switch $cube(system) { + image { + grid x $dcube(slider,2) \ + -padx 2 -pady 2 -sticky ew + } + default { + grid $dcube(wcsentry,2) $dcube(slider,2) \ + -padx 2 -pady 2 -sticky ew + } + } } else { grid columnconfigure $w.param 1 -weight 0 grid columnconfigure $w.param 2 -weight 1 - grid $dcube(taxis) $dcube(tslice) $dcube(twcs) \ - -padx 2 -pady 2 -sticky ew + grid $dcube(taxis) x $dcube(twcs) -padx 2 -pady 2 -sticky ew for {set ii 2} {$ii<$naxes} {incr ii} { - grid $dcube(chk,$ii) $dcube(lslice,$ii) \ - $dcube(sslice,$ii) -padx 2 -pady 2 -sticky ew + switch $cube(system) { + image { + grid $dcube(chk,$ii) x \ + $dcube(slider,$ii) -padx 2 -pady 2 -sticky ew + } + default { + grid $dcube(chk,$ii) $dcube(wcsentry,$ii) \ + $dcube(slider,$ii) -padx 2 -pady 2 -sticky ew + } + } } } # set intervals if {$naxes == 2} { - SliderMinMax $dcube(sslice,2) $dcube(from,2) $dcube(to,2) 4 - set dcube(vcoord) $cube(system) + SliderFromTo $dcube(slider,2) $dcube(from,2) $dcube(to,2) + SliderMinMax $dcube(slider,2) $dcube(from,2) $dcube(to,2) 4 + set dcube(vcoord) image } else { for {set ii 2} {$ii<$naxes} {incr ii} { + SliderFromTo $dcube(slider,$ii) $dcube(from,$ii) $dcube(to,$ii) + SliderMinMax $dcube(slider,$ii) $dcube(from,wcs,$ii) $dcube(to,wcs,$ii) 4 + set dcube(vcoord) $cube(system) switch $cube(system) { - image { - set dcube(from,$ii) [expr int($dcube(from,$ii))] - set dcube(to,$ii) [expr int($dcube(to,$ii))] - } + image {} default { set w [string range $cube(system) 3 3] set key "CTYPE[expr $cube(axis)+1]$w" @@ -568,7 +623,6 @@ proc UpdateCubeDialog {} { } } } - SliderMinMax $dcube(sslice,$ii) $dcube(from,$ii) $dcube(to,$ii) 4 } } @@ -586,9 +640,8 @@ proc UpdateCubeDialog {} { set dcube(wcs,2) 1 } else { for {set ii 2} {$ii<$naxes} {incr ii} { - set slice [$current(frame) get fits slice $ii] - set dcube(image,$ii) $slice - set dcube(wcs,$ii) [$current(frame) get coordinates $slice image $cube(system) $ii] + set dcube(image,$ii) [$current(frame) get fits slice $ii] + set dcube(wcs,$ii) [$current(frame) get coordinates $dcube(image,$ii) image $cube(system) $ii] } } } @@ -716,14 +769,35 @@ proc ProcessCubeCmd {varname iname} { proc CubeCmdCoord {ss sys axis} { global dcube global cube + global current + global rgb + + CubeStop + + if {$current(frame) == {}} { + return + } + + if {![$current(frame) has fits]} { + return + } + + # will return float + set ss [expr int([$current(frame) get coordinates $ss $sys image $axis])] - set dcube(wcs,$axis) $ss - set cube(system) $sys - set cube(axis) $axis - if {$cube(axis) < 2} { - set cube(axis) 2 + if {$ss<1} { + set ss 1 } - CubeApply $cube(axis) + set depth [$current(frame) get fits depth $axis] + if {$ss>$depth} { + set ss $depth + } + + set dcube(image,$axis) $ss + set dcube(wcs,$axis) [$current(frame) get coordinates $dcube(image,$axis) image $cube(system) $axis] + RGBEvalLockCurrent rgb(lock,slice) "$current(frame) update fits slice $axis $ss" + + UpdateCube } proc ProcessSendCubeCmd {proc id param {sock {}} {fn {}}} { diff --git a/ds9/library/slider.tcl b/ds9/library/slider.tcl index 591cb82..fff5ac1 100644 --- a/ds9/library/slider.tcl +++ b/ds9/library/slider.tcl @@ -31,14 +31,17 @@ proc slider {w from to label varname cmd {num {5}} {width {7}}} { bind $w.entry <Return> $cmd + SliderFromTo $w $from $to SliderMinMax $w $from $to $num return $w } -proc SliderMinMax {w from to num} { +proc SliderFromTo {w from to} { $w.slider configure -from $from -to $to +} +proc SliderMinMax {w from to num} { if {$from == $to} { for {set ii 0} {$ii<$num} {incr ii} { $w.t$ii configure -text {} diff --git a/ds9/parsers/cubeparser.tac b/ds9/parsers/cubeparser.tac index d749b6e..8818e37 100644 --- a/ds9/parsers/cubeparser.tac +++ b/ds9/parsers/cubeparser.tac @@ -58,6 +58,7 @@ cube : OPEN_ | AXES_ order | ORDER_ order | INT_ {CubeCmdCoord $1 image 2} + | INT_ IMAGE_ {CubeCmdCoord $1 image 2} | numeric wcssys {CubeCmdCoord $1 $2 2} | numeric wcssys INT_ {CubeCmdCoord $1 $2 [expr $3-1]} ; |