It supplies one built-in colormap Greyscale 1, which will always be available. The other colormaps are stored in AIPS++ tables. The standard colormaps ar in /aips++/data/colormaps/default.tbl. These can be deactivated by putting display.colormaps.usedefault: no in the .aipsrc file. It also supplies user defined colormaps. It looks for the complete path to the user table in .aipsrc under display.colormaps.usertable:.
ColormapDefinition is used by the
Construct the known Colormap mapName, first looking for
a saved Colormap having this name, then resorting to a built-in
Colormap, and if that doesn't exist, throw an error
Construct a new Colormap, using the supplied name and component
vectors
Obtain the Colormap value for the "index" value 0 <= t <= 1
Change the Colormap values with the provided component vectors
Write this ColormapDefinition to the named Table in the named
directory (default values are obtained from the user's
.aipsrc file. If overwrite is
True, then an existing map of the same name in the
Table will be over-written. If the named Table does not exist,
it will be created.
The table format has to conform with following scheme.
It must have five columns:
CMAP_NAME a String
RED a Float array of dim n
GREEN a Float array of dim n
BLUE a Float array of dim n
SYNONYMS a String array of dim m
Return the names of the built-in colormaps. If uniqueonly
is True (default), only the names of the unique colormaps
are returned, otherwise all colormap names are returned.
Load Colormap definitions for a specified colormapname
Write a ColormapDefinition to an ostream in a simple text form.
Utility function to look if a colormap name is in a Table
load ColormapDefinitions from default location
aips++/data/colormaps/default.tbl
and/or location specified in display.colormaps.usertable
Example
A ColormapDefinition corresponding to the system "rainbow" Colormap
can be obtained and used as follows:
ColormapDefinition rainbowDefinition(String("rainbow"));
Float red, green, blue;
for (uInt i = 0; i <= 100; i++) {
rainbowDefinition.getValues((Float)i/100.0, red, green, blue);
// ... do something with red, green, blue ...
}
Or a new ColormapDefinition with a red ramp and green and blue fixed
at 0.5 could be constructed and saved for later use as follows:
Vector<Float> reds(40), greens(40), blues(40);
greens = 0.5;
blues = 0.5;
for (uInt i = 0; i < 40; i++) {
reds(i) = (Float)i / 39.0;
}
ColormapDefinition simpleRamp("redRamp", reds, greens, blues);
Vector<String> synonyms(2);
synonyms(0) = "RedRamp";synonyms(1) = "redramp";
simpleRamp.save("mytable.tbl,synonyms);
Motivation
Needed to separate out ColormapDefinition from Colormap to give the
programmer a way to over-ride the definition without having to also
over-ride the shape function.
Thrown Exceptions
To Do
Member Description
ColormapDefinition()
Construct a single color (white) Colormap
explicit ColormapDefinition(const String & mapName)
ColormapDefinition(const String & mapName, const Vector<Float> & reds, const Vector<Float> & greens, const Vector<Float> & blues)
void getValue(const Float t, Float & red, Float & green, Float & blue) const
void setValues(const Vector<Float> & reds, const Vector<Float> & greens, const Vector<Float> & blues)
Bool save(const String &fullPathName, const Vector<String> &synonyms, const Bool &overwrite = True) const
static Vector<String> builtinColormapNames(Bool uniqueonly = True)
Bool loadColormap(const String& name)
Bool loadBuiltinColormap(const String& name)
friend ostream & operator << (ostream & os, const ColormapDefinition& pcreh)
Bool queryColormapTable(const Table& table, const String& name)
static void loadColormapTable()