Class Downsampler


  • public final class Downsampler
    extends Object
    2×2 block-averaging downsampler used to build pyramid levels, adapting the averaging scheme of NDTiffStorage.downsample. Produces an image of dimensions ceil(width/2) × ceil(height/2); odd edges average only the available pixels.
    • Method Detail

      • downWidth

        public static int downWidth​(int width)
        Downsampled width for a given source width.
      • downHeight

        public static int downHeight​(int height)
        Downsampled height for a given source height.
      • downsample

        public static Object downsample​(Object pixels,
                                        int width,
                                        int height,
                                        PixelType type)
        Downsample a single plane by 2×2 averaging.
        Parameters:
        pixels - row-major primitive array of width*height elements
        width - source width
        height - source height
        type - pixel type
        Returns:
        a new primitive array of downWidth(width)*downHeight(height) elements