LatticeUtilities.h

Classes

LatticeUtilities -- Static functions for Lattices (full description)
-- Global functions on Lattices (full description)

class LatticeUtilities

Interface

Public Members
template <class T> static void collapse (T<T>& data, const Array& axes, const IPosition<T>& in, Bool dropDegenerateAxes)
template <class T> static void collapse (T<T>& data, T<Bool>& mask, const Array& axes, const IPosition<T>& lat, Bool dropDegenerateAxes, Bool getPixels=True, Bool getMask=True)
template <class T> static void copyDataAndMask (T& os, LogIO<T>& out, const LogIO<T>& in, Bool zeroMasked=False)
template <class T> static void replicate (T<T>& lat, const Lattice& region, const Slicer<T>& pixels)
template <class T> static void bin (T<T>& out, const T<T>& in, uInt axis, uInt bin)
template <class T> static void addDegenerateAxes (T<T>*& pLatOut, const T<T>& latIn, uInt nDim)

Description

Review Status

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

Prerequisite

Synopsis

Some static helper functions for Lattices

Motivation

Common functionality not appropriate for Lattice member functions

To Do

Member Description

template <class T> static void collapse (T<T>& data, const Array& axes, const IPosition<T>& in, Bool dropDegenerateAxes)

Collapse the specified axes by averaging and recover the pixel values. If axes is empty, then the data just contains all of the lattice (i.e. no collapse), but dropDegenerateAxes is stil honoured

template <class T> static void collapse (T<T>& data, T<Bool>& mask, const Array& axes, const IPosition<T>& lat, Bool dropDegenerateAxes, Bool getPixels=True, Bool getMask=True)

Collapse the specified axes by averaging and recover either/and the pixel values and mask. If axes is empty, then the data and mask just contains all of the lattice (i.e. no collapse) but dropDegenerateAxes is stil honoured

template <class T> static void copyDataAndMask (T& os, LogIO<T>& out, const LogIO<T>& in, Bool zeroMasked=False)

Copy data and mask from input to output. If the input has no mask, that means all True (good), and these values will be transferred to the output. Mask transfer only occurs if the output has a writeable mask.

template <class T> static void replicate (T<T>& lat, const Lattice& region, const Slicer<T>& pixels)

Replicate array through lattice in the specified region. The shape of pixels has to fit exactly into the shape of the selected region for each axis of pixels. Otherwise and exception will be thrown. For example, if the shape of the region is [10,20], the shape of pixels could be [10] and it will be replicated 20 times. Another example would be that the shape of pixels could be [5,10] and it would be replicated 4 times fitting into the Lattice

template <class T> static void bin (T<T>& out, const T<T>& in, uInt axis, uInt bin)

Bin up one axis of MaskedArray (uses Lattices in implementation)

template <class T> static void addDegenerateAxes (T<T>*& pLatOut, const T<T>& latIn, uInt nDim)

Add degenerate axes to the lattice if needed (nDim is the desired number of dimensions for the output lattice). If the shapes are the same, the returned pointer holds a SubLattice. If a reshape was necessary, the pointer holds an ExtendLattice. The pointer is the callers responsibility to delete.


Description

Review Status

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

Prerequisite

Synopsis

Global functions using Lattices

Example

Example 1:

Copy the lattice-type data between two Images.//
    
    PagedImage<Float> myImg ("myimagefile");
    Float lmin;
    Float lmax;
    IPosition posMin = myImg.shape();
    IPosition posMax = myImg.shape();
    minMax( lmin, lmax, posMin, posMax, myImg );
    
    

Motivation

Algorithms like CLEAN need to know the position of the MIN and MAX of an image, but easy things like LEL's min and max don't tell you the location of the min and max. It seems there may be other global functions involving lattices.

To Do