| TUgridNoise | TCL UTILITIES USER MANUAL | TUgridNoise |
|---|
| TUgridNoise  |
|
| Algorithm | - | The algorithm to apply to the grid.
|
|||||||||
| Grid | - | The input 2D data grid generated by a call to TUdataGrid. | |||||||||
| gInfo | - | The grid information array for the input data grid. | |||||||||
| V1 | - | Optional input the meaning of which depends on the Algorithm selected. Default value is 1. | |||||||||
| V2 | - | Optional input the meaning of which depends on the Algorithm selected. Default value is 0. | |||||||||
| V3 | - | Optional input the meaning of which depends on the Algorithm selected. Default value is 0. |
| NONE |
| 1 | 2 | 3 |
| 4 | X | 5 |
| 6 | 7 | 8 |
# NOISE reduction example
# SET up the grid information array.
set gInfo(0) -6.0
set gInfo(1) 6.0
set gInfo(2) -6.0
set gInfo(3) 6.0
set gInfo(4) 100
set gInfo(5) 100
set gInfo(6) POINT
set gInfo(7) POINT
set gInfo(8) COLUMN
set gInfo(9) IGNORE
set gInfo(10) NEW:ADD:END
set gInfo(11) -1
set gInfo(12) -5
set gInfo(13) -1.0e30
set gInfo(14) 1.0e30
set gInfo(15) NO
set gInfo(16) NO
# SET up a data set of a single Gaussian centered at (0, -0).
set nP 0
set nG [expr $gInfo(4) * $gInfo(5)]
for { set I 0 } { $I < $nG } { incr I } {
TUgridInfo 20 gInfo rV $I
set X($nP) $rV(2)
set Y($nP) $rV(3)
set R [expr $X($nP) * $X($nP) + $Y($nP) * $Y($nP)]
set V($nP) [expr 4.0 * exp(-$R)]
incr nP
}
# GRID the data set
TUdataGrid $nP 1 X X 1 Y Y V gV Norm gInfo
# SET up the plot basics. There are a total of 5 plots defined here.
set GphInfo(xScrL) 500
set GphInfo(yScrL) 760
GraphicsOn TK ETones SWAP
GenWindow 1 0.0 0.0 0.0 1.0 1.0 0.0 0. 0. 0. 1. 1. 0. XY
set WinInfo(2,corFmt) 1
RelWindow 2 1 177.0 515.0 0. 377. 715. 0. -6. -6. 0. 6. 6. 0.
DefinePlot 2 2 $gInfo(4) $gInfo(5)
set WinInfo(4,corFmt) 1
RelWindow 4 1 75.0 290.0 0. 275. 490. 0. -6. -6. 0. 6. 6. 0.
DefinePlot 4 4 $gInfo(4) $gInfo(5)
set WinInfo(5,corFmt) 1
RelWindow 5 1 280.0 290.0 0. 480. 490. 0. -6. -6. 0. 6. 6. 0.
DefinePlot 5 5 $gInfo(4) $gInfo(5)
set WinInfo(6,corFmt) 1
RelWindow 6 1 75.0 65.0 0. 275. 265. 0. -6. -6. 0. 6. 6. 0.
DefinePlot 6 6 $gInfo(4) $gInfo(5)
set WinInfo(7,corFmt) 1
RelWindow 7 1 280.0 65.0 0. 480. 265. 0. -6. -6. 0. 6. 6. 0.
DefinePlot 7 7 $gInfo(4) $gInfo(5)
# SET up the color map to run from 0.0 to 4.0
PLTcolorMap 0.0 4.0 LINEAR 0 cA
# PLOT the gaussian
Plot3D 2 Xb Yb Dummy Dummy gV AUTO Dummy cA
# ADD some white noise to the grid and plot the gaussian with noise
for { set I 0 } { $I < $nG } { incr I } {
set gV($I) [expr $gV($I) + [TUdataRnd1 TmP 1 P 0.5]]
}
Plot3D 4 Xb Yb Dummy Dummy gV AUTO Dummy cA
# REDUCE noise using a CUT of .2 and then plot the results
TUgridNoise CUT gV gInfo 0.2
Plot3D 5 Xb Yb Dummy Dummy gV AUTO Dummy cA
# REDUCE noise using a UNIFORM background subtraction of .3 on the already
# noise reduced grid and then plot the results
TUgridNoise UNIFORM gV gInfo .3
Plot3D 6 Xb Yb Dummy Dummy gV AUTO Dummy cA
# DESPECKLE the already noise reduced grid. Any cell with two or less
# neighbors is removed.
TUgridNoise DESPECKLE gV gInfo 2 .1
Plot3D 7 Xb Yb Dummy Dummy gV AUTO Dummy cA
# THROW up the axis. Only annotate lower left-hand plot
PlotOutlines 2 [list "" 1.0 "" 1.0] [list NONE NONE BOTH BOTH]
PlotOutlines 4 [list "" 1.0 "" 1.0] [list NONE NONE BOTH BOTH]
PlotOutlines 5 [list "" 1.0 "" 1.0] [list NONE NONE BOTH BOTH]
PlotOutlines 6 [list "X" 1.0 "Y" 1.0] [list BOT BOT BOTH BOTH]
PlotOutlines 7 [list "" 1.0 "" 1.0] [list NONE NONE BOTH BOTH]
# LABEL the plots
TextProp 12 HOLD HOLD
WinClip 2 0
TexT 2 0.0 6.50 0.0 center "ORIGINAL" $GphInfo(White)
WinClip 4 0
TexT 4 0.0 6.50 0.0 center "NOISY" $GphInfo(White)
WinClip 5 0
TexT 5 0.0 6.50 0.0 center "CUT AT .2" $GphInfo(White)
WinClip 6 0
TexT 6 0.0 6.50 0.0 center "THEN UNIFORM AT .3" $GphInfo(White)
WinClip 7 0
TexT 7 0.0 6.50 0.0 center "LAST DESPECKLE" $GphInfo(White)
update
| Sept 25, 2006 |
|---|