edu.stanford.rsl.konrad.io
Class SerializableFloatProcessor

java.lang.Object
  extended by ij.process.ImageProcessor
      extended by edu.stanford.rsl.konrad.io.SerializableFloatProcessor
All Implemented Interfaces:
java.io.Serializable

public class SerializableFloatProcessor
extends ij.process.ImageProcessor
implements java.io.Serializable

See Also:
Serialized Form

Field Summary
 
Fields inherited from class ij.process.ImageProcessor
BICUBIC, BILINEAR, BLACK, BLACK_AND_WHITE_LUT, CENTER_JUSTIFY, ISODATA, ISODATA2, LEFT_JUSTIFY, NEAREST_NEIGHBOR, NO_LUT_UPDATE, NO_THRESHOLD, NONE, OVER_UNDER_LUT, RED_LUT, RIGHT_JUSTIFY
 
Constructor Summary
SerializableFloatProcessor(float[][] array)
          Creates a FloatProcessor from a 2D float array using the default LUT.
SerializableFloatProcessor(ij.process.FloatProcessor floatProcessor)
          Creates a new FloatProcessor using the specified FloatProcessor.
SerializableFloatProcessor(ij.process.ImageProcessor imageProcessor)
          Creates a new FloatProcessor using the specified ImageProcessor.
SerializableFloatProcessor(int[][] array)
          Creates a FloatProcessor from an int[][] array.
SerializableFloatProcessor(int width, int height)
          Creates a blank FloatProcessor using the default grayscale LUT that displays zero as black.
SerializableFloatProcessor(int width, int height, double[] pixels)
          Creates a FloatProcessor from a double array using the default grayscale LUT.
SerializableFloatProcessor(int width, int height, float[] pixels, java.awt.image.ColorModel cm)
          Creates a new FloatProcessor using the specified pixel array and ColorModel.
SerializableFloatProcessor(int width, int height, int[] pixels)
          Creates a FloatProcessor from an int array using the default grayscale LUT.
 
Method Summary
 void abs()
           
 void add(double value)
           
 void add(int value)
           
 void and(int value)
           
 void applyTable(int[] lut)
           
 void autoThreshold()
          Not implemented.
 void convolve(float[] kernel, int kernelWidth, int kernelHeight)
          Performs a convolution operation using the specified kernel.
 void convolve3x3(int[] kernel)
          Does 3x3 convolution.
 void copyBits(ij.process.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()
           
 SerializableFloatProcessor createProcessor(int width, int height)
          Returns a new, blank FloatProcessor with the specified width and height.
 ij.process.ImageProcessor crop()
           
 void dilate()
          Not implemented.
 void drawPixel(int x, int y)
          Draws a pixel in the current foreground color.
 SerializableFloatProcessor duplicate()
          Returns a duplicate of this image.
 void erode()
          Not implemented.
 void exp()
           
 void fill()
          Fills the current rectangular ROI.
 void fill(ij.process.ImageProcessor mask)
          Fills pixels that are within roi and part of the mask.
 void filter(int type)
          Filters using a 3x3 neighborhood.
 void findMinAndMax()
          Calculates the minimum and maximum pixel value for the entire image.
 void flipVertical()
           
 void gamma(double value)
           
 int get(int index)
           
 int get(int x, int y)
           
 double getBackgroundValue()
          Always returns 0.
 double getBicubicInterpolatedPixel(double x0, double y0, SerializableFloatProcessor ip2)
          This method is from Chapter 16 of "Digital Image Processing: An Algorithmic Introduction Using Java" by Burger and Burge (http://www.imagingbook.com/).
 java.awt.image.BufferedImage getBufferedImage()
          Returns this image as an 8-bit BufferedImage.
 float getf(int index)
           
 float getf(int x, int y)
           
 int getHeight()
           
 int[] getHistogram()
          Not implemented.
 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 a pixel value that must be converted using Float.intBitsToFloat().
 int[] getPixel(int x, int y, int[] iArray)
          Returns the value of the pixel at (x,y) in a one element int array.
 int getPixelInterpolated(double x, double y)
           
 java.lang.Object getPixels()
          Returns a reference to the float 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) as a float.
 java.lang.Object getSnapshotPixels()
           
 int getWidth()
           
 void invert()
           
 void log()
           
 void max(double value)
           
 double maxValue()
          Returns the largest possible positive finite pixel value.
 void medianFilter()
          Not implemented.
 void min(double value)
           
 double minValue()
          Returns the smallest possible positive nonzero pixel value.
 void multiply(double value)
           
 void noise(double range)
           
 void or(int value)
           
 void putPixel(int x, int y, int value)
          Stores the specified value at (x,y).
 void putPixel(int x, int y, int[] iArray)
          Sets a pixel in the image using a one element int array.
 void putPixelValue(int x, int y, double value)
          Stores the specified real value at (x,y).
 void reset()
           
 void reset(ij.process.ImageProcessor mask)
           
 void resetMinAndMax()
          Recalculates the min and max values used to scale pixel values to 0-255 for display.
 ij.process.ImageProcessor resize(int dstWidth, int dstHeight)
          Creates a new FloatProcessor 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)
           
 void setBackgroundValue(double value)
          Does nothing.
 void setColor(java.awt.Color color)
          Sets the foreground fill/draw color.
 void setf(int index, float value)
           
 void setf(int x, int y, float value)
           
 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(int channelNumber, ij.process.FloatProcessor fp)
          Sets the pixels, and min&max values from a FloatProcessor.
 void setPixels(java.lang.Object pixels)
           
 void setSnapshotPixels(java.lang.Object pixels)
           
 void setThreshold(double minThreshold, double maxThreshold, int lutUpdate)
           
 void setValue(double value)
          Sets the default fill/draw value.
 void snapshot()
           
 void sqr()
           
 void sqrt()
           
 void threshold(int level)
          Not implemented.
 ij.process.FloatProcessor toFloat(int channelNumber, ij.process.FloatProcessor fp)
          Returns this FloatProcessor.
 ij.process.FloatProcessor toFloat(SerializableFloatProcessor fp)
          Returns this FloatProcessor.
 void xor(int value)
           
 
