ij.process
Class ShortProcessor

java.lang.Object
  |
  +--ij.process.ImageProcessor
        |
        +--ij.process.ShortProcessor

public class ShortProcessor
extends ImageProcessor

Objects of the class contain a 16-bit unsigned image (short) and methods that operate on that image.


Fields inherited from class ij.process.ImageProcessor
BLACK, BLACK_AND_WHITE_LUT, NO_LUT_UPDATE, NO_THRESHOLD, OVER_UNDER_LUT, RED_LUT
 
Constructor Summary
ShortProcessor(int width, int height)
          Creates a blank ShortProcessor using the default grayscale LUT that displays zero as black.
ShortProcessor(int width, int height, boolean unsigned)
          Obsolete.
ShortProcessor(int width, int height, short[] pixels, java.awt.image.ColorModel cm)
          Creates a new ShortProcessor using the specified pixel array and ColorModel.
ShortProcessor(int width, int height, short[] pixels, java.awt.image.ColorModel cm, boolean unsigned)
          Obsolete.
 
Method Summary
 void add(double value)
          Adds 'value' to each pixel in the image or ROI.
 void add(int value)
          Adds 'value' to each pixel in the image or ROI.
 void and(int value)
          Binary AND of each pixel in the image or ROI with 'value'.
 void applyTable(int[] lut)
          Transforms the pixel data using a 65536 entry lookup table.
 void autoThreshold()
          For byte images, converts to binary using an automatically determined threshold.
 void convolve(float[][] kernel, int kw, int kh)
           
 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()
          Create an 8-bit AWT image by scaling pixels in the range min-max to 0-255.
 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)
          Filters using a 3x3 neighborhood.
 void findMinAndMax()
           
 void flipVertical()
          Flips the image or ROI vertically.
 void gamma(double value)
          Performs gamma correction of the image or ROI.
 int[] getHistogram()
          Returns 65536 bin histogram of the current ROI, which can be non-rectangular.
 double getInterpolatedPixel(double x, double y)
          Uses bilinear interpolation to find the pixel value at real coordinates (x,y).
 double getInterpolatedValue(double x, double y)
          Uses bilinear interpolation to find the calibrated 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).
 java.lang.Object getPixels()
          Returns a reference to the short 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)
          Returns the value of the pixel at (x,y).
 void Gradient2D()
           
 void Gradient2DIn(int refX, int refY)
          computes inward gradient toward center of ROI
 void Gradient2DOut(int refX, int refY)
          computes outward gradient from center of ROI
 void invert()
          Inverts the image or ROI.
 void log()
          Performs a log transform on the image or ROI.
 void max(double value)
          Pixels greater than 'value' are set to 'value'.
 void medianFilter()
          A 3x3 median filter.
 void min(double value)
          Pixels less than 'value' are set to 'value'.
 void multiply(double value)
          Multiplies each pixel in the image or ROI by 'value'.
 void noise(double range)
          Adds random noise to the image or ROI.
 void or(int value)
          Binary OR of each pixel in the image or ROI with 'value'.
 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.
 void resetMinAndMax()
          Recalculates the min and max values used to scale pixel values to 0-255 for display.
 ImageProcessor resize(int dstWidth, int dstHeight)
          Creates a new ShortProcessor containing a scaled copy of this image or selection.
 void reWindowImage()
           
 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 fill/draw color.
 void setMinAndMax(double min, double max)
          Sets the min and max variables that control how real pixel values are mapped to 0-255 screen values.
 void setPixels(java.lang.Object pixels)
          Sets a new pixel array for the image and resets the snapshot 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<=65535).
 void snapshot()
          Makes a copy of this image's pixel data.
 void sqr()
          Performs a square transform on the image or ROI.
 void sqrt()
          Performs a square root transform on the image or ROI.
 void threshold(int level)
           
 void xor(int value)
          Binary exclusive OR of each pixel in the image or ROI with 'value'.
 
