Package gov.nih.mipav.model.algorithms
Interface ContourPlot.ColorMap
-
- All Known Implementing Classes:
ContourPlot.DefaultColorMap,ContourPlot.SimpleColorMap
- Enclosing class:
- ContourPlot
public static interface ContourPlot.ColorMapThe ColorMap interface defines discrete mapping from a fixed integer interval [0..N-1] to colors through thegetColor(int)method. It also defines a continuous mapping from the unit interval [0,1] to colors through theinterpolate(double)method. For this each of the discrete colors is mapped to a location within the unit interval [0,1] with the first color mapping to 0 and the last mapping to 1. The colors in between have arbitrary but ascending locations within ]0,1[ which can be accessed usinggetLocation(int).- Author:
- hageldave
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default ContourPlot.SimpleColorMapcopy()intgetColor(int i)Returns the ith colorint[]getColors()doublegetLocation(int i)Returns the location of the ith color within the unit interval.double[]getLocations()default intinterpolate(double m)linearly interpolates colors for the specified location of the unit interval.intnumColors()default ContourPlot.SimpleColorMapresample(int numSamples, double start, double end)Returns a uniformly sampled version of this map with the specified number of samples within the specified interval.
-
-
-
Method Detail
-
numColors
int numColors()
- Returns:
- the number of discrete colors in this
ContourPlot.ColorMap
-
getColor
int getColor(int i)
Returns the ith color- Parameters:
i- index of the color- Returns:
- ith color in integer packed ARGB format (0xff00ff00 is opaque green)
-
getColors
int[] getColors()
- Returns:
- all discrete colors in this
ContourPlot.ColorMapin integer packed ARGB format (0xff00ff00 is opaque green)
-
getLocation
double getLocation(int i)
Returns the location of the ith color within the unit interval.- Parameters:
i- index of the location/color- Returns:
- location within [0,1]
-
getLocations
double[] getLocations()
- Returns:
- all locations of the discrete colors in this
ContourPlot.ColorMap
-
interpolate
default int interpolate(double m)
linearly interpolates colors for the specified location of the unit interval.- Parameters:
m- location within [0,1]- Returns:
- the interpolated color for specified location in integer packed ARGB format (0xff00ff00 is opaque green)
-
copy
default ContourPlot.SimpleColorMap copy()
- Returns:
- copy of this color map
-
resample
default ContourPlot.SimpleColorMap resample(int numSamples, double start, double end)
Returns a uniformly sampled version of this map with the specified number of samples within the specified interval.- Parameters:
numSamples- number of uniform samplesstart- of sampling interval within [0,1[end- of sampling interval within ]0,1]- Returns:
- re-sampled map
-
-