new ByteProcessor(img)
Creates a ByteProcessor from an AWT Image.
Parameters:
Name | Type | Description |
---|---|---|
img |
java.awt.Image | - |
Methods
applyLut()
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> | - |
convolve(kernel, kernelWidth, kernelHeight)
Performs a convolution operation using the specified kernel.
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 ByteProcessor 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
dilate()
Dilates the image or ROI using a 3x3 minimum filter. Requires 8-bit or RGB image.
dilate(count, background)
Parameters:
Name | Type | Description |
---|---|---|
count |
int | - |
background |
int | - |
drawPixel(x, y)
Draws a pixel in the current foreground color.
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
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.
erode(count, background)
Parameters:
Name | Type | Description |
---|---|---|
count |
int | - |
background |
int | - |
fill(mask)
Sets pixels that are within roi and part of the mask to the foreground color. Does nothing if the mask is not the same size as the ROI.
Parameters:
Name | Type | Description |
---|---|---|
mask |
ImageProcessor | - |
filter(type)
Filters using a 3x3 neighborhood. The p1, p2, etc variables, which contain the values of the pixels in the neighborhood, are arranged as follows:
p1 p2 p3 p4 p5 p6 p7 p8 p9
Parameters:
Name | Type | Description |
---|---|---|
type |
int | - |
flipVertical()
Flips the image or ROI vertically.
get(index)
Parameters:
Name | Type | Description |
---|---|---|
index |
int | - |
Returns:
int
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
getBackgroundValue()
Returns the background fill value.
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
getf(index)
Parameters:
Name | Type | Description |
---|---|---|
index |
int | - |
Returns:
float
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
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(mask)
Parameters:
Name | Type | Description |
---|---|---|
mask |
ImageProcessor | - |
Returns:
int[]
getInterpolatedPixel(x, y)
Uses the current interpolation method (BILINEAR or BICUBIC) to calculate the pixel value at real coordinates (x,y).
Parameters:
Name | Type | Description |
---|---|---|
x |
double | - |
y |
double | - |
Returns:
double
getMax()
Returns the largest displayed pixel value.
Returns:
double
getMin()
Returns the smallest displayed pixel value.
Returns:
double
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
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 the byte array containing this image's pixel data. To avoid sign extension, the pixel values must be accessed using a mask (e.g. int i = pixels[j]&0xff).
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
getSnapshotPixels()
Returns a reference to the snapshot (undo) buffer, or null.
Returns:
java.lang.Object
isBinary()
Returns 'true' if this is a binary image (8-bit-image with only 0 and 255).
Returns:
boolean
medianFilter()
A 3x3 median filter. Requires 8-bit or RGB image.
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 | - |
outline()
putPixel(x, y, value)
Stores the specified value at (x,y). Does nothing if (x,y) is outside the image boundary. Values outside the range 0-255 are clamped.
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
value |
int | - |
putPixelValue(x, y, value)
Stores the specified real value at (x,y). Does nothing if (x,y) is outside the image boundary. Values outside the range 0-255 are clamped.
Parameters:
Name | Type | Description |
---|---|---|
x |
int | - |
y |
int | - |
value |
double | - |
reset(mask)
Restore pixels that are within roi but not part of mask.
Parameters:
Name | Type | Description |
---|---|---|
mask |
ImageProcessor | - |
reset()
Reset the image from snapshot.
resetMinAndMax()
Resets this image's LUT.
resize(dstWidth, dstHeight)
Creates a new ByteProcessor containing a scaled copy of this image or selection.
Parameters:
Name | Type | Description |
---|---|---|
dstWidth |
int | - |
dstHeight |
int | - |
Returns:
ImageProcessor
rotate(angle)
Rotates the image or ROI 'angle' degrees clockwise.
Parameters:
Name | Type | Description |
---|---|---|
angle |
double | - |
scale(xScale, yScale)
Scales the image or selection using the specified scale factors.
Parameters:
Name | Type | Description |
---|---|---|
xScale |
double | - |
yScale |
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 | - |
setBackgroundValue(value)
Sets the background fill value, where 0<=value<=255.
Parameters:
Name | Type | Description |
---|---|---|
value |
double | - |
setColor(color)
Sets the foreground drawing color.
Parameters:
Name | Type | Description |
---|---|---|
color |
java.awt.Color | - |
setf(index, value)
Parameters:
Name | Type | Description |
---|---|---|
index |
int | - |
value |
float | - |
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 | - |
setFromFloatArrays(arrays)
Parameters:
Name | Type | Description |
---|---|---|
arrays |
Array.<Array.<float>> | - |
setFromFloatProcessors(fp)
Parameters:
Name | Type | Description |
---|---|---|
fp |
Array.<FloatProcessor> | - |
setMinAndMax(min, max)
Maps the entries in this image's LUT from min-max to 0-255.
Parameters:
Name | Type | Description |
---|---|---|
min |
double | - |
max |
double | - |
setPixels(channelNumber, fp)
Sets the pixels from a FloatProcessor, no scaling. Also the min&max values are taken from the 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 | - |
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 | - |
setValue(value)
Sets the default fill/draw value, where 0<=value<=255.
Parameters:
Name | Type | Description |
---|---|---|
value |
double | - |
skeletonize()
snapshot()
Make a snapshot of the current image.
swapPixelArrays()
Swaps the pixel and snapshot (undo) arrays.
threshold(level)
Sets pixels less than or equal to level to 0 and all other pixels to 255.
Parameters:
Name | Type | Description |
---|---|---|
level |
int | - |
toFloat(channelNumber, fp)
Returns a FloatProcessor with the same image, no scaling or calibration (pixel values 0 to 255). The roi, mask, lut (ColorModel), threshold, min&max are also set for the FloatProcessor
Parameters:
Name | Type | Description |
---|---|---|
channelNumber |
int | - |
fp |
FloatProcessor | - |
Returns:
FloatProcessor
toFloatArrays()
Returns:
float[][]
toFloatProcessors()
Returns:
FloatProcessor[]