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

Home » Public Forums » archive » Image scale as 0 - 4096 instead of 0 - 255
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
Image scale as 0 - 4096 instead of 0 - 255 [message #29908] Fri, 22 March 2002 12:18 Go to next message
idlfreak is currently offline  idlfreak
Messages: 47
Registered: October 2001
Member
Hi,
I can view the images in a window using IDLgrWindow command in object
graphics or tvscl command in direct graphics. I have couple of simple
questions on this.

1. The images obtained are in the scale of 0 - 255. I'd like to view
these images on a 0 - 4096 scale. Can anybody tell me how to do that.
2. When i'm drawing these images in object graphics. I can draw
images in only one window at a time. That is, even though i perform
several modifications to the image like erosion or dilation only one
stage can be seen. In other words i can't get many windows. I want to
draw all the stages of image in seperate windows like what we can do
in direct graphics using tvscl command and the location of a window.
please suggest me a method to do this.

Thank you for ur time and any help is welcome.

Cheers,
Akhila.
Re: Image scale as 0 - 4096 instead of 0 - 255 [message #29942 is a reply to message #29908] Tue, 26 March 2002 17:35 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Akhila (idlfreak@yahoo.com) writes:

> I hope i'm clear this time.

I think Mark solved this one for you. You can have as many
object windows as you like. Set the RETAIN keyword so they
do their own backing store and redraw properly.

> I'm sorry to bother you, but i have another question to ask you. I saw
> that you have once discussed about dispaying the image for Medical
> imaging purposes using 4096 as a greyscale instead of 255. Is that
> possible and how can you do that?

I didn't say 4096 shades of gray. I said that often medical
images are 12 or 16 bit rather than 8 and radiologists don't
want to throw *any* data away. So they prefer to define a
"window" into their 16-bit data and choose which range of
the data is displayed in the 256 shades of gray available
on a computer.

The program ConstrastZoom on my web page demonstrates one
way this windowing can be done (among other things).

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Image scale as 0 - 4096 instead of 0 - 255 [message #29943 is a reply to message #29908] Tue, 26 March 2002 16:45 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
"Akhila" <idlfreak@yahoo.com> wrote in message
news:b1ad7b05.0203261438.19606cd0@posting.google.com...
> I can display two images in two different windows in direct graphics
> like this:
>
> ...
>

> I want to display the two images this way in two windows but in
> object graphics. I tried to do the following in object graphics, but
> didn't help.
>
> oImage = Obj_New('IDLgrImage', image, ORDER = 2)
> oWindow = Obj_New('IDLgrWindow')
> oView = Obj_New('IDLgrView', VIEWPLANE_RECT = [0,0,512,512], COLOR =
> [0,0,0], PROJECTION = 2)
> oModel = Obj_New('IDLgrModel')
> oModel -> Add, oImage
> oView -> Add, oModel
> oWindow -> Draw, oView
>
> and again for image1.
>
> ...

Hmmm. I think it's a redrawing problem. If I run your code on my
system (IDL 5.5, Windows 2000, hardware renderer) I get two object
graphics windows, one on top of the other. The image is visible in the
second window (ie. the one initially visible), but when I expose the
first window it's black. Then when I expose the first window it's
black also. And they both stay black thereafter, because the
IDLgrWindow objects don't retain their contents and they're not being
redrawn on exposure.

A simple fix is to set the RETAIN property of the IDLgrWindows to
something other than 0. (Possible values are 1 & 2. On Windows they
give identical results. On Unix it depends on X backing store and
other complicated stuff--try them both.)

The basic problem is that Object Graphics provides quite a nice
toolkit for scientific visualisation, but it's all very
low-level. Plain IDLgrWindow objects are not really very useful. You
need an object-graphics window embedded in a widget application with
event-handling code to take care of redrawing. You could display each
of your IDLgrImage objects with XOBJVIEW. Or you roam through David
Fanning's WWW site looking for something suitable. My IDL libray has a
general-purpose OG window object (MGH_Window) that could be just what
you need. It's at

http://katipo.niwa.cri.nz/~hadfield/gust/software/idl/

As I've explained recently on this group, my library is not as
user-friendly as some others. But you're welcome to try it out and I'd
love to hear how you get on.

--
Mark Hadfield
m.hadfield@niwa.co.nz Ka puwaha et tai nei
http://katipo.niwa.co.nz/~hadfield Hoea tatou
National Institute for Water and Atmospheric Research (NIWA)
Re: Image scale as 0 - 4096 instead of 0 - 255 [message #29944 is a reply to message #29908] Tue, 26 March 2002 14:38 Go to previous message
idlfreak is currently offline  idlfreak
Messages: 47
Registered: October 2001
Member
I can display two images in two different windows in direct graphics
like this:

window, 1, XSIZE = imSize[1], YSIZE = imSize[2]
tvscl, congrid(image, imSize[1], imSize[2])

window, 2, XSIZE = imSize[1], YSIZE = imSize[2]
tvscl, congrid(image1, imSize[1], imSize[2])

I want to display the two images this way in two windows but in object
graphics. I tried to do the following in object graphics, but didn't
help.

oImage = Obj_New('IDLgrImage', image, ORDER = 2)
oWindow = Obj_New('IDLgrWindow')
oView = Obj_New('IDLgrView', VIEWPLANE_RECT = [0,0,512,512], COLOR =
[0,0,0], PROJECTION = 2)
oModel = Obj_New('IDLgrModel')
oModel -> Add, oImage
oView -> Add, oModel
oWindow -> Draw, oView

and again for image1.

oImage = Obj_New('IDLgrImage', image1, ORDER = 2)
oWindow = Obj_New('IDLgrWindow')
oView = Obj_New('IDLgrView', VIEWPLANE_RECT = [0,0,512,512], COLOR =
[0,0,0], PROJECTION = 2)
oModel = Obj_New('IDLgrModel')
oModel -> Add, oImage
oView -> Add, oModel
oWindow -> Draw, oView

but it doesn't work. I hope i'm clear this time.

I'm sorry to bother you, but i have another question to ask you. I saw
that you have once discussed about dispaying the image for Medical
imaging purposes using 4096 as a greyscale instead of 255. Is that
possible and how can you do that?

Thank you for your time.
Regerds,
Akhila
David Fanning <david@dfanning.com> wrote in message news:<MPG.170a61484298476d98984e@news.frii.com>...
> Akhila (idlfreak@yahoo.com) writes:
>
>> I looked at your program but u have drawn some different views in
>> one scene and displayed that in one window. Is that the only way we
>> can do it?
>>
>> In direct graphics
>>
>> tvscl, image
>> tvscl, image1
>>
>> will draw two images in two windows. I want to do that but in object
>> graphics. Please tell me if that's possible.
>
> Actually, your example will overdraw the second image
> in the same window as the first, so I'm not exactly
> sure what you are asking about. Could you clarify
> exactly what you want?
>
> Cheers,
>
> David
Re: Image scale as 0 - 4096 instead of 0 - 255 [message #29955 is a reply to message #29908] Tue, 26 March 2002 09:43 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Akhila (idlfreak@yahoo.com) writes:

> I looked at your program but u have drawn some different views in
> one scene and displayed that in one window. Is that the only way we
> can do it?
>
> In direct graphics
>
> tvscl, image
> tvscl, image1
>
> will draw two images in two windows. I want to do that but in object
> graphics. Please tell me if that's possible.

Actually, your example will overdraw the second image
in the same window as the first, so I'm not exactly
sure what you are asking about. Could you clarify
exactly what you want?

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: command line edit problem
Next Topic: Re: updating a different widget from the event handler

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

Current Time: Wed Oct 08 18:39:49 PDT 2025

Total time taken to generate the page: 0.00646 seconds