SubImage.h

Classes

SubImage -- A (masked) subset of an ImageInterface object. (full description)

template <class T> class SubImage: public ImageInterface<T>

Interface

Public Members
SubImage()
SubImage (const ImageInterface<T>& image, AxesSpecifier=AxesSpecifier())
SubImage (ImageInterface<T>& image, Bool writableIfPossible, image=image())
SubImage (const ImageInterface<T>& image, const LattRegionHolder& region, AxesSpecifier=AxesSpecifier())
SubImage (ImageInterface<T>& image, const LattRegionHolder& region, Bool writableIfPossible, LattRegionHolder=LattRegionHolder())
SubImage (const ImageInterface<T>& image, const Slicer& slicer, AxesSpecifier=AxesSpecifier())
SubImage (ImageInterface<T>& image, const Slicer& slicer, Bool writableIfPossible, Slicer=Slicer())
SubImage (const SubImage<T>& other)
virtual ~SubImage()
SubImage<T>& operator= (const SubImage<T>& other)
virtual ImageInterface<T>* cloneII() const
virtual String imageType() const
virtual Bool isMasked() const
virtual Bool hasPixelMask() const
virtual const Lattice<Bool>& pixelMask() const
virtual Lattice<Bool>& pixelMask()
virtual Bool isPersistent() const
virtual Bool isPaged() const
virtual Bool canReferenceArray() const
virtual Bool isWritable() const
virtual const LatticeRegion* getRegionPtr() const
virtual IPosition shape() const
virtual uInt ndim() const
virtual uInt nelements() const
virtual Bool conform (const Lattice<T>& other) const
virtual uInt advisedMaxPixels() const
virtual T getAt (const IPosition& where) const
virtual void putAt (const T& value, const IPosition& where)
virtual void resize(const TiledShape& newShape)
virtual String name (Bool stripPath=False) const
virtual Bool ok() const
virtual Bool doGetSlice (Array<T>& buffer, const Slicer& section)
virtual void doPutSlice (const Array<T>& sourceBuffer, const IPosition& where, const IPosition& stride)
virtual Bool doGetMaskSlice (Array<Bool>& buffer, const Slicer& section)
virtual LatticeIterInterface<T>* makeIter (const T& navigator, Bool useRef) const
virtual IPosition doNiceCursorShape (uInt maxPixels) const
virtual Bool lock (FileLocker::LockType, uInt nattempts)
virtual void unlock()
virtual Bool hasLock (FileLocker::LockType) const
virtual void resync()
virtual void flush()
virtual void tempClose()
virtual void reopen()
Private Members
void setCoords (const CoordinateSystem& coords)
void setMembers (const ImageInterface<T>& image)
void convertIPosition(Vector<Float>& x, const IPosition& pos) const

Description

Review Status

Programs:
Tests:

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

To Do

Member Description

SubImage()

The default constructor

SubImage (const ImageInterface<T>& image, AxesSpecifier=AxesSpecifier())
SubImage (ImageInterface<T>& image, Bool writableIfPossible, image=image())

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).

SubImage (const ImageInterface<T>& image, const LattRegionHolder& region, AxesSpecifier=AxesSpecifier())
SubImage (ImageInterface<T>& image, const LattRegionHolder& region, Bool writableIfPossible, LattRegionHolder=LattRegionHolder())

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.

SubImage (const ImageInterface<T>& image, const Slicer& slicer, AxesSpecifier=AxesSpecifier())
SubImage (ImageInterface<T>& image, const Slicer& slicer, Bool writableIfPossible, Slicer=Slicer())

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.

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
virtual Lattice<Bool>& pixelMask()

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.

virtual Bool isPersistent() const

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.

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 LatticeRegion* getRegionPtr() 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. axes with a length of one).

virtual uInt ndim() const

Returns the number of axes in this SubImage. This includes all degenerate axes.

virtual uInt 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
virtual void putAt (const T& value, const IPosition& where)

Get or put a single element in the lattice.

virtual void resize(const TiledShape& newShape)

Function which changes the shape of the SubImage. Throws an exception as resizing a SubImage is not possible.

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 T& navigator, Bool useRef) const

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

virtual IPosition doNiceCursorShape (uInt maxPixels) const

Get the best cursor shape.

virtual Bool lock (FileLocker::LockType, uInt nattempts)
virtual void unlock()
virtual Bool hasLock (FileLocker::LockType) const
virtual void resync()
virtual void flush()
virtual void tempClose()
virtual void reopen()

Handle the (un)locking and syncing, etc..

void setCoords (const CoordinateSystem& coords)

Set the coordinates. It removes world axes if the subimage has axes removed.

void setMembers (const ImageInterface<T>& image)

Set the other members in the parent.

void convertIPosition(Vector<Float>& x, const IPosition& pos) const

Helper