Package net.imglib2.view
Class Views
- java.lang.Object
-
- net.imglib2.view.Views
-
public class Views extends java.lang.Object
Create light-weight views intoRandomAccessibles
. A view is itself aRandomAccessible
orRandomAccessibleInterval
that providesaccessors
that transform coordinates on-the-fly without copying the underlying data. Consecutive transformations are concatenated and simplified to provide optimally efficient accessors. Note, that accessors provided by a view are read/write. Changing pixels in a view changes the underlying image data.- Author:
- Tobias Pietzsch, Stephan Saalfeld, Philipp Hanslovsky
-
-
Constructor Summary
Constructors Constructor Description Views()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <T> MixedTransformView<T>
addDimension(RandomAccessible<T> randomAccessible)
Create view which adds a dimension to the sourceRandomAccessible
.static <T> IntervalView<T>
addDimension(RandomAccessibleInterval<T> interval, long minOfNewDim, long maxOfNewDim)
Create view which adds a dimension to the sourceRandomAccessibleInterval
.static <T> CompositeView<T,? extends GenericComposite<T>>
collapse(RandomAccessible<T> source)
Collapse the nth dimension of an n -dimensionalRandomAccessible
<T> into an (n -1)-dimensionalRandomAccessible
<GenericComposite
<T>>static <T> CompositeIntervalView<T,? extends GenericComposite<T>>
collapse(RandomAccessibleInterval<T> source)
Collapse the nth dimension of an n -dimensionalRandomAccessibleInterval
<T> into an ( n-1)-dimensionalRandomAccessibleInterval
<GenericComposite
<T>>static <T extends NumericType<T>>
CompositeView<T,NumericComposite<T>>collapseNumeric(RandomAccessible<T> source, int numChannels)
Collapse the nth dimension of an n -dimensionalRandomAccessible
<T extendsNumericType
<T>> into an (n-1)-dimensionalRandomAccessible
<NumericComposite
<T>>static <T extends NumericType<T>>
CompositeIntervalView<T,NumericComposite<T>>collapseNumeric(RandomAccessibleInterval<T> source)
Collapse the nth dimension of an n -dimensionalRandomAccessibleInterval
<T extendsNumericType
<T>> into an (n-1)-dimensionalRandomAccessibleInterval
<NumericComposite
<T>>static <T extends RealType<T>>
CompositeView<T,RealComposite<T>>collapseReal(RandomAccessible<T> source, int numChannels)
Collapse the nth dimension of an n -dimensionalRandomAccessible
<T extendsRealType
<T>> into an (n-1)-dimensionalRandomAccessible
<RealComposite
<T>>static <T extends RealType<T>>
CompositeIntervalView<T,RealComposite<T>>collapseReal(RandomAccessibleInterval<T> source)
Collapse the nth dimension of an n -dimensionalRandomAccessibleInterval
<T extendsRealType
<T>> into an (n-1)-dimensionalRandomAccessibleInterval
<RealComposite
<T>>static <T> RandomAccessibleInterval<T>
concatenate(int concatenationAxis, java.util.List<? extends RandomAccessibleInterval<T>> sources)
Concatenate a list ofRandomAccessibleInterval
along the providedconcatenationAxis
.static <T> RandomAccessibleInterval<T>
concatenate(int concatenationAxis, RandomAccessibleInterval<T>... sources)
Concatenate an array ofRandomAccessibleInterval
along the providedconcatenationAxis
.static <T> RandomAccessibleInterval<T>
concatenate(int concatenationAxis, StackView.StackAccessMode mode, java.util.List<? extends RandomAccessibleInterval<T>> sources)
Concatenate a list ofRandomAccessibleInterval
along the providedconcatenationAxis
.static <T> RandomAccessibleInterval<T>
concatenate(int concatenationAxis, StackView.StackAccessMode mode, RandomAccessibleInterval<T>... sources)
Concatenate an array ofRandomAccessibleInterval
along the providedconcatenationAxis
.static <T> RandomAccessibleInterval<T>
dropSingletonDimensions(RandomAccessibleInterval<T> source)
Removes all unit dimensions (dimensions with size one) from the RandomAccessibleIntervalstatic <T,F extends RandomAccessibleInterval<T>>
IntervalView<T>expand(F source, OutOfBoundsFactory<T,? super F> oob, long... border)
Expand a RandomAccessibleInterval as specified by border.static <T> IntervalView<T>
expandBorder(RandomAccessibleInterval<T> source, long... border)
Expand a RandomAccessibleInterval as specified by border.static <T> IntervalView<T>
expandMirrorDouble(RandomAccessibleInterval<T> source, long... border)
Expand a RandomAccessibleInterval as specified by border.static <T> IntervalView<T>
expandMirrorSingle(RandomAccessibleInterval<T> source, long... border)
Expand a RandomAccessibleInterval as specified by border.static <T> IntervalView<T>
expandPeriodic(RandomAccessibleInterval<T> source, long... border)
Expand a RandomAccessibleInterval as specified by border.static <T extends RealType<T>>
IntervalView<T>expandRandom(RandomAccessibleInterval<T> source, double min, double max, long... border)
Expand a RandomAccessibleInterval as specified by border.static <T extends Type<T>>
IntervalView<T>expandValue(RandomAccessibleInterval<T> source, T t, long... border)
Expand a RandomAccessibleInterval as specified by border.static <T extends NumericType<T>>
IntervalView<T>expandZero(RandomAccessibleInterval<T> source, long... border)
Expand a RandomAccessibleInterval as specified by border.static <T,F extends RandomAccessibleInterval<T>>
ExtendedRandomAccessibleInterval<T,F>extend(F source, OutOfBoundsFactory<T,? super F> factory)
Extend a RandomAccessibleInterval with an out-of-bounds strategy.static <T,F extends RandomAccessibleInterval<T>>
ExtendedRandomAccessibleInterval<T,F>extendBorder(F source)
Extend a RandomAccessibleInterval with an out-of-bounds strategy to repeat border pixels.static <T,F extends RandomAccessibleInterval<T>>
ExtendedRandomAccessibleInterval<T,F>extendMirrorDouble(F source)
Extend a RandomAccessibleInterval with a mirroring out-of-bounds strategy.static <T,F extends RandomAccessibleInterval<T>>
ExtendedRandomAccessibleInterval<T,F>extendMirrorSingle(F source)
Extend a RandomAccessibleInterval with a mirroring out-of-bounds strategy.static <T,F extends RandomAccessibleInterval<T>>
ExtendedRandomAccessibleInterval<T,F>extendPeriodic(F source)
Extend a RandomAccessibleInterval with a periodic out-of-bounds strategy.static <T extends RealType<T>,F extends RandomAccessibleInterval<T>>
ExtendedRandomAccessibleInterval<T,F>extendRandom(F source, double min, double max)
Extend a RandomAccessibleInterval with a random-value out-of-bounds strategy.static <T extends Type<T>,F extends RandomAccessibleInterval<T>>
ExtendedRandomAccessibleInterval<T,F>extendValue(F source, T value)
Extend a RandomAccessibleInterval with a constant-value out-of-bounds strategy.static <T extends NumericType<T>,F extends RandomAccessibleInterval<T>>
ExtendedRandomAccessibleInterval<T,F>extendZero(F source)
Extend a RandomAccessibleInterval with a constant-value out-of-bounds strategy where the constant value is the zero-element of the data type.static <T> IterableInterval<T>
flatIterable(RandomAccessibleInterval<T> randomAccessibleInterval)
Return anIterableInterval
havingFlatIterationOrder
.static <T> MixedTransformView<T>
hyperSlice(RandomAccessible<T> view, int d, long pos)
take a (n-1)-dimensional slice of a n-dimensional view, fixing d-component of coordinates to pos.static <T> IntervalView<T>
hyperSlice(RandomAccessibleInterval<T> view, int d, long pos)
take a (n-1)-dimensional slice of a n-dimensional view, fixing d-component of coordinates to pos.static <T> RandomAccessible<? extends RandomAccessible<T>>
hyperSlices(RandomAccessible<T> source, int... axes)
Provide an (n + m)-dimensionalRandomAccessible
of T as an m-dimensionalRandomAccessible
of n-dimensionalRandomAccessibles
of T.static <T,F extends EuclideanSpace>
RealRandomAccessible<T>interpolate(F source, InterpolatorFactory<T,F> factory)
Returns aRealRandomAccessible
using interpolationstatic <T> IntervalView<T>
interval(RandomAccessible<T> randomAccessible, long[] min, long[] max)
Define an interval on a RandomAccessible.static <T> IntervalView<T>
interval(RandomAccessible<T> randomAccessible, Interval interval)
Define an interval on a RandomAccessible.static <T> MixedTransformView<T>
invertAxis(RandomAccessible<T> randomAccessible, int d)
Invert the d-axis.static <T> IntervalView<T>
invertAxis(RandomAccessibleInterval<T> interval, int d)
Invert the d-axis.static boolean
isZeroMin(Interval interval)
test whether the source interval starts at (0,0,...,0)static <T> IterableInterval<T>
iterable(RandomAccessibleInterval<T> randomAccessibleInterval)
Return anIterableInterval
.static <T> MixedTransformView<T>
offset(RandomAccessible<T> randomAccessible, long... offset)
Translate such that pixel at offset in randomAccessible is at the origin in the resulting view.static <T> IntervalView<T>
offset(RandomAccessibleInterval<T> interval, long... offset)
Translate such that pixel at offset in interval is at the origin in the resulting view.static <T> IntervalView<T>
offsetInterval(RandomAccessible<T> randomAccessible, long[] offset, long[] dimension)
Define an interval on a RandomAccessible and translate it such that the min corner is at the origin.static <T> IntervalView<T>
offsetInterval(RandomAccessible<T> randomAccessible, Interval interval)
Define an interval on a RandomAccessible and translate it such that the min corner is at the origin.static <A,B>
RandomAccessible<Pair<A,B>>pair(RandomAccessible<A> sourceA, RandomAccessible<B> sourceB)
static <T> MixedTransformView<T>
permute(RandomAccessible<T> randomAccessible, int fromAxis, int toAxis)
Create view with permuted axes.static <T> IntervalView<T>
permute(RandomAccessibleInterval<T> interval, int fromAxis, int toAxis)
Create view with permuted axes.static <T> IntervalView<T>
permuteCoordinateInverse(RandomAccessibleInterval<T> source, int[] permutation, int d)
Deprecated.static <T> IntervalView<T>
permuteCoordinates(RandomAccessibleInterval<T> source, int[] permutation)
Bijective permutation of the integer coordinates in each dimension of aRandomAccessibleInterval
.static <T> IntervalView<T>
permuteCoordinates(RandomAccessibleInterval<T> source, int[] permutation, int d)
Bijective permutation of the integer coordinates of one dimension of aRandomAccessibleInterval
.static <T> IntervalView<T>
permuteCoordinatesInverse(RandomAccessibleInterval<T> source, int[] permutation)
Inverse Bijective permutation of the integer coordinates in each dimension of aRandomAccessibleInterval
.static <T> IntervalView<T>
permuteCoordinatesInverse(RandomAccessibleInterval<T> source, int[] permutation, int d)
Inverse bijective permutation of the integer coordinates of one dimension of aRandomAccessibleInterval
.static <T> RandomAccessibleOnRealRandomAccessible<T>
raster(RealRandomAccessible<T> source)
Turns aRealRandomAccessible
into aRandomAccessible
, providingRandomAccess
at integer coordinates.static <T> MixedTransformView<T>
rotate(RandomAccessible<T> randomAccessible, int fromAxis, int toAxis)
Create view that is rotated by 90 degrees.static <T> IntervalView<T>
rotate(RandomAccessibleInterval<T> interval, int fromAxis, int toAxis)
Create view that is rotated by 90 degrees.static <T> TransformView<T>
shear(RandomAccessible<T> source, int shearDimension, int referenceDimension)
Positive shear transform of a RandomAccessible usingShearTransform
, i.e.static <T> IntervalView<T>
shear(RandomAccessible<T> source, Interval interval, int shearDimension, int referenceDimension)
Positive shear transform of a RandomAccessible usingShearTransform
, i.e.static <T> RandomAccessibleInterval<T>
stack(java.util.List<? extends RandomAccessibleInterval<T>> hyperslices)
Form a (n+1)-dimensionalRandomAccessibleInterval
by stacking n-dimensionalRandomAccessibleInterval
s.static <T> RandomAccessibleInterval<T>
stack(RandomAccessibleInterval<T>... hyperslices)
Form a (n+1)-dimensionalRandomAccessibleInterval
by stacking n-dimensionalRandomAccessibleInterval
s.static <T> RandomAccessibleInterval<T>
stack(StackView.StackAccessMode stackAccessMode, java.util.List<? extends RandomAccessibleInterval<T>> hyperslices)
Form a (n+1)-dimensionalRandomAccessibleInterval
by stacking n-dimensionalRandomAccessibleInterval
s.static <T> RandomAccessibleInterval<T>
stack(StackView.StackAccessMode stackAccessMode, RandomAccessibleInterval<T>... hyperslices)
Form a (n+1)-dimensionalRandomAccessibleInterval
by stacking n-dimensionalRandomAccessibleInterval
s.static <T> SubsampleView<T>
subsample(RandomAccessible<T> source, long step)
Sample only every stepth value of a sourceRandomAccessible
.static <T> SubsampleView<T>
subsample(RandomAccessible<T> source, long... steps)
Sample only every stepdth value of a sourceRandomAccessible
.static <T> SubsampleIntervalView<T>
subsample(RandomAccessibleInterval<T> source, long step)
Sample only every stepth value of a sourceRandomAccessibleInterval
.static <T> SubsampleIntervalView<T>
subsample(RandomAccessibleInterval<T> source, long... steps)
Sample only every stepdth value of a sourceRandomAccessibleInterval
.static <T> MixedTransformView<T>
translate(RandomAccessible<T> randomAccessible, long... translation)
Translate the source view by the given translation vector.static <T> IntervalView<T>
translate(RandomAccessibleInterval<T> interval, long... translation)
Translate the source view by the given translation vector.static <T> TransformView<T>
unshear(RandomAccessible<T> source, int shearDimension, int referenceDimension)
Negative shear transform of a RandomAccessible usingInverseShearTransform
, i.e.static <T> IntervalView<T>
unshear(RandomAccessible<T> source, Interval interval, int shearDimension, int referenceDimension)
Negative shear transform of a RandomAccessible usingInverseShearTransform
, i.e.static <T> IntervalView<T>
zeroMin(RandomAccessibleInterval<T> interval)
Translate the source such that the upper left corner is at the origin
-
-
-
Method Detail
-
interpolate
public static <T,F extends EuclideanSpace> RealRandomAccessible<T> interpolate(F source, InterpolatorFactory<T,F> factory)
Returns aRealRandomAccessible
using interpolation- Parameters:
source
- theEuclideanSpace
to be interpolatedfactory
- theInterpolatorFactory
to provide interpolators for source- Returns:
-
raster
public static <T> RandomAccessibleOnRealRandomAccessible<T> raster(RealRandomAccessible<T> source)
Turns aRealRandomAccessible
into aRandomAccessible
, providingRandomAccess
at integer coordinates.- Parameters:
source
- theRealRandomAccessible
to be rasterized.- Returns:
- a
RandomAccessibleOnRealRandomAccessible
wrapping source. - See Also:
interpolate(net.imglib2.EuclideanSpace, net.imglib2.interpolation.InterpolatorFactory)
-
extend
public static <T,F extends RandomAccessibleInterval<T>> ExtendedRandomAccessibleInterval<T,F> extend(F source, OutOfBoundsFactory<T,? super F> factory)
Extend a RandomAccessibleInterval with an out-of-bounds strategy.- Parameters:
source
- the interval to extend.factory
- the out-of-bounds strategy.- Returns:
- (unbounded) RandomAccessible which extends the input interval to infinity.
-
extendMirrorSingle
public static <T,F extends RandomAccessibleInterval<T>> ExtendedRandomAccessibleInterval<T,F> extendMirrorSingle(F source)
Extend a RandomAccessibleInterval with a mirroring out-of-bounds strategy. Boundary pixels are not repeated. Note that this requires that all dimensions of the source (F source) must be > 1.- Parameters:
source
- the interval to extend.- Returns:
- (unbounded) RandomAccessible which extends the input interval to infinity.
- See Also:
OutOfBoundsMirrorSingleBoundary
-
extendMirrorDouble
public static <T,F extends RandomAccessibleInterval<T>> ExtendedRandomAccessibleInterval<T,F> extendMirrorDouble(F source)
Extend a RandomAccessibleInterval with a mirroring out-of-bounds strategy. Boundary pixels are repeated.- Parameters:
source
- the interval to extend.- Returns:
- (unbounded) RandomAccessible which extends the input interval to infinity.
- See Also:
OutOfBoundsMirrorDoubleBoundary
-
extendValue
public static <T extends Type<T>,F extends RandomAccessibleInterval<T>> ExtendedRandomAccessibleInterval<T,F> extendValue(F source, T value)
Extend a RandomAccessibleInterval with a constant-value out-of-bounds strategy.- Parameters:
source
- the interval to extend.- Returns:
- (unbounded) RandomAccessible which extends the input interval to infinity.
- See Also:
OutOfBoundsConstantValue
-
extendZero
public static <T extends NumericType<T>,F extends RandomAccessibleInterval<T>> ExtendedRandomAccessibleInterval<T,F> extendZero(F source)
Extend a RandomAccessibleInterval with a constant-value out-of-bounds strategy where the constant value is the zero-element of the data type.- Parameters:
source
- the interval to extend.- Returns:
- (unbounded) RandomAccessible which extends the input interval to infinity with a constant value of zero.
- See Also:
OutOfBoundsConstantValue
-
extendRandom
public static <T extends RealType<T>,F extends RandomAccessibleInterval<T>> ExtendedRandomAccessibleInterval<T,F> extendRandom(F source, double min, double max)
Extend a RandomAccessibleInterval with a random-value out-of-bounds strategy.- Parameters:
source
- the interval to extend.min
- the minimal random valuemax
- the maximal random value- Returns:
- (unbounded) RandomAccessible which extends the input interval to infinity.
- See Also:
OutOfBoundsRandomValue
-
extendPeriodic
public static <T,F extends RandomAccessibleInterval<T>> ExtendedRandomAccessibleInterval<T,F> extendPeriodic(F source)
Extend a RandomAccessibleInterval with a periodic out-of-bounds strategy.- Parameters:
source
- the interval to extend.- Returns:
- (unbounded) RandomAccessible which extends the input interval to infinity.
- See Also:
OutOfBoundsPeriodic
-
extendBorder
public static <T,F extends RandomAccessibleInterval<T>> ExtendedRandomAccessibleInterval<T,F> extendBorder(F source)
Extend a RandomAccessibleInterval with an out-of-bounds strategy to repeat border pixels.- Parameters:
source
- the interval to extend.- Returns:
- (unbounded) RandomAccessible which extends the input interval to infinity.
- See Also:
OutOfBoundsBorder
-
interval
public static <T> IntervalView<T> interval(RandomAccessible<T> randomAccessible, long[] min, long[] max)
Define an interval on a RandomAccessible. It is the callers responsibility to ensure that the source RandomAccessible is defined in the specified interval.- Parameters:
randomAccessible
- the sourcemin
- lower bound of intervalmax
- upper bound of interval- Returns:
- a RandomAccessibleInterval
-
interval
public static <T> IntervalView<T> interval(RandomAccessible<T> randomAccessible, Interval interval)
Define an interval on a RandomAccessible. It is the callers responsibility to ensure that the source RandomAccessible is defined in the specified interval.- Parameters:
randomAccessible
- the sourceinterval
- interval boundaries.- Returns:
- a RandomAccessibleInterval
-
rotate
public static <T> MixedTransformView<T> rotate(RandomAccessible<T> randomAccessible, int fromAxis, int toAxis)
Create view that is rotated by 90 degrees. The rotation is specified by the fromAxis and toAxis arguments. If fromAxis=0 and toAxis=1, this means that the X-axis of the source view is mapped to the Y-Axis of the rotated view. That is, it corresponds to a 90 degree clock-wise rotation of the source view in the XY plane. fromAxis=1 and toAxis=0 corresponds to a counter-clock-wise rotation in the XY plane.
-
rotate
public static <T> IntervalView<T> rotate(RandomAccessibleInterval<T> interval, int fromAxis, int toAxis)
Create view that is rotated by 90 degrees. The rotation is specified by the fromAxis and toAxis arguments. If fromAxis=0 and toAxis=1, this means that the X-axis of the source view is mapped to the Y-Axis of the rotated view. That is, it corresponds to a 90 degree clock-wise rotation of the source view in the XY plane. fromAxis=1 and toAxis=0 corresponds to a counter-clock-wise rotation in the XY plane.
-
permute
public static <T> MixedTransformView<T> permute(RandomAccessible<T> randomAccessible, int fromAxis, int toAxis)
Create view with permuted axes. fromAxis and toAxis are swapped. If fromAxis=0 and toAxis=2, this means that the X-axis of the source view is mapped to the Z-Axis of the permuted view and vice versa. For a XYZ source, a ZYX view would be created.
-
permute
public static <T> IntervalView<T> permute(RandomAccessibleInterval<T> interval, int fromAxis, int toAxis)
Create view with permuted axes. fromAxis and toAxis are swapped. If fromAxis=0 and toAxis=2, this means that the X-axis of the source view is mapped to the Z-Axis of the permuted view and vice versa. For a XYZ source, a ZYX view would be created.
-
translate
public static <T> MixedTransformView<T> translate(RandomAccessible<T> randomAccessible, long... translation)
Translate the source view by the given translation vector. Pixel x in the source view has coordinates (x + translation) in the resulting view.- Parameters:
randomAccessible
- the sourcetranslation
- translation vector of the source view. The pixel at x in the source view becomes (x + translation) in the resulting view.
-
translate
public static <T> IntervalView<T> translate(RandomAccessibleInterval<T> interval, long... translation)
Translate the source view by the given translation vector. Pixel x in the source view has coordinates (x + translation) in the resulting view.- Parameters:
interval
- the sourcetranslation
- translation vector of the source view. The pixel at x in the source view becomes (x + translation) in the resulting view.
-
offset
public static <T> MixedTransformView<T> offset(RandomAccessible<T> randomAccessible, long... offset)
Translate such that pixel at offset in randomAccessible is at the origin in the resulting view. This is equivalent to translating by -offset.- Parameters:
randomAccessible
- the sourceoffset
- offset of the source view. The pixel at offset becomes the origin of resulting view.
-
offset
public static <T> IntervalView<T> offset(RandomAccessibleInterval<T> interval, long... offset)
Translate such that pixel at offset in interval is at the origin in the resulting view. This is equivalent to translating by -offset.- Parameters:
interval
- the sourceoffset
- offset of the source view. The pixel at offset becomes the origin of resulting view.
-
zeroMin
public static <T> IntervalView<T> zeroMin(RandomAccessibleInterval<T> interval)
Translate the source such that the upper left corner is at the origin- Parameters:
interval
- the source.- Returns:
- view of the source translated to the origin
-
hyperSlice
public static <T> MixedTransformView<T> hyperSlice(RandomAccessible<T> view, int d, long pos)
take a (n-1)-dimensional slice of a n-dimensional view, fixing d-component of coordinates to pos.
-
hyperSlice
public static <T> IntervalView<T> hyperSlice(RandomAccessibleInterval<T> view, int d, long pos)
take a (n-1)-dimensional slice of a n-dimensional view, fixing d-component of coordinates to pos.
-
addDimension
public static <T> MixedTransformView<T> addDimension(RandomAccessible<T> randomAccessible)
Create view which adds a dimension to the sourceRandomAccessible
. The additional dimension is the last dimension. For example, an XYZ view is created for an XY source. When accessing an XYZ sample in the view, the final coordinate is discarded and the source XY sample is accessed.- Parameters:
randomAccessible
- the source
-
addDimension
public static <T> IntervalView<T> addDimension(RandomAccessibleInterval<T> interval, long minOfNewDim, long maxOfNewDim)
Create view which adds a dimension to the sourceRandomAccessibleInterval
. TheInterval
boundaries in the additional dimension are set to the specified values. The additional dimension is the last dimension. For example, an XYZ view is created for an XY source. When accessing an XYZ sample in the view, the final coordinate is discarded and the source XY sample is accessed.- Parameters:
interval
- the sourceminOfNewDim
- Interval min in the additional dimension.maxOfNewDim
- Interval max in the additional dimension.
-
invertAxis
public static <T> MixedTransformView<T> invertAxis(RandomAccessible<T> randomAccessible, int d)
Invert the d-axis.- Parameters:
randomAccessible
- the sourced
- the axis to invert
-
invertAxis
public static <T> IntervalView<T> invertAxis(RandomAccessibleInterval<T> interval, int d)
Invert the d-axis.- Parameters:
interval
- the sourced
- the axis to invert
-
offsetInterval
public static <T> IntervalView<T> offsetInterval(RandomAccessible<T> randomAccessible, long[] offset, long[] dimension)
Define an interval on a RandomAccessible and translate it such that the min corner is at the origin. It is the callers responsibility to ensure that the source RandomAccessible is defined in the specified interval.- Parameters:
randomAccessible
- the sourceoffset
- offset of min corner.dimension
- size of the interval.- Returns:
- a RandomAccessibleInterval
-
offsetInterval
public static <T> IntervalView<T> offsetInterval(RandomAccessible<T> randomAccessible, Interval interval)
Define an interval on a RandomAccessible and translate it such that the min corner is at the origin. It is the callers responsibility to ensure that the source RandomAccessible is defined in the specified interval.- Parameters:
randomAccessible
- the sourceinterval
- the interval on source that should be cut out and translated to the origin.- Returns:
- a RandomAccessibleInterval
-
isZeroMin
public static boolean isZeroMin(Interval interval)
test whether the source interval starts at (0,0,...,0)- Parameters:
interval
- - theInterval
to test- Returns:
- true if zero-bounded, false otherwise
-
iterable
public static <T> IterableInterval<T> iterable(RandomAccessibleInterval<T> randomAccessibleInterval)
Return anIterableInterval
. If the passedRandomAccessibleInterval
is already anIterableInterval
then it is returned directly (this is the case forImg
). If not, then anIterableRandomAccessibleInterval
is created.- Parameters:
randomAccessibleInterval
- the source- Returns:
- an
IterableInterval
-
flatIterable
public static <T> IterableInterval<T> flatIterable(RandomAccessibleInterval<T> randomAccessibleInterval)
Return anIterableInterval
havingFlatIterationOrder
. If the passedRandomAccessibleInterval
is already anIterableInterval
withFlatIterationOrder
then it is returned directly (this is the case forArrayImg
). If not, then anIterableRandomAccessibleInterval
is created.- Parameters:
randomAccessibleInterval
- the source- Returns:
- an
IterableInterval
withFlatIterationOrder
-
collapse
public static <T> CompositeIntervalView<T,? extends GenericComposite<T>> collapse(RandomAccessibleInterval<T> source)
Collapse the nth dimension of an n -dimensionalRandomAccessibleInterval
<T> into an ( n-1)-dimensionalRandomAccessibleInterval
<GenericComposite
<T>>- Parameters:
source
- the source- Returns:
- an (n-1)-dimensional
CompositeIntervalView
ofGenericComposites
-
collapseReal
public static <T extends RealType<T>> CompositeIntervalView<T,RealComposite<T>> collapseReal(RandomAccessibleInterval<T> source)
Collapse the nth dimension of an n -dimensionalRandomAccessibleInterval
<T extendsRealType
<T>> into an (n-1)-dimensionalRandomAccessibleInterval
<RealComposite
<T>>- Parameters:
source
- the source- Returns:
- an (n-1)-dimensional
CompositeIntervalView
ofRealComposites
-
collapseNumeric
public static <T extends NumericType<T>> CompositeIntervalView<T,NumericComposite<T>> collapseNumeric(RandomAccessibleInterval<T> source)
Collapse the nth dimension of an n -dimensionalRandomAccessibleInterval
<T extendsNumericType
<T>> into an (n-1)-dimensionalRandomAccessibleInterval
<NumericComposite
<T>>- Parameters:
source
- the source- Returns:
- an (n-1)-dimensional
CompositeIntervalView
ofNumericComposites
-
collapse
public static <T> CompositeView<T,? extends GenericComposite<T>> collapse(RandomAccessible<T> source)
Collapse the nth dimension of an n -dimensionalRandomAccessible
<T> into an (n -1)-dimensionalRandomAccessible
<GenericComposite
<T>>- Parameters:
source
- the source- Returns:
- an (n-1)-dimensional
CompositeView
ofGenericComposites
-
collapseReal
public static <T extends RealType<T>> CompositeView<T,RealComposite<T>> collapseReal(RandomAccessible<T> source, int numChannels)
Collapse the nth dimension of an n -dimensionalRandomAccessible
<T extendsRealType
<T>> into an (n-1)-dimensionalRandomAccessible
<RealComposite
<T>>- Parameters:
source
- the sourcenumChannels
- the number of channels that theRealComposite
will consider when performing calculations- Returns:
- an (n-1)-dimensional
CompositeView
ofRealComposites
-
collapseNumeric
public static <T extends NumericType<T>> CompositeView<T,NumericComposite<T>> collapseNumeric(RandomAccessible<T> source, int numChannels)
Collapse the nth dimension of an n -dimensionalRandomAccessible
<T extendsNumericType
<T>> into an (n-1)-dimensionalRandomAccessible
<NumericComposite
<T>>- Parameters:
source
- the sourcenumChannels
- the number of channels that theNumericComposite
will consider when performing calculations- Returns:
- an (n-1)-dimensional
CompositeView
ofNumericComposites
-
subsample
public static <T> SubsampleIntervalView<T> subsample(RandomAccessibleInterval<T> source, long step)
Sample only every stepth value of a sourceRandomAccessibleInterval
. This is effectively an integer scaling and zero offset transformation.- Parameters:
source
- the sourcestep
- the subsampling step size- Returns:
- a subsampled
RandomAccessibleInterval
with its origin coordinates at zero
-
subsample
public static <T> SubsampleIntervalView<T> subsample(RandomAccessibleInterval<T> source, long... steps)
Sample only every stepdth value of a sourceRandomAccessibleInterval
. This is effectively an integer scaling and zero offset transformation.- Parameters:
source
- the sourcesteps
- the subsampling step sizes- Returns:
- a subsampled
RandomAccessibleInterval
with its origin coordinates at zero
-
subsample
public static <T> SubsampleView<T> subsample(RandomAccessible<T> source, long step)
Sample only every stepth value of a sourceRandomAccessible
. This is effectively an integer scaling transformation.- Parameters:
source
- the sourcestep
- the subsampling step size- Returns:
- a subsampled
RandomAccessible
-
subsample
public static <T> SubsampleView<T> subsample(RandomAccessible<T> source, long... steps)
Sample only every stepdth value of a sourceRandomAccessible
. This is effectively an integer scaling transformation.- Parameters:
source
- the sourcesteps
- the subsampling step sizes- Returns:
- a subsampled
RandomAccessible
-
dropSingletonDimensions
public static <T> RandomAccessibleInterval<T> dropSingletonDimensions(RandomAccessibleInterval<T> source)
Removes all unit dimensions (dimensions with size one) from the RandomAccessibleInterval- Parameters:
source
- the source- Returns:
- a RandomAccessibleInterval without dimensions of size one
-
stack
public static <T> RandomAccessibleInterval<T> stack(java.util.List<? extends RandomAccessibleInterval<T>> hyperslices)
Form a (n+1)-dimensionalRandomAccessibleInterval
by stacking n-dimensionalRandomAccessibleInterval
s.- Parameters:
hyperslices
- a list of n-dimensionalRandomAccessibleInterval
of identical sizes.- Returns:
- a (n+1)-dimensional
RandomAccessibleInterval
where the final dimension is the index of the hyperslice.
-
stack
@SafeVarargs public static <T> RandomAccessibleInterval<T> stack(RandomAccessibleInterval<T>... hyperslices)
Form a (n+1)-dimensionalRandomAccessibleInterval
by stacking n-dimensionalRandomAccessibleInterval
s.- Parameters:
hyperslices
- a list of n-dimensionalRandomAccessibleInterval
of identical sizes.- Returns:
- a (n+1)-dimensional
RandomAccessibleInterval
where the final dimension is the index of the hyperslice.
-
stack
public static <T> RandomAccessibleInterval<T> stack(StackView.StackAccessMode stackAccessMode, java.util.List<? extends RandomAccessibleInterval<T>> hyperslices)
Form a (n+1)-dimensionalRandomAccessibleInterval
by stacking n-dimensionalRandomAccessibleInterval
s.- Parameters:
stackAccessMode
- describes how aRandomAccess
on the (n+1) -dimensionalStackView
maps position changes into position changes of the underlying n-dimensionalRandomAccess
es.hyperslices
- a list of n-dimensionalRandomAccessibleInterval
of identical sizes.- Returns:
- a (n+1)-dimensional
RandomAccessibleInterval
where the final dimension is the index of the hyperslice.
-
stack
public static <T> RandomAccessibleInterval<T> stack(StackView.StackAccessMode stackAccessMode, RandomAccessibleInterval<T>... hyperslices)
Form a (n+1)-dimensionalRandomAccessibleInterval
by stacking n-dimensionalRandomAccessibleInterval
s.- Parameters:
stackAccessMode
- describes how aRandomAccess
on the (n+1) -dimensionalStackView
maps position changes into position changes of the underlying n-dimensionalRandomAccess
es.hyperslices
- a list of n-dimensionalRandomAccessibleInterval
of identical sizes.- Returns:
- a (n+1)-dimensional
RandomAccessibleInterval
where the final dimension is the index of the hyperslice.
-
shear
public static <T> TransformView<T> shear(RandomAccessible<T> source, int shearDimension, int referenceDimension)
Positive shear transform of a RandomAccessible usingShearTransform
, i.e. c[ shearDimension ] = c[ shearDimension ] + c[ referenceDimension ]- Parameters:
source
- input, e.g. extendedRandomAccessibleInterval
shearDimension
- dimension to be shearedreferenceDimension
- reference dimension for shear- Returns:
TransformView
containing the result.
-
unshear
public static <T> TransformView<T> unshear(RandomAccessible<T> source, int shearDimension, int referenceDimension)
Negative shear transform of a RandomAccessible usingInverseShearTransform
, i.e. c[ shearDimension ] = c[ shearDimension ] - c[ referenceDimension ]- Parameters:
source
- input, e.g. extendedRandomAccessibleInterval
shearDimension
- dimension to be shearedreferenceDimension
- reference dimension for shear- Returns:
TransformView
containing the result.
-
shear
public static <T> IntervalView<T> shear(RandomAccessible<T> source, Interval interval, int shearDimension, int referenceDimension)
Positive shear transform of a RandomAccessible usingShearTransform
, i.e. c[ shearDimension ] = c[ shearDimension ] + c[ referenceDimension ]- Parameters:
source
- input, e.g. extendedRandomAccessibleInterval
interval
- original intervalshearDimension
- dimension to be shearedreferenceDimension
- reference dimension for shear- Returns:
IntervalView
containing the result. The returned interval's dimension are determined by applying theShearTransform.transform(net.imglib2.transform.integer.BoundingBox)
method on the input interval.
-
unshear
public static <T> IntervalView<T> unshear(RandomAccessible<T> source, Interval interval, int shearDimension, int referenceDimension)
Negative shear transform of a RandomAccessible usingInverseShearTransform
, i.e. c[ shearDimension ] = c[ shearDimension ] - c[ referenceDimension ]- Parameters:
source
- input, e.g. extendedRandomAccessibleInterval
interval
- original intervalshearDimension
- dimension to be shearedreferenceDimension
- reference dimension for shear- Returns:
IntervalView
containing the result. The returned interval's dimension are determined by applying theShearTransform.transform(net.imglib2.transform.integer.BoundingBox)
method on the input interval.
-
permuteCoordinates
public static <T> IntervalView<T> permuteCoordinates(RandomAccessibleInterval<T> source, int[] permutation)
Bijective permutation of the integer coordinates in each dimension of aRandomAccessibleInterval
.- Parameters:
source
- must be an n-dimensional hypercube with each dimension being of the same size as the permutation arraypermutation
- must be a bijective permutation over its index set, i.e. for a LUT of length n, the sorted content the array must be [0,...,n-1] which is the index set of the LUT.- Returns:
IntervalView
of permuted source.
-
permuteCoordinates
public static <T> IntervalView<T> permuteCoordinates(RandomAccessibleInterval<T> source, int[] permutation, int d)
Bijective permutation of the integer coordinates of one dimension of aRandomAccessibleInterval
.- Parameters:
source
- must have dimension(dimension) == permutation.lengthpermutation
- must be a bijective permutation over its index set, i.e. for a lut of length n, the sorted content the array must be [0,...,n-1] which is the index set of the lut.d
- dimension index to be permuted- Returns:
IntervalView
of permuted source.
-
permuteCoordinatesInverse
public static <T> IntervalView<T> permuteCoordinatesInverse(RandomAccessibleInterval<T> source, int[] permutation)
Inverse Bijective permutation of the integer coordinates in each dimension of aRandomAccessibleInterval
.- Parameters:
source
- must be an n-dimensional hypercube with each dimension being of the same size as the permutation arraypermutation
- must be a bijective permutation over its index set, i.e. for a LUT of length n, the sorted content the array must be [0,...,n-1] which is the index set of the LUT.- Returns:
IntervalView
of permuted source.
-
permuteCoordinateInverse
@Deprecated public static <T> IntervalView<T> permuteCoordinateInverse(RandomAccessibleInterval<T> source, int[] permutation, int d)
Deprecated.Inverse bijective permutation of the integer coordinates of one dimension of aRandomAccessibleInterval
.- Parameters:
source
- must have dimension(dimension) == permutation.lengthpermutation
- must be a bijective permutation over its index set, i.e. for a lut of length n, the sorted content the array must be [0,...,n-1] which is the index set of the lut.d
- dimension index to be permuted- Returns:
IntervalView
of permuted source.
-
permuteCoordinatesInverse
public static <T> IntervalView<T> permuteCoordinatesInverse(RandomAccessibleInterval<T> source, int[] permutation, int d)
Inverse bijective permutation of the integer coordinates of one dimension of aRandomAccessibleInterval
.- Parameters:
source
- must have dimension(dimension) == permutation.lengthpermutation
- must be a bijective permutation over its index set, i.e. for a lut of length n, the sorted content the array must be [0,...,n-1] which is the index set of the lut.d
- dimension index to be permuted- Returns:
IntervalView
of permuted source.
-
pair
public static <A,B> RandomAccessible<Pair<A,B>> pair(RandomAccessible<A> sourceA, RandomAccessible<B> sourceB)
- Parameters:
sourceA
-sourceB
-- Returns:
-
hyperSlices
public static <T> RandomAccessible<? extends RandomAccessible<T>> hyperSlices(RandomAccessible<T> source, int... axes)
Provide an (n + m)-dimensionalRandomAccessible
of T as an m-dimensionalRandomAccessible
of n-dimensionalRandomAccessibles
of T.- Parameters:
source
-axes
- the axes to become the inner axes (embedded into the co-domain)- Returns:
-
expand
public static <T,F extends RandomAccessibleInterval<T>> IntervalView<T> expand(F source, OutOfBoundsFactory<T,? super F> oob, long... border)
Expand a RandomAccessibleInterval as specified by border. Out of bounds pixels will be sampled as specified byOutOfBoundsFactory
oob.- Parameters:
source
- the interval to expand.oob
- the out-of-bounds strategy.- Returns:
- Expansion of the
RandomAccessibleInterval
source as specified by oob and border.
-
expandMirrorSingle
public static <T> IntervalView<T> expandMirrorSingle(RandomAccessibleInterval<T> source, long... border)
Expand a RandomAccessibleInterval as specified by border. Out of bounds pixels will be sampled by mirroring source. Boundary pixels are not repeated. Note that this requires that all dimensions of the source (F source) must be > 1.- Parameters:
source
- the interval to expand.- Returns:
- Expansion of the
RandomAccessibleInterval
source as specified by border.
-
expandMirrorDouble
public static <T> IntervalView<T> expandMirrorDouble(RandomAccessibleInterval<T> source, long... border)
Expand a RandomAccessibleInterval as specified by border. Out of bounds pixels will be sampled by mirroring source. Boundary pixels are repeated.- Parameters:
source
- the interval to expand.- Returns:
- Expansion of the
RandomAccessibleInterval
source as specified by border.
-
expandValue
public static <T extends Type<T>> IntervalView<T> expandValue(RandomAccessibleInterval<T> source, T t, long... border)
Expand a RandomAccessibleInterval as specified by border. source will be extended with a constant value specified by the caller.- Parameters:
source
- the interval to expand.t
- Constant extension of source.- Returns:
- Expansion of the
RandomAccessibleInterval
source as specified by t and border.
-
expandZero
public static <T extends NumericType<T>> IntervalView<T> expandZero(RandomAccessibleInterval<T> source, long... border)
Expand a RandomAccessibleInterval as specified by border. source will be extended with the zero-element of that data type.- Parameters:
source
- the interval to expand.- Returns:
- Expansion of the
RandomAccessibleInterval
source as specified by border.
-
expandRandom
public static <T extends RealType<T>> IntervalView<T> expandRandom(RandomAccessibleInterval<T> source, double min, double max, long... border)
Expand a RandomAccessibleInterval as specified by border. source will be extended with a random-value out-of-bounds strategy.- Parameters:
source
- the interval to expand.min
- the minimal random valuemax
- the maximal random value- Returns:
- Expansion of the
RandomAccessibleInterval
source as specified by min, max, and border.
-
expandPeriodic
public static <T> IntervalView<T> expandPeriodic(RandomAccessibleInterval<T> source, long... border)
Expand a RandomAccessibleInterval as specified by border. source will be extended with a periodic out-of-bounds strategy.- Parameters:
source
- the interval to expand.- Returns:
- Expansion of the
RandomAccessibleInterval
source as specified by border.
-
expandBorder
public static <T> IntervalView<T> expandBorder(RandomAccessibleInterval<T> source, long... border)
Expand a RandomAccessibleInterval as specified by border. source will be extended with the border value.- Parameters:
source
- the interval to expand.- Returns:
- Expansion of the
RandomAccessibleInterval
source as specified by border.
-
concatenate
@SafeVarargs public static <T> RandomAccessibleInterval<T> concatenate(int concatenationAxis, RandomAccessibleInterval<T>... sources)
Concatenate an array ofRandomAccessibleInterval
along the providedconcatenationAxis
. The random access behaves as defined byStackView.StackAccessMode.DEFAULT
.- Parameters:
concatenationAxis
- Concatenate along this axis.sources
-RandomAccessibleInterval
s to be concatenated.- Returns:
RandomAccessibleInterval
of concatenated sources.
-
concatenate
public static <T> RandomAccessibleInterval<T> concatenate(int concatenationAxis, java.util.List<? extends RandomAccessibleInterval<T>> sources)
Concatenate a list ofRandomAccessibleInterval
along the providedconcatenationAxis
. The random access behaves as defined byStackView.StackAccessMode.DEFAULT
.- Parameters:
concatenationAxis
- Concatenate along this axis.sources
-RandomAccessibleInterval
s to be concatenated.- Returns:
RandomAccessibleInterval
of concatenated sources.
-
concatenate
@SafeVarargs public static <T> RandomAccessibleInterval<T> concatenate(int concatenationAxis, StackView.StackAccessMode mode, RandomAccessibleInterval<T>... sources)
Concatenate an array ofRandomAccessibleInterval
along the providedconcatenationAxis
. SeeStackView.StackAccessMode
for behaviors ofRandomAccess
.- Parameters:
concatenationAxis
- Concatenate along this axis.mode
- Defines how random accesses are moved. SeeStackView.StackAccessMode
for behaviors ofRandomAccess
.sources
-RandomAccessibleInterval
s to be concatenated.- Returns:
RandomAccessibleInterval
of concatenated sources.
-
concatenate
public static <T> RandomAccessibleInterval<T> concatenate(int concatenationAxis, StackView.StackAccessMode mode, java.util.List<? extends RandomAccessibleInterval<T>> sources)
Concatenate a list ofRandomAccessibleInterval
along the providedconcatenationAxis
. SeeStackView.StackAccessMode
for behaviors ofRandomAccess
.- Parameters:
concatenationAxis
- Concatenate along this axis.mode
- Defines how random accesses are moved. SeeStackView.StackAccessMode
for behaviors ofRandomAccess
.sources
-RandomAccessibleInterval
s to be concatenated.- Returns:
RandomAccessibleInterval
of concatenated sources.
-
-