Re: xroi with regions_in problem [message #94856 is a reply to message #94853] |
Wed, 08 November 2017 00:19   |
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.
|
|
|