Class: ImageProcessor

ImageProcessor

new ImageProcessor()

Author:
  • Created by ijdoc2js

Members

(static, constant) BICUBIC :int

Interpolation methods

Type:
  • int
Author:
  • Created by ijdoc2js

(static, constant) BILINEAR :int

Interpolation methods

Type:
  • int
Author:
  • Created by ijdoc2js

(static, constant) BLACK :int

Value of pixels included in masks.

Type:
  • int
Author:
  • Created by ijdoc2js

(static, constant) BLACK_AND_WHITE_LUT :int

Type:
  • int
Author:
  • Created by ijdoc2js

(static, constant) BLUR_MORE :int

Type:
  • int
Author:
  • Created by ijdoc2js

(static, constant) CENTER_JUSTIFY :int

Center justify text.

Type:
  • int
Author:
  • Created by ijdoc2js

(static, constant) CONVOLVE :int

Type:
  • int
Author:
  • Created by ijdoc2js

(static, constant) FIND_EDGES :int

Type:
  • int
Author:
  • Created by ijdoc2js

(static, constant) ISODATA :int

Isodata thresholding method

Type:
  • int
Author:
  • Created by ijdoc2js

(static, constant) ISODATA2 :int

Modified isodata method used in Image/Adjust/Threshold tool

Type:
  • int
Author:
  • Created by ijdoc2js

(static, constant) LEFT_JUSTIFY :int

Left justify text.

Type:
  • int
Author:
  • Created by ijdoc2js

(static, constant) MAX :int

Type:
  • int
Author:
  • Created by ijdoc2js

(static, constant) MEDIAN_FILTER :int

Type:
  • int
Author:
  • Created by ijdoc2js

(static, constant) MIN :int

Type:
  • int
Author:
  • Created by ijdoc2js

(static, constant) NEAREST_NEIGHBOR :int

Interpolation methods

Type:
  • int
Author:
  • Created by ijdoc2js

(static, constant) NO_LUT_UPDATE :int

Type:
  • int
Author:
  • Created by ijdoc2js

(static, constant) NO_THRESHOLD :double

Value returned by getMinThreshold() when thresholding is not enabled.

Type:
  • double
Author:
  • Created by ijdoc2js

(static, constant) NONE :int

Interpolation methods

Type:
  • int
Author:
  • Created by ijdoc2js

(static, constant) OVER_UNDER_LUT :int

Type:
  • int
Author:
  • Created by ijdoc2js

(static, constant) RED_LUT :int

Type:
  • int
Author:
  • Created by ijdoc2js

(static, constant) RIGHT_JUSTIFY :int

Right justify text.

Type:
  • int
Author:
  • Created by ijdoc2js

Methods

abs()

If this is a 32-bit or signed 16-bit image, performs an absolute value transform, otherwise does nothing.

Author:
  • Created by ijdoc2js

add(value)

Adds 'value' to each pixel in the image or ROI.

Parameters:
Name Type Description
value double

-

Author:
  • Created by ijdoc2js

add(value)

Adds 'value' to each pixel in the image or ROI.

Parameters:
Name Type Description
value int

-

Author:
  • Created by ijdoc2js

and(value)

Binary AND of each pixel in the image or ROI with 'value'.

Parameters:
Name Type Description
value int

-

Author:
  • Created by ijdoc2js

applyMacro(macro)

Uses the Process/Math/Macro command to apply macro code to this image.

Parameters:
Name Type Description
macro java.lang.String

-

Author:
  • Created by ijdoc2js

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>

-

Author:
  • Created by ijdoc2js

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.

Author:
  • Created by ijdoc2js

bin(shrinkFactor)

Returns a copy of this image that has been reduced in size using binning.

Parameters:
Name Type Description
shrinkFactor int

-

Author:
  • Created by ijdoc2js
Returns:

ImageProcessor

blurGaussian(sigma)

Blurs the image by convolving with a Gaussian function.

Parameters:
Name Type Description
sigma double

-

Author:
  • Created by ijdoc2js

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.

Author:
  • Created by ijdoc2js
Returns:

java.lang.Object

convertToByte(doScaling)

Returns an 8-bit version of this image as a ByteProcessor.

Parameters:
Name Type Description
doScaling boolean

-

Author:
  • Created by ijdoc2js
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.

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js
Returns:

ByteProcessor

convertToColorProcessor()

Returns an RGB version of this image as a ColorProcessor.

Author:
  • Created by ijdoc2js
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().

Author:
  • Created by ijdoc2js
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().

Author:
  • Created by ijdoc2js
Returns:

FloatProcessor

