summaryrefslogtreecommitdiffstats
path: root/ds9/library
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-07-10 20:51:44 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-07-10 20:51:44 (GMT)
commitf8a175bf5b2c4ad0ae830c0c09d096e4aeb58785 (patch)
tree5add3ae0d001975b30bb23361a463d589cf324e7 /ds9/library
parentcf5512238a12cf871256c34e7aed6c911b35ba2f (diff)
downloadblt-f8a175bf5b2c4ad0ae830c0c09d096e4aeb58785.zip
blt-f8a175bf5b2c4ad0ae830c0c09d096e4aeb58785.tar.gz
blt-f8a175bf5b2c4ad0ae830c0c09d096e4aeb58785.tar.bz2
add current slice control to plot3d
Diffstat (limited to 'ds9/library')
-rw-r--r--ds9/library/cube.tcl71
-rw-r--r--ds9/library/markeranalysisplot2d.tcl2
-rw-r--r--ds9/library/markeranalysisplot3d.tcl66
-rw-r--r--ds9/library/plotdialog.tcl5
4 files changed, 133 insertions, 11 deletions
diff --git a/ds9/library/cube.tcl b/ds9/library/cube.tcl
index c716a86..0190dfc 100644
--- a/ds9/library/cube.tcl
+++ b/ds9/library/cube.tcl
@@ -646,6 +646,77 @@ proc UpdateCubeDialog {} {
}
}
+proc UpdateCubeMotionDialog {ii} {
+ global icube
+ global dcube
+ global cube
+
+ # current frame only
+ global current
+ global ds9
+
+ global debug
+ if {$debug(tcl,update)} {
+ puts stderr "UpdateCubeMotionDialog"
+ }
+
+ CubeStop
+
+ if {![winfo exists $icube(top)]} {
+ return
+ }
+
+ set w $icube(top)
+ set mb $icube(mb)
+
+ # get number of axes
+ if {$current(frame) != {}} {
+ set naxes [$current(frame) get fits naxes]
+ } else {
+ set naxes 2
+ }
+
+ # set from/to
+ set depth 1
+ 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 {
+ if {$ii==2} {
+ # get cropped version
+ set ss [$current(frame) get crop 3d image]
+ set dcube(from,$ii) [lindex $ss 0]
+ set dcube(to,$ii) [lindex $ss 1]
+ } else {
+ 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]
+ }
+
+ # set intervals
+ if {$naxes == 2} {
+ SliderFromTo $dcube(slider,2) $dcube(from,2) $dcube(to,2)
+ SliderMinMax $dcube(slider,2) $dcube(from,2) $dcube(to,2) 4
+ } else {
+ SliderFromTo $dcube(slider,$ii) $dcube(from,$ii) $dcube(to,$ii)
+ SliderMinMax $dcube(slider,$ii) $dcube(from,wcs,$ii) $dcube(to,wcs,$ii) 4
+ }
+
+ # we must do this after the scale has been configured
+ if {$naxes == 2} {
+ set dcube(image,2) 1
+ set dcube(wcs,2) 1
+ } else {
+ 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]
+ }
+}
+
proc CubeBackup {ch which} {
switch [$which get type] {
base -
diff --git a/ds9/library/markeranalysisplot2d.tcl b/ds9/library/markeranalysisplot2d.tcl
index 13bda9f..cacf93f 100644
--- a/ds9/library/markeranalysisplot2d.tcl
+++ b/ds9/library/markeranalysisplot2d.tcl
@@ -163,7 +163,7 @@ proc MarkerAnalysisPlot2dCB {frame id} {
if {!$ping} {
set tt [string totitle [$frame get marker $id type]]
- PlotLineDialog $vvarname $tt Plot2D $sys Counts
+ PlotLineDialog $vvarname $tt {} $sys Counts
MarkerAnalysisPlot2dXAxisTitle $vvarname
MarkerAnalysisPlot2dYAxisTitle $vvarname
diff --git a/ds9/library/markeranalysisplot3d.tcl b/ds9/library/markeranalysisplot3d.tcl
index 37ec572..dce3a09 100644
--- a/ds9/library/markeranalysisplot3d.tcl
+++ b/ds9/library/markeranalysisplot3d.tcl
@@ -110,6 +110,7 @@ proc MarkerAnalysisPlot3dSystem {varname} {
# hardcoded marker.C
proc MarkerAnalysisPlot3dCB {frame id} {
global imarker
+ global wcs
set varname ${imarker(prefix,dialog)}${id}${frame}
global $varname
@@ -124,23 +125,16 @@ proc MarkerAnalysisPlot3dCB {frame id} {
if {[info exists var(system)]} {
set vvar(system) $var(system)
- set sys $var(system)
} elseif {[info exists vvar(system)]} {
- set sys $vvar(system)
} else {
- global wcs
set vvar(system) $wcs(system)
- set sys $wcs(system)
}
if {[info exists var(method)]} {
set vvar(method) $var(method)
- set method $var(method)
} elseif {[info exists vvar(method)]} {
- set method $vvar(method)
} else {
set vvar(method) average
- set method average
}
set xdata ${vvarname}x
@@ -151,10 +145,19 @@ proc MarkerAnalysisPlot3dCB {frame id} {
if {!$ping} {
set tt [string totitle [$frame get marker $id type]]
- PlotLineDialog $vvarname $tt Plot3D $sys Counts
+ PlotLineDialog $vvarname $tt {} $vvar(system) Counts
MarkerAnalysisPlot3dXAxisTitle $vvarname
MarkerAnalysisPlot3dYAxisTitle $vvarname
+ set vvar(markerslice) [$vvar(graph) marker create line -element bar1 \
+ -outline cyan -linewidth 2 \
+ -bindtags [list slice]]
+ $vvar(graph) marker bind slice <B1-Motion> \
+ [list MarkerAnalysisPlot3dMotion $vvarname %x %y]
+
+ set vvar(mode) pointer
+ PlotChangeMode $vvarname
+
set vvar(manage) 0
set vvar(dim) xy
set vvar(xdata) $xdata
@@ -162,7 +165,11 @@ proc MarkerAnalysisPlot3dCB {frame id} {
blt::vector create $xdata $ydata
}
- $frame get marker $id analysis plot3d $xdata $ydata $sys $method
+ $frame get marker $id analysis plot3d $xdata $ydata \
+ $vvar(system) $vvar(method)
+
+ set vvar(slice) [$frame get fits slice 2 $vvar(system)]
+ MarkerAnalysisPlot3dMarker $vvarname
if {!$ping} {
PlotExternal $vvarname
@@ -174,6 +181,47 @@ proc MarkerAnalysisPlot3dCB {frame id} {
PlotList $vvarname
}
+proc MarkerAnalysisPlot3dMotion {vvarname xx yy} {
+ upvar #0 $vvarname vvar
+ global $vvarname
+
+ if {$vvar(mode) != "pointer"} {
+ return
+ }
+
+ set vvar(slice) [lindex [$vvar(graph) invtransform $xx $yy] 0]
+ $vvar(frame) update fits slice $vvar(slice) $vvar(system)
+
+ MarkerAnalysisPlot3dMarker $vvarname
+
+ # current frame only
+ global current
+ if {$vvar(frame) == $current(frame)} {
+ UpdateCubeMotionDialog 2
+ UpdateScaleDialog
+ UpdateContourScale
+ UpdateContourDialog
+ }
+}
+
+proc MarkerAnalysisPlot3dMarker {vvarname} {
+ upvar #0 $vvarname vvar
+ global $vvarname
+
+ set ss [$vvar(frame) get crop 3d $vvar(system)]
+ set min [lindex $ss 0]
+ set max [lindex $ss 1]
+ set delta [expr ($max-$min)*.0001]
+ if {[::math::fuzzy::tle $vvar(slice) $min]} {
+ set vvar(slice) [expr $min+$delta]
+ }
+ if {[::math::fuzzy::tge $vvar(slice) $max]} {
+ set vvar(slice) [expr $max-$delta]
+ }
+ $vvar(graph) marker configure $vvar(markerslice) \
+ -coords "$vvar(slice) -Inf $vvar(slice) Inf"
+}
+
# hardcoded marker.C
proc MarkerAnalysisPlot3dDeleteCB {frame id} {
# this routine could be called by the region
diff --git a/ds9/library/plotdialog.tcl b/ds9/library/plotdialog.tcl
index b6dd55c..a1e7237 100644
--- a/ds9/library/plotdialog.tcl
+++ b/ds9/library/plotdialog.tcl
@@ -203,8 +203,11 @@ proc PlotChangeMode {varname} {
bind $var(graph) <1> {}
switch $var(mode) {
- pointer {bind $var(graph) <1> [list PlotButton $varname %x %y]}
+ pointer {
+ bind $var(graph) <1> [list PlotButton $varname %x %y]
+ }
zoom {
+ blt::ZoomStack::Reset $var(graph)
switch $ds9(wm) {
x11 -
win32 {Blt_ZoomStack $var(graph) -mode release}