Hold mathematical expressions involving ImageInterface objects. More...
#include <ImageExpr.h>
Public Member Functions | |
ImageExpr () | |
The default constructor. | |
ImageExpr (const LatticeExpr< T > &latticeExpr, const String &expr, const String &fileName=String()) | |
Construct an ImageExpr from a LatticeExpr. | |
ImageExpr (const LatticeExpr< T > &latticeExpr, const String &expr, const String &fileName, const LELImageCoord &imCoord) | |
Same as previous constructor, but the coordinates are taken from the given LELImageCoord object. | |
ImageExpr (const ImageExpr< T > &other) | |
Copy constructor (reference semantics). | |
~ImageExpr () | |
Destructor does nothing. | |
ImageExpr< T > & | operator= (const ImageExpr< T > &other) |
Assignment (reference semantics). | |
virtual ImageInterface< T > * | cloneII () const |
Make a copy of the object (reference semantics). | |
virtual void | save (const String &fileName) const |
Save the image in an AipsIO file with the given name. | |
void | setFileName (const String &name) |
Set the file name. | |
virtual String | imageType () const |
Get the image type (returns name of derived class). | |
virtual Bool | isMasked () const |
Has the object really a mask? | |
virtual const LatticeRegion * | getRegionPtr () const |
Get the region used. | |
virtual IPosition | shape () const |
return the shape of the ImageExpr | |
virtual void | resize (const TiledShape &newShape) |
Function which changes the shape of the ImageExpr. | |
virtual Bool | doGetMaskSlice (Array< Bool > &buffer, const Slicer §ion) |
Do the actual get of the mask data. | |
virtual Bool | doGetSlice (Array< T > &buffer, const Slicer &theSlice) |
Do the actual get of the data. | |
virtual void | doPutSlice (const Array< T > &sourceBuffer, const IPosition &where, const IPosition &stride) |
putSlice is not possible on an expression, so it throws an exception. | |
virtual String | name (Bool stripPath=False) const |
If the object is persistent, the file name is given. | |
virtual Bool | ok () const |
Check class invariants. | |
virtual LatticeIterInterface< T > * | makeIter (const LatticeNavigator &navigator, Bool useRef) const |
These are the implementations of the LatticeIterator letters. | |
virtual Bool | isWritable () const |
Returns False, as the ImageExpr is not writable. | |
virtual Bool | isPersistent () const |
Is the lattice persistent and can it be loaded by other processes as well? | |
virtual IPosition | doNiceCursorShape (uInt maxPixels) const |
Help the user pick a cursor for most efficient access if they only want pixel values and don't care about the order or dimension of the cursor. | |
virtual Bool | lock (FileLocker::LockType, uInt nattempts) |
Handle the (un)locking and syncing. | |
virtual void | unlock () |
virtual Bool | hasLock (FileLocker::LockType) const |
virtual void | resync () |
Resynchronize the Lattice object with the lattice file. | |
virtual void | tempClose () |
Temporarily close the lattice. | |
virtual void | reopen () |
Explicitly reopen the temporarily closed lattice. | |
const LatticeExpr< T > & | expression () const |
Get the lattice expression. | |
Private Attributes | |
LatticeExpr< T > | latticeExpr_p |
Unit | unit_p |
String | exprString_p |
String | fileName_p |
Hold mathematical expressions involving ImageInterface objects.
Public interface
This class holds a LatticeExpr object but inherits from ImageInterface hence ImageExpr
An ImageExpr object holds a LatticeExpr object which can be used to evaluate mathematical expressions involving Lattices. ImageExpr exists so that direct manipulation of LatticeExpr objects by methods expecting an ImageInterface, rather than a Lattice can occur.
The ImageExpr object is constructed from a LatticeExpr object, but only if the latter has true Coordinates associated with it. The ImageExpr object is not writable, so the ImageExpr object functions like a read only ImageInterface.
PagedImage<Float> a("imageB"); // Open PagedImages PagedImage<Float> b("imageB"); LatticeExprNode node(a+b); // Create ImageExpr LatticeExpr<Float> lExpr(node); ImageExpr<Float> iExpr(lExpr); LogOrigin or("imageImpl", "main()", WHERE); // Create statistics object LogIO logger(or); ImageStatistics<Float> stats(iExpr, logger); Bool ok = stats.display(); // Display statistics
The ImageExpr object is evaluated during the call to stats.dislay()
. Previously, the expression tree has been constructed, but not evaluated.
This enables one to evaluate expressions but not to have to write them out to an output image.
Definition at line 110 of file ImageExpr.h.
casacore::ImageExpr< T >::ImageExpr | ( | ) |
The default constructor.
casacore::ImageExpr< T >::ImageExpr | ( | const LatticeExpr< T > & | latticeExpr, | |
const String & | expr, | |||
const String & | fileName = String() | |||
) |
Construct an ImageExpr from a LatticeExpr.
The expr given should be the original expression string. The fileName argument is meant for ImageOpener. The coordinates are taken from the expression, usually the first image. An exception is thrown if the expression has no coordinates.
casacore::ImageExpr< T >::ImageExpr | ( | const LatticeExpr< T > & | latticeExpr, | |
const String & | expr, | |||
const String & | fileName, | |||
const LELImageCoord & | imCoord | |||
) |
Same as previous constructor, but the coordinates are taken from the given LELImageCoord object.
casacore::ImageExpr< T >::ImageExpr | ( | const ImageExpr< T > & | other | ) |
Copy constructor (reference semantics).
casacore::ImageExpr< T >::~ImageExpr | ( | ) |
Destructor does nothing.
virtual ImageInterface<T>* casacore::ImageExpr< T >::cloneII | ( | ) | const [virtual] |
Make a copy of the object (reference semantics).
Implements casacore::ImageInterface< T >.
virtual Bool casacore::ImageExpr< T >::doGetMaskSlice | ( | Array< Bool > & | buffer, | |
const Slicer & | section | |||
) | [virtual] |
Do the actual get of the mask data.
The return value is always False, thus the buffer does not reference another array.
Reimplemented from casacore::MaskedLattice< T >.
virtual Bool casacore::ImageExpr< T >::doGetSlice | ( | Array< T > & | buffer, | |
const Slicer & | theSlice | |||
) | [virtual] |
Do the actual get of the data.
Implements casacore::Lattice< T >.
virtual IPosition casacore::ImageExpr< T >::doNiceCursorShape | ( | uInt | maxPixels | ) | const [virtual] |
Help the user pick a cursor for most efficient access if they only want pixel values and don't care about the order or dimension of the cursor.
Reimplemented from casacore::LatticeBase.
virtual void casacore::ImageExpr< T >::doPutSlice | ( | const Array< T > & | sourceBuffer, | |
const IPosition & | where, | |||
const IPosition & | stride | |||
) | [virtual] |
putSlice is not possible on an expression, so it throws an exception.
Implements casacore::Lattice< T >.
const LatticeExpr<T>& casacore::ImageExpr< T >::expression | ( | ) | const [inline] |
Get the lattice expression.
Definition at line 214 of file ImageExpr.h.
virtual const LatticeRegion* casacore::ImageExpr< T >::getRegionPtr | ( | ) | const [virtual] |
Get the region used.
Implements casacore::MaskedLattice< T >.
virtual Bool casacore::ImageExpr< T >::hasLock | ( | FileLocker::LockType | ) | const [virtual] |
Reimplemented from casacore::LatticeBase.
virtual String casacore::ImageExpr< T >::imageType | ( | ) | const [virtual] |
Get the image type (returns name of derived class).
Implements casacore::ImageInterface< T >.
virtual Bool casacore::ImageExpr< T >::isMasked | ( | ) | const [virtual] |
Has the object really a mask?
Reimplemented from casacore::MaskedLattice< T >.
virtual Bool casacore::ImageExpr< T >::isPersistent | ( | ) | const [virtual] |
Is the lattice persistent and can it be loaded by other processes as well?
Reimplemented from casacore::LatticeBase.
virtual Bool casacore::ImageExpr< T >::isWritable | ( | ) | const [virtual] |
Returns False, as the ImageExpr is not writable.
Reimplemented from casacore::LatticeBase.
virtual Bool casacore::ImageExpr< T >::lock | ( | FileLocker::LockType | , | |
uInt | nattempts | |||
) | [virtual] |
Handle the (un)locking and syncing.
Reimplemented from casacore::LatticeBase.
virtual LatticeIterInterface<T>* casacore::ImageExpr< T >::makeIter | ( | const LatticeNavigator & | navigator, | |
Bool | useRef | |||
) | const [virtual] |
These are the implementations of the LatticeIterator letters.
Note: not for public use
Reimplemented from casacore::Lattice< T >.
virtual String casacore::ImageExpr< T >::name | ( | Bool | stripPath = False |
) | const [virtual] |
If the object is persistent, the file name is given.
Otherwise it returns the expression string given in the constructor.
Implements casacore::ImageInterface< T >.
virtual Bool casacore::ImageExpr< T >::ok | ( | ) | const [virtual] |
Check class invariants.
Implements casacore::ImageInterface< T >.
ImageExpr<T>& casacore::ImageExpr< T >::operator= | ( | const ImageExpr< T > & | other | ) |
Assignment (reference semantics).
Reimplemented from casacore::ImageInterface< T >.
virtual void casacore::ImageExpr< T >::reopen | ( | ) | [virtual] |
Explicitly reopen the temporarily closed lattice.
By default the function does not do anything at all.
Reimplemented from casacore::LatticeBase.
virtual void casacore::ImageExpr< T >::resize | ( | const TiledShape & | newShape | ) | [virtual] |
Function which changes the shape of the ImageExpr.
Throws an exception as ImageExpr is not writable.
Implements casacore::ImageInterface< T >.
virtual void casacore::ImageExpr< T >::resync | ( | ) | [virtual] |
Resynchronize the Lattice object with the lattice file.
This function is only useful if no read-locking is used, ie. if the table lock option is UserNoReadLocking or AutoNoReadLocking. In that cases the table system does not acquire a read-lock, thus does not synchronize itself automatically.
By default the function does not do anything at all.
Reimplemented from casacore::LatticeBase.
virtual void casacore::ImageExpr< T >::save | ( | const String & | fileName | ) | const [virtual] |
Save the image in an AipsIO file with the given name.
It can be opened by ImageOpener::openExpr.
Reimplemented from casacore::LatticeBase.
void casacore::ImageExpr< T >::setFileName | ( | const String & | name | ) | [inline] |
Set the file name.
Definition at line 147 of file ImageExpr.h.
virtual IPosition casacore::ImageExpr< T >::shape | ( | ) | const [virtual] |
return the shape of the ImageExpr
Implements casacore::LatticeBase.
virtual void casacore::ImageExpr< T >::tempClose | ( | ) | [virtual] |
Temporarily close the lattice.
It will be reopened automatically on the next access.
By default the function does not do anything at all.
Reimplemented from casacore::LatticeBase.
virtual void casacore::ImageExpr< T >::unlock | ( | ) | [virtual] |
Reimplemented from casacore::LatticeBase.
String casacore::ImageExpr< T >::exprString_p [private] |
Definition at line 221 of file ImageExpr.h.
String casacore::ImageExpr< T >::fileName_p [mutable, private] |
Definition at line 222 of file ImageExpr.h.
Referenced by casacore::ImageExpr< Bool >::setFileName().
LatticeExpr<T> casacore::ImageExpr< T >::latticeExpr_p [private] |
Definition at line 219 of file ImageExpr.h.
Referenced by casacore::ImageExpr< Bool >::expression().
Unit casacore::ImageExpr< T >::unit_p [private] |
Reimplemented from casacore::ImageInterface< T >.
Definition at line 220 of file ImageExpr.h.