Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
ByteProcessor Class Reference
Inheritance diagram for ByteProcessor:
ImageProcessor BinaryProcessor

Public Member Functions

 ByteProcessor (Image img)
 
 ByteProcessor (int width, int height)
 
 ByteProcessor (int width, int height, byte[] pixels, ColorModel cm)
 
Image createImage ()
 
ImageProcessor createProcessor (int width, int height)
 
ImageProcessor crop ()
 
void snapshot ()
 
void reset ()
 
void reset (ImageProcessor mask)
 
void fill (ImageProcessor mask)
 
int getPixel (int x, int y)
 
double getInterpolatedPixel (double x, double y)
 
double getInterpolatedValue (double x, double y)
 
float getPixelValue (int x, int y)
 
void setColor (Color color)
 
void setValue (double value)
 
void putPixelValue (int x, int y, double value)
 
void putPixel (int x, int y, int value)
 
void drawPixel (int x, int y)
 
Object getPixels ()
 
Object getPixelsCopy ()
 
void setPixels (Object pixels)
 
double getMin ()
 
double getMax ()
 
void setMinAndMax (double min, double max)
 
void resetMinAndMax ()
 
void copyBits (ImageProcessor ip, int xloc, int yloc, int mode)
 
void applyTable (int[] lut)
 
void convolve3x3 (int[] kernel)
 
void filter (int type)
 
void erode ()
 
void dilate ()
 
void outline ()
 
void skeletonize ()
 
void medianFilter ()
 
void noise (double range)
 
void scale (double xScale, double yScale)
 
ImageProcessor resize (int dstWidth, int dstHeight)
 
void rotate (double angle)
 
void flipVertical ()
 
int[] getHistogram ()
 
int[] getHistogram (ImageProcessor mask)
 
void threshold (int level)
 
void applyLut ()
 
void convolve (float[] kernel, int kernelWidth, int kernelHeight)
 
- Public Member Functions inherited from ImageProcessor
int getWidth ()
 
int getHeight ()
 
ColorModel getColorModel ()
 
void setColorModel (ColorModel cm)
 
void invertLut ()
 
int getBestIndex (Color c)
 
boolean isInvertedLut ()
 
boolean isColorLut ()
 
boolean isPseudoColorLut ()
 
void setColor (int value)
 
void resetMinAndMax ()
 
void setThreshold (double minThreshold, double maxThreshold, int lutUpdate)
 
void resetThreshold ()
 
double getMinThreshold ()
 
double getMaxThreshold ()
 
void setRoi (Rectangle roi)
 
void setRoi (int x, int y, int rwidth, int rheight)
 
void setRoi (ij.gui.Roi roi)
 
void setRoi (Polygon roi)
 
void resetRoi ()
 
Rectangle getRoi ()
 
void setMask (ImageProcessor mask)
 
ImageProcessor getMask ()
 
byte[] getMaskArray ()
 
void setProgressBar (ProgressBar pb)
 
void setInterpolate (boolean interpolate)
 
boolean getInterpolate ()
 
boolean isKillable ()
 
double[] getLine (double x1, double y1, double x2, double y2)
 
void getRow (int x, int y, int[] data, int length)
 
void getColumn (int x, int y, int[] data, int length)
 
void putRow (int x, int y, int[] data, int length)
 
void putColumn (int x, int y, int[] data, int length)
 
void moveTo (int x, int y)
 
void setLineWidth (int width)
 
void lineTo (int x2, int y2)
 
void drawLine (int x1, int y1, int x2, int y2)
 
void drawRect (int x, int y, int width, int height)
 
void drawPolygon (Polygon p)
 
void fillPolygon (Polygon p)
 
void drawDot2 (int x, int y)
 
void drawDot (int xcenter, int ycenter)
 
void drawString (String s)
 
void drawString (String s, int x, int y)
 
void setJustification (int justification)
 
void setFont (Font font)
 
void setAntialiasedText (boolean antialiasedText)
 
int getStringWidth (String s)
 
FontMetrics getFontMetrics ()
 
void smooth ()
 
void sharpen ()
 
void findEdges ()
 
void flipHorizontal ()
 
ImageProcessor rotateRight ()
 
ImageProcessor rotateLeft ()
 
void insert (ImageProcessor ip, int xloc, int yloc)
 
String toString ()
 
void fill ()
 
void setCalibrationTable (float[] cTable)
 
void setHistogramSize (int size)
 
int getHistogramSize ()
 
void setHistogramRange (double histMin, double histMax)
 
double getHistogramMin ()
 
double getHistogramMax ()
 
int[] getPixel (int x, int y, int[] iArray)
 
void putPixel (int x, int y, int[] iArray)
 
double getInterpolatedValue (double x, double y)
 
void invert ()
 
void add (int value)
 
void add (double value)
 
void multiply (double value)
 
void and (int value)
 
void or (int value)
 
void xor (int value)
 
void gamma (double value)
 
void log ()
 
void sqr ()
 
void sqrt ()
 
void min (double value)
 
void max (double value)
 
ImageProcessor duplicate ()
 
