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

A (masked) subset of an ImageInterface object. More...

#include <SubImage.h>

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

List of all members.

Public Member Functions

 SubImage ()
 The default constructor.
 SubImage (ImageInterface< T > &image, AxesSpecifier=AxesSpecifier(), Bool preserveAxesOrder=False)
 Create a SubImage from a Image.
 SubImage (ImageInterface< T > &image, Bool writableIfPossible, AxesSpecifier=AxesSpecifier(), Bool preserveAxesOrder=False)
 SubImage (const ImageInterface< T > &image, const LattRegionHolder &region, AxesSpecifier=AxesSpecifier(), Bool preserveAxesOrder=False)
 Create a SubImage from the given Image and region.
 SubImage (ImageInterface< T > &image, const LattRegionHolder &region, Bool writableIfPossible, AxesSpecifier=AxesSpecifier(), Bool preserveAxesOrder=False)
 SubImage (const ImageInterface< T > &image, const Slicer &slicer, AxesSpecifier=AxesSpecifier(), Bool preserveAxesOrder=False)
 Create a SubImage from the given Image and slicer.
 SubImage (ImageInterface< T > &image, const Slicer &slicer, Bool writableIfPossible, AxesSpecifier=AxesSpecifier(), Bool preserveAxesOrder=False)
 SubImage (const SubImage< T > &other)
 Copy constructor (reference semantics).
