Hello,
I have some code that masks user selected input files by a user selected mask and now I want to apply a 'data ignore value' of 0 to the output files. I'm trying this with the 'envi_setup_head' routine. I get an ENVI header file in any case without the part where I set up the header, but I cannot get the 'data ignore value' set to 0, as I want. If anyone can figure out the solution to modify the code below, it'd be wonderful.
Thanks,
Mike
---------------------------------------------------------------------------------------------------------------------------
PRO ml_multiple_mask
;;******************************************
;; Created by ML - May 26, 2011
;;
;; This program applies a user-selected mask
;; to user-selected images.
;;
;; Input files can be selected from user-
;; specified directories and the output
;; files can be written to a specified
;; directory by modifying this code (see
;; comments throughout code for details).
;;
;;******************************************
;ML set starting directory
cd, 'C:\B_Working\IDL_forHoma_Jan18_2012'
; Select input files (Select all your images)
files_list = DIALOG_PICKFILE(/READ,title ='Select input files',/multiple_files)
; Select the mask File
mask_file = DIALOG_PICKFILE(/read, title = 'Select Mask File')
ENVI_OPEN_FILE, mask_file, r_fid=m_fid
; Count the number of files
num_files = N_elements (files_list)
FOR count = 0, num_files-1 DO BEGIN
; Selects the n- file. Output file name is
; "input_file_name"+"-masked" (remove suffix .tif)
in_file = files_list [count]
out_file = file_basename(files_list [count], '.tif') +'_masked2'
ENVI_OPEN_FILE, in_file, r_fid=fid
IF (fid EQ -1 OR m_fid EQ -1) THEN RETURN
; get some useful information and set the output filename.
ENVI_FILE_QUERY, fid, ns=ns, nl=nl, nb=nb, bname=bname
; Set the keyword parameters
dims = [-1l, 0, ns-1, 0, nl-1]
pos = LINDGEN(nb)
m_pos = [0l]
; Call the 'doit' to apply the mask
ENVI_MASK_APPLY_DOIT, fid=fid, pos=pos, dims=dims, m_fid=m_fid, $
m_pos=m_pos, value=0, out_name=out_file, in_memory=0, $
r_fid=r_fid
; Set up the Header to include the data ignore value [this is the part I think doesnt' quite work]
ENVI_SETUP_HEAD, fname=out_file, data_ignore_value=0, interleave=0, offset=0, data_type=4, $
ns=ns, nl=nl, nb=nb, /write
ENDFOR
END
|