X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 13 Jan 2017 04:40 AM by  anon
Compute the number of records from a ROI
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
13 Jan 2017 04:40 AM
    Hello, which is the ENVI API or IDL function to extract the number of records from an envi ROI xml file? I need to compute statistics from each record delete single record That is my code: file_xml = 'myroifilepath' rois_xml = e.OpenRoi(myroifile) ; open raster to determinate statistics msi_file = 'myrasterpath' msi_raster = e.OpenRaster(msi_file) ; for each roi inside rois_xml select each that has the name EQ to a certain string: foreach rois_xml_obj, rois_xml DO Begin IF (rois_xml_obj.Name EQ 'ROI_1 (Roi_Test_v2)') THEN BEGIN ; my roi has 3 records. if now a compute the statistics over the raster i obtain only one mean (i suppose a mean considering all the records). I instead need one mean for each record, and then delete the record from the roi with mean LT 7000. Thanks for any suggestion. I continue to work on it.

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    13 Jan 2017 07:23 AM
    I would suggest the ROI processing discussed here: http://www.harrisgeospatial.com/docs/...

    Deleted User



    New Member


    Posts:
    New Member


    --
    18 Jan 2017 03:33 AM
    Thank you for your reply. I had already read that example but it seems to do something different compared to my needs, namely: in the example you can imagine that the processed roi file is a multy roi file. It is only processed the water roi statistics are calculated only for one record. but I would need to process statistics for all objects contained in the water (for example) roi and then delete the object whose characteristics do not meet the selection criteria. Currently I believe that the only way is the following: Create a shapefile including all roi and all records for each roi. Transform the shapefile with n object into a roi file.xml with n roi. execute the code: foreach rois_xml_obj, rois_xml DO Begin IF (rois_xml_obj.Name EQ 'My roi NAME') THEN BEGIN ; Create a masked raster msi_raster_masked_ROI = ENVIROIMaskRaster(first_band, rois_xml_obj) ; Calculate statistics for the ROI Stats = ENVIRasterStatistics(msi_raster_masked_ROI ENDIF Now, the point is: delete the record when the mean is less then my value. i need for example to: delete the roi from the file.xml and then convert the file.xml into classic roi by combining objects with the same name delete the object from start shapefile and then convert the shapefile into classic roi by combining objects with the same name In fact, I can not make this last step: get an classic roi file from which the records with mean LT threshold have been eliminated. Please, can you a solution?
    You are not authorized to post a reply.