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

Home » Public Forums » archive » Re: rough lines in IDL graphic window
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: rough lines in IDL graphic window [message #46373] Tue, 15 November 2005 08:35
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Franco writes:

> yes the problem is resolution, and I've partially resolved it using
> your suggestion http://www.dfanning.com/graphics_tips/zfonts.html
> with the z-buffer.
>
> My code looks like this:
>
> thisDevice = !D.Name
> Set_Plot, 'Z'
> Device, Set_Resolution=[1200,1200]
> contour,u,x,y,levels=vals,/fill,c_colors=col,charsize=4.0,fo nt=1
> contour,v,x,y,nlevels=15,/noerase,c_thick=4,charsize=4.0,fon t=1
>
> snapshot = TVRD()
> Set_Plot, thisDevice
> window,1,xsize=300,ysize=300
> new= Rebin(snapshot, 300, 300)
> TV, new
> write_tiff, 'pl.tiff', reverse( new, 3 ), /append
>
> In grayscale it works simply great!!
> My problem now is with colors. If I load a color table, I make the
> following modification:
> snapshot = TVRD(true=1)
> Set_Plot, thisDevice
> window,1,xsize=300,ysize=300
> new= Rebin(snapshot, 3, 300, 300)
> TV, new, /true
> write_tiff, 'pl.tiff', reverse( new, 3 ), /append
>
> but now it doesn't work. It shows 3 small rough pictures.
> Unfurtunately I have not a lot of experience with the z-buffer
> and colors. Is there a simple solution?
> I'm using IDL 6.1 on a Mac Powerbook G4.

I don't answer questions about Macs. Who knows what is happening!?

No, just kidding.

The reason you are using the Z-buffer is to get away from
having to resize a 24-bit image, which will implement all sorts
of complications in your life. So that whole TVRD(TRUE=1) thing
concerns me.

I don't have time to try this (I'm teaching a class today),
but I would do the output and resizing in the Z-buffer as normal,
then I would load a color table (one that presumably resembles
the gray-scale table in its smoothness). Get those color vectors,
and run my re-sized snapshot through those vectors to produce
my 24-bit image for the TIFF file:

thisDevice = !D.Name
Set_Plot, 'Z'
Device, Set_Resolution=[1200,1200]
contour,u,x,y,levels=vals,/fill,c_colors=col,charsize=4.0,fo nt=1
contour,v,x,y,nlevels=15,/noerase,c_thick=4,charsize=4.0,fon t=1
new= Rebin(snapshot, 300, 300)
Set_Plot, thisDevice

LoadCT, 22
TVLCT, r, g, b, /Get
image24 = [ [[r[new]]], [[g[new]]], [[b[new]]] ]
write_tiff, 'pl.tiff', reverse( image24, 2 ), /append


Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: rough lines in IDL graphic window [message #46378 is a reply to message #46373] Tue, 15 November 2005 04:20 Go to previous message
franco is currently offline  franco
Messages: 3
Registered: November 2005
Junior Member
David Fanning wrote:
> Well, clearly the "problem" is resolution. You could try
> smoothing the data before you contour it on your display.

David,
yes the problem is resolution, and I've partially resolved it using
your suggestion http://www.dfanning.com/graphics_tips/zfonts.html
with the z-buffer.

My code looks like this:

thisDevice = !D.Name
Set_Plot, 'Z'
Device, Set_Resolution=[1200,1200]
contour,u,x,y,levels=vals,/fill,c_colors=col,charsize=4.0,fo nt=1
contour,v,x,y,nlevels=15,/noerase,c_thick=4,charsize=4.0,fon t=1

snapshot = TVRD()
Set_Plot, thisDevice
window,1,xsize=300,ysize=300
new= Rebin(snapshot, 300, 300)
TV, new
write_tiff, 'pl.tiff', reverse( new, 3 ), /append

In grayscale it works simply great!!
My problem now is with colors. If I load a color table, I make the
following modification:
snapshot = TVRD(true=1)
Set_Plot, thisDevice
window,1,xsize=300,ysize=300
new= Rebin(snapshot, 3, 300, 300)
TV, new, /true
write_tiff, 'pl.tiff', reverse( new, 3 ), /append

but now it doesn't work. It shows 3 small rough pictures.
Unfurtunately I have not a lot of experience with the z-buffer
and colors. Is there a simple solution?
I'm using IDL 6.1 on a Mac Powerbook G4.

Thank you.
Franco


> Or, you could even try resizing your data set before you
> contour it on your display. Be sure to set the /INTERP
> keyword on CONGRID, or this won't help.
>
> In either case, you are changing the data, of course, so
> you have to decide if aesthetic concerns are more important
> than scientific concerns. :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: rough lines in IDL graphic window [message #46390 is a reply to message #46378] Mon, 14 November 2005 14:40 Go to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
The problem you describe is called aliasing, a common problem in
computer graphics:

http://en.wikipedia.org/wiki/Aliasing


Techniques for minimizing aliasing are called anti-aliasing:

http://en.wikipedia.org/wiki/Anti-aliasing


A simple approach to anti-aliasing is to to create a very large image,
say 4 times your desired size and then use REBIN or CONGRID to shrink
your image back to your desired size. I posted regarding this a while back:

http://tinyurl.com/8dxaq

The code at the bottom of that post could be integrated into your
program which dumps the images to disk.

-Rick


arctorit@yahoo.com wrote:
> Dear all,
> I have a 2D field of which I make contour lines. On the graphic window
> this contour lines
> appear quite rough, i.e. they seem to be formed by small rods one after
> the other.
> When I print this to a PS file, the lines become magically smooth and
> very nice to look at.
>
> Usually I don't care that much about this problem, but as now I would
> like to do a movie,
> starting from graphic window dumps, I would like to have the same
> smooth lines also
> in the graphic window.
>
> If someone can resolve this puzzle.................
>
> Thank you all.
> Franco.
>
Re: rough lines in IDL graphic window [message #46391 is a reply to message #46390] Mon, 14 November 2005 10:47 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
arctorit@yahoo.com writes:

> I have a 2D field of which I make contour lines. On the graphic window
> this contour lines
> appear quite rough, i.e. they seem to be formed by small rods one after
> the other.
> When I print this to a PS file, the lines become magically smooth and
> very nice to look at.
>
> Usually I don't care that much about this problem, but as now I would
> like to do a movie,
> starting from graphic window dumps, I would like to have the same
> smooth lines also
> in the graphic window.
>
> If someone can resolve this puzzle.................

Well, clearly the "problem" is resolution. You could try
smoothing the data before you contour it on your display.
Or, you could even try resizing your data set before you
contour it on your display. Be sure to set the /INTERP
keyword on CONGRID, or this won't help.

In either case, you are changing the data, of course, so
you have to decide if aesthetic concerns are more important
than scientific concerns. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: One More Mac Question
Next Topic: widget ?

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

Current Time: Fri Oct 10 02:00:13 PDT 2025

Total time taken to generate the page: 0.40558 seconds