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

Link to existing OME-Zarr images in Fiji project creator #1116

Closed
tischi opened this issue Mar 13, 2024 · 52 comments
Closed

Link to existing OME-Zarr images in Fiji project creator #1116

tischi opened this issue Mar 13, 2024 · 52 comments

Comments

@tischi
Copy link
Contributor

tischi commented Mar 13, 2024

@K-Meech

You had:

            gd.addMessage( "Note: You can only 'link' to images outside the project folder \n" +
                    " for local projects. 'copy' or 'move' if you wish to upload to s3" );

I don't see why one could not link to OME-Zarr from and to S3? In fact, I would think in the future it could be a major use-case to link to OME-Zarr hosted on S3 at the BioImage Archive.

@tischi
Copy link
Contributor Author

tischi commented Mar 13, 2024

Same question here:

            if ( imageDataFormat == ImageDataFormat.OmeZarr && addMethod == ProjectCreator.AddMethod.link )
            {
                IJ.log( "link is currently unsupported for ome-zarr. Please choose copy or move instead for this file format." );
                return;
            }

Why is that? We could just store the absolutePath to the linked OME-Zarr; I don't see the problem....

@K-Meech
Copy link
Contributor

K-Meech commented Mar 13, 2024

            gd.addMessage( "Note: You can only 'link' to images outside the project folder \n" +
                    " for local projects. 'copy' or 'move' if you wish to upload to s3" );

This message was about people linking to images stored on the filesystem outside of their project. It's useful to be able to do this so people don't have to copy large images around when they just want to view their mobie project locally. The issue is that when this project is then uploaded to S3, these links will break and the images will no longer be available.

I agree - it should be possible to link to ome-zarr images that are already hosted on S3. This just hasn't been implemented yet, and would need to be some kind of new option.

            if ( imageDataFormat == ImageDataFormat.OmeZarr && addMethod == ProjectCreator.AddMethod.link )
            {
                IJ.log( "link is currently unsupported for ome-zarr. Please choose copy or move instead for this file format." );
                return;
            }

For this one, it's just that this hasn't been implemented yet. So far all linking has been done by placing an XML file inside the MoBIE project that internally contains a link to the position of the file elsewhere on the filesystem. I agree that using absolute path is probably a better way to do this - and would mean that n5 + ome-zarr could be handled in the same way.

@tischi tischi changed the title Link to existing images Link to existing images in Fiji project creator Mar 13, 2024
@tischi
Copy link
Contributor Author

tischi commented Mar 13, 2024

@K-Meech would you have some time to look into the new-n5 branch to see how we could add support linking to existing OME-Zarr datasets in the ProjectCreator via the absolute path mechanism?

@K-Meech
Copy link
Contributor

K-Meech commented Mar 13, 2024

@tischi I probably wouldn't have time until next week or the week after. Do you need it done before then?

@tischi
Copy link
Contributor Author

tischi commented Mar 13, 2024

There is no deadline for any of the issues that I posted today; I just had time travelling to work on this.
Maybe you could check the issues once you have time and if you feel like working on something you can do it.
In case I will do something I will try to keep the issues up to date such that we don't both work on the same thing.

@tischi tischi changed the title Link to existing images in Fiji project creator Link to existing OME-Zarr images in Fiji project creator Mar 13, 2024
@tischi
Copy link
Contributor Author

tischi commented Mar 13, 2024

The ImagesCreatorTests are running now, but:

//    @Test
//    void linkImage() throws IOException {
//        testLinkingImages( false );
//    }

...this needs work and is thus commented out for now.

@tischi
Copy link
Contributor Author

tischi commented Apr 3, 2024

Hi @K-Meech, little ping :-)

And please use the new-n5-merge-main branch.

@K-Meech
Copy link
Contributor

K-Meech commented Apr 4, 2024

Sorry for the delay in getting back to you @tischi ! I should have time to take a look at this next week.