convertToRGB()

Returns an RGB version of this image as a ColorProcessor.

Author:
  • Created by ijdoc2js
Returns:

ImageProcessor

convertToShort(doScaling)

Returns a 16-bit version of this image as a ShortProcessor.

Parameters:
Name Type Description
doScaling boolean

-

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js
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.

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js

convolve3x3(kernel)

Convolves the image or ROI with the specified 3x3 integer convolution kernel.

Parameters:
Name Type Description
kernel Array.<int>

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

createImage()

Returns a copy of this image is the form of an AWT Image.

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js
Returns:

ImageProcessor

crop()

Creates a new processor containing an image that corresponds to the current ROI.

Author:
  • Created by ijdoc2js
Returns:

ImageProcessor

cubic(x)

Parameters:
Name Type Description
x double

-

Author:
  • Created by ijdoc2js
Returns:

double

dilate()

Dilates the image or ROI using a 3x3 minimum filter. Requires 8-bit or RGB image.

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

drawDot(xcenter, ycenter)

Draws a dot using the current line width and fill/draw value.

Parameters:
Name Type Description
xcenter int

-

ycenter int

-

Author:
  • Created by ijdoc2js

drawDot2(x, y)

Deprecated. 

Parameters:
Name Type Description
x int

-

y int

-

Deprecated:
Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

drawLine4(x1, y1, x2, y2)

Parameters:
Name Type Description
x1 int

-

y1 int

-

x2 int

-

y2 int

-

Author:
  • Created by ijdoc2js

drawOval(x, y, width, height)

Draws an elliptical shape.

Parameters:
Name Type Description
x int

-

y int

-

width int

-

height int

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

drawPixel(x, y)

Sets the pixel at (x,y) to the current fill/draw value.

Parameters:
Name Type Description
x int

-

y int

-

Author:
  • Created by ijdoc2js

drawPolygon(p)

Draws a polygon.

Parameters:
Name Type Description
p java.awt.Polygon

-

Author:
  • Created by ijdoc2js

drawRect(x, y, width, height)

Draws a rectangle.

Parameters:
Name Type Description
x int

-

y int

-

width int

-

height int

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

duplicate()

Returns a duplicate of this image.

Author:
  • Created by ijdoc2js
Returns:

ImageProcessor

erode()

Erodes the image or ROI using a 3x3 maximum filter. Requires 8-bit or RGB image.

Author:
  • Created by ijdoc2js

exp()

Performs a exponential transform on the image or ROI.

Author:
  • Created by ijdoc2js

fill(roi)

Fills the ROI with the current fill/draw value.

Parameters:
Name Type Description
roi Roi

-

Author:
  • Created by ijdoc2js

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.

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

fillOutside(roi)

Fills outside an Roi.

Parameters:
Name Type Description
roi Roi

-

Author:
  • Created by ijdoc2js

fillOval(x, y, width, height)

Fills an elliptical shape.

Parameters:
Name Type Description
x int

-

y int

-

width int

-

height int

-

Author:
  • Created by ijdoc2js

fillPolygon(p)

Fills a polygon.

Parameters:
Name Type Description
p java.awt.Polygon

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

findEdges()

Finds edges in the image or ROI using a Sobel operator.

Author:
  • Created by ijdoc2js

flipHorizontal()

Flips the image or ROI horizontally.

Author:
  • Created by ijdoc2js

flipVertical()

Flips the image or ROI vertically.

Author:
  • Created by ijdoc2js

gamma(value)

Performs gamma correction of the image or ROI.

Parameters:
Name Type Description
value double

-

Author:
  • Created by ijdoc2js

get(x, y)

This is a faster version of getPixel() that does not do bounds checking.

Parameters:
Name Type Description
x int

-

y int

-

Author:
  • Created by ijdoc2js
Returns:

int

get(index)

Parameters:
Name Type Description
index int

-

Author:
  • Created by ijdoc2js
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.

Author:
  • Created by ijdoc2js
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>

-

Author:
  • Created by ijdoc2js
Returns:

int

getBackgroundValue()

Returns the background fill value.

Author:
  • Created by ijdoc2js
Returns:

double

getBestIndex(c)

Returns the LUT index that's the best match for this color.

Parameters:
Name Type Description
c java.awt.Color

-

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js
Returns:

double

getBitDepth()

Returns the bit depth, 8, 16, 24 (RGB) or 32. RGB images actually use 32 bits per pixel.

Author:
  • Created by ijdoc2js
Returns:

int

getBufferedImage()

Returns this image as a BufferedImage.

Author:
  • Created by ijdoc2js
