Class ContourPlot.Pixel

java.lang.Object
gov.nih.mipav.model.algorithms.ContourPlot.Pixel
All Implemented Interfaces:
ContourPlot.PixelBase
Enclosing class:
ContourPlot

public class ContourPlot.Pixel extends Object implements ContourPlot.PixelBase
Pixel class for retrieving a value from an ContourPlot.Img. A Pixel object stores a position and can be used to get and set values of an Img. It is NOT the value and changing its position will not change the image, instead it will reference a different value of the image as the pixel object is a pointer to a value in the Img's data array.

The Pixel class also provides a set of static methods for color decomposition and recombination from color channels like argb(int, int, int, int) or a(int), r(int), g(int), b(int).

Since:
1.0
Author:
hageldave
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final ContourPlot.Img
    Img this pixel belongs to
    private int
    index of the value this pixel references
  • Constructor Summary

    Constructors
    Constructor
    Description
    Pixel(ContourPlot.Img img, int index)
    Creates a new Pixel object referencing the value of specified Img at specified index.
    Pixel(ContourPlot.Img img, int x, int y)
    Creates a new Pixel object referencing the value of specified Img at specified position.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    a()
     
    final int
    a(int color)
     
    double
    Returns the alpha value of this pixel at its current position.
    final double
    a_normalized(int color)
     
    final int
    argb(int a, int r, int g, int b)
    Packs 8bit ARGB color components into a single 32bit integer value.
    final int
    argb_bounded(int a, int r, int g, int b)
    Packs 8bit ARGB color components into a single 32bit integer value.
    final int
    argb_fast(int a, int r, int g, int b)
    Packs 8bit ARGB color components into a single 32bit integer value.
    final int
    argb_fromNormalized(double a, double r, double g, double b)
    Packs normalized ARGB color components (values in [0.0 .. 1.0]) into a single 32bit integer value.
    int
    b()
     
    final int
    b(int color)
     
    double
    Returns the blue value of this pixel at its current position.
    final double
    b_normalized(int color)
     
    int
    g()
     
    final int
    g(int color)
     
    double
    Returns the green value of this pixel at its current position.
    final double
    g_normalized(int color)
     
    int
    getGrey(int redWeight, int greenWeight, int blueWeight)
    Calculates the grey value of this pixel using specified weights.
    final int
    getGrey(int color, int redWeight, int greenWeight, int blueWeight)
    Calculates a grey value from an RGB or ARGB value using specified weights for each R,G and B channel.
    int
    Returns this pixel's index.
    int
     
    final int
    getLuminance(int color)
     
    Returns the underlying image of this pixel (the image referenced by this pixel)
    int
    Gets the value of the Img at the position currently referenced by this Pixel.
    int
     
    int
     
    int
    r()
     
    final int
    r(int color)
     
    double
    Returns the red value of this pixel at its current position.
    final double
    r_normalized(int color)
     
    final int
    rgb(int r, int g, int b)
    Packs 8bit RGB color components into a single 32bit ARGB integer value with alpha=255 (opaque).
    final int
    rgb_bounded(int r, int g, int b)
    Packs 8bit RGB color components into a single 32bit ARGB integer value with alpha=255 (opaque).
    final int
    rgb_fast(int r, int g, int b)
    Packs 8bit RGB color components into a single 32bit ARGB integer value with alpha=255 (opaque).
    final int
    rgb_fromNormalized(double r, double g, double b)
    Packs normalized ARGB color components (values in [0.0 .. 1.0]) into a single 32bit integer value with alpha=255 (opaque).
    setA(int a)
    Sets alpha channel value of this Pixel.
    setA_fromDouble(double a)
    Sets the alpha value of this pixel at its current position with 0.0 as fully transparent and 1.0 as fully opaque.
    void
    setARGB(int a, int r, int g, int b)
    Sets an ARGB value at the position currently referenced by this Pixel.
    setARGB_fromDouble(double a, double r, double g, double b)
    Sets an ARGB value at the position currently referenced by this Pixel.
    setB(int b)
    Sets blue channel value of this Pixel.
    setB_fromDouble(double b)
    Sets the blue value of this pixel at its current position with 0.0 as no blue contribution and 1.0 as full blue contribution.
    setG(int g)
    Sets green channel value of this Pixel.
    setG_fromDouble(double g)
    Sets the green value of this pixel at its current position with 0.0 as no green contribution and 1.0 as full green contribution.
    setIndex(int index)
    Sets the index of the Img value this Pixel references.
    setPosition(int x, int y)
    Sets the position of the Img value this Pixel references.
    setR(int r)
    Sets red channel value of this Pixel.
    setR_fromDouble(double r)
    Sets the red value of this pixel at its current position with 0.0 as no red contribution and 1.0 as full red contribution.
    void
    setRGB(int r, int g, int b)
    Sets an opaque RGB value at the position currently referenced by this Pixel.
    setRGB_fromDouble(double r, double g, double b)
    Sets an opaque RGB value at the position currently referenced by this Pixel.
    setRGB_fromDouble_preserveAlpha(double r, double g, double b)
    Sets an RGB value at the position currently referenced by this Pixel.
    void
    setRGB_preserveAlpha(int r, int g, int b)
    Sets an RGB value at the position currently referenced by this Pixel.
    setValue(int pixelValue)
    Sets the value of the Img at the position currently referenced by this Pixel.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface gov.nih.mipav.model.algorithms.ContourPlot.PixelBase

    asString, getXnormalized, getYnormalized