Thank you for your replying. However, I want to know how to get the minimize rect of ROI when I subset a image, otherwise, the subseted image has same dimension with the orgin image. Here is my codes.
...
ENVI_GET_ROI_INFORMATION,roi_ids[0],NL=nl,NPTS=npts,NS=ns,ROI_NAMES=roiname
dims= [-1,0,ns-1,0,nl-1] ;The ns and nl is not from ROI but the image.
maskfile = ENVI_PICKFILE(TITLE='Set ROI Mask File',DEFAULT=defaultPath+'testData\maskfile.img',/OUTPUT)
class_values = LINDGEN(N_ELEMENTS(roi_ids))+1
; Create Mask file
ENVI_DOIT, 'ENVI_ROI_TO_IMAGE_DOIT', FID=fid, ROI_IDS=roi_ids, OUT_NAME=maskfile, CLASS_VALUES=class_values
ENVI_OPEN_FILE,maskfile,R_FID=m_fid
;ENVI_FILE_QUERY,FID=m_fid,NB=m_nb
m_pos=[0]
; Subset image, the output dimension is same as the orgin file.
outputimg = ENVI_PICKFILE(TITLE='Set Subset Image File',DEFAULT=defaultPath+'testData\subset.img',/OUTPUT)
ENVI_MASK_APPLY_DOIT, FID = fid, POS = pos, DIMS = dims, $
M_FID = m_fid, M_POS = m_pos, VALUE = -999, OUT_NAME = outputimg, $
IN_MEMORY = 0, R_FID = r_fid
...
|