- java.lang.Object
-
- net.imglib2.imagej.RAIToImagePlus
-
public class RAIToImagePlus extends Object
Utilities for wrappingRandomAccessibleIntervals intoImagePluses.Under the hood, conversion utilizes
ImageJVirtualStack, allowing read/write operations to the backingRandomAccessibleInterval.- Author:
- Tobis Pietzsch, Stephan Preibisch, Stephan Saalfeld, Gabriel Selzer
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends net.imglib2.type.numeric.RealType<T>>
ij.ImagePlusconvertRGB(net.imglib2.RandomAccessibleInterval<T> img, String title)Create a 24bit RGBImagePlusfrom aRandomAccessibleIntervala using a defaultConverter.static <T extends net.imglib2.type.numeric.NumericType<T>>
ij.ImagePluswrap(net.imglib2.RandomAccessibleInterval<T> img, String title)Create a single channelImagePlusfrom aRandomAccessibleInterval.static <T extends net.imglib2.type.numeric.NumericType<T>>
ij.ImagePluswrap(net.imglib2.RandomAccessibleInterval<T> img, String title, ExecutorService service)Create a single channelImagePlusfrom aRandomAccessibleInterval.static <B extends net.imglib2.type.BooleanType<B>>
ij.ImagePluswrapAndScaleBoolean(net.imglib2.RandomAccessibleInterval<B> img, String title)Create a single channel 8-bit unsigned integerImagePlusfrom aBooleanTypeRandomAccessibleIntervalusing a customConverter.static <B extends net.imglib2.type.BooleanType<B>>
ij.ImagePluswrapAndScaleBoolean(net.imglib2.RandomAccessibleInterval<B> img, String title, ExecutorService service)Create a single channel 8-bit unsigned integerImagePlusfrom aBooleanTypeRandomAccessibleIntervalusing a customConverter.static <B extends net.imglib2.type.BooleanType<B>>
ij.ImagePluswrapBoolean(net.imglib2.RandomAccessibleInterval<B> img, String title)Create a single channel 8-bit unsigned integerImagePlusfrom aBooleanTypeRandomAccessibleIntervalusing a customConverter.static <B extends net.imglib2.type.BooleanType<B>>
ij.ImagePluswrapBoolean(net.imglib2.RandomAccessibleInterval<B> img, String title, ExecutorService service)Create a single channel 8-bit unsigned integerImagePlusfrom aBooleanTypeRandomAccessibleIntervalusing a customConverter.static <T extends net.imglib2.type.numeric.RealType<T>>
ij.ImagePluswrapFloat(net.imglib2.RandomAccessibleInterval<T> img, String title)Create a single channel 32-bit floatImagePlusfrom aRandomAccessibleIntervalusing a defaultConverter.static <T extends net.imglib2.type.numeric.RealType<T>>
ij.ImagePluswrapFloat(net.imglib2.RandomAccessibleInterval<T> img, String title, ExecutorService service)Create a single channel 32-bit floatImagePlusfrom aRandomAccessibleIntervalusing a defaultConverter.static <T> ij.ImagePluswrapFloat(net.imglib2.RandomAccessibleInterval<T> img, net.imglib2.converter.Converter<T,net.imglib2.type.numeric.real.FloatType> converter, String title)Create a single channel 32-bit floatImagePlusfrom aRandomAccessibleIntervalusing a customConverter.static <T> ij.ImagePluswrapFloat(net.imglib2.RandomAccessibleInterval<T> img, net.imglib2.converter.Converter<T,net.imglib2.type.numeric.real.FloatType> converter, String title, ExecutorService service)Create a single channel 32-bit floatImagePlusfrom aRandomAccessibleIntervalusing a customConverter.static ij.ImagePluswrapRGB(net.imglib2.RandomAccessibleInterval<net.imglib2.type.numeric.ARGBType> img, String title)Create a 24bit RGBImagePluswrapping aRandomAccessibleIntervalwithARGBTypeelements.static ij.ImagePluswrapRGB(net.imglib2.RandomAccessibleInterval<net.imglib2.type.numeric.ARGBType> img, String title, ExecutorService service)Create a 24bit RGBImagePlusfrom aRandomAccessibleIntervalwithARGBTypeelements.static <T extends net.imglib2.type.numeric.RealType<T>>
ij.ImagePluswrapUnsignedByte(net.imglib2.RandomAccessibleInterval<T> img, String title)Create a single channel 8-bit unsigned integerImagePlusfrom aRandomAccessibleIntervalusing a customConverter.static <T extends net.imglib2.type.numeric.RealType<T>>
ij.ImagePluswrapUnsignedByte(net.imglib2.RandomAccessibleInterval<T> img, String title, ExecutorService service)Create a single channel 8-bit unsigned integerImagePlusfrom aRandomAccessibleIntervalusing a customConverter.static <T> ij.ImagePluswrapUnsignedByte(net.imglib2.RandomAccessibleInterval<T> img, net.imglib2.converter.Converter<T,net.imglib2.type.numeric.integer.UnsignedByteType> converter, String title)Create a single channel 8-bit unsigned integerImagePlusfrom aRandomAccessibleIntervalusing a customConverter.static <T> ij.ImagePluswrapUnsignedByte(net.imglib2.RandomAccessibleInterval<T> img, net.imglib2.converter.Converter<T,net.imglib2.type.numeric.integer.UnsignedByteType> converter, String title, ExecutorService service)Create a single channel 8-bit unsigned integerImagePlusfrom aRandomAccessibleIntervalusing a customConverter.static <T extends net.imglib2.type.numeric.RealType<T>>
ij.ImagePluswrapUnsignedShort(net.imglib2.RandomAccessibleInterval<T> img, String title)Create a single channel 16-bit unsigned integerImagePlusfrom aRandomAccessibleIntervalusing a defaultConverter(clamp values to range [0, 65535]).static <T extends net.imglib2.type.numeric.RealType<T>>
ij.ImagePluswrapUnsignedShort(net.imglib2.RandomAccessibleInterval<T> img, String title, ExecutorService service)Create a single channel 16-bit unsigned integerImagePlusfrom aRandomAccessibleIntervalusing a defaultConverter(clamp values to range [0, 65535]).static <T> ij.ImagePluswrapUnsignedShort(net.imglib2.RandomAccessibleInterval<T> img, net.imglib2.converter.Converter<T,net.imglib2.type.numeric.integer.UnsignedShortType> converter, String title)Create a single channel 16-bit unsigned integerImagePlusfrom aRandomAccessibleIntervalusing a customConverter.static <T> ij.ImagePluswrapUnsignedShort(net.imglib2.RandomAccessibleInterval<T> img, net.imglib2.converter.Converter<T,net.imglib2.type.numeric.integer.UnsignedShortType> converter, String title, ExecutorService service)Create a single channel 16-bit unsigned integerImagePlusfrom aRandomAccessibleIntervalusing a customConverter.static ij.ImagePluswrapVirtualStack(net.imglib2.RandomAccessibleInterval<?> rai, String title)Wraps anRandomAccessibleIntervalinto anImagePlus.static <B extends net.imglib2.type.BooleanType<B>>
ij.ImagePluswrapVirtualStackAndScaleBooleanType(net.imglib2.RandomAccessibleInterval<B> rai, String title)Similar towrapVirtualStack(RandomAccessibleInterval, String), but works only forRandomAccessibleIntervals ofBitType.
-
-
-
Method Detail
-
wrap
public static <T extends net.imglib2.type.numeric.NumericType<T>> ij.ImagePlus wrap(net.imglib2.RandomAccessibleInterval<T> img, String title, ExecutorService service)
Create a single channelImagePlusfrom aRandomAccessibleInterval. The image type of the result (ImagePlus.GRAY8, ImagePlus.GRAY16, ImagePlus.GRAY32, ImagePlus.COLOR_256 or ImagePlus.COLOR_RGB) is inferred from the generic type of the inputRandomAccessibleInterval.- Type Parameters:
T- element type in source image- Parameters:
img- theRandomAccessibleIntervalto wraptitle- the name to assign to the wrappedImagePlusservice- anExecutorServiceto manage asynchronous tasks- Returns:
- an
ImagePluswrappingimgnamedtitle
-
wrap
public static <T extends net.imglib2.type.numeric.NumericType<T>> ij.ImagePlus wrap(net.imglib2.RandomAccessibleInterval<T> img, String title)
Create a single channelImagePlusfrom aRandomAccessibleInterval. The image type of the result (ImagePlus.GRAY8, ImagePlus.GRAY16, ImagePlus.GRAY32, ImagePlus.COLOR_256 or ImagePlus.COLOR_RGB) is inferred from the generic type of the inputRandomAccessibleInterval.- Type Parameters:
T- element type in source image- Parameters:
img- theRandomAccessibleIntervalto wraptitle- the name to assign to the wrappedImagePlus- Returns:
- an
ImagePluswrappingimgnamedtitle
-
wrapFloat
public static <T extends net.imglib2.type.numeric.RealType<T>> ij.ImagePlus wrapFloat(net.imglib2.RandomAccessibleInterval<T> img, String title, ExecutorService service)
Create a single channel 32-bit floatImagePlusfrom aRandomAccessibleIntervalusing a defaultConverter.- Type Parameters:
T- element type in source image- Parameters:
img- the data to wrap.title- the title to set on the resultingImagePlus.service- anExecutorServiceused for processing.- Returns:
- an RGB
ImagePluswrappingimg
-
wrapFloat
public static <T extends net.imglib2.type.numeric.RealType<T>> ij.ImagePlus wrapFloat(net.imglib2.RandomAccessibleInterval<T> img, String title)
Create a single channel 32-bit floatImagePlusfrom aRandomAccessibleIntervalusing a defaultConverter.- Type Parameters:
T- element type in source image- Parameters:
img- the data to wrap.title- the title to set on the resultingImagePlus.- Returns:
- an RGB
ImagePluswrappingimg
-
wrapFloat
public static <T> ij.ImagePlus wrapFloat(net.imglib2.RandomAccessibleInterval<T> img, net.imglib2.converter.Converter<T,net.imglib2.type.numeric.real.FloatType> converter, String title, ExecutorService service)
Create a single channel 32-bit floatImagePlusfrom aRandomAccessibleIntervalusing a customConverter.- Type Parameters:
T- element type in source image- Parameters:
img- the data to wrap.converter- aConverterturningRAIToImagePlusinto a anFloatTypetitle- the title to set on the resultingImagePlus.service- anExecutorServiceused for processing.- Returns:
- an RGB
ImagePluswrappingimg
-
wrapFloat
public static <T> ij.ImagePlus wrapFloat(net.imglib2.RandomAccessibleInterval<T> img, net.imglib2.converter.Converter<T,net.imglib2.type.numeric.real.FloatType> converter, String title)
Create a single channel 32-bit floatImagePlusfrom aRandomAccessibleIntervalusing a customConverter.- Type Parameters:
T- element type in source image- Parameters:
img- the data to wrap.converter- aConverterturningRAIToImagePlusinto a anFloatTypetitle- the title to set on the resultingImagePlus.- Returns:
- an RGB
ImagePluswrappingimg
-
wrapRGB
public static ij.ImagePlus wrapRGB(net.imglib2.RandomAccessibleInterval<net.imglib2.type.numeric.ARGBType> img, String title, ExecutorService service)
Create a 24bit RGBImagePlusfrom aRandomAccessibleIntervalwithARGBTypeelements.- Parameters:
img- the data to wrap.title- the title to set on the resultingImagePlus.service- anExecutorServiceused for processing.- Returns:
- an RGB
ImagePluswrappingimg
-
wrapRGB
public static ij.ImagePlus wrapRGB(net.imglib2.RandomAccessibleInterval<net.imglib2.type.numeric.ARGBType> img, String title)
Create a 24bit RGBImagePluswrapping aRandomAccessibleIntervalwithARGBTypeelements.- Parameters:
img- theRandomAccessibleIntervalto wraptitle- the name assigned to the resultingImagePlus- Returns:
- an RGB
ImagePluswrappingimg
-
convertRGB
public static <T extends net.imglib2.type.numeric.RealType<T>> ij.ImagePlus convertRGB(net.imglib2.RandomAccessibleInterval<T> img, String title)
Create a 24bit RGBImagePlusfrom aRandomAccessibleIntervala using a defaultConverter.- Type Parameters:
T- element type in source image- Parameters:
img- theRandomAccessibleIntervalto wraptitle- the name assigned to the resultingImagePlus- Returns:
- an RGB
ImagePluswrappingimg
-
wrapUnsignedByte
public static <T extends net.imglib2.type.numeric.RealType<T>> ij.ImagePlus wrapUnsignedByte(net.imglib2.RandomAccessibleInterval<T> img, String title, ExecutorService service)
Create a single channel 8-bit unsigned integerImagePlusfrom aRandomAccessibleIntervalusing a customConverter.- Type Parameters:
T- element type in source image- Parameters:
img- theRandomAccessibleIntervalto wraptitle- the name assigned to the resultingImagePlusservice- theExecutorServiceused for processing.- Returns:
- an
ImagePluswrappingimg
-
wrapUnsignedByte
public static <T extends net.imglib2.type.numeric.RealType<T>> ij.ImagePlus wrapUnsignedByte(net.imglib2.RandomAccessibleInterval<T> img, String title)
Create a single channel 8-bit unsigned integerImagePlusfrom aRandomAccessibleIntervalusing a customConverter.- Type Parameters:
T- element type in source image- Parameters:
img- theRandomAccessibleIntervalto wraptitle- the name assigned to the resultingImagePlus- Returns:
- an
ImagePluswrappingimg
-
wrapUnsignedByte
public static <T> ij.ImagePlus wrapUnsignedByte(net.imglib2.RandomAccessibleInterval<T> img, net.imglib2.converter.Converter<T,net.imglib2.type.numeric.integer.UnsignedByteType> converter, String title, ExecutorService service)
Create a single channel 8-bit unsigned integerImagePlusfrom aRandomAccessibleIntervalusing a customConverter.- Type Parameters:
T- element type in source image- Parameters:
img- theRandomAccessibleIntervalto wrapconverter- aConverterturningRAIToImagePlusinto a anUnsignedByteTypetitle- the name assigned to the resultingImagePlusservice- theExecutorServiceused for processing.- Returns:
- an
ImagePluswrappingimg
-
wrapUnsignedByte
public static <T> ij.ImagePlus wrapUnsignedByte(net.imglib2.RandomAccessibleInterval<T> img, net.imglib2.converter.Converter<T,net.imglib2.type.numeric.integer.UnsignedByteType> converter, String title)
Create a single channel 8-bit unsigned integerImagePlusfrom aRandomAccessibleIntervalusing a customConverter.- Type Parameters:
T- element type in source image- Parameters:
img- theRandomAccessibleIntervalto wrapconverter- aConverterturningRAIToImagePlusinto a anUnsignedByteTypetitle- the name assigned to the resultingImagePlus- Returns:
- an
ImagePluswrappingimg
-
wrapUnsignedShort
public static <T extends net.imglib2.type.numeric.RealType<T>> ij.ImagePlus wrapUnsignedShort(net.imglib2.RandomAccessibleInterval<T> img, String title, ExecutorService service)
Create a single channel 16-bit unsigned integerImagePlusfrom aRandomAccessibleIntervalusing a defaultConverter(clamp values to range [0, 65535]).- Type Parameters:
T- element type in source image- Parameters:
img- theRandomAccessibleIntervalto wraptitle- the name assigned to the resultingImagePlusservice- theExecutorServiceused for processing.- Returns:
- an
ImagePluswrappingimg
-
wrapUnsignedShort
public static <T extends net.imglib2.type.numeric.RealType<T>> ij.ImagePlus wrapUnsignedShort(net.imglib2.RandomAccessibleInterval<T> img, String title)
Create a single channel 16-bit unsigned integerImagePlusfrom aRandomAccessibleIntervalusing a defaultConverter(clamp values to range [0, 65535]).- Type Parameters:
T- element type in source image- Parameters:
img- theRandomAccessibleIntervalto wraptitle- the name assigned to the resultingImagePlus- Returns:
- an
ImagePluswrappingimg
-
wrapUnsignedShort
public static <T> ij.ImagePlus wrapUnsignedShort(net.imglib2.RandomAccessibleInterval<T> img, net.imglib2.converter.Converter<T,net.imglib2.type.numeric.integer.UnsignedShortType> converter, String title, ExecutorService service)
Create a single channel 16-bit unsigned integerImagePlusfrom aRandomAccessibleIntervalusing a customConverter.- Type Parameters:
T- element type in source image- Parameters:
img- theRandomAccessibleIntervalto wrapconverter- aConverterturningRAIToImagePlusinto a anUnsignedShortTypetitle- the name assigned to the resultingImagePlusservice- theExecutorServiceused for processing.- Returns:
- an
ImagePluswrappingimg
-
wrapUnsignedShort
public static <T> ij.ImagePlus wrapUnsignedShort(net.imglib2.RandomAccessibleInterval<T> img, net.imglib2.converter.Converter<T,net.imglib2.type.numeric.integer.UnsignedShortType> converter, String title)
Create a single channel 16-bit unsigned integerImagePlusfrom aRandomAccessibleIntervalusing a customConverter.- Type Parameters:
T- element type in source image- Parameters:
img- theRandomAccessibleIntervalto wrapconverter- aConverterturningRAIToImagePlusinto a anUnsignedShortTypetitle- the name assigned to the resultingImagePlus- Returns:
- an
ImagePluswrappingimg
-
wrapBoolean
public static <B extends net.imglib2.type.BooleanType<B>> ij.ImagePlus wrapBoolean(net.imglib2.RandomAccessibleInterval<B> img, String title, ExecutorService service)
Create a single channel 8-bit unsigned integerImagePlusfrom aBooleanTypeRandomAccessibleIntervalusing a customConverter.- Type Parameters:
B- element type in source image- Parameters:
img- theRandomAccessibleIntervalto wraptitle- the name assigned to the resultingImagePlusservice- theExecutorServiceused for processing.- Returns:
- an
ImagePluswrappingimg - See Also:
for wrapping with scaling.
-
wrapBoolean
public static <B extends net.imglib2.type.BooleanType<B>> ij.ImagePlus wrapBoolean(net.imglib2.RandomAccessibleInterval<B> img, String title)
Create a single channel 8-bit unsigned integerImagePlusfrom aBooleanTypeRandomAccessibleIntervalusing a customConverter.- Type Parameters:
B- element type in source image- Parameters:
img- theRandomAccessibleIntervalto wraptitle- the name assigned to the resultingImagePlus- Returns:
- an
ImagePluswrappingimg - See Also:
for wrapping with scaling.
-
wrapAndScaleBoolean
public static <B extends net.imglib2.type.BooleanType<B>> ij.ImagePlus wrapAndScaleBoolean(net.imglib2.RandomAccessibleInterval<B> img, String title, ExecutorService service)
Create a single channel 8-bit unsigned integerImagePlusfrom aBooleanTypeRandomAccessibleIntervalusing a customConverter.Note that this method scales the result such that
truevalues inimgare mapped to255in the resultingImagePlus.- Type Parameters:
B- element type in source image- Parameters:
img- theRandomAccessibleIntervalto wraptitle- the name assigned to the resultingImagePlusservice- theExecutorServiceused for processing.- Returns:
- an
ImagePluswrappingimg - See Also:
for wrapping without scaling.
-
wrapAndScaleBoolean
public static <B extends net.imglib2.type.BooleanType<B>> ij.ImagePlus wrapAndScaleBoolean(net.imglib2.RandomAccessibleInterval<B> img, String title)
Create a single channel 8-bit unsigned integerImagePlusfrom aBooleanTypeRandomAccessibleIntervalusing a customConverter.Note that this method scales the result such that
truevalues inimgare mapped to255in the resultingImagePlus.- Type Parameters:
B- element type in source image- Parameters:
img- theRandomAccessibleIntervalto wraptitle- the name assigned to the resultingImagePlus- Returns:
- an
ImagePluswrappingimg - See Also:
for wrapping without scaling.
-
wrapVirtualStack
public static ij.ImagePlus wrapVirtualStack(net.imglib2.RandomAccessibleInterval<?> rai, String title)
Wraps anRandomAccessibleIntervalinto anImagePlus. The image can beRealTypeorARGBType. TheImagePlusis backed by a specialVirtualStack, which copies an plane from the given image, instead of it plane from a file.Only up to five dimensions are supported. Axes can might be arbitrary. The image title and calibration are derived from the given image.
- Parameters:
rai- theRandomAccessibleIntervalto converttitle- the title to assign to the output- Returns:
- an
ImagePluswrappingrai - See Also:
ArrayImgToImagePlus
-
wrapVirtualStackAndScaleBooleanType
public static <B extends net.imglib2.type.BooleanType<B>> ij.ImagePlus wrapVirtualStackAndScaleBooleanType(net.imglib2.RandomAccessibleInterval<B> rai, String title)
Similar towrapVirtualStack(RandomAccessibleInterval, String), but works only forRandomAccessibleIntervals ofBitType. The pixel values of 0 and 1 are scaled to 0 and 255.- Parameters:
rai- theRandomAccessibleIntervalto convert. Must contain bits.title- the title to assign to the output- Returns:
- an
ImagePluswrappingrai - See Also:
ArrayImgToImagePlus
-
-