X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 07 Dec 2015 03:38 PM by  anon
ENVI ROI to Image Doit
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
07 Dec 2015 03:38 PM
    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.

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    08 Dec 2015 01:40 PM
    If you want to have a classification image of a subset of your ROIs, then you need to pass the ROI_IDS you want to convert and it needs to match the class_values. So if you are using [1, 2] then you need to specify this for both ROI_IDS and class_values.

    Deleted User



    New Member


    Posts:
    New Member


    --
    26 Jan 2016 02:16 PM
    Sorry for the long delay. A coworker of mine, whos been doing ILD longer than... also helped with a solution. The meat of our ROI to Class image ended up looking like this: f2 = input_class_image ;an input class image with a same name associated ROI envi_restore_rois, f2 + '.roi' roi_ids = envi_get_roi_ids(fid=fid2, SHORT_NAME=SHORT_NAME) ;error handling in roi retrival if (roi_ids[0] eq -1) then return ; Set the variables needed for ROI to IMG corr_name = f2 + '_correction' class_values = lindgen(n_elements(roi_ids))+1 ;output class image of roi's envi_doit, 'envi_roi_to_image_doit', $ fid=fid2, roi_ids=roi_ids, out_name=corr_name, $ class_values=class_values Thank you Mari!
    You are not authorized to post a reply.