All raster formats must form a rectangle of some sort because it is number of samples x number of lines. The best you can do is make the smallest bounding box around an irregularly shaped region of interest and mask out areas outside of your ROI. One way to do this in ENVI is to use the Subset data via ROIs. This tool makes the smallest bounding box around your region of interest and you can set the background values to whatever value you wish.
Now, if you want to access the actual data within an ROI, you can do this using something like ENVI_GET_DATA but with the DIMs array accessing an ROI. Or you can use the ENVI_GET_ROI_DATA to get the data associated with ROI addresses. This data is held in a variable in memory and you can manipulate it, but if you go to output an image file of whatever format (ENVI, TIFF, JPEG, Imagine, etc.) it *must* return a rectangular image. So there will always be background if the area is irregularly shaped.
|