FUNCTION qImage_cw_BoxCosine, state, img_box, box, pfov=pfov, nimg=nimg ;+ ; NAME: ; qImage_cw_BoxCosine ; PURPOSE: ; Applies geometric corrections to intensities in SMEI fov ; CATEGORY: ; Compound widget qImage_cw ; CALLING SEQUENCE: ; img_box = qImage_cw_BoxCosine(state, img_box, box) ; img_box = qImage_cw_BoxCosine(state, img_box, pfov=pfov) ; INPUTS: ; state array[1]; type: structure ; qImage_cw state structure ; img_box array[n,m]; type: float ; pixel values in area to be corrected ; box array[2,2]; type: integer ; pixel coordinates of lower-left and upper-right corners ; of area to be corrected. The coordinates must be ; relative to the lower-left corner of the image on display ; (i.e. after subtracting state.img_offset) ; pfov array[2,n,m]; type: float ; polar coordinates of pixels in img_box ; Pixels outside the field of view should be marked with ; BadValue(0.0) ; If 'pfov' is used then 'box' is not used and need not be present ; OUTPUTS: ; img_box ; array[*,*]; type: same as input 'img_box' ; corrected subarray ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; IsType, Inside_Wedge, qImage_cw_Box, SubArray, SuperArray, gridgen ; PROCEDURE: ; STATE INFO USED: ; widget_control, state.wid_axis[0], get_value=phi ; widget_control, state.wid_axis[0], get_value=phi ; widget_control, state.wid_axis[1], get_value=rad ; MODIFICATION HISTORY: ; MAR-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- widget_control, state.wid_smei, get_uvalue=set IF set THEN BEGIN widget_control, state.wid_cos, get_uvalue=set IF set THEN BEGIN widget_control, state.wid_axis [0], get_value=phi & phi = phi /!radeg widget_control, state.wid_axis [1], get_value=rad widget_control, state.wid_corner[0], get_value=phi_lo & phi_lo = phi_lo/!radeg widget_control, state.wid_corner[1], get_value=rad_lo widget_control, state.wid_corner[2], get_value=phi_hi & phi_hi = phi_hi/!radeg widget_control, state.wid_corner[3], get_value=rad_hi fov = [[phi_lo,rad_lo], [phi_hi, rad_hi]] no_pfov = IsType(pfov, /undefined) CASE no_pfov OF 0: inside = finite( SubArray(pfov) ) 1: BEGIN qImage_cw_Box, state, pfov, /center pfov = gridgen( box[2:3]-box[0:1]+1, origin=-box[0:1]+pfov ) pfov = cv_coord(from_rect=pfov, /to_polar) inside = Inside_Wedge(fov, pfov) ; Locate pixels inside fov END ENDCASE ; Apply corrections only to pixels inside the field of view s = SubArray(pfov,element=1)/rad-1 s = (1-inside)+inside/cos(SubArray(pfov)-phi)/(1-2.7*s*(1+32*s)) ; Cosine correction InitVar, nimg, 1 IF no_pfov THEN s = SuperArray(s, nimg, /trail) img_box = img_box*s ENDIF ENDIF RETURN, img_box & END