From 6bed6f9bcfc25cfe031ce07bd9865b0e769d99a9 Mon Sep 17 00:00:00 2001 From: Christian Tischer Date: Fri, 7 Jun 2024 16:34:28 +0200 Subject: [PATCH] Improve opening OME-Zarr files as a grid view --- .../mobie/command/open/OpenImageAndLabelsFilesCommand.java | 3 ++- .../mobie/command/open/OpenImageAndLabelsURIsCommand.java | 3 ++- .../open/OpenMultipleImagesAndLabelsFilesCommand.java | 3 ++- .../command/open/OpenMultipleImagesAndLabelsURIsCommand.java | 3 ++- .../java/org/embl/mobie/command/open/OpenTableCommand.java | 3 ++- src/main/java/org/embl/mobie/lib/MoBIEHelper.java | 2 ++ src/test/java/develop/OpenAutoMicTable.java | 5 +++-- .../muscle_patterning_drosophila/OpenTeresaData.java | 3 ++- 8 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/embl/mobie/command/open/OpenImageAndLabelsFilesCommand.java b/src/main/java/org/embl/mobie/command/open/OpenImageAndLabelsFilesCommand.java index 97f89231..936d3456 100644 --- a/src/main/java/org/embl/mobie/command/open/OpenImageAndLabelsFilesCommand.java +++ b/src/main/java/org/embl/mobie/command/open/OpenImageAndLabelsFilesCommand.java @@ -32,6 +32,7 @@ import org.embl.mobie.MoBIESettings; import org.embl.mobie.command.CommandConstants; import org.embl.mobie.command.SpatialCalibration; +import org.embl.mobie.lib.MoBIEHelper; import org.embl.mobie.lib.transform.GridType; import org.scijava.command.Command; import org.scijava.plugin.Parameter; @@ -59,7 +60,7 @@ public class OpenImageAndLabelsFilesCommand implements Command { @Parameter( label = "Spatial Calibration" ) public SpatialCalibration spatialCalibration = SpatialCalibration.FromImage; - @Parameter( label = "Grid type", description = "If the images are different and not too many, use Transformed; otherwise use Stitched for better performance.") + @Parameter( label = "Grid type", description = MoBIEHelper.GRID_TYPE_HELP ) public GridType gridType = GridType.Transformed; @Override diff --git a/src/main/java/org/embl/mobie/command/open/OpenImageAndLabelsURIsCommand.java b/src/main/java/org/embl/mobie/command/open/OpenImageAndLabelsURIsCommand.java index a2c5a63c..05150d4d 100644 --- a/src/main/java/org/embl/mobie/command/open/OpenImageAndLabelsURIsCommand.java +++ b/src/main/java/org/embl/mobie/command/open/OpenImageAndLabelsURIsCommand.java @@ -32,6 +32,7 @@ import org.embl.mobie.MoBIESettings; import org.embl.mobie.command.CommandConstants; import org.embl.mobie.command.SpatialCalibration; +import org.embl.mobie.lib.MoBIEHelper; import org.embl.mobie.lib.transform.GridType; import org.scijava.command.Command; import org.scijava.plugin.Parameter; @@ -57,7 +58,7 @@ public class OpenImageAndLabelsURIsCommand implements Command { @Parameter( label = "Spatial Calibration" ) public SpatialCalibration spatialCalibration = SpatialCalibration.FromImage; - @Parameter( label = "Grid type", description = "If the images are different and not too many, use Transformed; otherwise use Stitched for better performance.") + @Parameter( label = "Grid type", description = MoBIEHelper.GRID_TYPE_HELP ) public GridType gridType = GridType.Transformed; @Override diff --git a/src/main/java/org/embl/mobie/command/open/OpenMultipleImagesAndLabelsFilesCommand.java b/src/main/java/org/embl/mobie/command/open/OpenMultipleImagesAndLabelsFilesCommand.java index 44b87ea0..5b488b4b 100644 --- a/src/main/java/org/embl/mobie/command/open/OpenMultipleImagesAndLabelsFilesCommand.java +++ b/src/main/java/org/embl/mobie/command/open/OpenMultipleImagesAndLabelsFilesCommand.java @@ -32,6 +32,7 @@ import org.embl.mobie.MoBIESettings; import org.embl.mobie.command.CommandConstants; import org.embl.mobie.command.SpatialCalibration; +import org.embl.mobie.lib.MoBIEHelper; import org.embl.mobie.lib.transform.GridType; import org.scijava.command.Command; import org.scijava.plugin.Parameter; @@ -73,7 +74,7 @@ public class OpenMultipleImagesAndLabelsFilesCommand implements Command { @Parameter( label = "Spatial Calibration" ) public SpatialCalibration spatialCalibration = SpatialCalibration.FromImage; - @Parameter( label = "Grid type", description = "If the images are different and not too many, use Transformed; otherwise use Stitched for better performance.") + @Parameter( label = "Grid type", description = MoBIEHelper.GRID_TYPE_HELP ) public GridType gridType = GridType.Transformed; @Override diff --git a/src/main/java/org/embl/mobie/command/open/OpenMultipleImagesAndLabelsURIsCommand.java b/src/main/java/org/embl/mobie/command/open/OpenMultipleImagesAndLabelsURIsCommand.java index 588db033..a51f24d1 100644 --- a/src/main/java/org/embl/mobie/command/open/OpenMultipleImagesAndLabelsURIsCommand.java +++ b/src/main/java/org/embl/mobie/command/open/OpenMultipleImagesAndLabelsURIsCommand.java @@ -32,6 +32,7 @@ import org.embl.mobie.MoBIESettings; import org.embl.mobie.command.CommandConstants; import org.embl.mobie.command.SpatialCalibration; +import org.embl.mobie.lib.MoBIEHelper; import org.embl.mobie.lib.transform.GridType; import org.scijava.command.Command; import org.scijava.plugin.Parameter; @@ -72,7 +73,7 @@ public class OpenMultipleImagesAndLabelsURIsCommand implements Command { @Parameter( label = "Spatial Calibration" ) public SpatialCalibration spatialCalibration = SpatialCalibration.FromImage; - @Parameter( label = "Grid type", description = "If the images are different and not too many, use Transformed; otherwise use Stitched for better performance.") + @Parameter( label = "Grid type", description = MoBIEHelper.GRID_TYPE_HELP ) public GridType gridType = GridType.Transformed; @Override diff --git a/src/main/java/org/embl/mobie/command/open/OpenTableCommand.java b/src/main/java/org/embl/mobie/command/open/OpenTableCommand.java index b762cedd..a9779279 100644 --- a/src/main/java/org/embl/mobie/command/open/OpenTableCommand.java +++ b/src/main/java/org/embl/mobie/command/open/OpenTableCommand.java @@ -33,6 +33,7 @@ import org.embl.mobie.MoBIESettings; import org.embl.mobie.command.CommandConstants; import org.embl.mobie.command.SpatialCalibration; +import org.embl.mobie.lib.MoBIEHelper; import org.embl.mobie.lib.transform.GridType; import org.scijava.command.Command; import org.scijava.plugin.Parameter; @@ -74,7 +75,7 @@ public class OpenTableCommand implements Command { @Parameter( label = "Spatial Calibration" ) public SpatialCalibration spatialCalibration = SpatialCalibration.FromImage; - @Parameter( label = "Grid type", description = "If the images are different and not too many, use \"Transformed\"; otherwise use \"Stitched\" for better performance.") + @Parameter( label = "Grid type", description = MoBIEHelper.GRID_TYPE_HELP ) public GridType gridType = GridType.Transformed; @Override diff --git a/src/main/java/org/embl/mobie/lib/MoBIEHelper.java b/src/main/java/org/embl/mobie/lib/MoBIEHelper.java index 7d44494f..0e7aad12 100644 --- a/src/main/java/org/embl/mobie/lib/MoBIEHelper.java +++ b/src/main/java/org/embl/mobie/lib/MoBIEHelper.java @@ -62,6 +62,8 @@ public abstract class MoBIEHelper { + public static final String GRID_TYPE_HELP = "If the images are different and not too many, use Transformed; otherwise use Stitched for better performance."; + static { net.imagej.patcher.LegacyInjector.preinit(); } public static String print(double[] array, int numSignificantDigits) { diff --git a/src/test/java/develop/OpenAutoMicTable.java b/src/test/java/develop/OpenAutoMicTable.java index 6340cfa2..1501586d 100644 --- a/src/test/java/develop/OpenAutoMicTable.java +++ b/src/test/java/develop/OpenAutoMicTable.java @@ -29,6 +29,7 @@ package develop; import net.imagej.ImageJ; +import org.embl.mobie.command.open.OpenTableCommand; import org.embl.mobie.lib.transform.GridType; import java.io.File; @@ -40,7 +41,7 @@ public static void main( String[] args ) final ImageJ imageJ = new ImageJ(); imageJ.ui().showUI(); - OpenTableAdvancedCommand command = new OpenTableAdvancedCommand(); + OpenTableCommand command = new OpenTableCommand(); //command.table = new File( "/Volumes/almf/group/Aliaksandr/User_data/Furlong_CrispR/test_data_20231018/20231004/20231004-172458/summary_calculated1.txt" ); //command.table = new File( "/Volumes/almf/group/Aliaksandr/User_data/Furlong_CrispR/test_data_20231018/20231004/20231004-172458/summary_calculated1_subset.txt" ); command.table = new File( "/Users/tischer/Desktop/teresa/summary_calculated1_subset.txt" ); @@ -48,7 +49,7 @@ public static void main( String[] args ) //command.images = "Result.Image.Zarr"; // Result.Image.Zarr command.root = command.table.getParentFile(); command.images = "FileName_Result.Image_IMG"; // Result.Image.Zarr - command.gridType = GridType.Transformed; // FIXME: not working with Stitched! + command.gridType = GridType.Transformed; command.run(); } } diff --git a/src/test/java/projects/muscle_patterning_drosophila/OpenTeresaData.java b/src/test/java/projects/muscle_patterning_drosophila/OpenTeresaData.java index 35344ba4..6810024b 100644 --- a/src/test/java/projects/muscle_patterning_drosophila/OpenTeresaData.java +++ b/src/test/java/projects/muscle_patterning_drosophila/OpenTeresaData.java @@ -29,6 +29,7 @@ package projects.muscle_patterning_drosophila; import net.imagej.ImageJ; +import org.embl.mobie.command.open.OpenTableCommand; import org.embl.mobie.lib.transform.GridType; import java.io.File; @@ -40,7 +41,7 @@ public static void main( String[] args ) final ImageJ imageJ = new ImageJ(); imageJ.ui().showUI(); - OpenTableAdvancedCommand command = new OpenTableAdvancedCommand(); + OpenTableCommand command = new OpenTableCommand(); //command.table = new File( "/Volumes/almf/group/Aliaksandr/User_data/Furlong_CrispR/test_data_20231018/20231004/20231004-172458/summary_calculated1.txt" ); //command.table = new File( "/Volumes/almf/group/Aliaksandr/User_data/Furlong_CrispR/test_data_20231018/20231004/20231004-172458/summary_calculated1_subset.txt" ); command.table = new File( "/Users/tischer/Desktop/teresa/summary_calculated1_subset.txt" );