void setLutAnimation (boolean lutAnimation)
 
ImageProcessor convertToByte (boolean doScaling)
 
ImageProcessor convertToShort (boolean doScaling)
 
ImageProcessor convertToFloat ()
 
ImageProcessor convertToRGB ()
 
void autoThreshold ()
 
int getAutoThreshold ()
 
int getAutoThreshold (int[] histogram)
 
void setClipRect (Rectangle clipRect)
 

Protected Attributes

byte[] pixels
 
byte[] snapshotPixels
 
- Protected Attributes inherited from ImageProcessor
int lineWidth = 1
 
int cx
 
Font font
 
FontMetrics fontMetrics
 
boolean antialiasedText
 
boolean boldFont
 
int width
 
int height
 
int roiX
 
int xMin
 
ColorModel baseCM
 
ColorModel cm
 
byte[] rLUT1
 
byte[] rLUT2
 
boolean interpolate
 
double minThreshold =NO_THRESHOLD
 
int histogramSize = 256
 
double histogramMin
 
float[] cTable
 
boolean lutAnimation
 
MemoryImageSource source
 
Image img
 
boolean newPixels
 
Color drawingColor = Color.black
 
int clipXMin
 
int justification = LEFT_JUSTIFY
 
boolean inversionTested = false
 
boolean invertedLut
 

Additional Inherited Members

- Static Public Attributes inherited from ImageProcessor
static final int BLACK = 0xFF000000
 
static final double NO_THRESHOLD = -808080.0
 
static final int LEFT_JUSTIFY = 0
 
static final int CENTER_JUSTIFY = 1
 
static final int RIGHT_JUSTIFY = 2
 
static final int RED_LUT =0
 
- Protected Member Functions inherited from ImageProcessor
void showProgress (double percentDone)
 
void hideProgress ()
 
void makeDefaultColorModel ()
 
String maskSizeError (ImageProcessor mask)
 

Detailed Description

This is an 8-bit image and methods that operate on that image. Based on the ImageProcessor class from "KickAss Java Programming" by Tonny Espeset.

Definition at line 12 of file ByteProcessor.java.

Constructor & Destructor Documentation

ByteProcessor ( Image  img)
inline

Creates a ByteProcessor from an 8-bit, indexed color AWT Image.

Definition at line 22 of file ByteProcessor.java.

ByteProcessor ( int  width,
int  height 
)
inline

Creates a blank ByteProcessor of the specified dimensions.

Definition at line 41 of file ByteProcessor.java.

ByteProcessor ( int  width,
int  height,
byte[]  pixels,
ColorModel  cm 
)
inline

Creates a ByteProcessor from a pixel array and IndexColorModel.

Definition at line 46 of file ByteProcessor.java.

Member Function Documentation

void applyTable ( int[]  lut)
inlinevirtual

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.

Implements ImageProcessor.

Definition at line 358 of file ByteProcessor.java.

void convolve ( float[]  kernel,
int  kernelWidth,
int  kernelHeight 
)
inlinevirtual

Performs a convolution operation using the specified kernel.

Implements ImageProcessor.

Definition at line 814 of file ByteProcessor.java.

void convolve3x3 ( int[]  kernel)
inlinevirtual

3x3 convolution contributed by Glynne Casteel.

Implements ImageProcessor.

Definition at line 369 of file ByteProcessor.java.

void copyBits ( ImageProcessor  ip,
int  xloc,
int  yloc,
int  mode 
)
inlinevirtual

Copies the image contained in 'ip' to (xloc, yloc) using one of the transfer modes defined in the Blitter interface.

Implements ImageProcessor.

Definition at line 350 of file ByteProcessor.java.

Image createImage ( )
inlinevirtual

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

Implements ImageProcessor.

Definition at line 56 of file ByteProcessor.java.

ImageProcessor createProcessor ( int  width,
int  height 
)
inlinevirtual

Returns a new, blank ByteProcessor with the specified width and height.

Implements ImageProcessor.

Definition at line 73 of file ByteProcessor.java.

ImageProcessor crop ( )
inlinevirtual

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

Implements ImageProcessor.

Definition at line 81 of file ByteProcessor.java.

void dilate ( )
inlinevirtual

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

Implements ImageProcessor.

Definition at line 506 of file ByteProcessor.java.

void drawPixel ( int  x,
int  y 
)
inlinevirtual

Draws a pixel in the current foreground color.

Implements ImageProcessor.

Definition at line 244 of file ByteProcessor.java.

void erode ( )
inlinevirtual

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

Implements ImageProcessor.

Definition at line 499 of file ByteProcessor.java.

void fill ( ImageProcessor  mask)
inlinevirtual

Fills pixels that are within roi and part of the mask. Throws an IllegalArgumentException if the mask is not the same size as the ROI.

Implements ImageProcessor.

Definition at line 136 of file ByteProcessor.java.

void filter ( int  type)
inlinevirtual

Filters using a 3x3 neighborhood.

Implements ImageProcessor.

Definition at line 424 of file ByteProcessor.java.

void flipVertical ( )
inlinevirtual

Flips the image or ROI vertically.

