bigdataviewer / bigdataviewer_fiji

Fiji plugins for starting BigDataViewer and exporting data.
GNU General Public License v3.0
21 stars 9 forks source link

HDF5 saved by Fiji doesn't open in BigDataViewer #12

Closed pawlowska closed 5 years ago

pawlowska commented 5 years ago

I am trying to convert a dataset to hdf5 to view it in BigDataViewer. I did the following: -opened the stack in Fiji -File -> Save as -> HDF5 (new or replace)

I obtained a .h5 file that I can open via File-> Import ->HDF5, but if I try to open via Plugins->BigDataViewer -> Open XML/HDF5, I get errors (below).

Why is this the case and what is the appriopritae way to convert a tif stack into multiresolution hdf5?

=== (Fiji Is Just) ImageJ 2.0.0-rc-69/1.52p; Java 1.8.0_172 [64-bit]; Windows 7 6.1; 450MB of 73552MB (<1%)

java.lang.RuntimeException:` java.util.concurrent.ExecutionException: java.lang.RuntimeException: mpicbg.spim.data.SpimDataIOException: org.apache.xerces.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence. at net.imagej.legacy.LegacyService.runLegacyCompatibleCommand(LegacyService.java:309) at net.imagej.legacy.DefaultLegacyHooks.interceptRunPlugIn(DefaultLegacyHooks.java:163) at ij.IJ.runPlugIn(IJ.java) at ij.Executer.runCommand(Executer.java:137) at ij.Executer.run(Executer.java:66) at java.lang.Thread.run(Thread.java:748) Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: mpicbg.spim.data.SpimDataIOException: org.apache.xerces.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence. at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at net.imagej.legacy.LegacyService.runLegacyCompatibleCommand(LegacyService.java:305) ... 5 more Caused by: java.lang.RuntimeException: mpicbg.spim.data.SpimDataIOException: org.apache.xerces.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence. at bdv.ij.BigDataViewerPlugIn.run(BigDataViewerPlugIn.java:118) at org.scijava.command.CommandModule.run(CommandModule.java:199) 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:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ... 1 more Caused by: mpicbg.spim.data.SpimDataIOException: org.apache.xerces.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence. at bdv.spimdata.XmlIoSpimDataMinimal.load(XmlIoSpimDataMinimal.java:76) at bdv.BigDataViewer.open(BigDataViewer.java:487) at bdv.ij.BigDataViewerPlugIn.run(BigDataViewerPlugIn.java:114) ... 9 more Caused by: org.apache.xerces.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence. at org.apache.xerces.impl.io.UTF8Reader.invalidByte(Unknown Source) at org.apache.xerces.impl.io.UTF8Reader.read(Unknown Source) at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source) at org.apache.xerces.impl.XMLEntityScanner.skipString(Unknown Source) at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at org.jdom2.input.sax.SAXBuilderEngine.build(SAXBuilderEngine.java:217) at org.jdom2.input.sax.SAXBuilderEngine.build(SAXBuilderEngine.java:329) at org.jdom2.input.SAXBuilder.build(SAXBuilder.java:1266) at bdv.spimdata.XmlIoSpimDataMinimal.load(XmlIoSpimDataMinimal.java:72) ... 11 more

tpietzsch commented 5 years ago

Hi @pawlowska

Try: -opened the stack in Fiji -Plugins -> BigDataViewer -> Export Current Image as XML/HDF5 That will produce a h5 file and an XML file. You can then open the XML file with Plugins->BigDataViewer -> Open XML/HDF5

See https://imagej.net/BigDataViewer#Exporting_from_ImageJ_Stacks

Does that work?

pawlowska commented 5 years ago

this works, thank you. But shouldn't the two methods be compatible?

tpietzsch commented 5 years ago

But shouldn't the two methods be compatible?

Not really, HDF5 is a "filesystem in a file", so it's more a family of formats than a single format. The "Export Current Image as XML/HDF5" creates multi-resolution pyramids, puts 3D stacks (per resolution level, channel, angle, etc..) as datasets into a specified group structure inside the HDF5 and writes the metadata to the XML file. The "Save as -> HDF5" just puts a one dataset into one HDF5 file.