@K-Meech
Copy link
Contributor

K-Meech commented Apr 8, 2024

@tischi I'm starting to look into this, but I'm having trouble getting it to build. Just to check, you're using:

  • new-n5-merge-main branch of this repo
  • new-n5 branch of mobie-io
  • master branch of imagej-utils

@tischi
Copy link
Contributor Author

tischi commented Apr 9, 2024

Yes, that's correct.

@K-Meech
Copy link
Contributor

K-Meech commented Apr 9, 2024

Thanks @tischi - I'm getting cannot find symbol from this line in MOBIE.java. I couldn't see the corresponding method in ImageDataFormat on that branch of mobie-io?

@tischi
Copy link
Contributor Author

tischi commented Apr 9, 2024

@K-Meech

Could you please pull everything again and re-built?

@K-Meech
Copy link
Contributor

K-Meech commented Apr 9, 2024

Thanks @tischi - everything builds now.

@K-Meech
Copy link
Contributor

K-Meech commented Apr 9, 2024

@tischi I couldn't find absolutePath in the current mobie schema. Can the absolute path be a file path or a remote S3 link? Do you have an example of a project that uses it?

@tischi
Copy link
Contributor Author

tischi commented Apr 10, 2024

You are right, we would need to discuss this.

I will sent a mail around.

@tischi
Copy link
Contributor Author

tischi commented Apr 10, 2024

Hmm, I have it in the Java code, though:

public class StorageLocation
{
	// for data on disk:
	// either
	public String relativePath;
	// or
	public String absolutePath;

	// for data on s3:
	public String s3Address;
	public String signingRegion;

My proposal would be adding a new way of referring to the storage location, called uri, which would combine all of those: relativePath, absolutePath, and s3Address. Relative paths would be discovered by the uri starting with a ., e.g. ./image_data/image.tiff. S3 locations would be discovered by the http and s3 in the address.

@K-Meech
Copy link
Contributor

K-Meech commented Apr 10, 2024

In the spec there's currently two different ways of specifying ome-zarr files: ome.zarr with a relativePath, and ome.zarr.s3 with an s3address. To keep compatibility with previous mobie projects it might be easier to just add an absolutePath option to ome.zarr which has to be a file path?

For the project creator, you could then have three options for adding images: adding the currently open image from imageJ, adding an ome-zarr file from the file system (link or copy, using absolute or relative path), then adding an ome-zarr file from s3 (where you can type in the s3 path)?

@tischi
Copy link
Contributor Author

tischi commented Apr 10, 2024

adding an ome-zarr file from the file system (link or copy, using absolute or relative path), then adding an ome-zarr file from s3 (where you can type in the s3 path)

We can still keep those separate on the UI level, but internally we could use uri for both.

OK, but what I think you could do right now is to implement what you proposed, because it should just work, given the current code in MoBIE.class:

