casa
5.7.0-16
|
A memory resident Lattice. More...
#include <ImageTask.h>
Public Member Functions | |
ArrayLattice () | |
The default constructor creates a ArrayLattice that is useless for just about everything, except that it can be assigned to with the assignment operator. More... | |
ArrayLattice (const IPosition &shape) | |
Construct an ArrayLattice with the specified shape. More... | |
ArrayLattice (Array< T > &array, Bool isWritable=True) | |
Construct an ArrayLattice that references the given Array. More... | |
ArrayLattice (const Array< T > &array) | |
Construct an ArrayLattice that references the given Array. More... | |
ArrayLattice (const ArrayLattice< T > &other) | |
The copy constructor uses reference semantics. More... | |
virtual | ~ArrayLattice () |
ArrayLattice< T > & | operator= (const ArrayLattice< T > &other) |
The assignment operator uses copy semantics. More... | |
virtual Lattice< T > * | clone () const |
Make a copy of the object (reference semantics). More... | |
virtual Bool | canReferenceArray () const |
The lattice data can be referenced as an array section. More... | |
virtual Bool | isWritable () const |
Is the lattice writable? More... | |
virtual IPosition | shape () const |
returns the shape of the ArrayLattice. More... | |
virtual void | set (const T &value) |
Set all of the elements in the Lattice to a value. More... | |
Array< T > & | asArray () |
Return the Array of the data within this Lattice. More... | |
const Array< T > & | asArray () const |
virtual T | getAt (const IPosition &where) const |
Return the value of the single element located at the argument IPosition. More... | |
virtual void | putAt (const T &value, const IPosition &where) |
Put the value of a single element. More... | |
virtual Bool | ok () const |
Check for internal consistency. More... | |
virtual uInt | advisedMaxPixels () const |
Returns the maximum recommended number of pixels for a cursor. More... | |
void | getIterSlice (Array< T > &buffer, const IPosition &start, const IPosition &end, const IPosition &incr) |
Get a slice in an optimized way (specifically for ArrLatticeIter). More... | |
Public Member Functions inherited from casacore::Lattice< T > | |
virtual | ~Lattice () |
a virtual destructor is needed so that it will use the actual destructor in the derived class More... | |
virtual DataType | dataType () const |
Get the data type of the lattice. More... | |
T | operator() (const IPosition &where) const |
Return the value of the single element located at the argument IPosition. More... | |
Bool | get (COWPtr< Array< T > > &buffer, Bool removeDegenerateAxes=False) const |
Functions which extract an Array of values from a Lattice. More... | |
Bool | getSlice (COWPtr< Array< T > > &buffer, const Slicer §ion, Bool removeDegenerateAxes=False) const |
Bool | getSlice (COWPtr< Array< T > > &buffer, const IPosition &start, const IPosition &shape, Bool removeDegenerateAxes=False) const |
Bool | getSlice (COWPtr< Array< T > > &buffer, const IPosition &start, const IPosition &shape, const IPosition &stride, Bool removeDegenerateAxes=False) const |
Bool | get (Array< T > &buffer, Bool removeDegenerateAxes=False) |
Bool | getSlice (Array< T > &buffer, const Slicer §ion, Bool removeDegenerateAxes=False) |
Bool | getSlice (Array< T > &buffer, const IPosition &start, const IPosition &shape, Bool removeDegenerateAxes=False) |
Bool | getSlice (Array< T > &buffer, const IPosition &start, const IPosition &shape, const IPosition &stride, Bool removeDegenerateAxes=False) |
Array< T > | get (Bool removeDegenerateAxes=False) const |
Array< T > | getSlice (const Slicer §ion, Bool removeDegenerateAxes=False) const |
Array< T > | getSlice (const IPosition &start, const IPosition &shape, Bool removeDegenerateAxes=False) const |
Array< T > | getSlice (const IPosition &start, const IPosition &shape, const IPosition &stride, Bool removeDegenerateAxes=False) const |
void | putSlice (const Array< T > &sourceBuffer, const IPosition &where, const IPosition &stride) |
A function which places an Array of values within this instance of the Lattice at the location specified by the IPosition "where", incrementing by "stride". More... | |
void | putSlice (const Array< T > &sourceBuffer, const IPosition &where) |
void | put (const Array< T > &sourceBuffer) |
virtual void | apply (T(*function)(T)) |
Replace every element, x, of the Lattice with the result of f(x). More... | |
virtual void | apply (T(*function)(const T &)) |
virtual void | apply (const Functional< T, T > &function) |
void | operator+= (const Lattice< T > &other) |
Add, subtract, multiple, or divide by another Lattice. More... | |
void | operator-= (const Lattice< T > &other) |
void | operator*= (const Lattice< T > &other) |
void | operator/= (const Lattice< T > &other) |
virtual void | copyData (const Lattice< T > &from) |
Copy the data from the given lattice to this one. More... | |
virtual void | copyDataTo (Lattice< T > &to) const |
Copy the data from this lattice to the given lattice. More... | |
virtual LatticeIterInterface< T > * | makeIter (const LatticeNavigator &navigator, Bool useRef) const |
These functions are used by the LatticeIterator class to generate an iterator of the correct type for a specified Lattice. More... | |
Public Member Functions inherited from casacore::LatticeBase | |
virtual | ~LatticeBase () |
A virtual destructor is needed so that it will use the actual destructor in the derived class. More... | |
virtual String | imageType () const |
Get the image type (returns name of derived class). More... | |
virtual Bool | isPersistent () const |
Is the lattice persistent and can it be loaded by other processes as well? That is the case for a PagedArray or PagedImage and for an ImageExpr which does not use transient lattices or regions. More... | |
virtual Bool | isPaged () const |
Is the lattice paged to disk? The default implementation returns False. More... | |
virtual void | save (const String &fileName) const |
Save the image in an AipsIO file with the given name. More... | |
virtual Bool | lock (FileLocker::LockType, uInt nattempts) |
It is strongly recommended to use class LatticeLocker to handle lattice locking. More... | |
virtual void | unlock () |
virtual Bool | hasLock (FileLocker::LockType) const |
virtual void | resync () |
Resynchronize the Lattice object with the lattice file. More... | |
virtual void | flush () |
Flush the data (but do not unlock). More... | |
virtual void | tempClose () |
Temporarily close the lattice. More... | |
virtual void | reopen () |
Explicitly reopen the temporarily closed lattice. More... | |
virtual String | name (Bool stripPath=False) const |
Return the name of the current Lattice object. More... | |
virtual uInt | ndim () const |
Return the number of axes in this Lattice. More... | |
virtual size_t | nelements () const |
Return the total number of elements in this Lattice. More... | |
size_t | size () const |
Bool | conform (const LatticeBase &other) const |
Return a value of "True" if this instance of Lattice and 'other' have the same shape, otherwise returns a value of "False". More... | |
virtual LELCoordinates | lelCoordinates () const |
Return the coordinates of the lattice. More... | |
IPosition | niceCursorShape (uInt maxPixels) const |
Returns a recommended cursor shape for iterating through all the pixels in the Lattice. More... | |
IPosition | niceCursorShape () const |
virtual IPosition | doNiceCursorShape (uInt maxPixels) const |
The function (in the derived classes) doing the actual work. More... | |
virtual uInt | maximumCacheSize () const |
Maximum cache size - not necessarily all used. More... | |
virtual void | setMaximumCacheSize (uInt howManyPixels) |
Set the maximum (allowed) cache size as indicated. More... | |
virtual void | setCacheSizeInTiles (uInt howManyTiles) |
Set the actual cache size for this Array to be big enough for the indicated number of tiles. More... | |
virtual void | setCacheSizeFromPath (const IPosition &sliceShape, const IPosition &windowStart, const IPosition &windowLength, const IPosition &axisPath) |
Set the cache size as to "fit" the indicated path. More... | |
virtual void | clearCache () |
Clears and frees up the caches, but the maximum allowed cache size is unchanged from when setCacheSize was called. More... | |
virtual void | showCacheStatistics (ostream &os) const |
Report on cache success. More... | |
Protected Member Functions | |
virtual Bool | doGetSlice (Array< T > &buffer, const Slicer §ion) |
Do the actual getting of an array of values. More... | |
virtual void | doPutSlice (const Array< T > &sourceBuffer, const IPosition &where, const IPosition &stride) |
Do the actual putting of an array of values. More... | |
Protected Member Functions inherited from casacore::Lattice< T > | |
Lattice () | |
Define default constructor to satisfy compiler. More... | |
virtual void | handleMath (const Lattice< T > &from, int oper) |
Handle the Math operators (+=, -=, *=, /=). More... | |
virtual void | handleMathTo (Lattice< T > &to, int oper) const |
Lattice (const Lattice< T > &) | |
Copy constructor and assignment can only be used by derived classes. More... | |
Lattice< T > & | operator= (const Lattice< T > &) |
template<> | |
void | handleMathTo (Lattice< Bool > &, int) const |
Protected Member Functions inherited from casacore::LatticeBase | |
LatticeBase () | |
Define default constructor to be used by derived classes. More... | |
LatticeBase (const LatticeBase &) | |
Copy constructor and assignment can only be used by derived classes. More... | |
LatticeBase & | operator= (const LatticeBase &) |
void | throwBoolMath () const |
Throw an exception for arithmetic on a Bool Lattice. More... | |
Private Attributes | |
Array< T > | itsData |
Bool | itsWritable |
A memory resident Lattice.
Public interface
The ArrayLattice name reflects its role as a Lattice interface to an Array object.
An ArrayLattice is a concrete Lattice class where the data is stored in memory as opposed to the PagedArray class where the data is stored on disk. As a result this class is much more suitable to problems which require small Lattices that can fit into the memory of a computer.
ArrayLattice imposes another layer of function calls on top of a an Array. As a result they should not be used for generic Array manipulation. They are useful if you have an Array that needs to use Lattice functions or needs to be used with PagedArrays or other Lattice derivatives (like LatticeExpr or SubLattice). For example the LatticeIterator class can iterate through an Array in more ways than any of the ArrayIterator classes can. The examples below illustrate some uses for ArrayLattices.
All the examples in this section are available in dArrayLattice.cc
In this example an Array of data is converted into an ArrayLattice so that the copyData function can be used to write the data to a PagedArray which will be stored on disk.
Note that it could be done in a somewhat simpler way as:
The ArrayIterator class (or its derivatives the VectorIterator and the MatrixIterator classes) do not allow the user to specify a cursor shape. In this example a Cube class will be converted into an ArrayLattice so that an ArrLatticeIter can be used to access the data spectrum by spectrum (assuming the z-axis is frequency).
There are more examples in the Lattice class and many of the examples in the PagedArray class will also be instructive.
We needed a way of creating Lattices but with Casacore Array characteristics.
Definition at line 16 of file ImageTask.h.
casacore::ArrayLattice< T >::ArrayLattice | ( | ) |
The default constructor creates a ArrayLattice that is useless for just about everything, except that it can be assigned to with the assignment operator.
|
explicit |
Construct an ArrayLattice with the specified shape.
It results in a writable lattice.
casacore::ArrayLattice< T >::ArrayLattice | ( | Array< T > & | array, |
Bool | isWritable = True |
||
) |
Construct an ArrayLattice that references the given Array.
By default it results in a writable lattice.
casacore::ArrayLattice< T >::ArrayLattice | ( | const Array< T > & | array | ) |
Construct an ArrayLattice that references the given Array.
It results in a non-writable lattice.
casacore::ArrayLattice< T >::ArrayLattice | ( | const ArrayLattice< T > & | other | ) |
The copy constructor uses reference semantics.
|
virtual |
|
virtual |
Returns the maximum recommended number of pixels for a cursor.
For this class this is equal to the number of pixels in the lattice.
Reimplemented from casacore::Lattice< T >.
Array<T>& casacore::ArrayLattice< T >::asArray | ( | ) |
const Array<T>& casacore::ArrayLattice< T >::asArray | ( | ) | const |
|
virtual |
The lattice data can be referenced as an array section.
Reimplemented from casacore::LatticeBase.
|
virtual |
Make a copy of the object (reference semantics).
Implements casacore::Lattice< T >.
|
protectedvirtual |
Do the actual getting of an array of values.
Implements casacore::Lattice< T >.
|
protectedvirtual |
Do the actual putting of an array of values.
Implements casacore::Lattice< T >.
|
virtual |
Return the value of the single element located at the argument IPosition.
Note that operator() (defined in the base class) can also be used.
Reimplemented from casacore::Lattice< T >.
void casacore::ArrayLattice< T >::getIterSlice | ( | Array< T > & | buffer, |
const IPosition & | start, | ||
const IPosition & | end, | ||
const IPosition & | incr | ||
) |
Get a slice in an optimized way (specifically for ArrLatticeIter).
It returns in buffer
a reference to the lattice array.
|
virtual |
Is the lattice writable?
Reimplemented from casacore::LatticeBase.
|
virtual |
Check for internal consistency.
Returns False if something nasty has happened to the ArrayLattice.
Reimplemented from casacore::LatticeBase.
ArrayLattice<T>& casacore::ArrayLattice< T >::operator= | ( | const ArrayLattice< T > & | other | ) |
The assignment operator uses copy semantics.
|
virtual |
Put the value of a single element.
Reimplemented from casacore::Lattice< T >.
|
virtual |
Set all of the elements in the Lattice to a value.
Reimplemented from casacore::Lattice< T >.
|
virtual |
returns the shape of the ArrayLattice.
Implements casacore::LatticeBase.
|
private |
Definition at line 230 of file ArrayLattice.h.
|
private |
Definition at line 231 of file ArrayLattice.h.