Package gov.nih.mipav.model.algorithms
Interface ContourPlot.ColorMap
- All Known Implementing Classes:
ContourPlot.DefaultColorMap,ContourPlot.SimpleColorMap
- Enclosing class:
ContourPlot
public static interface ContourPlot.ColorMap
The ColorMap interface defines discrete mapping from a fixed integer
interval [0..N-1] to colors through the
getColor(int) method.
It also defines a continuous mapping from the unit interval [0,1] to
colors through the interpolate(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 using getLocation(int).- Author:
- hageldave
-
Method Summary
Modifier and TypeMethodDescriptiondefault ContourPlot.SimpleColorMapcopy()intgetColor(int i) Returns the ith colorint[]doublegetLocation(int i) Returns the location of the ith color within the unit interval.double[]default intinterpolate(double m) linearly interpolates colors for the specified location of the unit interval.intdefault 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 Details
-
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
- Returns:
- copy of this color map
-
resample
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
-