diff --git a/pom.xml b/pom.xml index 89e4bab9..47416f63 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ org.embl.mobie mobie-viewer-fiji - 4.4.1 + 4.4.2 @@ -85,7 +85,7 @@ 0.8.0 0.6.9 - 2.2.5 + 2.2.6 1.0.2 16.0.2 diff --git a/src/main/java/org/embl/mobie/lib/MoBIEHelper.java b/src/main/java/org/embl/mobie/lib/MoBIEHelper.java index d5a085d5..fe46dc73 100644 --- a/src/main/java/org/embl/mobie/lib/MoBIEHelper.java +++ b/src/main/java/org/embl/mobie/lib/MoBIEHelper.java @@ -35,7 +35,9 @@ import mpicbg.spim.data.SpimDataException; import mpicbg.spim.data.generic.AbstractSpimData; import net.imglib2.Dimensions; +import net.imglib2.RandomAccessibleInterval; import org.embl.mobie.DataStore; +import org.embl.mobie.io.CachedCellImgOpener; import org.embl.mobie.io.ImageDataFormat; import org.embl.mobie.io.SpimDataOpener; import org.embl.mobie.io.github.GitHubUtils; @@ -211,6 +213,7 @@ public static Metadata getMetadataFromImageFile( String path, int channelIndex ) throw new RuntimeException( "Path does not exist: " + path ); } + if ( path.contains( ".zarr" ) ) { try @@ -230,9 +233,14 @@ public static Metadata getMetadataFromImageFile( String path, int channelIndex ) } else if ( path.endsWith( ".h5" ) ) { - return new Metadata(); + CachedCellImgOpener< ? > opener = new CachedCellImgOpener<>( path, ImageDataFormat.IlastikHDF5, ThreadHelper.sharedQueue ); + RandomAccessibleInterval< ? > rai = opener.getRAI( 0 ); + Metadata metadata = new Metadata(); + metadata.numZSlices = (int) rai.dimension( 2 ); + + return metadata; } - else if ( path.endsWith( ".toml" ) ) + if ( path.endsWith( ".toml" ) ) { final ImagePlus imagePlus = new TOMLOpener( path ).asImagePlus(); return new Metadata( imagePlus ); diff --git a/src/main/java/org/embl/mobie/lib/source/Metadata.java b/src/main/java/org/embl/mobie/lib/source/Metadata.java index a583c062..ed7c46bb 100644 --- a/src/main/java/org/embl/mobie/lib/source/Metadata.java +++ b/src/main/java/org/embl/mobie/lib/source/Metadata.java @@ -28,7 +28,6 @@ */ package org.embl.mobie.lib.source; -import IceInternal.Ex; import ij.IJ; import ij.ImagePlus; import ij.plugin.ContrastEnhancer; @@ -43,7 +42,7 @@ public class Metadata public double[] contrastLimits = null; public Integer numTimePoints = null; public Integer numZSlices = 1; - public Integer numChannelsContainer = 1; // in MoBIE each image has jsut one channel, but the container could have multiple + public Integer numChannelsContainer = 1; // in MoBIE each image has just one channel, but the container could have multiple private static boolean logBFError = true; public Metadata() diff --git a/src/test/java/debug/DebugOpen3DIlastikImage.java b/src/test/java/debug/DebugOpen3DIlastikImage.java new file mode 100644 index 00000000..b53c6054 --- /dev/null +++ b/src/test/java/debug/DebugOpen3DIlastikImage.java @@ -0,0 +1,17 @@ +package debug; + +import net.imagej.ImageJ; +import org.embl.mobie.command.open.OpenImageAndLabelsCommand; + +import java.io.File; + +public class DebugOpen3DIlastikImage +{ + public static void main( String[] args ) + { + new ImageJ().ui().showUI(); + OpenImageAndLabelsCommand command = new OpenImageAndLabelsCommand(); + command.image = new File("/Users/tischer/Downloads/export.h5"); + command.run(); + } +}