pro processblemish,list,outputdir,camera=camera,pixrem=pixrem,startind=startind,endind=endind,width=width,sigma_mult=sigma_mult ;+ ; ; NAME: ; processblemish ; PURPOSE: ; Remove blemishes from a set of DISR images ; CATEGORY: ; Data reduction ; CALLING SEQUENCE: ; processblemish,list,outputdir,camera=camera,pixrem=pixrem,startind=startind,endind=endind,width=width,sigma_mult=sigma_mult ; INPUTS: ; list: List of images as a string array ; outputdir: Directory into which the images will be written ; OPTIONAL INPUT PARAMETERS: ; NONE ; OUTPUTS: ; None (Output images are written to files) ; OPTIONAL OUTPUT PARAMETERS: ; NONE ; KEYWORDS: ; Camera: Integer. Set to 21 for MRI, 22 for SLI, 23 for HRI if only images from one camera should be processed. This is ; necessary in case the set of images gets a common list of bad pixels. Keyword should be made more ; transparent in the future. ; pixrem: If set to a pixel list, replace those pixels in all images. If no pixel list is provided, a median filter ; is run. ; startind,endind: Optional indices of the files in the list where the reduction starts. Default is to reduce the ; whole list (startind = 0, endind = n_elements(list)-1), possibly restricted to one of the imagers ; by the keyword camera. ; width: Width of the median filter ; sigma_mult: Deviation necessary to replace a pixel in multiples of the standard deviation (quartile value). ; COMMON BLOCKS: ; NONE ; SIDE EFFECTS: ; NONE ; RESTRICTIONS: ; NONE ; PROCEDURE: ; Either use the list of bad pixels provided by pixrem and replace the pixels for one camera. If the list is not ; provided, run a median filter to replace bad pixels. ; ; MODIFICATION HISTORY: ; 17 01 05, MK ;- ; set defaults if limits to file list are not provided if not keyword_Set(startind) then startind = 0 if not keyword_Set(endind) then endind = n_elements(list)-1 ; Replace bad pixels for all images if list is provided if n_elements(pixrem) gt 0 then begin for i = startind,endind do begin d_Read,list[i],hdr,im if d_Value(hdr,96) eq camera then begin removeblemish,im,imout,blemishin=pixrem tmp = str_Sep(list[i],'\') d_write,outputdir+'\'+tmp[n_elements(tmp)-1],hdr,imout endif endfor ; otherwise run median filter endif else begin ; Set keywords to default if not provided if N_elements(width) eq 0 then width = 5 if n_elements(sigma_mult) eq 0 then sigma_mult = 3.5 ; Remove bad pixels by median filter and write result to outputdir. for i = startind,endind do begin d_Read,list[i],hdr,im removeblemish,im,imout,width=iwidth,sigma_mult=sigma_mult,/noplot tmp = str_Sep(list[i],'\') d_write,outputdir+'\'+tmp[n_elements(tmp)-1],hdr,imout endfor endelse end