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