From 020a185ead3a2e124eca8dd648ea6816dc011ef3 Mon Sep 17 00:00:00 2001 From: tpietzsch Date: Fri, 1 Mar 2024 10:03:01 +0100 Subject: [PATCH] Remove obsolete check for UnsignedShortType when exporting to HDF5 --- .../java/bdv/export/WriteSequenceToHdf5.java | 60 ++++++++----------- 1 file changed, 24 insertions(+), 36 deletions(-) diff --git a/src/main/java/bdv/export/WriteSequenceToHdf5.java b/src/main/java/bdv/export/WriteSequenceToHdf5.java index 13b90b61..298714e9 100644 --- a/src/main/java/bdv/export/WriteSequenceToHdf5.java +++ b/src/main/java/bdv/export/WriteSequenceToHdf5.java @@ -28,6 +28,30 @@ */ package bdv.export; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.function.Function; + +import org.janelia.saalfeldlab.n5.ByteArrayDataBlock; +import org.janelia.saalfeldlab.n5.Compression; +import org.janelia.saalfeldlab.n5.DataBlock; +import org.janelia.saalfeldlab.n5.DataType; +import org.janelia.saalfeldlab.n5.DatasetAttributes; +import org.janelia.saalfeldlab.n5.DoubleArrayDataBlock; +import org.janelia.saalfeldlab.n5.FloatArrayDataBlock; +import org.janelia.saalfeldlab.n5.GzipCompression; +import org.janelia.saalfeldlab.n5.IntArrayDataBlock; +import org.janelia.saalfeldlab.n5.LongArrayDataBlock; +import org.janelia.saalfeldlab.n5.RawCompression; +import org.janelia.saalfeldlab.n5.ShortArrayDataBlock; + import bdv.export.ExportScalePyramid.AfterEachPlane; import bdv.export.ExportScalePyramid.Block; import bdv.export.ExportScalePyramid.DatasetIO; @@ -38,19 +62,8 @@ import bdv.img.n5.DataTypeProperties; import bdv.spimdata.SequenceDescriptionMinimal; import ch.systemsx.cisd.hdf5.HDF5Factory; -import ch.systemsx.cisd.hdf5.HDF5IntStorageFeatures; import ch.systemsx.cisd.hdf5.IHDF5Reader; import ch.systemsx.cisd.hdf5.IHDF5Writer; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.function.Function; import mpicbg.spim.data.XmlHelpers; import mpicbg.spim.data.generic.sequence.AbstractSequenceDescription; import mpicbg.spim.data.generic.sequence.BasicImgLoader; @@ -61,28 +74,11 @@ import mpicbg.spim.data.sequence.ViewId; import net.imglib2.Dimensions; import net.imglib2.RandomAccessibleInterval; -import net.imglib2.cache.img.SingleCellArrayImg; import net.imglib2.img.cell.CellImg; import net.imglib2.type.NativeType; import net.imglib2.type.numeric.RealType; import net.imglib2.type.numeric.integer.UnsignedShortType; import net.imglib2.util.Cast; -import net.imglib2.util.Intervals; -import org.janelia.saalfeldlab.n5.ByteArrayDataBlock; -import org.janelia.saalfeldlab.n5.Compression; -import org.janelia.saalfeldlab.n5.DataBlock; -import org.janelia.saalfeldlab.n5.DataType; -import org.janelia.saalfeldlab.n5.DatasetAttributes; -import org.janelia.saalfeldlab.n5.DoubleArrayDataBlock; -import org.janelia.saalfeldlab.n5.FloatArrayDataBlock; -import org.janelia.saalfeldlab.n5.GzipCompression; -import org.janelia.saalfeldlab.n5.IntArrayDataBlock; -import org.janelia.saalfeldlab.n5.LongArrayDataBlock; -import org.janelia.saalfeldlab.n5.N5Writer; -import org.janelia.saalfeldlab.n5.RawCompression; -import org.janelia.saalfeldlab.n5.ShortArrayDataBlock; - -import static net.imglib2.util.Util.long2int; /** * Create a hdf5 files containing image data from all views and all timepoints @@ -398,14 +394,6 @@ public static void writeHdf5PartitionFile( // get the BasicImgLoader that supplies the images final BasicImgLoader imgLoader = seq.getImgLoader(); - for ( final BasicViewSetup setup : seq.getViewSetupsOrdered() ) { - final Object type = imgLoader.getSetupImgLoader( setup.getId() ).getImageType(); - if ( !( type instanceof UnsignedShortType ) ) - throw new IllegalArgumentException( "Expected BasicImgLoader but your dataset has BasicImgLoader<" - + type.getClass().getSimpleName() + ">.\nCurrently writing to HDF5 is only supported for UnsignedShortType." ); - } - - // open HDF5 partition output file final File hdf5File = new File( partition.getPath() ); if ( hdf5File.exists() )