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

Home » Public Forums » archive » Re: Poscript Component Selection
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: Poscript Component Selection [message #45492] Wed, 14 September 2005 01:53
IDLmastertobe is currently offline  IDLmastertobe
Messages: 54
Registered: June 2004
Member
Thank you so much, Mark. Your explanation is really helpful. I will look
more into it.
Re: Poscript Component Selection [message #45495 is a reply to message #45492] Tue, 13 September 2005 15:11 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
IDLmastertobe wrote:
> Thanks Mark. I have a whole bunch of 3D data to visualize in IDL. I can
> now visualize them, rotate them in any direction I want. It is like a
> real time display of the 3D object. Now I am trying to save the 3D object
> in a postscript format such that I can select certain axis, labels, etc and
> modify them for say presentation or other purposes. I was able to save the
> 3D object in ps, but it is like a jpeg image and I can't modify any
> component of the image. After getting help from a lot of people, I can
> now save it in ps format with the ability of selecting and modifying some
> component, but the 3D image now appear to be a while plane that has no
> color at all. I am trying to figure out if it is possible to even have
> what I want implemented. Thanks for your reply.

If you want vector Postscript output from object graphics then you are
going to have to live with or work around its limitations. These are
listed in the IDL documentation under the heading...

Programmer's Guides
Object Programming
Displaying, Copying and Printing Objects
Bitmap and Vector Graphics

One of these limitations is that texture mapped images are omitted from
vector output; there are other significant ones, eg shaded lighting effects.

Texture mapped images are not the only way to display numeric data as a
colour plot in Object Graphics. Surfaces can also be coloured, as can
polygons. There are examples of this in the Motley library:

http://www.dfanning.com/hadfield/idl/README.html

Once you've got the library installed and working (contact me if you
need help) run the command "mgh_example_density" with various values of
the option argument. You can try various output options (image files,
Postscript files, printer) and see how they look.

But if you get past this obstacle, you may still find that vector
Postscript just can't represent 3D object graphics well enough. Bitmap
output, in a format like PNG, represents the plot much better, doesn't
have to look too grainy (if the resolution is high enough) and can be
annotated in some graphics editor (but the axes and lines aren't
entities, just collections of pixels).

Another option is to use the IDL Itools and do your annotation and
editing in IDL. I can't really comment on this because I haven't got to
grips with Itools.

Or do what I do: do all my annotation with IDL code, running the
commands repeatedly until I'm satisfied. This can be time-consuming but
has the advantage that the plot can then be generated again without any
manual steps.

Or use Tecplot?



--
Mark Hadfield "Kei puwaha te tai nei, Hoea tahi tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
Re: Poscript Component Selection [message #45509 is a reply to message #45495] Tue, 13 September 2005 01:19 Go to previous message
IDLmastertobe is currently offline  IDLmastertobe
Messages: 54
Registered: June 2004
Member
Hi Ben, that was a truncated version of my code. In my unabridged code, it
acutally has the lines you mentioned. Thanks for the advise though.
Re: Poscript Component Selection [message #45510 is a reply to message #45509] Tue, 13 September 2005 00:22 Go to previous message
Ben Panter is currently offline  Ben Panter
Messages: 102
Registered: July 2003
Senior Member
IDLmastertobe wrote:
> Thanks Mark. I have a whole bunch of 3D data to visualize in IDL. I can
> now visualize them, rotate them in any direction I want. It is like a
> real time display of the 3D object. Now I am trying to save the 3D object
> in a postscript format such that I can select certain axis, labels, etc and
> modify them for say presentation or other purposes. I was able to save the
> 3D object in ps, but it is like a jpeg image and I can't modify any
> component of the image. After getting help from a lot of people, I can
> now save it in ps format with the ability of selecting and modifying some
> component, but the 3D image now appear to be a while plane that has no
> color at all. I am trying to figure out if it is possible to even have
> what I want implemented. Thanks for your reply.
>


I notice that in the code you posted you just set_plot, 'ps' and then
start plotting. It might help you to try

device, filename='mypsfile.ps', /color, bits_per_pixel=8

just after your set_plot

but then I have no idea of how that interacts with the object methods
outlined by others here... you might find there is similar functionality
in the object?

Ben

--
Ben Panter, Garching, Germany.
Email false, http://www.benpanter.co.uk
or you could try ben at ^^^^^^^^^^^^^^^
Re: Poscript Component Selection [message #45511 is a reply to message #45510] Mon, 12 September 2005 23:46 Go to previous message
IDLmastertobe is currently offline  IDLmastertobe
Messages: 54
Registered: June 2004
Member
Thanks Mark. I have a whole bunch of 3D data to visualize in IDL. I can
now visualize them, rotate them in any direction I want. It is like a
real time display of the 3D object. Now I am trying to save the 3D object
in a postscript format such that I can select certain axis, labels, etc and
modify them for say presentation or other purposes. I was able to save the
3D object in ps, but it is like a jpeg image and I can't modify any
component of the image. After getting help from a lot of people, I can
now save it in ps format with the ability of selecting and modifying some
component, but the 3D image now appear to be a while plane that has no
color at all. I am trying to figure out if it is possible to even have
what I want implemented. Thanks for your reply.
Re: Poscript Component Selection [message #45512 is a reply to message #45511] Mon, 12 September 2005 23:16 Go to previous message
IDLmastertobe is currently offline  IDLmastertobe
Messages: 54
Registered: June 2004
Member
Thanks Mark. I have a whole bunch of 3D data to visualize in IDL. I can
now visualize them, rotate them in any direction I want. It is like a
real time display of the 3D object. Now I am trying to save the 3D object
in a postscript format such that I can select certain axis, labels, etc and
modify them for say presentation or other purposes. I was able to save the
3D object in ps, but it is like a jpeg image and I can't modify any
component of the image. After getting help from a lot of people, I can
now save it in ps format with the ability of selecting and modifying some
component, but the 3D image now appear to be a while plane that has no
color at all. I am trying to figure out if it is possible to even have
what I want implemented. Thanks for your reply.
Re: Poscript Component Selection [message #45513 is a reply to message #45512] Mon, 12 September 2005 22:07 Go to previous message
IDLmastertobe is currently offline  IDLmastertobe
Messages: 54
Registered: June 2004
Member
Thank you Dr.Fanning and Mike. It was really helpful and I think I can
select the components now. But as Mike pointed out, the image in my 3D
postscript file is a piece of while plane. It has no color. Is there any
way I can fix it? Thanks.
Re: Poscript Component Selection [message #45514 is a reply to message #45513] Mon, 12 September 2005 22:06 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
IDLmastertobe wrote:
> Thank you Dr.Fanning and Mike. It was really helpful and I think I can
> select the components now. But as Mike pointed out, the image in my 3D
> postscript file is a piece of while plane. It has no color. Is there any
> way I can fix it? Thanks.
>

I'm afraid not. When IDL renders object graphics scenes (like the
thunderstorm visualisation) to vector formats like Postscript, there are
several limitations. One is that images laid on top of surfaces or
polygons with the "texture map" feature are not shown. For further info
see the following sections in the IDL manual:

Displaying, Copying and Printing Objects:
Bitmap and Vector Graphic Output

Mapping an Image onto Geometry

(I'm looking at these via the IDL 6.2 Help system. I'm not sure where to
find them in the printed manuals.)

It is possible to create coloured planes that resemble the one in the
thunderstorm visualisation by setting the VERT_COLORS property of the
ILgrPolygon or IDLgrSurface object that defines the plane.

It is possible to get high-quality output of object graphics scenes in
bitmap format. The bitmap file can then be edited in a graphics package,
but you won't be able to select and manipulate lines, axes, etc because
in bitmap format they're just a bunch of coloured pixels.

But what exactly is it that you're tyring to achieve?

--
Mark Hadfield "Kei puwaha te tai nei, Hoea tahi tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
Re: Poscript Component Selection [message #45515 is a reply to message #45514] Mon, 12 September 2005 21:47 Go to previous message
IDLmastertobe is currently offline  IDLmastertobe
Messages: 54
Registered: June 2004
Member
Thank you Dr.Fanning and Mike. It was really helpful and I think I can
select the components now. But as Mike pointed out, the image in my 3D
postscript file is a piece of while plane. It has no color. Is there any
way I can fix it? Thanks.
Re: Poscript Component Selection [message #45516 is a reply to message #45515] Mon, 12 September 2005 19:10 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
David Fanning wrote:
> OK, find this line in the DEMO_DRAW:
>
> oWindow->Draw, oView
>
> And after it, try this:
>
> clipboard = Obj_New("IDLgrClipboard", Dimensions=[4,3], Units=1, $
> Resolution=[2.54/300., 2.54/300.])
> clipboard->Draw, oView, Filename='myfile.eps', /PostScript, /Vector
> Obj_Destroy, clipboard
>
> But, I agree with Mark. I don't think it has much of a chance
> of actually working.

DEMO_DRAW is called by the D_VECTRACK widget every time the window is
refreshed, so the above works a little more often than required!

But it does work (I tried it). There are some effects missing in the
resulting plot (eg coloured texture map on one of the slices) and the
lettering is way to big (different Dimensions or Resolution settings for
the clipboard object might fix this).

Don't forget to remove or comment out the extra code and recompile after
you've finished!


--
Mark Hadfield "Kei puwaha te tai nei, Hoea tahi tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
Re: Poscript Component Selection [message #45517 is a reply to message #45516] Mon, 12 September 2005 18:38 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
IDLmastertobe writes:

> Thank you Dr.Fanning. I think the following code is the demo_draw module
> the previous programmer used. I think this is the one:
>
> http://funk.on.br/rguimara/RSI/IDL54/examples/demo/demosrc/d emo_draw.pro

Reading RSI-supplied code is always illuminating, in
an odd sort of way, isn't it? :-)

OK, find this line in the DEMO_DRAW:

oWindow->Draw, oView

And after it, try this:

clipboard = Obj_New("IDLgrClipboard", Dimensions=[4,3], Units=1, $
Resolution=[2.54/300., 2.54/300.])
clipboard->Draw, oView, Filename='myfile.eps', /PostScript, /Vector
Obj_Destroy, clipboard

But, I agree with Mark. I don't think it has much of a chance
of actually working.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Poscript Component Selection [message #45518 is a reply to message #45517] Mon, 12 September 2005 17:35 Go to previous message
IDLmastertobe is currently offline  IDLmastertobe
Messages: 54
Registered: June 2004
Member
Thank you Dr.Fanning. I think the following code is the demo_draw module
the previous programmer used. I think this is the one:

http://funk.on.br/rguimara/RSI/IDL54/examples/demo/demosrc/d emo_draw.pro

Thanks for your help.
Re: Poscript Component Selection [message #45519 is a reply to message #45518] Mon, 12 September 2005 17:34 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
David Fanning wrote:
> IDLmastertobe writes:
>> partial code:
>> sState.oVols[sState.iVrendVol]->SetProperty, $
>> HIDE=1-vol_rend
>> demo_draw, sState.oWindow, sState.oView, debug=sState.debug
>> sState.oVols[sState.iVrendVol]->SetProperty,HIDE=1
>> oImage = sState.oWindow->Read()
>> oImage->GetProperty,DATA=data
>> OBJ_DESTROY,oImage
>
> By the way, do you think we could have a peek at that
> DEMO_DRAW module? That's probably where you are going
> to have to solve this problem, although I have doubts
> that it *can* be solved, given the names of some of the
> variables in this code.

The above looks suspiciously like an excerpt from

<IDL_DIR>\examples\demo\demosrc\d_vectrack.pro

line 439-445 (in version 6.2). The original poster appears to be trying
to adapt some IDL demo code for his own purposes. Now this *sounds* like
a sensible thing to do but (as many of the newsgroup regulars can
attest) the code distributed with IDL is a whole Pandora's box of worms.

I imagine that if I spent 15 minutes or so I could fight my way into the
code, find the view object and draw it to a PS file in vector form. The
results, in terms of code, wouldn't be pretty. The results, in terms of
Postscript, may not be very pretty either, as the scene displayed by
d_vectrack is a 3D one using effects like shading that will not be
reproduced properly.

So, IDL mastertobe, before your or any of the rest of us put the effort
in, perhaps you could tell us more about what you're really trying to
do. Is this a learning exercise (in which case you might find a totally
different approach more fruitful)? Are you are trying to plot the
thunderstorm visualization displayed by d_vectrack, or have you changed
that too? Do you want a quick and dirty solution or something more
general and adaptable?




--
Mark Hadfield "Kei puwaha te tai nei, Hoea tahi tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
Re: Poscript Component Selection [message #45523 is a reply to message #45519] Mon, 12 September 2005 15:41 Go to previous message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
Your code will always produce PS images that look like JPEGs (i.e.
pixelated) rather than vectors. Let's look at some of the important
lines of your code.


Here, you're grabbing the image on the current window. The variable
data is simply a 2-dimensional array of the pixels in the window. What
you have are pixels of the image, not the individual components of the
image.

> oImage = sState.oWindow->Read()
> oImage->GetProperty,DATA=data

Setting im3d to data...

> im3d=data

Setting the output to PS...

> SET_PLOT, 'ps'

Now you're drawing the image pixels to the PostScript file. Because you
only have pixels at this point, that's all that's going to appear in the
file.

> TVSCL, im3d, TRUE=1

Closing out the PS...

> DEVICE, /CLOSE


So, what do you do about all of this? If you can get your hands on the
view object before it is drawn, you can use the IDLgrClipboard::Draw
method where you pass in the IDLgrView and specify to use VECTOR = 1 and
POSTSCRIPT = 1.

-Mike
Re: Poscript Component Selection [message #45524 is a reply to message #45523] Mon, 12 September 2005 15:38 Go to previous message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
> Oh, dear. Not exactly the "object graphics way", is it? :-(
>
> I'm sure Mike will be able to set you straight. :-)


Since when did I become Mr. Object Graphics Setter Straighter? :-)

-Mike
Re: Poscript Component Selection [message #45525 is a reply to message #45524] Mon, 12 September 2005 15:26 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
IDLmastertobe writes:

> partial code:
> sState.oVols[sState.iVrendVol]->SetProperty, $
> HIDE=1-vol_rend
> demo_draw, sState.oWindow, sState.oView, debug=sState.debug
> sState.oVols[sState.iVrendVol]->SetProperty,HIDE=1
> oImage = sState.oWindow->Read()
> oImage->GetProperty,DATA=data
> OBJ_DESTROY,oImage

By the way, do you think we could have a peek at that
DEMO_DRAW module? That's probably where you are going
to have to solve this problem, although I have doubts
that it *can* be solved, given the names of some of the
variables in this code.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Poscript Component Selection [message #45526 is a reply to message #45525] Mon, 12 September 2005 15:17 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
IDLmastertobe writes:

> partial code:
> sState.oVols[sState.iVrendVol]->SetProperty, $
> HIDE=1-vol_rend
> demo_draw, sState.oWindow, sState.oView, debug=sState.debug
> sState.oVols[sState.iVrendVol]->SetProperty,HIDE=1
> oImage = sState.oWindow->Read()
> oImage->GetProperty,DATA=data
> OBJ_DESTROY,oImage
>
> im3d=data
>
> !P.FONT=0
>
> ; Set the plotting device to PostScript:
> SET_PLOT, 'ps'
>
> LOADCT, 0
>
> ; Write the image to the file:
> ;TV, [[[r]], [[g]], [[b]]], TRUE=3
>
> TVSCL, im3d, TRUE=1
> ; Close the file:
> DEVICE, /CLOSE
> set_plot,'win'

Oh, dear. Not exactly the "object graphics way", is it? :-(

I'm sure Mike will be able to set you straight. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Poscript Component Selection [message #45527 is a reply to message #45526] Mon, 12 September 2005 14:58 Go to previous message
IDLmastertobe is currently offline  IDLmastertobe
Messages: 54
Registered: June 2004
Member
hi, sorry about the confusion. I don't know why the same post got posted
again. What I just typed was not lost.

Thanks Mike for your reply. Following is the postscript printing code I
used. Since I am continuing on someone else's code, as far as I
understood, the "owindow" variable is the IDL number of the graphic window
the 3D image is drawing on. The 3D image could be rotated as wished in the
window. The "oview" is an IDLgrView structure. From what I realized, the
output is already in a format of an image ("im3d" variable) even before it
was printed as a PS. please let me know if I need to post a more detailed
documentation of the code. Thank you very much for your time. I
appreciate your help.

partial code:
sState.oVols[sState.iVrendVol]->SetProperty, $
HIDE=1-vol_rend
demo_draw, sState.oWindow, sState.oView, debug=sState.debug
sState.oVols[sState.iVrendVol]->SetProperty,HIDE=1
oImage = sState.oWindow->Read()
oImage->GetProperty,DATA=data
OBJ_DESTROY,oImage

im3d=data

!P.FONT=0

; Set the plotting device to PostScript:
SET_PLOT, 'ps'

LOADCT, 0

; Write the image to the file:
;TV, [[[r]], [[g]], [[b]]], TRUE=3

TVSCL, im3d, TRUE=1
; Close the file:
DEVICE, /CLOSE
set_plot,'win'
Re: Poscript Component Selection [message #45528 is a reply to message #45527] Mon, 12 September 2005 14:51 Go to previous message
IDLmastertobe is currently offline  IDLmastertobe
Messages: 54
Registered: June 2004
Member
Thanks for your reply Mike. Below is a truncated version of my
printPostscript function. I found that even before I printed my
postscript, the data is already act as an image (the "im3d" variable in
the following code). Since I am continuing on an existing piece of code,
as far as I understand, the "owindow" is an IDL number for a graphic
window which the 3D image will be drawn on. The "oview" is an IDLgrView.
If it is not clear, I will try to post a more detailed documentation of the
code. Thanks for your time in helping me. I appreciate it.

partial code:

sState.oVols[sState.iVrendVol]->SetProperty, $
HIDE=1-vol_rend
demo_draw, sState.oWindow, sState.oView, debug=sState.debug
sState.oVols[sState.iVrendVol]->SetProperty,HIDE=1
oImage = sState.oWindow->Read()
oImage->GetProperty,DATA=data
OBJ_DESTROY,oImage

im3d=data

; Reconstruct the color table:
TVLCT, r,g,b, /GET

s = SIZE(image3D)

filename = file + name + '.ps'

!P.FONT=0

; Set the plotting device to PostScript:
SET_PLOT, 'ps'

LOADCT, 0

TVSCL, im3d, TRUE=1
; Close the file:
DEVICE, /CLOSE
set_plot,'win'

END
Re: Poscript Component Selection [message #45529 is a reply to message #45528] Mon, 12 September 2005 14:48 Go to previous message
IDLmastertobe is currently offline  IDLmastertobe
Messages: 54
Registered: June 2004
Member
Thanks for your reply Mike. Below is a truncated version of my
printPostscript function. I found that even before I printed my
postscript, the data is already act as an image (the "im3d" variable in
the following code). Since I am continuing on an existing piece of code,
as far as I understand, the "owindow" is an IDL number for a graphic
window which the 3D image will be drawn on. The "oview" is an IDLgrView.
If it is not clear, I will try to post a more detailed documentation of the
code. Thanks for your time in helping me. I appreciate it.

partial code:

sState.oVols[sState.iVrendVol]->SetProperty, $
HIDE=1-vol_rend
demo_draw, sState.oWindow, sState.oView, debug=sState.debug
sState.oVols[sState.iVrendVol]->SetProperty,HIDE=1
oImage = sState.oWindow->Read()
oImage->GetProperty,DATA=data
OBJ_DESTROY,oImage

im3d=data

; Reconstruct the color table:
TVLCT, r,g,b, /GET

s = SIZE(image3D)

filename = file + name + '.ps'

!P.FONT=0

; Set the plotting device to PostScript:
SET_PLOT, 'ps'

LOADCT, 0

TVSCL, im3d, TRUE=1
; Close the file:
DEVICE, /CLOSE
set_plot,'win'

END
Re: Poscript Component Selection [message #45530 is a reply to message #45529] Mon, 12 September 2005 14:18 Go to previous message
IDLmastertobe is currently offline  IDLmastertobe
Messages: 54
Registered: June 2004
Member
Hi everyone, my post might have been not detailed enough. Let me restate
it in a little more detail: I am able to save a 3D image in postscript
format, but I want to be
able to select the axis, labels.. each component individually in
illustrator and modify it. My postscript image so far only looks like a
jpeg image and I have no way to select all the component of the image.
Does anyone know what option I will need to set to have the postscript
image able to have its components modified at will in Illustrator?

Some helpers suggested to use the VECTOR keyword if I used IDLgrClipboard
in my implementation, however I used IDLgrModel and IDL_Container in my
implementation. How should I use the VECTOR keyword or related
functionalities to get each component of the postscript selected? Thank
you.
Re: Poscript Component Selection [message #45531 is a reply to message #45530] Mon, 12 September 2005 14:01 Go to previous message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
What is the specific command you use to create the PS?

-Mike
Re: Poscript Component Selection [message #45532 is a reply to message #45531] Mon, 12 September 2005 13:50 Go to previous message
IDLmastertobe is currently offline  IDLmastertobe
Messages: 54
Registered: June 2004
Member
Hi everyone, my post might have been not detailed enough. Let me restate
it in a little more detail: I am able to save a 3D image in postscript
format, but I want to be
able to select the axis, labels.. each component individually in
illustrator and modify it. My postscript image so far only looks like a
jpeg image and I have no way to select all the component of the image.
Does anyone know what option I will need to set to have the postscript
image able to have its components modified at will in Illustrator?

Some helpers suggested to use the VECTOR keyword if I used IDLgrClipboard
in my implementation, however I used IDLgrModel and IDL_Container in my
implementation. How should I use the VECTOR keyword or related
functionalities to get each component of the postscript selected? Thank
you.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: tvimage followed by contour in ps... positioning not coming out right
Next Topic: Re: Force Field

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

Current Time: Wed Oct 08 15:14:14 PDT 2025

Total time taken to generate the page: 0.00561 seconds