From fc0bc6b2e39f41835f4b847aee20f79cbd7ca433 Mon Sep 17 00:00:00 2001 From: Christian Tischer Date: Sat, 6 Jul 2024 09:39:48 +0200 Subject: [PATCH] Add examples for opening OMEZarr --- src/test/java/develop/OMEZarrSavingSpeed.java | 2 +- src/test/java/examples/N5ViewerExample.java | 12 +++++++ .../java/examples/OpenOMEZarrExample.java | 32 +++++++++++++++++++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/test/java/examples/N5ViewerExample.java create mode 100644 src/test/java/examples/OpenOMEZarrExample.java diff --git a/src/test/java/develop/OMEZarrSavingSpeed.java b/src/test/java/develop/OMEZarrSavingSpeed.java index 0ac9a23..15f7e5e 100644 --- a/src/test/java/develop/OMEZarrSavingSpeed.java +++ b/src/test/java/develop/OMEZarrSavingSpeed.java @@ -8,7 +8,7 @@ public class OMEZarrSavingSpeed { public static void main( String[] args ) { - int size = 100; + int size = 100; // => 2 s ImagePlus imp = IJ.createImage( "image", size, size, size, 8 ); long start = System.currentTimeMillis(); diff --git a/src/test/java/examples/N5ViewerExample.java b/src/test/java/examples/N5ViewerExample.java new file mode 100644 index 0000000..aa242f3 --- /dev/null +++ b/src/test/java/examples/N5ViewerExample.java @@ -0,0 +1,12 @@ +package examples; + +import org.janelia.saalfeldlab.n5.bdv.N5Viewer; + +public class N5ViewerExample +{ + public static void main( String[] args ) + { + String uri = "/Users/tischer/Downloads/20240524_1_s2.zarr"; + N5Viewer.show( uri ); + } +} diff --git a/src/test/java/examples/OpenOMEZarrExample.java b/src/test/java/examples/OpenOMEZarrExample.java new file mode 100644 index 0000000..1b567bb --- /dev/null +++ b/src/test/java/examples/OpenOMEZarrExample.java @@ -0,0 +1,32 @@ +package examples; + +import bdv.cache.SharedQueue; +import bdv.util.BdvFunctions; +import bdv.viewer.SourceAndConverter; +import org.embl.mobie.io.imagedata.N5ImageData; +import org.jruby.RubyProcess; + +import java.util.List; + +public class OpenOMEZarrExample +{ + public static void main( String[] args ) + { + //String uri = "https://s3.embl.de/imatrec/IMATREC_HiTT_20240414_AS/TAL_20to200_20230627_NA_01_epo_05.ome.zarr"; + String uri = "/Users/tischer/Downloads/20240524_1_s2.zarr"; + + long start = System.currentTimeMillis(); + N5ImageData< ? > imageData = new N5ImageData<>( + uri, + new SharedQueue( Math.max( 1, Runtime.getRuntime().availableProcessors() / 2 ) ) + ); + imageData.getSourcesAndConverters(); // triggers actual opening of the data + System.out.println("Opened " + uri ); + System.out.println("Opening time [ms]: " + (System.currentTimeMillis() - start ) ); + + BdvFunctions.show( + imageData.getSourcesAndConverters(), + imageData.getNumTimepoints(), + imageData.getBdvOptions()); + } +}