public class SlicingTransform extends AbstractMixedTransform implements Slicing, Concatenable<Slicing>, PreConcatenable<Slicing>
A SlicingTransform
transform 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. The
SlicingTransform
can be decomposed as follows:
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!
Modifier and Type | Field and Description |
---|---|
protected int[] |
component
specifies for each component of the target vector from which source
vector component should it be taken.
|
protected int |
numSourceDimensions
dimension of source vector.
|
protected long[] |
translation
translation is added to the target vector after applying the permutation
and project-up operations.
|
protected boolean[] |
zero
for each component of the target vector (before translation).
|
numTargetDimensions
Constructor and Description |
---|
SlicingTransform(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. |
SlicingTransform |
concatenate(Slicing t)
Concatenate this object with a.
|
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<Slicing> |
getConcatenableClass() |
double[][] |
getMatrix()
Get the matrix that transforms homogeneous source points to homogeneous
target points.
|
Class<Slicing> |
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.
|
SlicingTransform |
preConcatenate(Slicing t)
Pre-concatenate this object with a.
|
void |
set(Slicing transform)
set parameters to
transform . |
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 |
setTranslation(long[] t) |
getComponentInversion, getComponentInversion, numTargetDimensions, transform
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getComponentInversion, getComponentInversion
numTargetDimensions
transform
protected final int numSourceDimensions
protected final boolean[] zero
protected final long[] translation
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 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 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 SlicingTransform concatenate(Slicing t)
Concatenable
concatenate
in interface Concatenable<Slicing>
public Class<Slicing> getConcatenableClass()
getConcatenableClass
in interface Concatenable<Slicing>
public SlicingTransform preConcatenate(Slicing t)
PreConcatenable
preConcatenate
in interface PreConcatenable<Slicing>
public Class<Slicing> getPreConcatenableClass()
getPreConcatenableClass
in interface PreConcatenable<Slicing>
public void set(Slicing transform)
transform
.transform
- public double[][] getMatrix()
public boolean hasFullSourceMapping()
Copyright © 2015–2022 ImgLib2. All rights reserved.