Package net.imglib2.converter
Class Converters
- java.lang.Object
-
- net.imglib2.converter.Converters
-
public class Converters extends java.lang.Object
Convenience factory methods for sample conversion.- Author:
- Stephan Saalfeld, Tobias Pietzsch
-
-
Constructor Summary
Constructors Constructor Description Converters()
-
Method Summary
-
-
-
Method Detail
-
convert
public static final <A,B extends Type<B>> RandomAccessible<B> convert(RandomAccessible<A> source, Converter<? super A,? super B> converter, B b)
Create aRandomAccessible
whoseRandomAccesses
Sampler.get()
you a converted sample. Conversion is done on-the-fly when reading values. Writing to the convertedRandomAccessibleInterval
has no effect.- Parameters:
source
-converter
-b
-- Returns:
- a converted
RandomAccessible
whoseRandomAccesses
perform on-the-fly value conversion using the provided converter.
-
convert
public static final <A,B extends Type<B>> WriteConvertedRandomAccessible<A,B> convert(RandomAccessible<A> source, SamplerConverter<? super A,B> converter)
Create aRandomAccessible
whoseRandomAccesses
Sampler.get()
you a converted sample. Conversion is done on-the-fly both when reading and writing values.- Parameters:
source
-converter
-- Returns:
- a converted
RandomAccessible
whoseRandomAccesses
perform on-the-fly value conversion using the provided converter.
-
convert
public static final <A,B extends Type<B>> RandomAccessibleInterval<B> convert(RandomAccessibleInterval<A> source, Converter<? super A,? super B> converter, B b)
Create aRandomAccessibleInterval
whoseRandomAccesses
Sampler.get()
you a converted sample. Conversion is done on-the-fly when reading values. Writing to the convertedRandomAccessibleInterval
has no effect.- Parameters:
source
-converter
-b
-- Returns:
- a converted
RandomAccessibleInterval
whoseRandomAccesses
perform on-the-fly value conversion using the provided converter.
-
convert
public static final <A,B extends Type<B>> WriteConvertedRandomAccessibleInterval<A,B> convert(RandomAccessibleInterval<A> source, SamplerConverter<? super A,B> converter)
Create aRandomAccessibleInterval
whoseRandomAccesses
Sampler.get()
you a converted sample. Conversion is done on-the-fly both when reading and writing values.- Parameters:
source
-converter
-- Returns:
- a converted
RandomAccessibleInterval
whoseRandomAccesses
perform on-the-fly value conversion using the provided converter.
-
convert
public static final <A,B extends Type<B>> IterableInterval<B> convert(IterableInterval<A> source, Converter<? super A,? super B> converter, B b)
Create aIterableInterval
whoseCursors
Sampler.get()
you a converted sample. Conversion is done on-the-fly when reading values. Writing to the convertedIterableInterval
has no effect.- Parameters:
source
-converter
-b
-- Returns:
- a converted
IterableInterval
whoseCursors
perform on-the-fly value conversion using the provided converter.
-
convert
public static final <A,B extends Type<B>> WriteConvertedIterableInterval<A,B> convert(IterableInterval<A> source, SamplerConverter<? super A,B> converter)
Create anIterableInterval
whoseCursors
Sampler.get()
you a converted sample. Conversion is done on-the-fly both when reading and writing values.- Parameters:
source
-converter
-- Returns:
- a converted
IterableInterval
whoseCursors
perform on-the-fly value conversion using the provided converter.
-
convertRandomAccessibleIterableInterval
public static final <A,B extends Type<B>,S extends RandomAccessible<A> & IterableInterval<A>> WriteConvertedIterableRandomAccessibleInterval<A,B,S> convertRandomAccessibleIterableInterval(S source, SamplerConverter<? super A,B> converter)
Create anWriteConvertedIterableRandomAccessibleInterval
whoseRandomAccesses
andCursors
Sampler.get()
you a converted sample. Conversion is done on-the-fly both when reading and writing values.- Parameters:
source
-converter
-- Returns:
- a
WriteConvertedIterableRandomAccessibleInterval
whoseSamplers
perform on-the-fly value conversion using the provided converter.
-
convert
public static final <A,B extends Type<B>> RealRandomAccessibleRealInterval<B> convert(RealRandomAccessibleRealInterval<A> source, Converter<? super A,? super B> converter, B b)
Create aRealRandomAccessibleRealInterval
whoseRealRandomAccesses
Sampler.get()
you a converted sample. Conversion is done on-the-fly when reading values. Writing to the convertedRealRandomAccessibleRealInterval
has no effect.- Parameters:
source
-converter
-b
-- Returns:
- a converted
RealRandomAccessibleRealInterval
whoseRealRandomAccesses
perform on-the-fly value conversion using the provided converter.
-
convert
public static final <A,B extends Type<B>> RealRandomAccessible<B> convert(RealRandomAccessible<A> source, Converter<? super A,? super B> converter, B b)
Create aRealRandomAccessible
whoseRealRandomAccesses
Sampler.get()
you a converted sample. Conversion is done on-the-fly when reading values. Writing to the convertedRandomAccessibleInterval
has no effect.- Parameters:
source
-converter
-b
-- Returns:
- a converted
RealRandomAccessible
whoseRealRandomAccesses
perform on-the-fly value conversion using the provided converter.
-
argbChannel
public static final WriteConvertedRandomAccessibleInterval<ARGBType,UnsignedByteType> argbChannel(RandomAccessibleInterval<ARGBType> source, int channel)
Create aWriteConvertedRandomAccessibleInterval
to one of the four channels encoded in aRandomAccessibleInterval
ofARGBType
. The source is being modified as expected by writing into the converted channels.- Parameters:
source
-channel
- 0 = alpha, 1 = red, 2 = green, 3 = blue- Returns:
- a converted
WriteConvertedRandomAccessibleInterval
whoseSamplers
perform on-the-fly value conversion into and from one channel of the originalARGBType
.
-
argbChannel
public static final WriteConvertedRandomAccessible<ARGBType,UnsignedByteType> argbChannel(RandomAccessible<ARGBType> source, int channel)
Create aWriteConvertedRandomAccessible
to one of the four channels encoded in aRandomAccessible
ofARGBType
. The source is being modified as expected by writing into the converted channels.- Parameters:
source
-channel
- 0 = alpha, 1 = red, 2 = green, 3 = blue- Returns:
- a converted
WriteConvertedRandomAccessible
whoseSamplers
perform on-the-fly value conversion into and from one channel of the originalARGBType
.
-
argbChannels
public static final RandomAccessibleInterval<UnsignedByteType> argbChannels(RandomAccessibleInterval<ARGBType> source)
Create an (n+1)-dimensionalRandomAccessible
of an n-dimensionalRandomAccessible
that maps the four channels encoded inARGBType
into a dimension. The source is being modified as expected by writing into the converted channels.- Parameters:
source
-- Returns:
- a converted
RandomAccessibleInterval
whoseSamplers
perform on-the-fly value conversion into and from the corresponding channels of the originalARGBType
.
-
argbChannels
public static final RandomAccessibleInterval<UnsignedByteType> argbChannels(RandomAccessibleInterval<ARGBType> source, int... channels)
Create an (n+1)-dimensionalRandomAccessible
of an n-dimensionalRandomAccessible
that maps the four channels encoded inARGBType
into a dimension. The order of the channels passed as arguments is preserved. The source is being modified as expected by writing into the converted channels.- Parameters:
source
-channels
- 0 = alpha, 1 = red, 2 = green, 3 = blue- Returns:
- a converted
RandomAccessibleInterval
whoseSamplers
perform on-the-fly value conversion into and from the corresponding channels of the originalARGBType
.
-
-