Recent issue with Bioformats multiposition file opening from a macro macro

bio-formats
imagej

#1

Dear All,

I am using the bioformat plugin to open a multiposition tiff file. Opening the image with the bioformat plugin from the graphical user interface works fine but using the macro command produced by the macro recorder does not work anymore. A user reported me that since December 15 that bioformat call was producing an error. A window pops up showing the message “Sorry, there was an I/O problem during import”. and an error message shows up in the log window.

Thanks for any help.

Here is a minimal macro that reproduced the issue with our data

//@File  filePath
i=1
print(filePath)
run("Bio-Formats", "open=["+filePath+"] color_mode=Default rois_import=[ROI manager] view=Hyperstack stack_order=XYCZT series_"+i);

my Fiji version:
with java8 update site activated

error message:

java.nio.channels.ClosedChannelException
	at sun.nio.ch.FileChannelImpl.ensureOpen(FileChannelImpl.java:110)
	at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:721)
	at loci.common.NIOByteBufferProvider.allocateDirect(NIOByteBufferProvider.java:127)
	at loci.common.NIOByteBufferProvider.allocate(NIOByteBufferProvider.java:112)
	at loci.common.NIOFileHandle.buffer(NIOFileHandle.java:602)
	at loci.common.NIOFileHandle.seek(NIOFileHandle.java:293)
	at loci.common.RandomAccessInputStream.seek(RandomAccessInputStream.java:174)
	at loci.formats.tiff.TiffParser.getTile(TiffParser.java:729)
	at loci.formats.tiff.TiffParser.getSamples(TiffParser.java:986)
	at loci.formats.tiff.TiffParser.getSamples(TiffParser.java:783)
	at loci.formats.in.FluoviewReader.openBytes(FluoviewReader.java:166)
	at loci.formats.ChannelFiller.openBytes(ChannelFiller.java:156)
	at loci.formats.ChannelSeparator.openBytes(ChannelSeparator.java:227)
	at loci.formats.ChannelSeparator.openBytes(ChannelSeparator.java:159)
	at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:335)
	at loci.formats.DimensionSwapper.openBytes(DimensionSwapper.java:233)
	at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:335)
	at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:335)
	at loci.plugins.util.ImageProcessorReader.openProcessors(ImageProcessorReader.java:186)
	at loci.plugins.in.ImagePlusReader.readProcessors(ImagePlusReader.java:416)
	at loci.plugins.in.ImagePlusReader.readPlanes(ImagePlusReader.java:380)
	at loci.plugins.in.ImagePlusReader.readImage(ImagePlusReader.java:277)
	at loci.plugins.in.ImagePlusReader.readImages(ImagePlusReader.java:238)
	at loci.plugins.in.ImagePlusReader.readImages(ImagePlusReader.java:216)
	at loci.plugins.in.ImagePlusReader.openImagePlus(ImagePlusReader.java:111)
	at loci.plugins.in.Importer.readPixels(Importer.java:149)
	at loci.plugins.in.Importer.run(Importer.java:86)
	at loci.plugins.LociImporter.run(LociImporter.java:78)
	at ij.IJ.runUserPlugIn(IJ.java:217)
	at ij.IJ.runPlugIn(IJ.java:181)
	at ij.Executer.runCommand(Executer.java:137)
	at ij.Executer.run(Executer.java:66)
	at ij.IJ.run(IJ.java:297)
	at ij.macro.Functions.doRun(Functions.java:601)
	at ij.macro.Functions.doFunction(Functions.java:96)
	at ij.macro.Interpreter.doStatement(Interpreter.java:230)
	at ij.macro.Interpreter.doStatements(Interpreter.java:218)
	at ij.macro.Interpreter.run(Interpreter.java:115)
	at ij.macro.Interpreter.run(Interpreter.java:85)
	at ij.macro.Interpreter.run(Interpreter.java:96)
	at ij.plugin.Macro_Runner.runMacro(Macro_Runner.java:155)
	at ij.IJ.runMacro(IJ.java:134)
	at ij.IJ.runMacro(IJ.java:123)
	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1039)
	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1035)
	at net.imagej.legacy.IJ1Helper.runMacroFriendly(IJ1Helper.java:986)
	at net.imagej.legacy.IJ1Helper.runMacro(IJ1Helper.java:1035)
	at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:97)
	at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:144)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:177)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65)
	at org.scijava.thread.DefaultThreadService$2.call(DefaultThreadService.java:191)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

#2

Dear all,
I am facing similar issue with a jython plugin that opens .lei series one by one that way:

for s in range(1,1+seriesCount):
    IJ.run("Bio-Formats", "open=["+file_path+"] autoscale color_mode=Default rois_import=[ROI manager] view=Hyperstack stack_order=XYCZT series_"+str(s));

throwing following errors and exceptions:

