uk.ac.ed.ph.signal
Class ColourScale

java.lang.Object
  extended by java.awt.color.ColorSpace
      extended by uk.ac.ed.ph.signal.ColourScale
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
GammaGreyScale, LinearGreyScale

public class ColourScale
extends ColorSpace

Class to implement a ColorSpace for direct display of Float/Double images.

See Also:
Serialized Form

Field Summary
protected  double gamma
          Gamma correction value
protected  double lowerLimit
          Lowest pixel limit
protected static float MAX_VALUE
           
protected static float MIN_VALUE
           
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
 
Method Summary
 float[] fromCIEXYZ(float[] rgb)
           
 float[] fromRGB(float[] rgb)
          Implements fromfromRGB (not used)
 double getGamma()
          Meth ot oget the current gamma
 double getLowerLimit()
          Method to get the lower limit
 double getUpperLimit()
          Method to get the upper limit
protected  float scaledPixelValue(float value)
          Method to for the scaled pixel value in the range 0 - > 1.0 wrt to the current lower and upper limits.
 void setDisplayRange(double a, double b)
          Method to set the display range
 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)
          Metho to set the upper limit, (lower will remain unhanged)
 float[] toCIEXYZ(float[] values)
          Implement fromMIEXYZ 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
See Also:
Constant Field Values

MAX_VALUE

protected static final float MAX_VALUE
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

Method Detail

toCIEXYZ

public float[] toCIEXYZ(float[] values)
Implement fromMIEXYZ conversion (not used)

Specified by:
toCIEXYZ in class ColorSpace

fromCIEXYZ

public float[] fromCIEXYZ(float[] rgb)
Specified by:
fromCIEXYZ in class ColorSpace

toRGB

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

Specified by:
toRGB in class 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 ColorSpace

toRGB

public float[] toRGB(float value)
Return the rgb value for a single input pixel value.

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

setDisplayRange

public void setDisplayRange(double a,
                            double b)
Method to set the display range


getLowerLimit

public double getLowerLimit()
Method to get the lower limit


getUpperLimit

public double getUpperLimit()
Method to get the upper limit


setLowerLimit

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

Parameters:
min - the lower limit

setUpperLimit

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


setGamma

public void setGamma(double g)
Method to set gamma

Parameters:
g - the gamma factor

getGamma

public double getGamma()
Meth ot oget 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 for the scaled pixel value in the range 0 - > 1.0 wrt to the current lower and upper limits.