comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: envi_get_roi_data
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: envi_get_roi_data [message #62221] Sun, 31 August 2008 06:05 Go to next message
skymaxwell@gmail.com is currently offline  skymaxwell@gmail.com
Messages: 127
Registered: January 2007
Senior Member
On Aug 31, 12:46 am, "Jeff N." <jeffnettles4...@gmail.com> wrote:
> On Aug 30, 3:06 am, "skymaxw...@gmail.com" <skymaxw...@gmail.com>
> wrote:
>
>> Good day
>
>> i did excercise from ENVI Programming documentation with ROI. from
>> ENVI i create 4 different ROIs.
>> then i use ENVI_GET_ROI_DATA function i get values of my ROI pixels, i
>> printed it
>> for check i use ENVI and use cursor/location option....
>
>> why values are different ? does ENVI_GET_ROI_DATA use some
>> interpolation algorithm?
>
> Did you check to make sure you were handling your indices the right
> way?  ENVI routines like ENVI_GET_ROI_DATA will use zero-based
> indices, while in the ENVI GUI (ie, the cursor location/value tool)
> one-based indices are used.

yes, i know about it.

now, i faced with problem.

i use following syntax:

roi_ids=ENVI_GET_ROI_IDS(NS=ns,NL=nl,ROI_NAMES=roi_names,/SH ORT_NAME)

in first runtime i have size of roi_names = 4, the same for roi_ids
second runtime size of roi_names = 8, the same with roi_ids.

why data is appended to roi_names and roi_ids ????
Re: envi_get_roi_data [message #62223 is a reply to message #62221] Sat, 30 August 2008 13:46 Go to previous messageGo to next message
jeffnettles4870 is currently offline  jeffnettles4870
Messages: 111
Registered: October 2006
Senior Member
On Aug 30, 3:06 am, "skymaxw...@gmail.com" <skymaxw...@gmail.com>
wrote:
> Good day
>
> i did excercise from ENVI Programming documentation with ROI. from
> ENVI i create 4 different ROIs.
> then i use ENVI_GET_ROI_DATA function i get values of my ROI pixels, i
> printed it
> for check i use ENVI and use cursor/location option....
>
> why values are different ? does ENVI_GET_ROI_DATA use some
> interpolation algorithm?

Did you check to make sure you were handling your indices the right
way? ENVI routines like ENVI_GET_ROI_DATA will use zero-based
indices, while in the ENVI GUI (ie, the cursor location/value tool)
one-based indices are used.
Re: envi_get_roi_data [message #62318 is a reply to message #62221] Sun, 31 August 2008 08:18 Go to previous message
devin.white is currently offline  devin.white
Messages: 50
Registered: March 2007
Member
On Aug 31, 9:05 am, "skymaxw...@gmail.com" <skymaxw...@gmail.com>
wrote:
> On Aug 31, 12:46 am, "Jeff N." <jeffnettles4...@gmail.com> wrote:
>
>
>
>
>
>> On Aug 30, 3:06 am, "skymaxw...@gmail.com" <skymaxw...@gmail.com>
>> wrote:
>
>>> Good day
>
>>> i did excercise from ENVI Programming documentation with ROI. from
>>> ENVI i create 4 different ROIs.
>>> then i use ENVI_GET_ROI_DATA function i get values of my ROI pixels, i
>>> printed it
>>> for check i use ENVI and use cursor/location option....
>
>>> why values are different ? does ENVI_GET_ROI_DATA use some
>>> interpolation algorithm?
>
>> Did you check to make sure you were handling your indices the right
>> way?  ENVI routines like ENVI_GET_ROI_DATA will use zero-based
>> indices, while in the ENVI GUI (ie, the cursor location/value tool)
>> one-based indices are used.
>
> yes, i know about it.
>
> now, i faced with problem.
>
> i use following syntax:
>
> roi_ids=ENVI_GET_ROI_IDS(NS=ns,NL=nl,ROI_NAMES=roi_names,/SH ORT_NAME)
>
> in first runtime i have size of roi_names = 4, the same for roi_ids
> second runtime size of roi_names = 8, the same with roi_ids.
>
> why data is appended to roi_names and roi_ids ????- Hide quoted text -
>
> - Show quoted text -

If your program includes a step where you are defining ROIs, then you
most likely ran the program twice in the same ENVI session without
cleaning up the ROIs created during the first run. You can check this
by loading the image you are working with to a display, then open the
ROI tool for that display. You'll likely see the same set of ROIs
listed twice. To get around this, one approach would be to make sure
that no ROIs are associated with your image prior to creating new
ones. You can put these lines at the beginning of your program, right
after you obtain the FID for the image you are working with:

roi_ids = envi_get_roi_ids(fid=fid)
envi_delete_rois, roi_ids

Any ROIs associated with the image will be deleted, so you can start
with a clean slate. As for the differences in retrieved data values,
keep in mind that data are returned in an array that has an array of
1D image coordinate addresses associated with it (returned through the
ADDR keyword to ENVI_GET_ROI_DATA). You should convert these 1D
coordinates to 2D if you want to check to make sure that the correct
data are being returned. To do this:

roi_ids = envi_get_roi_ids(fid=fid)
;as an example, retrieve data from first ROI in the list
roi_data = envi_get_roi_data(roi_ids[0], fid=fid, addr=addr)
;get number of samples in the image
envi_file_query, fid, ns=ns
;calculate 1-based coordinates for interactive evaluation in Cursor
Location/Value tool
roi_x_coords = (addr mod ns) + 1
roi_y_coords = (addr/ns) + 1

And no, ENVI_GET_ROI_DATA does not do any kind of interpolation. The
only data retrieval routine that does that is ENVI_GET_DATA--and only
when you specify X/Y scale factors that are not 1.0.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: envi_get_roi_data
Next Topic: Re: Changing values of one image from ENVI

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:43:10 PDT 2025

Total time taken to generate the page: 0.00750 seconds