Re: A problem with envi_save_rois [message #66328] |
Fri, 01 May 2009 11:52 |
josea.malpica
Messages: 12 Registered: March 2008
|
Junior Member |
|
|
> Ok, next try... you are using ns and nl, but they are not defined
> anywhere...
>
> Jean
I only change in the code:
ENVI_FILE_QUERY, fid, dims=dims
ENVI_FILE_QUERY, fid, dims=dims, ns=ns, nl=nl
and the procedure works perfectly.
There is a typo in the reference guide page 191
Thank you very much for your help Jean
Jose
|
|
|
Re: A problem with envi_save_rois [message #66333 is a reply to message #66328] |
Fri, 01 May 2009 07:31  |
Jean H.
Messages: 472 Registered: July 2006
|
Senior Member |
|
|
> ENVI_SELECT, fid=fid
> ;
> ; Get the dimensions for this
> ; file and create an ROI
> ;
> ENVI_FILE_QUERY, fid, dims=dims
> roi_id = ENVI_CREATE_ROI(ns=ns, nl=nl, $
> color=4, name='Square')
Ok, next try... you are using ns and nl, but they are not defined
anywhere...
Jean
|
|
|
Re: A problem with envi_save_rois [message #66335 is a reply to message #66333] |
Fri, 01 May 2009 06:47  |
josea.malpica
Messages: 12 Registered: March 2008
|
Junior Member |
|
|
> try adding "envi" at the top of your procedure... it will give you
> access to the Envi's functions
> Jean
I just did it; I suppose this is what you mean:
pro veamos, event
;
; Choose the bhtmref.img file
;
ENVI
ENVI_SELECT, fid=fid
;
; Get the dimensions for this
; file and create an ROI
;
ENVI_FILE_QUERY, fid, dims=dims
roi_id = ENVI_CREATE_ROI(ns=ns, nl=nl, $
color=4, name='Square')
;
; Define the square and add
; the polygon object to the ROI
;
xpts = [100, 200, 200, 100, 100]
ypts = [100, 100, 200, 200, 100]
ENVI_DEFINE_ROI, roi_id, /polygon, $
xpts=xpts, ypts=ypts
ENVI_SAVE_ROIS, 'Square.roi', roi_id
end
but it still keeps giving the same error.
Thanks anyway, for your response.
Jose
|
|
|
Re: A problem with envi_save_rois [message #66336 is a reply to message #66335] |
Fri, 01 May 2009 05:31  |
Jean H.
Messages: 472 Registered: July 2006
|
Senior Member |
|
|
frasca wrote:
> Hi,
>
> Please could some one tell me why the following program does not
> work?
try adding "envi" at the top of your procedure... it will give you
access to the Envi's functions
Jean
>
> pro veamos, event
> ;
> ; Choose the bhtmref.img file
> ;
> ENVI_SELECT, fid=fid
> ;
> ; Get the dimensions for this
> ; file and create an ROI
> ;
> ENVI_FILE_QUERY, fid, dims=dims
> roi_id = ENVI_CREATE_ROI(ns=ns, nl=nl, $
> color=4, name='Square')
> ;
> ; Define the square and add
> ; the polygon object to the ROI
> ;
> xpts = [100, 200, 200, 100, 100]
> ypts = [100, 100, 200, 200, 100]
> ENVI_DEFINE_ROI, roi_id, /polygon, $
> xpts=xpts, ypts=ypts
>
> ENVI_SAVE_ROIS, 'Square.roi', roi_id
>
> end
>
> When executed is says:
>
> Variable is undefined ENVI_ROIS(ENVI_ROI_COMMON) The result may be
> invalid
>
> It looks like I follow the rules in the reference guide, actually
> except for the envi_save_roi is a copy and paste of the
> envi_create_roi (page 191)
>
> Thanks in advance,
> Jose
|
|
|