- java.lang.Object
-
- bdv.export.WriteSequenceToHdf5
-
public class WriteSequenceToHdf5 extends Object
Create a hdf5 files containing image data from all views and all timepoints in a chunked, mipmaped representation.Every image is stored in multiple resolutions. The resolutions are described as int[] arrays defining multiple of original pixel size in every dimension. For example {1,1,1} is the original resolution, {4,4,2} is downsampled by factor 4 in X and Y and factor 2 in Z. Each resolution of the image is stored as a chunked three-dimensional array (each chunk corresponds to one cell of a
CellImgwhen the data is loaded). The chunk sizes are defined by the subdivisions parameter which is an array of int[], one per resolution. Each int[] array describes the X,Y,Z chunk size for one resolution. For instance {32,32,8} says that the (downsampled) image is divided into 32x32x8 pixel blocks.For every mipmap level we have a (3D) int[] resolution array, so the full mipmap pyramid is specified by a nested int[][] array. Likewise, we have a (3D) int[] subdivions array for every mipmap level, so the full chunking of the full pyramid is specfied by a nested int[][] array.
A data-set can be stored in a single hdf5 file or split across several hdf5 "partitions" with one master hdf5 linking into the partitions.
- Author:
- Tobias Pietzsch
-
-
Constructor Summary
Constructors Constructor Description WriteSequenceToHdf5()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static voidwriteHdf5File(mpicbg.spim.data.generic.sequence.AbstractSequenceDescription<?,?,?> seq, int[][] resolutions, int[][] subdivisions, boolean deflate, File hdf5File, ExportScalePyramid.LoopbackHeuristic loopbackHeuristic, ExportScalePyramid.AfterEachPlane afterEachPlane, int numCellCreatorThreads, ProgressWriter progressWriter)Create a hdf5 file containing image data from all views and all timepoints in a chunked, mipmaped representation.static voidwriteHdf5File(mpicbg.spim.data.generic.sequence.AbstractSequenceDescription<?,?,?> seq, Map<Integer,ExportMipmapInfo> perSetupMipmapInfo, boolean deflate, File hdf5File, ExportScalePyramid.LoopbackHeuristic loopbackHeuristic, ExportScalePyramid.AfterEachPlane afterEachPlane, int numCellCreatorThreads, ProgressWriter progressWriter)Create a hdf5 file containing image data from all views and all timepoints in a chunked, mipmaped representation.static voidwriteHdf5PartitionFile(mpicbg.spim.data.generic.sequence.AbstractSequenceDescription<?,?,?> seq, Map<Integer,ExportMipmapInfo> perSetupMipmapInfo, boolean deflate, Partition partition, ExportScalePyramid.LoopbackHeuristic loopbackHeuristic, ExportScalePyramid.AfterEachPlane afterEachPlane, int numCellCreatorThreads, ProgressWriter progressWriter)Create a hdf5 partition file containing image data for a subset of views and timepoints in a chunked, mipmaped representation.static voidwriteHdf5PartitionLinkFile(mpicbg.spim.data.generic.sequence.AbstractSequenceDescription<?,?,?> seq, Map<Integer,ExportMipmapInfo> perSetupMipmapInfo)Create a hdf5 master file linking to image data from all views and all timepoints.static voidwriteHdf5PartitionLinkFile(mpicbg.spim.data.generic.sequence.AbstractSequenceDescription<?,?,?> seq, Map<Integer,ExportMipmapInfo> perSetupMipmapInfo, ArrayList<Partition> partitions, File hdf5File)Create a hdf5 master file linking to image data from all views and all timepoints.static voidwriteViewToHdf5PartitionFile(net.imglib2.RandomAccessibleInterval<net.imglib2.type.numeric.integer.UnsignedShortType> img, int timepointIdPartition, int setupIdPartition, ExportMipmapInfo mipmapInfo, boolean writeMipmapInfo, boolean deflate, bdv.export.Hdf5BlockWriterThread writerQueue, ExecutorService executorService, int numThreads, ExportScalePyramid.LoopbackHeuristic loopbackHeuristic, ExportScalePyramid.AfterEachPlane afterEachPlane, ProgressWriter progressWriter)Deprecated.static voidwriteViewToHdf5PartitionFile(net.imglib2.RandomAccessibleInterval<net.imglib2.type.numeric.integer.UnsignedShortType> img, Partition partition, int timepointIdPartition, int setupIdPartition, ExportMipmapInfo mipmapInfo, boolean writeMipmapInfo, boolean deflate, ExportScalePyramid.LoopbackHeuristic loopbackHeuristic, ExportScalePyramid.AfterEachPlane afterEachPlane, int numCellCreatorThreads, ProgressWriter progressWriter)Deprecated.static <T extends net.imglib2.type.numeric.RealType<T> & net.imglib2.type.NativeType<T>>
voidwriteViewToHdf5PartitionFile(net.imglib2.RandomAccessibleInterval<T> img, T type, int timepointIdPartition, int setupIdPartition, ExportMipmapInfo mipmapInfo, boolean writeMipmapInfo, boolean deflate, bdv.export.Hdf5BlockWriterThread writerQueue, ExecutorService executorService, int numThreads, ExportScalePyramid.LoopbackHeuristic loopbackHeuristic, ExportScalePyramid.AfterEachPlane afterEachPlane, ProgressWriter progressWriter)Write a single view to a hdf5 partition file, in a chunked, mipmaped representation.
-
-
-
Method Detail
-
writeHdf5File
public static void writeHdf5File(mpicbg.spim.data.generic.sequence.AbstractSequenceDescription<?,?,?> seq, Map<Integer,ExportMipmapInfo> perSetupMipmapInfo, boolean deflate, File hdf5File, ExportScalePyramid.LoopbackHeuristic loopbackHeuristic, ExportScalePyramid.AfterEachPlane afterEachPlane, int numCellCreatorThreads, ProgressWriter progressWriter)
Create a hdf5 file containing image data from all views and all timepoints in a chunked, mipmaped representation.- Parameters:
seq- description of the sequence to be stored as hdf5. (TheAbstractSequenceDescriptioncontains the number of setups and timepoints as well as anBasicImgLoaderthat provides the image data, Registration information is not needed here, that will go into the accompanying xml).perSetupMipmapInfo- this maps from setupidtoExportMipmapInfofor that setup. TheExportMipmapInfocontains for each mipmap level, the subsampling factors and subdivision block sizes.deflate- whether to compress the data with the HDF5 DEFLATE filter.hdf5File- hdf5 file to which the image data is written.loopbackHeuristic- heuristic to decide whether to create each resolution level by reading pixels from the original image or by reading back a finer resolution level already written to the hdf5. may be null (in this case always use the original image).afterEachPlane- this is called after each "plane of chunks" is written, giving the opportunity to clear caches, etc.numCellCreatorThreads- The number of threads that will be instantiated to generate cell data. Must be at least 1. (In addition the cell creator threads there is one writer thread that saves the generated data to HDF5.)progressWriter- completion ratio and status output will be directed here.
-
writeHdf5File
public static void writeHdf5File(mpicbg.spim.data.generic.sequence.AbstractSequenceDescription<?,?,?> seq, int[][] resolutions, int[][] subdivisions, boolean deflate, File hdf5File, ExportScalePyramid.LoopbackHeuristic loopbackHeuristic, ExportScalePyramid.AfterEachPlane afterEachPlane, int numCellCreatorThreads, ProgressWriter progressWriter)
Create a hdf5 file containing image data from all views and all timepoints in a chunked, mipmaped representation. This is the same aswriteHdf5File(AbstractSequenceDescription, Map, boolean, File, LoopbackHeuristic, AfterEachPlane, int, ProgressWriter)except that only one set of supsampling factors and and subdivision blocksizes is given, which is used for allviews.- Parameters:
seq- description of the sequence to be stored as hdf5. (TheAbstractSequenceDescriptioncontains the number of setups and timepoints as well as anBasicImgLoaderthat provides the image data, Registration information is not needed here, that will go into the accompanying xml).resolutions- this nested arrays contains per mipmap level, the subsampling factors.subdivisions- this nested arrays contains per mipmap level, the subdivision block sizes.deflate- whether to compress the data with the HDF5 DEFLATE filter.hdf5File- hdf5 file to which the image data is written.loopbackHeuristic- heuristic to decide whether to create each resolution level by reading pixels from the original image or by reading back a finer resolution level already written to the hdf5. may be null (in this case always use the original image).afterEachPlane- this is called after each "plane of chunks" is written, giving the opportunity to clear caches, etc.numCellCreatorThreads- The number of threads that will be instantiated to generate cell data. Must be at least 1. (In addition the cell creator threads there is one writer thread that saves the generated data to HDF5.)progressWriter- completion ratio and status output will be directed here.
-
writeHdf5PartitionLinkFile
public static void writeHdf5PartitionLinkFile(mpicbg.spim.data.generic.sequence.AbstractSequenceDescription<?,?,?> seq, Map<Integer,ExportMipmapInfo> perSetupMipmapInfo)
Create a hdf5 master file linking to image data from all views and all timepoints. This is the same aswriteHdf5PartitionLinkFile(AbstractSequenceDescription, Map, ArrayList, File), except that the information about the partition files as well as the path of the master file to be written is obtained from theBasicImgLoaderof the sequence, which must be aHdf5ImageLoader.- Parameters:
seq- description of the sequence to be stored as hdf5. (TheAbstractSequenceDescriptioncontains the number of setups and timepoints as well as anBasicImgLoaderthat provides the image data, Registration information is not needed here, that will go into the accompanying xml).perSetupMipmapInfo- this maps from setupidtoExportMipmapInfofor that setup. TheExportMipmapInfocontains for each mipmap level, the subsampling factors and subdivision block sizes.
-
writeHdf5PartitionLinkFile
public static void writeHdf5PartitionLinkFile(mpicbg.spim.data.generic.sequence.AbstractSequenceDescription<?,?,?> seq, Map<Integer,ExportMipmapInfo> perSetupMipmapInfo, ArrayList<Partition> partitions, File hdf5File)
Create a hdf5 master file linking to image data from all views and all timepoints. Which hdf5 files contain which part of the image data is specified in theportitionsparameter. Note that this method only writes the master file containing links. The individual partitions need to be written withwriteHdf5PartitionFile(AbstractSequenceDescription, Map, boolean, Partition, LoopbackHeuristic, AfterEachPlane, int, ProgressWriter).- Parameters:
seq- description of the sequence to be stored as hdf5. (TheAbstractSequenceDescriptioncontains the number of setups and timepoints as well as anBasicImgLoaderthat provides the image data, Registration information is not needed here, that will go into the accompanying xml).perSetupMipmapInfo- this maps from setupidtoExportMipmapInfofor that setup. TheExportMipmapInfocontains for each mipmap level, the subsampling factors and subdivision block sizes.partitions- which parts of the dataset are stored in which files.hdf5File- hdf5 master file to which the image data from the partition files is linked.
-
writeHdf5PartitionFile
public static void writeHdf5PartitionFile(mpicbg.spim.data.generic.sequence.AbstractSequenceDescription<?,?,?> seq, Map<Integer,ExportMipmapInfo> perSetupMipmapInfo, boolean deflate, Partition partition, ExportScalePyramid.LoopbackHeuristic loopbackHeuristic, ExportScalePyramid.AfterEachPlane afterEachPlane, int numCellCreatorThreads, ProgressWriter progressWriter)
Create a hdf5 partition file containing image data for a subset of views and timepoints in a chunked, mipmaped representation. Please note that the description of the full dataset must be given in theseq,perSetupResolutions, andperSetupSubdivisionsparameters. Then only the part described bypartitionwill be written.- Parameters:
seq- description of the sequence to be stored as hdf5. (TheAbstractSequenceDescriptioncontains the number of setups and timepoints as well as anBasicImgLoaderthat provides the image data, Registration information is not needed here, that will go into the accompanying xml).perSetupMipmapInfo- this maps from setupidtoExportMipmapInfofor that setup. TheExportMipmapInfocontains for each mipmap level, the subsampling factors and subdivision block sizes.deflate- whether to compress the data with the HDF5 DEFLATE filter.partition- which part of the dataset to write, and to which file.loopbackHeuristic- heuristic to decide whether to create each resolution level by reading pixels from the original image or by reading back a finer resolution level already written to the hdf5. may be null (in this case always use the original image).afterEachPlane- this is called after each "plane of chunks" is written, giving the opportunity to clear caches, etc.numCellCreatorThreads- The number of threads that will be instantiated to generate cell data. Must be at least 1. (In addition the cell creator threads there is one writer thread that saves the generated data to HDF5.)progressWriter- completion ratio and status output will be directed here.
-
writeViewToHdf5PartitionFile
public static <T extends net.imglib2.type.numeric.RealType<T> & net.imglib2.type.NativeType<T>> void writeViewToHdf5PartitionFile(net.imglib2.RandomAccessibleInterval<T> img, T type, int timepointIdPartition, int setupIdPartition, ExportMipmapInfo mipmapInfo, boolean writeMipmapInfo, boolean deflate, bdv.export.Hdf5BlockWriterThread writerQueue, ExecutorService executorService, int numThreads, ExportScalePyramid.LoopbackHeuristic loopbackHeuristic, ExportScalePyramid.AfterEachPlane afterEachPlane, ProgressWriter progressWriter)
Write a single view to a hdf5 partition file, in a chunked, mipmaped representation. Note that the specified view must not already exist in the partition file!- Parameters:
img- the view to be written.type- pixel typetimepointIdPartition- the timepoint id wrt the partition of the view to be written. The information inpartitionrelates this to timepoint id in the full sequence.setupIdPartition- the setup id wrt the partition of the view to be written. The information inpartitionrelates this to setup id in the full sequence.mipmapInfo- contains for each mipmap level of the setup, the subsampling factors and subdivision block sizes.writeMipmapInfo- whether to write mipmap description for the setup. must be done (at least) once for each setup in the partition.deflate- whether to compress the data with the HDF5 DEFLATE filter.writerQueue- block writing tasks are enqueued here.executorService- executor used for creating (possibly down-sampled) blocks of the view to be written.numThreads-loopbackHeuristic- heuristic to decide whether to create each resolution level by reading pixels from the original image or by reading back a finer resolution level already written to the hdf5. may be null (in this case always use the original image).afterEachPlane- this is called after each "plane of chunks" is written, giving the opportunity to clear caches, etc.progressWriter- completion ratio and status output will be directed here. may be null.
-
writeViewToHdf5PartitionFile
@Deprecated public static void writeViewToHdf5PartitionFile(net.imglib2.RandomAccessibleInterval<net.imglib2.type.numeric.integer.UnsignedShortType> img, Partition partition, int timepointIdPartition, int setupIdPartition, ExportMipmapInfo mipmapInfo, boolean writeMipmapInfo, boolean deflate, ExportScalePyramid.LoopbackHeuristic loopbackHeuristic, ExportScalePyramid.AfterEachPlane afterEachPlane, int numCellCreatorThreads, ProgressWriter progressWriter)
Deprecated.
-
writeViewToHdf5PartitionFile
@Deprecated public static void writeViewToHdf5PartitionFile(net.imglib2.RandomAccessibleInterval<net.imglib2.type.numeric.integer.UnsignedShortType> img, int timepointIdPartition, int setupIdPartition, ExportMipmapInfo mipmapInfo, boolean writeMipmapInfo, boolean deflate, bdv.export.Hdf5BlockWriterThread writerQueue, ExecutorService executorService, int numThreads, ExportScalePyramid.LoopbackHeuristic loopbackHeuristic, ExportScalePyramid.AfterEachPlane afterEachPlane, ProgressWriter progressWriter)
Deprecated.
-
-