Skip to content

Commit

Permalink
Check for ilastik image dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
tischi committed Mar 15, 2024
1 parent 1ff8296 commit 0da95dc
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<groupId>org.embl.mobie</groupId>
<artifactId>mobie-viewer-fiji</artifactId>
<version>4.4.1</version>
<version>4.4.2</version>

<!-- force javadoc generation to fetch errors: -->
<!-- mvn javadoc:javadoc | grep error -->
Expand Down Expand Up @@ -85,7 +85,7 @@

<bigdataviewer-playground.version>0.8.0</bigdataviewer-playground.version>
<imagej-utils.version>0.6.9</imagej-utils.version>
<mobie-io.version>2.2.5</mobie-io.version>
<mobie-io.version>2.2.6</mobie-io.version>
<trove.version>1.0.2</trove.version>
<annotations.version>16.0.2</annotations.version>

Expand Down
12 changes: 10 additions & 2 deletions src/main/java/org/embl/mobie/lib/MoBIEHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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 );
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/embl/mobie/lib/source/Metadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
*/
package org.embl.mobie.lib.source;

import IceInternal.Ex;
import ij.IJ;
import ij.ImagePlus;
import ij.plugin.ContrastEnhancer;
Expand All @@ -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()
Expand Down
17 changes: 17 additions & 0 deletions src/test/java/debug/DebugOpen3DIlastikImage.java
Original file line number Diff line number Diff line change
@@ -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();
}
}

0 comments on commit 0da95dc

Please sign in to comment.