Re: Reading ENVI roi file [message #17400] |
Wed, 13 October 1999 00:00 |
Peter Mason
Messages: 145 Registered: June 1996
|
Senior Member |
|
|
alexander.loew@stud.uni-muenchen.de (Alex Loew) wrote:
> is there a routine to read ENVIs ROI files? I need a procedure which
> gives me the index for each roi.
One way is to use ENVI's ROI support routines. (I assume you're
working within ENVI?) First of all, each ROI is associated with a
#samples and #lines, so one usually works off an image. Given a FID of
an open image, do: ENVI_FILE_QUERY,fid,NS=fns,NL=fnl to get its full
size. Then to get a list of open ROIs that can go with the image, do:
roi_names=1
&roi_ptr=ENVI_GET_ROI_IDS(NS=fns,NL=fnl,ROI_NAMES=roi_na mes). If
(roi_ptr[0] eq -1) then there are no loaded ROIs that match, otherwise
there's at least one. To get the one-dimensional point indices (into a
band of the partner image) of the first such ROI, for example, do:
roi_indices=ENVI_GET_ROI(roi_ptr[0]). Note that ROIs have to be loaded
(but not necessarily displayed) to be accessed like this. Also, no
matter how you originally defined the ROI, it always exists as an array
of one-dimensional indices, one index per pixel "set" in the ROI.
HTH
Peter Mason
(PS Apologies to regular IDL users - I hope you don't mind the
occasional ENVI-related post.)
Sent via Deja.com http://www.deja.com/
Before you buy.
|
|
|