Package net.imglib2.converter
Class Converters
java.lang.Object
net.imglib2.converter.Converters
Convenience factory methods for sample conversion.
- Author:
- Stephan Saalfeld, Tobias Pietzsch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final WriteConvertedRandomAccessible<ARGBType, UnsignedByteType> argbChannel(RandomAccessible<ARGBType> source, int channel) Create aWriteConvertedRandomAccessibleto one of the four channels encoded in aRandomAccessibleofARGBType.static final WriteConvertedRandomAccessibleInterval<ARGBType, UnsignedByteType> argbChannel(RandomAccessibleInterval<ARGBType> source, int channel) Create aWriteConvertedRandomAccessibleIntervalto one of the four channels encoded in aRandomAccessibleIntervalofARGBType.static final RandomAccessibleInterval<UnsignedByteType> argbChannels(RandomAccessibleInterval<ARGBType> source) Create an (n+1)-dimensionalRandomAccessibleof an n-dimensionalRandomAccessiblethat maps the four channels encoded inARGBTypeinto a dimension.static final RandomAccessibleInterval<UnsignedByteType> argbChannels(RandomAccessibleInterval<ARGBType> source, int... channels) Create an (n+1)-dimensionalRandomAccessibleof an n-dimensionalRandomAccessiblethat maps the four channels encoded inARGBTypeinto a dimension.static final <A,B extends Type<B>>
IterableInterval<B> convert(IterableInterval<A> source, Converter<? super A, ? super B> converter, B b) static final <A,B extends Type<B>>
WriteConvertedIterableInterval<A, B> convert(IterableInterval<A> source, SamplerConverter<? super A, B> converter) static final <A,B extends Type<B>>
RandomAccessible<B> convert(RandomAccessible<A> source, Converter<? super A, ? super B> converter, B b) static final <A,B extends Type<B>>
WriteConvertedRandomAccessible<A, B> convert(RandomAccessible<A> source, SamplerConverter<? super A, B> converter) static final <A,B extends Type<B>>
RandomAccessibleInterval<B> convert(RandomAccessibleInterval<A> source, Converter<? super A, ? super B> converter, B b) static final <A,B extends Type<B>>
WriteConvertedRandomAccessibleInterval<A, B> convert(RandomAccessibleInterval<A> source, SamplerConverter<? super A, B> converter) static final <A,B extends Type<B>>
RealRandomAccessible<B> convert(RealRandomAccessible<A> source, Converter<? super A, ? super B> converter, B b) static final <A,B extends Type<B>>
RealRandomAccessibleRealInterval<B> convert(RealRandomAccessibleRealInterval<A> source, Converter<? super A, ? super B> converter, B b) Create aRealRandomAccessibleRealIntervalwhoseRealRandomAccessesSampler.get()you a converted sample.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 anWriteConvertedIterableRandomAccessibleIntervalwhoseRandomAccessesandCursorsSampler.get()you a converted sample.
-
Constructor Details
-
Converters
public Converters()
-
-
Method Details
-
convert
public static final <A,B extends Type<B>> RandomAccessible<B> convert(RandomAccessible<A> source, Converter<? super A, ? super B> converter, B b) Create aRandomAccessiblewhoseRandomAccessesSampler.get()you a converted sample. Conversion is done on-the-fly when reading values. Writing to the convertedRandomAccessibleIntervalhas no effect.- Parameters:
source-converter-b-- Returns:
- a converted
RandomAccessiblewhoseRandomAccessesperform 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 aRandomAccessiblewhoseRandomAccessesSampler.get()you a converted sample. Conversion is done on-the-fly both when reading and writing values.- Parameters:
source-converter-- Returns:
- a converted
RandomAccessiblewhoseRandomAccessesperform 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 aRandomAccessibleIntervalwhoseRandomAccessesSampler.get()you a converted sample. Conversion is done on-the-fly when reading values. Writing to the convertedRandomAccessibleIntervalhas no effect.- Parameters:
source-converter-b-- Returns:
- a converted
RandomAccessibleIntervalwhoseRandomAccessesperform 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 aRandomAccessibleIntervalwhoseRandomAccessesSampler.get()you a converted sample. Conversion is done on-the-fly both when reading and writing values.- Parameters:
source-converter-- Returns:
- a converted
RandomAccessibleIntervalwhoseRandomAccessesperform 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 aIterableIntervalwhoseCursorsSampler.get()you a converted sample. Conversion is done on-the-fly when reading values. Writing to the convertedIterableIntervalhas no effect.- Parameters:
source-converter-b-- Returns:
- a converted
IterableIntervalwhoseCursorsperform 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 anIterableIntervalwhoseCursorsSampler.get()you a converted sample. Conversion is done on-the-fly both when reading and writing values.- Parameters:
source-converter-- Returns:
- a converted
IterableIntervalwhoseCursorsperform on-the-fly value conversion using the provided converter.
-
convertRandomAccessibleIterableInterval
public static final <A,B extends Type<B>, WriteConvertedIterableRandomAccessibleInterval<A,S extends RandomAccessible<A> & IterableInterval<A>> B, convertRandomAccessibleIterableIntervalS> (S source, SamplerConverter<? super A, B> converter) Create anWriteConvertedIterableRandomAccessibleIntervalwhoseRandomAccessesandCursorsSampler.get()you a converted sample. Conversion is done on-the-fly both when reading and writing values.- Parameters:
source-converter-- Returns:
- a
WriteConvertedIterableRandomAccessibleIntervalwhoseSamplersperform 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 aRealRandomAccessibleRealIntervalwhoseRealRandomAccessesSampler.get()you a converted sample. Conversion is done on-the-fly when reading values. Writing to the convertedRealRandomAccessibleRealIntervalhas no effect.- Parameters:
source-converter-b-- Returns:
- a converted
RealRandomAccessibleRealIntervalwhoseRealRandomAccessesperform 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 aRealRandomAccessiblewhoseRealRandomAccessesSampler.get()you a converted sample. Conversion is done on-the-fly when reading values. Writing to the convertedRandomAccessibleIntervalhas no effect.- Parameters:
source-converter-b-- Returns:
- a converted
RealRandomAccessiblewhoseRealRandomAccessesperform on-the-fly value conversion using the provided converter.
-
argbChannel
public static final WriteConvertedRandomAccessibleInterval<ARGBType,UnsignedByteType> argbChannel(RandomAccessibleInterval<ARGBType> source, int channel) Create aWriteConvertedRandomAccessibleIntervalto one of the four channels encoded in aRandomAccessibleIntervalofARGBType. 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
WriteConvertedRandomAccessibleIntervalwhoseSamplersperform 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 aWriteConvertedRandomAccessibleto one of the four channels encoded in aRandomAccessibleofARGBType. 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
WriteConvertedRandomAccessiblewhoseSamplersperform 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)-dimensionalRandomAccessibleof an n-dimensionalRandomAccessiblethat maps the four channels encoded inARGBTypeinto a dimension. The source is being modified as expected by writing into the converted channels.- Parameters:
source-- Returns:
- a converted
RandomAccessibleIntervalwhoseSamplersperform 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)-dimensionalRandomAccessibleof an n-dimensionalRandomAccessiblethat maps the four channels encoded inARGBTypeinto 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
RandomAccessibleIntervalwhoseSamplersperform on-the-fly value conversion into and from the corresponding channels of the originalARGBType.
-