Package bdv.export

Class ProposeMipmaps


  • public class ProposeMipmaps
    extends Object
    Propose number of mipmap levels, as well subsampling factors and chunk size for each level.

    Choice of proposed chunksize is not based on any hard benchmark data currently. Chunk sizes are proposed such that chunks have power-of-two side lengths, are roughly square in world space, and contain close to (but not more than) a specified number of elements (4096 by default). It is very likely that more efficient choices can be found by manual tuning, depending on hardware and use case.

    Author:
    Tobias Pietzsch
    • Constructor Detail

      • ProposeMipmaps

        public ProposeMipmaps()
    • Method Detail

      • proposeMipmaps

        public static ExportMipmapInfo proposeMipmaps​(mpicbg.spim.data.generic.sequence.BasicViewSetup setup)
        Propose number of mipmap levels as well subsampling factors and chunk size for each level, based on the image and voxel size of the given setup. Chunks contain close to (but not more than) 4096 elements.
        Parameters:
        setup -
        Returns:
        proposed mipmap settings
      • proposeMipmaps

        public static ExportMipmapInfo proposeMipmaps​(mpicbg.spim.data.generic.sequence.BasicViewSetup setup,
                                                      int maxNumElements)
        Propose number of mipmap levels as well subsampling factors and chunk size for each level, based on the image and voxel size of the given setup. Chunk sizes are proposed such that chunks have power-of-two side lengths, are roughly square in world space, and contain close to (but not more than) maxNumElements.
        Parameters:
        setup -
        maxNumElements -
        Returns:
        proposed mipmap settings
      • getArrayString

        public static String getArrayString​(int[][] resolutions)
        Format in[][] array, such as resolutions or chunksizes definition, as a String (to be used in export dialog textfields).
      • normalizeVoxelSize

        public static void normalizeVoxelSize​(double[] size)
        Adjust voxelSize such that the smallest dimension is 1.0
        Parameters:
        size -
      • suggestPoTBlockSize

        public static int[] suggestPoTBlockSize​(double[] voxelSize,
                                                int maxNumElements)
        Propose block size such that
        1. each dimension is power-of-two,
        2. number of elements is as big as possible, but not larger than maxNumElements
        3. and the block (scaled by the voxelSize) is as close to square as possible given constraints 1 and 2.
      • suggestPoTBlockSize

        public static int[] suggestPoTBlockSize​(double[] voxelSize,
                                                long[] size,
                                                int maxNumElements)
        Propose block size such that
        1. each dimension is power-of-two,
        2. number of elements is as big as possible, but not larger than maxNumElements
        3. and the block (scaled by the voxelSize) is as close to square as possible given constraints 1 and 2.
        Additionally, the full size[] of the image limits the number of bits spent in a particular dimension. For example, if size[2] = 3, then resulting block size will not exceed 4 in the Z dimension.