I know it is a bit antiquated to be using DOITs but such is the process.I'm trying to use ROIs to edit a class image, to do this I need to convert my ROIs to images. I've successfully used envi_restore_rois and envi_get_roi_ids, to access my file associated ROIs. The trouble lies in, that I want to make two class images from the restored ROIs. One class image that will have ROIs 1 and 2, this one will always be written by the program. If there there is a 3rd ROI, it needs to be a separate image, and optional for the program to run.
So far my code looks something like this:
;f1 is an input class image to be edited and has associated ROIs.
envi_restore_rois, f1 + '.roi'
roi_ids = envi_get_roi_ids(fid=fid1, SHORT_NAME=SHORT_NAME) ;also short_name doesn't appear to write properly
;error handling in roi retrieval
if (roi_ids[0] eq -1) then return
; Set the variables needed for ROI to IMG
corr_name = f1 + '_correction'
add_tribC = f1 + '_addTribC'
class_values = lindgen(n_elements(roi_ids))+1
;get the size of class_values, and use this array to determine how to structure the IF statement for running Trib
;use this variable to determine if the image has a Trib Runoff class
;zCV = 2 no trib zCV = 3 trib runoff class needed
zCV = SIZE(class_values, /N_ELEMENTS)
;output class image of only class_values of 1 & 2
envi_doit, 'envi_roi_to_image_doit', $
fid=fid1, roi_ids=roi_ids, out_name=corr_name, $
class_values=class_values[1,2] ;THIS IS MY TROUBLE
;output class image of only class_value 3
if zCV eq 3 then begin
envi_doit, 'envi_roi_to_image_doit', $
fid=fid1, roi_ids=roi_ids, out_name=add_tribC, $
class_values=class_values[3] ;THIS IS MY TROUBLE
endif
As I called out, I don't know how to define or use the variable class_values to define which ROIs to write to the class image. I'm not even sure if its the right keyword for the process. Any ideas are welcome. Thanks.
|