    public synchronized String getImageLocation( ImageDataFormat imageDataFormat, StorageLocation storageLocation )
	{
		switch (imageDataFormat) {
			case OpenOrganelleS3:
            case OmeZarrS3:
				if ( storageLocation.s3Address != null )
                	return storageLocation.s3Address;
				else
					return storageLocation.absolutePath; // works now, too
            default:
				if ( storageLocation.absolutePath != null  )
					return storageLocation.absolutePath;
				else
					return combinePath( imageRoot, dataset.getName(), storageLocation.relativePath );
        }
    }

Could you please try this?

We can then, as a second step, discuss what we do on the spec level, where absolutePath simply seems to be missing...?!

@K-Meech
Copy link
Contributor

K-Meech commented Apr 10, 2024

Ok - sounds good! I should hopefully have time to look at this tomorrow.

@normanrz
Copy link

Fwiw, in OME-Zarr this attribute is called path.

@tischi
Copy link
Contributor Author

tischi commented Apr 10, 2024

I was trying to anticipate the collection spec, where I think you proposed uri...

@normanrz
Copy link

I initially had uri but then switched to path because that is also used in the multiscale metadata.

@K-Meech
Copy link
Contributor

K-Meech commented Apr 12, 2024

@tischi I'm trying to get linking images to work, but having issues reading/writing ome-zarr with the current code in the project creator. For example, running:

void testZarrReadWrite() {
        ImagePlus imp = IJ.createImage( "test", "8-bit noise", 186, 226, 27 );
        String filePath = "C:\\Users\\kimme\\Documents\\Temp\\test.ome.zarr";
        OMEZarrWriter.write( imp, filePath, OMEZarrWriter.ImageType.Intensities, true );
        ImageData< ? > imageData = ImageDataOpener.open( filePath );
        int numSetups = imageData.getNumDatasets();
    }

throws a bunch of errors:

N5ImageData: Error opening C:\Users\kimme\Documents\Temp\test.ome.zarr
java.lang.NullPointerException
	at org.janelia.saalfeldlab.n5.bdv.N5Viewer.buildN5Sources(N5Viewer.java:522)
	at org.janelia.saalfeldlab.n5.bdv.N5Viewer.buildN5Sources(N5Viewer.java:497)
	at org.embl.mobie.io.imagedata.N5ImageData.open(N5ImageData.java:153)
	at org.embl.mobie.io.imagedata.N5ImageData.getNumDatasets(N5ImageData.java:88)
	at org.embl.mobie.lib.create.ImagesCreatorTest.testZarrReadWrite(ImagesCreatorTest.java:248)
	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.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:628)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:117)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:184)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:180)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:127)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:229)
	at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:197)
	at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:211)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:191)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
	at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)

java.lang.RuntimeException: java.lang.NullPointerException

	at org.embl.mobie.io.imagedata.N5ImageData.open(N5ImageData.java:168)
	at org.embl.mobie.io.imagedata.N5ImageData.getNumDatasets(N5ImageData.java:88)
	at org.embl.mobie.lib.create.ImagesCreatorTest.testZarrReadWrite(ImagesCreatorTest.java:248)
	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.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:628)
	at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:117)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:184)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:180)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:127)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:229)
	at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:197)
	at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:211)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:191)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
	at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
Caused by: java.lang.NullPointerException
	at org.janelia.saalfeldlab.n5.bdv.N5Viewer.buildN5Sources(N5Viewer.java:522)
	at org.janelia.saalfeldlab.n5.bdv.N5Viewer.buildN5Sources(N5Viewer.java:497)
	at org.embl.mobie.io.imagedata.N5ImageData.open(N5ImageData.java:153)
	... 55 more

Does the same happen on your system? Potentially it's windows specific.

@tischi
Copy link
Contributor Author

tischi commented Apr 12, 2024

Hi @K-Meech,

I added an OMEZarrWriterTest to mobie-io and that works for me...

If you pull that and run the test, does it work for you?

If not, we 'd probably need to ask the Janelia folks...

@K-Meech
Copy link
Contributor

K-Meech commented Apr 14, 2024

Thanks @tischi - I just tried and this test fails on my Windows 11 computer. The ome-zarr file is written successfully, but can't be opened again:

N5ImageData: Error opening src/test/tmp/test.zarr
java.lang.NullPointerException
	at org.janelia.saalfeldlab.n5.bdv.N5Viewer.buildN5Sources(N5Viewer.java:522)
	at org.janelia.saalfeldlab.n5.bdv.N5Viewer.buildN5Sources(N5Viewer.java:497)
	at org.embl.mobie.io.imagedata.N5ImageData.open(N5ImageData.java:153)
	at org.embl.mobie.io.imagedata.N5ImageData.getSourcePair(N5ImageData.java:70)
	at org.embl.mobie.io.OMEZarrWriterTest.writeAndReadOMEZarr(OMEZarrWriterTest.java:25)
	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.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
	at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
	at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)

