edu.ucla.loni.LOVE.colormap
Class ColorMap

java.lang.Object
  extended by edu.ucla.loni.LOVE.colormap.ColorMap
Direct Known Subclasses:
BlueColorMap, BoneColorMap, CoolColorMap, CopperColorMap, GEColorMap, GrayColorMap, GreenColorMap, HotColorMap, HotmetalColorMap, HSVColorMap, RedColorMap, SpecialSpectralColorMap, SpectralColorMap, ThreeColorMap

public abstract class ColorMap
extends java.lang.Object

Base class for colormap, also provides all constants for colormap. The ColorMap class is colormap for indexed gray image. Given bits used per pixel, and upper and lower limits. User can get an IndexColorModel by calling getColorModel() method. More advanced user can use getRedMap, getGreenMap, getBlueMap to get those arrays directly. "Under Color" The color for intensity less than lower limit. "Over Color" The color for intensity that is higher than upper limit. See the figure for a illustration of the concept.

 .                          Upper Limit
 .          ^
 .     255  |               |***********
 .          |              *
 .          |             *
 .          |            *
 .          |           *
 .          |          *
 .          |         *
 .       0  *********|------------------->
 .          0        Lower Limit        4095
 


Field Summary
protected  byte _alpha
          Alpha value for this colormap
protected  byte[] _aMap
          Map of alpha component
protected  int _bits
          Number of bits used for each pixel
protected  byte[] _bMap
          Map of blue color
protected  byte[] _gMap
          Map of green color
protected  boolean _isInverted
          Flag to indicate if this is a inverted colormap.
protected  int _lowerLimit
          lower limit, inclusive [lower, upper)
protected  java.awt.Color _overColor
          over color
protected  byte[] _rMap
          Map of red color
protected  int _size
          Total number of levels
protected  java.awt.Color _underColor
          under color
protected  int _upperLimit
          upper limit, exclusive [lower, upper)
static int BLUE
          Blue colormap
static int BONE
          Bone colormap
static int COOL
          Cool colormap
static int COPPER
          Copper colormap
static int FLAG
          Flag colormap
static int GRAY
          Gray colormap
static int GREEN
          Green colormap
static int HOT
          Hot colormap
static int HOTMETAL
          Hotmetal colormap
static int HSV
          HSV colormap
static int PINK
          Pink colormap
static int RED
          Red colormap
static int SPECIAL_SPECTRAL
          Special Spectral colormap
static int SPECTRAL
          Spectral colormap
 
Constructor Summary
ColorMap()
          Default constructor Required for plugin usage.
ColorMap(int size, int bits)
          Constructor
 
Method Summary
protected abstract  void _setColorMap()
          Actual set up of color map in range.
 byte getAlpha()
          Get the current alpha value
 byte[] getAlphaMap()
          Get alpha map
 byte[] getBlueMap()
          Get blue map
 java.awt.image.ColorModel getColorModel()
          Get a colormodel of this give colormap
 byte[] getGreenMap()
          Get green map
 boolean getInverted()
          iget the invert flag.
 int getLowerLimit()
          Gets the lower limit.
abstract  java.lang.String getName()
          Get the names of the actual color map
 java.awt.Color getOverColor()
          Get over color.
 byte[] getRedMap()
          Get red map
 int getSize()
          Get the size of the colormap.
 java.awt.Color getUnderColor()
          Get under color.
 int getUpperLimit()
          Gets the upper limit.
 void initializeColorMap(int size, int bits)
          Initialize this colormap.
 void invertColorMap()
           
 void setAlpha(byte alpha)
          Set the alpha value of this map
 void setInverted(boolean flag)
          set the invert flag.
 boolean setLimits(int lowerLimit, int upperLimit)
          Set the upper limit and lower limit of this colormap, Nothing will be changed if the input is invalid.
 boolean setLowerLimit(int lowerLimit)
          Set the lower limit.
 void setOverColor(java.awt.Color overColor)
          Set over color.
 void setUnderColor(java.awt.Color underColor)
          Set under color.
 boolean setUpperLimit(int upperLimit)
          Set the upper limit.
 java.lang.String toString()
          Get a String representation of the colormap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

GRAY

public static final int GRAY
Gray colormap

See Also:
Constant Field Values

HOTMETAL

public static final int HOTMETAL
Hotmetal colormap

See Also:
Constant Field Values

SPECTRAL

public static final int SPECTRAL
Spectral colormap

See Also:
Constant Field Values

RED

public static final int RED
Red colormap

See Also:
Constant Field Values

GREEN

public static final int GREEN
Green colormap

See Also:
Constant Field Values

BLUE

public static final int BLUE
Blue colormap

See Also:
Constant Field Values

BONE

public static final int BONE
Bone colormap

See Also:
Constant Field Values

COOL

public static final int COOL
Cool colormap

See Also:
Constant Field Values

COPPER

public static final int COPPER
Copper colormap

See Also:
Constant Field Values

FLAG

public static final int FLAG
Flag colormap

See Also:
Constant Field Values

HOT

public static final int HOT
Hot colormap

See Also:
Constant Field Values

HSV

public static final int HSV
HSV colormap

See Also:
Constant Field Values

PINK

public static final int PINK
Pink colormap

See Also:
Constant Field Values

SPECIAL_SPECTRAL

public static final int SPECIAL_SPECTRAL
Special Spectral colormap

See Also:
Constant Field Values

_underColor

protected java.awt.Color _underColor
under color


_overColor

protected java.awt.Color _overColor
over color


_rMap

protected byte[] _rMap
Map of red color


_gMap

protected byte[] _gMap
Map of green color


_bMap

protected byte[] _bMap
Map of blue color


_aMap

protected byte[] _aMap
Map of alpha component


_upperLimit

protected int _upperLimit
upper limit, exclusive [lower, upper)


_lowerLimit

protected int _lowerLimit
lower limit, inclusive [lower, upper)


_size

protected int _size
Total number of levels


_bits

protected int _bits
Number of bits used for each pixel


_alpha

protected byte _alpha
Alpha value for this colormap


_isInverted

protected boolean _isInverted
Flag to indicate if this is a inverted colormap.

Constructor Detail

ColorMap

public ColorMap()
Default constructor Required for plugin usage. If you call this constructor. Then you must call initializeColorMap(size, bits) immediately after constructor.


ColorMap

public ColorMap(int size,
                int bits)
Constructor

Method Detail

initializeColorMap

public void initializeColorMap(int size,
                               int bits)
Initialize this colormap. Only need to be called once.

Parameters:
size - Size of the colormap.
bits - Bits of each pixel.

getSize

public int getSize()
Get the size of the colormap.

Returns:
Size of this colormap

getUpperLimit

public int getUpperLimit()
Gets the upper limit.

Returns:
Upper limit of the colormap.

getLowerLimit

public int getLowerLimit()
Gets the lower limit.

Returns:
Lower limit of the colormap

getColorModel

public java.awt.image.ColorModel getColorModel()
Get a colormodel of this give colormap

Returns:
An IndexColorModel object of this colormap

getRedMap

public byte[] getRedMap()
Get red map

Returns:
Red component of this colormap.

getGreenMap

public byte[] getGreenMap()
Get green map

Returns:
Green component of this colormap.

getBlueMap

public byte[] getBlueMap()
Get blue map

Returns:
Blue component of this colormap.

getAlphaMap

public byte[] getAlphaMap()
Get alpha map

Returns:
Alpha component of this colormap.

setAlpha

public void setAlpha(byte alpha)
Set the alpha value of this map

Parameters:
alpha - alpha value

getAlpha

public byte getAlpha()
Get the current alpha value

Returns:
alpha value

getOverColor

public java.awt.Color getOverColor()
Get over color.

Returns:
over color

setOverColor

public void setOverColor(java.awt.Color overColor)
Set over color.

Parameters:
overColor - over color

getUnderColor

public java.awt.Color getUnderColor()
Get under color.

Returns:
under color

setUnderColor

public void setUnderColor(java.awt.Color underColor)
Set under color.

Parameters:
underColor - under color

setUpperLimit

public boolean setUpperLimit(int upperLimit)
Set the upper limit.

Parameters:
upperLimit -
Returns:
True if the limits are valid, false if not.

setLowerLimit

public boolean setLowerLimit(int lowerLimit)
Set the lower limit.

Parameters:
lowerLimit - Lower limit.
Returns:
True if the limits are valid, false if not.

setLimits

public boolean setLimits(int lowerLimit,
                         int upperLimit)
Set the upper limit and lower limit of this colormap, Nothing will be changed if the input is invalid.

Parameters:
lowerLimit - window of this colormap
upperLimit - level of this colormap
Returns:
True if the limits are valid, false if not.

setInverted

public void setInverted(boolean flag)
set the invert flag.


invertColorMap

public void invertColorMap()

getInverted

public boolean getInverted()
iget the invert flag.


toString

public java.lang.String toString()
Get a String representation of the colormap

Overrides:
toString in class java.lang.Object
Returns:
String representation of the colormap

getName

public abstract java.lang.String getName()
Get the names of the actual color map


_setColorMap

protected abstract void _setColorMap()
Actual set up of color map in range.