casacore::ImageConcat< T > Class Template Reference

Concatenates images along a specified axis. More...

#include <ImageConcat.h>

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

List of all members.

Public Member Functions

 ImageConcat (uInt axis, Bool tempClose=True)
 Constructor.
 ImageConcat (AipsIO &aio, const String &fileName)
 Construct the object from an AipsIO file with the given name.
 ImageConcat ()
 Default constructor, Sets the concatenation axis to 0.
 ImageConcat (const ImageConcat< T > &other)
 Copy constructor (reference semantics).
virtual ~ImageConcat ()
 Destructor.
ImageConcat< T > & operator= (const ImageConcat< T > &other)
 Assignment operator (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.
virtual String imageType () const
 Get the image type (returns name of derived class).
virtual Bool isPersistent () const
 Is the lattice persistent and can it be loaded by other processes as well?
void setImage (ImageInterface< T > &image, Bool relax)
 Sets a new image into the list to be concatenated.
void setLattice (MaskedLattice< T > &lattice)
 Add a clone of the lattice to the list to be concatenated.
uInt nimages () const
 Return the number of images/lattices set so far.
uInt axis () const
 Returns the current concatenation axis (0 relative).
uInt imageDim () const
 Returns the number of dimensions of the *input* images/lattices Returns 0 if none yet set.
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.
virtual String name (Bool stripPath=False) const
 Return the name of the current ImageInterface object.
virtual Bool isMasked () const
 Has the object really a mask?
virtual Bool hasPixelMask () const
 Does the image have a pixelmask?
virtual const Lattice< Bool > & pixelMask () const
 Get access to the pixelmask.
virtual Lattice< Bool > & pixelMask ()
virtual const LatticeRegiongetRegionPtr () const
 Get the region used (always returns 0).
virtual Bool isWritable () const
 If all of the underlying lattices are writable returns True.
virtual IPosition shape () const
 Return the shape of the concatenated image.
virtual IPosition doNiceCursorShape (uInt maxPixels) const
 Return the best cursor shape.
virtual Bool doGetSlice (Array< T > &buffer, const Slicer &section)
 Do the actual get of the data.
virtual Bool doGetMaskSlice (Array< Bool > &buffer, const Slicer &section)
 Do the actual get of the mask data.
virtual void doPutSlice (const Array< T > &sourceBuffer, const IPosition &where, const IPosition &stride)
 Do the actual put of the data into the Lattice.
virtual void resize (const TiledShape &)
 Throws an excpetion as you cannot reshape an ImageConcat 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.

Private Member Functions

Double coordConvert (Int &worldAxis, LogIO &os, const CoordinateSystem &cSys, uInt axis, Double pixelCoord) const
void _checkContiguous (const IPosition &shape1, const CoordinateSystem &cSys1, const CoordinateSystem &cSys2, LogIO &os, uInt axis, Bool relax)
void checkNonConcatAxisCoordinates (LogIO &os, const ImageInterface< T > &image, Bool relax)
Vector< IntmakeNewStokes (const Vector< Int > &stokes1, const Vector< Int > &stokes2)
void setCoordinates ()
 Updates the CoordinateSystem in the ImageConcat image.
void _updatePixelAndWorldValues (uInt iIm)

Private Attributes

LatticeConcat< T > latticeConcat_p
Bool warnAxisNames_p
Bool warnAxisUnits_p
Bool warnImageUnits_p
Bool warnContig_p
Bool warnRefPix_p
Bool warnRefVal_p
Bool warnInc_p
Bool warnTab_p
Bool isContig_p
String fileName_p
Vector< BoolisImage_p
Vector< DoublepixelValues_p
Vector< DoubleworldValues_p
Coordinate::Type originalAxisType_p

Detailed Description

template<class T>
class casacore::ImageConcat< T >

Concatenates images along a specified axis.

Intended use:

Public interface

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Etymology

This is a class designed to concatenate images along a specified axis

Synopsis

This is a class designed to concatenate images along a specified axis. This means you can join them together. E.g., join images of shape [10,20,30] and [10,20,40] into a lattice of shape [10,20,70].

The ImageConcat object does not copy the input images, it just references them. You can use the Lattice<T>::copyData(Lattice<T>) function to fill an output image with the concatenated input images

If you use the putSlice function, be aware that it will change the underlying images if they are writable.

You can also concatenate a lattice to an image.

Example

 IPosition shape(2, 10, 20);
 PagedImage<Float> im1(shape, CoordinateUtil::defaultCoords2D(),
 "tImageConcat_tmp1.img");
 im1.set(1.0);
 PagedImage<Float> im2(shape, CoordinateUtil::defaultCoords2D(),
 "tImageConcat_tmp2.img");
 im2.set(2.0);
 
// Make concatenator for axis 0
 
 ImageConcat<Float> concat(0);
 
// Relax coordinate constraints
 
 concat.setImage(im1, True);
 concat.setImage(im2, True);
 
// Make output image  and mask (if required, which it will be in this case)
 
 PagedImage<Float> im3(concat.shape(), CoordinateUtil::defaultCoords2D(),
 "tImageConcat_tmp3.img");
 
// Copy to output
 
 im3.copyData(concat);

See tImageConcat.cc for more examples.

Motivation

Image concatentation is a useful enduser requirement.

To Do

Definition at line 125 of file ImageConcat.h.


Constructor & Destructor Documentation

template<class T>
casacore::ImageConcat< T >::ImageConcat ( uInt  axis,
Bool  tempClose = True 
) [explicit]

Constructor.

Specify the pixel axis for concatenation

template<class T>
casacore::ImageConcat< T >::ImageConcat ( AipsIO aio,
const String fileName 
)

Construct the object from an AipsIO file with the given name.

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

Default constructor, Sets the concatenation axis to 0.

template<class T>
casacore::ImageConcat< T >::ImageConcat ( const ImageConcat< T > &  other  ) 

Copy constructor (reference semantics).

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

Destructor.


Member Function Documentation

template<class T>
void casacore::ImageConcat< T >::_checkContiguous ( const IPosition shape1,
const CoordinateSystem cSys1,
const CoordinateSystem cSys2,
LogIO os,
uInt  axis,
Bool  relax 
) [private]
template<class T>
void casacore::ImageConcat< T >::_updatePixelAndWorldValues ( uInt  iIm  )  [private]
template<class T>
uInt casacore::ImageConcat< T >::axis (  )  const [inline]

Returns the current concatenation axis (0 relative).

Definition at line 179 of file ImageConcat.h.

References casacore::ImageConcat< T >::latticeConcat_p.

template<class T>
void casacore::ImageConcat< T >::checkNonConcatAxisCoordinates ( LogIO os,
const ImageInterface< T > &  image,
Bool  relax 
) [private]
template<class T>
virtual ImageInterface<T>* casacore::ImageConcat< T >::cloneII (  )  const [virtual]

Make a copy of the object (reference semantics).

Implements casacore::ImageInterface< T >.

template<class T>
Double casacore::ImageConcat< T >::coordConvert ( Int worldAxis,
LogIO os,
const CoordinateSystem cSys,
uInt  axis,
Double  pixelCoord 
) const [private]
template<class T>
virtual Bool casacore::ImageConcat< 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. Generally the user should use function getMaskSlice

Reimplemented from casacore::MaskedLattice< T >.

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

Do the actual get of the data.

The return value is always False, thus the buffer does not reference another array. Generally the user should use function getSlice

Implements casacore::Lattice< T >.

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

Return the best cursor shape.

This isn't very meaningful for an ImageConcat Image since it isn't on disk ! But if you do copy it out, this is what you should use. The maxPixels aregument is ignored.

Reimplemented from casacore::LatticeBase.

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

Do the actual put of the data into the Lattice.

This will change the underlying images (if they are writable) that were used to create the ImageConcat object. It throws an exception if not writable. Generally the user should use function putSlice

Implements casacore::Lattice< T >.

template<class T>
virtual void casacore::ImageConcat< 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 const LatticeRegion* casacore::ImageConcat< T >::getRegionPtr (  )  const [virtual]

Get the region used (always returns 0).

Implements casacore::MaskedLattice< T >.

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

Reimplemented from casacore::LatticeBase.

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

Does the image have a pixelmask?

Reimplemented from casacore::MaskedLattice< T >.

template<class T>
uInt casacore::ImageConcat< T >::imageDim (  )  const [inline]

Returns the number of dimensions of the *input* images/lattices Returns 0 if none yet set.

Definition at line 184 of file ImageConcat.h.

References casacore::ImageConcat< T >::latticeConcat_p.

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

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

Implements casacore::ImageInterface< T >.

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

Has the object really a mask?

Reimplemented from casacore::MaskedLattice< T >.

template<class T>
virtual Bool casacore::ImageConcat< T >::isPersistent (  )  const [virtual]

Is the lattice persistent and can it be loaded by other processes as well?

Reimplemented from casacore::LatticeBase.

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

If all of the underlying lattices are writable returns True.

Reimplemented from casacore::LatticeBase.

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

template<class T>
Vector<Int> casacore::ImageConcat< T >::makeNewStokes ( const Vector< Int > &  stokes1,
const Vector< Int > &  stokes2 
) [private]
template<class T>
virtual String casacore::ImageConcat< T >::name ( Bool  stripPath = False  )  const [virtual]

Return the name of the current ImageInterface object.

If the object is persistent, it returns its file name. Otherwise it returns the string "Concatenation :"

Implements casacore::ImageInterface< T >.

template<class T>
uInt casacore::ImageConcat< T >::nimages (  )  const [inline]

Return the number of images/lattices set so far.

Definition at line 175 of file ImageConcat.h.

References casacore::ImageConcat< T >::latticeConcat_p.

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

Check class invariants.

Implements casacore::ImageInterface< T >.

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

Assignment operator (reference semantics).

Reimplemented from casacore::ImageInterface< T >.

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

Reimplemented from casacore::MaskedLattice< T >.

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

Get access to the pixelmask.

An exception is thrown if the image does not have a pixelmask

Reimplemented from casacore::MaskedLattice< T >.

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

Throws an excpetion as you cannot reshape an ImageConcat object.

Implements casacore::ImageInterface< T >.

template<class T>
virtual void casacore::ImageConcat< 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>
virtual void casacore::ImageConcat< T >::save ( const String fileName  )  const [virtual]

Save the image in an AipsIO file with the given name.

It can be opened by the constructor taking a file name.

Reimplemented from casacore::LatticeBase.

template<class T>
void casacore::ImageConcat< T >::setCoordinates (  )  [private]

Updates the CoordinateSystem in the ImageConcat image.

The first lattice must be an image. The first lattice is contiguous by definition. The Coordinate System for the first image must be set before calling this function. For the first image, this function just sets up worldValues and pixelValues

template<class T>
void casacore::ImageConcat< T >::setImage ( ImageInterface< T > &  image,
Bool  relax 
)

Sets a new image into the list to be concatenated.

If relax is False, throws an exception if the images are not contiguous along the concatenation axis. If relax is True, it will create a non-regular TabularCoordinate for non-contiguous images if the coordinates are monotonic. Otherwise, it just uses the coordinates of the image

template<class T>
void casacore::ImageConcat< T >::setLattice ( MaskedLattice< T > &  lattice  ) 

Add a clone of the lattice to the list to be concatenated.

You can only concatenate a lattice with an image if you have first used setImage to set an image (this provides the CooridinateSystem information)

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

Return the shape of the concatenated image.

Implements casacore::LatticeBase.

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

Reimplemented from casacore::LatticeBase.


Member Data Documentation

template<class T>
String casacore::ImageConcat< T >::fileName_p [mutable, private]

Definition at line 267 of file ImageConcat.h.

template<class T>
Bool casacore::ImageConcat< T >::isContig_p [private]

Definition at line 266 of file ImageConcat.h.

template<class T>
Vector<Bool> casacore::ImageConcat< T >::isImage_p [private]

Definition at line 268 of file ImageConcat.h.

template<class T>
LatticeConcat<T> casacore::ImageConcat< T >::latticeConcat_p [private]
template<class T>
Coordinate::Type casacore::ImageConcat< T >::originalAxisType_p [private]

Definition at line 271 of file ImageConcat.h.

template<class T>
Vector<Double> casacore::ImageConcat< T >::pixelValues_p [private]

Definition at line 269 of file ImageConcat.h.

template<class T>
Bool casacore::ImageConcat< T >::warnAxisNames_p [private]

Definition at line 264 of file ImageConcat.h.

template<class T>
Bool casacore::ImageConcat< T >::warnAxisUnits_p [private]

Definition at line 264 of file ImageConcat.h.

template<class T>
Bool casacore::ImageConcat< T >::warnContig_p [private]

Definition at line 265 of file ImageConcat.h.

template<class T>
Bool casacore::ImageConcat< T >::warnImageUnits_p [private]

Definition at line 264 of file ImageConcat.h.

template<class T>
Bool casacore::ImageConcat< T >::warnInc_p [private]

Definition at line 265 of file ImageConcat.h.

template<class T>
Bool casacore::ImageConcat< T >::warnRefPix_p [private]

Definition at line 265 of file ImageConcat.h.

template<class T>
Bool casacore::ImageConcat< T >::warnRefVal_p [private]

Definition at line 265 of file ImageConcat.h.

template<class T>
Bool casacore::ImageConcat< T >::warnTab_p [private]

Definition at line 265 of file ImageConcat.h.

template<class T>
Vector<Double> casacore::ImageConcat< T >::worldValues_p [private]

Definition at line 270 of file ImageConcat.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