java.lang.RuntimeException: java.lang.NullPointerException

	at org.embl.mobie.io.imagedata.N5ImageData.open(N5ImageData.java:168)
	at org.embl.mobie.io.imagedata.N5ImageData.getSourcePair(N5ImageData.java:70)
	at org.embl.mobie.io.OMEZarrWriterTest.writeAndReadOMEZarr(OMEZarrWriterTest.java:25)
	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.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
	at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
	at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:57)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
	at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
Caused by: java.lang.NullPointerException
	at org.janelia.saalfeldlab.n5.bdv.N5Viewer.buildN5Sources(N5Viewer.java:522)
	at org.janelia.saalfeldlab.n5.bdv.N5Viewer.buildN5Sources(N5Viewer.java:497)
	at org.embl.mobie.io.imagedata.N5ImageData.open(N5ImageData.java:153)
	... 72 more

@tischi
Copy link
Contributor Author

tischi commented Apr 15, 2024

Hi,

@k-dominik (on your Mac) and @constantinpape (on your Linux) could you please do us a favour and please try whether this works for you?

  • git pull https://github.com/mobie/mobie-io.git
  • git checkout new-n5
  • mvn test

For Kimberly the OMEZarrWriter test fails, for me it works.

@k-dominik
Copy link
Contributor

k-dominik commented Apr 15, 2024

Seems to work for me:

[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.601 s -- in org.embl.mobie.io.OMEZarrWriterTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 9, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  03:08 min
[INFO] Finished at: 2024-04-15T09:57:49+02:00
[INFO] ------------------------------------------------------------------------
╭─ ~/scratch/mobie-io  new-n5 ························································································ ✔  3m 15s  java   09:57:49
╰─ git log -1
commit 44fab8ace6b1a786eadb01b9787455025c6349eb (HEAD -> new-n5, origin/new-n5)
Author: Christian Tischer 
Date:   Fri Apr 12 23:18:09 2024 +0200

    Add OMEZarrWriterTest

@tischi
Copy link
Contributor Author

tischi commented Apr 15, 2024

@K-Meech would you mind asking for help here? https://imagesc.zulipchat.com/#narrow/stream/328251-NGFF

@K-Meech
Copy link
Contributor

K-Meech commented Apr 15, 2024

Done!

@k-dominik
Copy link
Contributor

k-dominik commented Apr 15, 2024

I've also confirmed an issue on windows 10, albeit a different one?

[ERROR] org.embl.mobie.io.imagedata.N5ImageDataTest.openOMEZarrFromEBIS3
[ERROR] org.embl.mobie.io.imagedata.N5ImageDataTest.openOMEZarrFromEBIS3 -- Time elapsed: 5.569 s <<< ERROR!
java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke "org.janelia.saalfeldlab.n5.universe.metadata.N5Metadata.getName()" because "metadata" is null
        at org.embl.mobie.io.imagedata.N5ImageData.open(N5ImageData.java:168)
        at org.embl.mobie.io.imagedata.N5ImageData.getSourcePair(N5ImageData.java:70)
        at org.embl.mobie.io.imagedata.N5ImageDataTest.openOMEZarrFromEBIS3(N5ImageDataTest.java:33)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
        at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
        at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
        at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
        at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
        at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
        at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
        at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
        at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
        at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
        at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
        at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
        at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
        at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
        at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
        at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
        at org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:56)
        at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:184)
        at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:148)
        at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:122)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
        at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
Caused by: java.lang.NullPointerException: Cannot invoke "org.janelia.saalfeldlab.n5.universe.metadata.N5Metadata.getName()" because "metadata" is null
        at org.janelia.saalfeldlab.n5.bdv.N5Viewer.buildN5Sources(N5Viewer.java:522)
        at org.janelia.saalfeldlab.n5.bdv.N5Viewer.buildN5Sources(N5Viewer.java:497)
        at org.embl.mobie.io.imagedata.N5ImageData.open(N5ImageData.java:153)
        ... 71 more

