168function /s ad_display_profiles(image, [filter])
171 variable show_legend = 0 // currently not supported
173 if (WaveDims(image) != 2)
174 abort "ad_display_profiles: image wave must be two-dimensional."
176 if (ParamIsDefault(filter))
177 filter = "ad_box_filter"
180 // data folders and references
181 dfref savedf = GetDataFolderDFR()
182 dfref imagedf = GetWavesDataFolderDFR(image)
183 string s_imagedf = GetDataFolder(1, imagedf)
184 setdatafolder imagedf
185 string s_viewdf = PearlCleanupName("view_" + NameOfWave(image))
186 newdatafolder /o/s $s_viewdf
187 dfref viewdf = GetDataFolderDFR()
188 s_viewdf = GetDataFolder(1, viewdf)
191 string /g sourcepath = GetWavesDataFolder(image, 2)
192 string viewname = "view_image"
193 duplicate /o image, $viewname /wave=view
194 make /n=(3,3)/o xprofiles // NX x 3 wave with 3 one-dimensional profiles along Y dimension
195 make /n=(3,3)/o yprofiles // NY x 3 wave with 3 one-dimensional profiles along X dimension
196 string /g view_filter
197 string /g view_filter_options
199 view_filter_options = ""
200 variable /g view_filter_smoothing_x = 1
201 variable /g view_filter_smoothing_y = 1
202 variable /g view_cursor_mode = 0
203 string dfname = ReplaceString("root:", GetDataFolder(1, imagedf), "")
204 string graphtitle = dfname + NameOfWave(image) + " Profiles"
205 string /g prof_graphname = graphname_from_dfref(imagedf, "prof_")
206 svar graphname = prof_graphname
207 variable /g graph_avg // average value in ROI (ROI is defined by the crosshairs A and B)
208 variable /g graph_min // minimum value in ROI
209 variable /g graph_max // maximum value in ROI
210 variable /g graph_sum // sum of all values in ROI
211 variable /g graph_sdev // standard deviation of all values in ROI
214 display /k=1 /n=$graphname /w=(100,100,500,400) as graphtitle
216 AppendToGraph /w=$graphname /L=xprofiles xprofiles[*][0],xprofiles[*][1],xprofiles[*][2]
217 AppendToGraph /w=$graphname /VERT/B=yprofiles yprofiles[*][0],yprofiles[*][1],yprofiles[*][2]
218 AppendImage /w=$graphname view
219 string imgname = StringFromList(0, ImageNameList(graphname, ";"))
220 ModifyImage /w=$graphname $imgname ctab= {*,*,BlueGreenOrange,0}
221 ModifyGraph /w=$graphname rgb(xprofiles)=(39168,0,0),rgb(yprofiles)=(39168,0,0)
222 ModifyGraph /w=$graphname rgb(xprofiles#1)=(0,26112,0),rgb(yprofiles#1)=(0,26112,0)
223 ModifyGraph /w=$graphname rgb(xprofiles#2)=(0,9472,39168),rgb(yprofiles#2)=(0,9472,39168)
224 ModifyGraph /w=$graphname mirror(xprofiles)=2,mirror(bottom)=3,mirror(yprofiles)=2,mirror(left)=3
225 ModifyGraph /w=$graphname nticks=3
226 ModifyGraph /w=$graphname minor=1
227 ModifyGraph /w=$graphname axThick=0.5
228 ModifyGraph /w=$graphname lblPosMode=1,lblPos=30,lblMargin=0
229 ModifyGraph /w=$graphname btLen=4
230 ModifyGraph /w=$graphname freePos(xprofiles)=0
231 ModifyGraph /w=$graphname freePos(yprofiles)=0
232 ModifyGraph /w=$graphname axisEnab(xprofiles)={0.64,1}
233 ModifyGraph /w=$graphname axisEnab(bottom)={0,0.6}
234 ModifyGraph /w=$graphname axisEnab(yprofiles)={0.64,1}
235 ModifyGraph /w=$graphname axisEnab(left)={0,0.6}
236 ModifyGraph /w=$graphname zero(left)=8
237 ModifyGraph /w=$graphname margin(left)=40,margin(bottom)=30,margin(top)=20,margin(right)=40
238 ModifyGraph /w=$graphname gfSize=10
241 string labels = note(image)
243 lab = StringByKey("AxisLabelX", labels, "=", "\r")
247 Label /w=$graphname bottom lab + " (\\U)"
248 lab = StringByKey("AxisLabelY", labels, "=", "\r")
252 Label /w=$graphname left lab + " (\\U)"
253 lab = StringByKey("AxisLabelD", labels, "=", "\r")
257 Label /w=$graphname xprofiles lab + " (\\U)"
258 Label /w=$graphname yprofiles lab + " (\\U)"
262 Legend /w=$graphname/C/N=text0/J/F=2/D=0.5/T={28}/A=RT/X=0.00/Y=0.00 "\\s(xprofiles)\tprofile A"
263 AppendText /w=$graphname "\\s(xprofiles#1)\tprofile B"
264 AppendText /w=$graphname "\\s(xprofiles#2)\tROI average"
265 AppendText /w=$graphname "min\t\\{" + s_viewdf + "graph_min}"
266 AppendText /w=$graphname "max\t\\{" + s_viewdf + "graph_max}"
267 AppendText /w=$graphname "sum\t\\{" + s_viewdf + "graph_sum}"
268 AppendText /w=$graphname "avg\t\\{" + s_viewdf + "graph_avg}"
269 AppendText /w=$graphname "sdev\t\\{" + s_viewdf + "graph_sdev}"
271 TextBox /w=$graphname /C/N=text0 /F=0 /B=1 /X=1.00 /Y=1.00
272 lab = StringByKey("Dataset", labels, "=", "\r")
274 AppendText /w=$graphname lab
276 AppendText /w=$graphname "sum\t\\{" + s_viewdf + "graph_sum}"
277 AppendText /w=$graphname "avg\t\\{" + s_viewdf + "graph_avg}"
278 AppendText /w=$graphname "sdev\t\\{" + s_viewdf + "graph_sdev}"
281 // interactive elements
282 Cursor /w=$graphname /A=1 /P /I /S=2 /H=1 /L=1 A $imgname 0,0
283 Cursor /w=$graphname /A=1 /P /I /S=2 /H=1 /L=1 B $imgname DimSize(view, 0)-1, DimSize(view, 1)-1
285 pcurs = floor(DimSize(xprofiles, 0) / 3)
286 Cursor /w=$graphname /A=0 /P /S=1 /H=0 C xprofiles#2 pcurs
287 pcurs = floor(DimSize(xprofiles, 0) * 2 / 3)
288 Cursor /w=$graphname /A=0 /P /S=1 /H=0 D xprofiles#2 pcurs
289 pcurs = floor(DimSize(yprofiles, 0) / 3)
290 Cursor /w=$graphname /A=0 /P /S=1 /H=0 E yprofiles#2 pcurs
291 pcurs = floor(DimSize(yprofiles, 0) * 2 / 3)
292 Cursor /w=$graphname /A=0 /P /S=1 /H=0 F yprofiles#2 pcurs
293 ShowInfo /w=$graphname /CP=0
295 SetWindow $graphname, hook(ad_profiles_hook)=ad_profiles_hook
296 ControlBar /w=$graphname 21
297 Button b_reset_cursors win=$graphname, title="reset cursors",pos={0,0},size={70,20},proc=PearlAreaDisplay#bp_reset_cursors
298 Button b_reset_cursors win=$graphname, fColor=(65535,65535,65535),fSize=10
300 SetVariable sv_smoothing_x win=$graphname, title="X smoothing",pos={130,2},bodyWidth=40
301 SetVariable sv_smoothing_x win=$graphname, value=view_filter_smoothing_x,limits={1,100,1}
302 SetVariable sv_smoothing_x win=$graphname, proc=PearlAreaDisplay#svp_smoothing
303 SetVariable sv_smooting_y win=$graphname, title="Y smoothing",pos={240,2},bodyWidth=40
304 SetVariable sv_smooting_y win=$graphname, value=view_filter_smoothing_y,limits={1,100,1}
305 SetVariable sv_smooting_y win=$graphname, proc=PearlAreaDisplay#svp_smoothing
307 PopupMenu pm_export win=$graphname, mode=0,title="Export"
308 PopupMenu pm_export win=$graphname, value="X profile;Y profile;X profile (collate);Y profile (collate)"
309 PopupMenu pm_export win=$graphname, pos={308,0},bodyWidth=60,proc=PearlAreaDisplay#pmp_export
310 PopupMenu pm_export win=$graphname, help={"Export profile of selected area and display in graph. Collate mode = display all profiles in same graph."}
313 ad_update_profiles(image)
331function /wave ad_add_overlay(image, [rgba])
335 if (ParamIsDefault(rgba))
336 rgba = "65535,65532,16385,32767"
337 elseif (ItemsInList(rgba, ",") == 3)
341 dfref savedf = GetDataFolderDFR()
342 wave view_image = get_view_image(image)
343 dfref viewdf = GetWavesDataFolderDFR(view_image)
344 svar /sdfr=viewdf graphname = prof_graphname
347 string overlayname = "view_overlay"
348 duplicate /o image, $overlayname /wave=overlay
349 redimension /b/u overlay
352 string imagenames = ImageNameList(graphname, ";")
353 if (whichlistItem(overlayname, imagenames, ";") < 0)
354 AppendImage /w=$graphname $overlayname
355 rgba = replacestring("(", rgba, "")
356 rgba = replacestring(")", rgba, "")
357 variable rr = str2num(StringFromList(0, rgba, ","))
358 variable gg = str2num(StringFromList(1, rgba, ","))
359 variable bb = str2num(StringFromList(2, rgba, ","))
360 variable aa = str2num(StringFromList(3, rgba, ","))
361#if IgorVersion() >= 8
362 ModifyImage /w=$graphname $overlayname explicit=1,eval={0,rr,gg,bb,aa},eval={255,-1,-1,-1}
364 ModifyImage /w=$graphname $overlayname explicit=1,eval={0,rr,gg,bb},eval={255,-1,-1,-1}
429function ad_profiles_cursor_mode(image, mode)
433 dfref savedf = GetDataFolderDFR()
434 wave view_image = get_view_image(image)
435 dfref viewdf = GetWavesDataFolderDFR(view_image)
436 svar /sdfr=viewdf graphname = prof_graphname
437 nvar /sdfr=viewdf cursor_mode = view_cursor_mode
438 wave /sdfr=viewdf xprofiles, yprofiles
440 variable dx = DimSize(view_image, 0)
441 variable dy = DimSize(view_image, 1)
443 case 1: // background selection
444 Cursor /w=$graphname /A=0 /P /I /S=2 /H=1 /L=1 A view_image 0, 0
445 Cursor /w=$graphname /A=0 /P /I /S=2 /H=1 /L=1 B view_image dx-1, dy-1
446 Cursor /w=$graphname /A=0 /P /I /S=2 /H=2 /L=1 C view_image round(0.2 * dx) -1, 0
447 Cursor /w=$graphname /A=0 /P /I /S=2 /H=2 /L=1 D view_image round(0.8 * dx) -1, 0
448 Cursor /w=$graphname /A=0 /P /I /S=2 /H=2 /L=1 E view_image round(0.4 * dx) -1, 0
449 Cursor /w=$graphname /A=0 /P /I /S=2 /H=2 /L=1 F view_image round(0.6 * dx) -1, 0
451 ShowInfo /w=$graphname /CP=0
455 Cursor /w=$graphname /A=1 /P /I /S=2 /H=1 /L=1 A view_image 0,0
456 Cursor /w=$graphname /A=1 /P /I /S=2 /H=1 /L=1 B view_image dx-1, dy-1
458 pcurs = floor(DimSize(xprofiles, 0) / 3)
459 Cursor /w=$graphname /A=0 /P /S=1 /H=0 C xprofiles#2 pcurs
460 pcurs = floor(DimSize(xprofiles, 0) * 2 / 3)
461 Cursor /w=$graphname /A=0 /P /S=1 /H=0 D xprofiles#2 pcurs
462 pcurs = floor(DimSize(yprofiles, 0) / 3)
463 Cursor /w=$graphname /A=0 /P /S=1 /H=0 E yprofiles#2 pcurs
464 pcurs = floor(DimSize(yprofiles, 0) * 2 / 3)
465 Cursor /w=$graphname /A=0 /P /S=1 /H=0 F yprofiles#2 pcurs
466 ShowInfo /w=$graphname /CP=0
542function ad_profiles_crosshairs(image, [clear])
546 if (ParamIsDefault(clear))
550 // data folders and references
551 wave view_image = get_view_image(image)
552 dfref viewdf = GetWavesDataFolderDFR(view_image)
553 svar /sdfr=viewdf graphname = prof_graphname
555 string cursors = "A;B"
556 string colors = "39168,0,0;0,26112,0"
561 string groupname = "crosshairs"
566 SetDrawEnv /W=$graphname push
567 DrawAction /w=$graphname getgroup=$groupname, delete, begininsert
568 SetDrawEnv /w=$graphname gstart, gname=$groupname
570 SetDrawEnv /W=$graphname dash=4
571 SetDrawEnv /W=$graphname linethick=0.5
573 ncursors = ItemsInList(cursors, ";")
574 for (icursor=0; icursor < ncursors; icursor += 1)
575 cursorname = StringFromList(icursor, cursors, ";")
576 color = StringFromList(icursor, colors, ";")
577 rgb.red = str2num(StringFromList(0, color, ","))
578 rgb.green = str2num(StringFromList(1, color, ","))
579 rgb.blue = str2num(StringFromList(2, color, ","))
580 if (strlen(CsrInfo($cursorname, graphname)) > 0)
581 xx = hcsr($cursorname, graphname)
582 yy = vcsr($cursorname, graphname)
583 SetDrawEnv /W=$graphname linefgc=(rgb.red, rgb.green, rgb.blue)
584 SetDrawEnv /W=$graphname save
585 SetDrawEnv /W=$graphname xcoord=bottom, ycoord=prel
586 DrawLine /W=$graphname xx, 0, xx, 1
587 SetDrawEnv /W=$graphname xcoord=prel, ycoord=left
588 DrawLine /W=$graphname 0, yy, 1, yy
592 SetDrawEnv /w=$graphname gstop
593 DrawAction /w=$graphname endinsert
594 SetDrawEnv /W=$graphname pop
595 SetDrawEnv /W=$graphname save
597 DrawAction /w=$graphname getgroup=$groupname, delete
834function ad_calc_profiles(image, pa, qa, pb, qb)
839 dfref savedf = GetDataFolderDFR()
840 dfref imagedf = GetWavesDataFolderDFR(image)
841 setdatafolder imagedf
851 // horizontal profiles at crosshairs
852 redimension /n=(dimsize(image,0), 3) xprofiles
853 setscale /p x dimoffset(image,0), dimdelta(image,0), WaveUnits(image,0), xprofiles
854 setscale d 0, 0, waveunits(image,-1), xprofiles
855 xprofiles[][0] = image[p][qa]
856 xprofiles[][1] = image[p][qb]
859 note xprofiles, "SourceWave=" + nameofwave(image)
860 note xprofiles, "SourceDimension=0"
861 note xprofiles, "SourceIndex0=" + num2str(qa)
862 note xprofiles, "SourceIndex1=" + num2str(qb)
864 // average horizontal profile between crosshairs
869 for (qq = q0; qq <= q1; qq += 1)
870 xprofiles[][2] += image[p][qq]
872 xprofiles[][2] /= q1 - q0 + 1
874 // vertical profiles at crosshairs
875 redimension /n=(dimsize(image,1), 3) yprofiles
876 setscale /p x dimoffset(image,1), dimdelta(image,1), WaveUnits(image,1), yprofiles
877 setscale d 0, 0, waveunits(image,-1), yprofiles
878 yprofiles[][0] = image[pa][p]
879 yprofiles[][1] = image[pb][p]
882 note yprofiles, "SourceWave=" + nameofwave(image)
883 note yprofiles, "SourceDimension=1"
884 note yprofiles, "SourceIndex0=" + num2str(pa)
885 note yprofiles, "SourceIndex1=" + num2str(pb)
887 // average vertical profile between crosshairs
892 for (pp = p0; pp <= p1; pp += 1)
893 yprofiles[][2] += image[pp][p]
895 yprofiles[][2] /= p1 - p0 + 1
897 // statistics between crosshairs
898 Duplicate /r=[p0,p1][q0,q1]/o image, roi_image
899 WaveStats /Q roi_image
903 graph_sum = v_avg * v_npnts
908 if (waveexists(hist))
909 Histogram /B=3 roi_image, hist
936function ad_export_profile(view_image, dim, [trace, show, overwrite])
943 dfref savedf = GetDataFolderDFR()
945 if (ParamIsDefault(trace))
948 if (ParamIsDefault(show))
951 if (ParamIsDefault(overwrite))
956 dfref imagedf = GetWavesDataFolderDFR(view_image)
960 wave /sdfr=imagedf profiles=xprofiles
964 wave /sdfr=imagedf profiles=yprofiles
968 return -1 // invalid argument
970 string graphname_string = "export_graph_" + dim_label
971 svar /z /sdfr=imagedf linked_graphname = $graphname_string
974 wave /z source_image = get_source_image(view_image)
975 if (WaveExists(source_image))
976 dfref sourcedf = GetWavesDataFolderDFR(source_image)
977 setdatafolder sourcedf
979 return -2 // invalid source data folder
982 // format dest wave name
983 string profile_note = note(profiles)
988 variable index_width = ceil(log(DimSize(view_image, 1 - dim)))
989 variable index0 = NumberByKey("SourceIndex0", profile_note, "=", "\r")
990 variable index1 = NumberByKey("SourceIndex1", profile_note, "=", "\r")
991 name_dim = "_" + dim_label
992 sprintf name_index, "%0*u_%0*u", index_width, index0, index_width, index1
993 name_base = NameOfWave(source_image)
994 name_base = name_base[0, min(strlen(name_base), 31 - strlen(name_index) - strlen(name_dim) - 1)]
995 profile_name = name_base + name_dim + name_index
996 if ((overwrite == 0) && (CheckName(profile_name, 1)))
997 profile_name = UniqueName(profile_name + "_", 1, 0)
1001 duplicate /o /r=[][trace] profiles, $profile_name /wave=dest_profile
1002 redimension /n=(dimsize(profiles, 0)) dest_profile
1003 profile_note = ReplaceStringByKey("SourceWave", profile_note, NameOfWave(source_image), "=", "\r")
1004 note /k dest_profile
1005 note dest_profile, profile_note
1006 print "created", GetWavesDataFolder(dest_profile, 2)
1012 // common graph for all profiles of a dimension
1013 graphname = "export_profiles_" + dim_label
1014 graphtitle = UpperStr(dim_label) + " Profiles"
1016 // one graph per source image
1017 if (svar_exists(linked_graphname) && (ItemsInList(WinList(linked_graphname, ";", "WIN:1"), ";") >= 1))
1018 graphname = linked_graphname
1020 graphname = GetWavesDataFolder(source_image, 0) + name_dim
1022 graphtitle = UpperStr(dim_label) + " Profiles: " + GetWavesDataFolder(source_image, 2)
1025 if ((ItemsInList(WinList(graphname, ";", "WIN:1"), ";") >= 1))
1026 appendtograph /w=$graphname dest_profile
1028 setdatafolder imagedf
1029 display /k=1 /n=$graphname dest_profile as graphtitle
1031 ModifyGraph /w=$graphname mirror=1,nticks=3,minor=1
1032 ModifyGraph /w=$graphname axThick=0.5,btLen=4
1033 ModifyGraph /w=$graphname gfSize=10
1034 ModifyGraph /w=$graphname grid=2,gridHair=0,gridRGB=(52224,52224,52224)
1035 Legend /w=$graphname /C/N=legend0/F=0/B=1/A=LT/X=0.00/Y=0.00
1038 string /g $graphname_string = graphname
1043 setdatafolder savedf
1143function /s ad_display_brick(data)
1146 if(exists("NewGizmo") != 4)
1147 abort "Gizmo XOP must be installed."
1149 if (WaveDims(data) != 3)
1150 abort "ad_display_brick: data must be three-dimensional."
1153 dfref savedf = GetDataFolderDFR()
1154 dfref datadf = GetWavesDataFolderDFR(data)
1155 string s_datadf = GetDataFolder(1, datadf)
1156 dfref viewdf = make_view_folder(data)
1158 setdatafolder viewdf
1159 string dfname = ReplaceString("root:", s_datadf, "")
1160 string graphtitle = dfname + " Gizmo"
1161 string /g gizmo_graphname = graphname_from_dfref(datadf, "giz_")
1162 svar graphname = gizmo_graphname
1164 if ((strlen(graphname) > 0) && (wintype(graphname) == 17))
1165 setdatafolder savedf
1166 return graphname // gizmo window exists
1169 variable nx = dimsize(data, 0)
1170 variable ny = dimsize(data, 1)
1171 variable nz = dimsize(data, 2)
1177 // igor does not allow calling gizmo functions directly
1178 setdatafolder datadf
1179 sprintf cmd, "NewGizmo /k=1 /n=%s /w=(100,100,500,400) /t=\"%s\"", graphname, graphtitle
1181 cmd =
"AppendToGizmo /D Axes=BoxAxes, name=axes0"
1184 obj =
"surface_xmid"
1185 pp = round(nx / 2 - 1)
1186 sprintf cmd, "AppendToGizmo /D surface=%s, name=%s", nameofwave(data), obj
1188 sprintf cmd, "ModifyGizmo modifyObject=%s, property={srcMode, 128}
", obj
1190 sprintf cmd, "ModifyGizmo ModifyObject=%s,
property={plane, %d}
", obj, pp
1192 sprintf cmd, "ModifyGizmo modifyObject=%s,
property={surfaceCtab, BlueGreenOrange}
", obj
1194 sprintf cmd, "ModifyGizmo ModifyObject=%s,
property={SurfaceCTABScaling,128}
", obj
1196 sprintf cmd, "ModifyGizmo modifyObject=%s,
property={surfaceCTABAlpha, 1.0}
", obj
1199 obj = "surface_ymid
"
1200 pp = round(ny / 2 - 1)
1201 sprintf cmd, "AppendToGizmo /D surface=%s, name=%s
", nameofwave(data), obj
1203 sprintf cmd, "ModifyGizmo modifyObject=%s,
property={srcMode, 64}
", obj
1205 sprintf cmd, "ModifyGizmo ModifyObject=%s,
property={plane, %d}
", obj, pp
1207 sprintf cmd, "ModifyGizmo modifyObject=%s,
property={surfaceCtab, BlueGreenOrange}
", obj
1209 sprintf cmd, "ModifyGizmo ModifyObject=%s,
property={SurfaceCTABScaling,128}
", obj
1211 sprintf cmd, "ModifyGizmo modifyObject=%s,
property={surfaceCTABAlpha, 1.0}
", obj
1214 obj = "surface_zmid
"
1215 pp = round(nz / 2 - 1)
1216 sprintf cmd, "AppendToGizmo /D surface=%s, name=%s
", nameofwave(data), obj
1218 sprintf cmd, "ModifyGizmo modifyObject=%s,
property={srcMode, 32}
", obj
1220 sprintf cmd, "ModifyGizmo ModifyObject=%s,
property={plane, %d}
", obj, pp
1222 sprintf cmd, "ModifyGizmo modifyObject=%s,
property={surfaceCtab, BlueGreenOrange}
", obj
1224 sprintf cmd, "ModifyGizmo ModifyObject=%s,
property={SurfaceCTABScaling,128}
", obj
1226 sprintf cmd, "ModifyGizmo modifyObject=%s,
property={surfaceCTABAlpha, 1.0}
", obj
1230 sprintf cmd, "ModifyGizmo ModifyObject=%s,
property={-1,axisScalingMode,1}
", obj
1232 sprintf cmd, "ModifyGizmo ModifyObject=%s,
property={-1,axisColor,0,0,0,1}
", obj
1234 sprintf cmd, "ModifyGizmo ModifyObject=%s,
property={0,ticks,3}
", obj
1236 sprintf cmd, "ModifyGizmo ModifyObject=%s,
property={1,ticks,3}
", obj
1238 sprintf cmd, "ModifyGizmo ModifyObject=%s,
property={2,ticks,3}
", obj
1240 sprintf cmd, "ModifyGizmo modifyObject=%s
property={Clipped,0}
", obj
1242 sprintf cmd, "ModifyGizmo modifyObject=%s
property={-1,fontScaleFactor,2}
", obj
1245 sprintf cmd, "ModifyGizmo showAxisCue=1
"
1248 setdatafolder savedf
1673static function bp_extract_slice(ba) : ButtonControl
1674 STRUCT WMButtonAction &ba
1676 dfref savedf = GetDataFolderDFR()
1678 switch( ba.eventCode )
1680 string control_datafolder = GetUserData(ba.win, "", "control_datafolder")
1681 setdatafolder control_datafolder
1682 string brick_path = GetUserData(ba.win, "", "brick_path")
1683 wave brick = $brick_path
1684 dfref brickdf = GetWavesDataFolderDFR(brick)
1686 string axis = StringFromList(1, ba.ctrlName, "_")
1687 string cmd = StringFromList(2, ba.ctrlName, "_")
1688 variable dim = char2num(axis[0]) - char2num("x")
1689 string posvariable = getdatafolder(1) + axis[0] + "_slice_pos"
1691 nvar pos = $(posvariable)
1692 variable pp = round((pos - dimoffset(brick, dim)) / dimdelta(brick, dim))
1693 if ((pp < 0) || (pp >= dimsize(brick, dim)))
1694 return -1 // requested value out of range
1697 variable dig = ceil(log(dimsize(brick, dim)))
1699 sprintf slicename, "%s_%s%0*u", NameOfWave(brick), axis[0], dig, pp
1700 setdatafolder brickdf
1703 wave wdest = ad_extract_slab_x(brick, pp, pp, slicename)
1706 wave wdest = ad_extract_slab_y(brick, pp, pp, slicename)
1709 wave wdest = ad_extract_slab_z(brick, pp, pp, slicename)
1714 sprintf msg, "%s=%g", axis[0], pos
1718 case -1: // control being killed
1722 setdatafolder savedf