casacore::SubImage< T > Class Template Reference

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

#include <SubImage.h>

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

List of all members.

Public Member Functions

 SubImage ()
 The default constructor.
 SubImage (const 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 ImageAttrHandlerattrHandler (Bool createHandler=False)
 Get access to the attribute handler (of the parent image).
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)
 Set the coordinates.
void setCoords (const CoordinateSystem &coords)
void setMembers ()
 Set the other members to the one in itsImagePtr.
void setMembers (const Slicer &slicer)
 Set the members to the subset (in particular, the beamset).
void convertIPosition (Vector< Float > &x, const IPosition &pos) const
 Helper.

Private Attributes

ImageInterface< T > * itsImagePtr
SubLattice< T > * itsSubLatPtr

Detailed Description

template<class T>
class casacore::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 86 of file SubImage.h.


Constructor & Destructor Documentation

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

The default constructor.

template<class T>
casacore::SubImage< T >::SubImage ( const 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>
casacore::SubImage< T >::SubImage ( ImageInterface< T > &  image,
Bool  writableIfPossible,
AxesSpecifier  = AxesSpecifier(),
Bool  preserveAxesOrder = False 
)
template<class T>
casacore::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>
casacore::SubImage< T >::SubImage ( ImageInterface< T > &  image,
const LattRegionHolder region,
Bool  writableIfPossible,
AxesSpecifier  = AxesSpecifier(),
Bool  preserveAxesOrder = False 
)
template<class T>
casacore::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>
casacore::SubImage< T >::SubImage ( ImageInterface< T > &  image,
const Slicer slicer,
Bool  writableIfPossible,
AxesSpecifier  = AxesSpecifier(),
Bool  preserveAxesOrder = False 
)
template<class T>
casacore::SubImage< T >::SubImage ( const SubImage< T > &  other  ) 

Copy constructor (reference semantics).

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

Member Function Documentation

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

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

Reimplemented from casacore::Lattice< T >.

template<class T>
virtual ImageAttrHandler& casacore::SubImage< T >::attrHandler ( Bool  createHandler = False  )  [virtual]

Get access to the attribute handler (of the parent image).

If a handler keyword does not exist yet, it is created if createHandler is set. Otherwise the handler is empty and no groups can be created for it.

Reimplemented from casacore::ImageInterface< T >.

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

Can the lattice data be referenced as an array section?

Reimplemented from casacore::LatticeBase.

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

Make a copy of the object (reference semantics).

Implements casacore::ImageInterface< T >.

template<class T>
virtual Bool casacore::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 casacore::SubImage< T >::convertIPosition ( Vector< Float > &  x,
const IPosition pos 
) const [private]

Helper.

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

Get a section of the mask.

Reimplemented from casacore::MaskedLattice< T >.

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

Do the actual getting of an array of values.

Implements casacore::Lattice< T >.

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

Get the best cursor shape.

Reimplemented from casacore::LatticeBase.

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

Do the actual getting of an array of values.

Implements casacore::Lattice< T >.

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

Flush the data (but do not unlock).


By default the function does not do anything at all.

Reimplemented from casacore::LatticeBase.

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

Get or put a single element in the lattice.

Reimplemented from casacore::Lattice< T >.

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

Get the region/mask object describing this subImage.

Implements casacore::MaskedLattice< T >.

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

Reimplemented from casacore::LatticeBase.

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

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

Reimplemented from casacore::MaskedLattice< T >.

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

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

Implements casacore::ImageInterface< T >.

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

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

Reimplemented from casacore::MaskedLattice< T >.

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

Is the SubImage paged to disk?

Reimplemented from casacore::LatticeBase.

template<class T>
virtual Bool casacore::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 casacore::LatticeBase.

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

Is the SubImage writable?

Reimplemented from casacore::LatticeBase.

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

Handle the (un)locking and syncing, etc.

Reimplemented from casacore::LatticeBase.

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

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

Return the name of the parent ImageInterface object.

Implements casacore::ImageInterface< T >.

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

Returns the number of axes in this SubImage.

This includes all degenerate axes.

Reimplemented from casacore::LatticeBase.

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

Returns the total number of elements in this SubImage.

Reimplemented from casacore::LatticeBase.

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

Check class invariants.

Implements casacore::ImageInterface< T >.

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

Assignment (reference semantics).

Reimplemented from casacore::ImageInterface< T >.

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

Reimplemented from casacore::MaskedLattice< T >.

template<class T>
virtual const Lattice<Bool>& casacore::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 casacore::MaskedLattice< T >.

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

Put the value of a single element.


The default implementation uses putSlice.

Reimplemented from casacore::Lattice< T >.

template<class T>
virtual void casacore::SubImage< T >::reopen (  )  [virtual]

Explicitly reopen the temporarily closed lattice.


By default the function does not do anything at all.

Reimplemented from casacore::LatticeBase.

template<class T>
virtual void casacore::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 casacore::ImageInterface< T >.

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

template<class T>
void casacore::SubImage< T >::setCoords ( const CoordinateSystem coords  )  [private]
template<class T>
void casacore::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 casacore::SubImage< T >::setMembers ( const Slicer slicer  )  [private]

Set the members to the subset (in particular, the beamset).

template<class T>
void casacore::SubImage< T >::setMembers (  )  [private]

Set the other members to the one in itsImagePtr.

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

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

axes with a length of one).

Implements casacore::LatticeBase.

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

template<class T>
virtual void casacore::SubImage< T >::unlock (  )  [virtual]

Reimplemented from casacore::LatticeBase.


Member Data Documentation

template<class T>
ImageInterface<T>* casacore::SubImage< T >::itsImagePtr [private]

Definition at line 272 of file SubImage.h.

template<class T>
SubLattice<T>* casacore::SubImage< T >::itsSubLatPtr [private]

Definition at line 273 of file SubImage.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1