1 | #pragma TextEncoding = "MacRoman" |
---|
2 | #pragma rtGlobals=3 // Use modern global access method and strict wave access. |
---|
3 | #pragma IgorVersion = 7.00 |
---|
4 | |
---|
5 | // |
---|
6 | // Mask utilities: |
---|
7 | // - loader |
---|
8 | // - simple editor |
---|
9 | // - save mask file |
---|
10 | // - assign mask file to data file |
---|
11 | // |
---|
12 | // |
---|
13 | // |
---|
14 | // |
---|
15 | // |
---|
16 | // |
---|
17 | |
---|
18 | ///// LOADING |
---|
19 | |
---|
20 | // DONE |
---|
21 | // x- when mask is loaded, need to be sure to clean up the "extra" waves that may be present |
---|
22 | // |
---|
23 | // x- the overlay and the currentTube waves since these are not overwritten or killed when new mask |
---|
24 | // data is read in from HDF. need to manually? check for these and delete then, or the data and |
---|
25 | // mask overlay will be out of sync. |
---|
26 | // |
---|
27 | |
---|
28 | |
---|
29 | // passing null file string presents a dialog |
---|
30 | // called from the Main Button " Read Mask" |
---|
31 | Proc V_LoadMASKData() |
---|
32 | V_LoadHDF5Data("","MSK") |
---|
33 | End |
---|
34 | |
---|
35 | |
---|
36 | |
---|
37 | //// DRAWING/SAVING |
---|
38 | // |
---|
39 | // (DONE) |
---|
40 | // x- CHANGE the mask behavior to a more logical choice - and consistent with SANS |
---|
41 | // x- CHANGE to: |
---|
42 | // 1 == mask == discard data |
---|
43 | // 0 == no Mask == keep data |
---|
44 | // x- and then make the corresponding changes in the I(Q) routines |
---|
45 | // |
---|
46 | // x- move the mask generating utilities from VC_HDF5_Utils into this procedure - to keep |
---|
47 | // all of the mask procedures together |
---|
48 | |
---|
49 | |
---|
50 | // TODO |
---|
51 | // -- document the arrow keys moving the tube number and adding/deleting tubes from the mask |
---|
52 | // this is done through a window hook function (LR moves tube number, up/down = add/delete) |
---|
53 | // |
---|
54 | // (DONE) |
---|
55 | // x- (NO)- Igor 7 is necessary for some VSANS functionality, so do not support Igor 6 |
---|
56 | // x (no)make the arrow keys Igor 6 compatible - search for specialKeyCode or Keyboard Events in the help file |
---|
57 | // and what needs to be replaced for Igor 6 |
---|
58 | // DONE |
---|
59 | // x- for L/R panels, the maksing of columns should be sufficient. Tubes are vertical. For the T/B panels |
---|
60 | // the L/R panels cast a vertical shadow (=vertical mask) AND the tubes are horizontal, so the individual |
---|
61 | // tubes will likely need to be masked in a horizontal line too, per tube. ADD this in... |
---|
62 | |
---|
63 | |
---|
64 | //TODO |
---|
65 | // x- draw a mask |
---|
66 | // x- save a mask (all panels) |
---|
67 | // x- move everything into it's own folder, rather than root: |
---|
68 | // -- be able to save the mask name to the RAW data file |
---|
69 | // -- be able to read a mask based on what name is in the data file |
---|
70 | // |
---|
71 | // x- biggest thing now is to re-write the DrawDetPanel() routine from the beamCenter.ipf |
---|
72 | // to do what this panel needs |
---|
73 | // |
---|
74 | // x- add this to the list of includes, move the file to SVN, and add it. |
---|
75 | // |
---|
76 | // -- for working with VCALC -- maybe have an automatic generator (if val < -2e6, mask = 0) |
---|
77 | // this can be checked column-wise to go faster (1st index) |
---|
78 | // |
---|
79 | // x- re-write V_OverlayMask to make the "overlay" wave that has the NaNs, and then the drawing |
---|
80 | // routines need to be aware of this |
---|
81 | |
---|
82 | |
---|
83 | |
---|
84 | // called from the main button "Draw Mask" |
---|
85 | Proc V_Edit_a_Mask() |
---|
86 | V_EditMask() |
---|
87 | end |
---|
88 | |
---|
89 | Function V_EditMask() |
---|
90 | DoWindow/F MaskEditPanel |
---|
91 | if(V_flag==0) |
---|
92 | |
---|
93 | NewDataFolder/O root:Packages:NIST:VSANS:Globals:Mask |
---|
94 | |
---|
95 | Variable/G root:Packages:NIST:VSANS:Globals:Mask:gMaskTube = 0 |
---|
96 | Variable/G root:Packages:NIST:VSANS:Globals:Mask:gMaskMaxIndex = 47 |
---|
97 | |
---|
98 | // check for a mask, if not present, generate a default mask |
---|
99 | String str="FT" |
---|
100 | wave/Z maskW = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":data") |
---|
101 | if(!WaveExists(maskW)) |
---|
102 | V_GenerateDefaultMask() |
---|
103 | endif |
---|
104 | |
---|
105 | Execute "V_MaskEditorPanel()" |
---|
106 | endif |
---|
107 | End |
---|
108 | |
---|
109 | // |
---|
110 | // TODO |
---|
111 | // -- may need to adjust the display for the different pixel dimensions |
---|
112 | // ModifyGraph width={Plan,1,bottom,left} |
---|
113 | // |
---|
114 | // DONE |
---|
115 | // need buttons for: |
---|
116 | // x- quit (to exit gracefully) (no, just close the window is fine) |
---|
117 | // x- help (button is there, fill in the content) |
---|
118 | // |
---|
119 | Proc V_MaskEditorPanel() |
---|
120 | PauseUpdate; Silent 1 // building window... |
---|
121 | |
---|
122 | Display /W=(662,418,1300,960)/N=MaskEditPanel /K=1 |
---|
123 | |
---|
124 | ShowTools rect |
---|
125 | ControlBar 100 |
---|
126 | |
---|
127 | PopupMenu popup_0,pos={18,40},size={109,20},proc=V_SetMaskPanelPopMenuProc,title="Detector Panel" |
---|
128 | PopupMenu popup_0,mode=1,popvalue="FL",value= #"\"FL;FR;FT;FB;ML;MR;MT;MB;B;\"" |
---|
129 | PopupMenu popup_2,pos={18,10},size={109,20},title="Data Source"//,proc=SetFldrPopMenuProc |
---|
130 | PopupMenu popup_2,mode=1,popvalue="RAW",value= #"\"RAW;SAM;ABS;VCALC;\"" |
---|
131 | |
---|
132 | SetVariable setvar0,pos={226,32},size={112,23},title="tube number" |
---|
133 | SetVariable setvar0,limits={0,127,1},value=root:Packages:NIST:VSANS:Globals:Mask:gMaskTube |
---|
134 | Button button_0,pos={226,58},size={50.00,20.00},proc=V_AddToMaskButtonProc,title="Add" |
---|
135 | Button button_1,pos={288,58},size={50.00,20.00},proc=V_RemoveFromMaskButtonProc,title="Del" |
---|
136 | Button button_2,pos={496,41},size={90.00,20.00},proc=V_ToggleMaskButtonProc,title="Toggle" |
---|
137 | Button button_3,pos={506,66},size={80.00,20.00},proc=V_SaveMaskButtonProc,title="Save" |
---|
138 | CheckBox check_0,pos={174,35},size={37.00,15.00},proc=V_DrawMaskRadioCheckProc,title="Row" |
---|
139 | CheckBox check_0,value= 0,mode=1 |
---|
140 | CheckBox check_1,pos={174,58},size={32.00,15.00},proc=V_DrawMaskRadioCheckProc,title="Col" |
---|
141 | CheckBox check_1,value= 1,mode=1 |
---|
142 | |
---|
143 | Button button_5,pos={18,70.00},size={70.00,20.00},proc=V_MaskToolsButton,title="Tools" |
---|
144 | Button button_6,pos={380,33},size={90.00,20.00},proc=V_AddShapeToMaskButtonProc,title="Add Shape" |
---|
145 | Button button_7,pos={380,58},size={90.00,20.00},proc=V_AddShapeToMaskButtonProc,title="Del Shape" |
---|
146 | Button button_8,pos={556.00,14.00},size={30.00,20.00},proc=V_DrawMaskHelpButtonProc,title="?" |
---|
147 | |
---|
148 | GroupBox group0,pos={163.00,5.00},size={188.00,90.00},title="Mask Tubes" |
---|
149 | GroupBox group1,pos={365.00,5.00},size={122.00,90.00},title="Mask Shapes" |
---|
150 | |
---|
151 | SetWindow MaskEditPanel, hook(MyHook)=V_MaskWindowHook |
---|
152 | |
---|
153 | // draw the correct images |
---|
154 | //draw the detector panel |
---|
155 | V_DrawPanelToMask("FL") |
---|
156 | |
---|
157 | // overlay the current mask |
---|
158 | V_OverlayMask("FL",1) |
---|
159 | |
---|
160 | SetDrawLayer/W=MaskEditPanel ProgFront |
---|
161 | SetDrawEnv/W=MaskEditPanel xcoord= bottom,ycoord= left,save //be sure to use axis coordinate mode |
---|
162 | EndMacro |
---|
163 | |
---|
164 | Function V_DrawMaskHelpButtonProc(ba) : ButtonControl |
---|
165 | STRUCT WMButtonAction &ba |
---|
166 | |
---|
167 | switch( ba.eventCode ) |
---|
168 | case 2: // mouse up |
---|
169 | // click code here |
---|
170 | DisplayHelpTopic/Z/K=1 "VSANS Data Reduction Documentation[Drawing a Mask]" |
---|
171 | if(V_flag !=0) |
---|
172 | DoAlert 0,"The VSANS Data Reduction Help file could not be found" |
---|
173 | endif |
---|
174 | break |
---|
175 | case -1: // control being killed |
---|
176 | break |
---|
177 | endswitch |
---|
178 | |
---|
179 | return 0 |
---|
180 | End |
---|
181 | |
---|
182 | // |
---|
183 | //a simple toggle between the two, so the logic is not done in the cleanest way. |
---|
184 | // |
---|
185 | // update the limits on the tube nubmer based on row/col and the panel (gMaskMaxIndex global) |
---|
186 | // |
---|
187 | Function V_DrawMaskRadioCheckProc(cba) : CheckBoxControl |
---|
188 | STRUCT WMCheckboxAction &cba |
---|
189 | |
---|
190 | switch( cba.eventCode ) |
---|
191 | case 2: // mouse up |
---|
192 | Variable checked = cba.checked |
---|
193 | String name = cba.ctrlName |
---|
194 | |
---|
195 | //get information to update the limits on the tube number setvar |
---|
196 | ControlInfo popup_0 |
---|
197 | String str=S_Value |
---|
198 | wave data = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":data") |
---|
199 | Variable val |
---|
200 | |
---|
201 | // update the radio button status and the setvar limits |
---|
202 | if(cmpstr(name,"check_0") == 0) // ROW is being selected |
---|
203 | CheckBox check_0,value = 1 |
---|
204 | CheckBox check_1,value = 0 |
---|
205 | val = DimSize(data, 1) -1 |
---|
206 | else |
---|
207 | // COL is being selected |
---|
208 | CheckBox check_0,value = 0 |
---|
209 | CheckBox check_1,value = 1 |
---|
210 | val = DimSize(data, 0) -1 |
---|
211 | endif |
---|
212 | |
---|
213 | // print "max = ",val |
---|
214 | |
---|
215 | SetVariable setvar0,limits={0,val,1} |
---|
216 | NVAR gVal = root:Packages:NIST:VSANS:Globals:Mask:gMaskTube |
---|
217 | NVAR gMax = root:Packages:NIST:VSANS:Globals:Mask:gMaskMaxIndex |
---|
218 | gMax = val |
---|
219 | if(gVal > val) |
---|
220 | gVal = val |
---|
221 | endif |
---|
222 | |
---|
223 | break |
---|
224 | case -1: // control being killed |
---|
225 | break |
---|
226 | endswitch |
---|
227 | |
---|
228 | return 0 |
---|
229 | End |
---|
230 | |
---|
231 | Function V_MaskWindowHook(s) |
---|
232 | STRUCT WMWinHookStruct &s |
---|
233 | |
---|
234 | Variable hookResult = 0 // 0 if we do not handle event, 1 if we handle it. |
---|
235 | |
---|
236 | String message = "" |
---|
237 | |
---|
238 | switch(s.eventCode) |
---|
239 | case 11: // Keyboard event |
---|
240 | // String keyCodeInfo |
---|
241 | // sprintf keyCodeInfo, "s.keycode = 0x%04X", s.keycode |
---|
242 | // if (strlen(message) > 0) |
---|
243 | // message += "\r" |
---|
244 | // endif |
---|
245 | // message +=keyCodeInfo |
---|
246 | // |
---|
247 | // message += "\r" |
---|
248 | // String specialKeyCodeInfo |
---|
249 | // sprintf specialKeyCodeInfo, "s.specialKeyCode = %d", s.specialKeyCode |
---|
250 | // message +=specialKeyCodeInfo |
---|
251 | // message += "\r" |
---|
252 | // |
---|
253 | // String keyTextInfo |
---|
254 | // sprintf keyTextInfo, "s.keyText = \"%s\"", s.keyText |
---|
255 | // message +=keyTextInfo |
---|
256 | // |
---|
257 | // String text = "\\Z24" + message |
---|
258 | // Textbox /C/N=Message/W=KeyboardEventsGraph/A=MT/X=0/Y=15 text |
---|
259 | |
---|
260 | // NOTE: these special keyCodes are all Igor-7 ONLY |
---|
261 | |
---|
262 | // Note that I need to keep track of the index value since I'm intercepting the |
---|
263 | // SetVariable event here. I need to keep the index in range. |
---|
264 | STRUCT WMButtonAction ba |
---|
265 | ba.eventCode = 2 |
---|
266 | NVAR tubeVal = root:Packages:NIST:VSANS:Globals:Mask:gMaskTube |
---|
267 | if(s.specialKeyCode == 100) |
---|
268 | //left arrow |
---|
269 | tubeVal -= 1 |
---|
270 | endif |
---|
271 | if(s.specialKeyCode == 101) |
---|
272 | //right arrow |
---|
273 | tubeVal += 1 |
---|
274 | endif |
---|
275 | if(s.specialKeyCode == 102) |
---|
276 | //up arrow |
---|
277 | V_AddToMaskButtonProc(ba) |
---|
278 | endif |
---|
279 | if(s.specialKeyCode == 103) |
---|
280 | //down arrow |
---|
281 | V_RemoveFromMaskButtonProc(ba) |
---|
282 | endif |
---|
283 | |
---|
284 | // enforce the limits on the setvar |
---|
285 | NVAR gMax = root:Packages:NIST:VSANS:Globals:Mask:gMaskMaxIndex |
---|
286 | if(tubeVal > gMax) |
---|
287 | tubeVal = gMax |
---|
288 | endif |
---|
289 | if(tubeVal < 0) |
---|
290 | tubeVal = 0 |
---|
291 | endif |
---|
292 | |
---|
293 | // draw the "currentTube" every time |
---|
294 | ControlInfo popup_0 |
---|
295 | String str=S_Value |
---|
296 | wave currentTube = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":currentTube") |
---|
297 | |
---|
298 | // update so that the proper row is displayed on the currentTube |
---|
299 | currentTube = 0 |
---|
300 | |
---|
301 | ControlInfo check_0 // is it row? |
---|
302 | Variable isRow = V_value |
---|
303 | if(isRow) |
---|
304 | currentTube[][tubeVal] = 1 |
---|
305 | else |
---|
306 | currentTube[tubeVal][] = 1 |
---|
307 | endif |
---|
308 | |
---|
309 | |
---|
310 | hookResult = 1 // We handled keystroke |
---|
311 | break |
---|
312 | endswitch |
---|
313 | |
---|
314 | return hookResult // If non-zero, we handled event and Igor will ignore it. |
---|
315 | End |
---|
316 | |
---|
317 | // toggles the view of the mask, either show the mask, or hide it |
---|
318 | // |
---|
319 | Function V_ToggleMaskButtonProc(ba) : ButtonControl |
---|
320 | STRUCT WMButtonAction &ba |
---|
321 | |
---|
322 | switch( ba.eventCode ) |
---|
323 | case 2: // mouse up |
---|
324 | // click code here |
---|
325 | |
---|
326 | ControlInfo popup_0 |
---|
327 | String str=S_Value |
---|
328 | |
---|
329 | wave/Z overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":overlay") |
---|
330 | |
---|
331 | CheckDisplayed/W=MaskEditPanel overlay |
---|
332 | Variable state = !(V_flag) //if V_flag == 0, then set to 1 (and vice versa) |
---|
333 | V_OverlayMask(str,state) |
---|
334 | |
---|
335 | break |
---|
336 | case -1: // control being killed |
---|
337 | break |
---|
338 | endswitch |
---|
339 | |
---|
340 | return 0 |
---|
341 | End |
---|
342 | |
---|
343 | // adds a row (or column) to the mask |
---|
344 | // |
---|
345 | Function V_AddToMaskButtonProc(ba) : ButtonControl |
---|
346 | STRUCT WMButtonAction &ba |
---|
347 | |
---|
348 | switch( ba.eventCode ) |
---|
349 | case 2: // mouse up |
---|
350 | // click code here |
---|
351 | ControlInfo popup_0 |
---|
352 | String str=S_Value |
---|
353 | |
---|
354 | wave/Z maskData = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":data") |
---|
355 | |
---|
356 | Variable val |
---|
357 | ControlInfo setvar0 //get the tube number |
---|
358 | val = V_Value |
---|
359 | |
---|
360 | ControlInfo check_0 // is it row? |
---|
361 | Variable isRow = V_value |
---|
362 | if(isRow) |
---|
363 | maskData[][val] = 1 |
---|
364 | else |
---|
365 | maskData[val][] = 1 |
---|
366 | endif |
---|
367 | |
---|
368 | V_OverlayMask(str,1) |
---|
369 | |
---|
370 | break |
---|
371 | case -1: // control being killed |
---|
372 | break |
---|
373 | endswitch |
---|
374 | |
---|
375 | return 0 |
---|
376 | End |
---|
377 | |
---|
378 | // |
---|
379 | //adds or erases the mask, based on which button was clicked |
---|
380 | // (only checks for "add shape", otherwise erases mask) |
---|
381 | // |
---|
382 | Function V_AddShapeToMaskButtonProc(ba) : ButtonControl |
---|
383 | STRUCT WMButtonAction &ba |
---|
384 | |
---|
385 | switch( ba.eventCode ) |
---|
386 | case 2: // mouse up |
---|
387 | // click code here |
---|
388 | ControlInfo popup_0 |
---|
389 | String str=S_Value |
---|
390 | |
---|
391 | wave/Z data = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":data") |
---|
392 | |
---|
393 | SetDrawLayer/W=MaskEditPanel ProgFront |
---|
394 | SetDrawEnv/W=MaskEditPanel xcoord= bottom,ycoord= left,save //be sure to use axis coordinate mode |
---|
395 | |
---|
396 | ImageGenerateROIMask/W=MaskEditPanel curDispPanel //M_ROIMask is in the root: folder |
---|
397 | |
---|
398 | WAVE M_ROIMask=M_ROIMask |
---|
399 | if(cmpstr("button_6",ba.ctrlName)==0) |
---|
400 | data = (data || M_ROIMask) // 0=0, 1=1 == "drawing" more mask points |
---|
401 | else |
---|
402 | data = (M_ROIMask[p][q] == 1 && data[p][q] == 1) ? 0 : data[p][q] // if the drawn shape = 1, set the mask to 0 (erase) |
---|
403 | endif |
---|
404 | |
---|
405 | V_OverlayMask(str,1) |
---|
406 | |
---|
407 | SetDrawLayer/K ProgFront |
---|
408 | SetDrawLayer/W=MaskEditPanel ProgFront |
---|
409 | SetDrawEnv/W=MaskEditPanel xcoord= bottom,ycoord= left,save //be sure to use axis coordinate mode |
---|
410 | break |
---|
411 | case -1: // control being killed |
---|
412 | break |
---|
413 | endswitch |
---|
414 | |
---|
415 | return 0 |
---|
416 | End |
---|
417 | |
---|
418 | // show the tools (they are there by default) |
---|
419 | // |
---|
420 | Function V_MaskToolsButton(ba) : ButtonControl |
---|
421 | STRUCT WMButtonAction &ba |
---|
422 | |
---|
423 | switch( ba.eventCode ) |
---|
424 | case 2: // mouse up |
---|
425 | // click code here |
---|
426 | |
---|
427 | ShowTools rect |
---|
428 | |
---|
429 | SetDrawLayer/W=MaskEditPanel ProgFront |
---|
430 | SetDrawEnv/W=MaskEditPanel xcoord= bottom,ycoord= left,save //be sure to use axis coordinate mode |
---|
431 | SetDrawEnv/W=MaskEditPanel fillPat=1 |
---|
432 | |
---|
433 | break |
---|
434 | case -1: // control being killed |
---|
435 | break |
---|
436 | endswitch |
---|
437 | |
---|
438 | return 0 |
---|
439 | End |
---|
440 | |
---|
441 | // un-mask a row or column |
---|
442 | // |
---|
443 | Function V_RemoveFromMaskButtonProc(ba) : ButtonControl |
---|
444 | STRUCT WMButtonAction &ba |
---|
445 | |
---|
446 | switch( ba.eventCode ) |
---|
447 | case 2: // mouse up |
---|
448 | // click code here |
---|
449 | ControlInfo popup_0 |
---|
450 | String str=S_Value |
---|
451 | |
---|
452 | wave/Z maskData = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":data") |
---|
453 | |
---|
454 | Variable val |
---|
455 | ControlInfo setvar0 // get the tube number |
---|
456 | val = V_Value |
---|
457 | |
---|
458 | ControlInfo check_0 // is it row? |
---|
459 | Variable isRow = V_value |
---|
460 | if(isRow) |
---|
461 | maskData[][val] = 0 |
---|
462 | else |
---|
463 | maskData[val][] = 0 |
---|
464 | endif |
---|
465 | |
---|
466 | V_OverlayMask(str,1) |
---|
467 | |
---|
468 | break |
---|
469 | case -1: // control being killed |
---|
470 | break |
---|
471 | endswitch |
---|
472 | |
---|
473 | return 0 |
---|
474 | End |
---|
475 | |
---|
476 | // |
---|
477 | // function to choose which detector panel to display, and then to actually display it |
---|
478 | // |
---|
479 | Function V_SetMaskPanelPopMenuProc(pa) : PopupMenuControl |
---|
480 | STRUCT WMPopupAction &pa |
---|
481 | |
---|
482 | switch( pa.eventCode ) |
---|
483 | case 2: // mouse up |
---|
484 | Variable popNum = pa.popNum |
---|
485 | String popStr = pa.popStr |
---|
486 | |
---|
487 | // remove the old image (it may not be the right shape) |
---|
488 | // -- but make sure it exists first... |
---|
489 | |
---|
490 | String list = ImageNameList("", ";" ) |
---|
491 | Variable num=ItemsInList(list) |
---|
492 | Variable ii |
---|
493 | for(ii=0;ii<num;ii+=1) |
---|
494 | // Wave w = ImageNameToWaveRef("", StringFromList(ii, list,";")) |
---|
495 | // CheckDisplayed/W=MaskEditPanel w |
---|
496 | |
---|
497 | RemoveImage/W=MaskEditPanel $(StringFromList(ii, list,";")) |
---|
498 | endfor |
---|
499 | |
---|
500 | |
---|
501 | |
---|
502 | // draw the correct images |
---|
503 | V_DrawPanelToMask(popStr) |
---|
504 | |
---|
505 | // fake a "click" on the radio buttons to re-set the row/col limits |
---|
506 | STRUCT WMCheckboxAction cba |
---|
507 | cba.eventCode = 2 |
---|
508 | |
---|
509 | ControlInfo check_0 |
---|
510 | if(V_flag == 1) //row is currently selected |
---|
511 | cba.ctrlName = "check_0" |
---|
512 | else |
---|
513 | cba.ctrlName = "check_1" |
---|
514 | endif |
---|
515 | |
---|
516 | V_DrawMaskRadioCheckProc(cba) //call the radio button action proc |
---|
517 | |
---|
518 | //overlay the mask (removes the old mask first) |
---|
519 | V_OverlayMask(popStr,1) |
---|
520 | |
---|
521 | SetDrawLayer/K ProgFront |
---|
522 | SetDrawLayer/W=MaskEditPanel ProgFront |
---|
523 | SetDrawEnv/W=MaskEditPanel xcoord= bottom,ycoord= left,save //be sure to use axis coordinate mode |
---|
524 | |
---|
525 | break |
---|
526 | case -1: // control being killed |
---|
527 | break |
---|
528 | endswitch |
---|
529 | |
---|
530 | return 0 |
---|
531 | End |
---|
532 | |
---|
533 | // |
---|
534 | // SEE DrawDetPanel() in the BeamCenter file |
---|
535 | // |
---|
536 | // TODO |
---|
537 | // x- currently is hard-wired for the simulation path! need to make it more generic, especially for RAW data |
---|
538 | // |
---|
539 | // -- need to adjust the size of the image subwindows |
---|
540 | // |
---|
541 | // x- need to do something for panel "B". currently ignored |
---|
542 | // |
---|
543 | // |
---|
544 | // draw the selected panel and the model calculation, adjusting for the |
---|
545 | // orientation of the panel and the number of pixels, and pixel sizes |
---|
546 | Function V_DrawPanelToMask(str) |
---|
547 | String str |
---|
548 | |
---|
549 | // from the selection, find the path to the data |
---|
550 | |
---|
551 | Variable xDim,yDim |
---|
552 | Variable left,top,right,bottom |
---|
553 | Variable height, width |
---|
554 | Variable left2,top2,right2,bottom2 |
---|
555 | Variable nPix_X,nPix_Y,pixSize_X,pixSize_Y |
---|
556 | |
---|
557 | |
---|
558 | // Wave dispW=root:curDispPanel |
---|
559 | |
---|
560 | //plot it in the subwindow with the proper aspect and positioning |
---|
561 | // for 48x256 (8mm x 4mm), aspect = (256/2)/48 = 2.67 (LR panels) |
---|
562 | // for 128x48 (4mm x 8 mm), aspect = 48/(128/2) = 0.75 (TB panels) |
---|
563 | |
---|
564 | |
---|
565 | // using two switches -- one to set the panel-specific dimensions |
---|
566 | // and the other to set the "common" values, some of which are based on the panel dimensions |
---|
567 | |
---|
568 | // set the source of the data. not always VCALC anymore |
---|
569 | String folder |
---|
570 | ControlInfo popup_2 |
---|
571 | folder = S_Value |
---|
572 | |
---|
573 | // TODO -- fix all of this mess |
---|
574 | if(cmpstr(folder,"VCALC") == 0) |
---|
575 | // panel-specific values |
---|
576 | Variable VC_nPix_X = VCALC_get_nPix_X(str) |
---|
577 | Variable VC_nPix_Y = VCALC_get_nPix_Y(str) |
---|
578 | Variable VC_pixSize_X = VCALC_getPixSizeX(str) |
---|
579 | Variable VC_pixSize_Y = VCALC_getPixSizeY(str) |
---|
580 | |
---|
581 | |
---|
582 | // if VCALC declare this way |
---|
583 | wave newW = $("root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_"+str+":det_"+str) |
---|
584 | nPix_X = VC_nPix_X |
---|
585 | nPix_Y = VC_nPix_Y |
---|
586 | pixSize_X = VC_pixSize_X |
---|
587 | pixSize_Y = VC_pixSize_Y |
---|
588 | |
---|
589 | else |
---|
590 | // TODO: if real data, need new declaration w/ data as the wave name |
---|
591 | wave newW = $("root:Packages:NIST:VSANS:"+folder+":entry:instrument:detector_"+str+":data") |
---|
592 | |
---|
593 | nPix_X = V_getDet_pixel_num_x(folder,str) |
---|
594 | nPix_Y = V_getDet_pixel_num_Y(folder,str) |
---|
595 | pixSize_X = V_getDet_x_pixel_size(folder,str)/10 |
---|
596 | pixSize_Y = V_getDet_y_pixel_size(folder,str)/10 |
---|
597 | endif |
---|
598 | |
---|
599 | |
---|
600 | Variable scale = 10 |
---|
601 | |
---|
602 | // common values (panel position, etc) |
---|
603 | // TODO -- units are absolute, based on pixels in cm. make sure this is always correct |
---|
604 | strswitch(str) |
---|
605 | case "FL": |
---|
606 | case "FR": |
---|
607 | case "ML": |
---|
608 | case "MR": |
---|
609 | width = trunc(nPix_X*pixSize_X *scale*1.15) //48 tubes @ 8 mm |
---|
610 | height = trunc(nPix_Y*pixSize_Y *scale*0.8) //128 pixels @ 8 mm |
---|
611 | |
---|
612 | left = 20 |
---|
613 | top = 80 |
---|
614 | right = left+width |
---|
615 | bottom = top+height |
---|
616 | |
---|
617 | left2 = right + 20 |
---|
618 | right2 = left2 + width |
---|
619 | top2 = top |
---|
620 | bottom2 = bottom |
---|
621 | |
---|
622 | break |
---|
623 | case "FT": |
---|
624 | case "FB": |
---|
625 | case "MT": |
---|
626 | case "MB": |
---|
627 | width = trunc(nPix_X*pixSize_X *scale*1.) //128 pix @ 4 mm |
---|
628 | height = trunc(nPix_Y*pixSize_Y *scale) // 48 tubes @ 8 mm |
---|
629 | |
---|
630 | left = 20 |
---|
631 | top = 80 |
---|
632 | right = left+width |
---|
633 | bottom = top+height |
---|
634 | |
---|
635 | left2 = left |
---|
636 | right2 = right |
---|
637 | top2 = top + height + 20 |
---|
638 | bottom2 = bottom + height + 20 |
---|
639 | |
---|
640 | break |
---|
641 | case "B": |
---|
642 | width = trunc(nPix_X/3.2) // |
---|
643 | height = trunc(nPix_Y/3.2) // |
---|
644 | |
---|
645 | left = 20 |
---|
646 | top = 80 |
---|
647 | right = left+width |
---|
648 | bottom = top+height |
---|
649 | |
---|
650 | // Print left,top,right,bottom |
---|
651 | |
---|
652 | break |
---|
653 | default: |
---|
654 | return(0) //just exit |
---|
655 | endswitch |
---|
656 | |
---|
657 | SetDataFolder root:Packages:NIST:VSANS:Globals:Mask |
---|
658 | |
---|
659 | // generate the new panel display |
---|
660 | duplicate/O newW curDispPanel |
---|
661 | SetScale/P x 0,1, curDispPanel |
---|
662 | SetScale/P y 0,1, curDispPanel |
---|
663 | |
---|
664 | NVAR defaultLogScaling = root:Packages:NIST:VSANS:Globals:gLogScalingAsDefault |
---|
665 | if(defaultLogScaling) |
---|
666 | Wave LookupWave = root:Packages:NIST:VSANS:Globals:logLookupWave |
---|
667 | else |
---|
668 | Wave LookupWave = root:Packages:NIST:VSANS:Globals:linearLookupWave |
---|
669 | endif |
---|
670 | |
---|
671 | //draw the detector panel |
---|
672 | // Display/W=(left,top,right,bottom) |
---|
673 | AppendImage curDispPanel |
---|
674 | ModifyImage curDispPanel ctab= {*,*,ColdWarm,0} |
---|
675 | // ModifyImage curDispPanel log=1 // this fails, since there are data values that are zero |
---|
676 | ModifyImage curDispPanel ctabAutoscale=0,lookup= LookupWave |
---|
677 | Label left "Y pixels" |
---|
678 | Label bottom "X pixels" |
---|
679 | |
---|
680 | |
---|
681 | DoUpdate |
---|
682 | |
---|
683 | SetDataFolder root: |
---|
684 | return(0) |
---|
685 | End |
---|
686 | |
---|
687 | // |
---|
688 | // overlay the mask |
---|
689 | // |
---|
690 | // (DONE) |
---|
691 | // x- remove the old mask first |
---|
692 | // x- make the mask "toggle" to remove it |
---|
693 | // x- go see SANS for color, implementation, etc. |
---|
694 | // x- un-comment the (two) calls |
---|
695 | // |
---|
696 | // |
---|
697 | //toggles a mask on/off of the SANS_Data window |
---|
698 | // points directly to window, doesn't need current display type |
---|
699 | // |
---|
700 | // if state==1, show the mask, if ==0, hide the mask |
---|
701 | // |
---|
702 | //** This assumes that if the overlay is/not present on the image display, then the currentTube is also there/not |
---|
703 | // and is not checked |
---|
704 | // |
---|
705 | Function V_OverlayMask(str,state) |
---|
706 | String str |
---|
707 | Variable state |
---|
708 | |
---|
709 | |
---|
710 | String maskPath = "root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":data" |
---|
711 | if(WaveExists($maskPath) == 1) |
---|
712 | if(state == 1) |
---|
713 | //duplicate the mask, which is named "data" |
---|
714 | wave maskW = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":data") |
---|
715 | |
---|
716 | Duplicate/O maskW $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":overlay") |
---|
717 | wave overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":overlay") |
---|
718 | Duplicate/O maskW $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":currentTube") |
---|
719 | wave currentTube = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":currentTube") |
---|
720 | |
---|
721 | Redimension/D overlay,currentTube |
---|
722 | SetScale/P x 0,1, overlay,currentTube |
---|
723 | SetScale/P y 0,1, overlay,currentTube |
---|
724 | |
---|
725 | // overlay = (maskW == 1) ? 1 : NaN //no need to do this - simply adjust the coloring |
---|
726 | |
---|
727 | // update so that the proper row is displayed on the currentTube |
---|
728 | currentTube = 0 |
---|
729 | |
---|
730 | Variable val |
---|
731 | ControlInfo setvar0 //get the tube number |
---|
732 | val = V_Value |
---|
733 | |
---|
734 | ControlInfo check_0 // is it row? |
---|
735 | Variable isRow = V_value |
---|
736 | if(isRow) |
---|
737 | currentTube[][val] = 1 |
---|
738 | else |
---|
739 | currentTube[val][] = 1 |
---|
740 | endif |
---|
741 | |
---|
742 | CheckDisplayed/W=MaskEditPanel overlay |
---|
743 | if(V_flag==0) //so the overlay doesn't get appended more than once |
---|
744 | AppendImage/W=MaskEditPanel overlay |
---|
745 | AppendImage/W=MaskEditPanel currentTube |
---|
746 | // ModifyImage/W=MaskEditPanel#DetData overlay ctab= {0.9,1,BlueRedGreen,0} ,minRGB=NaN,maxRGB=0 |
---|
747 | ModifyImage/W=MaskEditPanel overlay ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,35000) |
---|
748 | ModifyImage/W=MaskEditPanel currentTube ctab= {0.9,1,CyanMagenta,0} ,minRGB=NaN,maxRGB=0 |
---|
749 | // ModifyImage/W=MaskEditPanel#DetData overlay ctab= {0,*,BlueRedGreen,0} |
---|
750 | endif |
---|
751 | endif |
---|
752 | |
---|
753 | if(state == 0) |
---|
754 | wave overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":overlay") |
---|
755 | wave currentTube = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":currentTube") |
---|
756 | |
---|
757 | CheckDisplayed/W=MaskEditPanel overlay |
---|
758 | // Print "V_flag = ",V_flag |
---|
759 | |
---|
760 | If(V_Flag == 1) //overlay is present |
---|
761 | RemoveImage/W=MaskEditPanel overlay |
---|
762 | RemoveImage/W=MaskEditPanel currentTube |
---|
763 | endif |
---|
764 | endif |
---|
765 | Endif |
---|
766 | |
---|
767 | return(0) |
---|
768 | End |
---|
769 | |
---|
770 | |
---|
771 | Function V_SaveMaskButtonProc(ba) : ButtonControl |
---|
772 | STRUCT WMButtonAction &ba |
---|
773 | |
---|
774 | switch( ba.eventCode ) |
---|
775 | case 2: // mouse up |
---|
776 | // click code here |
---|
777 | |
---|
778 | // fills in a "default mask" in a separate folder to then write out |
---|
779 | Execute "H_Setup_VSANS_MASK_Structure()" |
---|
780 | |
---|
781 | // fill with current "stuff" |
---|
782 | SetDataFolder root:VSANS_MASK_file:entry |
---|
783 | Wave/T title = title |
---|
784 | title = "This is a custom MASK file for VSANS: VSANS_MASK" |
---|
785 | SetDataFolder root: |
---|
786 | |
---|
787 | |
---|
788 | // copy over what was actually drawn for all of the detector panels |
---|
789 | |
---|
790 | Variable ii |
---|
791 | String str |
---|
792 | for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) |
---|
793 | str = StringFromList(ii, ksDetectorListAll, ";") |
---|
794 | Wave det_str = $("root:VSANS_MASK_file:entry:instrument:detector_"+str+":data") |
---|
795 | wave maskW = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":data") |
---|
796 | det_str = maskW |
---|
797 | endfor |
---|
798 | |
---|
799 | //save it |
---|
800 | // String fileName = "ThisIsAMASK" |
---|
801 | |
---|
802 | Execute "Save_VSANS_MASK_Nexus()" |
---|
803 | |
---|
804 | break |
---|
805 | case -1: // control being killed |
---|
806 | break |
---|
807 | endswitch |
---|
808 | |
---|
809 | SetDataFolder root: |
---|
810 | return 0 |
---|
811 | End |
---|
812 | |
---|
813 | |
---|
814 | ////////////// fake MASK file tests |
---|
815 | // |
---|
816 | // |
---|
817 | // Make/O/T/N=1 file_name = "VSANS_MASK_test.h5" |
---|
818 | // |
---|
819 | // simple generation of a fake MASK file. for sans, nothing other than the creation date was written to the |
---|
820 | // file header. nothing more is needed (possibly) |
---|
821 | // |
---|
822 | // |
---|
823 | // TODO |
---|
824 | // -- put in the current date, as is done for the DIV file |
---|
825 | // -- make the number of pixels GLOBAL to pick up the right numbers for the detector dimensions |
---|
826 | // x- there will be lots of work to do to develop the procedures necessary to actually generate the |
---|
827 | // 9 data sets to become the MASK file contents. More complexity here than for the simple SANS case. |
---|
828 | // |
---|
829 | // x- this is currently random 0|1 values, need to write an editor |
---|
830 | // |
---|
831 | // currently set up to use 1 = YES MASK == exclude the data |
---|
832 | // and 0 = NO MASK == keep the data |
---|
833 | // |
---|
834 | Proc H_Setup_VSANS_MASK_Structure() |
---|
835 | |
---|
836 | NewDataFolder/O/S root:VSANS_MASK_file |
---|
837 | |
---|
838 | NewDataFolder/O/S root:VSANS_MASK_file:entry |
---|
839 | Make/O/T/N=1 title = "This is a MASK file for VSANS: VSANS_MASK" |
---|
840 | Make/O/T/N=1 start_date = "2015-02-28T08:15:30-5:00" |
---|
841 | NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument |
---|
842 | Make/O/T/N=1 name = "NG3_VSANS" |
---|
843 | |
---|
844 | |
---|
845 | // NVAR gHighResBinning = root:Packages:NIST:VSANS:Globals:gHighResBinning |
---|
846 | NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_B |
---|
847 | if(root:Packages:NIST:VSANS:Globals:gHighResBinning == 1) |
---|
848 | // TODOHIGHRES - the pixel values are hard-wired |
---|
849 | Make/O/I/N=(2720,6624) data = 0 |
---|
850 | |
---|
851 | // TODOHIGHRES -- these values are simply the 4x4 values x4 |
---|
852 | // these will need to be updated |
---|
853 | data[][0,20] = 1 |
---|
854 | data[][6603,6623] = 1 // |
---|
855 | data[0,20][] = 1 |
---|
856 | data[2599,2719][] = 1 // |
---|
857 | |
---|
858 | else |
---|
859 | Make/O/I/N=(680,1656) data = 0 |
---|
860 | |
---|
861 | data[][0,5] = 1 |
---|
862 | data[][1650,1655] = 1 |
---|
863 | data[0,5][] = 1 |
---|
864 | data[675,679][] = 1 |
---|
865 | |
---|
866 | endif |
---|
867 | |
---|
868 | |
---|
869 | NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_MR |
---|
870 | Make/O/I/N=(48,128) data = 0 |
---|
871 | data[44,47][] = 1 |
---|
872 | data[][0,4] = 1 |
---|
873 | data[][123,127] = 1 |
---|
874 | NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_ML |
---|
875 | Make/O/I/N=(48,128) data = 0 |
---|
876 | data[0,3][] = 1 |
---|
877 | data[][0,4] = 1 |
---|
878 | data[][123,127] = 1 |
---|
879 | NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_MT |
---|
880 | Make/O/I/N=(128,48) data = 0 |
---|
881 | data[0,49][] = 1 |
---|
882 | data[78,127][] = 1 |
---|
883 | data[50,77][] = 0 |
---|
884 | |
---|
885 | NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_MB |
---|
886 | Make/O/I/N=(128,48) data = 0 |
---|
887 | data[0,49][] = 1 |
---|
888 | data[78,127][] = 1 |
---|
889 | data[50,77][] = 0 |
---|
890 | |
---|
891 | NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_FR |
---|
892 | Make/O/I/N=(48,128) data = 0 |
---|
893 | data[44,47][] = 1 |
---|
894 | data[][0,4] = 1 |
---|
895 | data[][123,127] = 1 |
---|
896 | NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_FL |
---|
897 | Make/O/I/N=(48,128) data = 0 |
---|
898 | data[0,3][] = 1 |
---|
899 | data[][0,4] = 1 |
---|
900 | data[][123,127] = 1 |
---|
901 | NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_FT |
---|
902 | Make/O/I/N=(128,48) data = 0 |
---|
903 | data[0,49][] = 1 |
---|
904 | data[78,127][] = 1 |
---|
905 | data[50,77][] = 0 |
---|
906 | |
---|
907 | NewDataFolder/O/S root:VSANS_MASK_file:entry:instrument:detector_FB |
---|
908 | Make/O/I/N=(128,48) data = 0 |
---|
909 | data[0,49][] = 1 |
---|
910 | data[78,127][] = 1 |
---|
911 | data[50,77][] = 0 |
---|
912 | |
---|
913 | |
---|
914 | // fake, empty folders so that the generic loaders can be used |
---|
915 | NewDataFolder/O root:VSANS_MASK_file:entry:DAS_logs |
---|
916 | NewDataFolder/O root:VSANS_MASK_file:entry:control |
---|
917 | NewDataFolder/O root:VSANS_MASK_file:entry:reduction |
---|
918 | NewDataFolder/O root:VSANS_MASK_file:entry:sample |
---|
919 | NewDataFolder/O root:VSANS_MASK_file:entry:user |
---|
920 | SetDataFolder root: |
---|
921 | |
---|
922 | End |
---|
923 | |
---|
924 | |
---|
925 | // this default mask is only generated on startup of the panel, if a mask |
---|
926 | // has not been previously loaded. If any mask is present ("FT" is tested) then |
---|
927 | // this function is skipped and the existing mask is not overwritten |
---|
928 | Function V_GenerateDefaultMask() |
---|
929 | |
---|
930 | NewDataFolder/O/S root:Packages:NIST:VSANS:MSK:entry |
---|
931 | Make/O/T/N=1 title = "This is a MASK file for VSANS: VSANS_MASK" |
---|
932 | Make/O/T/N=1 start_date = "2015-02-28T08:15:30-5:00" |
---|
933 | NewDataFolder/O/S root:Packages:NIST:VSANS:MSK:entry:instrument |
---|
934 | Make/O/T/N=1 name = "NG3_VSANS" |
---|
935 | |
---|
936 | |
---|
937 | NVAR gHighResBinning = root:Packages:NIST:VSANS:Globals:gHighResBinning |
---|
938 | NewDataFolder/O/S root:Packages:NIST:VSANS:MSK:entry:instrument:detector_B |
---|
939 | switch(gHighResBinning) |
---|
940 | case 1: |
---|
941 | // TODOHIGHRES - the pix values are hard-wired |
---|
942 | Make/O/I/N=(2720,6624) data = 0 |
---|
943 | |
---|
944 | // TODOHIGHRES -- these values are simply the 4x4 values x4 |
---|
945 | // these will need to be updated |
---|
946 | data[][0,152] = 1 |
---|
947 | data[][6195,6623] = 1 // 107 pix *4 =428 |
---|
948 | data[0,40][] = 1 |
---|
949 | data[2679,2719][] = 1 // 10 pix (*4) |
---|
950 | |
---|
951 | break |
---|
952 | case 4: |
---|
953 | Make/O/I/N=(680,1656) data = 0 |
---|
954 | |
---|
955 | data[][0,38] = 1 |
---|
956 | data[][1535,1655] = 1 |
---|
957 | // data[0,10][] = 1 |
---|
958 | data[0,190][] = 1 //with the beam stop stuck on the detector |
---|
959 | data[669,679][] = 1 |
---|
960 | break |
---|
961 | default: |
---|
962 | Abort "No binning case matches in V_GenerateDefaultMask" |
---|
963 | endswitch |
---|
964 | |
---|
965 | |
---|
966 | NewDataFolder/O/S root:Packages:NIST:VSANS:MSK:entry:instrument:detector_MR |
---|
967 | Make/O/I/N=(48,128) data = 0 |
---|
968 | // data[][0,3] = 1 |
---|
969 | data[44,47][] = 1 |
---|
970 | data[][0,4] = 1 |
---|
971 | data[][123,127] = 1 |
---|
972 | NewDataFolder/O/S root:Packages:NIST:VSANS:MSK:entry:instrument:detector_ML |
---|
973 | Make/O/I/N=(48,128) data = 0 |
---|
974 | data[0,3][] = 1 |
---|
975 | // data[44,47][] = 1 |
---|
976 | data[][0,4] = 1 |
---|
977 | data[][123,127] = 1 |
---|
978 | NewDataFolder/O/S root:Packages:NIST:VSANS:MSK:entry:instrument:detector_MT |
---|
979 | Make/O/I/N=(128,48) data = 0 |
---|
980 | data[0,49][] = 1 |
---|
981 | data[78,127][] = 1 |
---|
982 | data[50,77][] = 0 |
---|
983 | |
---|
984 | NewDataFolder/O/S root:Packages:NIST:VSANS:MSK:entry:instrument:detector_MB |
---|
985 | Make/O/I/N=(128,48) data = 0 |
---|
986 | data[0,49][] = 1 |
---|
987 | data[78,127][] = 1 |
---|
988 | data[50,77][] = 0 |
---|
989 | |
---|
990 | NewDataFolder/O/S root:Packages:NIST:VSANS:MSK:entry:instrument:detector_FR |
---|
991 | Make/O/I/N=(48,128) data = 0 |
---|
992 | // data[][0,3] = 1 |
---|
993 | data[44,47][] = 1 |
---|
994 | data[][0,4] = 1 |
---|
995 | data[][123,127] = 1 |
---|
996 | NewDataFolder/O/S root:Packages:NIST:VSANS:MSK:entry:instrument:detector_FL |
---|
997 | Make/O/I/N=(48,128) data = 0 |
---|
998 | data[0,3][] = 1 |
---|
999 | // data[44,47][] = 1 |
---|
1000 | data[][0,4] = 1 |
---|
1001 | data[][123,127] = 1 |
---|
1002 | NewDataFolder/O/S root:Packages:NIST:VSANS:MSK:entry:instrument:detector_FT |
---|
1003 | Make/O/I/N=(128,48) data = 0 |
---|
1004 | data[0,49][] = 1 |
---|
1005 | data[78,127][] = 1 |
---|
1006 | data[50,77][] = 0 |
---|
1007 | |
---|
1008 | NewDataFolder/O/S root:Packages:NIST:VSANS:MSK:entry:instrument:detector_FB |
---|
1009 | Make/O/I/N=(128,48) data = 0 |
---|
1010 | data[0,49][] = 1 |
---|
1011 | data[78,127][] = 1 |
---|
1012 | data[50,77][] = 0 |
---|
1013 | |
---|
1014 | SetDataFolder root: |
---|
1015 | |
---|
1016 | end |
---|
1017 | |
---|
1018 | ////////////////////// MASK FILE |
---|
1019 | |
---|
1020 | |
---|
1021 | // (DONE) |
---|
1022 | // x- currently, there are no dummy fill values or attributes for the fake MASK file |
---|
1023 | // |
---|
1024 | Proc Setup_VSANS_MASK_Struct() |
---|
1025 | |
---|
1026 | // lays out the tree and fills with dummy values |
---|
1027 | H_Setup_VSANS_MASK_Structure() |
---|
1028 | |
---|
1029 | // writes in the attributes |
---|
1030 | // H_Fill_VSANS_Attributes() |
---|
1031 | |
---|
1032 | |
---|
1033 | End |
---|
1034 | |
---|
1035 | Proc Save_VSANS_MASK_Nexus(fileName) |
---|
1036 | String fileName="Test_VSANS_MASK_file" |
---|
1037 | |
---|
1038 | // save as HDF5 (no attributes saved yet) |
---|
1039 | Save_VSANS_file("root:VSANS_MASK_file", fileName+".MASK.h5") |
---|
1040 | |
---|
1041 | // // read in a data file using the gateway-- reads from the home path |
---|
1042 | // H_HDF5Gate_Read_Raw(fileName+".h5") |
---|
1043 | // |
---|
1044 | // // after reading in a "partial" file using the gateway (to generate the xref) |
---|
1045 | // // Save the xref to disk (for later use) |
---|
1046 | // Save_HDF5___xref("root:"+fileName,"HDF5___xref") |
---|
1047 | // |
---|
1048 | // // after you've generated the HDF5___xref, load it in and copy it |
---|
1049 | // // to the necessary folder location. |
---|
1050 | // Copy_HDF5___xref("root:VSANS_MASK_file", "HDF5___xref") |
---|
1051 | // |
---|
1052 | // // writes out the contents of a data folder using the gateway |
---|
1053 | // H_HDF5Gate_Write_Raw("root:VSANS_MASK_file", fileName+".h5") |
---|
1054 | // |
---|
1055 | // // re-load the data file using the gateway-- reads from the home path |
---|
1056 | // // now with attributes |
---|
1057 | // H_HDF5Gate_Read_Raw(fileName+".h5") |
---|
1058 | |
---|
1059 | End |
---|
1060 | |
---|
1061 | |
---|
1062 | |
---|
1063 | |
---|
1064 | ////////////////// |
---|
1065 | // procedures for an integrated panel to show the masks for all panels on a carriage |
---|
1066 | // |
---|
1067 | // also can be used to show the annular or sector ranges selected for averaging |
---|
1068 | // (so this block may be better located in one of the averaging procedure files) |
---|
1069 | // viewing the standard mask files may be a side benefit |
---|
1070 | // |
---|
1071 | // |
---|
1072 | // generally: |
---|
1073 | // - show the 4 panels on a carriage |
---|
1074 | // - allow selection of the averaging options |
---|
1075 | // - buttons for toggling of the mask, do average |
---|
1076 | // |
---|
1077 | // copy the general panel structure from DIVUtils, and add a larger control area for input |
---|
1078 | // - use the averaging routines from the main data display |
---|
1079 | // |
---|
1080 | |
---|
1081 | |
---|
1082 | Proc V_Display_Four_Panels() |
---|
1083 | V_SetupPanelDisplay() |
---|
1084 | end |
---|
1085 | |
---|
1086 | Function V_SetupPanelDisplay() |
---|
1087 | DoWindow/F VSANS_Det_Panels |
---|
1088 | if(V_flag==0) |
---|
1089 | |
---|
1090 | NewDataFolder/O root:Packages:NIST:VSANS:Globals:Mask |
---|
1091 | |
---|
1092 | Variable/G root:Packages:NIST:VSANS:Globals:Mask:gAnnularQCtr = 0.1 |
---|
1093 | Variable/G root:Packages:NIST:VSANS:Globals:Mask:gAnnularDQ = 0.01 |
---|
1094 | |
---|
1095 | Variable/G root:Packages:NIST:VSANS:Globals:Mask:gSectorAngle = 30 |
---|
1096 | Variable/G root:Packages:NIST:VSANS:Globals:Mask:gSectorDQ = 10 |
---|
1097 | |
---|
1098 | // check for a mask, if not present, generate a default mask |
---|
1099 | String str="FT" |
---|
1100 | wave/Z maskW = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+str+":data") |
---|
1101 | if(!WaveExists(maskW)) |
---|
1102 | V_GenerateDefaultMask() |
---|
1103 | endif |
---|
1104 | |
---|
1105 | Execute "V_Display_Det_Panels()" |
---|
1106 | endif |
---|
1107 | End |
---|
1108 | |
---|
1109 | |
---|
1110 | // |
---|
1111 | // simple panel to display the 4 detector panels |
---|
1112 | // |
---|
1113 | // TODO: |
---|
1114 | // -- label panels, axes |
---|
1115 | // x- add in display of "B" |
---|
1116 | |
---|
1117 | Proc V_Display_Det_Panels() |
---|
1118 | PauseUpdate; Silent 1 // building window... |
---|
1119 | NewPanel /W=(720,45,1500,570)/N=VSANS_Det_Panels/K=1 |
---|
1120 | DoWindow/C VSANS_Det_Panels |
---|
1121 | // ModifyPanel fixedSize=1,noEdit =1 |
---|
1122 | |
---|
1123 | |
---|
1124 | PopupMenu popup0,pos={15.00,10.00},size={77.00,23.00},proc=V_PickCarriagePopMenuProc,title="Carriage" |
---|
1125 | PopupMenu popup0,mode=1,value= #"\"F;M;B;\"" |
---|
1126 | PopupMenu popup1,pos={100.00,10.00},size={68.00,23.00},proc=V_PickFolderPopMenuProc,title="Folder" |
---|
1127 | PopupMenu popup1,mode=1,popvalue="RAW",value= #"\"SAM;EMP;BGD;DIV;COR;CAL;RAW;ABS;STO;SUB;DRK;MSK;ADJ;VCALC;\"" |
---|
1128 | // PopupMenu popup1,mode=1,popvalue="RAW",value= #"\"SAM;EMP;BGD;DIV;COR;CAL;RAW;ABS;STO;SUB;DRK;MSK;ADJ;VCALC;\"" |
---|
1129 | PopupMenu popup2,pos={200.00,10.00},size={83.00,23.00},title="Bin Type"//,proc=V_DummyPopMenuProc |
---|
1130 | PopupMenu popup2,mode=1,value= ksBinTypeStr |
---|
1131 | PopupMenu popup3,pos={350,10.00},size={83.00,23.00},title="Average Type"//,proc=V_DummyPopMenuProc |
---|
1132 | PopupMenu popup3,mode=1,value= #"\"Circular;Sector;Annular;\"" |
---|
1133 | // Button button0,pos={520.00,10.00},size={110.00,20.00},proc=V_UpdatePanelsButtonProc,title="Update Display" |
---|
1134 | Button button1,pos={520.00,40.00},size={100.00,20.00},proc=V_ToggleFourMaskButtonProc,title="Toggle Mask" |
---|
1135 | Button button2,pos={350.00,40.00},size={120.00,20.00},proc=V_ShowAvgRangeButtonProc,title="Show Avg Range" |
---|
1136 | Button button3,pos={350.00,70.00},size={100.00,20.00},proc=V_DoPanelAvgButtonProc,title="Do Average" |
---|
1137 | Button button4,pos={720.00,10.00},size={25.00,20.00},proc=V_AvgPanelHelpButtonProc,title="?" |
---|
1138 | |
---|
1139 | SetVariable setvar0,pos={20,40},size={160,23},title="Annulus q-center (A)" |
---|
1140 | SetVariable setvar0,limits={0,1,0.001},value=root:Packages:NIST:VSANS:Globals:Mask:gAnnularQCtr |
---|
1141 | SetVariable setvar1,pos={20,70},size={160,23},title="Annulus (+/-) q (A)" |
---|
1142 | SetVariable setvar1,limits={0,1,0.001},value=root:Packages:NIST:VSANS:Globals:Mask:gAnnularDQ |
---|
1143 | SetVariable setvar2,pos={190,40},size={150,23},title="Sector Angle (deg)" |
---|
1144 | SetVariable setvar2,limits={-90,90,1},value=root:Packages:NIST:VSANS:Globals:Mask:gSectorAngle |
---|
1145 | SetVariable setvar3,pos={190,70},size={150,23},title="Sector (+/-) (deg)" |
---|
1146 | SetVariable setvar3,limits={0,90,1},value=root:Packages:NIST:VSANS:Globals:Mask:gSectorDQ |
---|
1147 | |
---|
1148 | PopupMenu popup4,pos={200,100},size={90,23.00},title="Sector Side(s)"//,proc=V_DummyPopMenuProc |
---|
1149 | PopupMenu popup4,mode=1,value= #"\"both;left;right;\"" |
---|
1150 | |
---|
1151 | Make/O/B/N=(48,128) tmpLR |
---|
1152 | Make/O/B/N=(128,48) tmpTB |
---|
1153 | Make/O/B/N=(680,1656) tmpB |
---|
1154 | |
---|
1155 | tmpLR = 1 |
---|
1156 | tmpTB = 1 |
---|
1157 | tmpB = 1 |
---|
1158 | |
---|
1159 | // Display/W=(745,45,945,425)/HOST=# |
---|
1160 | Display/W=(10,45+80,210,425+80)/HOST=# |
---|
1161 | // root:Packages:NIST:VSANS:RAW:entry:instrument:detector_FL:data |
---|
1162 | AppendImage/T/G=1 tmpLR // /G=1 flag prevents interpretation as RGB so 3, 4 slices display correctly |
---|
1163 | |
---|
1164 | ModifyImage tmpLR ctab= {*,*,ColdWarm,0} |
---|
1165 | ModifyImage tmpLR ctabAutoscale=3 |
---|
1166 | ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 |
---|
1167 | ModifyGraph mirror=2 |
---|
1168 | ModifyGraph nticks=4 |
---|
1169 | ModifyGraph minor=1 |
---|
1170 | ModifyGraph fSize=9 |
---|
1171 | ModifyGraph standoff=0 |
---|
1172 | ModifyGraph tkLblRot(left)=90 |
---|
1173 | ModifyGraph btLen=3 |
---|
1174 | ModifyGraph tlOffset=-2 |
---|
1175 | RenameWindow #,Panel_L |
---|
1176 | SetActiveSubwindow ## |
---|
1177 | |
---|
1178 | // Display/W=(1300,45,1500,425)/HOST=# |
---|
1179 | Display/W=(565,45+80,765,425+80)/HOST=# |
---|
1180 | AppendImage/T/G=1 tmpLR // /G=1 flag prevents interpretation as RGB so 3, 4 slices display correctly |
---|
1181 | ModifyImage tmpLR ctab= {*,*,ColdWarm,0} |
---|
1182 | ModifyImage tmpLR ctabAutoscale=3 |
---|
1183 | ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 |
---|
1184 | ModifyGraph mirror=2 |
---|
1185 | ModifyGraph nticks=4 |
---|
1186 | ModifyGraph minor=1 |
---|
1187 | ModifyGraph fSize=9 |
---|
1188 | ModifyGraph standoff=0 |
---|
1189 | ModifyGraph tkLblRot(left)=90 |
---|
1190 | ModifyGraph btLen=3 |
---|
1191 | ModifyGraph tlOffset=-2 |
---|
1192 | RenameWindow #,Panel_R |
---|
1193 | SetActiveSubwindow ## |
---|
1194 | |
---|
1195 | // Display/W=(945,45,1300,235)/HOST=# |
---|
1196 | Display/W=(210,45+80,565,235+80)/HOST=# |
---|
1197 | AppendImage/T/G=1 tmpTB // /G=1 flag prevents interpretation as RGB so 3, 4 slices display correctly |
---|
1198 | ModifyImage tmpTB ctab= {*,*,ColdWarm,0} |
---|
1199 | ModifyImage tmpTB ctabAutoscale=3 |
---|
1200 | ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 |
---|
1201 | ModifyGraph mirror=2 |
---|
1202 | ModifyGraph nticks=4 |
---|
1203 | ModifyGraph minor=1 |
---|
1204 | ModifyGraph fSize=9 |
---|
1205 | ModifyGraph standoff=0 |
---|
1206 | ModifyGraph tkLblRot(left)=90 |
---|
1207 | ModifyGraph btLen=3 |
---|
1208 | ModifyGraph tlOffset=-2 |
---|
1209 | RenameWindow #,Panel_T |
---|
1210 | SetActiveSubwindow ## |
---|
1211 | |
---|
1212 | // Display/W=(945,235,1300,425)/HOST=# |
---|
1213 | Display/W=(210,235+80,565,425+80)/HOST=# |
---|
1214 | AppendImage/T/G=1 tmpTB // /G=1 flag prevents interpretation as RGB so 3, 4 slices display correctly |
---|
1215 | ModifyImage tmpTB ctab= {*,*,ColdWarm,0} |
---|
1216 | ModifyImage tmpTB ctabAutoscale=3 |
---|
1217 | ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 |
---|
1218 | ModifyGraph mirror=2 |
---|
1219 | ModifyGraph nticks=4 |
---|
1220 | ModifyGraph minor=1 |
---|
1221 | ModifyGraph fSize=9 |
---|
1222 | ModifyGraph standoff=0 |
---|
1223 | ModifyGraph tkLblRot(left)=90 |
---|
1224 | ModifyGraph btLen=3 |
---|
1225 | ModifyGraph tlOffset=-2 |
---|
1226 | RenameWindow #,Panel_B |
---|
1227 | SetActiveSubwindow ## |
---|
1228 | // |
---|
1229 | |
---|
1230 | End |
---|
1231 | |
---|
1232 | |
---|
1233 | // called by the "update" button |
---|
1234 | // |
---|
1235 | // must check for overlay of mask and of avgMask |
---|
1236 | // |
---|
1237 | Function V_UpdateFourPanelDisp() |
---|
1238 | |
---|
1239 | ControlInfo/W=VSANS_Det_Panels popup0 |
---|
1240 | String carrStr = S_value |
---|
1241 | |
---|
1242 | // if(cmpstr("B",carrStr)==0) |
---|
1243 | // DoAlert 0, "Detector B plotting not supported yet" |
---|
1244 | // return(0) |
---|
1245 | // endif |
---|
1246 | |
---|
1247 | ControlInfo/W=VSANS_Det_Panels popup1 |
---|
1248 | String folder = S_Value |
---|
1249 | |
---|
1250 | Variable isVCALC=0 |
---|
1251 | if(cmpstr("VCALC",folder)==0) |
---|
1252 | isVCALC=1 |
---|
1253 | endif |
---|
1254 | |
---|
1255 | String tmpStr="" |
---|
1256 | // |
---|
1257 | |
---|
1258 | |
---|
1259 | // remove everything from each of the 4 panels |
---|
1260 | tmpStr = ImageNameList("VSANS_Det_Panels#Panel_L",";") |
---|
1261 | if(ItemsInList(tmpStr) > 0) |
---|
1262 | do |
---|
1263 | RemoveImage /W=VSANS_Det_Panels#Panel_L $(StringFromList(0,tmpStr,";")) //get 1st item |
---|
1264 | tmpStr = ImageNameList("VSANS_Det_Panels#Panel_L",";") //refresh list |
---|
1265 | while(ItemsInList(tmpStr) > 0) |
---|
1266 | endif |
---|
1267 | |
---|
1268 | tmpStr = ImageNameList("VSANS_Det_Panels#Panel_R",";") |
---|
1269 | if(ItemsInList(tmpStr) > 0) |
---|
1270 | do |
---|
1271 | RemoveImage /W=VSANS_Det_Panels#Panel_R $(StringFromList(0,tmpStr,";")) //get 1st item |
---|
1272 | tmpStr = ImageNameList("VSANS_Det_Panels#Panel_R",";") //refresh list |
---|
1273 | while(ItemsInList(tmpStr) > 0) |
---|
1274 | endif |
---|
1275 | |
---|
1276 | tmpStr = ImageNameList("VSANS_Det_Panels#Panel_T",";") |
---|
1277 | if(ItemsInList(tmpStr) > 0) |
---|
1278 | do |
---|
1279 | RemoveImage /W=VSANS_Det_Panels#Panel_T $(StringFromList(0,tmpStr,";")) //get 1st item |
---|
1280 | tmpStr = ImageNameList("VSANS_Det_Panels#Panel_T",";") //refresh list |
---|
1281 | while(ItemsInList(tmpStr) > 0) |
---|
1282 | endif |
---|
1283 | |
---|
1284 | tmpStr = ImageNameList("VSANS_Det_Panels#Panel_B",";") |
---|
1285 | if(ItemsInList(tmpStr) > 0) |
---|
1286 | do |
---|
1287 | RemoveImage /W=VSANS_Det_Panels#Panel_B $(StringFromList(0,tmpStr,";")) //get 1st item |
---|
1288 | tmpStr = ImageNameList("VSANS_Det_Panels#Panel_B",";") //refresh list |
---|
1289 | while(ItemsInList(tmpStr) > 0) |
---|
1290 | endif |
---|
1291 | |
---|
1292 | |
---|
1293 | // append the new image |
---|
1294 | // if back, put this in the "left" postion, and nothing else |
---|
1295 | if(cmpstr("B",carrStr)==0) |
---|
1296 | if(isVCALC) |
---|
1297 | AppendImage/T/G=1/W=VSANS_Det_Panels#Panel_L $("root:Packages:NIST:VSANS:"+folder+":entry:instrument:detector_"+carrStr+":det_"+carrStr) |
---|
1298 | SetActiveSubwindow VSANS_Det_Panels#Panel_L |
---|
1299 | ModifyImage ''#0 ctab= {*,*,ColdWarm,0} |
---|
1300 | ModifyImage ''#0 ctabAutoscale=3 |
---|
1301 | else |
---|
1302 | AppendImage/T/G=1/W=VSANS_Det_Panels#Panel_L $("root:Packages:NIST:VSANS:"+folder+":entry:instrument:detector_"+carrStr+":data") |
---|
1303 | SetActiveSubwindow VSANS_Det_Panels#Panel_L |
---|
1304 | ModifyImage data ctab= {*,*,ColdWarm,0} |
---|
1305 | ModifyImage data ctabAutoscale=3 |
---|
1306 | endif |
---|
1307 | ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 |
---|
1308 | ModifyGraph mirror=2 |
---|
1309 | ModifyGraph nticks=4 |
---|
1310 | ModifyGraph minor=1 |
---|
1311 | ModifyGraph fSize=9 |
---|
1312 | ModifyGraph standoff=0 |
---|
1313 | ModifyGraph tkLblRot(left)=90 |
---|
1314 | ModifyGraph btLen=3 |
---|
1315 | ModifyGraph tlOffset=-2 |
---|
1316 | SetActiveSubwindow ## |
---|
1317 | return(0) |
---|
1318 | endif |
---|
1319 | |
---|
1320 | // RemoveImage/Z/W=VSANS_Det_Panels#Panel_L data |
---|
1321 | if(isVCALC) |
---|
1322 | AppendImage/T/G=1/W=VSANS_Det_Panels#Panel_L $("root:Packages:NIST:VSANS:"+folder+":entry:instrument:detector_"+carrStr+"L:det_"+carrStr+"L") |
---|
1323 | SetActiveSubwindow VSANS_Det_Panels#Panel_L |
---|
1324 | ModifyImage ''#0 ctab= {*,*,ColdWarm,0} |
---|
1325 | ModifyImage ''#0 ctabAutoscale=3 |
---|
1326 | else |
---|
1327 | AppendImage/T/G=1/W=VSANS_Det_Panels#Panel_L $("root:Packages:NIST:VSANS:"+folder+":entry:instrument:detector_"+carrStr+"L:data") |
---|
1328 | SetActiveSubwindow VSANS_Det_Panels#Panel_L |
---|
1329 | ModifyImage data ctab= {*,*,ColdWarm,0} |
---|
1330 | ModifyImage data ctabAutoscale=3 |
---|
1331 | endif |
---|
1332 | ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 |
---|
1333 | ModifyGraph mirror=2 |
---|
1334 | ModifyGraph nticks=4 |
---|
1335 | ModifyGraph minor=1 |
---|
1336 | ModifyGraph fSize=9 |
---|
1337 | ModifyGraph standoff=0 |
---|
1338 | ModifyGraph tkLblRot(left)=90 |
---|
1339 | ModifyGraph btLen=3 |
---|
1340 | ModifyGraph tlOffset=-2 |
---|
1341 | SetActiveSubwindow ## |
---|
1342 | |
---|
1343 | |
---|
1344 | // RemoveImage/Z/W=VSANS_Det_Panels#Panel_T data |
---|
1345 | if(isVCALC) |
---|
1346 | AppendImage/T/G=1/W=VSANS_Det_Panels#Panel_T $("root:Packages:NIST:VSANS:"+folder+":entry:instrument:detector_"+carrStr+"T:det_"+carrStr+"T") |
---|
1347 | SetActiveSubwindow VSANS_Det_Panels#Panel_T |
---|
1348 | ModifyImage ''#0 ctab= {*,*,ColdWarm,0} |
---|
1349 | ModifyImage ''#0 ctabAutoscale=3 |
---|
1350 | else |
---|
1351 | AppendImage/T/G=1/W=VSANS_Det_Panels#Panel_T $("root:Packages:NIST:VSANS:"+folder+":entry:instrument:detector_"+carrStr+"T:data") |
---|
1352 | SetActiveSubwindow VSANS_Det_Panels#Panel_T |
---|
1353 | ModifyImage data ctab= {*,*,ColdWarm,0} |
---|
1354 | ModifyImage data ctabAutoscale=3 |
---|
1355 | endif |
---|
1356 | ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 |
---|
1357 | ModifyGraph mirror=2 |
---|
1358 | ModifyGraph nticks=4 |
---|
1359 | ModifyGraph minor=1 |
---|
1360 | ModifyGraph fSize=9 |
---|
1361 | ModifyGraph standoff=0 |
---|
1362 | ModifyGraph tkLblRot(left)=90 |
---|
1363 | ModifyGraph btLen=3 |
---|
1364 | ModifyGraph tlOffset=-2 |
---|
1365 | SetActiveSubwindow ## |
---|
1366 | |
---|
1367 | // RemoveImage/Z/W=VSANS_Det_Panels#Panel_B data |
---|
1368 | if(isVCALC) |
---|
1369 | AppendImage/T/G=1/W=VSANS_Det_Panels#Panel_B $("root:Packages:NIST:VSANS:"+folder+":entry:instrument:detector_"+carrStr+"B:det_"+carrStr+"B") |
---|
1370 | SetActiveSubwindow VSANS_Det_Panels#Panel_B |
---|
1371 | ModifyImage ''#0 ctab= {*,*,ColdWarm,0} |
---|
1372 | ModifyImage ''#0 ctabAutoscale=3 |
---|
1373 | else |
---|
1374 | AppendImage/T/G=1/W=VSANS_Det_Panels#Panel_B $("root:Packages:NIST:VSANS:"+folder+":entry:instrument:detector_"+carrStr+"B:data") |
---|
1375 | SetActiveSubwindow VSANS_Det_Panels#Panel_B |
---|
1376 | ModifyImage data ctab= {*,*,ColdWarm,0} |
---|
1377 | ModifyImage data ctabAutoscale=3 |
---|
1378 | endif |
---|
1379 | ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 |
---|
1380 | ModifyGraph mirror=2 |
---|
1381 | ModifyGraph nticks=4 |
---|
1382 | ModifyGraph minor=1 |
---|
1383 | ModifyGraph fSize=9 |
---|
1384 | ModifyGraph standoff=0 |
---|
1385 | ModifyGraph tkLblRot(left)=90 |
---|
1386 | ModifyGraph btLen=3 |
---|
1387 | ModifyGraph tlOffset=-2 |
---|
1388 | SetActiveSubwindow ## |
---|
1389 | |
---|
1390 | // RemoveImage/Z/W=VSANS_Det_Panels#Panel_R data |
---|
1391 | if(isVCALC) |
---|
1392 | AppendImage/T/G=1/W=VSANS_Det_Panels#Panel_R $("root:Packages:NIST:VSANS:"+folder+":entry:instrument:detector_"+carrStr+"R:det_"+carrStr+"R") |
---|
1393 | SetActiveSubwindow VSANS_Det_Panels#Panel_R |
---|
1394 | ModifyImage ''#0 ctab= {*,*,ColdWarm,0} |
---|
1395 | ModifyImage ''#0 ctabAutoscale=3 |
---|
1396 | else |
---|
1397 | AppendImage/T/G=1/W=VSANS_Det_Panels#Panel_R $("root:Packages:NIST:VSANS:"+folder+":entry:instrument:detector_"+carrStr+"R:data") |
---|
1398 | SetActiveSubwindow VSANS_Det_Panels#Panel_R |
---|
1399 | ModifyImage data ctab= {*,*,ColdWarm,0} |
---|
1400 | ModifyImage data ctabAutoscale=3 |
---|
1401 | endif |
---|
1402 | ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 |
---|
1403 | ModifyGraph mirror=2 |
---|
1404 | ModifyGraph nticks=4 |
---|
1405 | ModifyGraph minor=1 |
---|
1406 | ModifyGraph fSize=9 |
---|
1407 | ModifyGraph standoff=0 |
---|
1408 | ModifyGraph tkLblRot(left)=90 |
---|
1409 | ModifyGraph btLen=3 |
---|
1410 | ModifyGraph tlOffset=-2 |
---|
1411 | SetActiveSubwindow ## |
---|
1412 | |
---|
1413 | return(0) |
---|
1414 | End |
---|
1415 | |
---|
1416 | |
---|
1417 | |
---|
1418 | |
---|
1419 | Function V_PickFolderPopMenuProc(pa) : PopupMenuControl |
---|
1420 | STRUCT WMPopupAction &pa |
---|
1421 | |
---|
1422 | switch( pa.eventCode ) |
---|
1423 | case 2: // mouse up |
---|
1424 | Variable popNum = pa.popNum |
---|
1425 | String popStr = pa.popStr |
---|
1426 | break |
---|
1427 | case -1: // control being killed |
---|
1428 | break |
---|
1429 | endswitch |
---|
1430 | |
---|
1431 | return 0 |
---|
1432 | End |
---|
1433 | |
---|
1434 | Function V_PickCarriagePopMenuProc(pa) : PopupMenuControl |
---|
1435 | STRUCT WMPopupAction &pa |
---|
1436 | |
---|
1437 | switch( pa.eventCode ) |
---|
1438 | case 2: // mouse up |
---|
1439 | Variable popNum = pa.popNum |
---|
1440 | String popStr = pa.popStr |
---|
1441 | |
---|
1442 | // update the data that is displayed |
---|
1443 | V_UpdateFourPanelDisp() |
---|
1444 | |
---|
1445 | break |
---|
1446 | case -1: // control being killed |
---|
1447 | break |
---|
1448 | endswitch |
---|
1449 | |
---|
1450 | return 0 |
---|
1451 | End |
---|
1452 | |
---|
1453 | |
---|
1454 | |
---|
1455 | Function V_UpdatePanelsButtonProc(ba) : ButtonControl |
---|
1456 | STRUCT WMButtonAction &ba |
---|
1457 | |
---|
1458 | switch( ba.eventCode ) |
---|
1459 | case 2: // mouse up |
---|
1460 | // click code here |
---|
1461 | |
---|
1462 | // do nothing |
---|
1463 | |
---|
1464 | |
---|
1465 | |
---|
1466 | break |
---|
1467 | case -1: // control being killed |
---|
1468 | break |
---|
1469 | endswitch |
---|
1470 | |
---|
1471 | return 0 |
---|
1472 | End |
---|
1473 | |
---|
1474 | // |
---|
1475 | // toggle the mask overlay(s) on/off of the detector panels. |
---|
1476 | // |
---|
1477 | Function V_ToggleFourMaskButtonProc(ba) : ButtonControl |
---|
1478 | STRUCT WMButtonAction &ba |
---|
1479 | |
---|
1480 | switch( ba.eventCode ) |
---|
1481 | case 2: // mouse up |
---|
1482 | // click code here |
---|
1483 | |
---|
1484 | String detStr |
---|
1485 | Variable state,isVCALC |
---|
1486 | |
---|
1487 | ControlInfo/W=VSANS_Det_Panels popup1 |
---|
1488 | String folderStr = S_Value |
---|
1489 | |
---|
1490 | ControlInfo/W=VSANS_Det_Panels popup0 |
---|
1491 | String carrStr = S_Value |
---|
1492 | |
---|
1493 | if(cmpstr(folderStr,"VCALC") == 0) |
---|
1494 | isVCALC = 1 |
---|
1495 | else |
---|
1496 | isVCALC = 0 |
---|
1497 | endif |
---|
1498 | |
---|
1499 | // handle "B" separately |
---|
1500 | if(cmpstr(carrStr,"B") == 0) |
---|
1501 | detStr = carrStr |
---|
1502 | // is the mask already there? |
---|
1503 | wave/Z overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":overlay_"+detStr) |
---|
1504 | CheckDisplayed/W=VSANS_Det_Panels#Panel_L overlay |
---|
1505 | if(V_Flag == 1) //overlay is present, set state = 0 to remove overlay |
---|
1506 | state = 0 |
---|
1507 | else |
---|
1508 | state = 1 |
---|
1509 | endif |
---|
1510 | |
---|
1511 | if(state == 1) |
---|
1512 | //duplicate the mask, which is named "data" |
---|
1513 | wave maskW = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":data") |
---|
1514 | // for the wave scaling |
---|
1515 | if(isVCALC) |
---|
1516 | wave data = $("root:Packages:NIST:VSANS:"+folderStr+":entry:instrument:detector_"+detStr+":det_"+detStr) |
---|
1517 | else |
---|
1518 | wave data = $("root:Packages:NIST:VSANS:"+folderStr+":entry:instrument:detector_"+detStr+":data") |
---|
1519 | endif |
---|
1520 | Duplicate/O data $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":overlay_"+detStr) |
---|
1521 | wave overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":overlay_"+detStr) |
---|
1522 | overlay = maskW //this copies the data into the properly scaled wave |
---|
1523 | |
---|
1524 | //"B" uses the L side display |
---|
1525 | // Print ImageNameList("VSANS_Det_Panels#Panel_L", ";" ) |
---|
1526 | CheckDisplayed/W=VSANS_Det_Panels#Panel_L overlay |
---|
1527 | if(V_flag==0) //so the overlay doesn't get appended more than once |
---|
1528 | AppendImage/T/W=VSANS_Det_Panels#Panel_L overlay |
---|
1529 | // ModifyImage/W=VSANS_Det_Panels#Panel_L overlay ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,35000) |
---|
1530 | ModifyImage/W=VSANS_Det_Panels#Panel_L ''#1 ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,35000) |
---|
1531 | endif |
---|
1532 | |
---|
1533 | endif //state == 1 |
---|
1534 | |
---|
1535 | if(state == 0) |
---|
1536 | wave overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":overlay_"+detStr) |
---|
1537 | |
---|
1538 | //"B" uses the L side display |
---|
1539 | |
---|
1540 | CheckDisplayed/W=VSANS_Det_Panels#Panel_L overlay |
---|
1541 | if(V_Flag == 1) //overlay is present |
---|
1542 | // RemoveImage/W=VSANS_Det_Panels#Panel_L overlay |
---|
1543 | RemoveImage/W=VSANS_Det_Panels#Panel_L ''#1 |
---|
1544 | endif |
---|
1545 | endif //state == 0 |
---|
1546 | |
---|
1547 | return(0) |
---|
1548 | endif //handle carriage B |
---|
1549 | |
---|
1550 | |
---|
1551 | // now toggle the mask for the F or M carriages |
---|
1552 | // test the L image to see if I need to remove the mask |
---|
1553 | if(cmpstr(carrStr,"F")==0) |
---|
1554 | detStr = "FL" |
---|
1555 | else |
---|
1556 | detStr = "ML" |
---|
1557 | endif |
---|
1558 | |
---|
1559 | wave/Z overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":overlay_"+detStr) |
---|
1560 | CheckDisplayed/W=VSANS_Det_Panels#Panel_L overlay |
---|
1561 | if(V_Flag == 1) //overlay is present, set state = 0 to remove overlay |
---|
1562 | state = 0 |
---|
1563 | else |
---|
1564 | state = 1 |
---|
1565 | endif |
---|
1566 | |
---|
1567 | if(cmpstr(carrStr,"F") == 0) |
---|
1568 | V_OverlayFourMask(folderStr,"FL",state) |
---|
1569 | V_OverlayFourMask(folderStr,"FR",state) |
---|
1570 | V_OverlayFourMask(folderStr,"FT",state) |
---|
1571 | V_OverlayFourMask(folderStr,"FB",state) |
---|
1572 | else |
---|
1573 | V_OverlayFourMask(folderStr,"ML",state) |
---|
1574 | V_OverlayFourMask(folderStr,"MR",state) |
---|
1575 | V_OverlayFourMask(folderStr,"MT",state) |
---|
1576 | V_OverlayFourMask(folderStr,"MB",state) |
---|
1577 | endif |
---|
1578 | |
---|
1579 | break |
---|
1580 | case -1: // control being killed |
---|
1581 | break |
---|
1582 | endswitch |
---|
1583 | |
---|
1584 | return 0 |
---|
1585 | End |
---|
1586 | |
---|
1587 | Function V_ShowAvgRangeButtonProc(ba) : ButtonControl |
---|
1588 | STRUCT WMButtonAction &ba |
---|
1589 | |
---|
1590 | switch( ba.eventCode ) |
---|
1591 | case 2: // mouse up |
---|
1592 | // click code here |
---|
1593 | |
---|
1594 | ControlInfo/W=VSANS_Det_Panels popup3 |
---|
1595 | String av_type = S_Value |
---|
1596 | |
---|
1597 | ControlInfo/W=VSANS_Det_Panels popup1 |
---|
1598 | String folderStr = S_Value |
---|
1599 | |
---|
1600 | ControlInfo/W=VSANS_Det_Panels popup0 |
---|
1601 | String detGroup = S_Value |
---|
1602 | |
---|
1603 | Variable isVCALC |
---|
1604 | if(cmpstr(folderStr,"VCALC")==0) |
---|
1605 | isVCALC = 1 |
---|
1606 | else |
---|
1607 | isVCALC = 0 |
---|
1608 | endif |
---|
1609 | |
---|
1610 | // calculate the "mask" to add |
---|
1611 | |
---|
1612 | // if circular, do nothing |
---|
1613 | // if annular |
---|
1614 | // if sector |
---|
1615 | // display the mask on the current data |
---|
1616 | |
---|
1617 | Variable ii |
---|
1618 | String detStr |
---|
1619 | String str1 = "root:Packages:NIST:VSANS:"+folderStr |
---|
1620 | String str2 = ":entry:instrument:detector_" |
---|
1621 | |
---|
1622 | strswitch(av_type) //dispatch to the proper routine to calculate mask |
---|
1623 | |
---|
1624 | case "Circular": |
---|
1625 | //do nothing |
---|
1626 | break |
---|
1627 | |
---|
1628 | case "Sector": |
---|
1629 | ControlInfo/W=VSANS_Det_Panels popup4 |
---|
1630 | String side = S_Value |
---|
1631 | NVAR phi_rad = root:Packages:NIST:VSANS:Globals:Mask:gSectorAngle |
---|
1632 | NVAR dphi_rad = root:Packages:NIST:VSANS:Globals:Mask:gSectorDQ |
---|
1633 | |
---|
1634 | // loop over all of the panels |
---|
1635 | // calculate phi matrix |
---|
1636 | // fill in the mask |
---|
1637 | for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) |
---|
1638 | detStr = StringFromList(ii, ksDetectorListAll, ";") |
---|
1639 | Wave qTotal = $(str1+str2+detStr+":qTot_"+detStr) |
---|
1640 | Wave phi = V_MakePhiMatrix(qTotal,folderStr,detStr,str1+str2+detStr) |
---|
1641 | if(isVCALC) |
---|
1642 | Wave w = $("root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_"+detStr+":det_"+detStr) |
---|
1643 | else |
---|
1644 | Wave w = V_getDetectorDataW(folderStr,detStr) //this is simply to get the correct wave scaling on the overlay |
---|
1645 | endif |
---|
1646 | Duplicate/O w $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":AvgOverlay_"+detStr) |
---|
1647 | Wave overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":AvgOverlay_"+detStr) |
---|
1648 | V_MarkSectorOverlayPixels(phi,overlay,phi_rad,dphi_rad,side) |
---|
1649 | endfor |
---|
1650 | |
---|
1651 | break |
---|
1652 | case "Sector_PlusMinus": |
---|
1653 | break |
---|
1654 | case "Rectangular": |
---|
1655 | break |
---|
1656 | |
---|
1657 | case "Annular": |
---|
1658 | |
---|
1659 | NVAR qCtr_Ann = root:Packages:NIST:VSANS:Globals:Mask:gAnnularQCtr |
---|
1660 | NVAR qWidth = root:Packages:NIST:VSANS:Globals:Mask:gAnnularDQ |
---|
1661 | |
---|
1662 | // loop over all of the panels |
---|
1663 | // fill in the mask |
---|
1664 | for(ii=0;ii<ItemsInList(ksDetectorListAll);ii+=1) |
---|
1665 | detStr = StringFromList(ii, ksDetectorListAll, ";") |
---|
1666 | Wave qTotal = $(str1+str2+detStr+":qTot_"+detStr) |
---|
1667 | if(isVCALC) |
---|
1668 | Wave w = $("root:Packages:NIST:VSANS:VCALC:entry:instrument:detector_"+detStr+":det_"+detStr) |
---|
1669 | else |
---|
1670 | Wave w = V_getDetectorDataW(folderStr,detStr) //this is simply to get the correct wave scaling on the overlay |
---|
1671 | endif |
---|
1672 | Duplicate/O w $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":AvgOverlay_"+detStr) |
---|
1673 | Wave overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":AvgOverlay_"+detStr) |
---|
1674 | V_MarkAnnularOverlayPixels(qTotal,overlay,qCtr_ann,qWidth) |
---|
1675 | endfor |
---|
1676 | |
---|
1677 | break |
---|
1678 | default: |
---|
1679 | //do nothing |
---|
1680 | endswitch |
---|
1681 | |
---|
1682 | |
---|
1683 | |
---|
1684 | // switch for the overlay |
---|
1685 | strswitch(av_type) |
---|
1686 | case "Sector": |
---|
1687 | case "Annular": |
---|
1688 | case "Sector_PlusMinus": |
---|
1689 | case "Rectangular": |
---|
1690 | |
---|
1691 | Variable state = 1 |
---|
1692 | |
---|
1693 | ControlInfo/W=VSANS_Det_Panels popup0 |
---|
1694 | String carrStr = S_Value |
---|
1695 | |
---|
1696 | // handle "B" separately |
---|
1697 | if(cmpstr(carrStr,"B") == 0) |
---|
1698 | detStr = carrStr |
---|
1699 | // is the mask already there? |
---|
1700 | wave/Z overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":AvgOverlay_"+detStr) |
---|
1701 | CheckDisplayed/W=VSANS_Det_Panels#Panel_L overlay |
---|
1702 | if(V_Flag == 1) //overlay is present, set state = 0 to remove overlay |
---|
1703 | state = 0 |
---|
1704 | else |
---|
1705 | state = 1 |
---|
1706 | endif |
---|
1707 | |
---|
1708 | V_OverlayFourAvgMask(folderStr,"B",state) |
---|
1709 | return(0) |
---|
1710 | endif //carriage "B" |
---|
1711 | |
---|
1712 | // test the L image to see if I need to remove the mask |
---|
1713 | if(cmpstr(carrStr,"F")==0) |
---|
1714 | detStr = "FL" |
---|
1715 | else |
---|
1716 | detStr = "ML" |
---|
1717 | endif |
---|
1718 | |
---|
1719 | wave overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":AvgOverlay_"+detStr) |
---|
1720 | CheckDisplayed/W=VSANS_Det_Panels#Panel_L overlay |
---|
1721 | if(V_Flag == 1) //overlay is present |
---|
1722 | state = 0 |
---|
1723 | else |
---|
1724 | state = 1 |
---|
1725 | endif |
---|
1726 | |
---|
1727 | if(cmpstr(carrStr,"F") == 0) |
---|
1728 | V_OverlayFourAvgMask(folderStr,"FL",state) |
---|
1729 | V_OverlayFourAvgMask(folderStr,"FR",state) |
---|
1730 | V_OverlayFourAvgMask(folderStr,"FT",state) |
---|
1731 | V_OverlayFourAvgMask(folderStr,"FB",state) |
---|
1732 | else |
---|
1733 | V_OverlayFourAvgMask(folderStr,"ML",state) |
---|
1734 | V_OverlayFourAvgMask(folderStr,"MR",state) |
---|
1735 | V_OverlayFourAvgMask(folderStr,"MT",state) |
---|
1736 | V_OverlayFourAvgMask(folderStr,"MB",state) |
---|
1737 | endif |
---|
1738 | |
---|
1739 | break |
---|
1740 | |
---|
1741 | default: |
---|
1742 | //do nothing |
---|
1743 | endswitch |
---|
1744 | |
---|
1745 | |
---|
1746 | break |
---|
1747 | case -1: // control being killed |
---|
1748 | break |
---|
1749 | endswitch |
---|
1750 | |
---|
1751 | return 0 |
---|
1752 | End |
---|
1753 | |
---|
1754 | |
---|
1755 | // |
---|
1756 | // see V_Proto_doAverage() and V_Proto_doPlot() |
---|
1757 | // this duplicates the switch and functionality from these operations |
---|
1758 | // |
---|
1759 | Function V_DoPanelAvgButtonProc(ba) : ButtonControl |
---|
1760 | STRUCT WMButtonAction &ba |
---|
1761 | |
---|
1762 | switch( ba.eventCode ) |
---|
1763 | case 2: // mouse up |
---|
1764 | // click code here |
---|
1765 | |
---|
1766 | ControlInfo/W=VSANS_Det_Panels popup2 |
---|
1767 | Variable binType = V_BinTypeStr2Num(S_Value) |
---|
1768 | // V_BinningModePopup("",binType,S_Value) // does binning of current popString and updates the graph |
---|
1769 | |
---|
1770 | ControlInfo/W=VSANS_Det_Panels popup3 |
---|
1771 | String av_type = S_Value |
---|
1772 | |
---|
1773 | ControlInfo/W=VSANS_Det_Panels popup1 |
---|
1774 | String activeType = S_Value |
---|
1775 | |
---|
1776 | String collimationStr="pinhole" |
---|
1777 | |
---|
1778 | |
---|
1779 | strswitch(av_type) //dispatch to the proper routine to average to 1D data |
---|
1780 | case "none": |
---|
1781 | //still do nothing |
---|
1782 | // set binType and binTypeStr to bad flags |
---|
1783 | String binTypeStr = "none" |
---|
1784 | binType = -999999 |
---|
1785 | break |
---|
1786 | |
---|
1787 | case "Circular": |
---|
1788 | V_QBinAllPanels_Circular(activeType,binType,collimationStr) // this does a default circular average |
---|
1789 | V_PlotData_Panel() //this brings the plot window to the front, or draws it (ONLY) |
---|
1790 | V_Update1D_Graph(activeType,binType) //update the graph, data was already binned |
---|
1791 | break |
---|
1792 | |
---|
1793 | case "Sector": |
---|
1794 | ControlInfo/W=VSANS_Det_Panels popup4 |
---|
1795 | String side = S_Value |
---|
1796 | NVAR phi = root:Packages:NIST:VSANS:Globals:Mask:gSectorAngle |
---|
1797 | NVAR delta = root:Packages:NIST:VSANS:Globals:Mask:gSectorDQ |
---|
1798 | |
---|
1799 | // convert the angles to radians before passing |
---|
1800 | V_QBinAllPanels_Sector(activeType,binType,collimationStr,side,phi*pi/180,delta*pi/180) |
---|
1801 | V_PlotData_Panel() //this brings the plot window to the front, or draws it (ONLY) |
---|
1802 | V_Update1D_Graph(activeType,binType) //update the graph, data was already binned |
---|
1803 | break |
---|
1804 | case "Sector_PlusMinus": |
---|
1805 | // Sector_PlusMinus1D(activeType) |
---|
1806 | break |
---|
1807 | case "Rectangular": |
---|
1808 | // RectangularAverageTo1D(activeType) |
---|
1809 | break |
---|
1810 | |
---|
1811 | case "Annular": |
---|
1812 | ControlInfo/W=VSANS_Det_Panels popup0 |
---|
1813 | String detGroup = S_Value |
---|
1814 | NVAR qCtr_Ann = root:Packages:NIST:VSANS:Globals:Mask:gAnnularQCtr |
---|
1815 | NVAR qWidth = root:Packages:NIST:VSANS:Globals:Mask:gAnnularDQ |
---|
1816 | //String detGroup = StringByKey("DETGROUP",avgStr,"=",";") |
---|
1817 | //Variable qCtr_Ann = NumberByKey("QCENTER",avgStr,"=",";") |
---|
1818 | //Variable qWidth = NumberByKey("QDELTA",avgStr,"=",";") |
---|
1819 | V_QBinAllPanels_Annular(activeType,detGroup,qCtr_Ann,qWidth) |
---|
1820 | V_Phi_Graph_Proc(activeType,detGroup) |
---|
1821 | break |
---|
1822 | |
---|
1823 | case "Narrow_Slit": |
---|
1824 | V_QBinAllPanels_Slit(activeType,binType) // this does a tall, narrow slit average |
---|
1825 | V_PlotData_Panel() //this brings the plot window to the front, or draws it (ONLY) |
---|
1826 | V_Update1D_Graph(activeType,binType) //update the graph, data was already binned |
---|
1827 | |
---|
1828 | break |
---|
1829 | |
---|
1830 | case "2D_ASCII": |
---|
1831 | //do nothing |
---|
1832 | break |
---|
1833 | case "QxQy_ASCII": |
---|
1834 | //do nothing |
---|
1835 | break |
---|
1836 | case "PNG_Graphic": |
---|
1837 | //do nothing |
---|
1838 | break |
---|
1839 | default: |
---|
1840 | //do nothing |
---|
1841 | endswitch |
---|
1842 | |
---|
1843 | |
---|
1844 | break |
---|
1845 | case -1: // control being killed |
---|
1846 | break |
---|
1847 | endswitch |
---|
1848 | |
---|
1849 | |
---|
1850 | |
---|
1851 | return 0 |
---|
1852 | End |
---|
1853 | |
---|
1854 | Function V_AvgPanelHelpButtonProc(ba) : ButtonControl |
---|
1855 | STRUCT WMButtonAction &ba |
---|
1856 | |
---|
1857 | switch( ba.eventCode ) |
---|
1858 | case 2: // mouse up |
---|
1859 | // click code here |
---|
1860 | |
---|
1861 | DisplayHelpTopic/Z/K=1 "VSANS Data Reduction Documentation[Show Mask for Averaging]" |
---|
1862 | if(V_flag !=0) |
---|
1863 | DoAlert 0,"The VSANS Data Reduction Tutorial Help file could not be found" |
---|
1864 | endif |
---|
1865 | |
---|
1866 | break |
---|
1867 | case -1: // control being killed |
---|
1868 | break |
---|
1869 | endswitch |
---|
1870 | |
---|
1871 | return 0 |
---|
1872 | End |
---|
1873 | |
---|
1874 | |
---|
1875 | |
---|
1876 | // |
---|
1877 | // overlay the mask |
---|
1878 | // |
---|
1879 | // |
---|
1880 | // if state==1, show the mask, if ==0, hide the mask |
---|
1881 | // |
---|
1882 | // |
---|
1883 | Function V_OverlayFourMask(folderStr,detStr,state) |
---|
1884 | String folderStr,detStr |
---|
1885 | Variable state |
---|
1886 | |
---|
1887 | |
---|
1888 | Variable isVCALC=0 |
---|
1889 | if(cmpstr("VCALC",folderStr)==0) |
---|
1890 | isVCALC=1 |
---|
1891 | endif |
---|
1892 | |
---|
1893 | String maskPath = "root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":data" |
---|
1894 | if(WaveExists($maskPath) == 1) |
---|
1895 | |
---|
1896 | |
---|
1897 | if(state == 1) |
---|
1898 | //duplicate the mask, which is named "data" |
---|
1899 | wave maskW = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":data") |
---|
1900 | // for the wave scaling |
---|
1901 | if(isVCALC) |
---|
1902 | wave data = $("root:Packages:NIST:VSANS:"+folderStr+":entry:instrument:detector_"+detStr+":det_"+detStr) |
---|
1903 | else |
---|
1904 | wave data = $("root:Packages:NIST:VSANS:"+folderStr+":entry:instrument:detector_"+detStr+":data") |
---|
1905 | endif |
---|
1906 | Duplicate/O data $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":overlay_"+detStr) |
---|
1907 | wave overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":overlay_"+detStr) |
---|
1908 | overlay = maskW //this copies the data into the properly scaled wave |
---|
1909 | |
---|
1910 | strswitch(detStr) |
---|
1911 | case "ML": |
---|
1912 | case "FL": |
---|
1913 | // Print ImageNameList("VSANS_Det_Panels#Panel_L", ";" ) |
---|
1914 | CheckDisplayed/W=VSANS_Det_Panels#Panel_L overlay |
---|
1915 | if(V_flag==0) //so the overlay doesn't get appended more than once |
---|
1916 | AppendImage/T/W=VSANS_Det_Panels#Panel_L overlay |
---|
1917 | // ModifyImage/W=VSANS_Det_Panels#Panel_L overlay ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,35000) |
---|
1918 | ModifyImage/W=VSANS_Det_Panels#Panel_L ''#1 ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,35000) |
---|
1919 | endif |
---|
1920 | break |
---|
1921 | case "MR": |
---|
1922 | case "FR": |
---|
1923 | CheckDisplayed/W=VSANS_Det_Panels#Panel_R overlay |
---|
1924 | if(V_flag==0) //so the overlay doesn't get appended more than once |
---|
1925 | AppendImage/T/W=VSANS_Det_Panels#Panel_R overlay |
---|
1926 | // ModifyImage/W=VSANS_Det_Panels#Panel_R overlay ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,35000) |
---|
1927 | ModifyImage/W=VSANS_Det_Panels#Panel_R ''#1 ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,35000) |
---|
1928 | endif |
---|
1929 | break |
---|
1930 | case "MT": |
---|
1931 | case "FT": |
---|
1932 | CheckDisplayed/W=VSANS_Det_Panels#Panel_T overlay |
---|
1933 | if(V_flag==0) //so the overlay doesn't get appended more than once |
---|
1934 | AppendImage/T/W=VSANS_Det_Panels#Panel_T overlay |
---|
1935 | // ModifyImage/W=VSANS_Det_Panels#Panel_T overlay ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,35000) |
---|
1936 | ModifyImage/W=VSANS_Det_Panels#Panel_T ''#1 ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,35000) |
---|
1937 | endif |
---|
1938 | break |
---|
1939 | case "MB": |
---|
1940 | case "FB": |
---|
1941 | CheckDisplayed/W=VSANS_Det_Panels#Panel_B overlay |
---|
1942 | if(V_flag==0) //so the overlay doesn't get appended more than once |
---|
1943 | AppendImage/T/W=VSANS_Det_Panels#Panel_B overlay |
---|
1944 | // ModifyImage/W=VSANS_Det_Panels#Panel_B overlay ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,35000) |
---|
1945 | ModifyImage/W=VSANS_Det_Panels#Panel_B ''#1 ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,35000) |
---|
1946 | endif |
---|
1947 | break |
---|
1948 | default: |
---|
1949 | // |
---|
1950 | Print "off bottom of switch" |
---|
1951 | endswitch |
---|
1952 | endif //state == 1 |
---|
1953 | |
---|
1954 | if(state == 0) |
---|
1955 | wave overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":overlay_"+detStr) |
---|
1956 | |
---|
1957 | strswitch(detStr) |
---|
1958 | case "ML": |
---|
1959 | case "FL": |
---|
1960 | CheckDisplayed/W=VSANS_Det_Panels#Panel_L overlay |
---|
1961 | if(V_Flag == 1) //overlay is present |
---|
1962 | // RemoveImage/W=VSANS_Det_Panels#Panel_L overlay |
---|
1963 | RemoveImage/W=VSANS_Det_Panels#Panel_L ''#1 |
---|
1964 | endif |
---|
1965 | break |
---|
1966 | case "MR": |
---|
1967 | case "FR": |
---|
1968 | CheckDisplayed/W=VSANS_Det_Panels#Panel_R overlay |
---|
1969 | if(V_Flag == 1) //overlay is present |
---|
1970 | // RemoveImage/W=VSANS_Det_Panels#Panel_R overlay |
---|
1971 | RemoveImage/W=VSANS_Det_Panels#Panel_R ''#1 |
---|
1972 | endif |
---|
1973 | break |
---|
1974 | case "MT": |
---|
1975 | case "FT": |
---|
1976 | CheckDisplayed/W=VSANS_Det_Panels#Panel_T overlay |
---|
1977 | if(V_Flag == 1) //overlay is present |
---|
1978 | // RemoveImage/W=VSANS_Det_Panels#Panel_T overlay |
---|
1979 | RemoveImage/W=VSANS_Det_Panels#Panel_T ''#1 |
---|
1980 | endif |
---|
1981 | break |
---|
1982 | case "MB": |
---|
1983 | case "FB": |
---|
1984 | CheckDisplayed/W=VSANS_Det_Panels#Panel_B overlay |
---|
1985 | if(V_Flag == 1) //overlay is present |
---|
1986 | // RemoveImage/W=VSANS_Det_Panels#Panel_B overlay |
---|
1987 | RemoveImage/W=VSANS_Det_Panels#Panel_B ''#1 |
---|
1988 | endif |
---|
1989 | break |
---|
1990 | default: |
---|
1991 | // |
---|
1992 | Print "off bottom of switch" |
---|
1993 | endswitch |
---|
1994 | endif //state == 0 |
---|
1995 | |
---|
1996 | Endif |
---|
1997 | |
---|
1998 | return(0) |
---|
1999 | End |
---|
2000 | |
---|
2001 | |
---|
2002 | // |
---|
2003 | // overlay the mask |
---|
2004 | // |
---|
2005 | // |
---|
2006 | // if state==1, show the mask, if ==0, hide the mask |
---|
2007 | // |
---|
2008 | // |
---|
2009 | Function V_OverlayFourAvgMask(folderStr,detStr,state) |
---|
2010 | String folderStr,detStr |
---|
2011 | Variable state |
---|
2012 | |
---|
2013 | // Variable isVCALC=0 |
---|
2014 | // if(cmpstr("VCALC",folderStr)==0) |
---|
2015 | // isVCALC=1 |
---|
2016 | // endif |
---|
2017 | |
---|
2018 | String maskPath = "root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":data" |
---|
2019 | if(WaveExists($maskPath) == 1) |
---|
2020 | |
---|
2021 | |
---|
2022 | if(state == 1) |
---|
2023 | //duplicate the mask, which is named "AvgOverlay_" |
---|
2024 | // wave maskW = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":data") |
---|
2025 | // // for the wave scaling |
---|
2026 | // wave data = $("root:Packages:NIST:VSANS:"+folderStr+":entry:instrument:detector_"+detStr+":data") |
---|
2027 | // Duplicate/O data $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":overlay_"+detStr) |
---|
2028 | |
---|
2029 | // if(isVCALC) |
---|
2030 | // wave overlay = $("root:Packages:NIST:VSANS:"+folderStr+":entry:instrument:detector_"+detStr+":AvgOverlay_"+detStr) |
---|
2031 | // else |
---|
2032 | wave overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":AvgOverlay_"+detStr) |
---|
2033 | // endif |
---|
2034 | // overlay = maskW //this copies the data into the properly scaled wave |
---|
2035 | |
---|
2036 | strswitch(detStr) |
---|
2037 | case "ML": |
---|
2038 | case "FL": |
---|
2039 | case "B": |
---|
2040 | // Print ImageNameList("VSANS_Det_Panels#Panel_L", ";" ) |
---|
2041 | CheckDisplayed/W=VSANS_Det_Panels#Panel_L overlay |
---|
2042 | if(V_flag==0) //so the overlay doesn't get appended more than once |
---|
2043 | AppendImage/T/W=VSANS_Det_Panels#Panel_L overlay |
---|
2044 | // ModifyImage/W=VSANS_Det_Panels#Panel_L overlay ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,35000) |
---|
2045 | ModifyImage/W=VSANS_Det_Panels#Panel_L ''#1 ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,35000) |
---|
2046 | endif |
---|
2047 | break |
---|
2048 | case "MR": |
---|
2049 | case "FR": |
---|
2050 | CheckDisplayed/W=VSANS_Det_Panels#Panel_R overlay |
---|
2051 | if(V_flag==0) //so the overlay doesn't get appended more than once |
---|
2052 | AppendImage/T/W=VSANS_Det_Panels#Panel_R overlay |
---|
2053 | // ModifyImage/W=VSANS_Det_Panels#Panel_R overlay ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,35000) |
---|
2054 | ModifyImage/W=VSANS_Det_Panels#Panel_R ''#1 ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,35000) |
---|
2055 | endif |
---|
2056 | break |
---|
2057 | case "MT": |
---|
2058 | case "FT": |
---|
2059 | CheckDisplayed/W=VSANS_Det_Panels#Panel_T overlay |
---|
2060 | if(V_flag==0) //so the overlay doesn't get appended more than once |
---|
2061 | AppendImage/T/W=VSANS_Det_Panels#Panel_T overlay |
---|
2062 | // ModifyImage/W=VSANS_Det_Panels#Panel_T overlay ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,35000) |
---|
2063 | ModifyImage/W=VSANS_Det_Panels#Panel_T ''#1 ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,35000) |
---|
2064 | endif |
---|
2065 | break |
---|
2066 | case "MB": |
---|
2067 | case "FB": |
---|
2068 | CheckDisplayed/W=VSANS_Det_Panels#Panel_B overlay |
---|
2069 | if(V_flag==0) //so the overlay doesn't get appended more than once |
---|
2070 | AppendImage/T/W=VSANS_Det_Panels#Panel_B overlay |
---|
2071 | // ModifyImage/W=VSANS_Det_Panels#Panel_B overlay ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,35000) |
---|
2072 | ModifyImage/W=VSANS_Det_Panels#Panel_B ''#1 ctab= {0.9,0.95,BlueRedGreen,0} ,minRGB=NaN,maxRGB=(0,65000,0,35000) |
---|
2073 | endif |
---|
2074 | break |
---|
2075 | default: |
---|
2076 | // |
---|
2077 | Print "off bottom of switch" |
---|
2078 | endswitch |
---|
2079 | endif //state == 1 |
---|
2080 | |
---|
2081 | if(state == 0) |
---|
2082 | wave overlay = $("root:Packages:NIST:VSANS:MSK:entry:instrument:detector_"+detStr+":AvgOverlay_"+detStr) |
---|
2083 | |
---|
2084 | strswitch(detStr) |
---|
2085 | case "ML": |
---|
2086 | case "FL": |
---|
2087 | case "B": |
---|
2088 | CheckDisplayed/W=VSANS_Det_Panels#Panel_L overlay |
---|
2089 | if(V_Flag == 1) //overlay is present |
---|
2090 | // RemoveImage/W=VSANS_Det_Panels#Panel_L overlay |
---|
2091 | RemoveImage/W=VSANS_Det_Panels#Panel_L ''#1 |
---|
2092 | endif |
---|
2093 | break |
---|
2094 | case "MR": |
---|
2095 | case "FR": |
---|
2096 | CheckDisplayed/W=VSANS_Det_Panels#Panel_R overlay |
---|
2097 | if(V_Flag == 1) //overlay is present |
---|
2098 | // RemoveImage/W=VSANS_Det_Panels#Panel_R overlay |
---|
2099 | RemoveImage/W=VSANS_Det_Panels#Panel_R ''#1 |
---|
2100 | endif |
---|
2101 | break |
---|
2102 | case "MT": |
---|
2103 | case "FT": |
---|
2104 | CheckDisplayed/W=VSANS_Det_Panels#Panel_T overlay |
---|
2105 | if(V_Flag == 1) //overlay is present |
---|
2106 | // RemoveImage/W=VSANS_Det_Panels#Panel_T overlay |
---|
2107 | RemoveImage/W=VSANS_Det_Panels#Panel_T ''#1 |
---|
2108 | endif |
---|
2109 | break |
---|
2110 | case "MB": |
---|
2111 | case "FB": |
---|
2112 | CheckDisplayed/W=VSANS_Det_Panels#Panel_B overlay |
---|
2113 | if(V_Flag == 1) //overlay is present |
---|
2114 | // RemoveImage/W=VSANS_Det_Panels#Panel_B overlay |
---|
2115 | RemoveImage/W=VSANS_Det_Panels#Panel_B ''#1 |
---|
2116 | endif |
---|
2117 | break |
---|
2118 | default: |
---|
2119 | // |
---|
2120 | Print "off bottom of switch" |
---|
2121 | endswitch |
---|
2122 | endif //state == 0 |
---|
2123 | |
---|
2124 | Endif |
---|
2125 | |
---|
2126 | return(0) |
---|
2127 | End |
---|
2128 | |
---|
2129 | |
---|