java.nio.channels.ClosedChannelException
	at sun.nio.ch.FileChannelImpl.ensureOpen(FileChannelImpl.java:110)
	at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:721)
	at loci.common.NIOByteBufferProvider.allocateDirect(NIOByteBufferProvider.java:127)
	at loci.common.NIOByteBufferProvider.allocate(NIOByteBufferProvider.java:112)
	at loci.common.NIOFileHandle.buffer(NIOFileHandle.java:602)
	at loci.common.NIOFileHandle.seek(NIOFileHandle.java:293)
	at loci.common.RandomAccessInputStream.seek(RandomAccessInputStream.java:174)
	at loci.formats.tiff.TiffParser.getTile(TiffParser.java:729)
	at loci.formats.tiff.TiffParser.getSamples(TiffParser.java:986)
	at loci.formats.tiff.TiffParser.getSamples(TiffParser.java:783)
	at loci.formats.in.MinimalTiffReader.openBytes(MinimalTiffReader.java:299)
	at loci.formats.in.LeicaReader.openBytes(LeicaReader.java:279)
	at loci.formats.ChannelFiller.openBytes(ChannelFiller.java:156)
	at loci.formats.ChannelSeparator.openBytes(ChannelSeparator.java:227)
	at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:349)
	at loci.formats.DimensionSwapper.openBytes(DimensionSwapper.java:249)
	at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:349)
	at loci.formats.MinMaxCalculator.openBytes(MinMaxCalculator.java:269)
	at loci.formats.MinMaxCalculator.openBytes(MinMaxCalculator.java:260)
	at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:335)
	at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:335)
	at loci.plugins.util.ImageProcessorReader.openProcessors(ImageProcessorReader.java:186)
	at loci.plugins.in.ImagePlusReader.readProcessors(ImagePlusReader.java:416)
	at loci.plugins.in.ImagePlusReader.readPlanes(ImagePlusReader.java:380)
	at loci.plugins.in.ImagePlusReader.readImage(ImagePlusReader.java:277)
	at loci.plugins.in.ImagePlusReader.readImages(ImagePlusReader.java:238)
	at loci.plugins.in.ImagePlusReader.readImages(ImagePlusReader.java:216)
	at loci.plugins.in.ImagePlusReader.openImagePlus(ImagePlusReader.java:111)
	at loci.plugins.in.Importer.readPixels(Importer.java:149)
	at loci.plugins.in.Importer.run(Importer.java:86)
	at loci.plugins.LociImporter.run(LociImporter.java:78)
	at ij.IJ.runUserPlugIn(IJ.java:217)
	at ij.IJ.runPlugIn(IJ.java:181)
	at ij.Executer.runCommand(Executer.java:137)
	at ij.Executer.run(Executer.java:66)
	at ij.IJ.run(IJ.java:297)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
	at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
	at org.python.core.PyObject.__call__(PyObject.java:404)
	at org.python.core.PyObject.__call__(PyObject.java:408)
	at org.python.pycode._pyx1.f$0(NUCLaminyzer_BioFormats_BatchAnalysis.py:368)
	at org.python.pycode._pyx1.call_function(NUCLaminyzer_BioFormats_BatchAnalysis.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1275)
	at org.scijava.plugins.scripting.jython.JythonScriptEngine.eval(JythonScriptEngine.java:76)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:177)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65)
	at org.scijava.thread.DefaultThreadService$2.call(DefaultThreadService.java:191)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

only to add a note, it worked well with a previous version of Fiji and Bioformats.
After and update of Fiji and Bioformats it throws these errors.
Fiji is 2.0 -rc-54/1.51.h
Java is 1.8.0_77 (64bit)
and Bio-Formats last version.

Thanks
have a nice day
Emanuele Martini
Bio-Formats


#3

Hi Benoit and Emanuele,

Thank you for reporting this problem. I can reproduce the error, but only when the Bio-Formats update site is enabled. Could you please verify whether you have that update site enabled, and if so whether disabling it and applying the resulting updates resolves the problem? Selecting Help > About Plugins > Bio-Formats Plugins after updating should show that version 5.3.1 is installed.

It looks like the Bio-Formats update site is approximately 10 days behind the current development version, and so does not include the final fixes from the recent 5.3.0 and 5.3.1 releases of Bio-Formats. I’m afraid I don’t know why that would be the case, though.

Regards,
-Melissa


#4

Dear Melissa,
thank you.
I just tried with your suggestions and unfortunately I got the same errors.
These are the two versions that I’ve tried:


maybe it could be a Mac Version problem
my version is OS X 10.9.5

thank you for your attention Melissa,
have a nice day
Emanuele


#5

Dears,
are there some news about this issue?


#6

Hi @melissa, Hi @emartini,

Happy new year!

Sorry for the late feedback. the update site was not selected on my side. Regarding the version, 5.3.1 is installed. Also my system is window 7


#7

