anatomist 6.0.4
3D neuroimaging data viewer
anatomist::ColorTraits< T > Class Template Reference

Converter value -> RGBA (high-level) More...

#include <anatomist/color/colortraits.h>

Public Member Functions

 ColorTraits (const AObjectPalette *palette, const T &mini, const T &maxi, const T &mini2, const T &maxi2, double min1, double max1, double zero1, double min2, double max2, double zero2)
 Constructor for 2D palettes.
 
 ColorTraits (const AObjectPalette *palette, const T &mini, const T &maxi, double min1, double max1, double zero1)
 Constructor for 1D palettes.
 
AimsRGBA color (const T &) const
 
neutralColor () const
 returns a black / transparent / zero color
 
void paletteCoords (double val0, double val1, int &px, int &py) const
 
void paletteCoord (int dim, double val0, int &px) const
 
void paletteCoord0 (double val0, int &px) const
 
void paletteCoord1 (double val0, int &px) const
 

Detailed Description

template<typename T>
class anatomist::ColorTraits< T >

Converter value -> RGBA (high-level)

Colormap helper.

Allows to get rescalings to colormap space. Basically the color() method associates a RGBA color to a scalar value. To do so, values rescalings apply, and lookup in a colormap (AObjectPalette) returns the actual color.

Implementations for RGB/RGBA transforms also exist.

mini / maxi are min and max indexes used to address the colormap (let's call it "output colormap").

min1 / max1 are the range (as in AObjectPalette::min1()/max1() actually mapped to the colormap. Generally we use palette.min1()/max1()

Definition at line 129 of file colortraits.h.

Constructor & Destructor Documentation

◆ ColorTraits() [1/2]

template<typename T>
anatomist::ColorTraits< T >::ColorTraits ( const AObjectPalette * palette,
const T & mini,
const T & maxi,
const T & mini2,
const T & maxi2,
double min1,
double max1,
double zero1,
double min2,
double max2,
double zero2 )
inline

Constructor for 2D palettes.

Definition at line 206 of file colortraits.h.

◆ ColorTraits() [2/2]

template<typename T>
anatomist::ColorTraits< T >::ColorTraits ( const AObjectPalette * palette,
const T & mini,
const T & maxi,
double min1,
double max1,
double zero1 )
inline

Constructor for 1D palettes.

Scaling parameters are processed, and should be passed carefully:

  • palette is the object palette.
  • mini / maxi are min and max values used to address the colormap from a source space. They can be either double float texture values, or indices used to build in a colormap or texture image. The methods color() and paletteCoords() get their parameters in this space.
  • min1 / max1 are the range to be mapped within the [mini, maxi] input space. They are coordinates in relative palette space (as in AObjectPalette::min1()/max1(). Depending on the values used here, different mappings may be obtained.
    • a Volume will use the volume min/max values, transformed in relative palette space (palette->relValue(object, absvolmin), palette->relValue(object, absvolmax)) to transform direct scalar volume values to RGB through the palette scale.
    • a texture will build a texture image (thus, a custom palette) covering just the zoomed palette region, using texture coord scaling and clamping for values outside these bounds, thus will map (palette->min(), palette->max()) or more precisely these bounds clamped within the range [0, 1] for "normal" palettes. Zero-centered palettes will use values matching the symmetric palette.
    • a colormap view will display the resampled palette beween given bounds (typically bound to the min/max texture values).
  • zero is the value in the palette relative space (same as min, max) corresponding to the absolute 0 of the texture. This is used only in zero-centered palette mode in order to have the center.

Definition at line 218 of file colortraits.h.

Member Function Documentation

◆ color()

template<typename T>
AimsRGBA anatomist::ColorTraits< T >::color ( const T & in) const
inline

Definition at line 226 of file colortraits.h.

◆ neutralColor()

template<typename T>
T anatomist::ColorTraits< T >::neutralColor ( ) const
inline

returns a black / transparent / zero color

Definition at line 232 of file colortraits.h.

◆ paletteCoord()

template<typename T>
void anatomist::ColorTraits< T >::paletteCoord ( int dim,
double val0,
int & px ) const
inline

Definition at line 246 of file colortraits.h.

◆ paletteCoord0()

template<typename T>
void anatomist::ColorTraits< T >::paletteCoord0 ( double val0,
int & px ) const
inline

Definition at line 253 of file colortraits.h.

◆ paletteCoord1()

template<typename T>
void anatomist::ColorTraits< T >::paletteCoord1 ( double val0,
int & px ) const
inline

Definition at line 260 of file colortraits.h.

◆ paletteCoords()

template<typename T>
void anatomist::ColorTraits< T >::paletteCoords ( double val0,
double val1,
int & px,
int & py ) const
inline

Definition at line 238 of file colortraits.h.


The documentation for this class was generated from the following file: