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

Home » Public Forums » archive » Animation
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
Animation [message #9821] Tue, 19 August 1997 00:00 Go to next message
Neil Winrow is currently offline  Neil Winrow
Messages: 18
Registered: July 1997
Junior Member
Can anyone give me any advice?
I am trying to Animate a set of surface plots. Each surface plot
represents the output from a data file. The set of plots represent flux
at different photon energy, and my boss would like a small animation as
the photon energies increase. I can read each of the data files into the
program to display individally, but how can I animate the sequence,
using the XINTERANIMATE etc. Any advice would be greatly appreicated.

Many Thanks

Neil
Re: animation [message #40601 is a reply to message #9821] Mon, 23 August 2004 10:38 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Mary T writes:

> I would like to animage the images that I get as an output in IDL
> windows. I saw an example in "IDL programming techniques" by Dr.
> Fanning (2 edition,page 105). However, from my understanding, this
> example is for images that are in a database called "head". My
> question is...how can I modify it, so that the images that I have in
> the output windows, be included in this code? I guess I have to save
> these output images first...in what format showld I do this?

It occurs to me that I could be more helpful. :-)

Where do the images you want to animate exist
at the time you want to animate them? Are they
in memory as variables? Did you display then someplace?
Are they in individual display windows? Or are all the
images in one window? How did you put them in the window?

If you have to copy them from some other display window
to the animation window, then the "DEVICE COPY"
technique is probably what you want to use.

None of this *has* to be done in a FOR loop, of course,
it is just easier this way. For example, if you wanted
to animate five images, and they were already displayed
in windows 1, 4, 10, 38 and 52 and these windows were
all the same size as your animation window (say 400 by 500),
then you could do this:

XInterAnimate, Set=[400,500,5],/Showload
XInteranimate,Frame=0,Window=1
XInteranimate,Frame=1,Window=4
XInteranimate,Frame=2,Window=10
XInteranimate,Frame=3,Window=38
XInteranimate,Frame=4,Window=52
XInteranimate,50

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: animation [message #40602 is a reply to message #9821] Mon, 23 August 2004 10:23 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Mary T writes:

> I would like to animage the images that I get as an output in IDL
> windows. I saw an example in "IDL programming techniques" by Dr.
> Fanning (2 edition,page 105). However, from my understanding, this
> example is for images that are in a database called "head". My
> question is...how can I modify it, so that the images that I have in
> the output windows, be included in this code? I guess I have to save
> these output images first...in what format showld I do this?
>
> Kind regards,
> Mary
>
>
>
> XInterAnimate, Set=[800,800,50],/Showload
> yellow=GetColor('yellow',!D.Table_Size-2)
> LoadCT,3,Ncolors=!D.Table_Size-2
> For j=0,50 DO BEGIN
> TVImage, BytScl(head[*,*,j],Top=!D.Table_Size-3)
> XYOuts,0.1,0.1,/Normal,StrTrim(j,2),Color=yellow
> XInteranimate,Frame=j,Window=!D.Window
> ENDFOR
> XInteranimate,50
> end

In the FOR loop above, take out the TVIMAGE command
and substitute whatever command or commands you use
to put something into the display window. Whatever
you put into the window will be animated.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: animation [message #40653 is a reply to message #9821] Wed, 25 August 2004 10:28 Go to previous messageGo to next message
mary2747102 is currently offline  mary2747102
Messages: 8
Registered: August 2004
Junior Member
Hi Dr. Fanning,
I followed the advice you gave to Neil Winrow to do a loop for the
animation.
It looked useful for me, but an error message appears on the first
line:

"% Variable is undefined: SET.
% Execution halted at: $MAIN$
3 C:\Documents and Settings\MaryT\Desktop\animation\ag25_animation.pro"

Can you let me know what is wrong with it, because I really do not
know. I have four files to animate, and I want the size of the images
to be 80x80.
THank you again,
MaryT
-----------------------------------------------
; Set up XInterAnimate

XInteranimate, Set[80, 80, 4], /Showload

; Open the data sets. Put flow3 vector plots in the
; XInterAnimate window and take a snap-shot of them.

FOR j=0,3 DO BEGIN
filename = 'Iteration' + StrTrim(j,2) + '.out'
OpenR, lun, filename, /Get_Lun
A = FltArr(7,49L*49L*5L)
ReadF, lun, A
Free_Lun, lun

;create 3 dimensional arrays to hold vector data.
;the indices will be Velocity(x,y,z)

Vx=fltarr(49L,49L,5L)
Vy=fltarr(49L,49L,5L)
Vz=fltarr(49L,49L,5L)
R=fltarr(49L,49L,5L)

For i = 0L, 12004L Do Begin

Vx(A(0,i)-1,A(1,i)-1,A(2,i)-1) = A(3,i)
Vy(A(0,i)-1,A(1,i)-1,A(2,i)-1) = A(4,i)
Vz(A(0,i)-1,A(1,i)-1,A(2,i)-1) = A(5,i)
R(A(0,i)-1,A(1,i)-1,A(2,i)-1) = A(6,i)

Endfor

Scale3, xr=[Min(Vx), Max(Vx)], $
yr=[Min(Vy), Max(Vy)], $
zr=[Min(Vz), Max(Vz)], $
AX=50, AZ=50

posx=A[*,0]
posy=A[*,1]
posz=A[*,2]

Flow3, Vx, Vy, Vz,$
SX=posx,SY=posy,SZ=posz, $
ARROWSIZE=.0100

;plots a cubical shape, vectors should appear inside this cube

PLOTS, [0,50], [0,0], [0,0], /T3D,color=200,line=9
PLOTS, [0,0], [0,50], [0,0], /T3D,color=200,line=9
PLOTS, [0,0], [0,0], [0,32], /T3D,color=200
PLOTS, [0,50], [0,0], [32,32], /T3D,color=200
PLOTS, [0,50], [50,50], [32,32], /T3D,color=200
PLOTS, [0,0], [50,50], [32,0], /T3D,color=200
PLOTS, [50,50], [50,0], [0,0], /T3D,color=200
PLOTS, [50,0], [50,50], [0,0], /T3D,color=200
PLOTS, [50,50], [50,50], [0,32], /T3D,color=200
PLOTS, [50,50], [0,0], [32,0], /T3D,color=200
PLOTS, [50,50], [50,0], [32,32], /T3D,color=200
PLOTS, [50,50], [50,0], [32,32], /T3D,color=200
PLOTS, [0,0], [0,50], [32,32], /T3D,color=200

Xinteranimate,Frame=j,window=!D.Window

Endfor

Xinteranimate

End
Re: animation [message #40660 is a reply to message #9821] Wed, 25 August 2004 08:49 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Mary T writes:

> Hello, I just have one comment....
>
> If I use your suggestion:
> Scale3, xr=[Min(Vx), Max(Vx)], $
> yr=[Min(Vy), Max(Vy)], $
> zr=[Min(Vz), Max(Vz)], $
> AX=50, AZ=50
> My output window will only show a piece of the whole data.
> On the other hand using the geographic coordinate system shows it all.
> I was wondering why did you think that was going to be more fruitful?

Because you told me the program "does not run at all".
I presume this meant you couldn't see anything.

> Should I change something else besides this?

I would just keep doing whatever it is you are doing. :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: animation [message #40661 is a reply to message #9821] Wed, 25 August 2004 08:43 Go to previous messageGo to next message
mary2747102 is currently offline  mary2747102
Messages: 8
Registered: August 2004
Junior Member
Hello, I just have one comment....

If I use your suggestion:
Scale3, xr=[Min(Vx), Max(Vx)], $
yr=[Min(Vy), Max(Vy)], $
zr=[Min(Vz), Max(Vz)], $
AX=50, AZ=50
My output window will only show a piece of the whole data.
On the other hand using the geographic coordinate system shows it all.
I was wondering why did you think that was going to be more fruitful?
Should I change something else besides this?
Kind Regards,
Mary T.
Re: animation [message #40690 is a reply to message #9821] Mon, 23 August 2004 19:13 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Mary T writes:

> I have more questions for you, if you don't mind...
>
> 1. I think I will need the loop to get the output images and insert
> them in the animation. The output images are produced from the flow3
> procedure.

Sigh...

Take the first XInteranimate command and put it *before*
the loop. And make the number of frames equal to the
number of files you have:

XInterAnimate, Set=[400,500,numFiles],/Showload

Take the last XInteranimate command and put it *after*
the loop.

Leave the middle XInteranimate command where it is.

Now you will be able to animate your output, whatever
it is. :-)

> Here is the code that I have been writting, but I don't know why it
> does not run at all, and it also does not show any error message.
> (note:I have the flow3.pro, the data files and my code in the same
> folder.)

I think we have covered this ground before. We are mostly
out of ideas here. But I *would* try setting up your 3D coordinate
system on the basis of the data values themselves, and not
the number of dimensions of the data arrays. I think that will be
more fruitful. :-)

Scale3, xr=[Min(Vx), Max(Vx)], $
yr=[Min(Vy), Max(Vy)], $
zr=[Min(Vz), Max(Vz)], $
AX=50, AZ=50

> 2. I would love to have an output window as the result that show in
> one of your procedures: fsc_surface. Meaning, that I could be able to
> rotate and zoom in the image. However, this is not a surface! Do you
> have any procedure that could do this for my images? This will be
> nicer than drawing a 3-D cube by myself. I tried the zoom command but
> it does not look nice either. And I tried the rotate keywords, but I
> have to change them every time and sort of guessing the angles....

Then you will have to re-write this program, which uses
commands that work in the *direct* graphics system, with
commands that work in the *object* graphics system. The
two systems are completely incompatible. I think, quite
honestly, you are quite far away from being able to write
an object graphics program. I think I would try to get
something working in direct graphics first. There will be
plenty of time to learn object graphics after you gain some
experience. :-)

Cheers,

David


Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: animation [message #40693 is a reply to message #40601] Mon, 23 August 2004 17:16 Go to previous messageGo to next message
mary2747102 is currently offline  mary2747102
Messages: 8
Registered: August 2004
Junior Member
Wow! Thank you very much...by the way...I have found your book as a
very nice tool to learn!

I have more questions for you, if you don't mind...

1. I think I will need the loop to get the output images and insert
them in the animation. The output images are produced from the flow3
procedure.
Here is the code that I have been writting, but I don't know why it
does not run at all, and it also does not show any error message.
(note:I have the flow3.pro, the data files and my code in the same
folder.)

2. I would love to have an output window as the result that show in
one of your procedures: fsc_surface. Meaning, that I could be able to
rotate and zoom in the image. However, this is not a surface! Do you
have any procedure that could do this for my images? This will be
nicer than drawing a 3-D cube by myself. I tried the zoom command but
it does not look nice either. And I tried the rotate keywords, but I
have to change them every time and sort of guessing the angles....

This message was long! Sorry for the inconvenience, and I thank you
very much in advance if you can give me some advice, expert!


Kind regards,
Mary T.

;there are several files that contain velocity results at different
number of iterations. The purpose of the animation is to show how the
vectors look at different number of iterations:

Filename=Dialog_Pickfile(filter='*.out',/read,/multiple)

For j=0,numFiles-1 DO BEGIN
openR,lun,Files[j],/Get_Lun
A=fltarr(7,49L*49L*5L) ;create arrays to hold data in files
ReadU,lun,data
Free_Lun,lun

;create 3 dimensional arrays to hold vector data.
;the indices will be Velocity(x,y,z)

U=fltarr(49L,49L,5L)
V=fltarr(49L,49L,5L)
W=fltarr(49L,49L,5L)


For i = 0L, 12004L Do Begin


U(A(0,i)-1,A(1,i)-1,A(2,i)-1) = A(3,i)

V(A(0,i)-1,A(1,i)-1,A(2,i)-1) = A(4,i)

W(A(0,i)-1,A(1,i)-1,A(2,i)-1) = A(5,i)


Endfor

window,j,XSIZE=400, YSIZE=500, TITLE='IDLgrWindow[j]'


Scale3, xr=[0,50],yr=[0,50],zr=[50,0],AX=50, AZ=50
Flow3, Vx, Vy, Vz,$
SX=posx,SY=posy,SZ=posz, $
ARROWSIZE=.0100

;plots a cubical shape, vectors should appear inside this cube

PLOTS, [0,50], [0,0], [0,0], /T3D,color=200,line=9
PLOTS, [0,0], [0,50], [0,0], /T3D,color=200,line=9
PLOTS, [0,0], [0,0], [0,32], /T3D,color=200
PLOTS, [0,50], [0,0], [32,32], /T3D,color=200
PLOTS, [0,50], [50,50], [32,32], /T3D,color=200
PLOTS, [0,0], [50,50], [32,0], /T3D,color=200
PLOTS, [50,50], [50,0], [0,0], /T3D,color=200
PLOTS, [50,0], [50,50], [0,0], /T3D,color=200
PLOTS, [50,50], [50,50], [0,32], /T3D,color=200
PLOTS, [50,50], [0,0], [32,0], /T3D,color=200
PLOTS, [50,50], [50,0], [32,32], /T3D,color=200
PLOTS, [50,50], [50,0], [32,32], /T3D,color=200
PLOTS, [0,0], [0,50], [32,32], /T3D,color=200



XInterAnimate, Set=[400,500,3],/Showload
XInteranimate,Frame=j,Window=j
XInteranimate,50

Endfor
End
Re: animation [message #40800 is a reply to message #40653] Wed, 25 August 2004 11:24 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Mary T writes:

> I followed the advice you gave to Neil Winrow to do a loop for the
> animation.
> It looked useful for me, but an error message appears on the first
> line:
>
> "% Variable is undefined: SET.
> % Execution halted at: $MAIN$
> 3 C:\Documents and Settings\MaryT\Desktop\animation\ag25_animation.pro"
>
> Can you let me know what is wrong with it, because I really do not
> know.
> -----------------------------------------------
> ; Set up XInterAnimate
>
> XInteranimate, Set[80, 80, 4], /Showload

Try, "XInteranimate, Set=[80, 80, 4], /Showload".

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: Bug with object graphics, app_scroll and the mouse in 6.1 under Windows.
Next Topic: xinteranimate with PLOTS and FLOW3 output

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

Current Time: Wed Oct 08 18:41:19 PDT 2025

Total time taken to generate the page: 0.00611 seconds