Package bdv.util

Class MipmapTransforms


  • public class MipmapTransforms
    extends Object
    • Constructor Detail

      • MipmapTransforms

        public MipmapTransforms()
    • Method Detail

      • getMipmapTransformDefault

        public static net.imglib2.realtransform.AffineTransform3D getMipmapTransformDefault​(double[] resolution)
        Compute the transformation (scale and shift) that maps from coordinates in a down-scaled image to coordinates in the original image. This assumes that each down-scaled pixel is the average of a block of blocks of pixels in the original image. For down-scaling by a factor of 2, pixel (0,0,0) in the down-scaled image is the average of the 8 pixel block from (0,0,0) to (1,1,1) in the original image.
        Parameters:
        resolution - the down-scaling factors in each dimension. {4,4,2} means every pixel in the down-scaled image corresponds to a 4x4x2 pixel block in the original image.
        Returns:
        transformation from down-scaled image to original image.
      • getVoxelScreenSize

        public static double getVoxelScreenSize​(net.imglib2.realtransform.AffineTransform3D screenTransform,
                                                Source<?> source,
                                                int timepoint,
                                                int mipmapIndex)
        Compute the projected voxel size at the given screen transform and mipmap level of a Source. Take a source voxel (0,0,0)-(1,1,1) at the given mipmap level and transform it to the screen image at the given screen scale. Take the maximum of the screen extends of the transformed projected voxel edges.
        Parameters:
        screenTransform - transforms screen coordinates to global coordinates.
        source - the source
        timepoint - for which timepoint to query the source
        mipmapIndex - mipmap level
        Returns:
        pixel size
      • getPixelSourceSize

        public static double[] getPixelSourceSize​(net.imglib2.realtransform.AffineTransform3D screenTransform,
                                                  Source<?> source,
                                                  int timepoint,
                                                  int mipmapIndex)
        Compute the size of the backprojected screen pixel in the Source space. Take a screen pixel (0,0)-(1,1) and transform it into the source coordinate system at the given mipmap level and screen scale, then compute the length of the resulting vectors.
        Parameters:
        screenTransform - transforms screen coordinates to global coordinates.
        source - the source
        timepoint - for which timepoint to query the source
        mipmapIndex - mipmap level
        Returns:
        pixel size
      • getBestMipMapLevel

        public static int getBestMipMapLevel​(net.imglib2.realtransform.AffineTransform3D screenTransform,
                                             Source<?> source,
                                             int timepoint)
        Get the mipmap level that best matches the given screen scale for the given source. Assumes that mipmap indices in the source are ordered by decreasing resolution.
        Parameters:
        screenTransform - transforms screen coordinates to global coordinates.
        source - the source
        timepoint - for which timepoint to query the source
        Returns:
        index of the best-matching mipmap level