Class SlicingTransform
- java.lang.Object
-
- net.imglib2.transform.integer.AbstractMixedTransform
-
- net.imglib2.transform.integer.SlicingTransform
-
- All Implemented Interfaces:
Concatenable<Slicing>,PreConcatenable<Slicing>,BoundingBoxTransform,Mixed,Slicing,Transform
public class SlicingTransform extends AbstractMixedTransform implements Slicing, Concatenable<Slicing>, PreConcatenable<Slicing>
Map the components of the source vector to a slice of the target space, for instance transform (x,y) to (x,C,y) where C is a constant.A
SlicingTransformtransform a n-dimensional source vector to a m-dimensional target vector, where m ≥ n. It can be represented as a m+1 × n+1 homogeneous matrix. TheSlicingTransformcan be decomposed as follows:- component permutation
- project up and position (add constant components in the target vector)
The component permutation step is implemented by the
component mapping. This is a lookup array that specifies for each target dimension from which source dimension it is taken. Note, that it is not allowed to set this array such that a source component is mapped to several target components!
-
-
Field Summary
Fields Modifier and Type Field Description protected int[]componentspecifies for each component of the target vector from which source vector component should it be taken.protected intnumSourceDimensionsdimension of source vector.protected long[]translationtranslation is added to the target vector after applying the permutation and project-up operations.protected boolean[]zerofor each component of the target vector (before translation).-
Fields inherited from class net.imglib2.transform.integer.AbstractMixedTransform
numTargetDimensions
-
-
Constructor Summary
Constructors Constructor Description SlicingTransform(int sourceDim, int targetDim)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(int[] source, int[] target)Apply theTransformto a source vector to obtain a target vector.voidapply(long[] source, long[] target)Apply theTransformto a source vector to obtain a target vector.voidapply(Localizable source, Positionable target)SlicingTransformconcatenate(Slicing t)Concatenate this object with a.intgetComponentMapping(int d)Get the source dimension which is mapped to the d-th target dimension (seeMixed.getComponentMapping(int[])).voidgetComponentMapping(int[] component)Get an array indicating for each target dimensions from which source dimension it is taken.voidgetComponentZero(boolean[] zero)Get a boolean array indicating which target dimensions are _not_ taken from source dimensions.booleangetComponentZero(int d)Get the d-th component of zeroing vector (seeMixed.getComponentZero(boolean[])).java.lang.Class<Slicing>getConcatenableClass()double[][]getMatrix()Get the matrix that transforms homogeneous source points to homogeneous target points.java.lang.Class<Slicing>getPreConcatenableClass()longgetTranslation(int d)Get the d-th component of translation (seeMixed.getTranslation(long[])).voidgetTranslation(long[] t)Get the translation.booleanhasFullSourceMapping()Check whether the transforms has a full mapping of source to target components (no source component is discarded).intnumSourceDimensions()Returns n, the dimension of the source vector.SlicingTransformpreConcatenate(Slicing t)Pre-concatenate this object with a.voidset(Slicing transform)set parameters totransform.voidsetComponentMapping(int[] component)Set for each target dimensions from which source dimension it is taken.voidsetComponentZero(boolean[] zero)Set which target dimensions are _not_ taken from source dimensions.voidsetTranslation(long[] t)-
Methods inherited from class net.imglib2.transform.integer.AbstractMixedTransform
getComponentInversion, getComponentInversion, numTargetDimensions, transform
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.imglib2.transform.integer.BoundingBoxTransform
transform
-
Methods inherited from interface net.imglib2.transform.integer.Mixed
getComponentInversion, getComponentInversion
-
Methods inherited from interface net.imglib2.transform.Transform
numTargetDimensions
-
-
-
-
Field Detail
-
numSourceDimensions
protected final int numSourceDimensions
dimension of source vector.
-
zero
protected final boolean[] zero
for each component of the target vector (before translation). should the value be taken from a source vector component (false) or should it be zero (true).
-
translation
protected final long[] translation
translation is added to the target vector after applying the permutation and project-up operations. Only translation values for dimensions that have not been assigned a source vector component are used. For instance, if you project (x,y) to (x,y,z) only the translation value for z is used.
-
component
protected final int[] component
specifies for each component of the target vector from which source vector component should it be taken.
-
-
Method Detail
-
numSourceDimensions
public int numSourceDimensions()
Description copied from interface:TransformReturns n, the dimension of the source vector.- Specified by:
numSourceDimensionsin interfaceTransform- Overrides:
numSourceDimensionsin classAbstractMixedTransform- Returns:
- the dimension of the source vector.
-
getTranslation
public void getTranslation(long[] t)
Description copied from interface:MixedGet the translation. Translation is added to the target vector after applying permutation, projection, inversion operations.- Specified by:
getTranslationin interfaceMixed- Overrides:
getTranslationin classAbstractMixedTransform- Parameters:
t- array of size at least the target dimension to store the result.
-
getTranslation
public long getTranslation(int d)
Description copied from interface:MixedGet the d-th component of translation (seeMixed.getTranslation(long[])).- Specified by:
getTranslationin interfaceMixed- Overrides:
getTranslationin classAbstractMixedTransform
-
setTranslation
public void setTranslation(long[] t)
-
getComponentZero
public void getComponentZero(boolean[] zero)
Description copied from interface:MixedGet a boolean array indicating which target dimensions are _not_ taken from source dimensions.For instance, if the transform maps 2D (x,y) coordinates to the first two components of a 3D (x,y,z) coordinate, the result will be [false, false, true]
- Specified by:
getComponentZeroin interfaceMixed- Overrides:
getComponentZeroin classAbstractMixedTransform- Parameters:
zero- array of size at least the target dimension to store the result.
-
getComponentZero
public boolean getComponentZero(int d)
Description copied from interface:MixedGet the d-th component of zeroing vector (seeMixed.getComponentZero(boolean[])).- Specified by:
getComponentZeroin interfaceMixed- Overrides:
getComponentZeroin classAbstractMixedTransform
-
setComponentZero
public void setComponentZero(boolean[] zero)
Set which target dimensions are _not_ taken from source dimensions.For instance, if the transform maps 2D (x,y) coordinates to the first two components of a 3D (x,y,z) coordinate, this will be [false, false, true]
- Parameters:
zero- array that says for each component of the target vector (before translation) whether the value should be taken from a source vector component (false) or should be set to zero (true).
-
getComponentMapping
public void getComponentMapping(int[] component)
Description copied from interface:MixedGet an array indicating for each target dimensions from which source dimension it is taken.For instance, if the transform maps 2D (x,y) coordinates to the first two components of a 3D (x,y,z) coordinate, the result will be [0, 1, x]. Here, the value of x is undefined because the third target dimension does not correspond to any source dimension. See
Mixed.getComponentZero(boolean[]).- Specified by:
getComponentMappingin interfaceMixed- Overrides:
getComponentMappingin classAbstractMixedTransform- Parameters:
component- array of size at least the target dimension to store the result.
-
getComponentMapping
public int getComponentMapping(int d)
Description copied from interface:MixedGet the source dimension which is mapped to the d-th target dimension (seeMixed.getComponentMapping(int[])).- Specified by:
getComponentMappingin interfaceMixed- Overrides:
getComponentMappingin classAbstractMixedTransform
-
setComponentMapping
public void setComponentMapping(int[] component)
Set for each target dimensions from which source dimension it is taken.For instance, if the transform maps 2D (x,y) coordinates to the first two components of a 3D (x,y,z) coordinate, this will be [0, 1, x]. Here, x can be any value because the third target dimension does not correspond to any source dimension, which can be realized using
setComponentZero(boolean[]).Note, that it is not allowed to set the
componentarray such that a source component is mapped to several target components!- Parameters:
component- array that says for each component of the target vector (before translation) from which source vector component it should be taken.
-
apply
public void apply(long[] source, long[] target)Description copied from interface:TransformApply theTransformto a source vector to obtain a target vector.
-
apply
public void apply(int[] source, int[] target)Description copied from interface:TransformApply theTransformto a source vector to obtain a target vector.
-
apply
public void apply(Localizable source, Positionable target)
Description copied from interface:Transform
-
concatenate
public SlicingTransform concatenate(Slicing t)
Description copied from interface:ConcatenableConcatenate this object with a. The result will be an object that can be concatenated with another A. The conventional meaning for concatenating transformations is the following: Let ba = b.concatenate(a). Applying ba to x is equivalent to first applying a to x and then applying b to the result.- Specified by:
concatenatein interfaceConcatenable<Slicing>
-
getConcatenableClass
public java.lang.Class<Slicing> getConcatenableClass()
- Specified by:
getConcatenableClassin interfaceConcatenable<Slicing>
-
preConcatenate
public SlicingTransform preConcatenate(Slicing t)
Description copied from interface:PreConcatenablePre-concatenate this object with a. The result will be an object that can be pre-concatenated with another A. The conventional meaning for concatenating transformations is the following: Let ba = a.preConcatenate(b). Applying ba to x is equivalent to first applying a to x and then applying b to the result.- Specified by:
preConcatenatein interfacePreConcatenable<Slicing>
-
getPreConcatenableClass
public java.lang.Class<Slicing> getPreConcatenableClass()
- Specified by:
getPreConcatenableClassin interfacePreConcatenable<Slicing>
-
set
public void set(Slicing transform)
set parameters totransform.- Parameters:
transform-
-
getMatrix
public double[][] getMatrix()
Get the matrix that transforms homogeneous source points to homogeneous target points. For testing purposes.
-
hasFullSourceMapping
public boolean hasFullSourceMapping()
Check whether the transforms has a full mapping of source to target components (no source component is discarded).- Returns:
- whether there is a full mapping of source to target components.
-
-