|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectij.process.ImageProcessor
ij.process.ColorProcessor
public class ColorProcessor
This is an 32-bit RGB image and methods that operate on that image.. Based on the ImageProcessor class from "KickAss Java Programming" by Tonny Espeset (http://www.sn.no/~espeset).
| Field Summary | |
|---|---|
protected int[] |
pixels
|
int |
RGB_DILATE
|
int |
RGB_ERODE
|
int |
RGB_FIND_EDGES
|
int |
RGB_MEDIAN
|
int |
RGB_NOISE
|
int |
RGB_THRESHOLD
|
protected int[] |
snapshotPixels
|
| Fields inherited from class ij.process.ImageProcessor |
|---|
baseCM, BLACK, BLACK_AND_WHITE_LUT, bLUT1, bLUT2, cm, cTable, cx, cy, font, fontMetrics, gLUT1, gLUT2, height, histogramSize, imageSource, interpolate, inversionTested, invertedLut, lineWidth, lutAnimation, maxThreshold, minThreshold, NO_LUT_UPDATE, NO_THRESHOLD, RED_LUT, rLUT1, rLUT2, roiHeight, roiWidth, roiX, roiY, snapshotHeight, snapshotWidth, width, xMax, xMin, yMax, yMin |
| Constructor Summary | |
|---|---|
ColorProcessor(java.awt.Image img)
Creates a ColorProcessor from an AWT Image. |
|
ColorProcessor(int width,
int height)
Creates a blank ColorProcessor of the specified dimensions. |
|
ColorProcessor(int width,
int height,
int[] pixels)
Creates a ColorProcessor from a pixel array. |
|
| Method Summary | |
|---|---|
void |
applyTable(int[] lut)
Transforms the image or ROI using a lookup table. |
void |
autoThreshold()
For byte images, converts to binary using an automatically determined threshold. |
void |
convolve3x3(int[] kernel)
3x3 convolution contributed by Glynne Casteel. |
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 ShortProcessor 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 |
drawPixel(int x,
int y)
Draws a pixel in the current foreground color. |
void |
erode()
Erodes the image or ROI using a 3x3 maximum filter. |
void |
fill()
Fills the current rectangular ROI. |
void |
fill(int[] mask)
Fills pixels that are within roi and part of the mask. |
void |
filter(int type)
3x3 unweighted smoothing. |
void |
filterRGB(int type,
double arg)
Performs the specified 3x3 filter on the reg, green and blue planes. |
void |
findEdges()
Finds edges in the image or ROI using a Sobel operator. |
int |
getBestIndex(java.awt.Color c)
Always returns 0 since RGB images do not use LUTs. |
java.awt.Color |
getColor(int x,
int y)
|
int[] |
getHistogram()
Returns the histogram of the image or ROI. |
int[] |
getHistogram(int[] mask)
|
void |
getHSB(byte[] H,
byte[] S,
byte[] B)
Returns hue, saturation and brightness in 3 byte arrays. |
double |
getInterpolatedPixel(double x,
double y)
Calls getPixelValue(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). |
java.lang.Object |
getPixels()
Returns a reference to the int array containing this image's pixel data. |
java.lang.Object |
getPixelsCopy()
Returns a reference to this image's snapshot (undo) array. |
float |
getPixelValue(int x,
int y)
Converts the specified pixel to grayscale (g=r*0.30+g*0.59+b*0.11) and returns it as a float. |
void |
getRGB(byte[] R,
byte[] G,
byte[] B)
Returns the red, green and blue planes as 3 byte arrays. |
void |
invertLut()
Does nothing since RGB images do not use LUTs. |
boolean |
isInvertedLut()
Always returns false since RGB images do not use LUTs. |
void |
medianFilter()
A 3x3 median filter. |
void |
noise(double range)
Adds random noise to the image or ROI. |
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()
Restores the pixel data from the snapshot (undo) buffer. |
void |
reset(int[] mask)
Restore pixels that are within roi but not part of the mask. |
ImageProcessor |
resize(int dstWidth,
int dstHeight)
Creates a new ColorProcessor 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 |
setColor(java.awt.Color color)
Sets the foreground color. |
void |
setHSB(byte[] H,
byte[] S,
byte[] B)
Sets the current pixels from 3 byte arrays (hue, saturation and brightness). |
void |
setMinAndMax(double min,
double max)
Uses a table look-up to map the pixels in this image from min-max to 0-255. |
void |
setPixels(java.lang.Object pixels)
Sets a new pixel array for the image and resets the snapshot buffer. |
void |
setRGB(byte[] R,
byte[] G,
byte[] B)
Sets the current pixels from 3 byte arrays (reg, green, blue). |
void |
setValue(double value)
Sets the default fill/draw value, where value is interpreted as an RGB int. |
void |
snapshot()
Makes a copy of this image's pixel data. |
| Methods inherited from class ij.process.ImageProcessor |
|---|
add, and, convertToByte, convertToFloat, convertToRGB, convertToShort, drawDot, drawDot2, drawString, duplicate, flipHorizontal, flipVertical, gamma, getColorModel, getColumn, getHeight, getHistogramSize, getImageSource, getLine, getMask, getMaxThreshold, getMinThreshold, getRoi, getRow, getStringWidth, getWidth, hideProgress, insert, invert, isKillable, lineTo, log, makeDefaultColorModel, moveTo, multiply, or, putColumn, putRow, resetMinAndMax, rotateLeft, rotateRight, setCalibrationTable, setColor, setColorModel, setFont, setHistogramSize, setInterpolate, setLineWidth, setLutAnimation, setMask, setProgressBar, setRoi, setRoi, setThreshold, sharpen, showProgress, smooth, toString, xor |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected int[] pixels
protected int[] snapshotPixels
public final int RGB_NOISE
public final int RGB_MEDIAN
public final int RGB_FIND_EDGES
public final int RGB_ERODE
public final int RGB_DILATE
public final int RGB_THRESHOLD
| Constructor Detail |
|---|
public ColorProcessor(java.awt.Image img)
public ColorProcessor(int width,
int height)
public ColorProcessor(int width,
int height,
int[] pixels)
| Method Detail |
|---|
public java.awt.Image createImage()
ImageProcessor
createImage in class ImageProcessor
public ImageProcessor createProcessor(int width,
int height)
createProcessor in class ImageProcessor
public java.awt.Color getColor(int x,
int y)
public void setColor(java.awt.Color color)
setColor in class ImageProcessorpublic void setValue(double value)
setValue in class ImageProcessorpublic double getMin()
getMin in class ImageProcessorpublic double getMax()
getMax in class ImageProcessor
public void setMinAndMax(double min,
double max)
setMinAndMax in class ImageProcessorpublic void snapshot()
ImageProcessor
snapshot in class ImageProcessorpublic void reset()
ImageProcessor
reset in class ImageProcessorpublic void reset(int[] mask)
ImageProcessor
reset in class ImageProcessorpublic void fill(int[] mask)
fill in class ImageProcessorpublic java.lang.Object getPixelsCopy()
ImageProcessor
getPixelsCopy in class ImageProcessor
public int getPixel(int x,
int y)
ImageProcessor
getPixel in class ImageProcessor
public double getInterpolatedPixel(double x,
double y)
getInterpolatedPixel in class ImageProcessor
public void putPixel(int x,
int y,
int value)
putPixel in class ImageProcessor
public void putPixelValue(int x,
int y,
double value)
putPixelValue in class ImageProcessor
public float getPixelValue(int x,
int y)
getPixelValue in class ImageProcessor
public void drawPixel(int x,
int y)
drawPixel in class ImageProcessorpublic java.lang.Object getPixels()
getPixels in class ImageProcessorpublic void setPixels(java.lang.Object pixels)
ImageProcessor
setPixels in class ImageProcessor
public void getHSB(byte[] H,
byte[] S,
byte[] B)
public void getRGB(byte[] R,
byte[] G,
byte[] B)
public void setRGB(byte[] R,
byte[] G,
byte[] B)
public void setHSB(byte[] H,
byte[] S,
byte[] B)
public void copyBits(ImageProcessor ip,
int xloc,
int yloc,
int mode)
copyBits in class ImageProcessorpublic void applyTable(int[] lut)
ImageProcessor
applyTable in class ImageProcessorpublic void fill()
fill in class ImageProcessor
public void filterRGB(int type,
double arg)
public void noise(double range)
ImageProcessor
noise in class ImageProcessorrange - the range of random numberspublic void medianFilter()
ImageProcessor
medianFilter in class ImageProcessorpublic void findEdges()
ImageProcessor
findEdges in class ImageProcessorpublic void erode()
ImageProcessor
erode in class ImageProcessorpublic void dilate()
ImageProcessor
dilate in class ImageProcessorpublic void autoThreshold()
ImageProcessor
autoThreshold in class ImageProcessor
public void scale(double xScale,
double yScale)
scale in class ImageProcessorImageProcessor.setInterpolate(boolean)public ImageProcessor crop()
ImageProcessor
crop in class ImageProcessor
public ImageProcessor resize(int dstWidth,
int dstHeight)
resize in class ImageProcessorImageProcessor.setInterpolate(boolean)public void rotate(double angle)
rotate in class ImageProcessorImageProcessor.setInterpolate(boolean)public void convolve3x3(int[] kernel)
convolve3x3 in class ImageProcessorpublic void filter(int type)
filter in class ImageProcessorpublic int[] getHistogram()
ImageProcessor
getHistogram in class ImageProcessorpublic int[] getHistogram(int[] mask)
public boolean isInvertedLut()
isInvertedLut in class ImageProcessorpublic int getBestIndex(java.awt.Color c)
getBestIndex in class ImageProcessorpublic void invertLut()
invertLut in class ImageProcessor
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||