Package qupath.lib.color
Class ColorMaps
java.lang.Object
qupath.lib.color.ColorMaps
Helper class to manage colormaps, which are rather like lookup tables but easily support interpolation.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic interfacecolormap, which acts as an interpolating lookup table with an arbitrary range.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic ColorMaps.ColorMapcreateColorMap(String name, double[] r, double[] g, double[] b) Create a colormap using floating point values for red, green and blue.static ColorMaps.ColorMapcreateColorMap(String name, int[] r, int[] g, int[] b) Create a colormap using integer values for red, green and blue.static ColorMaps.ColorMapcreateColorMap(String name, int r, int g, int b) Create a colormap using int values for red, green and blue corresponding to the maximum value; the minimum color will be black.static ColorMaps.ColorMapgammaColorMap(ColorMaps.ColorMap map, double gamma) Apply gamma to a colormap.static Map<String, ColorMaps.ColorMap> Get an unmodifiable map representing all the currently-available colormaps.static int[]getColors(ColorMaps.ColorMap map, int nValues, boolean doInvert) Get an array of packed RGB values for a specific colormap.static ColorMaps.ColorMapGet a default, general-purposeColorMaps.ColorMap.static booleaninstallColorMaps(Path... paths) Install colormaps from the specified paths.static booleaninstallColorMaps(ColorMaps.ColorMap... colorMaps) Install colormaps.static voidsetDefaultColorMap(ColorMaps.ColorMap colorMap) Set the defaultColorMaps.ColorMap.
- 
Constructor Details- 
ColorMapspublic ColorMaps()
 
- 
- 
Method Details- 
installColorMapsInstall colormaps from the specified paths.- Parameters:
- paths- optional paths containing either .tsv files containing colormaps, or directories that contain such .tsv files.
- Returns:
- true if changes were made, false otherwise
 
- 
installColorMapsInstall colormaps.- Parameters:
- colorMaps- one or more colormaps.
- Returns:
- true if changes were made, false otherwise
 
- 
getColorsGet an array of packed RGB values for a specific colormap.- Parameters:
- map- the colormap providing colors
- nValues- the number of colors to extract
- doInvert- if true, reverse the order of the colors
- Returns:
- an int array of length nValues
 
- 
getDefaultColorMapGet a default, general-purposeColorMaps.ColorMap.- Returns:
- See Also:
 
- 
setDefaultColorMapSet the defaultColorMaps.ColorMap.- Parameters:
- colorMap-
- See Also:
 
- 
getColorMapsGet an unmodifiable map representing all the currently-available colormaps.- Returns:
- the available colormaps
- Implementation Note
- The map is unmodifiable to avoid consumers removing colormaps that might be required elsewhere, but the underlying content may still be changed by installing new maps. This behavior may change in a later version. Defensive copies should be made if maps need to be persistent.
 
- 
createColorMapCreate a colormap using floating point values for red, green and blue. These should be in the range 0-1.- Parameters:
- name-
- r-
- g-
- b-
- Returns:
 
- 
createColorMapCreate a colormap using integer values for red, green and blue. These should be in the range 0-255.- Parameters:
- name-
- r-
- g-
- b-
- Returns:
 
- 
createColorMapCreate a colormap using int values for red, green and blue corresponding to the maximum value; the minimum color will be black. These should be in the range 0-255.- Parameters:
- name-
- r-
- g-
- b-
- Returns:
 
- 
gammaColorMapApply gamma to a colormap. The resulting colormap normalizes the input value according to the specified min and max, then appliesvalue = Math.pow(value, gamma)before passing this to the wrappedColorMaps.ColorMap.- Parameters:
- map- base colormap
- gamma- gamma value
- Returns:
- transformed colormap
 
 
-