Package net.imglib2.blocks
Class PlanarImgRangeCopier<T>
- java.lang.Object
-
- net.imglib2.blocks.PlanarImgRangeCopier<T>
-
- Type Parameters:
T- a primitive array type, e.g.,byte[].
- All Implemented Interfaces:
RangeCopier<T>
class PlanarImgRangeCopier<T> extends java.lang.Object implements RangeCopier<T>
Does the actual copying work from aPlanarImginto a primitive array.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classPlanarImgRangeCopier.SliceAccess<T>
-
Field Summary
Fields Modifier and Type Field Description private int[]cdimsprivate int[]cstepsprivate int[]doffsetsprivate int[]dstepsprivate RangesfindRangesprivate int[]lengthsprivate MemCopy<T>memCopyprivate intnprivate Toobprivate Ranges.Range[]rangesprivate java.util.List<Ranges.Range>[]rangesPerDimensionprivate PlanarImgRangeCopier.SliceAccess<T>sliceAccessprivate int[]srcDims
-
Constructor Summary
Constructors Modifier Constructor Description privatePlanarImgRangeCopier(PlanarImgRangeCopier<T> copier)PlanarImgRangeCopier(PlanarImg<?,?> planarImg, Ranges findRanges, MemCopy<T> memCopy, T oob)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcopy(long[] srcPos, T dest, int[] size)Copy the block starting atsrcPoswith the givensizeinto the (appropriately sized)destarray.private voidcopy(T dest, int d)Iterate therangesPerDimensionlist for the given dimensiondand recursively call itself for iterating dimensiond-1.private voidcopyRanges(T dest)Once we get here,setupDestSize(int[])andupdateRange(int)for all dimensions have been called, so thedsteps,doffsets,cdims, andlengthsfields have been appropriately set up for the current Range combination.private voidcopyRangesRecursively(T src, int srcPos, T dest, int destPos, int d)(package private) voidfillRanges(T dest, int dConst)Once we get here,setupDestSize(int[])andupdateRange(int)for all dimensions have been called, so thedsteps,doffsets,cdims, andlengthsfields have been appropriately set up for the current Range combination.private voidfillRangesRecursively(T dest, int destPos, int d, int dConst)PlanarImgRangeCopier<T>newInstance()Return a new independent instance of thisRangeCopier.private voidsetupDestSize(int[] size)private voidupdateRange(int d)
-
-
-
Field Detail
-
n
private final int n
-
sliceAccess
private final PlanarImgRangeCopier.SliceAccess<T> sliceAccess
-
srcDims
private final int[] srcDims
-
findRanges
private final Ranges findRanges
-
oob
private final T oob
-
rangesPerDimension
private final java.util.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
-
-
Method Detail
-
newInstance
public PlanarImgRangeCopier<T> newInstance()
Description copied from interface:RangeCopierReturn a new independent instance of thisRangeCopier. This is used for multi-threading. The new instance works on the same source image, but has independent internal state.- Specified by:
newInstancein interfaceRangeCopier<T>- Returns:
- new independent instance of this
RangeCopier
-
copy
public void copy(long[] srcPos, T dest, int[] size)Copy the block starting atsrcPoswith the givensizeinto the (appropriately sized)destarray.This finds the src range lists for all dimensions and then calls
copy(Object, int)to iterate all range combinations.- Specified by:
copyin interfaceRangeCopier<T>- Parameters:
srcPos- min coordinates of block to copy from src Img.dest- destination array. Type isbyte[],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)
Iterate therangesPerDimensionlist for the given dimensiondand recursively call itself for iterating dimensiond-1.- Parameters:
dest- destination array. Type isbyte[],float[], etc, corresponding to the src Img's native type.d- current dimension. This method calls itself recursively withd-1untild==0is 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[])andupdateRange(int)for all dimensions have been called, so thedsteps,doffsets,cdims, andlengthsfields have been appropriately set up for the current Range combination. AlsocellAccessis 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[])andupdateRange(int)for all dimensions have been called, so thedsteps,doffsets,cdims, andlengthsfields have been appropriately set up for the current Range combination. AlsocellAccessis positioned on the corresponding cell.
-
fillRangesRecursively
private void fillRangesRecursively(T dest, int destPos, int d, int dConst)
-
-