virtual ~SubImage ()
SubImage< T > & operator= (const SubImage< 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
 Is the SubImage masked? It is if its parent image or its region is masked.
virtual Bool hasPixelMask () const
 Does the image object have a pixelmask? It does if its parent has a pixelmask.
virtual const Lattice< Bool > & pixelMask () const
 Get access to the pixelmask in use (thus to the pixelmask of the parent).
virtual Lattice< Bool > & pixelMask ()
virtual Bool isPersistent () const
 A SubImage is persistent if no region is applied to the parent image.
virtual Bool isPaged () const
 Is the SubImage paged to disk?
virtual Bool canReferenceArray () const
 Can the lattice data be referenced as an array section?
virtual Bool isWritable () const
 Is the SubImage writable?
virtual const LatticeRegiongetRegionPtr () const
 Get the region/mask object describing this subImage.
virtual IPosition shape () const
 Returns the shape of the SubImage including all degenerate axes (i.e.
virtual uInt ndim () const
 Returns the number of axes in this SubImage.
virtual size_t nelements () const
 Returns the total number of elements in this SubImage.
virtual Bool conform (const Lattice< T > &other) const
 returns a value of "True" if this instance of Lattice and 'other' have the same shape, otherwise returns a value of "False".
virtual uInt advisedMaxPixels () const
 This function returns the recommended maximum number of pixels to include in the cursor of an iterator.
virtual T getAt (const IPosition &where) const
 Get or put a single element in the lattice.
virtual void putAt (const T &value, const IPosition &where)
 Put the value of a single element.
virtual void resize (const TiledShape &newShape)
 Function which changes the shape of the SubImage.
virtual String name (Bool stripPath=False) const
 Return the name of the parent ImageInterface object.
virtual Bool ok () const
 Check class invariants.
virtual Bool doGetSlice (Array< T > &buffer, const Slicer &section)
 Do the actual getting of an array of values.
virtual void doPutSlice (const Array< T > &sourceBuffer, const IPosition &where, const IPosition &stride)
 Do the actual getting of an array of values.
virtual Bool doGetMaskSlice (Array< Bool > &buffer, const Slicer &section)
 Get a section of the mask.
virtual LatticeIterInterface< T > * makeIter (const LatticeNavigator &navigator, Bool useRef) const
 This function is used by the LatticeIterator class to generate an iterator of the correct type for this Lattice.
virtual IPosition doNiceCursorShape (uInt maxPixels) const
 Get the best cursor shape.
virtual Bool lock (FileLocker::LockType, uInt nattempts)
 Handle the (un)locking and syncing, etc.
virtual void unlock ()
virtual Bool hasLock (FileLocker::LockType) const
virtual void resync ()
 Resynchronize the Lattice object with the lattice file.
virtual void flush ()
 Flush the data (but do not unlock).
virtual void tempClose ()
 Temporarily close the lattice.
virtual void reopen ()
 Explicitly reopen the temporarily closed lattice.

Private Member Functions

void setCoords (const CoordinateSystem &coords, Bool preserveAxesOrder)
 
   

void setMembers (const ImageBeamSet &hpBeams)
 Set the other members in the parent.
void convertIPosition (Vector< Float > &x, const IPosition &pos) const
 Helper.
ImageBeamSet _beamsForSubImage (const IPosition &subShape, const CoordinateSystem &subCoords)
 Given an original image shape and coordinate system and a subimage shape and coordinate system, get the corresponding per plane beam array.

Private Attributes

std::auto_ptr< ImageInterface
< T > > 
itsImagePtr
std::auto_ptr< SubLattice< T > > itsSubLatPtr

Detailed Description

template<class T>
class casa::SubImage< T >

A (masked) subset of an ImageInterface object.

Intended use:

Public interface

Review Status

Test programs:
tSubImage

Prerequisite

Synopsis

Class SubImage has to be used to apply a region or mask to an image. Several functions are inherited from SubLattice and not declared in this class.

Using an AxesSpecifier object it is possible to remove some or all degenerate axes (i.e. axes with length 1) to get an image with a lower dimensionality.

Example

Motivation

Definition at line 87 of file SubImage.h.


Constructor & Destructor Documentation

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

The default constructor.

template<class T>
casa::SubImage< T >::SubImage ( ImageInterface< T > &  image,
AxesSpecifier  = AxesSpecifier(),
Bool  preserveAxesOrder = False 
)

Create a SubImage from a Image.

This results in a SubImage without a real mask.
The "const Image" version yields a non-writable SubImage, while for the non-const version one has to specify if the SubImage should be writable (if the original image is non-writable, the SubImage is always set to non-writable). If preserveAxesOrder is True, the axes order will be preserved. This is only important in cases where pixel axes are to be dropped, if not the axes order will be preserved. If False and pixel axes are dropped, the order of the coordinates will be preserved, but not necessarily the axes.

template<class T>
casa::SubImage< T >::SubImage ( ImageInterface< T > &  image,
Bool  writableIfPossible,
AxesSpecifier  = AxesSpecifier(),
Bool  preserveAxesOrder = False 
)
template<class T>
casa::SubImage< T >::SubImage ( const ImageInterface< T > &  image,
const LattRegionHolder region,
AxesSpecifier  = AxesSpecifier(),
Bool  preserveAxesOrder = False 
)

Create a SubImage from the given Image and region.


An exception is thrown if the image shape used in the region differs from the shape of the image.

template<class T>
casa::SubImage< T >::SubImage ( ImageInterface< T > &  image,
const LattRegionHolder region,
Bool  writableIfPossible,
AxesSpecifier  = AxesSpecifier(),
Bool  preserveAxesOrder = False 
)
template<class T>
casa::SubImage< T >::SubImage ( const ImageInterface< T > &  image,
const Slicer slicer,
AxesSpecifier  = AxesSpecifier(),
Bool  preserveAxesOrder = False 
)

Create a SubImage from the given Image and slicer.

The slicer can be strided.
An exception is thrown if the slicer exceeds the image shape.

template<class T>
casa::SubImage< T >::SubImage ( ImageInterface< T > &  image,
const Slicer slicer,
Bool  writableIfPossible,
AxesSpecifier  = AxesSpecifier(),
Bool  preserveAxesOrder = False 
)
template<class T>
casa::SubImage< T >::SubImage ( const SubImage< T > &  other)

Copy constructor (reference semantics).

template<class T>
virtual casa::SubImage< T >::~SubImage ( ) [virtual]

Member Function Documentation

template<class T>
ImageBeamSet casa::SubImage< T >::_beamsForSubImage ( const IPosition subShape,
const CoordinateSystem subCoords 
) [private]

Given an original image shape and coordinate system and a subimage shape and coordinate system, get the corresponding per plane beam array.

The subimage coordinate system must have been made with origCoords.subimage() and both must have the same types of axes in the same order. The shapes must have the same number of dimensions and all members of subShape must be greater or equal to 1 and less than the corresponding members of origShape.

template<class T>
virtual uInt casa::SubImage< T >::advisedMaxPixels ( ) const [virtual]

This function returns the recommended maximum number of pixels to include in the cursor of an iterator.

Reimplemented from casa::Lattice< T >.

template<class T>
virtual Bool casa::SubImage< T >::canReferenceArray ( ) const [virtual]

Can the lattice data be referenced as an array section?

Reimplemented from casa::LatticeBase.

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

Make a copy of the object (reference semantics).

Implements casa::ImageInterface< T >.

template<class T>
virtual Bool casa::SubImage< T >::conform ( const Lattice< T > &  other) const [virtual]

returns a value of "True" if this instance of Lattice and 'other' have the same shape, otherwise returns a value of "False".

template<class T>
void casa::SubImage< T >::convertIPosition ( Vector< Float > &  x,
const IPosition pos 
) const [private]

Helper.

template<class T>
virtual Bool casa::SubImage< T >::doGetMaskSlice ( Array< Bool > &  buffer,
const Slicer section 
) [virtual]

Get a section of the mask.

Reimplemented from casa::MaskedLattice< T >.

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

Do the actual getting of an array of values.

Implements casa::Lattice< T >.

template<class T>
virtual IPosition casa::SubImage< T >::doNiceCursorShape ( uInt  maxPixels) const [virtual]

Get the best cursor shape.

Reimplemented from casa::LatticeBase.

template<class T>
virtual void casa::SubImage< T >::doPutSlice ( const Array< T > &  sourceBuffer,
const IPosition where,
const IPosition stride 
) [virtual]

Do the actual getting of an array of values.

Implements casa::Lattice< T >.

template<class T>
virtual void casa::SubImage< T >::flush ( ) [virtual]

Flush the data (but do not unlock).


By default the function does not do anything at all.

Reimplemented from casa::LatticeBase.

template<class T>
virtual T casa::SubImage< T >::getAt ( const IPosition where) const [virtual]

Get or put a single element in the lattice.

Reimplemented from casa::Lattice< T >.

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

Get the region/mask object describing this subImage.

Implements casa::MaskedLattice< T >.

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

Reimplemented from casa::LatticeBase.

template<class T>
virtual Bool casa::SubImage< T >::hasPixelMask ( ) const [virtual]

Does the image object have a pixelmask? It does if its parent has a pixelmask.

Reimplemented from casa::MaskedLattice< T >.

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

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

Implements casa::ImageInterface< T >.

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

Is the SubImage masked? It is if its parent image or its region is masked.

Reimplemented from casa::MaskedLattice< T >.

template<class T>
virtual Bool casa::SubImage< T >::isPaged ( ) const [virtual]

Is the SubImage paged to disk?

Reimplemented from casa::LatticeBase.

template<class T>
virtual Bool casa::SubImage< T >::isPersistent ( ) const [virtual]

A SubImage is persistent if no region is applied to the parent image.

That is true if the region has the same shape as the parent image and the region has no mask.

Reimplemented from casa::LatticeBase.

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

Is the SubImage writable?

Reimplemented from casa::LatticeBase.

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

Handle the (un)locking and syncing, etc.

Reimplemented from casa::LatticeBase.

template<class T>
virtual LatticeIterInterface<T>* casa::SubImage< T >::makeIter ( const LatticeNavigator navigator,
Bool  useRef 
) const [virtual]

This function is used by the LatticeIterator class to generate an iterator of the correct type for this Lattice.

Not recommended for general use.

Reimplemented from casa::Lattice< T >.

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

Return the name of the parent ImageInterface object.

Implements casa::ImageInterface< T >.

template<class T>
virtual uInt casa::SubImage< T >::ndim ( ) const [virtual]

Returns the number of axes in this SubImage.

This includes all degenerate axes.

Reimplemented from casa::LatticeBase.

template<class T>
virtual size_t casa::SubImage< T >::nelements ( ) const [virtual]

Returns the total number of elements in this SubImage.

Reimplemented from casa::LatticeBase.

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

Check class invariants.

Implements casa::ImageInterface< T >.

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

Assignment (reference semantics).

template<class T>
virtual const Lattice<Bool>& casa::SubImage< T >::pixelMask ( ) const [virtual]

Get access to the pixelmask in use (thus to the pixelmask of the parent).

An exception is thrown if the parent does not have a pixelmask.

Reimplemented from casa::MaskedLattice< T >.

template<class T>
virtual Lattice<Bool>& casa::SubImage< T >::pixelMask ( ) [virtual]

Reimplemented from casa::MaskedLattice< T >.

template<class T>
virtual void casa::SubImage< T >::putAt ( const T &  value,
const IPosition where 
) [virtual]

Put the value of a single element.


The default implementation uses putSlice.

Reimplemented from casa::Lattice< T >.

template<class T>
virtual void casa::SubImage< 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::SubImage< T >::resize ( const TiledShape newShape) [virtual]

Function which changes the shape of the SubImage.

Throws an exception as resizing a SubImage is not possible.

Implements casa::ImageInterface< T >.

template<class T>
virtual void casa::SubImage< 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>
void casa::SubImage< T >::setCoords ( const CoordinateSystem coords,
Bool  preserveAxesOrder 
) [private]

   

Set the coordinates. It removes world axes if the subimage has axes removed. If preserveAxesOrder is True and axes are dropped, it will preserve the order of the axes as well as the order of the coordinates.

template<class T>
void casa::SubImage< T >::setMembers ( const ImageBeamSet hpBeams) [private]

Set the other members in the parent.

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

Returns the shape of the SubImage including all degenerate axes (i.e.

axes with a length of one).

Implements casa::LatticeBase.

template<class T>
virtual void casa::SubImage< 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::SubImage< T >::unlock ( ) [virtual]

Reimplemented from casa::LatticeBase.


Member Data Documentation

template<class T>
std::auto_ptr<ImageInterface<T> > casa::SubImage< T >::itsImagePtr [private]

Definition at line 259 of file SubImage.h.

template<class T>
std::auto_ptr<SubLattice<T> > casa::SubImage< T >::itsSubLatPtr [private]

Definition at line 260 of file SubImage.h.


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