casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Attributes
casa::ImageExpr< T > Class Template Reference

Hold mathematical expressions involving ImageInterface objects. More...

#include <ImageExpr.h>

Inheritance diagram for casa::ImageExpr< T >:
casa::ImageInterface< T > casa::MaskedLattice< T > casa::Lattice< T > casa::LatticeBase

List of all members.

Public Member Functions

 ImageExpr ()
 The default constructor.
 ImageExpr (const LatticeExpr< T > &latticeExpr, const String &name)
 Construct an ImageExpr from a LatticeExpr.
 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 String imageType () const
 Get the image type (returns name of derived class).
virtual Bool isMasked () const
 Has the object really a mask?
virtual const LatticeRegiongetRegionPtr () 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 &section)
 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
 Return the name of the current ImageInterface object.
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 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
Lattice< Bool > * pBool_p
 These are used to return null object by reference.
Record rec_p
String name_p

Detailed Description

template<class T>
class casa::ImageExpr< T >

Hold mathematical expressions involving ImageInterface objects.

Intended use:

Public interface

Review Status

Test programs:
tImageExpr

Prerequisite

Etymology

This class holds a LatticeExpr object but inherits from ImageInterface hence ImageExpr

Synopsis

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.

Example

       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.

Motivation

This enables one to evaluate expressions but not to have to write them out to an output image.

Definition at line 109 of file ImageExpr.h.


Constructor & Destructor Documentation

template<class T>
casa::ImageExpr< T >::ImageExpr ( )

The default constructor.

template<class T>
casa::ImageExpr< T >::ImageExpr ( const LatticeExpr< T > &  latticeExpr,
const String name 
)

Construct an ImageExpr from a LatticeExpr.

The name given could be the original expression string. The prefix "Expression: " is added to the name if not empty. The function name() returns this name (including possible prefix).

template<class T>
casa::ImageExpr< T >::ImageExpr ( const ImageExpr< T > &  other)

Copy constructor (reference semantics)

template<class T>
casa::ImageExpr< T >::~ImageExpr ( )

Destructor does nothing.


Member Function Documentation

template<class T>
virtual ImageInterface<T>* casa::ImageExpr< T >::cloneII ( ) const [virtual]

Make a copy of the object (reference semantics).

Implements casa::ImageInterface< T >.

template<class T>
virtual Bool casa::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 casa::MaskedLattice< T >.

template<class T>
virtual Bool casa::ImageExpr< T >::doGetSlice ( Array< T > &  buffer,
const Slicer theSlice 
) [virtual]

Do the actual get of the data.

Implements casa::Lattice< T >.

template<class T>
virtual IPosition casa::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 casa::LatticeBase.

template<class T>
virtual void casa::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 casa::Lattice< T >.

template<class T>
const LatticeExpr<T>& casa::ImageExpr< T >::expression ( ) const [inline]

Get the lattice expression.

Definition at line 194 of file ImageExpr.h.

template<class T>
virtual const LatticeRegion* casa::ImageExpr< T >::getRegionPtr ( ) const [virtual]

Get the region used.

Implements casa::MaskedLattice< T >.

template<class T>
virtual Bool casa::ImageExpr< T >::hasLock ( FileLocker::LockType  ) const [virtual]

Reimplemented from casa::LatticeBase.

template<class T>
virtual String casa::ImageExpr< T >::imageType ( ) const [virtual]

Get the image type (returns name of derived class).

Implements casa::ImageInterface< T >.

template<class T>
virtual Bool casa::ImageExpr< T >::isMasked ( ) const [virtual]

Has the object really a mask?

Reimplemented from casa::MaskedLattice< T >.

template<class T>
virtual Bool casa::ImageExpr< T >::isWritable ( ) const [virtual]

Returns False, as the ImageExpr is not writable.

Reimplemented from casa::LatticeBase.

template<class T>
virtual Bool casa::ImageExpr< T >::lock ( FileLocker::LockType  ,
uInt  nattempts 
) [virtual]

Handle the (un)locking and syncing.

Reimplemented from casa::LatticeBase.

template<class T>
virtual LatticeIterInterface<T>* casa::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 casa::Lattice< T >.

template<class T>
virtual String casa::ImageExpr< T >::name ( Bool  stripPath = False) const [virtual]

Return the name of the current ImageInterface object.

Returns the expression string given in the constructor.

Implements casa::ImageInterface< T >.

template<class T>
virtual Bool casa::ImageExpr< T >::ok ( ) const [virtual]

Check class invariants.

Implements casa::ImageInterface< T >.

template<class T>
ImageExpr<T>& casa::ImageExpr< T >::operator= ( const ImageExpr< T > &  other)

Assignment (reference semantics)

template<class T>
virtual void casa::ImageExpr< T >::reopen ( ) [virtual]

Explicitly reopen the temporarily closed lattice.


By default the function does not do anything at all.

Reimplemented from casa::LatticeBase.

template<class T>
virtual void casa::ImageExpr< T >::resize ( const TiledShape newShape) [virtual]

Function which changes the shape of the ImageExpr.

Throws an exception as ImageExpr is not writable.

Implements casa::ImageInterface< T >.

template<class T>
virtual void casa::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 casa::LatticeBase.

template<class T>
virtual IPosition casa::ImageExpr< T >::shape ( ) const [virtual]

return the shape of the ImageExpr

Implements casa::LatticeBase.

template<class T>
virtual void casa::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 casa::LatticeBase.

template<class T>
virtual void casa::ImageExpr< T >::unlock ( ) [virtual]

Reimplemented from casa::LatticeBase.


Member Data Documentation

template<class T>
LatticeExpr<T> casa::ImageExpr< T >::latticeExpr_p [private]

Definition at line 199 of file ImageExpr.h.

Referenced by casa::ImageExpr< Bool >::expression().

template<class T>
String casa::ImageExpr< T >::name_p [private]

Definition at line 206 of file ImageExpr.h.

template<class T>
Lattice<Bool>* casa::ImageExpr< T >::pBool_p [private]

These are used to return null object by reference.

Definition at line 204 of file ImageExpr.h.

template<class T>
Record casa::ImageExpr< T >::rec_p [private]

Definition at line 205 of file ImageExpr.h.

template<class T>
Unit casa::ImageExpr< T >::unit_p [private]

Reimplemented from casa::ImageInterface< T >.

Definition at line 200 of file ImageExpr.h.


The documentation for this class was generated from the following file: