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

Home » Public Forums » archive » Re: Problem with IDLgrROI and normalization.
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: Problem with IDLgrROI and normalization. [message #19153] Fri, 25 February 2000 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
I wrote earlier today:

> I don't think there is anything wrong with *your* code.
> I believe you have discovered a bug in the IDLgrROI
> code. :-)

RSI confirms my suspicion. Here is the message
I received late today:

> Yes, this is a bug in 5.3. But, is has been fixed and
> will be released with 5.4. Essentially, the xcoord_conv,
> etc. keywords are being ignored which is why the roi
> is not being drawn correctly.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Problem with IDLgrROI and normalization. [message #19163 is a reply to message #19153] Fri, 25 February 2000 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Erik Hummel (erik.hummel@philips.com) writes:

> In the program added an IDLgrPolyLine and IDLgrROI object are drawn. The
> results of the
> program is that only the IDLgrPolyLine is drawn. Important is that
> normalized coordinates are used,
> otherwise both objects are correctly drawn.
> What is wrong here?

I don't think there is anything wrong with *your* code.
I believe you have discovered a bug in the IDLgrROI
code. :-)

Here is an example. Two windows, produced with identical
code. However, the viewport rectangle in one window uses
a "device" coordinate system (0 to 500), whereas the
viewport rectangle in the second window uses a
"normalized" coordinate system (0 to 1). The ROI appears
in the first window, but not in the second.

I'll report this to RSI and see what they have to say.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155

------------------------------------------------------
FUNCTION Normalize, range, Position=position

On_Error, 1
IF N_Params() EQ 0 THEN Message, 'Please pass range vector as argument.'

IF (N_Elements(position) EQ 0) THEN position = [0.0, 1.0] ELSE $
position=Float(position)
range = Float(range)

scale = [((position[0]*range[1])-(position[1]*range[0])) / $
(range[1]-range[0]), (position[1]-position[0])/(range[1]-range[0])]

RETURN, scale
END


PRO ROI_TEST

; Draw using viewport with device coordinates.


top_wid = Widget_Base(XSize = 500, YSize = 500, Title='Device
Coordinates')

draw_wid = Widget_Draw(top_wid, XSize = 500, YSize = 500,$
Graphics_Level = 2, Retain=2)

Widget_Control, top_wid, /REALIZE;
Widget_Control, draw_wid, Get_Value = window


view = Obj_New('IDLgrView', Color = [100, 100, 100])
view->SetProperty,Viewplane_rect = [0,0,500,500]

model = Obj_New('IDLgrModel')
view->Add, model

; The IDLgrROI Object.
gfxROI = OBJ_New('IDLgrROI', [50, 400, 400, 50, 50], $
[50, 50, 400, 400, 50], Color=[255,255,0])
model->Add, gfxROI
gfxROI->GetProperty, xrange=xrange, yrange=yrange
Print, 'XRange for Device Coordinates: ', xrange
Print, 'YRange for Device Coordinates: ', yrange
xs = Normalize(xrange, Pos=[50,400])
ys = Normalize(yrange, Pos=[50,400])
gfxROI->SetProperty, XCoord_Conv = xs, YCoord_Conv = ys

window->Draw, view

; Draw using veiwport with normalized coordinates.

top_wid = Widget_Base(XSize = 500, YSize = 500, $
XOffset=500, YOffset=0, Title='Normalized Coordinates')

draw_wid = Widget_Draw(top_wid, XSize = 500, YSize = 500,$
Graphics_Level = 2, Retain=2)

Widget_Control, top_wid, /REALIZE;
Widget_Control, draw_wid, Get_Value = window


view = Obj_New('IDLgrView', Color = [100, 100, 100])
view->SetProperty,Viewplane_rect = [0,0,1,1]

model = Obj_New('IDLgrModel')
view->Add, model

; The IDLgrROI Object.
gfxROI = OBJ_New('IDLgrROI', [50, 400, 400, 50, 50],$
[50, 50, 400, 400, 50], Color=[255,255,0])
model->Add, gfxROI
gfxROI->GetProperty, xrange=xrange, yrange=yrange
Print, 'XRange for Normalized Coordinates: ', xrange
Print, 'YRange for Normalized Coordinates: ', yrange
xs = Normalize(xrange, Pos=[0.1,0.8])
ys = Normalize(yrange, Pos=[0.1,0.8])
gfxROI->SetProperty, XCoord_Conv = xs, YCoord_Conv = ys

window->Draw, view
end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Interpolation: grid --> observation point
Next Topic: Re: color resources problem

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

Current Time: Fri Oct 10 22:31:10 PDT 2025

Total time taken to generate the page: 0.16097 seconds