Returns:

java.awt.image.BufferedImage

getCalibrationTable()

Returns the calibration table or null.

Author:
  • Created by ijdoc2js
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().

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js

getCurrentColorModel()

Returns the current color model, which may have been modified by setMinAndMax() or setThreshold().

Author:
  • Created by ijdoc2js
Returns:

java.awt.image.ColorModel

getDefaultColorModel()

Returns the default grayscale IndexColorModel.

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js
Returns:

float

getf(index)

Parameters:
Name Type Description
index int

-

Author:
  • Created by ijdoc2js
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].

Author:
  • Created by ijdoc2js
Returns:

float[][]

getFont()

Returns the current font.

Author:
  • Created by ijdoc2js
Returns:

java.awt.Font

getFontMetrics()

Returns the current FontMetrics.

Author:
  • Created by ijdoc2js
Returns:

java.awt.FontMetrics

getHeight()

Returns the height of this image in pixels.

Author:
  • Created by ijdoc2js
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).

Author:
  • Created by ijdoc2js
Returns:

int[]

getHistogram(nBins)

Returns the histogram of the image or ROI, using the specified number of bins.

Parameters:
Name Type Description
nBins int

-

Author:
  • Created by ijdoc2js
Returns:

int[]

getHistogramMax()

Returns the maximum histogram value used for histograms of float images.

Author:
  • Created by ijdoc2js
Returns:

double

getHistogramMin()

Returns the minimum histogram value used for histograms of float images.

Author:
  • Created by ijdoc2js
Returns:

double

getHistogramSize()

Returns the number of float image histogram bins. The bin count is fixed at 256 for the other three data types.

Author:
  • Created by ijdoc2js
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().

Author:
  • Created by ijdoc2js
Returns:

int[][]

getInterpolate()

Returns the value of the interpolate field.

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js
Returns:

double

getInterpolationMethod()

Returns the current interpolation method (NONE, BILINEAR or BICUBIC).

Author:
  • Created by ijdoc2js
Returns:

int

getInterpolationMethods()

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js
Returns:

double[]

getLineWidth()

Returns the current line width.

Author:
  • Created by ijdoc2js
Returns:

int

getLut()

Author:
  • Created by ijdoc2js
Returns:

LUT

getLutUpdateMode()

Returns the LUT update mode, which can be RED_LUT, BLACK_AND_WHITE_LUT, OVER_UNDER_LUT or NO_LUT_UPDATE.

Author:
  • Created by ijdoc2js
Returns:

int

getMask()

For images with irregular ROIs, returns a mask, otherwise, returns null. Pixels outside the mask have a value of zero.

Author:
  • Created by ijdoc2js
Returns:

ImageProcessor

getMaskArray()

Returns a reference to the mask pixel array, or null if there is no mask.

Author:
  • Created by ijdoc2js
Returns:

byte[]

getMax()

Returns the largest displayed pixel value.

Author:
  • Created by ijdoc2js
Returns:

double

getMaxThreshold()

Returns the upper threshold level.

Author:
  • Created by ijdoc2js
Returns:

double

getMin()

Returns the smallest displayed pixel value.

Author:
  • Created by ijdoc2js
Returns:

double

getMinThreshold()

Returns the lower threshold level. Returns NO_THRESHOLD if thresholding is not enabled.

Author:
  • Created by ijdoc2js
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).

Author:
  • Created by ijdoc2js
Returns:

int

getNeighborhood(x, y, arr)

Experimental

Parameters:
Name Type Description
x int

-

y int

-

arr Array.<Array.<double>>

-

Author:
  • Created by ijdoc2js

getOverlay()

Author:
  • Created by ijdoc2js
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>

-

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js
Returns:

int

getPixelCount()

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js
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.

Author:
  • Created by ijdoc2js
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.

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js
Returns:

float

getRoi()

Returns a Rectangle that represents the current region of interest.

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js

getSliceNumber()

Author:
  • Created by ijdoc2js
Returns:

int

getSnapshotPixels()

Returns a reference to the snapshot (undo) buffer, or null.

Author:
  • Created by ijdoc2js
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().

Author:
  • Created by ijdoc2js
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.

Author:
  • Created by ijdoc2js
Returns:

ImageStatistics

getStringWidth(s)

Returns the width in pixels of the specified string.

Parameters:
Name Type Description
s java.lang.String

-

Author:
  • Created by ijdoc2js
Returns:

int

getWidth()

Returns the width of this image in pixels.

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js

invert()

Inverts the image or ROI.

Author:
  • Created by ijdoc2js

invertLut()

