help with saving jpeg forms in loops [message #90902] |
Mon, 11 May 2015 10:38  |
g.nacarts
Messages: 148 Registered: November 2013
|
Senior Member |
|
|
Hi
I have an Array=[120]. I wanted to store my images in a jpeg form so I typed the following code.
Array = ArrayNew(ArrayOLD, S, time)
for i=0L,Nt-1 do begin
images_JPEG, REFORM(Array[i,*,*]),('(2,'+string(i,format='(i3.3)')+').jpe g')
endfor
Now I added one more loop which is looping over the trials. When I typed the following it's overwritten in each trial (I expected that).
for trial=1L, 3 do begin
Array = ArrayNew(ArrayOLD, S, time)
for i=0L,Nt-1 do begin
images_JPEG, REFORM(Array[i,*,*]),('(2,'+string(i,format='(i3.3)')+').jpe g')
endfor
endfor
I tried few things but I couldn't manage to store my images in each trial (3 trials) for each time point (120).
Can anyone please help with that?
|
|
|
Re: help with saving jpeg forms in loops [message #90906 is a reply to message #90902] |
Tue, 12 May 2015 01:33   |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Monday, May 11, 2015 at 7:38:23 PM UTC+2, g.na...@gmail.com wrote:
> Hi
>
> I have an Array=[120]. I wanted to store my images in a jpeg form so I typed the following code.
>
> Array = ArrayNew(ArrayOLD, S, time)
> for i=0L,Nt-1 do begin
> images_JPEG, REFORM(Array[i,*,*]),('(2,'+string(i,format='(i3.3)')+').jpe g')
> endfor
>
> Now I added one more loop which is looping over the trials. When I typed the following it's overwritten in each trial (I expected that).
>
> for trial=1L, 3 do begin
> Array = ArrayNew(ArrayOLD, S, time)
> for i=0L,Nt-1 do begin
> images_JPEG, REFORM(Array[i,*,*]),('(2,'+string(i,format='(i3.3)')+').jpe g')
> endfor
> endfor
>
> I tried few things but I couldn't manage to store my images in each trial (3 trials) for each time point (120).
>
> Can anyone please help with that?
Hi,
I don't know what images_JPEG is doing with the input file name. In your case, what appears to be a file name starts with a parenthesis "(". So I cannot say much, other than that if you want to have filename number and trial number in one string you could use this:
outputFileName = 'myOutputFile_trial_'+strtrim(trial,2)+'_number_'+strtrim(i, 2)+'.jpg'
You can improve the look of this using format in the string function...
But first you have to figure out what images_JPEG does with your input.
cheers,
Helder
|
|
|
|