WCResampleHandler.h

Classes

WCResampleHandler -- Base class for resampling data pixels to World/PixelCanvas pixels. (full description)

class WCResampleHandler

Interface

Public Members
WCResampleHandler()
WCResampleHandler (const WCResampleHandler& other)
WCResampleHandler& operator=(const WCResampleHandler& other)
virtual ~WCResampleHandler()
virtual void operator()(Matrix<Bool> &out, const Matrix<Bool> &in) = 0
virtual void operator()(Matrix<uChar> &out, const Matrix<uChar> &in) = 0
virtual void operator()(Matrix<Char> &out, const Matrix<Char> &in) = 0
virtual void operator()(Matrix<uShort> &out, const Matrix<uShort> &in) = 0
virtual void operator()(Matrix<Short> &out, const Matrix<Short> &in) = 0
virtual void operator()(Matrix<uInt> &out, const Matrix<uInt> &in) = 0
virtual void operator()(Matrix<Int> &out, const Matrix<Int> &in) = 0
virtual void operator()(Matrix<uLong> &out, const Matrix<uLong> &in) = 0
virtual void operator()(Matrix<Long> &out, const Matrix<Long> &in) = 0
virtual void operator()(Matrix<Float> &out, const Matrix<Float> &in) = 0
virtual void operator()(Matrix<Double> &out, const Matrix<Double> &in) = 0
virtual void operator()(Matrix<Complex> &out, const Matrix<Complex> &in) = 0
virtual void operator()(Matrix<DComplex> &out, const Matrix<DComplex> &in) = 0
virtual void operator()(Matrix<Float> &out, const Matrix<Float> &in, const Vector<Float> &inblc, const Vector<Float> &intrc, const Float blank = 0.0) = 0
virtual void operator()(Matrix<Float> &out, Matrix<Bool>& outMask, const Matrix<Float> &in, const Matrix<Bool> &inMask, const Vector<Float> &inblc, const Vector<Float> &intrc, const Float blank = 0.0) = 0
virtual void operator()(Matrix<Bool> &out, const Matrix<Bool> &in, const Vector<Float> &inblc, const Vector<Float> &intrc, const Bool blank = False) = 0
void setSubregion(const Vector<Double> &blc, const Vector<Double> &trc)
void getSubregion(Vector<Double> &blc, Vector<Double> &trc) const
Protected Members
const Vector<Double> &blc() const
const Vector<Double> &trc() const

Description

Prerequisite

Etymology

The name of WCResampleHandler comes from WorldCanvas + Resample + Handler

Synopsis

WCResampleHandler is the tool used to extract a rectangular subregion of an image for purposes of display. This class is abstract and defines the interface the WorldCanvas sees.

When the resample handler fires, it extracts a rectangular subregion of its input matrix and stores it in its output matrix. If the default subregion is the whole image and the output image is the same size as the input image, then the output image is a copy of the input image.

If not, the subregion of the image is resampled to fit the output matrix size.

Motivation

Objectify the concept of resampling to allow programmers to write their own, more complicated versions and register them with the WorldCanvas.

Member Description

WCResampleHandler()

(Required) default constructor.

WCResampleHandler (const WCResampleHandler& other)

Copy Constructor (copy semantics)

WCResampleHandler& operator=(const WCResampleHandler& other)

Assignment operator (copy semantics)

virtual ~WCResampleHandler()

Destructor.

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

The output array is presized by the caller to the correct size. It will be filled using information in the input array combined with other resample-specific information. Here again the interface is type expanded rather than templated because C++ doesn't yet handle templated member functions in a non-templated class.

virtual void operator()(Matrix<Float> &out, const Matrix<Float> &in, const Vector<Float> &inblc, const Vector<Float> &intrc, const Float blank = 0.0) = 0
virtual void operator()(Matrix<Float> &out, Matrix<Bool>& outMask, const Matrix<Float> &in, const Matrix<Bool> &inMask, const Vector<Float> &inblc, const Vector<Float> &intrc, const Float blank = 0.0) = 0
virtual void operator()(Matrix<Bool> &out, const Matrix<Bool> &in, const Vector<Float> &inblc, const Vector<Float> &intrc, const Bool blank = False) = 0

These functions resample the input matrix to the output. inblc is the location 'within' the input matrix for the bottom-left pixel of the output (sim. for intrc); blank is the output value where none of the input data is useful. The output matrix must be presized to the required size.

void setSubregion(const Vector<Double> &blc, const Vector<Double> &trc)
void getSubregion(Vector<Double> &blc, Vector<Double> &trc) const

These functions manipulate which subregion in "in" gets expanded to "out" Coordinates are the fraction of the image to use, with <0.0, 0.0> representing the bottom-left corner of the first pixel and <1.0, 1.0> representing the top-right corner of the last pixel. These parameters are interpreted according to the derived class.

const Vector<Double> &blc() const

Get the bottom left corner (range <0-1,0-1>) of the subregion

const Vector<Double> &trc() const

Get the top right corner (range <0-1,0-1>) of the subregion