public class ByteProcessor extends ImageProcessor
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
pixels |
protected byte[] |
snapshotPixels |
antialiasedText, baseCM, BICUBIC, BILINEAR, BLACK, BLACK_AND_WHITE_LUT, BLUR_MORE, bLUT1, bLUT2, boldFont, CENTER_JUSTIFY, clipXMax, clipXMin, clipYMax, clipYMin, cm, cm2, CONVOLVE, cTable, cx, cy, defaultColorModel, drawingColor, FIND_EDGES, fmImage, font, fontMetrics, gLUT1, gLUT2, height, histogramMax, histogramMin, histogramSize, image, img, interpolate, interpolationMethod, inversionTested, invertedLut, ISODATA, ISODATA2, justification, LEFT_JUSTIFY, lineWidth, lutAnimation, lutUpdateMode, MAX, maxThreshold, MEDIAN_FILTER, MIN, minMaxSet, minThreshold, NEAREST_NEIGHBOR, newPixels, NO_LUT_UPDATE, NO_THRESHOLD, NONE, OVER_UNDER_LUT, raster, RED_LUT, RIGHT_JUSTIFY, rLUT1, rLUT2, roiHeight, roiWidth, roiX, roiY, sampleModel, snapshotHeight, snapshotWidth, source, width, xMax, xMin, yMax, yMin| Constructor and Description |
|---|
ByteProcessor(java.awt.image.BufferedImage bi)
Creates a ByteProcessor from a TYPE_BYTE_GRAY BufferedImage.
|
ByteProcessor(java.awt.Image img)
Creates a ByteProcessor from an AWT Image.
|
ByteProcessor(ImageProcessor ip,
boolean scale)
Creates a ByteProcessor from an ImageProcessor.
|
ByteProcessor(int width,
int height)
Creates a blank ByteProcessor of the specified dimensions.
|
ByteProcessor(int width,
int height,
byte[] pixels)
Creates a ByteProcessor from a byte array.
|
ByteProcessor(int width,
int height,
byte[] pixels,
java.awt.image.ColorModel cm)
Creates a ByteProcessor from a pixel array and IndexColorModel.
|
| Modifier and Type | Method and Description |
|---|---|
void |
applyLut() |
void |
applyTable(int[] lut)
Transforms the image or ROI using a lookup table.
|
void |
convolve(float[] kernel,
int kernelWidth,
int kernelHeight)
Performs a convolution operation using the specified kernel.
|
void |
convolve3x3(int[] kernel)
Convolves the image or ROI with the specified
3x3 integer convolution kernel.
|
void |
copyBits(ImageProcessor ip,
int xloc,
int yloc,
int mode)
Copies the image contained in 'ip' to (xloc, yloc) using one of
the transfer modes defined in the Blitter interface.
|
java.awt.Image |
createImage()
Returns a copy of this image is the form of an AWT Image.
|
ImageProcessor |
createProcessor(int width,
int height)
Returns a new, blank ByteProcessor with the specified width and height.
|
ImageProcessor |
crop()
Creates a new processor containing an image
that corresponds to the current ROI.
|
void |
dilate()
Dilates the image or ROI using a 3x3 minimum filter.
|
void |
dilate(int count,
int background) |
void |
drawPixel(int x,
int y)
Draws a pixel in the current foreground color.
|
ImageProcessor |
duplicate()
Returns a duplicate of this image.
|
void |
erode()
Erodes the image or ROI using a 3x3 maximum filter.
|
void |
erode(int count,
int background) |
void |
fill(ImageProcessor mask)
Sets pixels that are within roi and part of the mask to the foreground
color.
|
void |
filter(int type)
Filters using a 3x3 neighborhood.
|
void |
flipVertical()
Flips the image or ROI vertically.
|
int |
get(int index) |
int |
get(int x,
int y)
This is a faster version of getPixel() that does not do bounds checking.
|
double |
getBackgroundValue()
Returns the background fill value.
|
int |
getBitDepth()
Returns the bit depth, 8, 16, 24 (RGB) or 32.
|
java.awt.image.BufferedImage |
getBufferedImage()
Returns this image as a BufferedImage.
|
float |
getf(int index) |
float |
getf(int x,
int y)
Returns the value of the pixel at (x,y) as a float.
|
int[] |
getHistogram()
Returns the histogram of the image or ROI.
|
int[] |
getHistogram(ImageProcessor mask) |
double |
getInterpolatedPixel(double x,
double y)
Uses the current interpolation method (BILINEAR or BICUBIC)
to calculate the pixel value at real coordinates (x,y).
|
double |
getMax()
Returns the largest displayed pixel value.
|
double |
getMin()
Returns the smallest displayed pixel value.
|
int |
getPixel(int x,
int y)
Returns the value of the pixel at (x,y).
|
int |
getPixelInterpolated(double x,
double y)
Uses the current interpolation method to find the pixel value at real coordinates (x,y).
|
java.lang.Object |
getPixels()
Returns a reference to the byte array containing this image's
pixel data.
|
java.lang.Object |
getPixelsCopy()
Returns a copy of the pixel data.
|
float |
getPixelValue(int x,
int y)
Returns the value of the pixel at (x,y).
|
java.lang.Object |
getSnapshotPixels()
Returns a reference to the snapshot (undo) buffer, or null.
|
boolean |
isBinary()
Returns 'true' if this is a binary image (8-bit-image with only 0 and 255).
|
void |
medianFilter()
A 3x3 median filter.
|
void |
noise(double standardDeviation)
Adds pseudorandom, Gaussian ("normally") distributed values, with
mean 0.0 and the specified standard deviation, to this image or ROI.
|
void |
outline() |
void |
putPixel(int x,
int y,
int value)
Stores the specified value at (x,y).
|
void |
putPixelValue(int x,
int y,
double value)
Stores the specified real value at (x,y).
|
void |
reset()
Reset the image from snapshot.
|
void |
reset(ImageProcessor mask)
Restore pixels that are within roi but not part of mask.
|
void |
resetMinAndMax()
Resets this image's LUT.
|
ImageProcessor |
resize(int dstWidth,
int dstHeight)
Creates a new ByteProcessor containing a scaled copy of this image or selection.
|
void |
rotate(double angle)
Rotates the image or ROI 'angle' degrees clockwise.
|
void |
scale(double xScale,
double yScale)
Scales the image or selection using the specified scale factors.
|
void |
set(int index,
int value) |
void |
set(int x,
int y,
int value)
This is a faster version of putPixel() that does not clip
out of range values and does not do bounds checking.
|
void |
setBackgroundValue(double value)
Sets the background fill value, where 0<=value<=255.
|
void |
setColor(java.awt.Color color)
Sets the foreground drawing color.
|
void |
setf(int index,
float value) |
void |
setf(int x,
int y,
float value)
Sets the value of the pixel at (x,y) to 'value'.
|
void |
setFromFloatArrays(float[][] arrays) |
void |
setFromFloatProcessors(FloatProcessor[] fp) |
void |
setMinAndMax(double min,
double max)
Maps the entries in this image's LUT from min-max to 0-255.
|
void |
setPixels(int channelNumber,
FloatProcessor fp)
Sets the pixels from a FloatProcessor, no scaling.
|
void |
setPixels(java.lang.Object pixels)
Sets a new pixel array for the image.
|
void |
setSnapshotPixels(java.lang.Object pixels)
Sets a new pixel array for the snapshot (undo) buffer.
|
void |
setThreshold(double minThreshold,
double maxThreshold,
int lutUpdate)
Sets the lower and upper threshold levels.
|
void |
setValue(double value)
Sets the default fill/draw value, where 0<=value<=255.
|
void |
skeletonize() |
void |
snapshot()
Make a snapshot of the current image.
|
void |
swapPixelArrays()
Swaps the pixel and snapshot (undo) arrays.
|
void |
threshold(int level)
Sets pixels less than or equal to level to 0 and all other pixels to 255.
|
FloatProcessor |
toFloat(int channelNumber,
FloatProcessor fp)
Returns a FloatProcessor with the same image, no scaling or calibration
(pixel values 0 to 255).
|
float[][] |
toFloatArrays() |
FloatProcessor[] |
toFloatProcessors() |
abs, add, add, and, applyMacro, autoThreshold, bin, blurGaussian, clone, convertToByte, convertToByteProcessor, convertToByteProcessor, convertToColorProcessor, convertToFloat, convertToFloatProcessor, convertToRGB, convertToShort, convertToShortProcessor, convertToShortProcessor, cubic, draw, drawDot, drawDot2, drawLine, drawOval, drawOverlay, drawPolygon, drawRect, drawRoi, drawString, drawString, drawString, exp, fill, fill, fillOutside, fillOval, fillPolygon, findEdges, flipHorizontal, gamma, getAutoThreshold, getAutoThreshold, getBestIndex, getBicubicInterpolatedPixel, getCalibrationTable, getColorModel, getColumn, getCurrentColorModel, getDefaultColorModel, getFloatArray, getFont, getFontMetrics, getHeight, getHistogramMax, getHistogramMin, getHistogramSize, getIndexSampleModel, getIntArray, getInterpolate, getInterpolatedValue, getInterpolationMethod, getInterpolationMethods, getLine, getLineWidth, getLut, getLutUpdateMode, getMask, getMaskArray, getMaxThreshold, getMinThreshold, getNChannels, getNeighborhood, getOverlay, getPixel, getPixelCount, getProgressIncrement, getRoi, getRow, getRow, getSliceNumber, getStatistics, getStringWidth, getWidth, hideProgress, insert, invert, invertLut, isColorLut, isDefaultLut, isGrayscale, isInvertedLut, isKillable, isPseudoColorLut, lineTo, ln, log, makeDefaultColorModel, maskSizeError, max, maxValue, min, minValue, moveTo, multiply, or, putColumn, putPixel, putRow, putRow, resetBinaryThreshold, resetRoi, resetThreshold, resize, resize, resizeLinearly, rotateLeft, rotateRight, set, setAntialiasedText, setAutoThreshold, setAutoThreshold, setAutoThreshold, setAutoThreshold, setAutoThreshold, setBinaryThreshold, setCalibrationTable, setClipRect, setColor, setColor, setColorModel, setFloatArray, setFont, setHistogramRange, setHistogramSize, setIntArray, setInterpolate, setInterpolationMethod, setJustification, setLineWidth, setLut, setLutAnimation, setMask, setOverColor, setOverlay, setProgressBar, setRoi, setRoi, setRoi, setRoi, setSliceNumber, setSnapshotCopyMode, setUnderColor, setUseBicubic, sharpen, showProgress, smooth, sqr, sqrt, subtract, toString, translate, translate, updateComposite, xorpublic ByteProcessor(java.awt.Image img)
public ByteProcessor(int width,
int height)
public ByteProcessor(int width,
int height,
byte[] pixels)
public ByteProcessor(int width,
int height,
byte[] pixels,
java.awt.image.ColorModel cm)
public ByteProcessor(java.awt.image.BufferedImage bi)
public ByteProcessor(ImageProcessor ip, boolean scale)
public java.awt.Image createImage()
ImageProcessorcreateImage in class ImageProcessorpublic java.awt.image.BufferedImage getBufferedImage()
getBufferedImage in class ImageProcessorpublic ImageProcessor createProcessor(int width, int height)
createProcessor in class ImageProcessorpublic ImageProcessor crop()
ImageProcessorcrop in class ImageProcessorpublic ImageProcessor duplicate()
duplicate in class ImageProcessorpublic void snapshot()
snapshot in class ImageProcessorImageProcessor.reset(),
ImageProcessor.reset(ImageProcessor)public void reset()
reset in class ImageProcessorpublic void swapPixelArrays()
swapPixelArrays in class ImageProcessorpublic void reset(ImageProcessor mask)
reset in class ImageProcessorpublic void setSnapshotPixels(java.lang.Object pixels)
ImageProcessorsetSnapshotPixels in class ImageProcessorpublic java.lang.Object getSnapshotPixels()
ImageProcessorgetSnapshotPixels in class ImageProcessorpublic void fill(ImageProcessor mask)
fill in class ImageProcessorImageProcessor.setColor(Color),
ImageProcessor.setValue(double),
ImageProcessor.getMask(),
ImageProcessor.fill(Roi)public int getPixel(int x,
int y)
ImageProcessorgetPixel in class ImageProcessorpublic final int get(int x,
int y)
ImageProcessorget in class ImageProcessorpublic final void set(int x,
int y,
int value)
ImageProcessorset in class ImageProcessorpublic final int get(int index)
get in class ImageProcessorpublic final void set(int index,
int value)
set in class ImageProcessorpublic final float getf(int x,
int y)
ImageProcessorgetf in class ImageProcessorpublic final void setf(int x,
int y,
float value)
ImageProcessorsetf in class ImageProcessorpublic final float getf(int index)
getf in class ImageProcessorpublic final void setf(int index,
float value)
setf in class ImageProcessorpublic double getInterpolatedPixel(double x,
double y)
getInterpolatedPixel in class ImageProcessorpublic final int getPixelInterpolated(double x,
double y)
ImageProcessorgetPixelInterpolated in class ImageProcessorpublic float getPixelValue(int x,
int y)
ImageProcessorgetPixelValue in class ImageProcessorpublic void setColor(java.awt.Color color)
setColor in class ImageProcessorpublic void setValue(double value)
setValue in class ImageProcessorpublic void setBackgroundValue(double value)
setBackgroundValue in class ImageProcessorpublic double getBackgroundValue()
getBackgroundValue in class ImageProcessorpublic void putPixelValue(int x,
int y,
double value)
putPixelValue in class ImageProcessorpublic final void putPixel(int x,
int y,
int value)
putPixel in class ImageProcessorpublic void drawPixel(int x,
int y)
drawPixel in class ImageProcessorpublic java.lang.Object getPixels()
getPixels in class ImageProcessorpublic java.lang.Object getPixelsCopy()
getPixelsCopy in class ImageProcessorImageProcessor.snapshot(),
ImageProcessor.setSnapshotCopyMode(boolean)public void setPixels(java.lang.Object pixels)
ImageProcessorsetPixels in class ImageProcessorpublic double getMin()
getMin in class ImageProcessorpublic double getMax()
getMax in class ImageProcessorpublic void setMinAndMax(double min,
double max)
setMinAndMax in class ImageProcessorpublic void resetMinAndMax()
resetMinAndMax in class ImageProcessorpublic void setThreshold(double minThreshold,
double maxThreshold,
int lutUpdate)
ImageProcessorsetThreshold in class ImageProcessorpublic void copyBits(ImageProcessor ip, int xloc, int yloc, int mode)
copyBits in class ImageProcessorpublic void applyTable(int[] lut)
ImageProcessorapplyTable in class ImageProcessorpublic void convolve3x3(int[] kernel)
ImageProcessorconvolve3x3 in class ImageProcessorpublic void filter(int type)
p1 p2 p3
p4 p5 p6
p7 p8 p9
filter in class ImageProcessorpublic void erode()
ImageProcessorerode in class ImageProcessorpublic void dilate()
ImageProcessordilate in class ImageProcessorpublic void erode(int count,
int background)
public void dilate(int count,
int background)
public void outline()
public void skeletonize()
public void medianFilter()
ImageProcessormedianFilter in class ImageProcessorpublic void noise(double standardDeviation)
noise in class ImageProcessorpublic void scale(double xScale,
double yScale)
scale in class ImageProcessorImageProcessor.setInterpolate(boolean)public ImageProcessor resize(int dstWidth, int dstHeight)
resize in class ImageProcessorImageProcessor.setInterpolate(boolean)public void rotate(double angle)
rotate in class ImageProcessorImageProcessor.setInterpolationMethod(int)public void flipVertical()
ImageProcessorflipVertical in class ImageProcessorpublic int[] getHistogram()
ImageProcessorFor 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).
getHistogram in class ImageProcessorpublic int[] getHistogram(ImageProcessor mask)
public void threshold(int level)
threshold in class ImageProcessorpublic void applyLut()
public void convolve(float[] kernel,
int kernelWidth,
int kernelHeight)
convolve in class ImageProcessorpublic FloatProcessor[] toFloatProcessors()
public void setFromFloatProcessors(FloatProcessor[] fp)
public float[][] toFloatArrays()
public void setFromFloatArrays(float[][] arrays)
public FloatProcessor toFloat(int channelNumber, FloatProcessor fp)
toFloat in class ImageProcessorchannelNumber - Ignored (needed for compatibility with ColorProcessor.toFloat)fp - Here a FloatProcessor can be supplied, or null. The FloatProcessor
is overwritten by this method (re-using its pixels array
improves performance).public void setPixels(int channelNumber,
FloatProcessor fp)
setPixels in class ImageProcessorchannelNumber - Ignored (needed for compatibility with ColorProcessor.toFloat)fp - The FloatProcessor where the image data are read from.public boolean isBinary()
isBinary in class ImageProcessorpublic int getBitDepth()
ImageProcessorgetBitDepth in class ImageProcessor