Implements ImageProcessor.

Definition at line 741 of file ByteProcessor.java.

int [] getHistogram ( )
inlinevirtual

Returns the histogram of the image or ROI. Returns a luminosity histogram for RGB images and null for float images.

Implements ImageProcessor.

Definition at line 756 of file ByteProcessor.java.

double getInterpolatedPixel ( double  x,
double  y 
)
inlinevirtual

Uses bilinear interpolation to find the pixel value at real coordinates (x,y).

Implements ImageProcessor.

Definition at line 163 of file ByteProcessor.java.

double getInterpolatedValue ( double  x,
double  y 
)
inline

Uses bilinear interpolation to find the calibrated pixel value at real coordinates (x,y).

Definition at line 173 of file ByteProcessor.java.

double getMax ( )
inlinevirtual

Returns the largest displayed pixel value.

Implements ImageProcessor.

Definition at line 296 of file ByteProcessor.java.

double getMin ( )
inlinevirtual

Returns the smallest displayed pixel value.

Implements ImageProcessor.

Definition at line 291 of file ByteProcessor.java.

int getPixel ( int  x,
int  y 
)
inlinevirtual

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.

Implements ImageProcessor.

Definition at line 153 of file ByteProcessor.java.

Object getPixels ( )
inlinevirtual

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).

Implements ImageProcessor.

Definition at line 252 of file ByteProcessor.java.

Object getPixelsCopy ( )
inlinevirtual

Returns a reference to this image's snapshot (undo) byte array. If the snapshot array is null, returns a copy of the pixel data.

Implements ImageProcessor.

Definition at line 258 of file ByteProcessor.java.

float getPixelValue ( int  x,
int  y 
)
inlinevirtual

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.

Implements ImageProcessor.

Definition at line 196 of file ByteProcessor.java.

void medianFilter ( )
inlinevirtual

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

Implements ImageProcessor.

Definition at line 540 of file ByteProcessor.java.

void noise ( double  range)
inlinevirtual

Adds random noise to the image or ROI.

Parameters
rangethe range of random numbers

Implements ImageProcessor.

Definition at line 544 of file ByteProcessor.java.

void putPixel ( int  x,
int  y,
int  value 
)
inlinevirtual

Stores the specified value at (x,y). Does nothing if (x,y) is outside the image boundary. Values outside the range 0-255 are clipped.

Implements ImageProcessor.

Definition at line 236 of file ByteProcessor.java.

void putPixelValue ( int  x,
int  y,
double  value 
)
inlinevirtual

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 clipped.

Implements ImageProcessor.

Definition at line 223 of file ByteProcessor.java.

void reset ( )
inlinevirtual

Reset the image from snapshot.

Implements ImageProcessor.

Definition at line 108 of file ByteProcessor.java.

void reset ( ImageProcessor  mask)
inlinevirtual

Restore pixels that are within roi but not part of mask.

Implements ImageProcessor.

Definition at line 116 of file ByteProcessor.java.

void resetMinAndMax ( )
inline

Resets this image's LUT.

Definition at line 344 of file ByteProcessor.java.

ImageProcessor resize ( int  dstWidth,
int  dstHeight 
)
inlinevirtual

Creates a new ByteProcessor containing a scaled copy of this image or selection.

See Also
ij.process.ImageProcessor::setInterpolate

Implements ImageProcessor.

Definition at line 645 of file ByteProcessor.java.

void rotate ( double  angle)
inlinevirtual

Rotates the image or ROI 'angle' degrees clockwise.

See Also
ImageProcessor::setInterpolate

Implements ImageProcessor.

Definition at line 691 of file ByteProcessor.java.

void scale ( double  xScale,
double  yScale 
)
inlinevirtual

Scales the image or selection using the specified scale factors.

See Also
ImageProcessor::setInterpolate

Implements ImageProcessor.

Definition at line 569 of file ByteProcessor.java.

void setColor ( Color  color)
inlinevirtual

Sets the foreground drawing color.

Implements ImageProcessor.

Definition at line 207 of file ByteProcessor.java.

void setMinAndMax ( double  min,
double  max 
)
inlinevirtual

Maps the entries in this image's LUT from min-max to 0-255.

Implements ImageProcessor.

Definition at line 301 of file ByteProcessor.java.

void setPixels ( Object  pixels)
inlinevirtual

Sets a new pixel array for the image and resets the snapshot buffer. The length of the array must be equal to width*height.

Implements ImageProcessor.

Definition at line 268 of file ByteProcessor.java.

void setValue ( double  value)
inlinevirtual

Sets the default fill/draw value, where 0<=value<=255.

Implements ImageProcessor.

Definition at line 214 of file ByteProcessor.java.

void snapshot ( )
inlinevirtual

Make a snapshot of the current image.

Implements ImageProcessor.

Definition at line 94 of file ByteProcessor.java.

void threshold ( int  level)
inlinevirtual

Sets pixels less than or equal to level to 0 and all other pixels to 255.

Implements ImageProcessor.

Definition at line 791 of file ByteProcessor.java.


The documentation for this class was generated from the following file: