casacore
|
Regular N-dimensional data structures. More...
Modules | |
Lattices_module_internal_classes | |
Internal Lattices_module classes and functions. | |
Classes | |
class | casacore::ArrayLattice< T > |
A memory resident Lattice. More... | |
class | casacore::ExtendLattice< T > |
An extension of a Lattice or MaskedLattice. More... | |
class | casacore::HDF5Lattice< T > |
A Lattice that is read from or written to an HDF5 dataset. More... | |
class | casacore::Lattice< T > |
A templated, abstract base class for array-like objects. More... | |
class | casacore::LatticeBase |
A non-templated, abstract base class for array-like objects. More... | |
class | casacore::LatticeCache< T > |
a class for caching image access via tiles More... | |
class | casacore::LatticeConcat< T > |
Concatenates lattices along a specified axis. More... | |
class | casacore::RO_LatticeIterator< T > |
A readonly iterator for Lattices. More... | |
class | casacore::LatticeIterator< T > |
A read/write lattice iterator. More... | |
class | casacore::LatticeLocker |
Class to hold a (user) lock on a lattice. More... | |
class | casacore::LatticeStepper |
Traverse a Lattice by cursor shape. More... | |
class | casacore::LatticeUtilities |
Static functions for Lattices. More... | |
class | casacore::MaskedLattice< T > |
A templated, abstract base class for array-like objects with masks. More... | |
class | casacore::RO_MaskedLatticeIterator< T > |
A readonly iterator for masked Lattices. More... | |
class | casacore::PagedArray< T > |
A Lattice that is read from or written to disk. More... | |
class | casacore::PixelCurve1D |
Arbitrary 1-dim curve in a lattice plane. More... | |
class | casacore::SubLattice< T > |
A subset of a Lattice or MaskedLattice. More... | |
class | casacore::TempLattice< T > |
A Lattice that can be used for temporary storage. More... | |
class | casacore::TiledLineStepper |
Step a Vector cursor optimally through a tiled Lattice. More... | |
class | casacore::TiledShape |
Define the shape and tile shape. More... | |
class | casacore::TileStepper |
traverse a tiled Lattice optimally with a tile cursor More... | |
Regular N-dimensional data structures.
See below for an overview of the classes in this module.
Lattice: "A regular, periodic configuration of points, particles, or objects, throughout an area of a space..." (American Heritage Directory) This definition matches our own: an N-dimensional arrangement of data on regular orthogonal axes.
In Casacore, we have used the ability to call many things by one generic name (Lattice) to create a number of classes which have different storage techniques (e.g. core memory, disk, etc...). The name Lattice should make the user think of a class interface (or member functions) which all Lattice objects have in common. If functions require a Lattice argument, the classes described here may be used interchangeably, even though their actual internal workings are very different.
The Lattice module may be broken up into a few areas:
Lattices - the actual holders of lattice-like data which all share a common interface. The following items are all Lattices and may be used polymorphically wherever a Lattice is called for.
The ArrayLattice class adds the interface requirements of a Lattice to a Casacore Array. The data inside an ArrayLattice are not stored on disk. This n-dimensional array class is the simplest of the Lattices. Users construct the ArrayLattice with an argument which is either an IPosition which describes the array shape or a previously instantiated Array object that may already contain data. In the former case, some Lattice operation must be done to fill the data. The ArrayLattice, like all Lattices, may be iterated through with a LatticeIterator (see below).
Iteration can also be done using LatticeApply and some helper classes. It makes it possible to concentrate on the algorithm.
The PagedArray class stores its data on disk in the Table format and pages it into random access memory for use. Paging is used here to describe the process of getting pieces of data small enough to fit into active memory even if the whole data set is much too large. This class "feels" like an array but may hold very large amounts of data. The paging has an added effect: all the data may be made persistent, so it stays around after the application ends. When you use PagedArrays - use them because you need persistent data and/or paging into large data sets.
The persistence is done using a Table, and uses the tiled storage manager. This means that accessing the data along any axis is equally efficient (depending on the tile shape used).
A PagedArray constructor allows previously created PagedArrays to be recalled from disk. Much of the time, the PagedArray will be constructed with a TiledShape argument which describes the array and tile shape and a Table argument for use as the place of storage. Then the PagedArray may be filled using any of the access functions of Lattices (like the LatticeIterator.)
The HDF5Lattice class stores its data on disk in HDF5 format. It works in the same way as PagedArray.
LatticeIterator - the object which allows iteration through any Lattice's data. This comes in two types: the RO_LatticeIterator
which should be used if you are not going to change the Lattice's data, and the LatticeIterator
if you need to change the data in the Lattice.
Note that iteration can also be done using LatticeApply and some helper classes. It makes it possible to concentrate on the algorithm.
The RO_LatticeIterator class name reflects its role as a means of iterating a "Read-Only" array (hereafter refered to as a "cursor") through a Lattice based object, from beginning to end. Think of a window into the Lattice that moves to a new location when requested. The Lattice doesn't change but you may see all or part of its data as the cursor "window" moves around. This class allows optimized read-only iteration through any instance of a class derived from Lattice. The cursor's shape is defined by the user and moved through the Lattice in an orderly fashion also defined by the user. Since the cursor is "read-only" it can only be used to "get" the data out of the Lattice. RO_LatticeIterators are constructed with the Lattice to be iterated as the first argument. The optional second constructor argument is either an IPosition which defines the shape of the cursor or a LatticeNavigator argument. The IPosition argument cause the iterator to move the cursor in a simple pattern; the cursor starts at the Lattice's origin and moves in the direction of the x-axis, then the y-axis, then the z-axis, etc.. If a LatticeNavigator argument is given, more control over the cursor shape and path are available. If no second argument is given, the optimal TileStepper navigator will be used.
LatticeNavigators - the objects which define the method and path used by a LatticeIterator to move the cursor through a Lattice. Many different paths are possible. We leave it you to choose the LatticeNavigator (method and path) when using a LatticeIterator.
The LatticeStepper class is used to define the steps which the cursor takes during its path through the Lattice. Every element of the Lattice will be covered, starting at the origin and ending at the "top right corner." This class provides the information needed by a LatticeIterator to do non-standard movements of the cursor during iteration. The shape of the cursor is specified by the second IPosition argument of the LatticeStepper. The order of the axis is important. An IPosition(1,5) is a five element vector along the x-axis. An IPosition(3,1,1,5) is a five element vector along the z-axis. The degenerate axes (axes with lengths of one) act as place holders. The third argument in the LatticeStepper constructor is the "orientation" IPosition. This describes the order of the axis for the cursor to follow. Again, we treat the elements, in order, of the IPosition as the designators of the appropriate axis. The zeroth element indicates which axis is the fastest moving, the first element indicates which axis is the second fastest moving etc. eg. The IPosition(3,2,0,1) says the LatticeIterator should start with the z-axis, next follow the x-axis, and finish with the y-axis. A single element cursor would thus move through a cube of dimension(x,y,z) from (0,0,0) up the z-axis until reaching the maximum (0,0,z-1) and then start on (1,0,0) and move to (1,0,z-1), etc.
The TiledLineStepper class allows you to iterate through a Lattice with a Vector cursor. However, it steps through the Lattice in an order which is optimum with regard to the I/O of the tiles with which the Lattice is constructed.
The TileStepper class allows you to iterate through a Lattice in the optimum way. It steps through the lattice tile by tile minimizing I/O and memory usage. It is very well suited for pixel based operations. However, its iteration order is such that it cannot be used for a certain subset of pixels (e.g. a vector) is needed.
This navigator is the default when no navigator is given when constructing a (RO_)LatticeIterator.
MaskedLattice - a Lattice with a mask. It is an abstract base class for various types of MaskedLattices. A MaskedLattice does not need to contain a mask (see e.g. SubLattice below), although the user can always ask for the mask. The function isMasked()
tells if there is really a mask. If not, users could take advantage by shortcutting some code for better performance. I.e. a function can test if a the MaskedLattice is really masked and can take a special route if not. Of course, doing that requires more coding, so it should only be done where performance is a real issue.
A SubLattice represents a rectangular subset of a Lattice. The SubLattice can be a simple box, but it can also be a circle, polygon, etc. In the latter case the SubLattice contains a mask telling which pixels in the bounding box actually belong to the circle or polygon. In the case of a box there is no mask, because there is no need to (because a box is already rectangular).
A SubLattice can be constructed from any Lattice and a LatticeRegion telling which part to take from the Lattice. If the SubLattice is constructed from a const Lattice
, the SubLattice is not writable. Otherwise it is writable if the lattice is writable.
There is a rich variety of region classes which can be used to define a LatticeRegion in pixel coordinates. They are described in module LRegions.
LatticeLocker can be used to acquire a (user) lock on a lattice. The lock can be a read or write lock. The destructor releases the lock when needed.
Lattices on disk can be used (read and write) by multiple processes. The Table locking/synchronization mechanism takes care that sharing such a lattice is done in an orderly way. Usually the default locking mechanism is sufficient. LatticeLocker is useful when finer locking control is needed for a disk-based lattice.
Warning: The following are listed for low-level programmers; Lattice users need not understand them;
The Lattice directory contains several files relevant only to implementation.
Lattices allow the various holders of data to assume a general method of treatment; by making interfaces in terms of the Lattice class, the programmer can polymorphically operate on objects derived from the Lattice class.