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

Home » Public Forums » archive » xroi with regions_in problem
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
xroi with regions_in problem [message #94851] Tue, 07 November 2017 05:28 Go to next message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
Hi,

I'm trying to use the regions_in keyword with xroi but it seems I can't make it work.

The purpose is to have a pre-defined region of interest, that the user can move or size scale in the GUI.

This call, without regions_in, works fine:

IDL> xroi, dispim, regions_out = roi, /block

But when I do

IDL> xroi, dispim, regions_in = [roi_in], regions_out = roi, /block

The display image (dispim) is not shown properly (I get just a black image) and the call is terminated with the error message:

IDLGRMODEL::ADD: Argument 1 should be of class type IDLgrModel or IDLgrGraphic or IDL_Container


If I repeat the call, the image is displayed nicely but I see no defined ROI in the ROI information window.


The roi_in object is created like this:

IDL> roi_in = OBJ_NEW('IDLanROI', X_in, Y_in)

where X_in and Y_in define a rectangle:

IDL> help,X_in,Y_in & print, X_in & print,Y_in
X_IN LONG = Array[4]
Y_IN LONG = Array[4]
35 65 65 35
35 35 65 65

The roi_in object at least passes the simplest of tests but could probably be wrong anyway:

IDL> roi_in -> getproperty, roi_xrange = xx & print, xx
35.000000 65.000000

I'm using regions_in = [roi_in] because the documentation says it should be an array but regions_in = roi_in gives the same error.

Any advice?
Re: xroi with regions_in problem [message #94853 is a reply to message #94851] Tue, 07 November 2017 07:03 Go to previous messageGo to next message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
Den tisdag 7 november 2017 kl. 14:28:18 UTC+1 skrev Mats Löfdahl:
> Hi,
>
> I'm trying to use the regions_in keyword with xroi but it seems I can't make it work.
>
> The purpose is to have a pre-defined region of interest, that the user can move or size scale in the GUI.
>
> This call, without regions_in, works fine:
>
> IDL> xroi, dispim, regions_out = roi, /block
>
> But when I do
>
> IDL> xroi, dispim, regions_in = [roi_in], regions_out = roi, /block
>
> The display image (dispim) is not shown properly (I get just a black image) and the call is terminated with the error message:
>
> IDLGRMODEL::ADD: Argument 1 should be of class type IDLgrModel or IDLgrGraphic or IDL_Container
>
>
> If I repeat the call, the image is displayed nicely but I see no defined ROI in the ROI information window.
>
>
> The roi_in object is created like this:
>
> IDL> roi_in = OBJ_NEW('IDLanROI', X_in, Y_in)
>
> where X_in and Y_in define a rectangle:
>
> IDL> help,X_in,Y_in & print, X_in & print,Y_in
> X_IN LONG = Array[4]
> Y_IN LONG = Array[4]
> 35 65 65 35
> 35 35 65 65
>
> The roi_in object at least passes the simplest of tests but could probably be wrong anyway:
>
> IDL> roi_in -> getproperty, roi_xrange = xx & print, xx
> 35.000000 65.000000
>
> I'm using regions_in = [roi_in] because the documentation says it should be an array but regions_in = roi_in gives the same error.
>
> Any advice?

I should add that dispim is a 100 by 100 byte array, so the rectangle should be within bounds.
Re: xroi with regions_in problem [message #94856 is a reply to message #94853] Wed, 08 November 2017 00:19 Go to previous messageGo to next message
Helder is currently offline  Helder
Messages: 10
Registered: October 2017
Junior Member
Hi Mats,
you need to give an IDLgrROI as input, not IDLanROI. From the help:
REGIONS_IN
Set this keyword to an array of IDLgrROI references.

Here is a working example:

dispim = dist(100)
roi_in = obj_new('IDLgrROI',[35,65,65,35],[35,35,65,65])
xroi, dispim, regions_in = roi_in, regions_out = roi_out, /block
;edit the roi
roi_out->getProperty, data=d
print, d
35.0000 16.0000 0.000000
87.2581 16.0000 0.000000
87.2581 64.3871 0.000000
35.0000 64.3871 0.000000

Cheers,
Helder


On Tuesday, 7 November 2017 16:03:17 UTC+1, Mats Löfdahl wrote:
> Den tisdag 7 november 2017 kl. 14:28:18 UTC+1 skrev Mats Löfdahl:
>> Hi,
>>
>> I'm trying to use the regions_in keyword with xroi but it seems I can't make it work.
>>
>> The purpose is to have a pre-defined region of interest, that the user can move or size scale in the GUI.
>>
>> This call, without regions_in, works fine:
>>
>> IDL> xroi, dispim, regions_out = roi, /block
>>
>> But when I do
>>
>> IDL> xroi, dispim, regions_in = [roi_in], regions_out = roi, /block
>>
>> The display image (dispim) is not shown properly (I get just a black image) and the call is terminated with the error message:
>>
>> IDLGRMODEL::ADD: Argument 1 should be of class type IDLgrModel or IDLgrGraphic or IDL_Container
>>
>>
>> If I repeat the call, the image is displayed nicely but I see no defined ROI in the ROI information window.
>>
>>
>> The roi_in object is created like this:
>>
>> IDL> roi_in = OBJ_NEW('IDLanROI', X_in, Y_in)
>>
>> where X_in and Y_in define a rectangle:
>>
>> IDL> help,X_in,Y_in & print, X_in & print,Y_in
>> X_IN LONG = Array[4]
>> Y_IN LONG = Array[4]
>> 35 65 65 35
>> 35 35 65 65
>>
>> The roi_in object at least passes the simplest of tests but could probably be wrong anyway:
>>
>> IDL> roi_in -> getproperty, roi_xrange = xx & print, xx
>> 35.000000 65.000000
>>
>> I'm using regions_in = [roi_in] because the documentation says it should be an array but regions_in = roi_in gives the same error.
>>
>> Any advice?
>
> I should add that dispim is a 100 by 100 byte array, so the rectangle should be within bounds.
Re: xroi with regions_in problem [message #94857 is a reply to message #94856] Wed, 08 November 2017 01:41 Go to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
OK, so I'm not stupid, I'm just blind... :)

Thanks Helder!

/Mats

Den onsdag 8 november 2017 kl. 09:19:56 UTC+1 skrev Helder:
> Hi Mats,
> you need to give an IDLgrROI as input, not IDLanROI. From the help:
> REGIONS_IN
> Set this keyword to an array of IDLgrROI references.
>
> Here is a working example:
>
> dispim = dist(100)
> roi_in = obj_new('IDLgrROI',[35,65,65,35],[35,35,65,65])
> xroi, dispim, regions_in = roi_in, regions_out = roi_out, /block
> ;edit the roi
> roi_out->getProperty, data=d
> print, d
> 35.0000 16.0000 0.000000
> 87.2581 16.0000 0.000000
> 87.2581 64.3871 0.000000
> 35.0000 64.3871 0.000000
>
> Cheers,
> Helder
>
>
> On Tuesday, 7 November 2017 16:03:17 UTC+1, Mats Löfdahl wrote:
>> Den tisdag 7 november 2017 kl. 14:28:18 UTC+1 skrev Mats Löfdahl:
>>> Hi,
>>>
>>> I'm trying to use the regions_in keyword with xroi but it seems I can't make it work.
>>>
>>> The purpose is to have a pre-defined region of interest, that the user can move or size scale in the GUI.
>>>
>>> This call, without regions_in, works fine:
>>>
>>> IDL> xroi, dispim, regions_out = roi, /block
>>>
>>> But when I do
>>>
>>> IDL> xroi, dispim, regions_in = [roi_in], regions_out = roi, /block
>>>
>>> The display image (dispim) is not shown properly (I get just a black image) and the call is terminated with the error message:
>>>
>>> IDLGRMODEL::ADD: Argument 1 should be of class type IDLgrModel or IDLgrGraphic or IDL_Container
>>>
>>>
>>> If I repeat the call, the image is displayed nicely but I see no defined ROI in the ROI information window.
>>>
>>>
>>> The roi_in object is created like this:
>>>
>>> IDL> roi_in = OBJ_NEW('IDLanROI', X_in, Y_in)
>>>
>>> where X_in and Y_in define a rectangle:
>>>
>>> IDL> help,X_in,Y_in & print, X_in & print,Y_in
>>> X_IN LONG = Array[4]
>>> Y_IN LONG = Array[4]
>>> 35 65 65 35
>>> 35 35 65 65
>>>
>>> The roi_in object at least passes the simplest of tests but could probably be wrong anyway:
>>>
>>> IDL> roi_in -> getproperty, roi_xrange = xx & print, xx
>>> 35.000000 65.000000
>>>
>>> I'm using regions_in = [roi_in] because the documentation says it should be an array but regions_in = roi_in gives the same error.
>>>
>>> Any advice?
>>
>> I should add that dispim is a 100 by 100 byte array, so the rectangle should be within bounds.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to 'fill' legend text with color or outline color text in black?
Next Topic: An IDL hero moves on. Best wishes, Chris!

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

Current Time: Wed Oct 08 07:11:31 PDT 2025

Total time taken to generate the page: 0.00404 seconds