Package net.imglib2.transform.integer
Class ComponentMappingTransform
- java.lang.Object
-
- net.imglib2.transform.integer.AbstractMixedTransform
-
- net.imglib2.transform.integer.ComponentMappingTransform
-
- All Implemented Interfaces:
Concatenable<ComponentMapping>
,PreConcatenable<ComponentMapping>
,BoundingBoxTransform
,ComponentMapping
,Mixed
,Transform
public class ComponentMappingTransform extends AbstractMixedTransform implements ComponentMapping, Concatenable<ComponentMapping>, PreConcatenable<ComponentMapping>
Map the components of the source vector to obtain the target vector, for instance transform (x,y,z) to (x,z,y).The intended use of ComponentMapping is as a dimension permutation. The mapping is implemented as a inverse lookup, i.e., every component of the target is read from a source component. Note, that it is not allowed to set this array such that a source component is mapped to several target components!
- Author:
- Tobias Pietzsch
-
-
Field Summary
Fields Modifier and Type Field Description protected int[]
component
for each component of the target vector: from which source vector component should it be taken.-
Fields inherited from class net.imglib2.transform.integer.AbstractMixedTransform
numTargetDimensions
-
-
Constructor Summary
Constructors Constructor Description ComponentMappingTransform(int targetDim)
ComponentMappingTransform(int[] component)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(int[] source, int[] target)
Apply theTransform
to a source vector to obtain a target vector.void
apply(long[] source, long[] target)
Apply theTransform
to a source vector to obtain a target vector.void
apply(Localizable source, Positionable target)
ComponentMappingTransform
concatenate(ComponentMapping t)
Concatenate this object with a.int
getComponentMapping(int d)
Get the source dimension which is mapped to the d-th target dimension (seeMixed.getComponentMapping(int[])
).void
getComponentMapping(int[] component)
Get an array indicating for each target dimensions from which source dimension it is taken.java.lang.Class<ComponentMapping>
getConcatenableClass()
double[][]
getMatrix()
Get the matrix that transforms homogeneous source points to homogeneous target points.java.lang.Class<ComponentMapping>
getPreConcatenableClass()
ComponentMappingTransform
preConcatenate(ComponentMapping t)
Pre-concatenate this object with a.void
setComponentMapping(int[] component)
Set for each target dimensions from which source dimension it is taken.-
Methods inherited from class net.imglib2.transform.integer.AbstractMixedTransform
getComponentInversion, getComponentInversion, getComponentZero, getComponentZero, getTranslation, getTranslation, numSourceDimensions, 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, getComponentZero, getComponentZero, getTranslation, getTranslation
-
Methods inherited from interface net.imglib2.transform.Transform
numSourceDimensions, numTargetDimensions
-
-
-
-
Constructor Detail
-
ComponentMappingTransform
public ComponentMappingTransform(int targetDim)
-
ComponentMappingTransform
public ComponentMappingTransform(int[] component)
- Parameters:
component
- array specifying for each component of the target vector from which source vector component should it be taken.
-
-
Method Detail
-
getComponentMapping
public void getComponentMapping(int[] component)
Description copied from interface:Mixed
Get 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:
getComponentMapping
in interfaceMixed
- Overrides:
getComponentMapping
in 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:Mixed
Get the source dimension which is mapped to the d-th target dimension (seeMixed.getComponentMapping(int[])
).- Specified by:
getComponentMapping
in interfaceMixed
- Overrides:
getComponentMapping
in 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 3D (x,y,z) coordinates to 2D (z,x,y) coordinate this will be [2, 0, 1].
- Parameters:
component
- array that says for each component of the target vector from which source vector component it should be taken.
-
getMatrix
public double[][] getMatrix()
Description copied from interface:Mixed
Get the matrix that transforms homogeneous source points to homogeneous target points. For testing purposes.
-
apply
public void apply(long[] source, long[] target)
Description copied from interface:Transform
Apply theTransform
to a source vector to obtain a target vector.
-
apply
public void apply(int[] source, int[] target)
Description copied from interface:Transform
Apply theTransform
to a source vector to obtain a target vector.
-
apply
public void apply(Localizable source, Positionable target)
Description copied from interface:Transform
-
concatenate
public ComponentMappingTransform concatenate(ComponentMapping t)
Description copied from interface:Concatenable
Concatenate 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:
concatenate
in interfaceConcatenable<ComponentMapping>
-
getConcatenableClass
public java.lang.Class<ComponentMapping> getConcatenableClass()
- Specified by:
getConcatenableClass
in interfaceConcatenable<ComponentMapping>
-
preConcatenate
public ComponentMappingTransform preConcatenate(ComponentMapping t)
Description copied from interface:PreConcatenable
Pre-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:
preConcatenate
in interfacePreConcatenable<ComponentMapping>
-
getPreConcatenableClass
public java.lang.Class<ComponentMapping> getPreConcatenableClass()
- Specified by:
getPreConcatenableClass
in interfacePreConcatenable<ComponentMapping>
-
-