public class MixedTransform extends AbstractMixedTransform implements Concatenable<Mixed>, PreConcatenable<Mixed>
It transform a n-dimensional source vector to a m-dimensional target vector, and can be represented as a m+1 × n+1 homogeneous matrix. The mixed transform can be decomposed as follows:
The project down and component permutation steps are 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!
Modifier and Type | Field and Description |
---|---|
protected int[] |
component
for each component of the target vector (before translation).
|
protected boolean[] |
invert
for each component of the target vector (before translation).
|
protected int |
numSourceDimensions
dimension of source vector.
|
protected long[] |
translation
translation is added to the target vector after applying permutation,
projection, inversion operations.
|
protected boolean[] |
zero
for each component of the target vector (before translation).
|
numTargetDimensions
Constructor and Description |
---|
MixedTransform(int sourceDim,
int targetDim) |
Modifier and Type | Method and Description |
---|---|
void |
apply(int[] source,
int[] target)
Apply the
Transform to a source vector to obtain a target vector. |
void |
apply(Localizable source,
Positionable target)
|
void |
apply(long[] source,
long[] target)
Apply the
Transform to a source vector to obtain a target vector. |
MixedTransform |
concatenate(Mixed t)
Concatenate this object with a.
|
void |
getComponentInversion(boolean[] invert)
Get an array indicating for each target component, whether the source
component it is taken from should be inverted.
|
boolean |
getComponentInversion(int d)
Get the d-th component of inversion vector (see
Mixed.getComponentInversion(boolean[]) ). |
int |
getComponentMapping(int d)
Get the source dimension which is mapped to the d-th target dimension
(see
Mixed.getComponentMapping(int[]) ). |
void |
getComponentMapping(int[] component)
Get an array indicating for each target dimensions from which source
dimension it is taken.
|
void |
getComponentZero(boolean[] zero)
Get a boolean array indicating which target dimensions are _not_ taken
from source dimensions.
|
boolean |
getComponentZero(int d)
Get the d-th component of zeroing vector (see
Mixed.getComponentZero(boolean[]) ). |
Class<Mixed> |
getConcatenableClass() |
double[][] |
getMatrix()
Get the matrix that transforms homogeneous source points to homogeneous
target points.
|
Class<Mixed> |
getPreConcatenableClass() |
long |
getTranslation(int d)
Get the d-th component of translation (see
Mixed.getTranslation(long[]) ). |
void |
getTranslation(long[] t)
Get the translation.
|
boolean |
hasFullSourceMapping()
Check whether the transforms has a full mapping of source to target
components (no source component is discarded).
|
int |
numSourceDimensions()
Returns n, the dimension of the source vector.
|
MixedTransform |
preConcatenate(Mixed t)
Pre-concatenate this object with a.
|
void |
set(Mixed transform)
set parameters to
transform . |
void |
setComponentInversion(boolean[] invert)
Set for each target component, whether the source component it is taken
from should be inverted.
|
void |
setComponentMapping(int[] component)
Set for each target dimensions from which source dimension it is taken.
|
void |
setComponentZero(boolean[] zero)
Set which target dimensions are _not_ taken from source dimensions.
|
void |
setInverseTranslation(long[] tinv) |
void |
setTranslation(long[] t) |
numTargetDimensions, transform
protected final int numSourceDimensions
protected final long[] translation
protected final boolean[] zero
protected final boolean[] invert
protected final int[] component
public int numSourceDimensions()
Transform
numSourceDimensions
in interface Transform
numSourceDimensions
in class AbstractMixedTransform
public void getTranslation(long[] t)
Mixed
getTranslation
in interface Mixed
getTranslation
in class AbstractMixedTransform
t
- array of size at least the target dimension to store the
result.public long getTranslation(int d)
Mixed
Mixed.getTranslation(long[])
).getTranslation
in interface Mixed
getTranslation
in class AbstractMixedTransform
public void setTranslation(long[] t)
public void setInverseTranslation(long[] tinv)
public void getComponentZero(boolean[] zero)
Mixed
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]
getComponentZero
in interface Mixed
getComponentZero
in class AbstractMixedTransform
zero
- array of size at least the target dimension to store the
result.public boolean getComponentZero(int d)
Mixed
Mixed.getComponentZero(boolean[])
).getComponentZero
in interface Mixed
getComponentZero
in class AbstractMixedTransform
public void setComponentZero(boolean[] zero)
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]
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).public void getComponentMapping(int[] component)
Mixed
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[])
.
getComponentMapping
in interface Mixed
getComponentMapping
in class AbstractMixedTransform
component
- array of size at least the target dimension to store the
result.public int getComponentMapping(int d)
Mixed
Mixed.getComponentMapping(int[])
).getComponentMapping
in interface Mixed
getComponentMapping
in class AbstractMixedTransform
public void setComponentMapping(int[] component)
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 component
array such that
a source component is mapped to several target components!
component
- array that says for each component of the target vector
(before translation) from which source vector component it
should be taken.public void getComponentInversion(boolean[] invert)
Mixed
For instance, if rotating a 2D (x,y) coordinates by 180 degrees will map it to (-x,-y). In this case, the result will be [true, true].
getComponentInversion
in interface Mixed
getComponentInversion
in class AbstractMixedTransform
invert
- array of size at least the target dimension to store the
result.public boolean getComponentInversion(int d)
Mixed
Mixed.getComponentInversion(boolean[])
).getComponentInversion
in interface Mixed
getComponentInversion
in class AbstractMixedTransform
public void setComponentInversion(boolean[] invert)
For instance, if rotating a 2D (x,y) coordinates by 180 degrees will map it to (-x,-y). In this case, this will be [true, true].
invert
- array that says for each component of the target vector
(before translation) whether the source vector component it is
taken from should be inverted (true).public void apply(long[] source, long[] target)
Transform
Transform
to a source vector to obtain a target vector.public void apply(int[] source, int[] target)
Transform
Transform
to a source vector to obtain a target vector.public void apply(Localizable source, Positionable target)
Transform
public MixedTransform concatenate(Mixed t)
Concatenable
concatenate
in interface Concatenable<Mixed>
public Class<Mixed> getConcatenableClass()
getConcatenableClass
in interface Concatenable<Mixed>
public MixedTransform preConcatenate(Mixed t)
PreConcatenable
preConcatenate
in interface PreConcatenable<Mixed>
public Class<Mixed> getPreConcatenableClass()
getPreConcatenableClass
in interface PreConcatenable<Mixed>
public void set(Mixed transform)
transform
.transform
- public double[][] getMatrix()
public boolean hasFullSourceMapping()
Copyright © 2015–2022 ImgLib2. All rights reserved.