5592
Converting Vector Polygons into Individual ROIs in Classic ENVI
Note: The routine provided in this help article is appropriate for adding an item to the classic ENVI interface. It is not appropriate for adding functionality to the newer default interface introduced with ENVI 5.
ENVI currently has a routine that will convert an entire vector layer into a single ROI (see the Export Layer to ROI option in the File menu in the Vector Parameters dialog). However, it is often useful to convert each separate polygon in a vector layer into its own ROI. If this is the functionality you need, then the user function included here will be useful for you. The POLYGONS_TO_ROIS function makes one ROI for each polygon in a selected EVF file. The image which will receive the new ROIs does not need to be in the same projection as the vector layer, however both files must be either georeferened or in arbitrary pixel coordinates (since it isn't possible to convert between arbitrary coordinates and map coordinates).
Program Notes
Only polygons found in the vector file are converted into ROIs. Any other vector records, such as points or polylines, are ignored. A polygon is defined to be any vector record with more than one node, and where the first node has the identical location as the last node. If you have a vector layer that appears to have polygons, but running this function does not produce any ROIs, then the polygons are probably defined as polylines instead of true polygons. Also, if a vector polygon encloses less than a single image pixel it is skipped.
DISCLAIMER
This
additional functionality is provided free of charge as a service for
our ENVI users; however, this procedure is not supported by Exelis
Visual Information Technical Support. The procedure POLYGONS_TO_ROIS has been been tested and we believe that it works correctly, but it is in no way guaranteed.
To add this user function to your version of ENVI
Click here to download the source code for this user function, polygons_to_rois.pro, as a Windows ASCII text file. For more details on how to add this function to ENVI please see "How to Add a User Function to ENVI".