public class Masks extends Object
Constructor and Description |
---|
Masks() |
public static Mask and(Mask left, Predicate<? super Localizable> right)
public static MaskInterval and(MaskInterval left, Predicate<? super Localizable> right)
public static Mask or(Mask left, Predicate<? super Localizable> right)
public static MaskInterval or(MaskInterval left, MaskInterval right)
public static Mask xor(Mask left, Predicate<? super Localizable> right)
public static MaskInterval xor(MaskInterval left, MaskInterval right)
public static Mask minus(Mask left, Predicate<? super Localizable> right)
public static MaskInterval minus(MaskInterval left, Predicate<? super Localizable> right)
public static RealMask and(RealMask left, Predicate<? super RealLocalizable> right)
public static RealMaskRealInterval and(RealMaskRealInterval left, Predicate<? super RealLocalizable> right)
public static RealMask or(RealMask left, Predicate<? super RealLocalizable> right)
public static RealMaskRealInterval or(RealMaskRealInterval left, RealMaskRealInterval right)
public static RealMask xor(RealMask left, Predicate<? super RealLocalizable> right)
public static RealMaskRealInterval xor(RealMaskRealInterval left, RealMaskRealInterval right)
public static RealMask minus(RealMask left, Predicate<? super RealLocalizable> right)
public static RealMaskRealInterval minus(RealMaskRealInterval left, Predicate<? super RealLocalizable> right)
public static RandomAccessible<BoolType> toRandomAccessible(Mask mask)
Mask
as a RandomAccessible
of
BoolType
. If the given Mask is a MaskInterval
, a
RandomAccessibleInterval
is returned.mask
- Mask
to be wrappedpublic static RandomAccessibleInterval<BoolType> toRandomAccessibleInterval(MaskInterval mask)
mask
- MaskInterval
to be wrappedpublic static RealRandomAccessible<BoolType> toRealRandomAccessible(RealMask mask)
RealMask
as a RealRandomAccessible
of
BoolType
. If the given RealMask is a RealMaskRealInterval
,
a RealRandomAccessibleRealInterval
is returned.mask
- RealMask
to be wrappedpublic static RealRandomAccessibleRealInterval<BoolType> toRealRandomAccessibleRealInterval(RealMaskRealInterval mask)
mask
- RealMaskRealInterval
to be wrappedpublic static IterableRegion<BoolType> toIterableRegion(RealMaskRealInterval mask)
RealMaskRealInterval
as an IterableRegion
,
in integer coordinates.
This method enables using a RealMaskRealInterval
as the ROI
to iterate over in a RandomAccessible
, in conjunction
with Regions.sample(net.imglib2.IterableInterval, RandomAccessible)
.
For example, to iterate the values inside a sphere, do:
final ClosedWritableSphere sphere = ...
final RandomAccessibleInterval rai = ...
for ( final T t : Regions.sample( Masks.toIterableRegion( sphere ), rai )
{
// Do something with t
}
mask
- RealMaskRealInterval
to be iterated in
in integer coordinates.IterableRegion<BoolType>
public static IterableRegion<BoolType> toIterableRegion(MaskInterval mask)
MaskInterval
as an IterableRegion
,
in integer coordinates.
This method enables using a MaskInterval
as the ROI
to iterate over in a RandomAccessible
, in conjunction
with Regions.sample(net.imglib2.IterableInterval, RandomAccessible)
.
For example, to iterate the values inside a sphere, do:
final ClosedWritableSphere sphere = ...
final RandomAccessibleInterval rai = ...
for ( final T t : Regions.sample( Masks.toIterableRegion( sphere ), rai )
{
// Do something with t
}
mask
- MaskInterval
to be iterated.IterableRegion<BoolType>
public static <B extends BooleanType<B>> Mask toMask(RandomAccessible<B> ra)
RandomAccessible
as a Mask
. If the given
RandomAccessible is a RandomAccessibleInterval
a
MaskInterval
is returned.ra
- RandomAccessible
to be wrappedMask
equivalent to the given RandomAccessible
public static <B extends BooleanType<B>> MaskInterval toMaskInterval(RandomAccessibleInterval<B> rai)
RandomAccessibleInterval
as a
MaskInterval
.rai
- RandomAccessibleInterval
to be wrappedMaskInterval
equivalent to the given
RandomAccessibleInterval
public static <B extends BooleanType<B>> RealMask toRealMask(RealRandomAccessible<B> rra)
RealRandomAccessible
as a RealMask
. If
the given RealRandomAccessible is a
RealRandomAccessibleRealInterval
a RealMaskRealInterval
is returned.rra
- RealRandomAccessible
to be wrappedRealMask
equivalent to the given
RealRandomAccessible
public static <B extends BooleanType<B>> RealMaskRealInterval toRealMaskRealInterval(RealRandomAccessibleRealInterval<B> rrari)
RealRandomAccessibleRealInterval
as a
RealMaskRealInterval
.rrari
- RealRandomAccessibleRealInterval
to be wrappedRealMaskRealInterval
equivalent to the given
RealRandomAccessibleRealInterval
public static Mask emptyMask(int numDims)
Mask
which returns false
for every location.numDims
- number of dimensions the resulting Mask should haveMask
which returns false for all locationspublic static MaskInterval emptyMaskInterval(int numDims)
MaskInterval
which returns false
for every
location and has empty interval bounds (i.e. min > max).numDims
- number of dimensions the resulting MaskInterval should haveMaskInterval
which returns false for all locationspublic static RealMask emptyRealMask(int numDims)
RealMask
which returns false
for every
location.numDims
- number of dimensions the resulting RealMask should haveRealMask
which returns false for all locationspublic static RealMaskRealInterval emptyRealMaskRealInterval(int numDims)
RealMaskRealInterval
which returns false
for
every location and has empty interval bounds (i.e. min > max).numDims
- number of dimensions the resulting RealMaskRealInterval should
haveRealMaskRealInterval
which returns false for all
locationspublic static Interval emptyInterval(int numDims)
Interval
which has min > max for all dimensions.public static RealInterval emptyRealInterval(int numDims)
RealInterval
which has min > max for all
dimensions.numDims
- dimensions of the resulting RealInterval
RealInterval
with min > maxpublic static Mask allMask(int numDims)
Mask
which returns true
for all locations.public static RealMask allRealMask(int numDims)
RealMask
which returns true
for all locations.public static <T,M extends MaskPredicate<T>> boolean sameTypesAndDimensions(M mask1, M mask2)
mask1
- The first mask to compare.mask2
- The second mask to compare.Copyright © 2015–2022 ImgLib2. All rights reserved.