Class CellImgRangeCopier<T>

java.lang.Object
net.imglib2.blocks.CellImgRangeCopier<T>
Type Parameters:
T - a primitive array type, e.g., byte[].
All Implemented Interfaces:
RangeCopier<T>

class CellImgRangeCopier<T> extends Object implements RangeCopier<T>
Does the actual copying work from an AbstractCellImg into a primitive array.
  • Field Details

    • n

      private final int n
    • cellGrid

      private final CellGrid cellGrid
    • cellAccess

      private final RandomAccess<? extends Cell<?>> cellAccess
    • srcDims

      private final long[] srcDims
    • findRanges

      private final Ranges findRanges
    • memCopy

      private final MemCopy<T> memCopy
    • oob

      private final T oob
    • rangesPerDimension

      private final List<Ranges.Range>[] rangesPerDimension
    • ranges

      private final Ranges.Range[] ranges
    • dsteps

      private final int[] dsteps
    • doffsets

      private final int[] doffsets
    • cdims

      private final int[] cdims
    • csteps

      private final int[] csteps
    • lengths

      private final int[] lengths
  • Constructor Details

  • Method Details

    • newInstance

      public CellImgRangeCopier<T> newInstance()
      Description copied from interface: RangeCopier
      Return a new independent instance of this RangeCopier. This is used for multi-threading. The new instance works on the same source image, but has independent internal state.
      Specified by:
      newInstance in interface RangeCopier<T>
      Returns:
      new independent instance of this RangeCopier
    • copy

      public void copy(long[] srcPos, T dest, int[] size)
      Copy the block starting at srcPos with the given size into the (appropriately sized) dest array.

      This finds the src range lists for all dimensions and then calls copy(Object, int) to iterate all range combinations.

      Specified by:
      copy in interface RangeCopier<T>
      Parameters:
      srcPos - min coordinates of block to copy from src Img.
      dest - destination array. Type is byte[], float[], etc, corresponding to the src Img's native type.
      size - dimensions of block to copy from src Img.
    • copy

      private void copy(T dest, int d)
      Iterates the rangesPerDimension list for the given dimension d and recursively calls itself for iterating dimension d-1.
      Parameters:
      dest - destination array. Type is byte[], float[], etc, corresponding to the src Img's native type.
      d - current dimension. This method calls itself recursively with d-1 until d==0 is reached.
    • setupDestSize

      private void setupDestSize(int[] size)
    • updateRange

      private void updateRange(int d)
    • copyRanges

      private void copyRanges(T dest)
      Once we get here, setupDestSize(int[]) and updateRange(int) for all dimensions have been called, so the dsteps, doffsets, cdims, and lengths fields have been appropriately set up for the current Range combination. Also cellAccess is positioned on the corresponding cell.
    • copyRangesRecursively

      private void copyRangesRecursively(T src, int srcPos, T dest, int destPos, int d)
    • fillRanges

      void fillRanges(T dest, int dConst)
      Once we get here, setupDestSize(int[]) and updateRange(int) for all dimensions have been called, so the dsteps, doffsets, cdims, and lengths fields have been appropriately set up for the current Range combination. Also cellAccess is positioned on the corresponding cell.
    • fillRangesRecursively

      private void fillRangesRecursively(T dest, int destPos, int d, int dConst)