-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathNM_ROITab.ipf
More file actions
executable file
·843 lines (569 loc) · 21.1 KB
/
NM_ROITab.ipf
File metadata and controls
executable file
·843 lines (569 loc) · 21.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
#pragma rtGlobals=3 // Use modern global access method and strict wave access.
#pragma hide = 1
//****************************************************************
//****************************************************************
//
// ROI Tab for ROI analysis
// To be run with NeuroMatic
// NeuroMatic.ThinkRandom.com
// Code for WaveMetrics Igor Pro
//
// By Jason Rothman ( Jason@ThinkRandom.com )
//
//****************************************************************
//****************************************************************
Static StrConstant tabPrefix = "ROI_"
StrConstant NMROIDF = "root:Packages:NeuroMatic:ROI:"
//****************************************************************
//****************************************************************
//
// ROI Tab Functions
//
//****************************************************************
//****************************************************************
Function /S NMTabPrefix_ROI() // this function allows NM to determine tab name and prefix
return tabPrefix
End // NMTabPrefix_ROI
//****************************************************************
//****************************************************************
Function NMROITab( enable ) // called by ChangeTab
Variable enable // ( 0 ) disable ( 1 ) enable tab
if ( enable == 1 )
CheckNMPackage( "ROI", 1 ) // declare globals if necessary
NMROIMake() // create tab controls if necessary
NMChannelGraphDisable( channel = -2, all = 0 )
NMROIAuto()
endif
NMROIDisplay( -1, enable )
End // NMROITab
//****************************************************************
//****************************************************************
Function NMROITabKill( what ) // called by KillTab
String what
String df = NMROIDF
// KillTab will automatically kill objects that begin with appropriate prefix.
// Place any other things to kill here.
strswitch( what )
case "waves":
// kill any other waves here
break
case "folder":
if ( DataFolderExists( df ) == 1 )
KillDataFolder $df
endif
break
endswitch
End // NMROITabKill
//****************************************************************
//****************************************************************
//
// Variables, Strings, Waves and folders
//
//****************************************************************
//****************************************************************
Function NMROISet( [ currentROI, setNum, xbgn, xend, wavePrefix, history ] )
Variable currentROI // current ROI for display on NM panel and graphs
Variable setNum // ROI number for xbgn, xend, wavePrefix ( pass nothing to get currentROI )
Variable xbgn, xend
String wavePrefix
Variable history // print function command to history ( 0 ) no ( 1 ) yes
Variable foundWin, updateROITab = 0, updateGraphs = 0
String vlist = "", vlistWin = ""
String df = NMROIDF
if ( !ParamIsDefault( currentROI ) )
vlist = NMCmdNumOptional( "currentROI", currentROI, vlist )
if ( ( numtype( currentROI ) > 0 ) || ( currentROI < 0 ) )
return NM2Error( 10, "currentROI", num2str( currentROI ) )
endif
SetNMvar( df + "CurrentROI", currentROI )
NMROICheck()
updateGraphs = 1
endif
if ( ParamIsDefault( setNum ) )
setNum = NumVarOrDefault( df + "CurrentROI", NaN )
endif
vlistWin = NMCmdNumOptional( "setNum", setNum, "", integer = 1 )
if ( !ParamIsDefault( xbgn ) )
vlistWin = NMCmdNumOptional( "xbgn", xbgn, vlistWin )
if ( numtype( setNum ) > 0 )
return NM2Error( 10, "setNum", num2str( setNum ) )
endif
//si.xbgn[ win ] = z_CheckXbgn( xbgn )
Wave wtemp = $df + "wleft"
wtemp[ setNum ] = z_CheckXend( xbgn )
updateGraphs = 1
foundWin = 1
endif
if ( !ParamIsDefault( xend ) )
vlistWin = NMCmdNumOptional( "xend", xend, vlistWin )
if ( numtype( setNum ) > 0 )
return NM2Error( 10, "setNum", num2str( setNum ) )
endif
//si.xend[ win ] = z_CheckXend( xend )
Wave wtemp = $df + "wright"
wtemp[ setNum ] = z_CheckXend( xend )
updateGraphs = 1
foundWin = 1
endif
if ( !ParamIsDefault( wavePrefix ) )
vlistWin = NMCmdStrOptional( "wavePrefix", wavePrefix, vlistWin )
if ( numtype( setNum ) > 0 )
return NM2Error( 10, "setNum", num2str( setNum ) )
endif
Wave /T stemp = $df + "WavePrefixes"
stemp[ setNum ] = wavePrefix
foundWin = 1
endif
if ( history )
if ( foundWin )
NMCommandHistory( vlist + vlistWin )
else
NMCommandHistory( vlist )
endif
endif
if ( updateGraphs )
//StatsChanControlsUpdate( -1, -1, 1 )
//NMChanGraphUpdate()
NMROIDisplay( -1, 1 )
endif
NMROIUpdate()
//if ( statsAuto )
//NMStatsAuto()
//elseif ( updateStatsTab )
//UpdateStats()
//endif
End // NMROISet
//****************************************************************
//****************************************************************
Static Function z_CheckXbgn( xbgn )
Variable xbgn
if ( numtype( xbgn ) > 0 )
return -inf
else
return xbgn
endif
End // z_CheckXbgn
//****************************************************************
//****************************************************************
Static Function z_CheckXend( xend )
Variable xend
if ( numtype( xend ) > 0 )
return inf
else
return xend
endif
End // z_CheckXend
//****************************************************************
//****************************************************************
Function CheckNMROILineScanSelect( select )
Variable select
if ( select == -1 )
select = NumVarOrDefault( NMROIDF + "LineScanSelect", 0 ) // currently selected line scan
endif
if ( ( numtype( select ) > 0 ) || ( select < 0 ) )
NM2Error( 10, "select", num2istr( select ) )
return Nan
endif
CheckNMROIWaves( 0, pointsAtLeast = ( select + 1 ), errorAlert = 1 )
return select
End // CheckNMROILineScanSelect
//****************************************************************
//****************************************************************
Function NMROICheck() // declare global variables
Variable currentROI
String df = NMROIDF
if ( DataFolderExists( df ) == 0 )
return -1 // folder doesnt exist
endif
CheckNMvar( df + "CurrentROI", 0 )
CheckNMvar( df + "Vleft", -inf )
CheckNMvar( df + "Vtop", -inf )
CheckNMvar( df + "Vright", inf )
CheckNMvar( df + "Vbottom", inf )
CheckNMstr( df + "WavePrefix", "ROI" )
currentROI = NumVarOrDefault( df + "CurrentROI", 0 )
CheckNMROIWaves( 0, pointsAtLeast = ( currentROI + 1 ), errorAlert = 1 )
return 0
End // NMROICheck
//****************************************************************
//****************************************************************
Function CheckNMROIWaves( reset [ df, pointsAtLeast, errorAlert ] )
Variable reset
String df
Variable pointsAtLeast
Variable errorAlert
Variable icnt, points = 1
if ( ParamIsDefault( df ) )
df = NMROIDF
endif
if ( !DataFolderExists( df ) )
return -1
endif
if ( WaveExists( $df + "wleft" ) )
points = numpnts( $df + "wleft" )
endif
points = max( points, pointsAtLeast )
CheckNMROIWave( "wleft", -inf, reset, points = points )
CheckNMROIWave( "wright", inf, reset, points = points )
CheckNMROIWaveT( "WavePrefixes", "", reset, points = points )
Wave /T wprefix = $df + "WavePrefixes"
for ( icnt = 0 ; icnt < numpnts( wprefix ) ; icnt += 1 )
if ( strlen( wprefix[ icnt ] ) == 0 )
wprefix[ icnt ] = "ROI" + num2istr( icnt )
endif
endfor
return 0
End // CheckNMROIWaves
//****************************************************************
//****************************************************************
Function CheckNMROIWave( wName, value, reset [ points ] )
String wName // wave name
Variable value
Variable reset
Variable points
String df = NMROIDF
if ( strlen( wName ) == 0 )
return NM2Error( 21, "wName", wName )
endif
if ( !DataFolderExists( df ) )
return NM2Error( 30, "ROIDF", df )
endif
if ( ParamIsDefault( points ) )
points = 1
endif
if ( reset )
return SetNMwave( df + wName, -1, value )
else
return CheckNMWaveOfType( df + wName, points, value, "R" )
endif
End // CheckNMROIWave
//****************************************************************
//****************************************************************
Function CheckNMROIWaveT( wName, strvalue, reset [ points ] )
String wName // wave name
String strvalue
Variable reset
Variable points
String df = NMROIDF
if ( strlen( wName ) == 0 )
return NM2Error( 21, "wName", wName )
endif
if ( !DataFolderExists( df ) )
return NM2Error( 30, "ROIDF", df )
endif
if ( ParamIsDefault( points ) )
points = 1
endif
if ( reset )
return SetNMtwave( df + wName, -1, strvalue )
else
return CheckNMtwave( df + wName, points, strvalue )
endif
End // CheckNMROIWaveT
//****************************************************************
//****************************************************************
Function NMROIConfigs()
//NMConfigVar( tabName, "DumVar", 11, "dummy variable", "units" )
//NMConfigStr( tabName, "DumStr", "Anything", "dummy text variable", "units" )
//NMConfigWave( tabName, "DumWave", 5, 22, "dummy wave" )
//NMConfigTWave( tabName, "DumTxtWave", 5, "anything", "dummy text wave" )
End // NMROIConfigs
//****************************************************************
//****************************************************************
//
// Tab Panel Functions
//
//****************************************************************
//****************************************************************
Function NMROIAuto()
NMROIUpdate()
End // NMROIAuto
//****************************************************************
//****************************************************************
Function NMROIMake()
Variable x0 = 50, xinc, yinc = 60, fs = NMPanelFsize
Variable y0 = NMPanelTabY + 80
String df = NMROIDF
ControlInfo /W=$NMPanelName $"ROI_AllWaves"
if ( V_Flag != 0 )
return 0 // tab controls exist, return here
endif
DoWindow /F $NMPanelName
x0 = 90
xinc = 150
y0 = NMPanelTabY + 60
yinc = 27
SetVariable ROI_NumSet, title="ROI #", pos={x0,y0+0*yinc}, size={115,50}, limits={0,9999,1}, fsize=fs, format = "%d", win=$NMPanelName
SetVariable ROI_NumSet, value=$df+"CurrentROI", proc=NMROISetVariable, win=$NMPanelName
SetVariable ROI_VleftSet, title="xbgn", pos={x0,y0+1*yinc}, size={115,50}, limits={-inf,inf,1}, fsize=fs, format = "%d", win=$NMPanelName
SetVariable ROI_VleftSet, value=$df+"vleft", proc=NMROISetVariable, win=$NMPanelName
SetVariable ROI_VrightSet, title="xend", pos={x0,y0+2*yinc}, size={115,50}, limits={-inf,inf,1}, fsize=fs, format = "%d", win=$NMPanelName
SetVariable ROI_VrightSet, value=$df+"vright", proc=NMROISetVariable, win=$NMPanelName
SetVariable ROI_PrefixSet, title="wave prefix", pos={x0,y0+3*yinc}, size={115,50}, fsize=fs, win=$NMPanelName
SetVariable ROI_PrefixSet, value=$df+"WavePrefix", proc=NMROISetVariable, win=$NMPanelName
Button ROI_AllWaves, title="All Waves", pos={x0,y0+5*yinc}, size={100,20}, proc=NMROIButton, fsize=fs, win=$NMPanelName
NMROIUpdate()
End // NMROIMake
//****************************************************************
//****************************************************************
Function NMROIUpdate()
Variable xleft, xright, lx, rx, updateDisplay
String df = NMROIDF
Variable num = NumVarOrDefault( df+"CurrentROI", 0 )
String dName = ChanDisplayWave( -1 )
Wave wleft = $df+"wleft"
Wave wright = $df+"wright"
Wave /T wprefix = $df+"WavePrefixes"
if ( ( numtype( num ) == 0 ) && ( num >= 0 ) && ( num < numpnts( wleft ) ) )
xleft = wleft[ num ]
xright = wright[ num ]
if ( numtype( xleft ) > 0 )
lx = leftx( $dName )
rx = rightx( $dName )
xleft = lx + 0.4 * ( rx - lx ) // move to center
wleft[ num ] = xleft
updateDisplay = 1
endif
if ( numtype( xright ) > 0 )
lx = leftx( $dName )
rx = rightx( $dName )
xright = rx - 0.4 * ( rx - lx ) // move to center
wright[ num ] = xright
updateDisplay = 1
endif
SetNMvar( df+"vleft", xleft )
SetNMvar( df+"vright", xright )
SetNMstr( df+"WavePrefix", wprefix[ num ] )
if ( updateDisplay )
NMROIDisplay( -1, 1 )
endif
endif
End // NMROIUpdate
//****************************************************************
//****************************************************************
Function NMROIButton( ctrlName ) : ButtonControl
String ctrlName
String fxn = ReplaceString( tabPrefix, ctrlName, "" )
NMROICall( fxn, "" )
End // NMROIButton
//****************************************************************
//****************************************************************
Function NMROISetVariable( ctrlName, varNum, varStr, varName ) : SetVariableControl
String ctrlName; Variable varNum; String varStr; String varName
String fxn = ReplaceString( tabPrefix, ctrlName, "" )
NMROICall( fxn, varStr )
End // NMROISetVariable
//****************************************************************
//****************************************************************
Function NMROICall( fxn, select )
String fxn // function name
String select // parameter string variable
Variable error
Variable snum = str2num( select ) // parameter variable number
strswitch( fxn )
case "NumSet":
error = NMROISet( currentROI = snum, history = 1 )
break
case "VleftSet":
error = NMROISet( xbgn = snum, history = 1 )
break
case "VrightSet":
error = NMROISet( xend = snum, history = 1 )
break
case "PrefixSet":
error = NMROISet( wavePrefix = select, history = 1 )
break
case "AllWaves":
case "All Waves":
NMROICompute( history = 1 )
break
endswitch
End // NMROICall
//****************************************************************
//****************************************************************
//
// Channel Graph Functions
//
//****************************************************************
//****************************************************************
Function NMROIDisplay( chan, appnd )
Variable chan // channel number ( -1 ) for current channel
Variable appnd // 1 - append wave; 0 - remove wave
Variable ccnt, drag = appnd
String gName, sname
String df = NMROIDF
if ( !DataFolderExists( df ) )
return 0
endif
if ( !StringMatch( CurrentNMTabName(), "ROI" ) )
drag = 0
endif
for ( ccnt = 0 ; ccnt < NMNumChannels() ; ccnt += 1 )
gName = ChanGraphName( ccnt )
if ( Wintype( gName ) == 0 )
continue // window does not exist
endif
RemoveFromGraph /Z/W=$gName DragBgnY, DragEndY
endfor
gName = ChanGraphName( chan )
sName = NMChanWaveName( chan, 0 )
if ( DimSize( $sName, 1 ) == 0 )
drag = 0
endif
NMDragEnable( drag, "DragBgn", df+"wleft", df+"CurrentROI", "", gName, "bottom", "min", 65535, 0, 0 )
NMDragEnable( drag, "DragEnd", df+"wright", df+"CurrentROI", "", gName, "bottom", "max", 65535, 0, 0 )
if ( !appnd )
//NMROIRemoveDisplayWaves()
endif
End // NMROIDisplay
//****************************************************************
//****************************************************************
Function NMROIDragClear()
NMDragClear( "DragBgn" )
NMDragClear( "DragEnd" )
NMDragClear( "DragBslnBgn" )
NMDragClear( "DragBslnEnd" )
End // NMFitDragClear
//****************************************************************
//****************************************************************
Function NMROICompute( [ chanSelectList, waveSelectList, windowList, graph, history ] )
String chanSelectList // channel select list ( e.g. "A;B;" )
String waveSelectList // wave select list ( e.g. "Set1;Set2;" )
String windowList // window number list ( e.g. "0;1;2;" or "All" )
Variable graph // plot output waves
Variable history // print function command to history ( 0 ) no ( 1 ) yes
Variable icnt, ccnt, channel, wcnt, jcnt, win, xbgn, xend
Variable xpnts, ypnts, xcnt, ycnt, xsum, xcount
String wName, outName, newPrefix, wavePrefix
Variable chanSelectListItems, waveSelectListItems
String chanSelectStr, progressStr, vlist = ""
String df = NMROIDF
Wave wleft = $df + "wleft"
Wave wright = $df + "wright"
Wave /T wprefix = $df + "WavePrefixes"
if ( ParamIsDefault( chanSelectList ) )
chanSelectList = NMChanSelectAllList()
else
vlist = NMCmdStrOptional( "chanSelectList", chanSelectList, vlist )
endif
if ( StringMatch( chanSelectList, "All" ) )
chanSelectList = NMChanSelectAllList()
endif
chanSelectListItems = ItemsInList( chanSelectList )
if ( ParamIsDefault( waveSelectList ) )
waveSelectList = NMWaveSelectAllList()
else
vlist = NMCmdStrOptional( "waveSelectList", waveSelectList, vlist )
endif
if ( StringMatch( waveSelectList, "All" ) )
waveSelectList = NMWaveSelectAllList()
endif
waveSelectListItems = ItemsInList( waveSelectList )
if ( ParamIsDefault( windowList ) )
windowList = "All" // NMStatsWinList( 1, "" ) // all windows
else
vlist = NMCmdStrOptional( "windowList", windowList, vlist )
endif
if ( StringMatch( windowList, "All" ) )
windowList = ""
for ( icnt = 0 ; icnt < numpnts( wleft ) ; icnt += 1 )
windowList += num2istr( icnt ) + ";"
endfor
endif
if ( ParamIsDefault( graph ) )
graph = 1
else
vlist = NMCmdNumOptional( "graph", graph, vlist, integer = 1 )
endif
if ( history )
NMCommandHistory( vlist )
endif
Variable numWaves = NMNumWaves()
String saveChanSelectStr = NMChanSelectStr()
String waveSelect = NMWaveSelectGet()
String saveWaveSelect = waveSelect
Variable saveCurrentWave = CurrentNMWave()
Variable waveLengthFormat = NMStatsVarGet( "WaveLengthFormat" )
for ( icnt = 0 ; icnt < max( waveSelectListItems, 1 ) ; icnt += 1 ) // loop thru sets / groups
if ( waveSelectListItems > 0 )
waveSelect = StringFromList( icnt, waveSelectList )
if ( !StringMatch( waveSelect, NMWaveSelectGet() ) )
NMWaveSelect( waveSelect )
endif
endif
if ( NMNumActiveWaves() <= 0 )
continue
endif
for ( ccnt = 0 ; ccnt < max( chanSelectListItems, 1 ) ; ccnt += 1 ) // loop thru channels
if ( chanSelectListItems > 0 )
chanSelectStr = StringFromList( ccnt, chanSelectList )
if ( !StringMatch( chanSelectStr, CurrentNMChanChar() ) )
NMChanSelect( chanSelectStr )
DoUpdate
endif
endif
channel = CurrentNMChannel()
//outputWaveList += StatsWavesMake( DEFAULTSUBFOLDER, channel, windowList )
progressStr = "Line Scan Chan " + ChanNum2Char( channel )
for ( wcnt = 0; wcnt < numWaves; wcnt += 1 ) // loop thru waves
if ( NMProgress( wcnt, numWaves, progressStr ) == 1 )
break
endif
wName = NMWaveSelected( channel, wcnt )
if ( strlen( wName ) == 0 )
continue // wave not selected, or does not exist... go to next wave
endif
NMCurrentWaveSet( wcnt )
DoUpdate
Wave wtemp = $wName
for ( jcnt = 0 ; jcnt < ItemsInList( windowList ) ; jcnt += 1 ) // loop thru line scans windows
win = str2num( StringFromList( jcnt, windowList ) )
xbgn = wleft[ win ]
xend = wright[ win ]
wavePrefix = wprefix[ win ]
xpnts = DimSize( wtemp, 0 )
ypnts = DimSize( wtemp, 1 )
if ( ( numtype( xbgn ) > 0 ) || ( xbgn < 0 ) || ( xbgn >= xpnts ) )
continue
endif
if ( ( numtype( xend ) > 0 ) || ( xend < 0 ) || ( xend >= xpnts ) )
continue
endif
//newPrefix = wavePrefix + num2str( win ) + "_"
newPrefix = wavePrefix
if ( strlen( newPrefix ) == 0 )
newPrefix = "ROI" + num2istr( win ) + "_"
endif
outName = newPrefix + CurrentNMChanChar() + num2istr( wcnt )
Make /O/N=( ypnts ) $outName = NaN
Wave otemp = $outName
for ( ycnt = 0 ; ycnt < ypnts ; ycnt += 1 )
xcount = 0
xsum = 0
for ( xcnt = xbgn ; xcnt <= xend ; xcnt += 1 )
xsum += wtemp[ xcnt ][ ycnt ]
xcount += 1
endfor
otemp[ ycnt ] = xsum / xcount
endfor
NMPrefixAdd( newPrefix )
endfor
endfor
if ( NMProgressCancel() == 1 )
break
endif
endfor
if ( NMProgressCancel() == 1 )
break
endif
endfor
if ( chanSelectListItems > 0 )
NMChanSelect( saveChanSelectStr, update = 0 )
endif
if ( waveSelectListItems > 0 )
NMWaveSelect( saveWaveSelect, update = 0 )
endif
NMCurrentWaveSet( saveCurrentWave, update = 0 )
End // NMROICompute
//****************************************************************
//****************************************************************