public class ImageJUtils extends Object
Constructor and Description |
---|
ImageJUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
assert2DImage(ij.ImagePlus image) |
static void |
assert3DImage(ij.ImagePlus image) |
static void |
assert4DImage(ij.ImagePlus image) |
static void |
assert5DImage(ij.ImagePlus image) |
static void |
assertImageDimensions(ij.ImagePlus image,
int maxDimensions) |
static Class<? extends ImagePlusData> |
bitDepthToImagePlusDataType(int bitDepth)
Returns the general
ImagePlusData class for a bit depth |
static double[] |
calculateCalibration(ij.process.ImageProcessor imp,
ImageJCalibrationMode calibrationMode,
double customMin,
double customMax,
ij.process.ImageStatistics stats) |
static void |
calibrate(ij.ImagePlus imp,
ImageJCalibrationMode calibrationMode,
double customMin,
double customMax)
Calibrates the image (all processors).
|
static void |
calibrate(ij.process.ImageProcessor imp,
ImageJCalibrationMode calibrationMode,
double customMin,
double customMax,
ij.process.ImageStatistics stats) |
static ij.ImagePlus |
channelsToRGB(ij.ImagePlus image)
Converted a 3-channel image into RGB (reducing the dimensionality)
|
static ij.ImagePlus |
combineSlices(Map<ImageSliceIndex,ij.process.ImageProcessor> slices)
Combines the slices in the map into one image.
|
static ij.ImagePlus |
convert3ChannelToRGBIfNeeded(ij.ImagePlus image)
Converts an
ImagePlus to the color space of this data. |
static void |
convertHSBToRGB(ij.ImagePlus img,
JIPipeProgressInfo progressInfo)
Converts an HSB image to RGB (re-using the same components)
|
static void |
convertLABToRGB(ij.ImagePlus img,
JIPipeProgressInfo progressInfo)
Converts an LAB image to RGB
L is stored unsigned (0-255)
A is stored signed (-128-127)
B is stored signed (-128-127)
|
static void |
convertRGBToHSB(ij.ImagePlus img,
JIPipeProgressInfo progressInfo)
Converts an RGB image to HSB (re-using the same components)
|
static void |
convertRGBToLAB(ij.ImagePlus img,
JIPipeProgressInfo progressInfo)
Converts an RGB image to LAB
L is stored unsigned (0-255)
A is stored signed (-128-127)
B is stored signed (-128-127)
|
static ij.ImagePlus |
convertToBitDepthIfNeeded(ij.ImagePlus imagePlus,
int bitDepth) |
static ij.ImagePlus |
convertToColorHSBIfNeeded(ij.ImagePlus image)
Converts an
ImagePlus to the color space of this data. |
static ij.ImagePlus |
convertToColorLABIfNeeded(ij.ImagePlus image)
Converts an
ImagePlus to the color space of this data. |
static ij.ImagePlus |
convertToColorRGBIfNeeded(ij.ImagePlus image)
Converts an
ImagePlus to the color space of this data. |
static List<ij.ImagePlus> |
convertToConsensusBitDepthIfNeeded(Collection<ij.ImagePlus> images) |
static ij.ImagePlus |
convertToGrayscale16UIfNeeded(ij.ImagePlus image)
Converts an
ImagePlus to the color space of this data. |
static ij.ImagePlus |
convertToGrayscale32FIfNeeded(ij.ImagePlus image)
Converts an
ImagePlus to the color space of this data. |
static ij.ImagePlus |
convertToGreyscale8UIfNeeded(ij.ImagePlus image)
Converts an
ImagePlus to the color space of this data. |
static ij.ImagePlus |
convertToGreyscaleIfNeeded(ij.ImagePlus image)
Converts an
ImagePlus to the color space of this data. |
static ij.ImagePlus |
convertToSameTypeIfNeeded(ij.ImagePlus image,
ij.ImagePlus reference,
boolean doScaling)
Converts this image to the same type as the other one if needed
|
static void |
convolveSlice(ij.plugin.filter.Convolver convolver,
int kernelWidth,
int kernelHeight,
float[] kernel,
ij.process.ImageProcessor imp) |
static void |
copyHyperstackDimensions(ij.ImagePlus src,
ij.ImagePlus target)
Copies the hyperstack dimensions from one image to another
src and target must have the same number of slices!
|
static void |
copyPixelsBetweenImages(ij.ImagePlus src,
ij.ImagePlus target,
JIPipeProgressInfo progressInfo)
Copies all data from the source to the target image
|
static ij.process.LUT |
createGrayscaleLUTFromGradient(List<ColorUtils.GradientStop> stops) |
static ij.process.LUT |
createLUTFromGradient(List<ColorUtils.GradientStop> stops) |
static ImageCanvas |
createZoomedDummyCanvas(ij.ImagePlus image,
double magnification)
Creates a dummy canvas that contains the appropriate magnification settings
|
static ImageCanvas |
createZoomedDummyCanvas(ij.ImagePlus image,
Rectangle renderArea)
Creates a dummy canvas that contains the appropriate magnification settings
|
static Map<ImageSliceIndex,ij.process.ImageProcessor> |
deduplicateSliceMappingByOverwriting(Map<ij.process.ImageProcessor,ImageSliceIndex> sliceMappings,
boolean silentlyOverwriteDuplicates) |
static void |
drawAnchoredStringLabel(ij.process.ImageProcessor ip,
String label,
Rectangle availableSpace,
Color foreground,
Color background,
Font font,
boolean drawBackground,
Anchor anchor) |
static void |
drawCenteredStringLabel(ij.ImagePlus imp,
ij.process.ImageProcessor ip,
String label,
Rectangle r,
Color foreground,
Color background,
Font font,
boolean drawBackground) |
static ij.ImagePlus |
duplicate(ij.ImagePlus imp)
Faster version of the duplicate() method in
ImagePlus . |
static ij.ImagePlus |
ensureEqualSize(ij.ImagePlus target,
ij.ImagePlus reference,
boolean copySlices)
Applies copy-scaling to ensure that the target image has the same size as the reference image
Will silently drop slices that are outside the range of the reference image
|
static ij.ImagePlus |
ensureSize(ij.ImagePlus target,
int nChannels,
int nSlices,
int nFrames,
boolean copySlices)
Returns an image that has the specified size by copying
|
static ij.ImagePlus |
expandImageCanvas(ij.ImagePlus imp,
Color backgroundColor,
int newWidth,
int newHeight,
Anchor anchor)
Expands the canvas of an image
|
static ij.process.ImageProcessor |
expandImageProcessorCanvas(ij.process.ImageProcessor ipOld,
Color backgroundColor,
int wNew,
int hNew,
int xOff,
int yOff) |
static ij.ImageStack |
expandImageStackCanvas(ij.ImageStack stackOld,
Color backgroundColor,
int wNew,
int hNew,
int xOff,
int yOff) |
static ij.ImagePlus |
extractCTStack(ij.ImagePlus img,
int c,
int t) |
static ij.process.ImageProcessor |
extractFromProcessor(ij.process.ImageProcessor processor,
Rectangle source) |
static void |
forEachIndexedCTStack(ij.ImagePlus img,
TriConsumer<ij.ImagePlus,ImageSliceIndex,JIPipeProgressInfo> function,
JIPipeProgressInfo progressInfo)
Runs the function for each Z, C, and T slice.
|
static void |
forEachIndexedSlice(ij.ImagePlus img,
BiConsumer<ij.process.ImageProcessor,Integer> function,
JIPipeProgressInfo progressInfo)
Runs the function for each slice
|
static void |
forEachIndexedZCTSlice(ij.ImagePlus img,
BiConsumer<ij.process.ImageProcessor,ImageSliceIndex> function,
JIPipeProgressInfo progressInfo)
Runs the function for each Z, C, and T slice.
|
static void |
forEachIndexedZCTSliceWithProgress(ij.ImagePlus img,
TriConsumer<ij.process.ImageProcessor,ImageSliceIndex,JIPipeProgressInfo> function,
JIPipeProgressInfo progressInfo)
Runs the function for each Z, C, and T slice.
|
static void |
forEachIndexedZTSlice(ij.ImagePlus img,
BiConsumer<Map<Integer,ij.process.ImageProcessor>,ImageSliceIndex> function,
JIPipeProgressInfo progressInfo)
Deprecated.
|
static void |
forEachSlice(ij.ImagePlus img,
Consumer<ij.process.ImageProcessor> function,
JIPipeProgressInfo progressInfo)
Runs the function for each slice
|
static ij.ImagePlus |
generateForEachIndexedZCTSlice(ij.ImagePlus sourceImage,
BiFunction<ij.process.ImageProcessor,ImageSliceIndex,ij.process.ImageProcessor> function,
JIPipeProgressInfo progressInfo)
Runs the function for each Z, C, and T slice.
|
static Component |
generatePreview(ij.ImagePlus image,
ColorSpace colorSpace,
int width,
int height)
Generates a preview for a colored image with color space
|
static JIPipeImageThumbnailData |
generateThumbnail(ij.ImagePlus image,
ColorSpace colorSpace,
int width,
int height)
Generates a thumbnail for a colored image with color space
|
static ij.process.LUT[] |
getChannelLUT(ij.ImagePlus image) |
static ij.process.ImageProcessor |
getClosestSliceZero(ij.ImagePlus image,
ImageSliceIndex index)
Gets the slice closest to the requested slice index (zero-based).
|
static int |
getConsensusBitDepth(Collection<ij.ImagePlus> images)
Returns the lowest ImageJ image type that can contain all images.
|
static Map<String,String> |
getImageProperties(ij.ImagePlus imagePlus)
Returns the persistent properties of a
ImagePlus as map |
static void |
getMaskedPixels_16U(ij.process.ImageProcessor ip,
ij.process.ImageProcessor mask,
gnu.trove.list.array.TShortArrayList target) |
static void |
getMaskedPixels_32F(ij.process.ImageProcessor ip,
ij.process.ImageProcessor mask,
gnu.trove.list.array.TFloatArrayList target) |
static void |
getMaskedPixels_8U(ij.process.ImageProcessor ip,
ij.process.ImageProcessor mask,
gnu.trove.list.array.TByteArrayList target) |
static void |
getMaskedPixels_Slow(ij.process.ImageProcessor ip,
ij.process.ImageProcessor mask,
List<Float> target) |
static Quantity |
getPixelSizeX(ij.ImagePlus imp) |
static Quantity |
getPixelSizeY(ij.ImagePlus imp) |
static Quantity |
getPixelSizeZ(ij.ImagePlus imp) |
static Map<String,String> |
getRoiProperties(Roi roi)
Returns the properties of a
Roi as map |
static ij.process.ImageProcessor |
getSliceZero(ij.ImagePlus img,
ImageSliceIndex index)
Gets slice from image
|
static ij.process.ImageProcessor |
getSliceZero(ij.ImagePlus img,
int c,
int z,
int t)
Gets slice from image
|
static ij.process.ImageProcessor |
getSliceZeroSafe(ij.ImagePlus img,
ImageSliceIndex index)
Gets slice from image.
|
static ij.process.ImageProcessor |
getSliceZeroSafe(ij.ImagePlus img,
int c,
int z,
int t)
Gets slice from image
Will not trigger an
IndexOutOfBoundsException |
static boolean |
imagesHaveSameSize(Collection<ij.ImagePlus> images) |
static boolean |
imagesHaveSameSize(ij.ImagePlus... images) |
static Roi |
intersectROI(Roi roi1,
Roi roi2) |
static ij.process.LUT |
lutFromImage(ij.ImagePlus image)
Converts an image into a LUT.
|
static ij.ImagePlus |
lutToImage(ij.process.LUT lut,
int width,
int height)
Converts a LUT into an RGB image
|
static void |
maskToBufferedImage(ij.process.ImageProcessor mask,
BufferedImage target,
Color foreground,
Color background)
Copies a mask into a
BufferedImage |
static ResultsTableData |
measureROI(Roi roi,
ij.ImagePlus reference,
boolean physicalUnits,
Measurement... statistics) |
static ij.ImagePlus |
mergeMappedSlices(Map<ImageSliceIndex,ij.process.ImageProcessor> sliceMap) |
static int |
oneSliceIndexToOneStackIndex(int channel,
int slice,
int frame,
ij.ImagePlus imagePlus)
Stack index (one-based)
|
static int |
oneSliceIndexToOneStackIndex(int channel,
int slice,
int frame,
int nChannels,
int nSlices,
int nFrames)
Stack index (one-based)
|
static Map<ImageSliceIndex,DisplayRange> |
readCalibration(ij.ImagePlus imagePlus) |
static void |
removeLUT(ij.ImagePlus image,
Set<Integer> channels) |
static void |
removeOverlay(ij.ImagePlus image) |
static ij.ImagePlus |
renderToRGBWithLUTIfNeeded(ij.ImagePlus inputImage,
JIPipeProgressInfo progressInfo)
Renders a non-RGB image to RGB, including LUT
|
static int |
rgbPixelLerp(int A,
int B,
double opacity) |
static ij.ImagePlus |
rgbToChannels(ij.ImagePlus image)
Convert a RGB image to a grayscale image where the RGB channels are split into individual planes
|
static ij.ImagePlus |
rotate(ij.ImagePlus img,
double degrees,
boolean expandCanvas,
Color background,
boolean addRoi,
JIPipeProgressInfo progressInfo)
Rotates the image by a specified amount of degrees to the right
|
static ij.ImagePlus |
runOnImage(ij.ImagePlus img,
ij.plugin.PlugIn plugin,
Object... parameters)
Runs a command on a copy of an ImageJ image
|
static ij.ImagePlus |
runOnImage(ij.ImagePlus img,
String command,
Object... parameters)
Runs a command on an ImageJ image
|
static ij.ImagePlus |
runOnNewImage(ij.ImagePlus img,
ij.plugin.PlugIn plugin,
Object... parameters)
Runs a command on a copy of an ImageJ image
|
static ij.ImagePlus |
runOnNewImage(ij.ImagePlus img,
String command,
Object... parameters)
Runs a command on a copy of an ImageJ image
|
static void |
setChannelLUT(ij.ImagePlus image,
ij.process.LUT[] luts) |
static void |
setImageProperties(ij.ImagePlus imagePlus,
Map<String,String> properties)
Sets the properties of a
ImagePlus from a map |
static void |
setLut(ij.ImagePlus image,
ij.process.LUT lut,
Set<Integer> channels) |
static void |
setLutFromColorMap(ij.ImagePlus image,
ColorMap colorMap,
Set<Integer> channels) |
static void |
setRoiCanvas(Roi roi,
ij.ImagePlus imagePlus,
ImageCanvas canvas)
Uses reflection to manually set the canvas of a
Roi
Please note that the image of the Roi will be set. |
static void |
setRoiProperties(Roi roi,
Map<String,String> properties)
Sets the properties of a
Roi from a map |
static void |
setSliceZero(ij.ImagePlus image,
ij.process.ImageProcessor processor,
ImageSliceIndex index)
Sets the slice of an image to the processor based on the index.
|
static Map<ImageSliceIndex,ij.process.ImageProcessor> |
splitIntoSlices(ij.ImagePlus image) |
static String |
toParameterString(Object... parameters)
Converts a list of parameters into a space-delimited
|
static ij.ImagePlus |
unwrap(ImagePlusData data) |
static void |
writeCalibration(ij.ImagePlus imagePlus,
Map<ImageSliceIndex,DisplayRange> calibrationMap) |
static void |
writeImageToMovie(ij.ImagePlus image,
HyperstackDimension followedDimension,
double fps,
Path outputFile,
AVICompression compression,
int jpegQuality,
JIPipeProgressInfo progressInfo) |
static int |
zeroSliceIndexToOneStackIndex(int channel,
int slice,
int frame,
ij.ImagePlus imagePlus)
Stack index (zero-based)
|
static int |
zeroSliceIndexToOneStackIndex(int channel,
int slice,
int frame,
int nChannels,
int nSlices,
int nFrames)
Stack index (zero-based)
|
public static ij.process.ImageProcessor extractFromProcessor(ij.process.ImageProcessor processor, Rectangle source)
public static ResultsTableData measureROI(Roi roi, ij.ImagePlus reference, boolean physicalUnits, Measurement... statistics)
public static Quantity getPixelSizeX(ij.ImagePlus imp)
public static Quantity getPixelSizeY(ij.ImagePlus imp)
public static Quantity getPixelSizeZ(ij.ImagePlus imp)
public static Map<String,String> getRoiProperties(Roi roi)
Roi
as maproi
- the roipublic static Map<String,String> getImageProperties(ij.ImagePlus imagePlus)
ImagePlus
as mapimagePlus
- the imagepublic static void setRoiProperties(Roi roi, Map<String,String> properties)
Roi
from a maproi
- the roiproperties
- the propertiespublic static void setImageProperties(ij.ImagePlus imagePlus, Map<String,String> properties)
ImagePlus
from a mapimagePlus
- the imageproperties
- the propertiespublic static int getConsensusBitDepth(Collection<ij.ImagePlus> images)
images
- the imagespublic static List<ij.ImagePlus> convertToConsensusBitDepthIfNeeded(Collection<ij.ImagePlus> images)
public static ij.ImagePlus convertToBitDepthIfNeeded(ij.ImagePlus imagePlus, int bitDepth)
public static Class<? extends ImagePlusData> bitDepthToImagePlusDataType(int bitDepth)
ImagePlusData
class for a bit depthbitDepth
- the bit depthImagePlusData
is returnedpublic static ij.ImagePlus duplicate(ij.ImagePlus imp)
ImagePlus
.
The reason behind this is that Duplicator
uses an expensive crop() operation instead of Java's array copy
to allow making duplicates of ROIimp
- the imagepublic static boolean imagesHaveSameSize(ij.ImagePlus... images)
public static boolean imagesHaveSameSize(Collection<ij.ImagePlus> images)
public static Component generatePreview(ij.ImagePlus image, ColorSpace colorSpace, int width, int height)
image
- the imagewidth
- the widthheight
- the heightpublic static JIPipeImageThumbnailData generateThumbnail(ij.ImagePlus image, ColorSpace colorSpace, int width, int height)
image
- the imagewidth
- the widthheight
- the heightpublic static void convertRGBToLAB(ij.ImagePlus img, JIPipeProgressInfo progressInfo)
img
- the input image (must be RGB)progressInfo
- the progress infopublic static void convertLABToRGB(ij.ImagePlus img, JIPipeProgressInfo progressInfo)
img
- the input image (must be RGB)progressInfo
- the progress infopublic static void convertRGBToHSB(ij.ImagePlus img, JIPipeProgressInfo progressInfo)
img
- the input image (must be RGB)progressInfo
- the progress infopublic static void convertHSBToRGB(ij.ImagePlus img, JIPipeProgressInfo progressInfo)
img
- the input image (must be RGB)progressInfo
- the progress infopublic static ij.process.ImageProcessor getSliceZeroSafe(ij.ImagePlus img, ImageSliceIndex index)
IndexOutOfBoundsException
img
- the imageindex
- the index (zero-based)public static ij.process.ImageProcessor getSliceZeroSafe(ij.ImagePlus img, int c, int z, int t)
IndexOutOfBoundsException
img
- the imagepublic static ij.process.ImageProcessor getSliceZero(ij.ImagePlus img, ImageSliceIndex index)
img
- the imageindex
- the index (zero-based)public static ij.process.ImageProcessor getSliceZero(ij.ImagePlus img, int c, int z, int t)
img
- the imagepublic static void copyHyperstackDimensions(ij.ImagePlus src, ij.ImagePlus target)
src
- the source imagetarget
- the target imagepublic static ij.ImagePlus ensureEqualSize(ij.ImagePlus target, ij.ImagePlus reference, boolean copySlices)
target
- the target imagereference
- the imagecopySlices
- if slices should be copied. otherwise, empty (black) slices are createdpublic static ImageCanvas createZoomedDummyCanvas(ij.ImagePlus image, Rectangle renderArea)
image
- the imagerenderArea
- the area where the image will be renderedpublic static ImageCanvas createZoomedDummyCanvas(ij.ImagePlus image, double magnification)
image
- the imagemagnification
- the magnification. See ImageCanvas
for the minimum and maximum valuespublic static ij.ImagePlus ensureSize(ij.ImagePlus target, int nChannels, int nSlices, int nFrames, boolean copySlices)
target
- the target imagenChannels
- number of channelsnSlices
- number of slicesnFrames
- number of framescopySlices
- if slices should be copied. otherwise, empty (black) slices are createdpublic static ij.ImagePlus rotate(ij.ImagePlus img, double degrees, boolean expandCanvas, Color background, boolean addRoi, JIPipeProgressInfo progressInfo)
img
- the imagedegrees
- the degreesexpandCanvas
- if the canvas should be expandedbackground
- the background (if non-90-degree angles)addRoi
- if the image should be overlaid with ROI indicating the area of the contentprogressInfo
- the progresspublic static void forEachSlice(ij.ImagePlus img, Consumer<ij.process.ImageProcessor> function, JIPipeProgressInfo progressInfo)
img
- the imagefunction
- the functionprogressInfo
- the progresspublic static int oneSliceIndexToOneStackIndex(int channel, int slice, int frame, ij.ImagePlus imagePlus)
channel
- one-based channelslice
- one-based sliceframe
- one-based frameimagePlus
- reference imagepublic static int zeroSliceIndexToOneStackIndex(int channel, int slice, int frame, ij.ImagePlus imagePlus)
channel
- one-based channelslice
- one-based sliceframe
- one-based frameimagePlus
- reference imagepublic static void maskToBufferedImage(ij.process.ImageProcessor mask, BufferedImage target, Color foreground, Color background)
BufferedImage
mask
- the masktarget
- the target image. Must be ABGRforeground
- color for pixels larger than zerobackground
- color for zero pixelspublic static void copyPixelsBetweenImages(ij.ImagePlus src, ij.ImagePlus target, JIPipeProgressInfo progressInfo)
src
- the sourcetarget
- the targetpublic static int oneSliceIndexToOneStackIndex(int channel, int slice, int frame, int nChannels, int nSlices, int nFrames)
channel
- one-based channelslice
- one-based sliceframe
- one-based framenChannels
- number of channelsnSlices
- number of slicesnFrames
- number of framespublic static int zeroSliceIndexToOneStackIndex(int channel, int slice, int frame, int nChannels, int nSlices, int nFrames)
channel
- zero-based channelslice
- zero-based sliceframe
- zero-based framenChannels
- number of channelsnSlices
- number of slicesnFrames
- number of framespublic static ij.ImagePlus combineSlices(Map<ImageSliceIndex,ij.process.ImageProcessor> slices)
slices
- the slices. Must all have the same size. Can be discontinuous.public static void forEachIndexedSlice(ij.ImagePlus img, BiConsumer<ij.process.ImageProcessor,Integer> function, JIPipeProgressInfo progressInfo)
img
- the imagefunction
- the functionprogressInfo
- the progresspublic static void forEachIndexedZCTSlice(ij.ImagePlus img, BiConsumer<ij.process.ImageProcessor,ImageSliceIndex> function, JIPipeProgressInfo progressInfo)
img
- the imagefunction
- the function. The indices are ZERO-basedprogressInfo
- the progresspublic static ij.ImagePlus mergeMappedSlices(Map<ImageSliceIndex,ij.process.ImageProcessor> sliceMap)
public static ij.ImagePlus extractCTStack(ij.ImagePlus img, int c, int t)
public static void forEachIndexedCTStack(ij.ImagePlus img, TriConsumer<ij.ImagePlus,ImageSliceIndex,JIPipeProgressInfo> function, JIPipeProgressInfo progressInfo)
img
- the imagefunction
- the function. The indices are ZERO-basedprogressInfo
- the progresspublic static void forEachIndexedZCTSliceWithProgress(ij.ImagePlus img, TriConsumer<ij.process.ImageProcessor,ImageSliceIndex,JIPipeProgressInfo> function, JIPipeProgressInfo progressInfo)
img
- the imagefunction
- the function. The indices are ZERO-basedprogressInfo
- the progresspublic static void setSliceZero(ij.ImagePlus image, ij.process.ImageProcessor processor, ImageSliceIndex index)
image
- the imageprocessor
- the processorindex
- the indexpublic static ij.ImagePlus generateForEachIndexedZCTSlice(ij.ImagePlus sourceImage, BiFunction<ij.process.ImageProcessor,ImageSliceIndex,ij.process.ImageProcessor> function, JIPipeProgressInfo progressInfo)
sourceImage
- the imagefunction
- the function. The indices are ZERO-based. Should return the result slice for this indexprogressInfo
- the progress@Deprecated public static void forEachIndexedZTSlice(ij.ImagePlus img, BiConsumer<Map<Integer,ij.process.ImageProcessor>,ImageSliceIndex> function, JIPipeProgressInfo progressInfo)
img
- the imagefunction
- the function. The indices are ZERO-basedprogressInfo
- the progresspublic static ij.ImagePlus runOnImage(ij.ImagePlus img, String command, Object... parameters)
img
- the imagecommand
- the commandparameters
- command parameterspublic static ij.ImagePlus runOnNewImage(ij.ImagePlus img, String command, Object... parameters)
img
- the imagecommand
- the commandparameters
- the command parameterspublic static ij.ImagePlus runOnImage(ij.ImagePlus img, ij.plugin.PlugIn plugin, Object... parameters)
img
- the imageplugin
- the commandparameters
- the command parameterspublic static ij.ImagePlus runOnNewImage(ij.ImagePlus img, ij.plugin.PlugIn plugin, Object... parameters)
img
- the imageplugin
- the commandparameters
- the command parameterspublic static String toParameterString(Object... parameters)
parameters
- the parameterspublic static ij.ImagePlus rgbToChannels(ij.ImagePlus image)
image
- the imagepublic static ij.ImagePlus channelsToRGB(ij.ImagePlus image)
image
- the imagepublic static ij.process.LUT createGrayscaleLUTFromGradient(List<ColorUtils.GradientStop> stops)
public static ij.process.LUT createLUTFromGradient(List<ColorUtils.GradientStop> stops)
public static Map<ImageSliceIndex,DisplayRange> readCalibration(ij.ImagePlus imagePlus)
public static void writeCalibration(ij.ImagePlus imagePlus, Map<ImageSliceIndex,DisplayRange> calibrationMap)
public static void calibrate(ij.process.ImageProcessor imp, ImageJCalibrationMode calibrationMode, double customMin, double customMax, ij.process.ImageStatistics stats)
public static double[] calculateCalibration(ij.process.ImageProcessor imp, ImageJCalibrationMode calibrationMode, double customMin, double customMax, ij.process.ImageStatistics stats)
public static void calibrate(ij.ImagePlus imp, ImageJCalibrationMode calibrationMode, double customMin, double customMax)
ContrastAdjuster
imp
- the imagecalibrationMode
- the calibration modecustomMin
- custom min value (only used if calibrationMode is Custom)customMax
- custom max value (only used if calibrationMode is Custom)public static ij.ImageStack expandImageStackCanvas(ij.ImageStack stackOld, Color backgroundColor, int wNew, int hNew, int xOff, int yOff)
public static ij.process.ImageProcessor expandImageProcessorCanvas(ij.process.ImageProcessor ipOld, Color backgroundColor, int wNew, int hNew, int xOff, int yOff)
public static ij.ImagePlus expandImageCanvas(ij.ImagePlus imp, Color backgroundColor, int newWidth, int newHeight, Anchor anchor)
imp
- the imagebackgroundColor
- the background colornewWidth
- the new widthnewHeight
- the new heightanchor
- the anchor that determines where to expand frompublic static ij.ImagePlus convertToSameTypeIfNeeded(ij.ImagePlus image, ij.ImagePlus reference, boolean doScaling)
reference
- the other imagedoScaling
- apply scaling for greyscale conversionspublic static void getMaskedPixels_Slow(ij.process.ImageProcessor ip, ij.process.ImageProcessor mask, List<Float> target)
public static void getMaskedPixels_8U(ij.process.ImageProcessor ip, ij.process.ImageProcessor mask, gnu.trove.list.array.TByteArrayList target)
public static void getMaskedPixels_16U(ij.process.ImageProcessor ip, ij.process.ImageProcessor mask, gnu.trove.list.array.TShortArrayList target)
public static void getMaskedPixels_32F(ij.process.ImageProcessor ip, ij.process.ImageProcessor mask, gnu.trove.list.array.TFloatArrayList target)
public static void writeImageToMovie(ij.ImagePlus image, HyperstackDimension followedDimension, double fps, Path outputFile, AVICompression compression, int jpegQuality, JIPipeProgressInfo progressInfo)
public static ij.ImagePlus convertToGreyscaleIfNeeded(ij.ImagePlus image)
ImagePlus
to the color space of this data.
Does not guarantee that the input image is copied.image
- the imagepublic static ij.ImagePlus convertToGreyscale8UIfNeeded(ij.ImagePlus image)
ImagePlus
to the color space of this data.
Does not guarantee that the input image is copied.image
- the imagepublic static ij.ImagePlus convertToGrayscale32FIfNeeded(ij.ImagePlus image)
ImagePlus
to the color space of this data.
Does not guarantee that the input image is copied.image
- the imagepublic static ij.ImagePlus convertToGrayscale16UIfNeeded(ij.ImagePlus image)
ImagePlus
to the color space of this data.
Does not guarantee that the input image is copied.image
- the imagepublic static ij.ImagePlus convertToColorRGBIfNeeded(ij.ImagePlus image)
ImagePlus
to the color space of this data.
Does not guarantee that the input image is copied.image
- the imagepublic static ij.ImagePlus convertToColorLABIfNeeded(ij.ImagePlus image)
ImagePlus
to the color space of this data.
Does not guarantee that the input image is copied.image
- the imagepublic static ij.ImagePlus convertToColorHSBIfNeeded(ij.ImagePlus image)
ImagePlus
to the color space of this data.
Does not guarantee that the input image is copied.image
- the imagepublic static ij.ImagePlus convert3ChannelToRGBIfNeeded(ij.ImagePlus image)
ImagePlus
to the color space of this data.
If this function encounters a 3-channel 3D image, it will assume that it is an RGB image and convert it
Does not guarantee that the input image is copied.image
- the imagepublic static void assertImageDimensions(ij.ImagePlus image, int maxDimensions)
public static void removeOverlay(ij.ImagePlus image)
public static ij.process.LUT lutFromImage(ij.ImagePlus image)
image
- the image. Must be RGB.public static ij.ImagePlus lutToImage(ij.process.LUT lut, int width, int height)
lut
- the lutwidth
- width of the imageheight
- height of the imagepublic static ij.process.ImageProcessor getClosestSliceZero(ij.ImagePlus image, ImageSliceIndex index)
image
- the imageindex
- the slice index (zero-based)public static void assert4DImage(ij.ImagePlus image)
public static void assert3DImage(ij.ImagePlus image)
public static void assert2DImage(ij.ImagePlus image)
public static void assert5DImage(ij.ImagePlus image)
public static void drawCenteredStringLabel(ij.ImagePlus imp, ij.process.ImageProcessor ip, String label, Rectangle r, Color foreground, Color background, Font font, boolean drawBackground)
public static void drawAnchoredStringLabel(ij.process.ImageProcessor ip, String label, Rectangle availableSpace, Color foreground, Color background, Font font, boolean drawBackground, Anchor anchor)
public static void setRoiCanvas(Roi roi, ij.ImagePlus imagePlus, ImageCanvas canvas)
Roi
Please note that the image of the Roi will be set.roi
- the ROIimagePlus
- the imagecanvas
- the canvaspublic static ij.ImagePlus renderToRGBWithLUTIfNeeded(ij.ImagePlus inputImage, JIPipeProgressInfo progressInfo)
inputImage
- the input imageprogressInfo
- the progress infopublic static void convolveSlice(ij.plugin.filter.Convolver convolver, int kernelWidth, int kernelHeight, float[] kernel, ij.process.ImageProcessor imp)
public static int rgbPixelLerp(int A, int B, double opacity)
public static ij.ImagePlus unwrap(ImagePlusData data)
public static ij.process.LUT[] getChannelLUT(ij.ImagePlus image)
public static void setChannelLUT(ij.ImagePlus image, ij.process.LUT[] luts)
public static void setLutFromColorMap(ij.ImagePlus image, ColorMap colorMap, Set<Integer> channels)
public static Map<ImageSliceIndex,ij.process.ImageProcessor> splitIntoSlices(ij.ImagePlus image)
public static Map<ImageSliceIndex,ij.process.ImageProcessor> deduplicateSliceMappingByOverwriting(Map<ij.process.ImageProcessor,ImageSliceIndex> sliceMappings, boolean silentlyOverwriteDuplicates)
Copyright © 2020–2024 Leibniz Institute for Natural Product Research and Infection Biology - Hans Knöll Institute (HKI). All rights reserved.