WCDataScaleHandler.h

Classes

WCDataScaleHandler -- Class implementing simple data scaling for the WorldCanvas. (full description)

class WCDataScaleHandler : public DisplayOptions

Interface

Public Members
WCDataScaleHandler()
virtual ~WCDataScaleHandler()
WCDataScaleHandler(Double min, Double max)
virtual Bool operator()(Array<uInt> & out, const Array<Bool> & in)
virtual Bool operator()(Array<uInt> & out, const Array<uChar> & in)
virtual Bool operator()(Array<uInt> & out, const Array<Char> & in)
virtual Bool operator()(Array<uInt> & out, const Array<uShort> & in)
virtual Bool operator()(Array<uInt> & out, const Array<Short> & in)
virtual Bool operator()(Array<uInt> & out, const Array<uInt> & in)
virtual Bool operator()(Array<uInt> & out, const Array<Int> & in)
virtual Bool operator()(Array<uInt> & out, const Array<uLong> & in)
virtual Bool operator()(Array<uInt> & out, const Array<Long> & in)
virtual Bool operator()(Array<uInt> & out, const Array<Float> & in)
virtual Bool operator()(Array<uInt> & out, const Array<Double> & in)
virtual Bool operator()(Array<uInt> & out, const Array<Complex> & in)
virtual Bool operator()(Array<uInt> & out, const Array<DComplex> & in)
Double domainMin() const
Double domainMax() const
void setDomainMinMax(Double min, Double max)
uInt rangeMax() const
void setRangeMax(uInt max)
virtual void setDefaultOptions()
virtual Bool setOptions(Record &rec, Record &recOut)
virtual Record getOptions()

Description

Prerequisite

Etymology

WCDataScaleHandler : WorldCanvas Data Scale Handler

This class is responsible for scaling data into a range suitable for display.

Synopsis

WCDataScaleHandler defines a set of functions whose purpose is to transform real data values, such as those from raster images or contour lines, into an image whose value ranges from 0 to N-1 for some N, normally taken to be the color resolution available for display.

The Display library defines the following process of image display:

  1. fitting of images to display (WCResampleHandler)
  2. transformation of values from real values to discrete values in the range of [0,N-1], where N is the output color resolution. (WCDataScaleHandler)
  3. translating [0,N-1] into color indicies (PixelCanvas's mapToColor() function)

The function suite includes all the normal scalar types. Default implementations exist for

Each scalar implementation must scale the data according to the domain minimum and maximum values and the N-1 value called the rangeMax.

This class would idealy be implemented by a templated member function, but C++ does not yet support templated member functions in non-templated classes. Thus the manual expansion-by-type.

Motivation

Wanted a way for users to customize the scaling process from real values to discrete values for color display.

Example

see WCLinearScaleHandler

To Do

Member Description

WCDataScaleHandler()

Default Constructor Required

virtual ~WCDataScaleHandler()

Destructor (does nothing)

WCDataScaleHandler(Double min, Double max)

Set min/max at construction time

virtual Bool operator()(Array<uInt> & out, const Array<Bool> & in)
virtual Bool operator()(Array<uInt> & out, const Array<uChar> & in)
virtual Bool operator()(Array<uInt> & out, const Array<Char> & in)
virtual Bool operator()(Array<uInt> & out, const Array<uShort> & in)
virtual Bool operator()(Array<uInt> & out, const Array<Short> & in)
virtual Bool operator()(Array<uInt> & out, const Array<uInt> & in)
virtual Bool operator()(Array<uInt> & out, const Array<Int> & in)
virtual Bool operator()(Array<uInt> & out, const Array<uLong> & in)
virtual Bool operator()(Array<uInt> & out, const Array<Long> & in)
virtual Bool operator()(Array<uInt> & out, const Array<Float> & in)
virtual Bool operator()(Array<uInt> & out, const Array<Double> & in)
virtual Bool operator()(Array<uInt> & out, const Array<Complex> & in)
virtual Bool operator()(Array<uInt> & out, const Array<DComplex> & in)

op() returns True if the Array in was converted to the Array out successfully. Default implentation for Bool maps False to 0 and True to rangeMax

Types uChar to Double not implemented (They return False). User should override the types needed (or perhaps all depending on your compiler.

Default Complex and DComplex extract amplitude and call the Float or Double version.

Double domainMin() const
Double domainMax() const
void setDomainMinMax(Double min, Double max)

set/get the min/max to use for the input Array

uInt rangeMax() const
void setRangeMax(uInt max)

set/get the maximum value to use for the output array Note: the minimum value is always zero

virtual void setDefaultOptions()

install the default options for this DisplayData

virtual Bool setOptions(Record &rec, Record &recOut)

apply options stored in val to the DisplayData; return value True means a refresh is needed...

virtual Record getOptions()

retrieve the current and default options and parameter types.