mobie / mobie-viewer-fiji

BSD 2-Clause "Simplified" License
29 stars 12 forks source link

Open HCS-Plate from Windows #1073

Open tibuch opened 7 months ago

tibuch commented 7 months ago

Hi,

I am running into an issue when I try to open an ome-zarr HCS plate from a windows machine. The same plate works fine from my Linux machine.

I get the following outputs:

Console

[ERROR] Command errored: Open HCS Dataset...
java.lang.IllegalStateException: No match found
    at java.util.regex.Matcher.getMatchedGroupIndex(Matcher.java:1314)
    at java.util.regex.Matcher.group(Matcher.java:572)
    at org.embl.mobie.lib.hcs.HCSPattern.getWellGroup(HCSPattern.java:257)
    at org.embl.mobie.lib.hcs.Plate.buildPlateMap(Plate.java:230)
    at org.embl.mobie.lib.hcs.Plate.<init>(Plate.java:144)
    at org.embl.mobie.MoBIE.openHCSDataset(MoBIE.java:266)
    at org.embl.mobie.MoBIE.<init>(MoBIE.java:156)
    at org.embl.mobie.command.open.OpenHCSDatasetCommand.run(OpenHCSDatasetCommand.java:66)
    at org.scijava.command.CommandModule.run(CommandModule.java:196)
    at org.scijava.module.ModuleRunner.run(ModuleRunner.java:165)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:125)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:64)
    at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:247)
    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)

Exception

(Fiji Is Just) ImageJ 2.14.0/1.54f; Java 1.8.0_172 [64-bit]; Windows 10 10.0; 1168MB of 64000MB (1%)

java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Module threw exception
    at net.imagej.legacy.LegacyService.runLegacyCompatibleCommand(LegacyService.java:308)
    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: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:304)
    ... 5 more
Caused by: java.lang.RuntimeException: Module threw exception
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:128)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:64)
    at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:247)
    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.IllegalStateException: No match found
    at java.util.regex.Matcher.getMatchedGroupIndex(Matcher.java:1314)
    at java.util.regex.Matcher.group(Matcher.java:572)
    at org.embl.mobie.lib.hcs.HCSPattern.getWellGroup(HCSPattern.java:257)
    at org.embl.mobie.lib.hcs.Plate.buildPlateMap(Plate.java:230)
    at org.embl.mobie.lib.hcs.Plate.<init>(Plate.java:144)
    at org.embl.mobie.MoBIE.openHCSDataset(MoBIE.java:266)
    at org.embl.mobie.MoBIE.<init>(MoBIE.java:156)
    at org.embl.mobie.command.open.OpenHCSDatasetCommand.run(OpenHCSDatasetCommand.java:66)
    at org.scijava.command.CommandModule.run(CommandModule.java:196)
    at org.scijava.module.ModuleRunner.run(ModuleRunner.java:165)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:125)
    ... 6 more

Log

# MoBIE
Opening: \\fileserver-address\fileserver\scratch\group\user\Projects\MB_projects\2304_HCR multiplexing\some_long_name\project.zarr
Parsing 14 wells...
Initialising (6/14): A/04
Initialising (1/14): A/05
Initialising (3/14): A/06
Initialising (2/14): B/02
Initialising (8/14): A/02
Initialising (4/14): A/03
Parsed 14 wells in 50 ms, using up to 23 thread(s).
Parsing 14 sites...
Fetching metadata for channel 0 from \\fileserver-address\fileserver\scratch\group\user\Projects\MB_projects\2304_HCR multiplexing\some_long_name\project.zarr\B/03\0...

Maybe it is the wrong / between B/03?

I can open individual wells (i.e. multiscale images) from this zarr.

tischi commented 7 months ago

@tibuch

I pushed a commit to the main branch with those changes:

//private static final String OME_ZARR = ".*.zarr/(?<"+WELL+">[A-Z]/[0-9]+)/(?<"+SITE+">[0-9]+)$";
private static final String OME_ZARR = ".+\\.zarr[\\\\/](?<"+WELL+">[A-Z][\\\\/][0-9]+)[\\\\/](?<"+SITE+">[0-9]+)$";

Hopefully this make the regex work on all OS.

As such things are usually not working the first time (and I do not have a Windows machine) it would be great if you could test this from within your IDE by building the latest main branch.
Please check that it also still works on Linux.

tischi commented 6 months ago

Another thing, could you please have a look into the .zattrs file how the paths to the wells are stored there?

I think it should be the top level .zattrs.... if they contain forward slashes there also on Windows then we may have to also change other things, not sure....

tibuch commented 6 months ago

Inside the .zattrs the paths have forward slashes:

            {
                "columnIndex": 1,
                "path": "A/02",
                "rowIndex": 0
            },

I will test the fix on Linux. @imagejan could you give it a try on you windows machine?

imagejan commented 6 months ago

@tischi wrote:

if they contain forward slashes there also on Windows...

They must. From the spec:

The path MUST consist of a name in the rows list, a file separator (/), and a name from the columns list, in that order.

I get the following error:

[ERROR] Command errored: Open HCS Dataset...
java.lang.RuntimeException: Could not determine HCSPattern for W:\[redacted].zarr
    at org.embl.mobie.lib.hcs.Plate.determineHCSPattern(Plate.java:298)
    at org.embl.mobie.lib.hcs.Plate.<init>(Plate.java:90)
    at org.embl.mobie.MoBIE.openHCSDataset(MoBIE.java:267)
    at org.embl.mobie.MoBIE.<init>(MoBIE.java:170)
    at org.embl.mobie.command.open.OpenHCSDatasetCommand.run(OpenHCSDatasetCommand.java:66)
    at org.scijava.command.CommandModule.run(CommandModule.java:196)
    at org.scijava.module.ModuleRunner.run(ModuleRunner.java:165)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:125)
    at org.scijava.module.ModuleRunner.call(ModuleRunner.java:64)
    at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:247)
    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)
tischi commented 6 months ago

@imagejan any chance you could debug and fix this? It is very hard for me to do so without access to a Windows machine with IntelliJ.....