From 88c931f321813357d1a52d6ecbc90f90476a38d5 Mon Sep 17 00:00:00 2001 From: William Joye Date: Thu, 3 Aug 2017 17:28:50 -0400 Subject: add elliptical gaussian smooth --- ds9/doc/ref/command.html | 81 +++++++++++++++++++----- ds9/doc/ref/samp.html | 100 ++++++++++++++++++++++++----- ds9/doc/ref/xpa.html | 100 +++++++++++++++++++++++------ ds9/library/prefs.tcl | 36 ++++++++++- ds9/library/smooth.tcl | 159 +++++++++++++++++++++++++++++++++++------------ 5 files changed, 385 insertions(+), 91 deletions(-) diff --git a/ds9/doc/ref/command.html b/ds9/doc/ref/command.html index 3c4acc0..976f76e 100644 --- a/ds9/doc/ref/command.html +++ b/ds9/doc/ref/command.html @@ -505,6 +505,7 @@ + [crosshair]
        [<ref>] [dec <col>]
@@ -608,6 +609,7 @@ + [match error <value> degrees|arcmin|arcsec]
        [<ref>] @@ -694,6 +696,7 @@ + [match function 1and2|1not2|2not1]
        [<ref>] @@ -780,6 +783,7 @@ + [match return 1and2|1only|2only]
        [<ref>] @@ -866,6 +870,7 @@ + [match unique yes|no]
        [<ref>] [maxrows <number>]
@@ -1009,6 +1014,7 @@ + [update]
        [<ref>] [x <col>]
@@ -1392,6 +1398,7 @@ + [match <coordsys>]
           [lock <coordsys>|none]
@@ -2269,6 +2276,7 @@ + [pan]
            @@ -2398,6 +2406,7 @@ + [crosshair]
            @@ -2527,6 +2536,7 @@ + [open|close]
 
Example:
@@ -2759,6 +2769,7 @@ + [yes|open]
            [no|close]
@@ -2858,6 +2869,7 @@ + duplicate
   @@ -2919,6 +2931,7 @@ +    [<plotname>] stats
     
[<plotname>] @@ -2980,6 +2993,7 @@ + list
     
[<plotname>] @@ -3041,6 +3055,7 @@ + loadconfig <filename>
      [<plotname>] saveconfig <filename>
@@ -3109,6 +3124,7 @@ +    [<plotname>] print
      [<plotname>] print destination [printer|file]
@@ -3179,6 +3195,7 @@ + mode [pointer|zoom]

# configure graph
@@ -3276,6 +3293,7 @@ + shape [circle|square|diamond|plus|splus|scross|triangle|arrow]

      [<plotname>] @@ -3338,6 +3356,7 @@ + shape fill [yes|no]
      [<plotname>] @@ -3402,6 +3421,7 @@ +     [<plotname>] @@ -3462,6 +3482,7 @@ + smooth [step|linear|cubic|quadratic|catrom]
   @@ -3524,6 +3545,7 @@ +    [<plotname>] @@ -3585,6 +3607,7 @@ + color <value>
    @@ -3647,6 +3670,7 @@ +   [<plotname>] @@ -3707,6 +3731,7 @@ + width <value>
  @@ -3769,6 +3794,7 @@ +     @@ -3830,6 +3856,7 @@ + [<plotname>] @@ -3890,6 +3917,7 @@ + dash [yes|no]
   @@ -3951,6 +3979,7 @@ +    [<plotname>] @@ -4012,6 +4041,7 @@ + error [yes|no]
  @@ -4073,6 +4103,7 @@ +     [<plotname>] @@ -4134,6 +4165,7 @@ + error color <value>
   @@ -4196,6 +4228,7 @@ +    [<plotname>] @@ -4257,6 +4290,7 @@ + error width <value>
    @@ -4319,6 +4353,7 @@ +   [<plotname>] @@ -4379,6 +4414,7 @@ + name <string>
# select current dataset
@@ -4768,8 +4804,8 @@ $ds9 -rgbimage foo.fits

$cat foo.fits | ds9 -rgbimage -

rotate

-

Controls the rotation angle (in degrees) of the current frame. -

+

Controls the rotation angle (in degrees) of the current + frame.<

Syntax:
-rotate [<value>]
        [to <value>]
@@ -4872,6 +4908,7 @@ + <filename> [image|table|slice]

 
Example:
@@ -5093,33 +5130,45 @@

smooth

Smooth current image or set smooth parameters.
- The width / height of the kernel = 2*size+1 with radius - <= kernel Size.
Boxcar width = 2*radius+1
Tophat diameter = 2*radius+1
- Gaussian mean =0, sigma = radius/2

+ Gaussian diameter = 2*radius+1, mean =0
+ Elliptical Gaussian diameter = 2*radius+1, mean =0 +
+

Syntax:
-smooth []
        [yes|no]
        [function - boxcar|tophat|gaussian]
-         [radius <int>]
-
        [kernel - <int>]
-
        [open|close]
-         [match]
+ boxcar|tophat|gaussian|elliptic]
+         [radius <value>]
+
        + [minor <value>]
+
        + [sigma <value>]
+
        + [angle <value>]
+
        + [match]
        [lock [yes|no]]
-  
+
        + [open|close]
+  

Example:
$ds9 -smooth
$ds9 -smooth yes
$ds9 -smooth function tophat
$ds9 -smooth radius 4
-
$ds9 -smooth kernel 4
-
$ds9 -smooth open
+
$ds9 -smooth minor 4
+
$ds9 -smooth + sigma 2.0
+
$ds9 + -smooth angle 45
+
$ds9 -smooth + match
+ $ds9 -smooth lock yes

+ $ds9 -smooth open
$ds9 -smooth close
- $ds9 -smooth match
- $ds9 -smooth lock yes

squared

Select squared scale function for the current frame.

diff --git a/ds9/doc/ref/samp.html b/ds9/doc/ref/samp.html index 218958e..1dd48ad 100644 --- a/ds9/doc/ref/samp.html +++ b/ds9/doc/ref/samp.html @@ -556,6 +556,7 @@ + [crosshair]

        [<ref>] [dec <col>]
@@ -657,6 +658,7 @@ + [match error <value> degrees|arcmin|arcsec]

        [<ref>] @@ -741,6 +743,7 @@ + [match function 1and2|1not2|2not1]
        [<ref>] @@ -825,6 +828,7 @@ + [match return 1and2|1only|2only]
        [<ref>] @@ -909,6 +913,7 @@ + [match unique yes|no]
        [<ref>] [maxrows <number>]
@@ -1049,6 +1054,7 @@ + [update]

        [<ref>] [x <col>]
@@ -2088,6 +2094,7 @@ + Macros for more information.

Syntax:
iexam []
@@ -2197,6 +2204,7 @@ +
quality (1-100)

