Package net.imglib2.view
Class TransformBuilder<T>
java.lang.Object
net.imglib2.view.TransformBuilder<T>
- Direct Known Subclasses:
IterableTransformBuilder
The "brain" of the Views framework. Simplifies View cascades to provide the
most efficient accessor for a specified Interval.
- Author:
- Tobias Pietzsch
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BoundingBox
Interval transformed to the currently visited view.protected RandomAccessible<T>
Provides the untransformed random access.protected LinkedList<Transform>
List of transforms that have to be applied when wrapping thesource
RandomAccess to obtain a RandomAccess in the target coordinate system. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
TransformBuilder
(Interval interval, RandomAccessible<T> randomAccessible) Create a new TransformBuilder. -
Method Summary
Modifier and TypeMethodDescriptionprotected RandomAccessible<T>
build()
Create a sequence of wrapped RandomAccessibles from thetransforms
list.static <S> RandomAccessible<S>
getEfficientRandomAccessible
(Interval interval, RandomAccessible<S> randomAccessible) Get a RandomAccessible which provides RandomAccess to the specifiedinterval
ofrandomAccessible
.static boolean
static boolean
isIdentity
(Mixed t) static boolean
static boolean
protected void
Prepend a transform to thetransforms
list.protected void
Simplify thetransforms
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>
protected RandomAccessible<T>
protected RandomAccessible<T>
protected RandomAccessible<T>
-
Field Details
-
source
Provides the untransformed random access. -
boundingBox
Interval transformed to the currently visited view. null means that the interval is infinite. -
transforms
List of transforms that have to be applied when wrapping thesource
RandomAccess to obtain a RandomAccess in the target coordinate system.
-
-
Constructor Details
-
TransformBuilder
Create a new TransformBuilder. Starting fromrandomAccessible
, go down the view hierarchy to the RandomAccessible that will provide the source RandomAccess into the specifiedinterval
. While traversing the view hierarchy transforms are collected into thetransforms
list. These transforms have to be applied when wrapping the source RandomAccess to obtain a RandomAccess in the coordinate system ofrandomAccessible
.- Parameters:
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
-
-
-
Method Details
-
getEfficientRandomAccessible
public static <S> RandomAccessible<S> getEfficientRandomAccessible(Interval interval, RandomAccessible<S> randomAccessible) Get a RandomAccessible which provides RandomAccess to the specifiedinterval
ofrandomAccessible
.Create a new TransformBuilder that traverses the view hierarchy starting from
randomAccessible
.build()
an efficient RandomAccessible by joining and simplifying the collected transformations.- Parameters:
interval
- The interval in which access is needed.randomAccessible
-
-
prependTransform
Prepend a transform to thetransforms
list. Also apply the transform toboundingBox
, 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.- Parameters:
t
- the transform to add.
-
visit
Visit a RandomAccessible (while traversing the view hierarchy). TherandomAccessible
is handled byvisitTransformed(TransformedRandomAccessible)
orvisitExtended(ExtendedRandomAccessibleInterval)
when it has the appropriate type. Otherwise, the traversal stops andrandomAccessible
is set as thesource
.- Parameters:
randomAccessible
-
-
visitTransformed
Visit a TransformedRandomAccessible (while traversing the view hierarchy). Append the view's transform to the list andvisit(RandomAccessible)
the view's source.- Parameters:
randomAccessible
-
-
visitExtended
Visit a ExtendedRandomAccessibleInterval (while traversing the view hierarchy). If the no out-of-bounds extension is needed for the current bounding box,visit(RandomAccessible)
the view's source. Otherwise, the traversal stops andrandomAccessible
is set as thesource
.- Parameters:
randomAccessible
-
-
isIdentity
-
isTranslation
-
isComponentMapping
-
isSlicing
-
simplifyTransforms
protected void simplifyTransforms()Simplify thetransforms
list. First, concatenate neighboring transforms if possible. Then, for everyMixed
transform:- remove it if it is the identity transforms.
- replace it by a
TranslationTransform
if it is a pure translation. - replace it by a
SlicingTransform
if it is a pure slicing.
-
build
Create a sequence of wrapped RandomAccessibles from thetransforms
list.- Returns:
- RandomAccessible on the interval specified in the constructor.
-
wrapGenericTransform
-
wrapMixedTransform
-
wrapTranslationTransform
protected RandomAccessible<T> wrapTranslationTransform(RandomAccessible<T> s, TranslationTransform t) -
wrapSlicingTransform
-