Inverts the values in this image's LUT (indexed color model). Does nothing if this is a ColorProcessor.

Author:
  • Created by ijdoc2js

isBinary()

Returns 'true' if this is a binary image (8-bit-image with only 0 and 255).

Author:
  • Created by ijdoc2js
Returns:

boolean

isColorLut()

Returns true if this image uses a color LUT.

Author:
  • Created by ijdoc2js
Returns:

boolean

isDefaultLut()

Returns true if the image is using the default grayscale LUT.

Author:
  • Created by ijdoc2js
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.

Author:
  • Created by ijdoc2js
Returns:

boolean

isInvertedLut()

Returns true if this image uses an inverting LUT that displays zero as white and 255 as black.

Author:
  • Created by ijdoc2js
Returns:

boolean

isKillable()

Deprecated. 

Deprecated:
Author:
  • Created by ijdoc2js
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.

Author:
  • Created by ijdoc2js
Returns:

boolean

isSigned16Bit()

Returns 'true' if this is a signed 16-bit image.

Author:
  • Created by ijdoc2js
Returns:

boolean

lineTo(x2, y2)

Draws a line from the current drawing location to (x2,y2).

Parameters:
Name Type Description
x2 int

-

y2 int

-

Author:
  • Created by ijdoc2js

ln()

Does a natural logarithmic (base e) transform of the image or ROI.

Author:
  • Created by ijdoc2js

log()

Does a natural logarithmic (base e) transform of the image or ROI.

Author:
  • Created by ijdoc2js

max(value)

Pixels greater than 'value' are set to 'value'.

Parameters:
Name Type Description
value double

-

Author:
  • Created by ijdoc2js

maxValue()

Returns the maximum possible pixel value.

Author:
  • Created by ijdoc2js
Returns:

double

medianFilter()

A 3x3 median filter. Requires 8-bit or RGB image.

Author:
  • Created by ijdoc2js

min(value)

Pixels less than 'value' are set to 'value'.

Parameters:
Name Type Description
value double

-

Author:
  • Created by ijdoc2js

minValue()

Returns the minimum possible pixel value.

Author:
  • Created by ijdoc2js
Returns:

double

moveTo(x, y)

Sets the current drawing location.

Parameters:
Name Type Description
x int

-

y int

-

Author:
  • Created by ijdoc2js

multiply(value)

Multiplies each pixel in the image or ROI by 'value'.

Parameters:
Name Type Description
value double

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

or(value)

Binary OR of each pixel in the image or ROI with 'value'.

Parameters:
Name Type Description
value int

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

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>

-

Author:
  • Created by ijdoc2js

putPixelValue(x, y, value)

Stores the specified value at (x,y).

Parameters:
Name Type Description
x int

-

y int

-

value double

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

reset()

Restores the pixel data from the snapshot (undo) buffer.

Author:
  • Created by ijdoc2js

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.

Author:
  • Created by ijdoc2js

resetMinAndMax()

For short and float images, recalculates the min and max image values needed to correctly display the image. For ByteProcessors, resets the LUT.

Author:
  • Created by ijdoc2js

resetRoi()

Sets the ROI (Region of Interest) and clipping rectangle to the entire image.

Author:
  • Created by ijdoc2js

resetThreshold()

Disables thresholding.

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js
Returns:

ImageProcessor

rotate(angle)

Rotates the image or selection 'angle' degrees clockwise.

Parameters:
Name Type Description
angle double

-

Author:
  • Created by ijdoc2js

rotateLeft()

Rotates the entire image 90 degrees counter-clockwise. Returns a new ImageProcessor that represents the rotated image.

Author:
  • Created by ijdoc2js
Returns:

ImageProcessor

rotateRight()

Rotates the entire image 90 degrees clockwise. Returns a new ImageProcessor that represents the rotated image.

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js

set(value)

Assigns 'value' to each pixel in the image or ROI.

Parameters:
Name Type Description
value double

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

set(index, value)

Parameters:
Name Type Description
index int

-

value int

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

setAutoThreshold(mString, darkBackground, lutUpdate)

Parameters:
Name Type Description
mString java.lang.String

-

darkBackground boolean

-

lutUpdate int

-

Author:
  • Created by ijdoc2js

setAutoThreshold(method, darkBackground)

Parameters:
Name Type Description
method AutoThresholder.Method

-

darkBackground boolean

-

Author:
  • Created by ijdoc2js

setAutoThreshold(method, darkBackground, lutUpdate)

Parameters:
Name Type Description
method AutoThresholder.Method

-

darkBackground boolean

-

lutUpdate int

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

