Package gov.nih.mipav.model.algorithms
Class ContourPlot.SimpleColorMap
- java.lang.Object
-
- gov.nih.mipav.model.algorithms.ContourPlot.SimpleColorMap
-
- All Implemented Interfaces:
ContourPlot.ColorMap
- Enclosing class:
- ContourPlot
public class ContourPlot.SimpleColorMap extends java.lang.Object implements ContourPlot.ColorMap
Implementation of theContourPlot.ColorMapinterface.- Author:
- hageldave
-
-
Constructor Summary
Constructors Constructor Description SimpleColorMap(int... colors)Creates a newContourPlot.SimpleColorMapwith the specified colors and uniform spacing.SimpleColorMap(int[] colors, double[] locations)Creates aContourPlot.SimpleColorMapwith the specified colors and corresponding locations in the unit interval.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetColor(int index)Returns the ith colorint[]getColors()doublegetLocation(int index)Returns the location of the ith color within the unit interval.double[]getLocations()intnumColors()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gov.nih.mipav.model.algorithms.ContourPlot.ColorMap
copy, interpolate, resample
-
-
-
-
Constructor Detail
-
SimpleColorMap
public SimpleColorMap(int[] colors, double[] locations)Creates aContourPlot.SimpleColorMapwith the specified colors and corresponding locations in the unit interval. As required by theContourPlot.ColorMapinterface the first location has to be 0, the last location has to 1 and the locations in between have to monotonically increase within ]0,1[.- Parameters:
colors- integer packed ARGB values (e.g. 0xff00ff00 is opaque green)locations- corresponding to colors. Within [0,1].- Throws:
java.lang.IllegalArgumentException- if colors and locations are of different lengths, if less than 2 colors are specified, if locations does not start with 0 or does not end with 1, if locations is not sorted in ascending order.
-
SimpleColorMap
public SimpleColorMap(int... colors)
Creates a newContourPlot.SimpleColorMapwith the specified colors and uniform spacing.- Parameters:
colors- integer packed ARGB values (e.g. 0xff00ff00 is opaque green)- Throws:
java.lang.IllegalArgumentException- when less than 2 colors are specified.
-
-
Method Detail
-
numColors
public int numColors()
- Specified by:
numColorsin interfaceContourPlot.ColorMap- Returns:
- the number of discrete colors in this
ContourPlot.ColorMap
-
getColor
public int getColor(int index)
Description copied from interface:ContourPlot.ColorMapReturns the ith color- Specified by:
getColorin interfaceContourPlot.ColorMap- Parameters:
index- index of the color- Returns:
- ith color in integer packed ARGB format (0xff00ff00 is opaque green)
-
getColors
public int[] getColors()
- Specified by:
getColorsin interfaceContourPlot.ColorMap- Returns:
- all discrete colors in this
ContourPlot.ColorMapin integer packed ARGB format (0xff00ff00 is opaque green)
-
getLocation
public double getLocation(int index)
Description copied from interface:ContourPlot.ColorMapReturns the location of the ith color within the unit interval.- Specified by:
getLocationin interfaceContourPlot.ColorMap- Parameters:
index- index of the location/color- Returns:
- location within [0,1]
-
getLocations
public double[] getLocations()
- Specified by:
getLocationsin interfaceContourPlot.ColorMap- Returns:
- all locations of the discrete colors in this
ContourPlot.ColorMap
-
-