Skip to content

Commit

Permalink
Add examples for opening OMEZarr
Browse files Browse the repository at this point in the history
  • Loading branch information
tischi committed Jul 6, 2024
1 parent f2a21d4 commit fc0bc6b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/test/java/develop/OMEZarrSavingSpeed.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
12 changes: 12 additions & 0 deletions src/test/java/examples/N5ViewerExample.java
Original file line number Diff line number Diff line change
@@ -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 );
}
}
32 changes: 32 additions & 0 deletions src/test/java/examples/OpenOMEZarrExample.java
Original file line number Diff line number Diff line change
@@ -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());
}
}

0 comments on commit fc0bc6b

Please sign in to comment.