new ImageProcessor()
Members
(static, constant) BICUBIC :int
Interpolation methods
Type:
- int
(static, constant) BILINEAR :int
Interpolation methods
Type:
- int
(static, constant) BLACK :int
Value of pixels included in masks.
Type:
- int
(static, constant) BLACK_AND_WHITE_LUT :int
Type:
- int
(static, constant) BLUR_MORE :int
Type:
- int
(static, constant) CENTER_JUSTIFY :int
Center justify text.
Type:
- int
(static, constant) CONVOLVE :int
Type:
- int
(static, constant) FIND_EDGES :int
Type:
- int
(static, constant) ISODATA :int
Isodata thresholding method
Type:
- int
(static, constant) ISODATA2 :int
Modified isodata method used in Image/Adjust/Threshold tool
Type:
- int
(static, constant) LEFT_JUSTIFY :int
Left justify text.
Type:
- int
(static, constant) MAX :int
Type:
- int
(static, constant) MEDIAN_FILTER :int
Type:
- int
(static, constant) MIN :int
Type:
- int
(static, constant) NEAREST_NEIGHBOR :int
Interpolation methods
Type:
- int
(static, constant) NO_LUT_UPDATE :int
Type:
- int
(static, constant) NO_THRESHOLD :double
Value returned by getMinThreshold() when thresholding is not enabled.
Type:
- double
(static, constant) NONE :int
Interpolation methods
Type:
- int
(static, constant) OVER_UNDER_LUT :int
Type:
- int
(static, constant) RED_LUT :int
Type:
- int
(static, constant) RIGHT_JUSTIFY :int
Right justify text.
Type:
- int
Methods
abs()
If this is a 32-bit or signed 16-bit image, performs an absolute value transform, otherwise does nothing.
add(value)
Adds 'value' to each pixel in the image or ROI.
Parameters:
Name | Type | Description |
---|---|---|
value |
double | - |
add(value)
Adds 'value' to each pixel in the image or ROI.
Parameters:
Name | Type | Description |
---|---|---|
value |
int | - |
and(value)
Binary AND of each pixel in the image or ROI with 'value'.
Parameters:
Name | Type | Description |
---|---|---|
value |
int | - |
applyMacro(macro)
Uses the Process/Math/Macro command to apply macro code to this image.
Parameters:
Name | Type | Description |
---|---|---|
macro |
java.lang.String | - |
applyTable(lut)
Transforms the image or ROI using a lookup table. The length of the table must be 256 for byte images and 65536 for short images. RGB and float images are not supported.
Parameters:
Name | Type | Description |
---|---|---|
lut |
Array.<int> | - |
autoThreshold()
Converts the image to binary using an automatically determined threshold. For byte and short images, converts to binary using an automatically determined threshold. For RGB images, converts each channel to binary. For float images, does nothing.
bin(shrinkFactor)
Returns a copy of this image that has been reduced in size using binning.
Parameters:
Name | Type | Description |
---|---|---|
shrinkFactor |
int | - |
Returns:
ImageProcessor
blurGaussian(sigma)
Blurs the image by convolving with a Gaussian function.
Parameters:
Name | Type | Description |
---|---|---|
sigma |
double | - |
clone()
Returns a shallow copy of this ImageProcessor, where this image and the copy share pixel data. Use the duplicate() method to create a copy that does not share the pixel data.
Returns:
java.lang.Object
convertToByte(doScaling)
Returns an 8-bit version of this image as a ByteProcessor.
Parameters:
Name | Type | Description |
---|---|---|
doScaling |
boolean | - |
Returns:
ImageProcessor
convertToByteProcessor()
Returns an 8-bit version of this image as a ByteProcessor. 16-bit and 32-bit pixel data are scaled from min-max to 0-255.
Returns:
ByteProcessor
convertToByteProcessor(scale)
Returns an 8-bit version of this image as a ByteProcessor. 16-bit and 32-bit pixel data are scaled from min-max to 0-255 if 'scale' is true.
Parameters:
Name | Type | Description |
---|---|---|
scale |
boolean | - |
Returns:
ByteProcessor
convertToColorProcessor()
Returns an RGB version of this image as a ColorProcessor.
Returns:
ColorProcessor
convertToFloat()
Returns a 32-bit float version of this image as a FloatProcessor. For byte and short images, converts using a calibration function if a calibration table has been set using setCalibrationTable().
Returns:
ImageProcessor
convertToFloatProcessor()
Returns a 32-bit float version of this image as a FloatProcessor. For byte and short images, converts using a calibration function if a calibration table has been set using setCalibrationTable().
Returns:
FloatProcessor
convertToRGB()
Returns an RGB version of this image as a ColorProcessor.
Returns:
ImageProcessor
convertToShort(doScaling)
Returns a 16-bit version of this image as a ShortProcessor.
Parameters:
Name | Type | Description |
---|---|---|
doScaling |
boolean | - |
Returns:
ImageProcessor
convertToShortProcessor(scale)
Returns a 16-bit version of this image as a ShortProcessor. 32-bit pixel data are scaled from min-max to 0-255 if 'scale' is true.
Parameters:
Name | Type | Description |
---|---|---|
scale |
boolean | - |
Returns:
ShortProcessor
convertToShortProcessor()
Returns a 16-bit version of this image as a ShortProcessor. 32-bit pixel data are scaled from min-max to 0-255.
Returns:
ShortProcessor
convolve(kernel, kernelWidth, kernelHeight)
Performs a convolution operation using the specified kernel. KernelWidth and kernelHeight must be odd.
Parameters:
Name | Type | Description |
---|---|---|
kernel |
Array.<float> | - |
kernelWidth |
int | - |
kernelHeight |
int | - |
convolve3x3(kernel)
Convolves the image or ROI with the specified 3x3 integer convolution kernel.
Parameters:
Name | Type | Description |
---|---|---|
kernel |
Array.<int> | - |
copyBits(ip, xloc, yloc, mode)
Copies the image contained in 'ip' to (xloc, yloc) using one of the transfer modes defined in the Blitter interface.
Parameters:
Name | Type | Description |
---|---|---|
ip |
ImageProcessor | - |
xloc |
int | - |
yloc |
int | - |
mode |
int | - |
createImage()
Returns a copy of this image is the form of an AWT Image.
Returns:
java.awt.Image
createProcessor(width, height)
Returns a new, blank processor with the specified width and height.
Parameters:
Name | Type | Description |
---|---|---|
width |
int | - |
height |
int | - |
Returns:
ImageProcessor
crop()
Creates a new processor containing an image that corresponds to the current ROI.
Returns:
ImageProcessor
cubic(x)
Parameters:
Name | Type | Description |
---|---|---|
x |
double | - |
Returns:
double
dilate()
Dilates the image or ROI using a 3x3 minimum filter. Requires 8-bit or RGB image.
draw(roi)
Draws the specified ROI on this image using the line width and color defined by ip.setLineWidth() and ip.setColor().
Parameters:
Name | Type | Description |
---|---|---|
roi |
Roi | - |
drawDot(xcenter, ycenter)
Draws a dot using the current line width and fill/draw value.
Parameters:
Name | Type | Description |
---|---|---|
xcenter |
int | - |
ycenter |
int | - |
drawDot2(x, y)
Deprecated.
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
- Deprecated:
- .
drawLine(x1, y1, x2, y2)
Draws a line from (x1,y1) to (x2,y2).
Parameters:
Name | Type | Description |
---|---|---|
x1 |
int | - |
y1 |
int | - |
x2 |
int | - |
y2 |
int | - |
drawLine4(x1, y1, x2, y2)
Parameters:
Name | Type | Description |
---|---|---|
x1 |
int | - |
y1 |
int | - |
x2 |
int | - |
y2 |
int | - |
drawOval(x, y, width, height)
Draws an elliptical shape.
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
width |
int | - |
height |
int | - |
drawOverlay(overlay)
Draws the specified Overlay on this image. Works best with RGB images. Does not work with 16-bit and float images. Requires Java 1.6.
Parameters:
Name | Type | Description |
---|---|---|
overlay |
Overlay | - |
drawPixel(x, y)
Sets the pixel at (x,y) to the current fill/draw value.
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
drawPolygon(p)
Draws a polygon.
Parameters:
Name | Type | Description |
---|---|---|
p |
java.awt.Polygon | - |
drawRect(x, y, width, height)
Draws a rectangle.
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
width |
int | - |
height |
int | - |
drawRoi(roi)
Draws the specified ROI on this image using the stroke width, stroke color and fill color defined by roi.setStrokeWidth, roi.setStrokeColor() and roi.setFillColor(). Works best with RGB images. Does not work with 16-bit and float images. Requires Java 1.6.
Parameters:
Name | Type | Description |
---|---|---|
roi |
Roi | - |
drawString(s, x, y, background)
Draws a string at the specified location with a filled background. A JavaScript example is available at http://imagej.nih.gov/ij/macros/js/DrawTextWithBackground.js
Parameters:
Name | Type | Description |
---|---|---|
s |
java.lang.String | - |
x |
int | - |
y |
int | - |
background |
java.awt.Color | - |
drawString(s, x, y)
Draws a string at the specified location using the current fill/draw value.
Parameters:
Name | Type | Description |
---|---|---|
s |
java.lang.String | - |
x |
int | - |
y |
int | - |
drawString(s)
Draws a string at the current location using the current fill/draw value. Draws multiple lines if the string contains newline characters.
Parameters:
Name | Type | Description |
---|---|---|
s |
java.lang.String | - |
duplicate()
Returns a duplicate of this image.
Returns:
ImageProcessor
erode()
Erodes the image or ROI using a 3x3 maximum filter. Requires 8-bit or RGB image.
exp()
Performs a exponential transform on the image or ROI.
fill(roi)
Fills the ROI with the current fill/draw value.
Parameters:
Name | Type | Description |
---|---|---|
roi |
Roi | - |
fill()
Fills the image or ROI bounding rectangle with the current fill/draw value. Use fill(Roi) or fill(ip.getMask()) to fill non-rectangular selections.
fill(mask)
Fills pixels that are within the ROI bounding rectangle and part of the mask (i.e. pixels that have a value=BLACK in the mask array). Use ip.getMask() to acquire the mask. Throws and IllegalArgumentException if the mask is null or the size of the mask is not the same as the size of the ROI.
Parameters:
Name | Type | Description |
---|---|---|
mask |
ImageProcessor | - |
fillOutside(roi)
Fills outside an Roi.
Parameters:
Name | Type | Description |
---|---|---|
roi |
Roi | - |
fillOval(x, y, width, height)
Fills an elliptical shape.
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
width |
int | - |
height |
int | - |
fillPolygon(p)
Fills a polygon.
Parameters:
Name | Type | Description |
---|---|---|
p |
java.awt.Polygon | - |
filter(type)
A 3x3 filter operation, where the argument (BLUR_MORE, FIND_EDGES, MEDIAN_FILTER, MIN or MAX) determines the filter type.
Parameters:
Name | Type | Description |
---|---|---|
type |
int | - |
findEdges()
Finds edges in the image or ROI using a Sobel operator.
flipHorizontal()
Flips the image or ROI horizontally.
flipVertical()
Flips the image or ROI vertically.
gamma(value)
Performs gamma correction of the image or ROI.
Parameters:
Name | Type | Description |
---|---|---|
value |
double | - |
get(x, y)
This is a faster version of getPixel() that does not do bounds checking.
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
Returns:
int
get(index)
Parameters:
Name | Type | Description |
---|---|---|
index |
int | - |
Returns:
int
getAutoThreshold()
Returns a pixel value (threshold) that can be used to divide the image into objects and background. It does this by taking a test threshold and computing the average of the pixels at or below the threshold and pixels above. It then computes the average of those two, increments the threshold, and repeats the process. Incrementing stops when the threshold is larger than the composite average. That is, threshold = (average background + average objects)/2. This description was posted to the ImageJ mailing list by Jordan Bevic.
Returns:
int
getAutoThreshold(histogram)
This is a version of getAutoThreshold() that uses a histogram passed as an argument.
Parameters:
Name | Type | Description |
---|---|---|
histogram |
Array.<int> | - |
Returns:
int
getBackgroundValue()
Returns the background fill value.
Returns:
double
getBestIndex(c)
Returns the LUT index that's the best match for this color.
Parameters:
Name | Type | Description |
---|---|---|
c |
java.awt.Color | - |
Returns:
int
getBicubicInterpolatedPixel(x0, y0, ip2)
This method is from Chapter 16 of "Digital Image Processing: An Algorithmic Introduction Using Java" by Burger and Burge (http://www.imagingbook.com/).
Parameters:
Name | Type | Description |
---|---|---|
x0 |
double | - |
y0 |
double | - |
ip2 |
ImageProcessor | - |
Returns:
double
getBitDepth()
Returns the bit depth, 8, 16, 24 (RGB) or 32. RGB images actually use 32 bits per pixel.
Returns:
int
getBufferedImage()
Returns this image as a BufferedImage.
Returns:
java.awt.image.BufferedImage
getCalibrationTable()
Returns the calibration table or null.
Returns:
float[]
getColorModel()
Returns this processor's color model. For non-RGB processors, this is the base lookup table (LUT), not the one that may have been modified by setMinAndMax() or setThreshold().
Returns:
java.awt.image.ColorModel
getColumn(x, y, data, length)
Returns the pixel values down the column starting at (x,y).
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
data |
Array.<int> | - |
length |
int | - |
getCurrentColorModel()
Returns the current color model, which may have been modified by setMinAndMax() or setThreshold().
Returns:
java.awt.image.ColorModel
getDefaultColorModel()
Returns the default grayscale IndexColorModel.
Returns:
java.awt.image.IndexColorModel
getf(x, y)
Returns the value of the pixel at (x,y) as a float. Faster than getPixel() because no bounds checking is done.
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
Returns:
float
getf(index)
Parameters:
Name | Type | Description |
---|---|---|
index |
int | - |
Returns:
float
getFloatArray()
Returns a copy of the pixel data as a 2D float array with dimensions [x=0..width-1][y=0..height-1].
Returns:
float[][]
getFont()
Returns the current font.
Returns:
java.awt.Font
getFontMetrics()
Returns the current FontMetrics.
Returns:
java.awt.FontMetrics
getHeight()
Returns the height of this image in pixels.
Returns:
int
getHistogram()
Returns the histogram of the image or ROI. Returns a luminosity histogram for RGB images and null for float images.
For 8-bit and 16-bit images, returns an array with one entry for each possible value that a pixel can have, from 0 to 255 (8-bit image) or 0-65535 (16-bit image). Thus, the array size is 256 or 65536, and the bin width in uncalibrated units is 1.
For RGB images, the brightness is evaluated using the color weights (which would result in a float value) and rounded to an int. This gives 256 bins. FloatProcessor.getHistogram is not implemented (returns null).
Returns:
int[]
getHistogram(nBins)
Returns the histogram of the image or ROI, using the specified number of bins.
Parameters:
Name | Type | Description |
---|---|---|
nBins |
int | - |
Returns:
int[]
getHistogramMax()
Returns the maximum histogram value used for histograms of float images.
Returns:
double
getHistogramMin()
Returns the minimum histogram value used for histograms of float images.
Returns:
double
getHistogramSize()
Returns the number of float image histogram bins. The bin count is fixed at 256 for the other three data types.
Returns:
int
getIntArray()
Returns a copy of the pixel data as a 2D int array with dimensions [x=0..width-1][y=0..height-1]. With RGB images, the returned values are in packed ARGB format. With float images, the returned values must be converted to float using Float.intBitsToFloat().
Returns:
int[][]
getInterpolate()
Returns the value of the interpolate field.
Returns:
boolean
getInterpolatedPixel(x, y)
Uses the current interpolation method (bilinear or bicubic) to find the pixel value at real coordinates (x,y).
Parameters:
Name | Type | Description |
---|---|---|
x |
double | - |
y |
double | - |
Returns:
double
getInterpolatedValue(x, y)
Uses bilinear interpolation to find the pixel value at real coordinates (x,y). Returns zero if the (x, y) is not inside the image.
Parameters:
Name | Type | Description |
---|---|---|
x |
double | - |
y |
double | - |
Returns:
double
getInterpolationMethod()
Returns the current interpolation method (NONE, BILINEAR or BICUBIC).
Returns:
int
getInterpolationMethods()
Returns:
java.lang.String[]
getLine(x1, y1, x2, y2)
Returns an array containing the pixel values along the line starting at (x1,y1) and ending at (x2,y2). For byte and short images, returns calibrated values if a calibration table has been set using setCalibrationTable().
Parameters:
Name | Type | Description |
---|---|---|
x1 |
double | - |
y1 |
double | - |
x2 |
double | - |
y2 |
double | - |
Returns:
double[]
getLineWidth()
Returns the current line width.
Returns:
int
getLut()
Returns:
LUT
getLutUpdateMode()
Returns the LUT update mode, which can be RED_LUT, BLACK_AND_WHITE_LUT, OVER_UNDER_LUT or NO_LUT_UPDATE.
Returns:
int
getMask()
For images with irregular ROIs, returns a mask, otherwise, returns null. Pixels outside the mask have a value of zero.
Returns:
ImageProcessor
getMaskArray()
Returns a reference to the mask pixel array, or null if there is no mask.
Returns:
byte[]
getMax()
Returns the largest displayed pixel value.
Returns:
double
getMaxThreshold()
Returns the upper threshold level.
Returns:
double
getMin()
Returns the smallest displayed pixel value.
Returns:
double
getMinThreshold()
Returns the lower threshold level. Returns NO_THRESHOLD if thresholding is not enabled.
Returns:
double
getNChannels()
Returns the number of color channels in the image. The color channels can be accessed by toFloat(channelNumber, fp) and written by setPixels(channelNumber, fp).
Returns:
int
getNeighborhood(x, y, arr)
Experimental
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
arr |
Array.<Array.<double>> | - |
getOverlay()
Returns:
Overlay
getPixel(x, y, iArray)
Returns the samples for the pixel at (x,y) in an int array. RGB pixels have three samples, all others have one. Returns zeros if the the coordinates are not in bounds. iArray is an optional preallocated array.
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
iArray |
Array.<int> | - |
Returns:
int[]
getPixel(x, y)
Returns the value of the pixel at (x,y). For RGB images, the argb values are packed in an int. For float images, the the value must be converted using Float.intBitsToFloat(). Returns zero if either the x or y coodinate is out of range.
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
Returns:
int
getPixelCount()
Returns:
int
getPixelInterpolated(x, y)
Uses the current interpolation method to find the pixel value at real coordinates (x,y). For RGB images, the argb values are packed in an int. For float images, the value must be converted using Float.intBitsToFloat(). Returns zero if the (x, y) is not inside the image.
Parameters:
Name | Type | Description |
---|---|---|
x |
double | - |
y |
double | - |
Returns:
int
getPixels()
Returns a reference to this image's pixel array. The array type (byte[], short[], float[] or int[]) varies depending on the image type.
Returns:
java.lang.Object
getPixelsCopy()
Returns a copy of the pixel data. Or returns a reference to the snapshot buffer if it is not null and 'snapshotCopyMode' is true.
Returns:
java.lang.Object
getPixelValue(x, y)
Returns the value of the pixel at (x,y). For byte and short images, returns a calibrated value if a calibration table has been set using setCalibraionTable(). For RGB images, returns the luminance value.
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
Returns:
float
getRoi()
Returns a Rectangle that represents the current region of interest.
Returns:
java.awt.Rectangle
getRow(x, y, data, length)
Returns the pixel values along the horizontal line starting at (x,y).
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
data |
Array.<float> | - |
length |
int | - |
Returns:
float[]
getRow(x, y, data, length)
Returns the pixel values along the horizontal line starting at (x,y).
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
data |
Array.<int> | - |
length |
int | - |
getSliceNumber()
Returns:
int
getSnapshotPixels()
Returns a reference to the snapshot (undo) buffer, or null.
Returns:
java.lang.Object
getStatistics()
This method calculates and returns complete uncalibrated statistics for this image or ROI but it is up to 70 times slower than getStats().
Returns:
ImageStatistics
getStats()
Calculates and returns uncalibrated statistics for this image or ROI, including histogram, area, mean, min and max, standard deviation, and mode. Use the setRoi(Roi) method to limit statistics to a non-rectangular area.
Returns:
ImageStatistics
getStringWidth(s)
Returns the width in pixels of the specified string.
Parameters:
Name | Type | Description |
---|---|---|
s |
java.lang.String | - |
Returns:
int
getWidth()
Returns the width of this image in pixels.
Returns:
int
insert(ip, xloc, yloc)
Inserts the image contained in 'ip' at (xloc, yloc).
Parameters:
Name | Type | Description |
---|---|---|
ip |
ImageProcessor | - |
xloc |
int | - |
yloc |
int | - |
invert()
Inverts the image or ROI.
invertLut()
Inverts the values in this image's LUT (indexed color model). Does nothing if this is a ColorProcessor.
isBinary()
Returns 'true' if this is a binary image (8-bit-image with only 0 and 255).
Returns:
boolean
isColorLut()
Returns true if this image uses a color LUT.
Returns:
boolean
isDefaultLut()
Returns true if the image is using the default grayscale LUT.
Returns:
boolean
isGrayscale()
Returns 'true' if this is an image with a grayscale LUT or an RGB image with identical red, green and blue channels.
Returns:
boolean
isInvertedLut()
Returns true if this image uses an inverting LUT that displays zero as white and 255 as black.
Returns:
boolean
isKillable()
Deprecated.
- Deprecated:
- .
Returns:
boolean
isPseudoColorLut()
Returns true if this image uses a pseudocolor or grayscale LUT, in other words, is this an image that can be filtered.
Returns:
boolean
isSigned16Bit()
Returns 'true' if this is a signed 16-bit image.
Returns:
boolean
lineTo(x2, y2)
Draws a line from the current drawing location to (x2,y2).
Parameters:
Name | Type | Description |
---|---|---|
x2 |
int | - |
y2 |
int | - |
ln()
Does a natural logarithmic (base e) transform of the image or ROI.
log()
Does a natural logarithmic (base e) transform of the image or ROI.
max(value)
Pixels greater than 'value' are set to 'value'.
Parameters:
Name | Type | Description |
---|---|---|
value |
double | - |
maxValue()
Returns the maximum possible pixel value.
Returns:
double
medianFilter()
A 3x3 median filter. Requires 8-bit or RGB image.
min(value)
Pixels less than 'value' are set to 'value'.
Parameters:
Name | Type | Description |
---|---|---|
value |
double | - |
minValue()
Returns the minimum possible pixel value.
Returns:
double
moveTo(x, y)
Sets the current drawing location.
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
multiply(value)
Multiplies each pixel in the image or ROI by 'value'.
Parameters:
Name | Type | Description |
---|---|---|
value |
double | - |
noise(standardDeviation)
Adds pseudorandom, Gaussian ("normally") distributed values, with mean 0.0 and the specified standard deviation, to this image or ROI.
Parameters:
Name | Type | Description |
---|---|---|
standardDeviation |
double | - |
or(value)
Binary OR of each pixel in the image or ROI with 'value'.
Parameters:
Name | Type | Description |
---|---|---|
value |
int | - |
putColumn(x, y, data, length)
Inserts the pixels contained in 'data' into a column starting at (x,y).
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
data |
Array.<int> | - |
length |
int | - |
putPixel(x, y, value)
Stores the specified value at (x,y). Does nothing if (x,y) is outside the image boundary. For 8-bit and 16-bit images, out of range values are clamped. For RGB images, the argb values are packed in 'value'. For float images, 'value' is expected to be a float converted to an int using Float.floatToIntBits().
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
value |
int | - |
putPixel(x, y, iArray)
Sets a pixel in the image using an int array of samples. RGB pixels have three samples, all others have one.
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
iArray |
Array.<int> | - |
putPixelValue(x, y, value)
Stores the specified value at (x,y).
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
value |
double | - |
putRow(x, y, data, length)
Inserts the pixels contained in 'data' into a horizontal line starting at (x,y).
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
data |
Array.<int> | - |
length |
int | - |
putRow(x, y, data, length)
Inserts the pixels contained in 'data' into a horizontal line starting at (x,y).
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
data |
Array.<float> | - |
length |
int | - |
reset(mask)
Restores pixels from the snapshot buffer that are within the rectangular roi but not part of the mask.
Parameters:
Name | Type | Description |
---|---|---|
mask |
ImageProcessor | - |
reset()
Restores the pixel data from the snapshot (undo) buffer.
resetBinaryThreshold()
Resets the threshold if minThreshold=maxThreshold and lutUpdateMode=NO_LUT_UPDATE. This removes the invisible threshold set by the MakeBinary and Convert to Mask commands.
resetMinAndMax()
For short and float images, recalculates the min and max image values needed to correctly display the image. For ByteProcessors, resets the LUT.
resetRoi()
Sets the ROI (Region of Interest) and clipping rectangle to the entire image.
resetThreshold()
Disables thresholding.
resize(dstWidth, dstHeight, useAverging)
Creates a new ImageProcessor containing a scaled copy of this image or ROI.
Parameters:
Name | Type | Description |
---|---|---|
dstWidth |
int | - |
dstHeight |
int | - |
useAverging |
boolean | - |
Returns:
ImageProcessor
resize(dstWidth, dstHeight)
Creates a new ImageProcessor containing a scaled copy of this image or ROI.
Parameters:
Name | Type | Description |
---|---|---|
dstWidth |
int | - |
dstHeight |
int | - |
Returns:
ImageProcessor
resize(dstWidth)
Creates a new ImageProcessor containing a scaled copy of this image or ROI, with the aspect ratio maintained.
Parameters:
Name | Type | Description |
---|---|---|
dstWidth |
int | - |
Returns:
ImageProcessor
rotate(angle)
Rotates the image or selection 'angle' degrees clockwise.
Parameters:
Name | Type | Description |
---|---|---|
angle |
double | - |
rotateLeft()
Rotates the entire image 90 degrees counter-clockwise. Returns a new ImageProcessor that represents the rotated image.
Returns:
ImageProcessor
rotateRight()
Rotates the entire image 90 degrees clockwise. Returns a new ImageProcessor that represents the rotated image.
Returns:
ImageProcessor
scale(xScale, yScale)
Scales the image by the specified factors. Does not change the image size.
Parameters:
Name | Type | Description |
---|---|---|
xScale |
double | - |
yScale |
double | - |
set(value)
Assigns 'value' to each pixel in the image or ROI.
Parameters:
Name | Type | Description |
---|---|---|
value |
double | - |
set(x, y, value)
This is a faster version of putPixel() that does not clip out of range values and does not do bounds checking.
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
value |
int | - |
set(index, value)
Parameters:
Name | Type | Description |
---|---|---|
index |
int | - |
value |
int | - |
setAntialiasedText(antialiasedText)
Specifies whether or not text is drawn using antialiasing. Antialiased test requires an 8 bit or RGB image. Antialiasing does not work with 8-bit images that are not using 0-255 display range.
Parameters:
Name | Type | Description |
---|---|---|
antialiasedText |
boolean | - |
setAutoThreshold(mString, darkBackground, lutUpdate)
Parameters:
Name | Type | Description |
---|---|---|
mString |
java.lang.String | - |
darkBackground |
boolean | - |
lutUpdate |
int | - |
setAutoThreshold(method, darkBackground)
Parameters:
Name | Type | Description |
---|---|---|
method |
AutoThresholder.Method | - |
darkBackground |
boolean | - |
setAutoThreshold(method, darkBackground, lutUpdate)
Parameters:
Name | Type | Description |
---|---|---|
method |
AutoThresholder.Method | - |
darkBackground |
boolean | - |
lutUpdate |
int | - |
setAutoThreshold(method, lutUpdate)
Automatically sets the lower and upper threshold levels, where 'method' must be ISODATA or ISODATA2 and 'lutUpdate' must be RED_LUT, BLACK_AND_WHITE_LUT, OVER_UNDER_LUT or NO_LUT_UPDATE.
Parameters:
Name | Type | Description |
---|---|---|
method |
int | - |
lutUpdate |
int | - |
setAutoThreshold(mString)
Parameters:
Name | Type | Description |
---|---|---|
mString |
java.lang.String | - |
setBackgroundValue(value)
Sets the background fill value used by the rotate() and scale() methods.
Parameters:
Name | Type | Description |
---|---|---|
value |
double | - |
setBinaryThreshold()
setCalibrationTable(cTable)
Set a lookup table used by getPixelValue(), getLine() and convertToFloat() to calibrate pixel values. The length of the table must be 256 for byte images and 65536 for short images. RGB and float processors do not do calibration.
Parameters:
Name | Type | Description |
---|---|---|
cTable |
Array.<float> | - |
setClipRect(clipRect)
Updates the clipping rectangle used by lineTo(), drawLine(), drawDot() and drawPixel(). The clipping rectangle is reset by passing a null argument or by calling resetRoi().
Parameters:
Name | Type | Description |
---|---|---|
clipRect |
java.awt.Rectangle | - |
setColor(color)
Sets the default fill/draw value to the pixel value closest to the specified color.
Parameters:
Name | Type | Description |
---|---|---|
color |
java.awt.Color | - |
setColor(value)
Sets the default fill/draw value.
Parameters:
Name | Type | Description |
---|---|---|
value |
double | - |
setColor(value)
Sets the default fill/draw value.
Parameters:
Name | Type | Description |
---|---|---|
value |
int | - |
setColorModel(cm)
Sets the color model. Must be an IndexColorModel (aka LUT) for all processors except the ColorProcessor.
Parameters:
Name | Type | Description |
---|---|---|
cm |
java.awt.image.ColorModel | - |
setf(x, y, value)
Sets the value of the pixel at (x,y) to 'value'. Does no bounds checking or clamping, making it faster than putPixel(). Due to the lack of bounds checking, (x,y) coordinates outside the image may cause an exception. Due to the lack of clamping, values outside the 0-255 range (for byte) or 0-65535 range (for short) are not handled correctly.
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
value |
float | - |
setf(index, value)
Parameters:
Name | Type | Description |
---|---|---|
index |
int | - |
value |
float | - |
setFloatArray(a)
Replaces the pixel data with contents of the specified 2D float array.
Parameters:
Name | Type | Description |
---|---|---|
a |
Array.<Array.<float>> | - |
setFont(font)
Sets the font used by drawString().
Parameters:
Name | Type | Description |
---|---|---|
font |
java.awt.Font | - |
setHistogramRange(histMin, histMax)
Set the range used for histograms of float images. The image range is
used if both histMin
and histMax
are zero.
Parameters:
Name | Type | Description |
---|---|---|
histMin |
double | - |
histMax |
double | - |
setHistogramSize(size)
Set the number of bins to be used for histograms of float images.
Parameters:
Name | Type | Description |
---|---|---|
size |
int | - |
setIntArray(a)
Replaces the pixel data with contents of the specified 2D int array.
Parameters:
Name | Type | Description |
---|---|---|
a |
Array.<Array.<int>> | - |
setInterpolate(interpolate)
This method has been replaced by setInterpolationMethod().
Parameters:
Name | Type | Description |
---|---|---|
interpolate |
boolean | - |
setInterpolationMethod(method)
Use this method to set the interpolation method (NONE, BILINEAR or BICUBIC) used by scale(), resize() and rotate().
Parameters:
Name | Type | Description |
---|---|---|
method |
int | - |
setJustification(justification)
Sets the justification used by drawString(), where justification
is CENTER_JUSTIFY, RIGHT_JUSTIFY or LEFT_JUSTIFY. The default is LEFT_JUSTIFY.
Parameters:
Name | Type | Description |
---|---|---|
justification |
int | - |
setLineWidth(width)
Sets the line width used by lineTo() and drawDot().
Parameters:
Name | Type | Description |
---|---|---|
width |
int | - |
setLut(lut)
Parameters:
Name | Type | Description |
---|---|---|
lut |
LUT | - |
setLutAnimation(lutAnimation)
For 16 and 32 bit processors, set 'lutAnimation' true to have createImage() use the cached 8-bit version of the image.
Parameters:
Name | Type | Description |
---|---|---|
lutAnimation |
boolean | - |
setMask(mask)
Defines a byte mask that limits processing to an irregular ROI. Background pixels in the mask have a value of zero.
Parameters:
Name | Type | Description |
---|---|---|
mask |
ImageProcessor | - |
setMinAndMax(min, max)
This image will be displayed by mapping pixel values in the range min-max to screen values in the range 0-255. For byte images, this mapping is done by updating the LUT. For short and float images, it's done by generating 8-bit AWT images. For RGB images, it's done by changing the pixel values.
Parameters:
Name | Type | Description |
---|---|---|
min |
double | - |
max |
double | - |
setOverColor(red, green, blue)
Sets the upper Over/Under threshold color. Can be called from a macro, e.g., call("ij.process.ImageProcessor.setOverColor", 0,255,255).
Parameters:
Name | Type | Description |
---|---|---|
red |
int | - |
green |
int | - |
blue |
int | - |
setOverlay(overlay)
This method is used to display virtual stack overlays.
Parameters:
Name | Type | Description |
---|---|---|
overlay |
Overlay | - |
setPixels(channelNumber, fp)
Sets the pixels (of one color channel for RGB images) from a FloatProcessor.
Parameters:
Name | Type | Description |
---|---|---|
channelNumber |
int | - |
fp |
FloatProcessor | - |
setPixels(pixels)
Sets a new pixel array for the image. The length of the array must be equal to width*height. Use setSnapshotPixels(null) to clear the snapshot buffer.
Parameters:
Name | Type | Description |
---|---|---|
pixels |
java.lang.Object | - |
setProgressBar(pb)
Assigns a progress bar to this processor. Set 'pb' to null to disable the progress bar.
Parameters:
Name | Type | Description |
---|---|---|
pb |
ProgressBar | - |
setRoi(roi)
Defines a non-rectangular region of interest that will consist of a
rectangular ROI and a mask. After processing, call reset(mask)
to restore non-masked pixels. Here is an example:
ip.setRoi(new OvalRoi(50, 50, 100, 50)); ip.fill(); ip.reset(ip.getMask());The example assumes
snapshot()
has been called, which is the case
for code executed in the run()
method of plugins that implement the
PlugInFilter
interface.
Parameters:
Name | Type | Description |
---|---|---|
roi |
Roi | - |
setRoi(x, y, rwidth, rheight)
Defines a rectangular region of interest and sets the mask to null if this ROI is not the same size as the previous one.
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
rwidth |
int | - |
rheight |
int | - |
setRoi(roi)
Defines a polygonal region of interest that will consist of a
rectangular ROI and a mask. After processing, call reset(mask)
to restore non-masked pixels. Here is an example:
Polygon p = new Polygon(); p.addPoint(50, 0); p.addPoint(100, 100); p.addPoint(0, 100); ip.setRoi(triangle); ip.invert(); ip.reset(ip.getMask());The example assumes
snapshot()
has been called, which is the case
for code executed in the run()
method of plugins that implement the
PlugInFilter
interface.
Parameters:
Name | Type | Description |
---|---|---|
roi |
java.awt.Polygon | - |
setRoi(roi)
Defines a rectangular region of interest and sets the mask to null if this ROI is not the same size as the previous one.
Parameters:
Name | Type | Description |
---|---|---|
roi |
java.awt.Rectangle | - |
setSliceNumber(slice)
PlugInFilterRunner uses this method to set the slice number.
Parameters:
Name | Type | Description |
---|---|---|
slice |
int | - |
setSnapshotCopyMode(b)
The getPixelsCopy() method returns a reference to the snapshot buffer if it is not null and 'snapshotCopyMode' is true.
Parameters:
Name | Type | Description |
---|---|---|
b |
boolean | - |
setSnapshotPixels(pixels)
Sets a new pixel array for the snapshot (undo) buffer.
Parameters:
Name | Type | Description |
---|---|---|
pixels |
java.lang.Object | - |
setThreshold(minThreshold, maxThreshold, lutUpdate)
Sets the lower and upper threshold levels. The 'lutUpdate' argument can be RED_LUT, BLACK_AND_WHITE_LUT, OVER_UNDER_LUT or NO_LUT_UPDATE. Thresholding of RGB images is not supported.
Parameters:
Name | Type | Description |
---|---|---|
minThreshold |
double | - |
maxThreshold |
double | - |
lutUpdate |
int | - |
setUnderColor(red, green, blue)
Set the lower Over/Under thresholding color.
Parameters:
Name | Type | Description |
---|---|---|
red |
int | - |
green |
int | - |
blue |
int | - |
setUseBicubic(b)
Parameters:
Name | Type | Description |
---|---|---|
b |
boolean | - |
setValue(value)
Sets the default fill/draw value.
Parameters:
Name | Type | Description |
---|---|---|
value |
double | - |
sharpen()
Sharpens the image or ROI using a 3x3 convolution kernel.
smooth()
Replaces each pixel with the 3x3 neighborhood mean.
snapshot()
Makes a copy of this image's pixel data that can be later restored using reset() or reset(mask).
sqr()
Performs a square transform on the image or ROI.
sqrt()
Performs a square root transform on the image or ROI.
subtract(value)
Subtracts 'value' from each pixel in the image or ROI.
Parameters:
Name | Type | Description |
---|---|---|
value |
double | - |
swapPixelArrays()
Swaps the pixel and snapshot (undo) buffers.
threshold(level)
Sets pixels less than or equal to level to 0 and all other pixels to 255. Only works with 8-bit and 16-bit images.
Parameters:
Name | Type | Description |
---|---|---|
level |
int | - |
toFloat(channelNumber, fp)
Returns a FloatProcessor with the image or one color channel thereof. The roi and mask are also set for the FloatProcessor.
Parameters:
Name | Type | Description |
---|---|---|
channelNumber |
int | - |
fp |
FloatProcessor | - |
Returns:
FloatProcessor
toString()
Returns a string containing information about this ImageProcessor.
Returns:
java.lang.String
translate(xOffset, yOffset)
Moves the image or selection vertically or horizontally by a specified number of pixels. Positive x values move the image or selection to the right, negative values move it to the left. Positive y values move the image or selection down, negative values move it up.
Parameters:
Name | Type | Description |
---|---|---|
xOffset |
double | - |
yOffset |
double | - |
translate(xOffset, yOffset, eraseBackground)
Deprecated. replaced by translate(x,y)
Parameters:
Name | Type | Description |
---|---|---|
xOffset |
int | - |
yOffset |
int | - |
eraseBackground |
boolean | - |
- Deprecated:
- . replaced by translate(x,y)
updateComposite(rgbPixels, channel)
CompositeImage calls this method to generate an updated color image.
Parameters:
Name | Type | Description |
---|---|---|
rgbPixels |
Array.<int> | - |
channel |
int | - |
xor(value)
Binary exclusive OR of each pixel in the image or ROI with 'value'.
Parameters:
Name | Type | Description |
---|---|---|
value |
int | - |