IDLgrImage image plot problem [message #50303] |
Tue, 26 September 2006 12:06  |
yy
Messages: 14 Registered: September 2006
|
Junior Member |
|
|
Hi there,
I want to plot a 2D data set by using object graphics.
And I want it to be colored. If I use direct graphics plot,
it can be done as the following:
WINDOW, 0, XSIZE=300, YSIZE=300
LOADCT,13
IMAGE_AX, 2ddata
However, when I try to use IDLgrImage, nothing appears
on screen. I don't know if it's because I didn't position the
image correctly. But if it is, I still don't know how to find the
image. Below is what I did:
oWindow = OBJ_NEW('IDLgrWindow', DIMENSIONS=[300,300])
oView = OBJ_NEW('IDLgrView')
oModel = OBJ_NEW('IDLgrModel')
; Load color table 13
oPalette = OBJ_NEW('IDLgrPalette')
oPalette -> LoadCT, 13
oImage = OBJ_NEW('IDLgrImage', 2ddata, PALETTE = oPalette)
oModel -> Add, oImage
oView -> Add, oModel
oWindow -> Draw, oView
Thanks a lot!
-Jingyi
|
|
|
Re: IDLgrImage image plot problem [message #50372 is a reply to message #50303] |
Wed, 27 September 2006 10:16  |
yy
Messages: 14 Registered: September 2006
|
Junior Member |
|
|
Yes! It works! Thank you soooooo much!
Jingyi
David Fanning wrote:
> yy writes:
>
>> It seems to be a TrueColor visual. :(
>> The strange thing is the direct graphic method works.
>
> Well, last gasp, I would run this in the software renderer,
> rather than with hardware rendering. Could be a graphics
> card problem, I guess.
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: IDLgrImage image plot problem [message #50374 is a reply to message #50303] |
Wed, 27 September 2006 09:34  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
yy writes:
> It seems to be a TrueColor visual. :(
> The strange thing is the direct graphic method works.
Well, last gasp, I would run this in the software renderer,
rather than with hardware rendering. Could be a graphics
card problem, I guess.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: IDLgrImage image plot problem [message #50375 is a reply to message #50303] |
Wed, 27 September 2006 09:06  |
yy
Messages: 14 Registered: September 2006
|
Junior Member |
|
|
David Fanning wrote:
> yy writes:
>
>> I just found that if I set the color table to be gray
>> (i.e., oPalette -> LoadCT, 0), things will show up with
>> the correct setting of VIEWPLANE_RECT. However,
>> none of the other color tables works. I'm wondering if
>> this is a problem with my IDL. But if that's the case,
>> why does the direct graphic method, i.e., LOADCT,
>> work well for all the color tables for the same data set?
>> And why does the color table work for an array with
>> dimensions [3, n, m]? I really have no clue about this.
>> It seems that nobody had complained about displaying
>> the IDL provided example, CenteringAnImage.pro.
>
> Well, here is a completely wild guess. Are you by any
> chance using a DIRECTCOLOR visual? If you are not using
> a TRUECCOLOR visual, all bets are off with respect to
> color behavior. :-)
>
> Try this:
>
> IDL> Help, /Device
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
It seems to be a TrueColor visual. :(
The strange thing is the direct graphic method works.
Available Graphics Devices: CGM HP LJ NULL PCL PRINTER PS REGIS TEK X Z
Current graphics device: X
Server: X11.0, The X.Org Foundation, Release 60802000
Display Depth, Size: 24 bits, (1024,768)
Visual Class: TrueColor (4)
Bits Per RGB: 8 (8/8/8)
Physical Color Map Entries (Emulated / Actual): 256 / 256
Colormap: Shared, 16777216 colors. Translation table: Enabled
Graphics pixels: Combined, Dither Method: Ordered
Write Mask: 16777215 (decimal) ffffff (hex)
Graphics Function: 3 (copy)
Current Font: <default>, Current TrueType Font: <default>
Default Backing Store: Pixmap.
Jingyi
|
|
|
Re: IDLgrImage image plot problem [message #50382 is a reply to message #50303] |
Wed, 27 September 2006 05:45  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
yy writes:
> I just found that if I set the color table to be gray
> (i.e., oPalette -> LoadCT, 0), things will show up with
> the correct setting of VIEWPLANE_RECT. However,
> none of the other color tables works. I'm wondering if
> this is a problem with my IDL. But if that's the case,
> why does the direct graphic method, i.e., LOADCT,
> work well for all the color tables for the same data set?
> And why does the color table work for an array with
> dimensions [3, n, m]? I really have no clue about this.
> It seems that nobody had complained about displaying
> the IDL provided example, CenteringAnImage.pro.
Well, here is a completely wild guess. Are you by any
chance using a DIRECTCOLOR visual? If you are not using
a TRUECCOLOR visual, all bets are off with respect to
color behavior. :-)
Try this:
IDL> Help, /Device
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: IDLgrImage image plot problem [message #50386 is a reply to message #50303] |
Tue, 26 September 2006 20:11  |
yy
Messages: 14 Registered: September 2006
|
Junior Member |
|
|
Thanks guys! I appreciate your help!
I just found that if I set the color table to be gray
(i.e., oPalette -> LoadCT, 0), things will show up with
the correct setting of VIEWPLANE_RECT. However,
none of the other color tables works. I'm wondering if
this is a problem with my IDL. But if that's the case,
why does the direct graphic method, i.e., LOADCT,
work well for all the color tables for the same data set?
And why does the color table work for an array with
dimensions [3, n, m]? I really have no clue about this.
It seems that nobody had complained about displaying
the IDL provided example, CenteringAnImage.pro.
Jingyi
|
|
|
Re: IDLgrImage image plot problem [message #50388 is a reply to message #50303] |
Tue, 26 September 2006 17:55  |
Karl Schultz
Messages: 341 Registered: October 1999
|
Senior Member |
|
|
On Tue, 26 Sep 2006 12:06:32 -0700, yy wrote:
> Hi there,
> I want to plot a 2D data set by using object graphics.
> And I want it to be colored. If I use direct graphics plot,
> it can be done as the following:
> WINDOW, 0, XSIZE=300, YSIZE=300
> LOADCT,13
> IMAGE_AX, 2ddata
>
> However, when I try to use IDLgrImage, nothing appears
> on screen. I don't know if it's because I didn't position the
> image correctly. But if it is, I still don't know how to find the
> image. Below is what I did:
> oWindow = OBJ_NEW('IDLgrWindow', DIMENSIONS=[300,300])
> oView = OBJ_NEW('IDLgrView')
> oModel = OBJ_NEW('IDLgrModel')
>
> ; Load color table 13
> oPalette = OBJ_NEW('IDLgrPalette')
> oPalette -> LoadCT, 13
> oImage = OBJ_NEW('IDLgrImage', 2ddata, PALETTE = oPalette)
>
> oModel -> Add, oImage
> oView -> Add, oModel
> oWindow -> Draw, oView
>
> Thanks a lot!
> -Jingyi
You are drawing an image into an IDLgrView with default dimensions of
[-1:1, -1:1]. So, you are probably only seeing the lower-left pixel of
your image, blown up to 1/4 of the entire window.
Try
oView->SetProperty, VIEWPLANE_RECT = [0,0,300,300]
Karl
|
|
|
Re: IDLgrImage image plot problem [message #50389 is a reply to message #50303] |
Tue, 26 September 2006 17:36  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
yy writes:
> Thanks for your reply. I'm wondering if there is some other problem
> since when I try to run the CenteringAnImage.pro code provided in IDL
> help. I still can't see anything in the window. I don't know what is
> going on.
Humm. Well, again, not at all unusual when beginning to learn
about object graphics. Lack of visual feedback is particularly
pernicious. Of course, object graphics allows you to do *everything*,
including all those things that make your visual appear off in
the ozone somewhere. :-)
I recall a line (imprefectly) from my favorite Barry Lopez story,
Directions:
When your throat fills with dust so that you cannot breathe,
and you find you cannot laugh at all any more, you are nearly there.
Push on.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|