Hi Emanuele and Benoit,

happy New Year. I tried to reproduce the issue described above using the following workflow I used on OS X 10.10.5:

I was able to reproduce the error you described. However the error message is very intermittent for me and I have not been able to pin down a sequence to systematically reproduce it yet. In most cases, when executing the macro, the image opens as expected. We will give it another go, try to activate some debugging and keep you posted.

Best,
Sebastien


#8

Thank you Sebastien
Yes it is intermittent also for me :cold_sweat: :smiley:
Yes I will try to debug it with Eclipse IDE, I don’t know when because at the moment we fixed it using an old Mac with an old version of Fiji and everything :wink: and i am working on other projects.
But for sure, if I would have news on it I will keep this post alive.

Happy new Year everybody
Emanuele


#9

Hi again,

quick heads up, we believe we have identified the source of the issue and are currently investigating a fix for this regression which should restore the pre 5.3.0 behavior for macros. If this turns out to be successful, the fix will be distributed in the following patch release of Bio-Formats.

Best,
Sébastien


#10

Hi Sebastien,

Thanks a lot for the help!

Best,
Benoit


#11

thank you very much,
best regards
Emanuele Martini


#12

Dear Sebastien,
I tried now my plugin that calls bioformats opener macro and it worked well!

thank you very much,
Emanuele


#13

Dear Emanuele,

thanks for your fast testing and feedback. We just released Bio-Formats 5.3.2 which contains the fix for this issue. @Benoit: let us know if this helps solving this issue.

Best,
Sebastien


#14

Hi Sebastien,

I’ve just tried it and it works like a charm!
Thanks a lot fo the help.

Best,
Benoit


#15

Sorry to revive an old thread, but I am having what looks like the same problem with some macros that have worked in the past and thought it would be better to reply rather than create a new thread as I can’t find the “reply as linked topic” option. Does anyone know if this issue has resurfaced with Bio-formats 5.9.2?

I am running ImageJ 1.52h, Bio-formats 5.9.2, Java 1.8.0_66, and I get the I/O problem during import (like above) and this code:

java.io.IOException: Restart interval and markers invalid
	at loci.formats.services.JPEGTurboServiceImpl.initialize(JPEGTurboServiceImpl.java:222)
	at loci.formats.in.TileJPEGReader.reopenFile(TileJPEGReader.java:144)
	at loci.formats.in.TileJPEGReader.initFile(TileJPEGReader.java:121)
	at loci.formats.FormatReader.setId(FormatReader.java:1397)
	at loci.formats.DelegateReader.setId(DelegateReader.java:300)
	at loci.formats.in.JPEGReader.setId(JPEGReader.java:87)
	at loci.plugins.in.ImportProcess.initializeFile(ImportProcess.java:499)
	at loci.plugins.in.ImportProcess.execute(ImportProcess.java:142)
	at loci.plugins.in.Importer.showDialogs(Importer.java:140)
	at loci.plugins.in.Importer.run(Importer.java:76)
	at loci.plugins.LociImporter.run(LociImporter.java:78)
	at ij.IJ.runUserPlugIn(IJ.java:228)
	at ij.IJ.runPlugIn(IJ.java:192)
	at ij.Executer.runCommand(Executer.java:137)
	at ij.Executer.run(Executer.java:66)
	at ij.IJ.run(IJ.java:308)
	at ij.macro.Functions.doRun(Functions.java:620)
	at ij.macro.Functions.doFunction(Functions.java:96)
	at ij.macro.Interpreter.doStatement(Interpreter.java:250)
	at ij.macro.Interpreter.doStatements(Interpreter.java:236)
	at ij.macro.Interpreter.run(Interpreter.java:119)
	at ij.macro.Interpreter.run(Interpreter.java:90)
	at ij.macro.Interpreter.run(Interpreter.java:101)
	at ij.plugin.Macro_Runner.runMacro(Macro_Runner.java:161)
	at ij.IJ.runMacro(IJ.java:147)
	at ij.IJ.runMacro(IJ.java:136)
	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1098)
	at net.imagej.legacy.IJ1Helper$3.call(IJ1Helper.java:1094)
	at net.imagej.legacy.IJ1Helper.runMacroFriendly(IJ1Helper.java:1045)
	at net.imagej.legacy.IJ1Helper.runMacro(IJ1Helper.java:1094)
	at net.imagej.legacy.plugin.IJ1MacroEngine.eval(IJ1MacroEngine.java:137)
	at org.scijava.script.ScriptModule.run(ScriptModule.java:160)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
	at org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:238)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Any tips would be appreciated!


#16

Hi @cgusbecker, this looks like an issue with the reading of a particular file, I dont think it is specifically linked to a recent version. If you are able to upload the sample file showing the issue to https://www.openmicroscopy.org/qa2/qa/upload/ then I would be happy to further test and debug the problem