setAutoThreshold(mString)

Parameters:
Name Type Description
mString java.lang.String

-

Author:
  • Created by ijdoc2js

setBackgroundValue(value)

Sets the background fill value used by the rotate() and scale() methods.

Parameters:
Name Type Description
value double

-

Author:
  • Created by ijdoc2js

setBinaryThreshold()

Author:
  • Created by ijdoc2js

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>

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

setColor(value)

Sets the default fill/draw value.

Parameters:
Name Type Description
value double

-

Author:
  • Created by ijdoc2js

setColor(value)

Sets the default fill/draw value.

Parameters:
Name Type Description
value int

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

setf(index, value)

Parameters:
Name Type Description
index int

-

value float

-

Author:
  • Created by ijdoc2js

setFloatArray(a)

Replaces the pixel data with contents of the specified 2D float array.

Parameters:
Name Type Description
a Array.<Array.<float>>

-

Author:
  • Created by ijdoc2js

setFont(font)

Sets the font used by drawString().

Parameters:
Name Type Description
font java.awt.Font

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

setHistogramSize(size)

Set the number of bins to be used for histograms of float images.

Parameters:
Name Type Description
size int

-

Author:
  • Created by ijdoc2js

setIntArray(a)

Replaces the pixel data with contents of the specified 2D int array.

Parameters:
Name Type Description
a Array.<Array.<int>>

-

Author:
  • Created by ijdoc2js

setInterpolate(interpolate)

This method has been replaced by setInterpolationMethod().

Parameters:
Name Type Description
interpolate boolean

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

setLineWidth(width)

Sets the line width used by lineTo() and drawDot().

Parameters:
Name Type Description
width int

-

Author:
  • Created by ijdoc2js

setLut(lut)

Parameters:
Name Type Description
lut LUT

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

setOverlay(overlay)

This method is used to display virtual stack overlays.

Parameters:
Name Type Description
overlay Overlay

-

Author:
  • Created by ijdoc2js

setPixels(channelNumber, fp)

Sets the pixels (of one color channel for RGB images) from a FloatProcessor.

Parameters:
Name Type Description
channelNumber int

-

fp FloatProcessor

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

setProgressBar(pb)

Assigns a progress bar to this processor. Set 'pb' to null to disable the progress bar.

Parameters:
Name Type Description
pb ProgressBar

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

setSliceNumber(slice)

PlugInFilterRunner uses this method to set the slice number.

Parameters:
Name Type Description
slice int

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

setSnapshotPixels(pixels)

Sets a new pixel array for the snapshot (undo) buffer.

Parameters:
Name Type Description
pixels java.lang.Object

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

setUnderColor(red, green, blue)

Set the lower Over/Under thresholding color.

Parameters:
Name Type Description
red int

-

green int

-

blue int

-

Author:
  • Created by ijdoc2js

setUseBicubic(b)

Parameters:
Name Type Description
b boolean

-

Author:
  • Created by ijdoc2js

setValue(value)

Sets the default fill/draw value.

Parameters:
Name Type Description
value double

-

Author:
  • Created by ijdoc2js

sharpen()

Sharpens the image or ROI using a 3x3 convolution kernel.

Author:
  • Created by ijdoc2js

smooth()

Replaces each pixel with the 3x3 neighborhood mean.

Author:
  • Created by ijdoc2js

snapshot()

Makes a copy of this image's pixel data that can be later restored using reset() or reset(mask).

Author:
  • Created by ijdoc2js

sqr()

Performs a square transform on the image or ROI.

Author:
  • Created by ijdoc2js

sqrt()

Performs a square root transform on the image or ROI.

Author:
  • Created by ijdoc2js

subtract(value)

Subtracts 'value' from each pixel in the image or ROI.

Parameters:
Name Type Description
value double

-

Author:
  • Created by ijdoc2js

swapPixelArrays()

Swaps the pixel and snapshot (undo) buffers.

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js

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

-

Author:
  • Created by ijdoc2js
Returns:

FloatProcessor

toString()

Returns a string containing information about this ImageProcessor.

Author:
  • Created by ijdoc2js
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

-

Author:
  • Created by ijdoc2js

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)
Author:
  • Created by ijdoc2js

updateComposite(rgbPixels, channel)

CompositeImage calls this method to generate an updated color image.

Parameters:
Name Type Description
rgbPixels Array.<int>

-

channel int

-

Author:
  • Created by ijdoc2js

xor(value)

Binary exclusive OR of each pixel in the image or ROI with 'value'.

Parameters:
Name Type Description
value int

-

Author:
  • Created by ijdoc2js