FloatProcessor
ij.process

Class FloatProcessor

  • All Implemented Interfaces:
    Cloneable
    Direct Known Subclasses:
    FHT


    public class FloatProcessorextends ImageProcessor
    This is an 32-bit floating-point image and methods that operate on that image.
    • Constructor Detail

      • FloatProcessor

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

        public FloatProcessor(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.
      • FloatProcessor

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

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

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

        public FloatProcessor(int[][] array)
        Creates a FloatProcessor from a 2D 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 minimum,                double maximum)
        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 ImageProcessor
        See Also:
        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 FloatProcessor is set up to correctly display the image.
        Overrides:
        resetMinAndMax in class ImageProcessor
      • getMin

        public double getMin()
        Returns the smallest displayed pixel value.
        Specified by:
        getMin in class ImageProcessor
      • getMax

        public double getMax()
        Returns the largest displayed pixel value.
        Specified by:
        getMax in class ImageProcessor
      • reset

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

        public void reset(ImageProcessor mask)
        Description copied from class: ImageProcessor
        Restores pixels from the snapshot buffer that are within the rectangular roi but not part of the mask.
        Specified by:
        reset in class 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 ImageProcessor
      • get

        public final int get(int x,      int y)
        Description copied from class: ImageProcessor
        This is a faster version of getPixel() that does not do bounds checking.
        Specified by:
        get in class ImageProcessor
      • set

        public final void set(int x,       int y,       int value)
        Description copied from class: ImageProcessor
        This is a faster version of putPixel() that does not clip out of range values and does not do bounds checking.
        Specified by:
        set in class ImageProcessor
      • set

        public final void set(int index,       int value)
        Specified by:
        set in class ImageProcessor
      • setf

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

        public final void setf(int index,        float value)
        Specified by:
        setf in class 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 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 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 ImageProcessor
      • getPixelInterpolated

        public final int getPixelInterpolated(double x,                       double y)
        Description copied from class: ImageProcessor
        Uses the current interpolation method to find the pixel value at real coordinates (x,y). For RGB images, the argb values are packed in an int. For float images, the value must be converted using Float.intBitsToFloat(). Returns zero if the (x, y) is not inside the image.
        Specified by:
        getPixelInterpolated in class 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 ImageProcessor
      • putPixelValue

        public void putPixelValue(int x,                 int y,                 double value)
        Stores the specified real value at (x,y).
        Specified by:
        putPixelValue in class 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 ImageProcessor
      • drawPixel

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

        public Object getPixels()
        Returns a reference to the float array containing this image's pixel data.
        Specified by:
        getPixels in class ImageProcessor
      • setPixels

        public void setPixels(Object pixels)
        Description copied from class: ImageProcessor
        Sets a new pixel array for the image. The length of the array must be equal to width*height. Use setSnapshotPixels(null) to clear the snapshot buffer.
        Specified by:
        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.
        Specified by:
        copyBits in class ImageProcessor
      • applyTable

        public void applyTable(int[] lut)
        Description copied from class: ImageProcessor
        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.
        Specified by:
        applyTable 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
      • exp

        public void exp()
        Description copied from class: ImageProcessor
        Performs a exponential transform on the image or ROI.
        Overrides:
        exp 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
      • abs

        public void abs()
        Description copied from class: ImageProcessor
        If this is a 32-bit or signed 16-bit image, performs an absolute value transform, otherwise does nothing.
        Overrides:
        abs 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
      • filter

        public void filter(int type)
        Filters using a 3x3 neighborhood.
        Specified by:
        filter in class ImageProcessor
      • noise

        public void noise(double range)
        Description copied from class: ImageProcessor
        Adds random noise to the image or ROI.
        Specified by:
        noise in class ImageProcessor
        Parameters:
        range - the range of random numbers
      • getBicubicInterpolatedPixel

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

        public void setValue(double value)
        Sets the default fill/draw value.
        Specified by:
        setValue in class ImageProcessor
      • setBackgroundValue

        public void setBackgroundValue(double value)
        Does nothing. The rotate() and scale() methods always zero fill.
        Specified by:
        setBackgroundValue 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. The 'lutUpdate' argument can be RED_LUT, BLACK_AND_WHITE_LUT, OVER_UNDER_LUT or NO_LUT_UPDATE. Thresholding of RGB images is not supported.
        Overrides:
        setThreshold in class ImageProcessor
      • convolve

        public void convolve(float[] kernel,            int kernelWidth,            int kernelHeight)
        Performs a convolution operation using the specified kernel.
        Specified by:
        convolve in class ImageProcessor
      • toFloat

        public FloatProcessor toFloat(int channelNumber,                     FloatProcessor fp)
        Returns this FloatProcessor.
        Specified by:
        toFloat in class ImageProcessor
        Parameters:
        channelNumber - Ignored (needed for compatibility with ColorProcessor.toFloat)
        fp - Ignored (needed for compatibility with the other ImageProcessor types).
        Returns:
        This FloatProcessor
      • setPixels

        public void setPixels(int channelNumber,             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 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 ImageProcessor
      • maxValue

        public double maxValue()
        Returns the largest possible positive finite pixel value.
        Overrides:
        maxValue in class ImageProcessor

SCaVis 2.1 © jWork.ORG