X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 16 Mar 2015 10:21 AM by  anon
ROI Tool Question
 4 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
16 Mar 2015 10:21 AM
    I am trying to create a ROI file from bhtmref.img using ENVI 5.2. I clicked on the ROI tool, chose a Rectangular geometry with both Multi Part and Vertex Snap unchecked. I drew the rectangle and chose "Accept Rectangle". Then in the ROI Tool window, I chose File | Export | Export to Classic, and saved as bhtm_nd.roi. I then ran the following neural network program on IDL 8.4, and got the solid colored ROI shape with no map features for testimg. I don't think that is what it should be, and I think it is because I did not create the ROI file correctly. forward_function envi_get_roi_ids, envi_get_roi_dims_ptr pro neural_network_example ; Restore all the base save files. envi, /restore_base_save_files ; Initialize ENVI and send all errors and warnings tobatch.txt envi_batch_init, log_file=’batch.txt’ ; Open the input file file = 'bmthref.img' envi_open_file, file, r_fid=fid if (fid eq-1) then begin print, ‘Error opening file ’, file envi_batch_exit return endif ; Set the dims and pos to classify all data (spatiallyand spectrally) in the file envi_file_query, fid, ns=ns, nb=nb pos = lindgen(nb) out_name = ‘testimg’ rule_out_name = '' ; Restore the ROI file used as the training pixels. ; Each ROI in the file will be considered an input class. envi_restore_rois, ‘bhtm_nd.roi’ roi_ids = envi_get_roi_ids(fid=fid, roi_colors=lookup,roi_names=class_names) ; Specify the neural net training criteria. theta = 0.9 eta = 0.2 alpha = 0.9 act_type = 0 ams_crit = 0.1 num_layers = 3 num_sweeps = 1000 ; Set the classification variables num_classes = n_elements(roi_ids) class_names = [‘Unclassified’, class_names] lookup =reform([0, 0, 0, reform(lookup, 3*num_classes)], num_classes+1) ; Call thedoit envi_doit, ‘envi_neural_net_doit’, fid=fid, pos=pos, dims=dims,out_name=out_name, rule_out_name=’’, $ theta=theta,eta=eta, alpha=alpha, num_classes=num_classes, num_sweeps=num_sweeps,num_layers=num_layers, $ act_type=act_type, rms_crit=rms_crit, roi_ids=roi_ids, /train,class_name=class_names, lookup=lookup ; Exit ENVI envi_batch_exit end

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    16 Mar 2015 10:49 AM
    If you open bhtmref.img and the ROI you created in ENVI Classic, does the ROI display on the file correctly? If so, the ROI is probably fine. If you then run the NN classifier from Classic with the ROI you created and the same parameters, do you get the same or different results than your program?

    Deleted User



    New Member


    Posts:
    New Member


    --
    16 Mar 2015 10:56 AM
    Thank you for your reply. How do I know whether the ROI displays correctly? What does an ROI file look like? If you mean the colored shape displaying where I selected it on the image, it does that. I am expecting map features in the ROI; i.e. a subset of the image itself.

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    16 Mar 2015 11:04 AM
    If you want to subset using an ROI, you pass it as the first element of the 5-element DIMS array. But I am not sure what you are trying to do then with the ROI. With NN, you are classifying using the statistics the pixels within the ROI. If you subset to this region, then you only classify this area and would presumably get a single class (subset) image.

    Deleted User



    New Member


    Posts:
    New Member


    --
    17 Mar 2015 11:35 AM
    The problem is that I didn't initialize the DIMS array. Once I initialized it, the ROI tool and IDL program gave me the expected result. Thank you for your help.
    You are not authorized to post a reply.