Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format Exception: Buffer too small #107

Open
smith6jt-cop opened this issue Oct 23, 2021 · 4 comments
Open

Format Exception: Buffer too small #107

smith6jt-cop opened this issue Oct 23, 2021 · 4 comments

Comments

@smith6jt-cop
Copy link

smith6jt-cop commented Oct 23, 2021

Hello,
I am trying to stitch a 694 GB .nd2 file of a cleared mouse brain acquired with a confocal. The tiles were generated as z-stacks before moving in the xy plane.

BigStitcher starts export and processing steps, but then I get this:

loci.formats.FormatException: Buffer too small (got 1572864, expected 2097152). at loci.formats.FormatTools.checkBufferSize(FormatTools.java:1047) at loci.formats.FormatTools.checkPlaneParameters(FormatTools.java:1003) at loci.formats.in.NativeND2Reader.openBytes(NativeND2Reader.java:231) at loci.formats.DelegateReader.openBytes(DelegateReader.java:227) at loci.formats.FormatReader.openBytes(FormatReader.java:876) at loci.formats.ImageReader.openBytes(ImageReader.java:457) at loci.formats.ReaderWrapper.openBytes(ReaderWrapper.java:341) at net.preibisch.mvrecon.fiji.spimdata.imgloaders.LegacyFileMapImgLoaderLOCI.openImg(LegacyFileMapImgLoaderLOCI.java:275) at net.preibisch.mvrecon.fiji.spimdata.imgloaders.LegacyFileMapImgLoaderLOCI.getImage(LegacyFileMapImgLoaderLOCI.java:158) at mpicbg.spim.data.legacy.LegacyImgLoaderWrapper$SetupImgLoaderWrapper.getImage(LegacyImgLoaderWrapper.java:79) at bdv.export.WriteSequenceToHdf5.writeHdf5PartitionFile(WriteSequenceToHdf5.java:445) at bdv.export.WriteSequenceToHdf5.writeHdf5File(WriteSequenceToHdf5.java:152) at net.preibisch.mvrecon.fiji.plugin.resave.Generic_Resave_HDF5.writeHDF5(Generic_Resave_HDF5.java:261) at net.preibisch.mvrecon.fiji.datasetmanager.FileListDatasetDefinition.createDataset(FileListDatasetDefinition.java:1154) at net.preibisch.mvrecon.fiji.plugin.Define_Multi_View_Dataset.defineDataset(Define_Multi_View_Dataset.java:142) at net.preibisch.mvrecon.fiji.plugin.queryXML.LoadParseQueryXML.queryXML(LoadParseQueryXML.java:122) at net.preibisch.mvrecon.fiji.plugin.queryXML.LoadParseQueryXML.queryXML(LoadParseQueryXML.java:109) at net.preibisch.stitcher.plugin.BigStitcher.run(BigStitcher.java:73) at org.scijava.command.CommandModule.run(CommandModule.java:196) at org.scijava.module.ModuleRunner.run(ModuleRunner.java:163) at org.scijava.module.ModuleRunner.call(ModuleRunner.java:124) at org.scijava.module.ModuleRunner.call(ModuleRunner.java:63) at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:225) 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) at java.lang.Thread.run(Thread.java:748) java.lang.RuntimeException: Could not load 'C:\Users\smith6jt\Desktop\1141648 Female OTR CLARITY\1141648unstitched.nd2' viewId=0, tpId=0 at net.preibisch.mvrecon.fiji.spimdata.imgloaders.LegacyFileMapImgLoaderLOCI.getImage(LegacyFileMapImgLoaderLOCI.java:161) at mpicbg.spim.data.legacy.LegacyImgLoaderWrapper$SetupImgLoaderWrapper.getImage(LegacyImgLoaderWrapper.java:79) at bdv.export.WriteSequenceToHdf5.writeHdf5PartitionFile(WriteSequenceToHdf5.java:445) at bdv.export.WriteSequenceToHdf5.writeHdf5File(WriteSequenceToHdf5.java:152) at net.preibisch.mvrecon.fiji.plugin.resave.Generic_Resave_HDF5.writeHDF5(Generic_Resave_HDF5.java:261) at net.preibisch.mvrecon.fiji.datasetmanager.FileListDatasetDefinition.createDataset(FileListDatasetDefinition.java:1154) at net.preibisch.mvrecon.fiji.plugin.Define_Multi_View_Dataset.defineDataset(Define_Multi_View_Dataset.java:142) at net.preibisch.mvrecon.fiji.plugin.queryXML.LoadParseQueryXML.queryXML(LoadParseQueryXML.java:122) at net.preibisch.mvrecon.fiji.plugin.queryXML.LoadParseQueryXML.queryXML(LoadParseQueryXML.java:109) at net.preibisch.stitcher.plugin.BigStitcher.run(BigStitcher.java:73) at org.scijava.command.CommandModule.run(CommandModule.java:196) at org.scijava.module.ModuleRunner.run(ModuleRunner.java:163) at org.scijava.module.ModuleRunner.call(ModuleRunner.java:124) at org.scijava.module.ModuleRunner.call(ModuleRunner.java:63) at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:225) 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) at java.lang.Thread.run(Thread.java:748)
This is the exception:

`(Fiji Is Just) ImageJ 2.3.0/1.53f51; Java 1.8.0_172 [64-bit]; Windows Server 2016 10.0; 2412MB of 72629MB (3%)

java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Module threw exception
at net.imagej.legacy.LegacyService.runLegacyCompatibleCommand(LegacyService.java:307)
at net.imagej.legacy.DefaultLegacyHooks.interceptRunPlugIn(DefaultLegacyHooks.java:166)
at ij.IJ.runPlugIn(IJ.java)
at ij.Executer.runCommand(Executer.java:150)
at ij.Executer.run(Executer.java:68)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Module threw exception
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:303)
... 5 more
Caused by: java.lang.RuntimeException: Module threw exception
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:63)
at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:225)
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: java.lang.RuntimeException: Could not load 'C:\Users\smith6jt\Desktop\1141648 Female OTR CLARITY\1141648unstitched.nd2' viewId=0, tpId=0: java.lang.RuntimeException: Could not load 'C:\Users\smith6jt\Desktop\1141648 Female OTR CLARITY\1141648unstitched.nd2' viewId=0, tpId=0
at net.preibisch.mvrecon.fiji.spimdata.imgloaders.LegacyFileMapImgLoaderLOCI.getImage(LegacyFileMapImgLoaderLOCI.java:169)
at mpicbg.spim.data.legacy.LegacyImgLoaderWrapper$SetupImgLoaderWrapper.getImage(LegacyImgLoaderWrapper.java:79)
at bdv.export.WriteSequenceToHdf5.writeHdf5PartitionFile(WriteSequenceToHdf5.java:445)
at bdv.export.WriteSequenceToHdf5.writeHdf5File(WriteSequenceToHdf5.java:152)
at net.preibisch.mvrecon.fiji.plugin.resave.Generic_Resave_HDF5.writeHDF5(Generic_Resave_HDF5.java:261)
at net.preibisch.mvrecon.fiji.datasetmanager.FileListDatasetDefinition.createDataset(FileListDatasetDefinition.java:1154)
at net.preibisch.mvrecon.fiji.plugin.Define_Multi_View_Dataset.defineDataset(Define_Multi_View_Dataset.java:142)
at net.preibisch.mvrecon.fiji.plugin.queryXML.LoadParseQueryXML.queryXML(LoadParseQueryXML.java:122)
at net.preibisch.mvrecon.fiji.plugin.queryXML.LoadParseQueryXML.queryXML(LoadParseQueryXML.java:109)
at net.preibisch.stitcher.plugin.BigStitcher.run(BigStitcher.java:73)
at org.scijava.command.CommandModule.run(CommandModule.java:196)
at org.scijava.module.ModuleRunner.run(ModuleRunner.java:163)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:124)
... 6 more
`

@StephanPreibisch
Copy link
Member

Hi, this sounds like the file is corrupted or Bioformats fails to load it ... could you please check if you can open it in Fiji as virtual stack using the Bioformats importer?

@JLiLab
Copy link

JLiLab commented Jan 15, 2023

I ran into the same issue with a toy .czi file (single z tiles). I had no problem opening it in Fiji as virtual stack using the Bioformats.

@Eddymorphling
Copy link

@StephanPreibisch Hi! I have having the same issue with my .nd2 file. Any clue what could be a fix for this? Thanks!

@melissalinkert
Copy link

Based on the stack trace, one place to start looking would be:

https://github.com/PreibischLab/multiview-reconstruction/blob/b7a7cf2e53d6160e974227b48a6243c2a883c3d6/src/main/java/net/preibisch/mvrecon/fiji/spimdata/imgloaders/LegacyFileMapImgLoaderLOCI.java#L243

reader.getBitsPerPixel() / 8 is not the ideal way to get the actual byte width of a pixel, as reader.getBitsPerPixel() is the number of "valid" bits, which may be less than the number of bits actually stored. This is a way to represent e.g. a 12 bit acquisition with a uint16 pixel type. The more accurate way to get the byte width of a pixel is to call FormatTools.getBytesPerPixel(reader.getPixelType()).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants