Class ColorMapper
- Direct Known Subclasses:
AnnotationMapper,GraphColorMapper,NodeColorMapper,TreeColorMapper
- Author:
- Tiago Ferreira
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected net.imglib2.display.ColorTableprotected booleanprotected net.imagej.lut.LUTServiceprotected doubleprotected double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetColor(double mappedValue) Gets the color corresponding to the specified mapped value.org.scijava.util.ColorRGBgetColorRGB(double mappedValue) Gets the color corresponding to the specified mapped value as ColorRGB.net.imglib2.display.ColorTableGets the current color table used for mapping.double[]Returns the mapping boundsGets the color used for NaN (Not a Number) values.protected voidinitLuts()booleanChecks if the color mapping uses an integer scale.voidSets up the color mapping for the specified measurement using the given color table.voidsetMinMax(double min, double max) Sets the LUT mapping bounds.voidsetNaNColor(Color nanColor) Sets the color to use for NaN (Not a Number) values.static voidunMap(Collection<Path> paths) Removes color mapping from the specified collection of paths.static voidRemoves color mapping from all paths in the specified tree.
-
Field Details
-
lutService
protected net.imagej.lut.LUTService lutService -
luts
-
colorTable
protected net.imglib2.display.ColorTable colorTable -
integerScale
protected boolean integerScale -
min
protected double min -
max
protected double max
-
-
Constructor Details
-
ColorMapper
public ColorMapper()
-
-
Method Details
-
map
Sets up the color mapping for the specified measurement using the given color table.This method configures the ColorMapper to use the specified measurement and color table for mapping values to colors. The actual mapping implementation is left to extending classes.
- Parameters:
measurement- the measurement to be mappedcolorTable- the color table to use for mapping- Throws:
IllegalArgumentException- if colorTable or measurement is null
-
getNaNColor
Gets the color used for NaN (Not a Number) values.Returns the color that will be used when mapping NaN values, which cannot be mapped to the regular color scale.
- Returns:
- the color for NaN values
-
setNaNColor
Sets the color to use for NaN (Not a Number) values.Specifies the color that should be used when mapping NaN values, which cannot be mapped to the regular color scale.
- Parameters:
nanColor- the color to use for NaN values
-
getColor
Gets the color corresponding to the specified mapped value.Maps the given value to a color using the current color table and mapping bounds. Returns the NaN color if the value is NaN.
- Parameters:
mappedValue- the value to map to a color- Returns:
- the corresponding color
-
getColorRGB
public org.scijava.util.ColorRGB getColorRGB(double mappedValue) Gets the color corresponding to the specified mapped value as ColorRGB.- Parameters:
mappedValue- the value to map to a color- Returns:
- the corresponding ColorRGB
- See Also:
-
setMinMax
public void setMinMax(double min, double max) Sets the LUT mapping bounds.- Parameters:
min- the mapping lower bound (i.e., the highest measurement value for the LUT scale). It is automatically calculated (the default) when set to Double.NaNmax- the mapping upper bound (i.e., the highest measurement value for the LUT scale).It is automatically calculated (the default) when set to Double.NaN.
-
isIntegerScale
public boolean isIntegerScale()Checks if the color mapping uses an integer scale.Returns true if the mapping is configured to use discrete integer values rather than continuous floating-point values.
- Returns:
- true if using integer scale, false for continuous scale
-
getMinMax
public double[] getMinMax()Returns the mapping bounds- Returns:
- a two-element array with current {minimum, maximum} mapping bounds
-
getColorTable
public net.imglib2.display.ColorTable getColorTable()Gets the current color table used for mapping.Returns the ColorTable instance that defines the color mapping from values to colors.
- Returns:
- the current color table
-
initLuts
protected void initLuts() -
unMap
Removes color mapping from all paths in the specified tree.Resets the color of all paths in the tree to their default state, effectively removing any color mapping that was previously applied.
- Parameters:
tree- the tree whose paths should have color mapping removed
-
unMap
Removes color mapping from the specified collection of paths.Resets the color of all paths in the collection to their default state, effectively removing any color mapping that was previously applied. This includes both path-level and node-level color assignments.
- Parameters:
paths- the collection of paths to have color mapping removed
-