[INFO] Running org.embl.mobie.io.OMEZarrWriterTest
18:24:02.194 [pool-10-thread-3] DEBUG org.janelia.saalfeldlab.n5.universe.N5DatasetDiscoverer - parsed metadata for: /s1:        found: N5SingleScaleMetadata
18:24:02.194 [pool-10-thread-2] DEBUG org.janelia.saalfeldlab.n5.universe.N5DatasetDiscoverer - parsed metadata for: /s0:        found: N5SingleScaleMetadata
18:24:02.198 [main] DEBUG org.janelia.saalfeldlab.n5.universe.N5DatasetDiscoverer - parsed metadata for: /:      found: OmeNgffMetadata
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.653 s -- in org.embl.mobie.io.OMEZarrWriterTest
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]   N5ImageDataTest.openOMEZarrFromEBIS3:33 ┬╗ Runtime java.lang.NullPointerException: Cannot invoke "org.janelia.saalfeldlab.n5.universe.metadata.N5Metadata.getName()" because "metadata" is null
[INFO]
[ERROR] Tests run: 9, Failures: 0, Errors: 1, Skipped: 0

@constantinpape
Copy link
Contributor

I tried on Ubuntu @tischi. I had to do a mvn clean install before the mvn test, but then everything seems to work.

@axtimwalde
Copy link

I traced the first two lines in the exception trace and the outcome is that selectedMetaData[i] must be null but set. The data comes from

