public class TransformBuilder<T> extends Object
getEfficientRandomAccessible(Interval, RandomAccessible)
Modifier and Type | Field and Description |
---|---|
protected BoundingBox |
boundingBox
Interval transformed to the currently visited view.
|
protected RandomAccessible<T> |
source
Provides the untransformed random access.
|
protected LinkedList<Transform> |
transforms
List of transforms that have to be applied when wrapping the
source RandomAccess to obtain a RandomAccess in the target
coordinate system. |
Modifier | Constructor and Description |
---|---|
protected |
TransformBuilder(Interval interval,
RandomAccessible<T> randomAccessible)
Create a new TransformBuilder.
|
Modifier and Type | Method and Description |
---|---|
protected RandomAccessible<T> |
build()
Create a sequence of wrapped RandomAccessibles from the
transforms list. |
static <S> RandomAccessible<S> |
getEfficientRandomAccessible(Interval interval,
RandomAccessible<S> randomAccessible)
Get a RandomAccessible which provides RandomAccess to the specified
interval of randomAccessible . |
static boolean |
isComponentMapping(Mixed t) |
static boolean |
isIdentity(Mixed t) |
static boolean |
isSlicing(Mixed t) |
static boolean |
isTranslation(Mixed t) |
protected void |
prependTransform(Transform t)
Prepend a transform to the
transforms list. |
protected void |
simplifyTransforms()
Simplify the
transforms list. |
protected void |
visit(RandomAccessible<T> randomAccessible)
Visit a RandomAccessible (while traversing the view hierarchy).
|
protected void |
visitExtended(ExtendedRandomAccessibleInterval<T,?> randomAccessible)
Visit a ExtendedRandomAccessibleInterval (while traversing the view
hierarchy).
|
protected void |
visitTransformed(TransformedRandomAccessible<T> randomAccessible)
Visit a TransformedRandomAccessible (while traversing the view
hierarchy).
|
protected RandomAccessible<T> |
wrapGenericTransform(RandomAccessible<T> s,
Transform t) |
protected RandomAccessible<T> |
wrapMixedTransform(RandomAccessible<T> s,
MixedTransform t) |
protected RandomAccessible<T> |
wrapSlicingTransform(RandomAccessible<T> s,
SlicingTransform t) |
protected RandomAccessible<T> |
wrapTranslationTransform(RandomAccessible<T> s,
TranslationTransform t) |
protected RandomAccessible<T> source
protected BoundingBox boundingBox
protected LinkedList<Transform> transforms
source
RandomAccess to obtain a RandomAccess in the target
coordinate system.protected TransformBuilder(Interval interval, RandomAccessible<T> randomAccessible)
randomAccessible
, go
down the view hierarchy to the RandomAccessible that will provide the
source RandomAccess into the specified interval
. While traversing
the view hierarchy transforms are collected into the transforms
list. These transforms have to be applied when wrapping the source
RandomAccess to obtain a RandomAccess in the coordinate system of
randomAccessible
.interval
- The interval in which access is needed. This is converted to a
bounding box which is propagated through the transforms down
the view hierarchy.randomAccessible
- public static <S> RandomAccessible<S> getEfficientRandomAccessible(Interval interval, RandomAccessible<S> randomAccessible)
interval
of randomAccessible
.
Create a new TransformBuilder that traverses the view hierarchy starting
from randomAccessible
. build()
an efficient
RandomAccessible by joining and simplifying the collected
transformations.
interval
- The interval in which access is needed.randomAccessible
- protected void prependTransform(Transform t)
transforms
list. Also apply the
transform to boundingBox
, which will be used to specify the
interval for the RandomAccess on the final source (at the end of the view
chain). This is called while traversing the view hierarchy.t
- the transform to add.protected void visit(RandomAccessible<T> randomAccessible)
randomAccessible
is handled by
visitTransformed(TransformedRandomAccessible)
or
visitExtended(ExtendedRandomAccessibleInterval)
when it has the
appropriate type. Otherwise, the traversal stops and
randomAccessible
is set as the source
.randomAccessible
- protected void visitTransformed(TransformedRandomAccessible<T> randomAccessible)
visit(RandomAccessible)
the view's source.randomAccessible
- protected void visitExtended(ExtendedRandomAccessibleInterval<T,?> randomAccessible)
visit(RandomAccessible)
the view's source.
Otherwise, the traversal stops and randomAccessible
is set as the
source
.randomAccessible
- public static boolean isIdentity(Mixed t)
public static boolean isTranslation(Mixed t)
public static boolean isComponentMapping(Mixed t)
public static boolean isSlicing(Mixed t)
protected void simplifyTransforms()
transforms
list. First, concatenate neighboring
transforms if possible. Then, for every Mixed
transform:
TranslationTransform
if it is a pure
translation.
SlicingTransform
if it is a pure slicing.
protected RandomAccessible<T> build()
transforms
list.protected RandomAccessible<T> wrapGenericTransform(RandomAccessible<T> s, Transform t)
protected RandomAccessible<T> wrapMixedTransform(RandomAccessible<T> s, MixedTransform t)
protected RandomAccessible<T> wrapTranslationTransform(RandomAccessible<T> s, TranslationTransform t)
protected RandomAccessible<T> wrapSlicingTransform(RandomAccessible<T> s, SlicingTransform t)
Copyright © 2015–2022 ImgLib2. All rights reserved.