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

Home » Public Forums » archive » help with cgDrawVectors in write_gif procedure
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: help with cgDrawVectors in write_gif procedure [message #91102 is a reply to message #91101] Wed, 03 June 2015 09:33 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Helder writes:

>
> On Wednesday, June 3, 2015 at 5:39:15 PM UTC+2, g.na...@gmail.com wrote:
>>> "OPENW: Filename argument must be a scalar string: FILE."
>>> you should check if your variable file is a string or a scalar.
>>
>> I used
>> help, file
>> to check whether is a string or a scalar and I got the following
>>
>> FILE UNDEFINED = <Undefined>
>> OPENW: Filename argument must be a scalar string: FILE.
>>
>> I will share my code because maybe I did a mistake somewhere else and I am not able to find it. I have the following procedure. (Image,VX,VY are 3D arrays.)
>>
>>
>> PRO vectors_overlaid, Image, VX, VY, name
>>
>> dims_i_need = Size(Dindgen(20,20), /Dimensions)
>>
>> pos_x = Rebin(Findgen(dims_i_need[0]), dims_i_need[0], dims_i_need[1])
>> pos_y = Rebin(Reform(Findgen(dims_i_need[1]), 1, dims_i_need[1]), dims_i_need[0], dims_i_need[1])
>>
>> for i=0L, n-1 do begin
>> cgDisplay, 500, 550
>> Image = BYTSCL(Image, min=0.,max=160.)
>> cgimage,Reform(Image[i,*,*])
>> cgDrawVectors, REFORM(VX[i,*,*]), REFORM(VY[i,*,*]), pos_x, pos_y,VECCOLORS='yellow', /ORDERED, overplot = 1
>> write_gif,file, Reform(Image[i,*,*]), /multiple
>> endfor
>>
>> write_gif, file, /close
>> END
>>
>> Then I called the vectors_overlaid in my main program like this
>>
>> vectors_overlaid, Image, VX,VY, 'C:\Users\Desktop\Vectors('+string(i,format='(i3.3)')+','+st ring(level)+','+strtrim(iter)+')'.gif'
>>
>> Why the file is undefined?
>
> Ok, this is something you should be able to solve by looking at what the error messages tell you and what the help, file told you (file is undefined!).
>
> In your procedure declaration you use:
> PRO vectors_overlaid, Image, VX, VY, name
>
> These variable names have to be used in the procedure. This means that when you call:
> vectors_overlaid, Image, VX,VY, 'C:\Users\Desktop\Vectors('+string(i,format='(i3.3)')+','+st ring(level)+','+strtrim(iter)+')'.gif'
>
> the variable "name" assumes the value 'C:\Users\Desktop\Vectors('+string(i,format='(i3.3)')+','+st ring(level)+','+strtrim(iter)+')'.gif'
>
> so in *all* your write_gif commands you should substitute "file" with "name".
>
> That should bring you a step further.

It should, but it still feels like an unfathomable long way to the
finish line.

Since the images you want to animate already exist in individual files,
if you insist on doing this completely in IDL (not my recommendation),
you should think about opening each file in succession, reading the
image data, and storing that in a new, multiple frame GIF file.

That should be a simple, concise loop to write. The algorithm looks like
this:

1. Open a GIF file, set up for multiple images.
2. Start a loop.
a. Read the image from one of the image files.
b. Store the image in the open GIF file as a "frame"
3. End the loop.
4. Close the open GIF file.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Vertical text orientation?
Next Topic: Pure IDL interface for video cameras -- linux only

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

Current Time: Wed Oct 08 17:33:50 PDT 2025

Total time taken to generate the page: 0.00403 seconds