org.embl.mobie.io.imagedata.N5ImageData.open(N5ImageData.java:153

Please follow up from here.

Reference with stream of thought https://imagesc.zulipchat.com/#narrow/stream/328251-NGFF/topic/Making.20it.20easy.20to.20read.20.2B.20write.20ome-zarr.20in.20Fiji

@tischi
Copy link
Contributor Author

tischi commented Apr 16, 2024

Thanks @axtimwalde for the analysis!

@K-Meech could you try the following on your Windows machine:

After this line of code: Running in debug mode, could you check what the group variable is? I wonder whether the "/" is wrong and should rather be File.separator..?

@K-Meech
Copy link
Contributor

K-Meech commented Apr 16, 2024

@tischi - I just checked and group is "/"

@tischi
Copy link
Contributor Author

tischi commented Apr 16, 2024

Time for a short zoom now?

@tischi
Copy link
Contributor Author

tischi commented Apr 16, 2024

Does it help if you change the code to:

String group = n5URI.getGroupPath() != null ? n5URI.getGroupPath() : File.separator;

?

@K-Meech
Copy link
Contributor

K-Meech commented Apr 16, 2024

Sorry @tischi - I'm just about to head out! Using File.separator didn't fix it unfortunately.
Are you around on Friday? I could do a zoom call then?

@K-Meech
Copy link
Contributor

K-Meech commented Apr 17, 2024

Ok - so looking in to this more, it seems to be an issue with how the path inside datasets and multiscales is written in the top .zattrs file. For the ome-zarr file created in the test (which has two datasets s0 and s1), they are written as "path":"..\\..s0" and "path":"..\\..s1". Manually changing these to just "s0" and "s1" allows it to be opened correctly.

There are probably a number of places that contribute to this - but for example, canoncialPath gets called with parent of "" and child of ..\s0 and ends up returning /..s0

@tischi
Copy link
Contributor Author

tischi commented Apr 18, 2024

@K-Meech could you please try whether that also happens when you are using the Fiji UI:

You could run this macro, but just adapt the containerroot to point to a folder on your computer.

run("Blobs (25K)");
run("Scale...", "x=8 y=8 width=2048 height=2032 interpolation=Bilinear average create");
run("HDF5/N5/Zarr/OME-NGFF ...", "containerroot=/Users/tischer/Desktop dataset=image storageformat=Zarr chunksizearg=100 createpyramidifpossible=true downsamplemethod=Sample compressionarg=gzip metadatastyle=OME-NGFF nthreads=1 overwrite=true");

@K-Meech
Copy link
Contributor

K-Meech commented Apr 18, 2024

@tischi The same doesn't happen in Fiji. Running this macro writes the image successfully with paths like "path":"s0" in the .zattrs file

@tischi
Copy link
Contributor Author

tischi commented Apr 18, 2024

Ha, that's interesting...then we need to look into the OME-Zarr writing code in mobie-io and n5-viewer and find the difference. I will have a look right now, however due to lack of access to a Windows computer I can only do educated guessing. So, if you could also have a look that would be ❤️ !

@tischi
Copy link
Contributor Author

tischi commented Apr 18, 2024

@K-Meech could you please try whether it makes a different if you put a non-empty string here?

For instance, replace that line with String n5Dataset = "image";...


Along similar lines, could you please also test writing an image from the Fiji GUI and then leaving the dataset empty (instead of "image")?

In fact I don't know how to do this in the macro.....?

run("Blobs (25K)");
run("Scale...", "x=8 y=8 width=2048 height=2032 interpolation=Bilinear average create");
run("HDF5/N5/Zarr/OME-NGFF ...", "containerroot=/Users/tischer/Desktop dataset=???? storageformat=Zarr chunksizearg=100 createpyramidifpossible=true downsamplemethod=Sample compressionarg=gzip metadatastyle=OME-NGFF nthreads=1 overwrite=true");

@K-Meech
Copy link
Contributor

K-Meech commented Apr 18, 2024

@tischi - yes, changing n5Dataset to a non-empty string fixes the paths (now "path":"s0" etc). It couldn't then open it from the test though, I guess because the location is now "src/test/tmp/test.zarr/image"

@tischi
Copy link
Contributor Author

tischi commented Apr 18, 2024

And what happens if you put an empty string into the Fiji UI and save it there?

@K-Meech
Copy link
Contributor

K-Meech commented Apr 18, 2024

If the dataset is empty in Fiji, then it writes an ome-zarr with wrong paths again "path":"..\\..s0"

@axtimwalde
Copy link

containerroot=/Users/tischer/Desktop means that /Users/tischer/Desktop is your Zarr container. This works but is likely not what you want. dataset being empty creating ..\\..s0 would be a bug. @bogovicj will have a look.

@bogovicj
Copy link

bogovicj commented Apr 18, 2024

I'm testing this now, but it will be tricky (for me right now) because I'm not on a windows machine, and @cmhulbert has an idea of what's causing this.

A side comment: overwrite=true is pretty dangerous especially if the containing you're writing into is your desktop. (It will delete any folders that it will write into)

p.s. thanks for identifying this issue

@tischi
Copy link
Contributor Author

tischi commented Apr 18, 2024

A side comment: overwrite=true is pretty dangerous especially if the containing you're writing into is your desktop. (It will delete any folders that it will write into)

Oh wow...thanks for letting me know!

@bogovicj
Copy link

bogovicj commented Apr 19, 2024

This issue on windows might be (probably is?) fixed by the latest n5-universe (1.4.3-SNAPSHOT). I made a test that was failing on the windows build but not the ubuntu build that now works for both (see this PR.

@K-Meech , if you have a chance to try it, please let me know if it behaves better

@K-Meech
Copy link
Contributor

K-Meech commented Apr 22, 2024

All tests pass on Windows now - thanks @bogovicj ! The paths are written correctly now like "path":"s0"

@K-Meech K-Meech mentioned this issue Apr 28, 2024
@tischi
Copy link
Contributor Author

tischi commented Jun 14, 2024

@K-Meech could you close this if it can be closed?

@K-Meech
Copy link
Contributor

K-Meech commented Jun 14, 2024

All good from my side! I'll close the issue.

@K-Meech K-Meech closed this as completed Jun 14, 2024
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

7 participants