optics.graphics
Class ColourScale

java.lang.Object
  extended by java.awt.color.ColorSpace
      extended by optics.graphics.ColourScale
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
GammaGreyScale, LinearGreyScale

public class ColourScale
extends java.awt.color.ColorSpace

Class to implement a ColorSpace for direct display of single plane Float/Double images using standard Java classes.

See Also:
Serialized Form

Field Summary
protected  double gamma
          Gamma correction value
protected  double lowerLimit
          Lowest pixel limit
protected static float MAX_VALUE
          Static final Max valie of 1.0
protected static float MIN_VALUE
          Static final Min Value of 0.0
protected  boolean reverse
          Constract reverse flag.
protected  double upperLimit
          Highest pixel limit
 
Fields inherited from class java.awt.color.ColorSpace
CS_CIEXYZ, CS_GRAY, CS_LINEAR_RGB, CS_PYCC, CS_sRGB, TYPE_2CLR, TYPE_3CLR, TYPE_4CLR, TYPE_5CLR, TYPE_6CLR, TYPE_7CLR, TYPE_8CLR, TYPE_9CLR, TYPE_ACLR, TYPE_BCLR, TYPE_CCLR, TYPE_CMY, TYPE_CMYK, TYPE_DCLR, TYPE_ECLR, TYPE_FCLR, TYPE_GRAY, TYPE_HLS, TYPE_HSV, TYPE_Lab, TYPE_Luv, TYPE_RGB, TYPE_XYZ, TYPE_YCbCr, TYPE_Yxy
 
Constructor Summary
ColourScale()
          Default consturctor needed to initialise underlying class.
 
Method Summary
 float[] fromCIEXYZ(float[] rgb)
          Required implementation of fromCIEXYZ conversion (not used)
 float[] fromRGB(float[] rgb)
          Implements fromfromRGB (not used)
 double getGamma()
          Method to get the current gamma
 double getLowerLimit()
          Method to get the current lower limit.
 double getUpperLimit()
          Method to get the current upper limit.
protected  float scaledPixelValue(float value)
          Method to form the scaled pixel value in the range MIN_VALUE - > MAX_VALUE wrt to the current lower and upper limits.
 void setGamma(double g)
          Method to set gamma
 void setLimits(double min, double max)
          Method to set the ranges.
 void setLowerLimit(double min)
          Method to set the lower limit (upper will remain unchanged)
 void setReverseContarst(boolean b)
          Meth ot set/unset reverse contarst, (defaults to false)
 void setUpperLimit(double max)
          Method to set the upper limit, (lower will remain unhanged)
 float[] toCIEXYZ(float[] values)
          Required implementation of fromCIEXYZ conversion (not used)
 float[] toRGB(float value)
          Return the rgb value for a single input pixel value.
 float[] toRGB(float[] values)
          Implement method from ColorSpace to give RGB values as floats.
 
Methods inherited from class java.awt.color.ColorSpace
getInstance, getMaxValue, getMinValue, getName, getNumComponents, getType, isCS_sRGB
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_VALUE

protected static final float MIN_VALUE
Static final Min Value of 0.0

See Also:
Constant Field Values

MAX_VALUE

protected static final float MAX_VALUE
Static final Max valie of 1.0

See Also:
Constant Field Values

lowerLimit

protected double lowerLimit
Lowest pixel limit


upperLimit

protected double upperLimit
Highest pixel limit


gamma

protected double gamma
Gamma correction value


reverse

protected boolean reverse
Constract reverse flag.

Constructor Detail

ColourScale

public ColourScale()
Default consturctor needed to initialise underlying class. (not normally called by users).

Method Detail

toCIEXYZ

public float[] toCIEXYZ(float[] values)
Required implementation of fromCIEXYZ conversion (not used)

Specified by:
toCIEXYZ in class java.awt.color.ColorSpace

fromCIEXYZ

public float[] fromCIEXYZ(float[] rgb)
Required implementation of fromCIEXYZ conversion (not used)

Specified by:
fromCIEXYZ in class java.awt.color.ColorSpace

toRGB

public float[] toRGB(float[] values)
Implement method from ColorSpace to give RGB values as floats.

Specified by:
toRGB in class java.awt.color.ColorSpace
Parameters:
values - array of input values, only [0] used
Returns:
float[] rgb values.

fromRGB

public float[] fromRGB(float[] rgb)
Implements fromfromRGB (not used)

Specified by:
fromRGB in class java.awt.color.ColorSpace

toRGB

public float[] toRGB(float value)
Return the rgb value for a single input pixel value. This method should be overoaded by the extending classes.

Parameters:
value - the pixel value
Returns:
float[] the rgb values.

setLimits

public void setLimits(double min,
                      double max)
Method to set the ranges.

Parameters:
min - the lower value
max - the upper value

getLowerLimit

public double getLowerLimit()
Method to get the current lower limit.

Returns:
double current lower limit.

getUpperLimit

public double getUpperLimit()
Method to get the current upper limit.

Returns:
double current upper limit.

setLowerLimit

public void setLowerLimit(double min)
Method to set the lower limit (upper will remain unchanged)

Parameters:
min - the new lower limit

setUpperLimit

public void setUpperLimit(double max)
Method to set the upper limit, (lower will remain unhanged)

Parameters:
max - the new upper limit

setGamma

public void setGamma(double g)
Method to set gamma

Parameters:
g - the gamma factor

getGamma

public double getGamma()
Method to get the current gamma


setReverseContarst

public void setReverseContarst(boolean b)
Meth ot set/unset reverse contarst, (defaults to false)


scaledPixelValue

protected float scaledPixelValue(float value)
Method to form the scaled pixel value in the range MIN_VALUE - > MAX_VALUE wrt to the current lower and upper limits.

Parameters:
value - the input pixel value.
Returns:
float scaled pixel value.