Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::DataMapper Class Reference

Map values into data or value ranges. Data range refers to the range of the data type, i.e. [0 4095] for 12-bit unsigned integer data. Value range refers to the physical meaning of the value, i.e. Hounsfield value range is from [-1000 3000]. It is important that the data range is specified for data types with a large range (for example 32/64-bit float and integer) since the data is often normalized to [0 1], when for example performing color mapping, i.e. applying a transfer function. More...

#include <datamapper.h>

Public Types

enum class  SignedNormalization { Asymmetric , Symmetric }
 

Public Member Functions

 DataMapper (const DataFormatBase *format, SignedNormalization normalization=SignedNormalization::Asymmetric, Axis valueAxis={})
 
 DataMapper (dvec2 dataRange, Axis valueAxis={})
 
 DataMapper (dvec2 dataRange, dvec2 valueRange, Axis valueAxis={})
 
 DataMapper (const DataMapper &rhs)
 
DataMapperoperator= (const DataMapper &that)
 
void initWithFormat (const DataFormatBase *format, SignedNormalization normalization=SignedNormalization::Asymmetric)
 
template<typename T >
util::same_extent_t< T, double > mapFromDataToValue (T val) const
 
template<typename T >
util::same_extent_t< T, double > mapFromValueToData (T val) const
 
template<typename T >
util::same_extent_t< T, double > mapFromDataToNormalized (T val) const
 
template<typename T >
util::same_extent_t< T, double > mapFromDataToSignNormalized (T val) const
 
template<typename T >
util::same_extent_t< T, double > mapFromNormalizedToData (T val) const
 
template<typename T >
util::same_extent_t< T, double > mapFromSignNormalizedToData (T val) const
 
template<typename T >
util::same_extent_t< T, double > mapFromValueToNormalized (T val) const
 
template<typename T >
util::same_extent_t< T, double > mapFromNormalizedToValue (T val) const
 

Static Public Member Functions

static dvec2 defaultDataRangeFor (const DataFormatBase *format, SignedNormalization normalization=SignedNormalization::Asymmetric)
 

Public Attributes

dvec2 dataRange
 
dvec2 valueRange
 
Axis valueAxis
 Name and Unit, i.e. "absorption", "Hounsfield".
 

Detailed Description

Map values into data or value ranges. Data range refers to the range of the data type, i.e. [0 4095] for 12-bit unsigned integer data. Value range refers to the physical meaning of the value, i.e. Hounsfield value range is from [-1000 3000]. It is important that the data range is specified for data types with a large range (for example 32/64-bit float and integer) since the data is often normalized to [0 1], when for example performing color mapping, i.e. applying a transfer function.

Member Enumeration Documentation

◆ SignedNormalization

Signed fixed-point integers are normalized using either an asymmetric range [-2^(b-1), 2^(b-1) - 1] or a symmetric range [-2^(b-1) + 1, 2^(b-1) - 1], where b corresponds to the bit depth of the fixed-point integer.

From version 4.2 and above, OpenGL uses a symmetric range to convert between normalized fixed-point integers and floating point values. For example, the range [-127, 127] is used for the normalization of 8bit signed integers instead of [-128, 127]. In order to match the normalization of signed integer formats on the GPU, the symmetric normalization has to be used in the DataMapper for OpenGL >= 4.2.

See also
OpenGL 4.6 specification, Section 2.3.5 Fixed-Point Data Conversion
Enumerator
Asymmetric 

uses an asymmetric range, i.e. [-2^(b-1), 2^(b-1) - 1]

Symmetric 

uses a symmetric range, i.e. [-2^(b-1) + 1, 2^(b-1) - 1]

Member Function Documentation

◆ mapFromDataToNormalized()

template<typename T >
util::same_extent_t< T, double > inviwo::DataMapper::mapFromDataToNormalized ( T val) const
inline

Map from dataRange to the Normalized range [0,1]

◆ mapFromDataToSignNormalized()

template<typename T >
util::same_extent_t< T, double > inviwo::DataMapper::mapFromDataToSignNormalized ( T val) const
inline

Map from dataRange to the Sign Normalized range [-1,1]

◆ mapFromDataToValue()

template<typename T >
util::same_extent_t< T, double > inviwo::DataMapper::mapFromDataToValue ( T val) const
inline

Map from dataRange to the valueRange

◆ mapFromNormalizedToData()

template<typename T >
util::same_extent_t< T, double > inviwo::DataMapper::mapFromNormalizedToData ( T val) const
inline

Map from Normalized range [0,1] to the dataRange

◆ mapFromNormalizedToValue()

template<typename T >
util::same_extent_t< T, double > inviwo::DataMapper::mapFromNormalizedToValue ( T val) const
inline

Map from Normalized range [0,1] to the valueRange

◆ mapFromSignNormalizedToData()

template<typename T >
util::same_extent_t< T, double > inviwo::DataMapper::mapFromSignNormalizedToData ( T val) const
inline

Map from Sign Normalized range [-1,1] to the dataRange

◆ mapFromValueToData()

template<typename T >
util::same_extent_t< T, double > inviwo::DataMapper::mapFromValueToData ( T val) const
inline

Map from valueRange to the dataRange

◆ mapFromValueToNormalized()

template<typename T >
util::same_extent_t< T, double > inviwo::DataMapper::mapFromValueToNormalized ( T val) const
inline

Map from valueRange to the Normalized range [0,1]

Member Data Documentation

◆ dataRange

dvec2 inviwo::DataMapper::dataRange

The dataRange is used to normalize the "raw" values to [0,1] Typically the minimum and maximum of the "raw" data is used. For 8 and 16 integer data that is often the same or close to the same as the minimum and maximum of the data type. For data where the minimum and maximum is far from the minimum and maximum of the data type, the minimum and maximum has to either be calculated from the data, read from the input, or entered by the user.

◆ valueAxis

Axis inviwo::DataMapper::valueAxis

Name and Unit, i.e. "absorption", "Hounsfield".

The valueAxis holds the name and unit of the quantity. Following the example above the name would be "water temperature" and unit "°C".

◆ valueRange

dvec2 inviwo::DataMapper::valueRange

The valueRange corresponds to the "true" values in the "raw" data. The "raw" data will first be normalized to [0,1] using the dataRange and mapped to the "true" range using the valueRange. An example might be helpful: if water temperature values in the range of [0.0, 30.0] °C are stored as 8 bit unsigned int, using the full data range from [0,255]. Then the dataRange would be [0, 255] and the valueRange [0.0, 30.0]. Using the same values for dataRange and valueRange means that the original "raw" values will be used.


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