Saving Virtual Stack as .avi causes Exception

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Saving Virtual Stack as .avi causes Exception

Ingo Bartholomaeus
Dear all,

I get error messages upon attempting to save virtual stacks as .avi files. Furthermore, ImageJ already started to write the file when the exception occurs, what irretrievably damages the source file, if you had decided to overwrite it.

This is the error message:

#################

java.lang.RuntimeException: An error occurred reading the file.

Frame ended prematurely after 2052 bytes
                at ij.plugin.AVI_Reader.getProcessor(AVI_Reader.java:304)
                at ij.plugin.filter.AVI_Writer.writeImage(AVI_Writer.java:278)
                at ij.plugin.filter.AVI_Writer.run(AVI_Writer.java:72)
                at ij.plugin.filter.PlugInFilterRunner.processOneImage(PlugInFilterRunner.java:247)
                at ij.plugin.filter.PlugInFilterRunner.<init>(PlugInFilterRunner.java:102)
                at ij.IJ.runPlugIn(IJ.java:155)
                at ij.Executer.runCommand(Executer.java:122)
                at ij.Executer.run(Executer.java:59)
                at java.lang.Thread.run(Thread.java:619)

#################

The error occurred with Java Versions: 1.6.0_10 (32-bit) and 1.6.0_12 (64-bit) and with ImageJ 1.43Lx and also with older versions. OS were Windows XP 64bit SP2 and XP 32bit SP3

Best regards,
Ingo
Reply | Threaded
Open this post in threaded view
|

Re: Saving Virtual Stack as .avi causes Exception

Ingo Bartholomaeus
My previous posting was a little misleading: The error ONLY occurred if I try to overwrite the source file. This however is not really surprising as the data type is "virtual stack". But it would be better if ImageJ did not damage the source file, but instead converts the virtual to a normal stack upon saving, in case the user wants to overwrite the source file.

Ingo


-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Ingo Bartholomaeus
Sent: Freitag, 20. November 2009 11:57
To: [hidden email]
Subject: Saving Virtual Stack as .avi causes Exception

Dear all,

I get error messages upon attempting to save virtual stacks as .avi files. Furthermore, ImageJ already started to write the file when the exception occurs, what irretrievably damages the source file, if you had decided to overwrite it.

This is the error message:

#################

java.lang.RuntimeException: An error occurred reading the file.

Frame ended prematurely after 2052 bytes
                at ij.plugin.AVI_Reader.getProcessor(AVI_Reader.java:304)
                at ij.plugin.filter.AVI_Writer.writeImage(AVI_Writer.java:278)
                at ij.plugin.filter.AVI_Writer.run(AVI_Writer.java:72)
                at ij.plugin.filter.PlugInFilterRunner.processOneImage(PlugInFilterRunner.java:247)
                at ij.plugin.filter.PlugInFilterRunner.<init>(PlugInFilterRunner.java:102)
                at ij.IJ.runPlugIn(IJ.java:155)
                at ij.Executer.runCommand(Executer.java:122)
                at ij.Executer.run(Executer.java:59)
                at java.lang.Thread.run(Thread.java:619)

#################

The error occurred with Java Versions: 1.6.0_10 (32-bit) and 1.6.0_12 (64-bit) and with ImageJ 1.43Lx and also with older versions. OS were Windows XP 64bit SP2 and XP 32bit SP3

Best regards,
Ingo
Reply | Threaded
Open this post in threaded view
|

Re: Saving Virtual Stack as .avi causes Exception

dscho
Dear Ingo,

On Fri, 20 Nov 2009, Ingo Bartholomaeus wrote:

> My previous posting was a little misleading: The error ONLY occurred if
> I try to overwrite the source file. This however is not really
> surprising as the data type is "virtual stack". But it would be better
> if ImageJ did not damage the source file, but instead converts the
> virtual to a normal stack upon saving, in case the user wants to
> overwrite the source file.

Ah, that explains the error.  You are changing the data of a virtual stack
behind its back.

Now, I would like to convince you that converting a virtual to a normal
stack upon saving is not a good idea.  Imagine a real-life scenario here:
a .avi file which is 4.2G in size, so that you cannot possibly open it on
a 32-bit Windows computer, except as a virtual stack.  So what you propose
would just throw an out-of-memory error.

And now I would like to convince you that it is not a good idea to
overwrite the original file to begin with: it is always possible that you
run out of quota, or that there is a write error which ImageJ cannot
recover from, and in those cases, you would have lost your original data
anyway, without any way for ImageJ to prevent that.

So I would like to suggest that you save to a new name and only after that
was successful, delete the original file and rename the new file.  It is
even possible to do that in a simple macro.

Ciao,
Johannes
Reply | Threaded
Open this post in threaded view
|

Re: Saving Virtual Stack as .avi causes Exception

Wayne Rasband
In reply to this post by Ingo Bartholomaeus
This bug is fixed in the 1.43i11 daily build. The AVI Writer displays  
an error message if you attempt to overwrite a virtual stack.

-wayne

 > My previous posting was a little misleading: The error ONLY
 > occurred if I try to overwrite the source file. This
 > however is not really surprising as the data type is
 > "virtual stack". But it would be better if ImageJ did not
 > damage the source file, but instead converts the virtual to
 > a normal stack upon saving, in case the user wants to
 > overwrite the source file.
 >
 > Ingo
 >
 >> Dear all,
 >>
 >> I get error messages upon attempting to save virtual stacks
 >> as .avi files. Furthermore, ImageJ already started to write
 >> the file when the exception occurs, what irretrievably
 >> damages the source file, if you had decided to overwrite it.
 >>
 >> This is the error message:
 >>
 >> #################
 >>
 >> java.lang.RuntimeException: An error occurred reading the file.
 >>
 >> Frame ended prematurely after 2052 bytes
  >>    at ij.plugin.AVI_Reader.getProcessor(AVI_Reader.java:304)
  >>    at ij.plugin.filter.AVI_Writer.writeImage(AVI_Writer.java:278)
 >>     at ij.plugin.filter.AVI_Writer.run(AVI_Writer.java:72)
 >>     at  
ij.plugin.filter.PlugInFilterRunner.processOneImage(PlugInFilterRunner.j
ava:247)
 >>     at  
ij.plugin.filter.PlugInFilterRunner.<init>(PlugInFilterRunner.java:102)
 >>     at ij.IJ.runPlugIn(IJ.java:155)
 >>     at ij.Executer.runCommand(Executer.java:122)
 >>     at ij.Executer.run(Executer.java:59)
 >>     at java.lang.Thread.run(Thread.java:619)
 >>
 >> #################
 >>
 >> The error occurred with Java Versions: 1.6.0_10 (32-bit)
 >> and 1.6.0_12 (64-bit) and with ImageJ 1.43Lx and also with
 >> older versions. OS were Windows XP 64bit SP2 and XP 32bit
 >> SP3
 >>
 >> Best regards,
 >> Ingo
Reply | Threaded
Open this post in threaded view
|

Re: Saving Virtual Stack as .avi causes Exception

Ingo Bartholomaeus
Thank you Wayne!! Seems to be foolproof now...

Ingo

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Wayne Rasband
Sent: Freitag, 20. November 2009 16:38
To: [hidden email]
Subject: Re: Saving Virtual Stack as .avi causes Exception

This bug is fixed in the 1.43i11 daily build. The AVI Writer displays  
an error message if you attempt to overwrite a virtual stack.

-wayne

 > My previous posting was a little misleading: The error ONLY
 > occurred if I try to overwrite the source file. This
 > however is not really surprising as the data type is
 > "virtual stack". But it would be better if ImageJ did not
 > damage the source file, but instead converts the virtual to
 > a normal stack upon saving, in case the user wants to
 > overwrite the source file.
 >
 > Ingo
 >
 >> Dear all,
 >>
 >> I get error messages upon attempting to save virtual stacks
 >> as .avi files. Furthermore, ImageJ already started to write
 >> the file when the exception occurs, what irretrievably
 >> damages the source file, if you had decided to overwrite it.
 >>
 >> This is the error message:
 >>
 >> #################
 >>
 >> java.lang.RuntimeException: An error occurred reading the file.
 >>
 >> Frame ended prematurely after 2052 bytes
  >>    at ij.plugin.AVI_Reader.getProcessor(AVI_Reader.java:304)
  >>    at ij.plugin.filter.AVI_Writer.writeImage(AVI_Writer.java:278)
 >>     at ij.plugin.filter.AVI_Writer.run(AVI_Writer.java:72)
 >>     at  
ij.plugin.filter.PlugInFilterRunner.processOneImage(PlugInFilterRunner.j
ava:247)
 >>     at  
ij.plugin.filter.PlugInFilterRunner.<init>(PlugInFilterRunner.java:102)
 >>     at ij.IJ.runPlugIn(IJ.java:155)
 >>     at ij.Executer.runCommand(Executer.java:122)
 >>     at ij.Executer.run(Executer.java:59)
 >>     at java.lang.Thread.run(Thread.java:619)
 >>
 >> #################
 >>
 >> The error occurred with Java Versions: 1.6.0_10 (32-bit)
 >> and 1.6.0_12 (64-bit) and with ImageJ 1.43Lx and also with
 >> older versions. OS were Windows XP 64bit SP2 and XP 32bit
 >> SP3
 >>
 >> Best regards,
 >> Ingo