Syntax:
jpeg [new|slice] [<filename>] [1-100]
@@ -2693,6 +2701,7 @@ + # title, title xaxis, title yaxis, dimension on line 1
     [new [name <plotname>] [line|bar|scatter] <title> <xaxis label> <yaxis @@ -2764,6 +2773,7 @@ + duplicate
     @@ -2824,6 +2834,7 @@ + [<plotname>] stats
    
[<plotname>] @@ -2883,6 +2894,7 @@ + list
    
[<plotname>] @@ -2942,6 +2954,7 @@ + loadconfig <filename>
     [<plotname>] saveconfig <filename>
@@ -3003,6 +3016,7 @@ + [<plotname>] pagesetup orient [portrait|landscape]
     [<plotname>] pagesetup size [letter|legal|tabloid|poster|a4]

@@ -3064,6 +3078,7 @@ + [<plotname>] print
     [<plotname>] print destination [printer|file]
@@ -3147,6 +3162,7 @@ + legend [yes|no]
     [<plotname>] legend position [right|left|top|bottom]

@@ -3225,6 +3241,7 @@ + shape [circle|square|diamond|plus|splus|scross|triangle|arrow]

     [<plotname>] @@ -3285,6 +3302,7 @@ + shape fill [yes|no]
     [<plotname>] @@ -3348,6 +3366,7 @@ + [<plotname>] @@ -3406,6 +3425,7 @@ + smooth [step|linear|cubic|quadratic|catrom]
     @@ -3467,6 +3487,7 @@ + [<plotname>] @@ -3525,6 +3546,7 @@ + color <value>
     @@ -3586,6 +3608,7 @@ + [<plotname>] @@ -3644,6 +3667,7 @@ + width <value>
     @@ -3705,6 +3729,7 @@ + [<plotname>] @@ -3763,6 +3788,7 @@ + dash [yes|no]
     @@ -3823,6 +3849,7 @@ + [<plotname>] @@ -3881,6 +3908,7 @@ + error [yes|no]
     @@ -3941,6 +3969,7 @@ + [<plotname>] @@ -3999,6 +4028,7 @@ + error color <value>
     @@ -4060,6 +4090,7 @@ + [<plotname>] @@ -4118,6 +4149,7 @@ + color <value>
     @@ -4179,6 +4211,7 @@ + [<plotname>] @@ -4237,6 +4270,7 @@ + error width <value>
     @@ -4298,6 +4332,7 @@ + [<plotname>] @@ -4356,6 +4391,7 @@ + name <string>

@@ -4441,6 +4477,7 @@ + value = ds9.get(string cmd)
plot stats
@@ -4530,6 +4567,7 @@ + axis x auto
plot @@ -4585,6 +4623,7 @@ + axis x min
plot @@ -4640,6 +4679,7 @@ + axis x max
plot @@ -4695,6 +4735,7 @@ + axis x format
plot @@ -4750,6 +4791,7 @@ + legend
plot legend position
@@ -4813,6 +4855,7 @@ + font numbers size
plot @@ -4872,6 +4915,7 @@ + font numbers weight
plot @@ -4931,6 +4975,7 @@ + font numbers slant
plot @@ -4990,6 +5035,7 @@ + title
plot @@ -5049,6 +5095,7 @@ + title x
plot barmode
@@ -5140,6 +5187,7 @@ + dash
plot @@ -5199,6 +5247,7 @@ + error
plot @@ -5258,6 +5307,7 @@ + error color
plot @@ -5317,6 +5367,7 @@ + error width
plot @@ -5376,6 +5427,7 @@ + name
ds9.set(string @@ -5435,6 +5487,7 @@ + cmd)
plot show yes
plot shape circle
@@ -6079,6 +6132,7 @@ + [crosshair]

        [<ref>] [export sb|tsv <filename>]
@@ -6180,6 +6234,7 @@ + [update]

 
Example:
@@ -6272,24 +6327,29 @@

smooth

Smooth current image or set smooth parameters.
- The width / height of the kernel = 2*size+1 with radius - <= kernel Size.
Boxcar width = 2*radius+1
Tophat diameter = 2*radius+1
- Gaussian mean =0, sigma = radius/2

- Syntax:
- smooth []
+ Gaussian diameter = 2*radius+1, mean =0
+ Elliptical Gaussian diameter = 2*radius+1, mean =0 + Syntax:
+

+ smooth []
       [yes|no]
       [function boxcar|tophat|gaussian]
-
       [radius - <int>]
-
       - [kernel <int>]
-
       [open|close]
-        [match]
-        [lock [yes|no]]
-  
+
       [radius + <value>]
+
       [minor + <value>]
+
       + [sigma <value>]
+
       + [angle <value>]
+
       + [match]
+        [lock [yes|no]]

+        [open|close]
+  

Example:
string value = ds9.get(string cmd)
smooth
@@ -6302,11 +6362,18 @@ smooth yes
smooth function tophat
smooth radius 4
-
smooth kernel 4
-
smooth open
+
smooth minor 4
+
smooth + sigma 2.0
+
smooth + angle 45
+
smooth + open
smooth close
smooth match
- smooth lock yes
+ smooth lock yes

+ smooth open
+ smooth close

source

Source TCL code from a file.

@@ -6411,6 +6478,7 @@ +
compression method.

Syntax:
tiff [new|slice] [<filename>] [none|jpeg|packbits|deflate]
diff --git a/ds9/doc/ref/xpa.html b/ds9/doc/ref/xpa.html index 667cee3..19f5db4 100644 --- a/ds9/doc/ref/xpa.html +++ b/ds9/doc/ref/xpa.html @@ -517,6 +517,7 @@ + [crosshair]

        [<ref>] [dec <col>]
@@ -622,6 +623,7 @@ + [match error <value> degrees|arcmin|arcsec]

        [<ref>] @@ -710,6 +712,7 @@ + [match function 1and2|1not2|2not1]
        [<ref>] @@ -798,6 +801,7 @@ + [match return 1and2|1only|2only]
        [<ref>] @@ -886,6 +890,7 @@ + [match unique yes|no]
        [<ref>] [maxrows <number>]
@@ -1028,6 +1033,7 @@ + [update]

        [<ref>] [x <col>]
@@ -1604,6 +1610,7 @@ + -p ds9 export envi foo.hdr foo.bsq little

$xpaset -p ds9 export tiff foo.tiff jpeg
@@ -2114,6 +2121,7 @@ + quality (1-100)

Syntax:
jpeg [new|slice] [<filename>] [1-100]
@@ -2586,6 +2594,7 @@ + # title, title xaxis, title yaxis, dimension on line 1
     [new [name <plotname>] [line|bar|scatter] <title> <xaxis label> <yaxis @@ -2658,6 +2667,7 @@ + duplicate
     @@ -2719,6 +2729,7 @@ + [<plotname>] stats
    
[<plotname>] @@ -2779,6 +2790,7 @@ + list
    
[<plotname>] @@ -2839,6 +2851,7 @@ + loadconfig <filename>
     [<plotname>] saveconfig <filename>
@@ -2901,6 +2914,7 @@ + [<plotname>] pagesetup orient [portrait|landscape]
     [<plotname>] pagesetup size [letter|legal|tabloid|poster|a4]

@@ -2963,6 +2977,7 @@ + [<plotname>] print
     [<plotname>] print destination [printer|file]
@@ -3047,6 +3062,7 @@ + legend [yes|no]
     [<plotname>] legend position [right|left|top|bottom]

@@ -3118,6 +3134,7 @@ + barmode [normal|stacked|aligned|overlap]

# configure current dataset
@@ -3181,6 +3198,7 @@ + shape [circle|square|diamond|plus|splus|scross|triangle|arrow]

     [<plotname>] @@ -3242,6 +3260,7 @@ + shape fill [yes|no]
     [<plotname>] @@ -3306,6 +3325,7 @@ + [<plotname>] @@ -3365,6 +3385,7 @@ + smooth [step|linear|cubic|quadratic|catrom]
     @@ -3427,6 +3448,7 @@ + [<plotname>] @@ -3486,6 +3508,7 @@ + color <value>
     @@ -3548,6 +3571,7 @@ + [<plotname>] @@ -3607,6 +3631,7 @@ + width <value>
     @@ -3669,6 +3694,7 @@ + [<plotname>] @@ -3728,6 +3754,7 @@ + dash [yes|no]
     @@ -3789,6 +3816,7 @@ + [<plotname>] @@ -3848,6 +3876,7 @@ + error [yes|no]
     @@ -3909,6 +3938,7 @@ + [<plotname>] @@ -3968,6 +3998,7 @@ + error color <value>
     @@ -4030,6 +4061,7 @@ + [<plotname>] @@ -4089,6 +4121,7 @@ + color <value>
     @@ -4151,6 +4184,7 @@ + [<plotname>] @@ -4210,6 +4244,7 @@ + error width <value>
     @@ -4272,6 +4307,7 @@ + [<plotname>] @@ -4331,6 +4367,7 @@ + name <string>

@@ -4453,6 +4490,7 @@ + ds9 plot axis x min
$xpaget @@ -4513,6 +4551,7 @@ + ds9 plot axis x max
$xpaget ds9 plot axis x format
$xpaget @@ -4570,6 +4609,7 @@ + ds9 plot legend
$xpaget ds9 plot legend position
@@ -4634,6 +4674,7 @@ + ds9 plot font numbers size
$xpaget @@ -4694,6 +4735,7 @@ + ds9 plot font numbers weight
$xpaget @@ -4754,6 +4796,7 @@ + ds9 plot font numbers slant
$xpaget @@ -4814,6 +4857,7 @@ + ds9 plot title
$xpaget @@ -4874,6 +4918,7 @@ + ds9 plot title x
$xpaget ds9 plot barmode
@@ -4963,6 +5008,7 @@ + ds9 plot dash
$xpaget @@ -5023,6 +5069,7 @@ + ds9 plot error
$xpaget @@ -5083,6 +5130,7 @@ + ds9 plot error color
$xpaget @@ -5144,6 +5192,7 @@ + ds9 plot error width
$xpaget @@ -5205,6 +5254,7 @@ + ds9 plot name
$xpaset @@ -5265,6 +5315,7 @@ + -p ds9 plot show yes
$xpaset -p ds9 plot shape circle
$xpaset -p ds9 plot shape fill no
@@ -5777,6 +5828,7 @@ + method.

Syntax:
saveimage
[fits|eps|gif|tiff|jpeg|png] <filename>
@@ -5984,25 +6036,31 @@

smooth

Smooth current image or set smooth parameters.
- The width / height of the kernel = 2*size+1 with radius - <= kernel Size.
Boxcar width = 2*radius+1
Tophat diameter = 2*radius+1
- Gaussian mean =0, sigma = radius/2

- Syntax:
- smooth []
+ Gaussian diameter = 2*radius+1, mean =0
+ Elliptical Gaussian diameter = 2*radius+1, mean =0
+
 
+ Syntax:
+

+ smooth []
       [yes|no]
       [function boxcar|tophat|gaussian]
-
       [radius - <int>]
-
       - [kernel <int>]
-
       [open|close]
-        [match]
-        [lock [yes|no]]
-
- Example:
+
       [radius + <value>]
+
       [minor + <value>]
+
       + [sigma <value>]
+
       + [angle <value>]
+
    +    [match]
+        [lock [yes|no]]

+        [open|close]
+
+
Example:
$xpaget ds9 smooth
$xpaget ds9 smooth function
$xpaget ds9 smooth radius
@@ -6012,11 +6070,16 @@ $xpaset -p ds9 smooth yes
$xpaset -p ds9 smooth function tophat
$xpaset -p ds9 smooth radius 4
-
$xpaset -p ds9 smooth kernel 4
-
$xpaset -p ds9 smooth open
+
$xpaset -p ds9 smooth minor 4
+
$xpaset + -p ds9 smooth sigma 2.0
+
$xpaset + -p ds9 smooth angle 45
+
$xpaset + -p ds9 smooth match
+ $xpaset -p ds9 smooth lock yes

+ $xpaset -p ds9 smooth open
$xpaset -p ds9 smooth close
- $xpaset -p ds9 smooth match
- $xpaset -p ds9 smooth lock yes

source

Source TCL code from a file. Only available for XPA_METHOD @@ -6122,6 +6185,7 @@ + compression method.

Syntax:
tiff [new|slice] [<filename>] [none|jpeg|packbits|deflate]
diff --git a/ds9/library/prefs.tcl b/ds9/library/prefs.tcl index 01aa763..f11ad0d 100644 --- a/ds9/library/prefs.tcl +++ b/ds9/library/prefs.tcl @@ -460,6 +460,9 @@ proc FixPrefs {version} { FixPrefs7.0to7.1 FixPrefs7.1to7.2 FixPrefs7.2to7.3 + FixPrefs7.3to7.4 + FixPrefs7.4to7.5 + FixPrefs7.5to7.6 } 6.0 { FixPrefs6.0to6.1 @@ -468,6 +471,9 @@ proc FixPrefs {version} { FixPrefs7.0to7.1 FixPrefs7.1to7.2 FixPrefs7.2to7.3 + FixPrefs7.3to7.4 + FixPrefs7.4to7.5 + FixPrefs7.5to7.6 } 6.1 - 6.1.1 - @@ -477,37 +483,65 @@ proc FixPrefs {version} { FixPrefs7.0to7.1 FixPrefs7.1to7.2 FixPrefs7.2to7.3 + FixPrefs7.3to7.4 + FixPrefs7.4to7.5 + FixPrefs7.5to7.6 } 6.2 { FixPrefs6.2to7.0 FixPrefs7.0to7.1 FixPrefs7.1to7.2 FixPrefs7.2to7.3 + FixPrefs7.3to7.4 + FixPrefs7.4to7.5 + FixPrefs7.5to7.6 } 7.0 { FixPrefs7.0to7.1 FixPrefs7.1to7.2 FixPrefs7.2to7.3 + FixPrefs7.3to7.4 + FixPrefs7.4to7.5 + FixPrefs7.5to7.6 } 7.1 { FixPrefs7.1to7.2 FixPrefs7.2to7.3 + FixPrefs7.3to7.4 + FixPrefs7.4to7.5 + FixPrefs7.5to7.6 } 7.2 { FixPrefs7.2to7.3 + FixPrefs7.3to7.4 + FixPrefs7.4to7.5 + FixPrefs7.5to7.6 } 7.3 - 7.3.1 - 7.3.2 { + FixPrefs7.3to7.4 + FixPrefs7.4to7.5 + FixPrefs7.5to7.6 } 7.4 { + FixPrefs7.4to7.5 + FixPrefs7.5to7.6 } 7.5 { - FixPrefs7.4to7.5 + FixPrefs7.5to7.6 } + 7.6 {} } } +proc FixPrefs7.5to7.6 {} { + global smooth + set smooth(radius,minor) $smooth(radius) + set smooth(sigma) [expr int($smooth(radius)/2.)] + set smooth(sigma,minor) $smooth(sigma) +} + proc FixPrefs7.4to7.5 {} { FixVarRm pds9(threads) } diff --git a/ds9/library/smooth.tcl b/ds9/library/smooth.tcl index 0d5da5d..5cc3e13 100644 --- a/ds9/library/smooth.tcl +++ b/ds9/library/smooth.tcl @@ -15,8 +15,11 @@ proc SmoothDef {} { set smooth(lock) 0 set smooth(view) 0 set smooth(function) gaussian - set smooth(kernel) 3 set smooth(radius) 3 + set smooth(radius,minor) 3 + set smooth(sigma) 1 + set smooth(sigma,minor) 1 + set smooth(angle) 0 array set psmooth [array get smooth] } @@ -29,7 +32,7 @@ proc SmoothUpdate {} { if {$current(frame) != {}} { SetWatchCursor if {$smooth(view)} { - RGBEvalLockCurrent rgb(lock,smooth) [list $current(frame) smooth $smooth(function) $smooth(kernel) $smooth(radius)] + RGBEvalLockCurrent rgb(lock,smooth) [list $current(frame) smooth $smooth(function) $smooth(radius) $smooth(radius,minor) $smooth(sigma) $smooth(sigma,minor) $smooth(angle)] } else { RGBEvalLockCurrent rgb(lock,smooth) [list $current(frame) smooth delete] } @@ -77,28 +80,67 @@ proc SmoothDialog {} { # Function set f [ttk::labelframe $w.func -text [msgcat::mc {Function}] -padding 2] ttk::radiobutton $f.boxcar -text [msgcat::mc {Boxcar}] \ - -variable smooth(function) -value boxcar + -variable smooth(function) -value boxcar \ + -command SmoothUpdateDialog ttk::radiobutton $f.tophat -text [msgcat::mc {Tophat}] \ - -variable smooth(function) -value tophat + -variable smooth(function) -value tophat \ + -command SmoothUpdateDialog ttk::radiobutton $f.gaussian -text [msgcat::mc {Gaussian}] \ - -variable smooth(function) -value gaussian - ttk::label $f.rbtitle -text {width= *radius+1} - ttk::label $f.rttitle -text {diameter=2*radius+1} - ttk::label $f.rgtitle -text {sigma=radius/2} - slider $f.rslider 1 20 {Radius} smooth(radius) {SmoothCheckRadius} - - grid $f.boxcar $f.tophat $f.gaussian -padx 2 -pady 2 -sticky w - grid $f.rbtitle $f.rttitle $f.rgtitle -padx 2 -pady 2 -sticky ew - grid $f.rslider - - -padx 2 -pady 2 -sticky ew + -variable smooth(function) -value gaussian \ + -command SmoothUpdateDialog + ttk::radiobutton $f.elliptic -text [msgcat::mc {Elliptical Gaussian}] \ + -variable smooth(function) -value elliptic \ + -command SmoothUpdateDialog + grid $f.boxcar $f.tophat $f.gaussian $f.elliptic -padx 2 -pady 2 -sticky w + + # boxcar + set f [ttk::labelframe $w.boxcar -text [msgcat::mc {Boxcar}] -padding 2] + ttk::label $f.tdescr -text [msgcat::mc {Width}] + ttk::label $f.descr -text {2*radius+1} + slider $f.slider 1 20 {Radius} smooth(radius) {} + + grid $f.tdescr $f.descr -padx 2 -pady 2 -sticky w + grid $f.slider -columnspan 20 -padx 2 -pady 2 -sticky ew + + # tophat + set f [ttk::labelframe $w.tophat -text [msgcat::mc {Tophat}] -padding 2] + ttk::label $f.tdescr -text [msgcat::mc {Diameter}] + ttk::label $f.descr -text {2*radius+1} + slider $f.slider 1 20 {Radius} smooth(radius) {} + + grid $f.tdescr $f.descr -padx 2 -pady 2 -sticky w + grid $f.slider -columnspan 20 -padx 2 -pady 2 -sticky ew - # Kernal - set f [ttk::labelframe $w.rad -text [msgcat::mc {Kernel}] -padding 2] - ttk::label $f.ktitle -text {width,height=2*size+1; radius<=size} - slider $f.kslider 1 20 {Size} smooth(kernel) {SmoothCheckKernel} + # gaussian + set f [ttk::labelframe $w.gaussian -text [msgcat::mc {Gaussian}] -padding 2] + ttk::label $f.tsigma -text {Sigma} + ttk::entry $f.sigma -textvariable smooth(sigma) -width 7 + ttk::label $f.tdescr -text [msgcat::mc {Diameter}] + ttk::label $f.descr -text {2*radius+1} + slider $f.slider 1 20 {Radius} smooth(radius) {} + + grid $f.tsigma $f.sigma -padx 2 -pady 2 -sticky w + grid $f.tdescr $f.descr -padx 2 -pady 2 -sticky w + grid $f.slider -columnspan 20 -padx 2 -pady 2 -sticky ew + + # elliptical gaussian + set f [ttk::labelframe $w.elliptic -text [msgcat::mc {Elliptical Gaussian}] -padding 2] + ttk::label $f.tdescr -text [msgcat::mc {Diameter}] + ttk::label $f.tsigma -text {Sigma} + ttk::entry $f.sigma -textvariable smooth(sigma) -width 7 + ttk::entry $f.sigmaminor -textvariable smooth(sigma,minor) -width 7 + ttk::label $f.tangle -text {Angle} + ttk::entry $f.angle -textvariable smooth(angle) -width 7 + ttk::label $f.descr -text {2*radius+1} + slider $f.slider 1 20 [msgcat::mc {Major Radius}] smooth(radius) {} + slider $f.slider2 1 20 [msgcat::mc {Minor Radius}] smooth(radius,minor) {} + + grid $f.tsigma $f.sigma $f.sigmaminor -padx 2 -pady 2 -sticky w + grid $f.tangle $f.angle -padx 2 -pady 2 -sticky w + grid $f.tdescr $f.descr -padx 2 -pady 2 -sticky w + grid $f.slider -columnspan 20 -padx 2 -pady 2 -sticky ew + grid $f.slider2 -columnspan 20 -padx 2 -pady 2 -sticky ew - grid $f.ktitle -padx 2 -pady 2 -sticky ew - grid $f.kslider -padx 2 -pady 2 -sticky ew - # Buttons set f [ttk::frame $w.buttons] ttk::button $f.apply -text [msgcat::mc {Apply}] -command SmoothApplyDialog @@ -108,27 +150,38 @@ proc SmoothDialog {} { # Fini grid $w.func -sticky news - grid $w.rad -sticky news - grid $w.buttons -sticky ew grid rowconfigure $w 0 -weight 1 grid rowconfigure $w 1 -weight 1 grid columnconfigure $w 0 -weight 1 + + SmoothUpdateDialog } -proc SmoothCheckRadius {} { +proc SmoothUpdateDialog {} { + global ismooth global smooth + global ds9 - if {$smooth(radius) > $smooth(kernel)} { - set smooth(kernel) $smooth(radius) + if {![winfo exists $ismooth(top)]} { + return } -} -proc SmoothCheckKernel {} { - global smooth + set w $ismooth(top) + set mb $ismooth(mb) - if {$smooth(kernel) < $smooth(radius)} { - set smooth(radius) $smooth(kernel) + grid forget $w.boxcar + grid forget $w.tophat + grid forget $w.gaussian + grid forget $w.elliptic + grid forget $w.buttons + + switch $smooth(function) { + boxcar {grid $w.boxcar -sticky news} + tophat {grid $w.tophat -sticky news} + gaussian {grid $w.gaussian -sticky news} + elliptic {grid $w.elliptic -sticky news} } + grid $w.buttons -sticky ew } proc SmoothApplyDialog {} { @@ -167,7 +220,10 @@ proc UpdateSmoothMenu {} { set smooth(view) [$current(frame) has smooth] set smooth(function) [$current(frame) get smooth function] set smooth(radius) [$current(frame) get smooth radius] - set smooth(kernel) [$current(frame) get smooth kernel] + set smooth(radius,minor) [$current(frame) get smooth radius minor] + set smooth(sigma) [$current(frame) get smooth sigma] + set smooth(sigma,minor) [$current(frame) get smooth sigma minor] + set smooth(angle) [$current(frame) get smooth angle] } } @@ -182,15 +238,18 @@ proc MatchSmoothCurrent {} { proc MatchSmooth {which} { global ds9 global rgb - + set view [$which has smooth] set function [$which get smooth function] set radius [$which get smooth radius] + set minor [$current(frame) get smooth minor] + set sigma [$current(frame) get smooth sigma] + set angle [$current(frame) get smooth angle] foreach ff $ds9(frames) { if {$ff != $which} { if {$view} { - RGBEvalLock rgb(lock,smooth) $ff [list $ff smooth $function $radius] + RGBEvalLock rgb(lock,smooth) $ff [list $ff smooth $function $radius $minor $sigma $angle] } else { RGBEvalLock rgb(lock,smooth) $ff [list $ff smooth delete] } @@ -226,7 +285,10 @@ proc SmoothBackupBase {ch which} { if {[$which has smooth]} { set function [$which get smooth function] set radius [$which get smooth radius] - puts $ch "$which smooth $function $radius" + set minor [$which get smooth minor] + set sigma [$which get smooth sigma] + set angle [$which get smooth angle] + puts $ch "$which smooth $function $radius $minor $sigma $angle" } } @@ -288,19 +350,34 @@ proc ProcessSmoothCmd {varname iname} { } LockSmoothCurrent } + function { + incr i + set smooth(function) [lindex $var $i] + SmoothUpdate + } radius { incr i set smooth(radius) [lindex $var $i] SmoothUpdate } - kernel { + radiusminor { incr i - set smooth(kernel) [lindex $var $i] + set smooth(radius,minor) [lindex $var $i] SmoothUpdate } - function { + sigma { incr i - set smooth(function) [lindex $var $i] + set smooth(sigma) [lindex $var $i] + SmoothUpdate + } + sigmaminor { + incr i + set smooth(sigma,minor) [lindex $var $i] + SmoothUpdate + } + angle { + incr i + set smooth(angle) [lindex $var $i] SmoothUpdate } yes - @@ -330,8 +407,10 @@ proc ProcessSendSmoothCmd {proc id param} { lock {$proc $id [ToYesNo $smooth(lock)]} function {$proc $id "$smooth(function)\n"} radius {$proc $id "$smooth(radius)\n"} - kernel {$proc $id "$smooth(kernel)\n"} + radiusminor {$proc $id "$smooth(radius,minor)\n"} + sigma {$proc $id "$smooth(sigma)\n"} + sigmaminor {$proc $id "$smooth(sigma,minor)\n"} + angle {$proc $id "$smooth(angle)\n"} default {$proc $id [ToYesNo $smooth(view)]} } } - -- cgit v0.12