diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2018-08-17 16:46:34 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2018-08-17 16:46:34 (GMT) |
commit | 61331fa2c608e44eae36a8edbaef63752e635303 (patch) | |
tree | 9908ec5510fc89225be60b572def5279b88f9622 /ds9 | |
parent | e45aee40eb4f7837acae8808dd2343dad32f9fe0 (diff) | |
download | blt-61331fa2c608e44eae36a8edbaef63752e635303.zip blt-61331fa2c608e44eae36a8edbaef63752e635303.tar.gz blt-61331fa2c608e44eae36a8edbaef63752e635303.tar.bz2 |
simplify slice code
Diffstat (limited to 'ds9')
-rw-r--r-- | ds9/library/cube.tcl | 68 | ||||
-rw-r--r-- | ds9/library/ime.tcl | 2 | ||||
-rw-r--r-- | ds9/library/markeranalysisplot3d.tcl | 13 | ||||
-rw-r--r-- | ds9/parsers/cubelex.fcl | 1 | ||||
-rw-r--r-- | ds9/parsers/cubeparser.tac | 13 |
5 files changed, 62 insertions, 35 deletions
diff --git a/ds9/library/cube.tcl b/ds9/library/cube.tcl index fa8a329..68d1324 100644 --- a/ds9/library/cube.tcl +++ b/ds9/library/cube.tcl @@ -17,6 +17,7 @@ proc CubeDef {} { # axes cnt starts at 0 set cube(axis) 2 set cube(system) wcs + set cube(sky) fk5 set cube(axes) 123 } @@ -35,7 +36,7 @@ proc MatchCube {which sys} { set naxes [$which get fits naxes] for {set ii 2} {$ii<$naxes} {incr ii} { - set slice($ii) [$which get fits slice $ii $sys] + set slice($ii) [$which get fits slice coordinates $ii $sys fk5] } foreach ff $ds9(frames) { @@ -73,7 +74,7 @@ proc CubeSlice {slice} { RGBEvalLockCurrent rgb(lock,slice) "$current(frame) update fits slice $cube(axis) $slice" set dcube(image,$cube(axis)) $slice - set dcube(wcs,$cube(axis)) [$current(frame) get coordinates $slice image $cube(system) $cube(axis)] + set dcube(wcs,$cube(axis)) [$current(frame) get fits slice coordinates $slice $cube(system) $cube(sky)] UpdateCube } @@ -106,7 +107,7 @@ proc CubeTimer {} { if {$current(frame) != {}} { if {[$current(frame) has fits]} { - set slice [$current(frame) get fits slice $cube(axis)] + set slice [$current(frame) get fits slice] if {$cube(axis)==2} { # get cropped version set ss [$current(frame) get crop 3d image] @@ -172,7 +173,7 @@ proc CubePrev {} { if {$current(frame) != {}} { if {[$current(frame) has fits]} { - set slice [$current(frame) get fits slice $cube(axis)] + set slice [$current(frame) get fits slice] if {$cube(axis)==2} { # get cropped version set ss [$current(frame) get crop 3d image] @@ -209,7 +210,7 @@ proc CubeNext {} { if {$current(frame) != {}} { if {[$current(frame) has fits]} { - set slice [$current(frame) get fits slice $cube(axis)] + set slice [$current(frame) get fits slice] if {$cube(axis)==2} { # get cropped version set ss [$current(frame) get crop 3d image] @@ -290,7 +291,7 @@ proc CubeApply {ii} { } set dcube(image,$ii) $ss - set dcube(wcs,$ii) [$current(frame) get coordinates $dcube(image,$ii) image $cube(system) $cube(axis)] + set dcube(wcs,$ii) [$current(frame) get fits slice coordinates $dcube(image,$ii) $cube(system) $cube(sky)] RGBEvalLockCurrent rgb(lock,slice) "$current(frame) update fits slice $ii $ss" UpdateCube @@ -312,9 +313,7 @@ proc CubeApplyWCS {ii} { return } - # will return float - set ss [expr int([$current(frame) get coordinates $dcube(wcs,$ii) $cube(system) image $ii])] - + set ss [$current(frame) get fits slice $dcube(wcs,$ii) $cube(system) $cube(sky)] if {$ss<1} { set ss 1 } @@ -324,7 +323,7 @@ proc CubeApplyWCS {ii} { } set dcube(image,$ii) $ss - set dcube(wcs,$ii) [$current(frame) get coordinates $dcube(image,$ii) image $cube(system) $ii] + set dcube(wcs,$ii) [$current(frame) get fits slice coordinates $dcube(image,$ii) $cube(system) $cube(sky)] RGBEvalLockCurrent rgb(lock,slice) "$current(frame) update fits slice $ii $ss" UpdateCube @@ -399,7 +398,7 @@ proc CubeDialog {} { $mb.blink add radiobutton -label "8 [msgcat::mc {Seconds}]" \ -variable blink(interval) -value 8000 - CoordMenu $mb.coord cube system 2 {} {} UpdateCubeDialog + CoordMenu $mb.coord cube system 2 sky {} UpdateCubeDialog menu $mb.axes $mb.axes add radiobutton -label {1 2 3} -variable cube(axes) \ @@ -553,9 +552,9 @@ proc UpdateCubeDialog {} { } set dcube(from,wcs,$ii) \ - [$current(frame) get coordinates $dcube(from,$ii) image $cube(system) $ii] + [$current(frame) get fits slice coordinates $dcube(from,$ii) $cube(system) $cube(sky)] set dcube(to,wcs,$ii) \ - [$current(frame) get coordinates $dcube(to,$ii) image $cube(system) $ii] + [$current(frame) get fits slice coordinates $dcube(to,$ii) $cube(system) $cube(sky)] } # forget everything @@ -631,8 +630,8 @@ proc UpdateCubeDialog {} { # we must do this after the scale has been configured for {set ii 2} {$ii<$naxes} {incr 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] + set dcube(image,$ii) [$current(frame) get fits slice] + set dcube(wcs,$ii) [$current(frame) get fits slice coordinates $dcube(image,$ii) $cube(system) $cube(sky)] } } @@ -755,8 +754,8 @@ proc UpdateCubeMotionDialog {ii} { } # we must do this after the scale has been configured - 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] + set dcube(image,$ii) [$current(frame) get fits slice] + set dcube(wcs,$ii) [$current(frame) get fits slice coordinates $dcube(image,$ii) $cube(system) $cube(sky)] } proc CubeBackup {ch which} { @@ -777,7 +776,7 @@ proc CubeBackupBase {ch which} { for {set ii 2} {$ii<$ds9(FTY_MAXAXES)} {incr ii} { set depth [$which get fits depth $ii] if {$depth>1} { - puts $ch "$which update fits slice $ii [$which get fits slice $ii]" + puts $ch "$which update fits slice $ii [$which get fits slice]" } else { break } @@ -879,7 +878,7 @@ proc ProcessCubeCmd {varname iname} { incr i [expr $cube::yycnt-1] } -proc CubeCmdCoord {ss sys axis} { +proc CubeCmd {ss} { global dcube global cube global current @@ -895,19 +894,36 @@ proc CubeCmdCoord {ss sys axis} { return } - # will return float - set ss [expr int([$current(frame) get coordinates $ss $sys image $axis])] + set dcube(image,$axis) $ss + set dcube(wcs,$axis) [$current(frame) get fits slice coordinates $dcube(image,$axis) $cube(system) $cube(sky)] + RGBEvalLockCurrent rgb(lock,slice) "$current(frame) update fits slice $axis $ss" + + UpdateCube +} + +proc CubeCmdCoord {ss sys sky} { + global dcube + global cube + global current + global rgb + + CubeStop + + if {$current(frame) == {}} { + return + } + + if {![$current(frame) has fits]} { + return + } + set ss [$current(frame) get fits slice $ss $sys $sky] if {$ss<1} { set ss 1 } - 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] + set dcube(wcs,$axis) [$current(frame) get fits slice coordinates $dcube(image,$axis) $cube(system) $cube(sky)] RGBEvalLockCurrent rgb(lock,slice) "$current(frame) update fits slice $axis $ss" UpdateCube diff --git a/ds9/library/ime.tcl b/ds9/library/ime.tcl index b4b418e..9cf3493 100644 --- a/ds9/library/ime.tcl +++ b/ds9/library/ime.tcl @@ -597,7 +597,7 @@ proc IMEPlot3DTask {which} { blt::vector create $xdata $ydata } - $which get marker analysis hide analysis plot3d $xdata $ydata physical average + $which get marker analysis hide analysis plot3d $xdata $ydata physical fk5 average if {!$ping} { PlotExternal $vvarname diff --git a/ds9/library/markeranalysisplot3d.tcl b/ds9/library/markeranalysisplot3d.tcl index 988df67..36a385a 100644 --- a/ds9/library/markeranalysisplot3d.tcl +++ b/ds9/library/markeranalysisplot3d.tcl @@ -130,6 +130,13 @@ proc MarkerAnalysisPlot3dCB {frame id} { set vvar(system) $wcs(system) } + if {[info exists var(sky)]} { + set vvar(sky) $var(sky) + } elseif {[info exists vvar(sky)]} { + } else { + set vvar(sky) $wcs(sky) + } + if {[info exists var(method)]} { set vvar(method) $var(method) } elseif {[info exists vvar(method)]} { @@ -166,9 +173,9 @@ proc MarkerAnalysisPlot3dCB {frame id} { } $frame get marker $id analysis plot3d $xdata $ydata \ - $vvar(system) $vvar(method) + $vvar(system) $vvar(sky) $vvar(method) - set vvar(slice) [$frame get fits slice 2 $vvar(system)] + set vvar(slice) [$frame get fits slice 2 $vvar(system) $vvar(sky)] MarkerAnalysisPlot3dMarker $vvarname if {!$ping} { @@ -234,7 +241,7 @@ proc MarkerAnalysisPlot3dSliceCB {frame id} { # this routine will be called, so check first if {[info exists ${vvarname}(system)]} { - set vvar(slice) [$frame get fits slice 2 $vvar(system)] + set vvar(slice) [$frame get fits slice 2 $vvar(system) $vvar(sky)] MarkerAnalysisPlot3dMarker $vvarname } } diff --git a/ds9/parsers/cubelex.fcl b/ds9/parsers/cubelex.fcl index cff9436..b0bbcd7 100644 --- a/ds9/parsers/cubelex.fcl +++ b/ds9/parsers/cubelex.fcl @@ -32,6 +32,7 @@ stop {return $STOP_} 321 {return $321_} #include wcssys.fin +#include skyframe.fin #include yesno.fin #include numeric.fin #include string.fin diff --git a/ds9/parsers/cubeparser.tac b/ds9/parsers/cubeparser.tac index 8818e37..784ab32 100644 --- a/ds9/parsers/cubeparser.tac +++ b/ds9/parsers/cubeparser.tac @@ -3,6 +3,7 @@ #include def.tin #include wcssys.tin +#include skyframe.tin #include yesno.tin #include numeric.tin #include string.tin @@ -36,6 +37,7 @@ %% #include wcssys.trl +#include skyframe.trl #include yesno.trl #include numeric.trl @@ -54,13 +56,14 @@ cube : OPEN_ | FIRST_ {CubeFirst} | LAST_ {CubeLast} | INTERVAL_ numeric {ProcessCmdSet cube interval [expr int($2*1000)]} - | AXIS_ INT_ {ProcessCmdSet cube axis [expr $2-1]} | 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]} + | INT_ {CubeCmd $1} + | INT_ IMAGE_ {CubeCmd $1} + | numeric wcssys {CubeCmdCoord $1 $2 fk5} + | numeric wcssys skyframe {CubeCmdCoord $1 $2 $3} +# backward compatible + | AXIS_ INT_ {} ; order : LOCK_ yesno {ProcessCmdSet cube lock,axes $2 LockAxesCurrent} |