LatticeSlice1D.h

Classes

LatticeSlice1D -- Extract a 1-D slice from a Lattice (full description)

template <class T> class LatticeSlice1D

Types

enum Method

NEAREST = 0
LINEAR = 1
CUBIC = 2
N_TYPES

Interface

Public Members
LatticeSlice1D ()
LatticeSlice1D (const MaskedLattice<T>& lattice, Method method=LINEAR)
LatticeSlice1D(const LatticeSlice1D<T> &other)
virtual ~LatticeSlice1D ()
LatticeSlice1D<T>& operator=(const LatticeSlice1D<T> &other)
void getSlice (Vector<T>& data, Vector<Bool>& mask, const PixelCurve1D& curve, uInt axis0, uInt axis1, const PixelCurve1D& coord)
void getSlice (Vector<T>& data, Vector<Bool>& mask, const IPosition& blc, const IPosition& trc, uInt nPts=0)
void getPosition (uInt& axis0, uInt& axis1, Vector<Float>& x, Vector<Float>& y, Vector<Float>& distance) const
Method interpolationMethod () const
static Method stringToMethod (const String& method)
Private Members
void checkCurve (IPosition& blc, IPosition& trc, const IPosition& coord, const PixelCurve1D& curve)
void findPlane (const IPosition& blc, const IPosition& trc)
void doGetSlice (Vector<T>& data, Vector<Bool>& mask, const PixelCurve1D& curve, const PixelCurve1D& blc, const PixelCurve1D& trc)
void makeInterpolator (Method method)

Description

Review Status

Date Reviewed:
yyyy/mm/dd
Programs:
Tests:

Prerequisite

Etymology

Synopsis

This class extracts an interpolated 1-D slice from a Lattice with a range of interpolation schemes available. The slice must lie in the plane of two cardinal axes.

Tip

Example

    IPosition shape(2, 20, 30);                    // Create MaskedLattice
    ArrayLattice<Float> arrLat(shape);
    SubLattice<Float> subLat(arrLat);
    LatticeSlice1D<Float> slicer(subLat);
    
    IPosition blc(2); blc = 0;                     // Extract slice between corners
    IPosition trc(shape-1);
    Vector<Float> data;
    Vector<Bool> mask;
    slicer.getSlice (data, mask, blc, trc);
    

Motivation

Users often want to see cross-cuts through their data.

To Do

Member Description

enum Method

Interpolation method

LatticeSlice1D ()

Default constructor - object useless

LatticeSlice1D (const MaskedLattice<T>& lattice, Method method=LINEAR)

Constructor

LatticeSlice1D(const LatticeSlice1D<T> &other)

Copy constructor (reference semantics)

virtual ~LatticeSlice1D ()

Destructor

LatticeSlice1D<T>& operator=(const LatticeSlice1D<T> &other)

Assignment operator (reference semantics)

void getSlice (Vector<T>& data, Vector<Bool>& mask, const PixelCurve1D& curve, uInt axis0, uInt axis1, const PixelCurve1D& coord)

Get 1-D slice. PixelCurve1D supplies the locus of the slice in the plane specified by axis0 and axis1. The pixel coordinate for the rest of the lattice is specified in coord.

void getSlice (Vector<T>& data, Vector<Bool>& mask, const IPosition& blc, const IPosition& trc, uInt nPts=0)

Get 1-D slice between blc & trc. These start and end points must be in a cardinal plane of the lattice. If nPts is 0 it is set automatically to the length of the slice.

void getPosition (uInt& axis0, uInt& axis1, Vector<Float>& x, Vector<Float>& y, Vector<Float>& distance) const

Get the (x,y) pixel coordinates from the last slice and the distance along the slice in pixels.. Also recover the axes of the slice plane

Method interpolationMethod () const

Recover interpolation method

static Method stringToMethod (const String& method)

void checkCurve (IPosition& blc, IPosition& trc, const IPosition& coord, const PixelCurve1D& curve)

Check the suppliec curve is valid.

void findPlane (const IPosition& blc, const IPosition& trc)

Find the slice plane.

void doGetSlice (Vector<T>& data, Vector<Bool>& mask, const PixelCurve1D& curve, const PixelCurve1D& blc, const PixelCurve1D& trc)

Get the interpolated slice

void makeInterpolator (Method method)

Make Interpolator