Posted by
Albert Cardona on
Apr 15, 2008; 11:53am
URL: http://imagej.273.s1.nabble.com/a-tutorial-on-a-custom-image-format-file-reader-writer-tp3696492p3696504.html
Hi Francis,
> "The problem is that somehow in macro headless mode (no gui) opening and
> saving occur in other threads. This means that the LSM_Reader is not
> finished opening the image that the macro already tries to save the files.
> The results are sometimes weird.
I had this problem very often. The core problem is that ImageJ is
multithreaded where you wouldn't want it to be: the I/O routines. Not
only images may be attempted to be written to disk before they have
finished opening, but also the image to save may not be the one you
expect/want, because the writer plugin will take the current image,
which changes as other images are opened.
I have addressed the problem for image writers by adding a static method
to all format writers included within ij.plugin package, which bypasses
the need to instantiate a new PlugIn in a new Thread, and made a
convenient wrapper method within in the ij.io.Writer class. Changes will
be available soon as part of the fiji package -a new ImageJ
distribution, to be released around May 1st.
Albert
--
Albert Cardona
http://www.mcdb.ucla.edu/Research/Hartenstein/acardona