Skip to content

Commit

Permalink
Update OMEZarrWriterTest
Browse files Browse the repository at this point in the history
  • Loading branch information
tischi committed May 14, 2024
1 parent 44fab8a commit 16a5cb2
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 18 deletions.
49 changes: 32 additions & 17 deletions src/main/java/org/embl/mobie/io/OMEZarrWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@
import ij.ImagePlus;
import mpicbg.spim.data.generic.sequence.BasicViewSetup;
import org.embl.mobie.io.util.IOHelper;
import org.janelia.saalfeldlab.n5.N5URI;
import org.janelia.saalfeldlab.n5.ij.N5Importer;
import org.janelia.saalfeldlab.n5.ij.N5ScalePyramidExporter;

import java.net.URISyntaxException;

import static org.janelia.saalfeldlab.n5.ij.N5ScalePyramidExporter.GZIP_COMPRESSION;
import static org.janelia.saalfeldlab.n5.ij.N5ScalePyramidExporter.ZARR_FORMAT;

Expand All @@ -57,9 +60,37 @@ public static void write( ImagePlus imp, String uri, ImageType imageType, boolea

String chunkSizeArg = imp.getNSlices() == 1 ? "1024,1024,1,1,1" : "96,96,1,96,1"; // X,Y,C,Z,T


try
{
N5URI n5URI = new N5URI( uri );
String containerPath = n5URI.getContainerPath();
String groupPath = n5URI.getGroupPath();
int a = 1;

N5ScalePyramidExporter exporter = new N5ScalePyramidExporter(
imp,
containerPath,
groupPath,
ZARR_FORMAT,
chunkSizeArg,
true,
downsampleMethod,
N5Importer.MetadataOmeZarrKey,
GZIP_COMPRESSION
);

exporter.setOverwrite( overwrite );
exporter.run();
}
catch ( URISyntaxException e )
{
throw new RuntimeException( e );
}

// TODO: If we want to give the dataset a name we also have to
// update how we refer to such an image or segmentation in the dataset.JSON
String n5Dataset = "";
// String n5Dataset = "";
// String n5Dataset = imageType.equals( ImageType.Labels ) ? "labels" : "intensities";
// if ( imageType.equals( ImageType.Labels ) )
// {
Expand All @@ -69,22 +100,6 @@ public static void write( ImagePlus imp, String uri, ImageType imageType, boolea
// {
// uri = IOHelper.combinePath( uri, "intensities" );
// }

N5ScalePyramidExporter exporter = new N5ScalePyramidExporter(
imp,
uri,
n5Dataset,
ZARR_FORMAT,
chunkSizeArg,
true,
downsampleMethod,
N5Importer.MetadataOmeZarrKey,
GZIP_COMPRESSION
);

exporter.setOverwrite( overwrite );

exporter.run();
}

}
1 change: 1 addition & 0 deletions src/main/java/org/embl/mobie/io/imagedata/N5ImageData.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.janelia.saalfeldlab.n5.universe.metadata.N5Metadata;
import org.janelia.saalfeldlab.n5.universe.metadata.canonical.CanonicalDatasetMetadata;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/embl/mobie/io/OMEZarrWriterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void writeAndReadOMEZarr()
{
ImagePlus imp = IJ.createImage( "test", "8-bit ramp", 186, 226, 27 );

String uri = "src/test/tmp/test.zarr";
String uri = "src/test/tmp/test.zarr/image";

OMEZarrWriter.write( imp,
uri,
Expand Down

0 comments on commit 16a5cb2

Please sign in to comment.