Methods inherited from class ij.process.ImageProcessor
convertToByte, convertToFloat, convertToRGB, convertToShort, draw, drawDot, drawDot2, drawLine, drawOval, drawPolygon, drawRect, drawString, drawString, fill, fillOutside, fillOval, fillPolygon, findEdges, flipHorizontal, getAutoThreshold, getAutoThreshold, getBestIndex, getBicubicInterpolatedPixel, getCalibrationTable, getColorModel, getColumn, getCurrentColorModel, getDefaultColorModel, getFloatArray, getFont, getFontMetrics, getHistogramMax, getHistogramMin, getHistogramSize, getIntArray, getInterpolate, getInterpolatedValue, getInterpolationMethods, getLine, getLineWidth, getLutUpdateMode, getMask, getMaskArray, getMaxThreshold, getMinThreshold, getNChannels, getNeighborhood, getPixelCount, getRoi, getRow, getSliceNumber, getStatistics, getStringWidth, insert, invertLut, isBinary, isColorLut, isDefaultLut, isInvertedLut, isKillable, isPseudoColorLut, lineTo, moveTo, putColumn, putRow, resetBinaryThreshold, resetRoi, resetThreshold, resize, rotateLeft, rotateRight, setAntialiasedText, setAutoThreshold, setAutoThreshold, setAutoThreshold, setAutoThreshold, setAutoThreshold, setBinaryThreshold, setCalibrationTable, setClipRect, setColor, setColorModel, setFloatArray, setFont, setHistogramRange, setHistogramSize, setIntArray, setInterpolate, setInterpolationMethod, setJustification, setLineWidth, setLutAnimation, setMask, setOverColor, setProgressBar, setRoi, setRoi, setRoi, setRoi, setSliceNumber, setSnapshotCopyMode, setUnderColor, setUseBicubic, sharpen, smooth, toString, translate, translate, updateComposite
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SerializableFloatProcessor

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


SerializableFloatProcessor

public SerializableFloatProcessor(ij.process.FloatProcessor floatProcessor)
Creates a new FloatProcessor using the specified FloatProcessor. Set 'cm' to null to use the default grayscale LUT.


SerializableFloatProcessor

public SerializableFloatProcessor(ij.process.ImageProcessor imageProcessor)
Creates a new FloatProcessor using the specified ImageProcessor. Set 'cm' to null to use the default grayscale LUT.


SerializableFloatProcessor

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


SerializableFloatProcessor

public SerializableFloatProcessor(int width,
                                  int height,
                                  int[] pixels)
Creates a FloatProcessor from an int array using the default grayscale LUT.


SerializableFloatProcessor

public SerializableFloatProcessor(int width,
                                  int height,
                                  double[] pixels)
Creates a FloatProcessor from a double array using the default grayscale LUT.


SerializableFloatProcessor

public SerializableFloatProcessor(float[][] array)
Creates a FloatProcessor from a 2D float array using the default LUT.


SerializableFloatProcessor

public SerializableFloatProcessor(int[][] array)
Creates a FloatProcessor from an int[][] array.

Method Detail

findMinAndMax

public void findMinAndMax()
Calculates the minimum and maximum pixel value for the entire image. Returns without doing anything if fixedScale has been set true as a result of calling setMinAndMax(). In this case, getMin() and getMax() return the fixed min and max defined by setMinAndMax(), rather than the calculated min and max.

See Also:
getMin(), getMin()

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. Use resetMinAndMax() to enable auto-scaling;

Specified by:
setMinAndMax in class ij.process.ImageProcessor

resetMinAndMax

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

Overrides:
resetMinAndMax in class ij.process.ImageProcessor

getMin

public double getMin()
Returns the smallest displayed pixel value.

Specified by:
getMin in class ij.process.ImageProcessor

getMax

public double getMax()
Returns the largest displayed pixel value.

Specified by:
getMax in class ij.process.ImageProcessor

createImage

public java.awt.Image createImage()
Specified by:
createImage in class ij.process.ImageProcessor

getBufferedImage

public java.awt.image.BufferedImage getBufferedImage()
Returns this image as an 8-bit BufferedImage.

Overrides:
getBufferedImage in class ij.process.ImageProcessor

createProcessor

public SerializableFloatProcessor createProcessor(int width,
                                                  int height)
Returns a new, blank FloatProcessor with the specified width and height.

Specified by:
createProcessor in class ij.process.ImageProcessor

snapshot

public void snapshot()
Specified by:
snapshot in class ij.process.ImageProcessor

reset

public void reset()
Specified by:
reset in class ij.process.ImageProcessor

reset

public void reset(ij.process.ImageProcessor mask)
Specified by:
reset in class ij.process.ImageProcessor

setSnapshotPixels

public void setSnapshotPixels(java.lang.Object pixels)
Specified by:
setSnapshotPixels in class ij.process.ImageProcessor

getSnapshotPixels

public java.lang.Object getSnapshotPixels()
Specified by:
getSnapshotPixels in class ij.process.ImageProcessor

getPixel

public int getPixel(int x,
                    int y)
Returns a pixel value that must be converted using Float.intBitsToFloat().

Specified by:
getPixel in class ij.process.ImageProcessor

get

public final int get(int x,
                     int y)
Specified by:
get in class ij.process.ImageProcessor

set

public final void set(int x,
                      int y,
                      int value)
Specified by:
set in class ij.process.ImageProcessor

get

public final int get(int index)
Specified by:
get in class ij.process.ImageProcessor

set

public final void set(int index,
                      int value)
Specified by:
set in class ij.process.ImageProcessor

getf

public final float getf(int x,
                        int y)
Specified by:
getf in class ij.process.ImageProcessor

setf

public final void setf(int x,
                       int y,
                       float value)
Specified by:
setf in class ij.process.ImageProcessor

getf

public final float getf(int index)
Specified by:
getf in class ij.process.ImageProcessor

setf

public final void setf(int index,
                       float value)
Specified by:
setf in class ij.process.ImageProcessor

getPixel

public int[] getPixel(int x,
                      int y,
                      int[] iArray)
Returns the value of the pixel at (x,y) in a one element int array. iArray is an optiona preallocated array.

Overrides:
getPixel in class ij.process.ImageProcessor

putPixel

public final void putPixel(int x,
                           int y,
                           int[] iArray)
Sets a pixel in the image using a one element int array.

Overrides:
putPixel in class ij.process.ImageProcessor

getInterpolatedPixel

public double getInterpolatedPixel(double x,
                                   double y)
Uses the current interpolation method (BILINEAR or BICUBIC) to calculate the pixel value at real coordinates (x,y).

Specified by:
getInterpolatedPixel in class ij.process.ImageProcessor

getPixelInterpolated

public final int getPixelInterpolated(double x,
                                      double y)
Specified by:
getPixelInterpolated in class ij.process.ImageProcessor

putPixel

public final void putPixel(int x,
                           int y,
                           int value)
Stores the specified value at (x,y). The value is expected to be a float that has been converted to an int using Float.floatToIntBits().

Specified by:
putPixel in class ij.process.ImageProcessor

putPixelValue

public void putPixelValue(int x,
                          int y,
                          double value)
Stores the specified real value at (x,y).

Specified by:
putPixelValue in class ij.process.ImageProcessor

getPixelValue

public float getPixelValue(int x,
                           int y)
Returns the value of the pixel at (x,y) as a float.

Specified by:
getPixelValue in class ij.process.ImageProcessor

drawPixel

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

Specified by:
drawPixel in class ij.process.ImageProcessor

getPixels

public java.lang.Object getPixels()
Returns a reference to the float array containing this image's pixel data.

Specified by:
getPixels in class ij.process.ImageProcessor

getPixelsCopy

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

Specified by:
getPixelsCopy in class ij.process.ImageProcessor
See Also:
ImageProcessor.snapshot(), ImageProcessor.setSnapshotCopyMode(boolean)

setPixels

public void setPixels(java.lang.Object pixels)
Specified by:
setPixels in class ij.process.ImageProcessor

copyBits

public void copyBits(ij.process.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.

Specified by:
copyBits in class ij.process.ImageProcessor

applyTable

public void applyTable(int[] lut)
Specified by:
applyTable in class ij.process.ImageProcessor

invert

public void invert()
Overrides:
invert in class ij.process.ImageProcessor

add

public void add(int value)
Overrides:
add in class ij.process.ImageProcessor

add

public void add(double value)
Overrides:
add in class ij.process.ImageProcessor

multiply

public void multiply(double value)
Overrides:
multiply in class ij.process.ImageProcessor

and

public void and(int value)
Overrides:
and in class ij.process.ImageProcessor

or

public void or(int value)
Overrides:
or in class ij.process.ImageProcessor

xor

public void xor(int value)
Overrides:
xor in class ij.process.ImageProcessor

gamma

public void gamma(double value)
Overrides:
gamma in class ij.process.ImageProcessor

log

public void log()
Overrides:
log in class ij.process.ImageProcessor

exp

public void exp()
Overrides:
exp in class ij.process.ImageProcessor

sqr

public void sqr()
Overrides:
sqr in class ij.process.ImageProcessor

sqrt

public void sqrt()
Overrides:
sqrt in class ij.process.ImageProcessor

abs

public void abs()
Overrides:
abs in class ij.process.ImageProcessor

min

public void min(double value)
Overrides:
min in class ij.process.ImageProcessor

max

public void max(double value)
Overrides:
max in class ij.process.ImageProcessor

fill

public void fill()
Fills the current rectangular ROI.

Overrides:
fill in class ij.process.ImageProcessor

fill

public void fill(ij.process.ImageProcessor mask)
Fills pixels that are within roi and part of the mask. Does nothing if the mask is not the same as the the ROI.

Specified by:
fill in class ij.process.ImageProcessor

convolve3x3

public void convolve3x3(int[] kernel)
Does 3x3 convolution.

Specified by:
convolve3x3 in class ij.process.ImageProcessor

filter

public void filter(int type)
Filters using a 3x3 neighborhood.

Specified by:
filter in class ij.process.ImageProcessor

rotate

public void rotate(double angle)
Rotates the image or ROI 'angle' degrees clockwise.

Specified by:
rotate in class ij.process.ImageProcessor
See Also:
ImageProcessor.setInterpolate(boolean)

flipVertical

public void flipVertical()
Specified by:
flipVertical in class ij.process.ImageProcessor

noise

public void noise(double range)
Specified by:
noise in class ij.process.ImageProcessor

crop

public ij.process.ImageProcessor crop()
Specified by:
crop in class ij.process.ImageProcessor

duplicate

public SerializableFloatProcessor duplicate()
Returns a duplicate of this image.

Specified by:
duplicate in class ij.process.ImageProcessor

scale

public void scale(double xScale,
                  double yScale)
Scales the image or selection using the specified scale factors.

Specified by:
scale in class ij.process.ImageProcessor
See Also:
ImageProcessor.setInterpolate(boolean)

resize

public ij.process.ImageProcessor resize(int dstWidth,
                                        int dstHeight)
Creates a new FloatProcessor containing a scaled copy of this image or selection.

Specified by:
resize in class ij.process.ImageProcessor

getBicubicInterpolatedPixel

public double getBicubicInterpolatedPixel(double x0,
                                          double y0,
                                          SerializableFloatProcessor ip2)
This method is from Chapter 16 of "Digital Image Processing: An Algorithmic Introduction Using Java" by Burger and Burge (http://www.imagingbook.com/).


setColor

public void setColor(java.awt.Color color)
Sets the foreground fill/draw color.

Specified by:
setColor in class ij.process.ImageProcessor

setValue

public void setValue(double value)
Sets the default fill/draw value.

Specified by:
setValue in class ij.process.ImageProcessor

setBackgroundValue

public void setBackgroundValue(double value)
Does nothing. The rotate() and scale() methods always zero fill.

Specified by:
setBackgroundValue in class ij.process.ImageProcessor

getBackgroundValue

public double getBackgroundValue()
Always returns 0.

Specified by:
getBackgroundValue in class ij.process.ImageProcessor

setThreshold

public void setThreshold(double minThreshold,
                         double maxThreshold,
                         int lutUpdate)
Overrides:
setThreshold in class ij.process.ImageProcessor

convolve

public void convolve(float[] kernel,
                     int kernelWidth,
                     int kernelHeight)
Performs a convolution operation using the specified kernel.

Specified by:
convolve in class ij.process.ImageProcessor

threshold

public void threshold(int level)
Not implemented.

Specified by:
threshold in class ij.process.ImageProcessor

autoThreshold

public void autoThreshold()
Not implemented.

Overrides:
autoThreshold in class ij.process.ImageProcessor

medianFilter

public void medianFilter()
Not implemented.

Specified by:
medianFilter in class ij.process.ImageProcessor

getHistogram

public int[] getHistogram()
Not implemented.

Specified by:
getHistogram in class ij.process.ImageProcessor

erode

public void erode()
Not implemented.

Specified by:
erode in class ij.process.ImageProcessor

dilate

public void dilate()
Not implemented.

Specified by:
dilate in class ij.process.ImageProcessor

toFloat

public ij.process.FloatProcessor toFloat(int channelNumber,
                                         ij.process.FloatProcessor fp)
Returns this FloatProcessor.

Specified by:
toFloat in class ij.process.ImageProcessor
Parameters:
channelNumber - Ignored (needed for compatibility with ColorProcessor.toFloat)
fp - Ignored (needed for compatibility with the other ImageProcessor types).
Returns:
This FloatProcessor

toFloat

public ij.process.FloatProcessor toFloat(SerializableFloatProcessor fp)
Returns this FloatProcessor.

Parameters:
fp - Ignored (needed for compatibility with the other ImageProcessor types).
Returns:
This FloatProcessor

setPixels

public void setPixels(int channelNumber,
                      ij.process.FloatProcessor fp)
Sets the pixels, and min&max values from a FloatProcessor. Also the values are taken from the FloatProcessor.

Specified by:
setPixels in class ij.process.ImageProcessor
Parameters:
channelNumber - Ignored (needed for compatibility with ColorProcessor.toFloat)
fp - The FloatProcessor where the image data are read from.

minValue

public double minValue()
Returns the smallest possible positive nonzero pixel value.

Overrides:
minValue in class ij.process.ImageProcessor

maxValue

public double maxValue()
Returns the largest possible positive finite pixel value.

Overrides:
maxValue in class ij.process.ImageProcessor

getWidth

public int getWidth()
Overrides:
getWidth in class ij.process.ImageProcessor

getHeight

public int getHeight()
Overrides:
getHeight in class ij.process.ImageProcessor