PRO qView_XYZ_Update, state, get=get, put=put, id=id, noz=noz ;+ ; NAME: ; qView_XYZ_Update ; PURPOSE: ; CATEGORY: ; CALLING SEQUENCE: ; INPUTS: ; state scalar, structure ; contains IDs for all qView widgets ; OPTIONAL INPUT PARAMETERS: ; id=id scalar, type integer, values: 0,1,2,3; default: 2 ; /get scalar, type integer ; picks up values from x,y widgets, and puts them in the appropriate ; locations of the user value of the state.box[0,0] widget ; /put scalar, type integer ; picks up the appropriate fields of the user value of the state.box[0,0] ; and puts them in the x,y widgets ; /noz scalar, type integer ; if set then the values of the widgets for min, max, mean and std. dev ; are not updated ; OUTPUTS: ; INCLUDE: @compile_opt.pro ; On error, return to caller ; OPTIONAL OUTPUT PARAMETERS: ; CALLS: ; qView_GetImage ; RESTRICTIONS: ; PROCEDURE: ; MODIFICATION HISTORY: ; JAN-1999, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- InitVar, get, /key InitVar, put, /key InitVar, noz, /key InitVar, id , 2 ; ip=0 for id=0,1,2; ip=1 for id=3 ip = id/3 widget_control, state.box[0,0], get_uvalue=oldbox ; Pick up box size box = oldbox IF get THEN BEGIN ; Pick up values from widgets FOR i=0,3 DO BEGIN widget_control, state.box[i,ip], get_value=inbox box[i,id] = inbox ; Write visible values into proper box elements ENDFOR ENDIF ; Check ranges FOR i=0,2,2 DO BEGIN ; Loop over x and y coordinates j = i+1 ; i=start index; j=end index box[i:j,1] = (box[i:j,1] > box[i,0]) < box[j,0] IF box[i,1] NE oldbox[i,1] AND box[j,1]-box[i,1] EQ oldbox[j,1]-oldbox[i,1] THEN $ box[i:j,2] = box[i:j,2]+box[i,1]-oldbox[i,1] box[i:j,2] = box[i+sort(box[i:j,2]),2] box[i:j,2] = ( (box[i:j,2] > box[i,2]) > box[i,1]) < box[j,1] box[i:j,3] = box[i+sort(box[i:j,3]),3] box[i:j,3] = ( (box[i:j,3] > box[i,3]) > box[i,1]) < box[j,1] ENDFOR widget_control, state.box[0,0], set_uvalue=box ; Update widget IF put THEN FOR i=0,3 DO widget_control, state.box[i,ip], set_value=box[i,id] IF NOT noz THEN BEGIN img = qView_GetImage(state, id=id) ip = id/3 ; ip=0 for id=0,1,2; ip=1 for id=3 zmax = max(img,min=zmin) widget_control, state.zactive[0,ip], set_value=float(zmin) widget_control, state.zactive[1,ip], set_value=float(zmax) widget_control, state.zactive[2,ip], set_value=mean(img) ;total(img)/n_elements(img) IF n_elements(img) GE 2 THEN std = stddev(img) ELSE std = 0. widget_control, state.zactive[3,ip], set_value=std ENDIF RETURN & END