Methods inherited from class ij.process.ImageProcessor
convertToByte, convertToFloat, convertToRGB, convertToShort, convolve, drawDot, drawDot2, drawLine, drawRect, drawString, drawString, duplicate, filterGaussian, filterGaussian, filterGaussian, filterGaussian, findEdges, flipHorizontal, getBestIndex, getColorModel, getColumn, getFontMetrics, getHeight, getHistogramSize, getImageAvg, getLine, getMask, getMaxThreshold, getMinThreshold, getNvalLocsInRegion, getNvalLocsInRegion, getNvalsInRegion, getNvalsInRegion, getPtDivotSize, getRegionAvg, getRegionAvg, getRegionAvg, getRegionMax, getRegionMax, getRegionMax, getRegionMin, getRegionMin, getRegionMin, getRegionMinLoc, getRegionMinLoc, getRegionMinLoc, getRegionStdev, getRegionStdev, getRoi, getRow, getStringWidth, getWidth, highPassFilter, ImageMult, insert, invertLut, isInvertedLut, isKillable, lineTo, moveTo, printRegion, putColumn, putRow, resetThreshold, rotateLeft, rotateRight, setCalibrationTable, setColor, setColorModel, setFont, setHistogramSize, setInterpolate, setLineWidth, setLutAnimation, setMask, setProgressBar, setRoi, setRoi, sharpen, smooth, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ShortProcessor

public ShortProcessor(int width,
                      int height,
                      short[] pixels,
                      java.awt.image.ColorModel cm)
Creates a new ShortProcessor using the specified pixel array and ColorModel. Set 'cm' to null to use the default grayscale LUT.

ShortProcessor

public ShortProcessor(int width,
                      int height)
Creates a blank ShortProcessor using the default grayscale LUT that displays zero as black. Call invertLut() to display zero as white.

ShortProcessor

public ShortProcessor(int width,
                      int height,
                      short[] pixels,
                      java.awt.image.ColorModel cm,
                      boolean unsigned)
Obsolete. Images are always unsigned.

ShortProcessor

public ShortProcessor(int width,
                      int height,
                      boolean unsigned)
Obsolete. Images are always unsigned.
Method Detail

findMinAndMax

public void findMinAndMax()

createImage

public java.awt.Image createImage()
Create an 8-bit AWT image by scaling pixels in the range min-max to 0-255.
Overrides:
createImage in class ImageProcessor

createProcessor

public ImageProcessor createProcessor(int width,
                                      int height)
Returns a new, blank ShortProcessor with the specified width and height.
Overrides:
createProcessor in class ImageProcessor

snapshot

public void snapshot()
Description copied from class: ImageProcessor
Makes a copy of this image's pixel data.
Overrides:
snapshot in class ImageProcessor

reset

public void reset()
Description copied from class: ImageProcessor
Restores the pixel data from the snapshot (undo) buffer.
Overrides:
reset in class ImageProcessor

reset

public void reset(int[] mask)
Description copied from class: ImageProcessor
Restore pixels that are within roi but not part of the mask.
Overrides:
reset in class ImageProcessor

getMin

public double getMin()
Returns the smallest displayed pixel value.
Overrides:
getMin in class ImageProcessor

getMax

public double getMax()
Returns the largest displayed pixel value.
Overrides:
getMax in class ImageProcessor

setMinAndMax

public void setMinAndMax(double min,
                         double max)
Sets the min and max variables that control how real pixel values are mapped to 0-255 screen values.
Overrides:
setMinAndMax in class ImageProcessor
See Also:
resetMinAndMax, ContrastAdjuster

resetMinAndMax

public void resetMinAndMax()
Recalculates the min and max values used to scale pixel values to 0-255 for display. This ensures that this ShortProcessor is set up to correctly display the image.
Overrides:
resetMinAndMax in class ImageProcessor

getPixel

public int getPixel(int x,
                    int y)
Description copied from class: ImageProcessor
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.
Overrides:
getPixel in class ImageProcessor

getInterpolatedPixel

public double getInterpolatedPixel(double x,
                                   double y)
Uses bilinear interpolation to find the pixel value at real coordinates (x,y).
Overrides:
getInterpolatedPixel in class ImageProcessor

getInterpolatedValue

public double getInterpolatedValue(double x,
                                   double y)
Uses bilinear interpolation to find the calibrated pixel value at real coordinates (x,y).
Overrides:
getInterpolatedValue in class ImageProcessor

putPixel

public void putPixel(int x,
                     int y,
                     int value)
Stores the specified value at (x,y).
Overrides:
putPixel in class ImageProcessor

putPixelValue

public void putPixelValue(int x,
                          int y,
                          double value)
Stores the specified real value at (x,y).
Overrides:
putPixelValue in class ImageProcessor

drawPixel

public void drawPixel(int x,
                      int y)
Draws a pixel in the current foreground color.
Overrides:
drawPixel in class ImageProcessor

getPixelValue

public float getPixelValue(int x,
                           int y)
Description copied from class: ImageProcessor
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.
Overrides:
getPixelValue in class ImageProcessor

getPixels

public java.lang.Object getPixels()
Returns a reference to the short 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]&0xffff).
Overrides:
getPixels in class ImageProcessor

getPixelsCopy

public java.lang.Object getPixelsCopy()
Returns a reference to this image's snapshot (undo) array. If the snapshot array is null, returns a copy of the pixel data.
Overrides:
getPixelsCopy in class ImageProcessor

setPixels

public void setPixels(java.lang.Object pixels)
Description copied from class: ImageProcessor
Sets a new pixel array for the image and resets the snapshot buffer. The length of the array must be equal to width*height.
Overrides:
setPixels in class ImageProcessor

copyBits

public 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.
Overrides:
copyBits in class ImageProcessor

applyTable

public void applyTable(int[] lut)
Transforms the pixel data using a 65536 entry lookup table.
Overrides:
applyTable in class ImageProcessor

invert

public void invert()
Description copied from class: ImageProcessor
Inverts the image or ROI.
Overrides:
invert in class ImageProcessor

add

public void add(int value)
Description copied from class: ImageProcessor
Adds 'value' to each pixel in the image or ROI.
Overrides:
add in class ImageProcessor

add

public void add(double value)
Description copied from class: ImageProcessor
Adds 'value' to each pixel in the image or ROI.
Overrides:
add in class ImageProcessor

multiply

public void multiply(double value)
Description copied from class: ImageProcessor
Multiplies each pixel in the image or ROI by 'value'.
Overrides:
multiply in class ImageProcessor

and

public void and(int value)
Description copied from class: ImageProcessor
Binary AND of each pixel in the image or ROI with 'value'.
Overrides:
and in class ImageProcessor

or

public void or(int value)
Description copied from class: ImageProcessor
Binary OR of each pixel in the image or ROI with 'value'.
Overrides:
or in class ImageProcessor

xor

public void xor(int value)
Description copied from class: ImageProcessor
Binary exclusive OR of each pixel in the image or ROI with 'value'.
Overrides:
xor in class ImageProcessor

gamma

public void gamma(double value)
Description copied from class: ImageProcessor
Performs gamma correction of the image or ROI.
Overrides:
gamma in class ImageProcessor

log

public void log()
Description copied from class: ImageProcessor
Performs a log transform on the image or ROI.
Overrides:
log in class ImageProcessor

sqr

public void sqr()
Description copied from class: ImageProcessor
Performs a square transform on the image or ROI.
Overrides:
sqr in class ImageProcessor

sqrt

public void sqrt()
Description copied from class: ImageProcessor
Performs a square root transform on the image or ROI.
Overrides:
sqrt in class ImageProcessor

min

public void min(double value)
Description copied from class: ImageProcessor
Pixels less than 'value' are set to 'value'.
Overrides:
min in class ImageProcessor

max

public void max(double value)
Description copied from class: ImageProcessor
Pixels greater than 'value' are set to 'value'.
Overrides:
max in class ImageProcessor

fill

public void fill()
Fills the current rectangular ROI.
Overrides:
fill in class ImageProcessor

fill

public void fill(int[] mask)
Fills pixels that are within roi and part of the mask. Throws an IllegalArgumentException if the mask is null or the size of the mask is not the same as the size of the ROI.
Overrides:
fill in class ImageProcessor

convolve3x3

public void convolve3x3(int[] kernel)
3x3 convolution contributed by Glynne Casteel.
Overrides:
convolve3x3 in class ImageProcessor

filter

public void filter(int type)
Filters using a 3x3 neighborhood.
Overrides:
filter in class ImageProcessor

rotate

public void rotate(double angle)
Rotates the image or ROI 'angle' degrees clockwise.
Overrides:
rotate in class ImageProcessor
See Also:
ImageProcessor.setInterpolate(boolean)

flipVertical

public void flipVertical()
Description copied from class: ImageProcessor
Flips the image or ROI vertically.
Overrides:
flipVertical in class ImageProcessor

scale

public void scale(double xScale,
                  double yScale)
Scales the image or selection using the specified scale factors.
Overrides:
scale in class ImageProcessor
See Also:
ImageProcessor.setInterpolate(boolean)

resize

public ImageProcessor resize(int dstWidth,
                             int dstHeight)
Creates a new ShortProcessor containing a scaled copy of this image or selection.
Overrides:
resize in class ImageProcessor
Following copied from class: ij.process.ImageProcessor
See Also:
ImageProcessor.setInterpolate(boolean)

crop

public ImageProcessor crop()
Description copied from class: ImageProcessor
Creates a new processor containing an image that corresponds to the current ROI.
Overrides:
crop in class ImageProcessor

setColor

public void setColor(java.awt.Color color)
Sets the foreground fill/draw color.
Overrides:
setColor in class ImageProcessor

setValue

public void setValue(double value)
Sets the default fill/draw value, where 0<=value<=65535).
Overrides:
setValue in class ImageProcessor

getHistogram

public int[] getHistogram()
Returns 65536 bin histogram of the current ROI, which can be non-rectangular.
Overrides:
getHistogram in class ImageProcessor

setThreshold

public void setThreshold(double minThreshold,
                         double maxThreshold,
                         int lutUpdate)
Description copied from class: ImageProcessor
Sets the lower and upper threshold levels. If 'lutUdate' is true, recalculates the LUT. Thresholding of RGB images is not supported.
Overrides:
setThreshold in class ImageProcessor

noise

public void noise(double range)
Description copied from class: ImageProcessor
Adds random noise to the image or ROI.
Overrides:
noise in class ImageProcessor
Following copied from class: ij.process.ImageProcessor
Parameters:
range - the range of random numbers

threshold

public void threshold(int level)

autoThreshold

public void autoThreshold()
Description copied from class: ImageProcessor
For byte images, converts to binary using an automatically determined threshold. For RGB images, converts each channel to binary. For short and float images, does nothing.
Overrides:
autoThreshold in class ImageProcessor

medianFilter

public void medianFilter()
Description copied from class: ImageProcessor
A 3x3 median filter.
Overrides:
medianFilter in class ImageProcessor

erode

public void erode()
Description copied from class: ImageProcessor
Erodes the image or ROI using a 3x3 maximum filter.
Overrides:
erode in class ImageProcessor

dilate

public void dilate()
Description copied from class: ImageProcessor
Dilates the image or ROI using a 3x3 minimum filter.
Overrides:
dilate in class ImageProcessor

Gradient2D

public void Gradient2D()
Overrides:
Gradient2D in class ImageProcessor

Gradient2DOut

public void Gradient2DOut(int refX,
                          int refY)
Description copied from class: ImageProcessor
computes outward gradient from center of ROI
Overrides:
Gradient2DOut in class ImageProcessor

Gradient2DIn

public void Gradient2DIn(int refX,
                         int refY)
Description copied from class: ImageProcessor
computes inward gradient toward center of ROI
Overrides:
Gradient2DIn in class ImageProcessor

reWindowImage

public void reWindowImage()

convolve

public void convolve(float[][] kernel,
                     int kw,
                     int kh)
Overrides:
convolve in class ImageProcessor