saalfeldlab / n5-ij

ImageJ convenience layer for N5
BSD 2-Clause "Simplified" License
15 stars 12 forks source link

Exeception when saving as .zarr #51

Closed dmilkie closed 2 years ago

dmilkie commented 2 years ago

I succeeded in saving a 704x1800x3814 unsigned 16-bit image to .n5 and .h5. When I try to save as .zarr I get the following error:

(Fiji Is Just) ImageJ 2.3.0/1.53q; Java 1.8.0_322 [64-bit]; Windows 10 10.0; 9717MB of 48813MB (19%)

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:152)
    at ij.Executer.run(Executer.java:70)
    at java.lang.Thread.run(Thread.java:750)
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.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1967)
    at org.janelia.saalfeldlab.n5.zarr.N5ZarrWriter.createDataset(N5ZarrWriter.java:260)
    at org.janelia.saalfeldlab.n5.imglib2.N5Utils.save(N5Utils.java:1315)
    at org.janelia.saalfeldlab.n5.ij.N5IJUtils.save(N5IJUtils.java:254)
    at org.janelia.saalfeldlab.n5.ij.N5IJUtils.save(N5IJUtils.java:219)
    at org.janelia.saalfeldlab.n5.ij.N5IJUtils.save(N5IJUtils.java:191)
    at org.janelia.saalfeldlab.n5.ij.N5Exporter.write(N5Exporter.java:332)
    at org.janelia.saalfeldlab.n5.ij.N5Exporter.process(N5Exporter.java:252)
    at org.janelia.saalfeldlab.n5.ij.N5Exporter.run(N5Exporter.java:420)
    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

image

bogovicj commented 2 years ago

@dmilkie ,

That's a bug, thanks for reporting. Could you try writing the dataset name as /test instead of test, and see if that helps.

dmilkie commented 2 years ago

Yes. That way works! (I'm using Windows.) image

bogovicj commented 2 years ago

@dmilkie Awesome, thanks for the follow up! This still needs fixing though.

bogovicj commented 2 years ago

This was fixed by https://github.com/saalfeldlab/n5-zarr/commit/2f4dc63120a0cd24c4d7fefae93b7961234c0484 and will work in Fiji once I update it. I'll do that shortly, and then will close this issue.