casa
$Rev:20696$
|
Concatenates images along a specified axis. More...
#include <ImageConcat.h>
Public Member Functions | |
ImageConcat (uInt axis, Bool tempClose=True) | |
Constructor. | |
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 String | imageType () const |
Get the image type (returns name of derived class). | |
void | setImage (ImageInterface< T > &image, Bool relax) |
Sets a new image into the list to be concatenated. | |
void | setLattice (MaskedLattice< T > &lattice) |
Sets a new lattice into 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 LatticeRegion * | getRegionPtr () 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 §ion) |
Do the actual get of the data. | |
virtual Bool | doGetMaskSlice (Array< Bool > &buffer, const Slicer §ion) |
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 (Bool &isContig, Bool &warnContig, const IPosition &shape1, const CoordinateSystem &cSys1, const CoordinateSystem &cSys2, LogIO &os, uInt axis, Bool relax) |
void | checkNonConcatAxisCoordinates (Bool &warnRefPix, Bool &warnRefVal, Bool &warnInc, LogIO &os, const ImageInterface< T > &image, Bool relax) |
Vector< Int > | makeNewStokes (const Vector< Int > &stokes1, const Vector< Int > &stokes2) |
void | setCoordinates () |
void | _doBeam (const ImageInterface< T > &image, const Bool relax) |
void | _doSingleBeam (const ImageInterface< T > &image, const Bool relax) |
void | _doMultiBeams (const ImageInterface< T > &image, const Bool relax) |
void | _logBeamMessages (const Bool relax, const String &msg1, const String msg2) |
void | _appendBeams (const ImageInterface< T > &image) |
Static Private Member Functions | |
static Bool | _areBeamsEquivalent (const ImageInfo &infoThis, const ImageInfo &infoThat) |
static Bool | _areBeamsEqual (const GaussianBeam &beamThis, const ImageBeamSet &beamThat) |
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 |
Bool | _warnBeam |
Vector< Bool > | isImage_p |
Vector< Double > | pixelValues_p |
Vector< Double > | worldValues_p |
Coordinate::Type | originalAxisType_p |
Concatenates images along a specified axis.
Public interface
This is a class designed to concatenate images along a specified axis
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.
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.
Image concatentation is a useful enduser requirement.
Definition at line 125 of file ImageConcat.h.
casa::ImageConcat< T >::ImageConcat | ( | uInt | axis, |
Bool | tempClose = True |
||
) | [explicit] |
Constructor.
Specify the pixel axis for concatenation
casa::ImageConcat< T >::ImageConcat | ( | ) |
Default constructor, Sets the concatenation axis to 0.
casa::ImageConcat< T >::ImageConcat | ( | const ImageConcat< T > & | other | ) |
Copy constructor (reference semantics)
virtual casa::ImageConcat< T >::~ImageConcat | ( | ) | [virtual] |
Destructor.
void casa::ImageConcat< T >::_appendBeams | ( | const ImageInterface< T > & | image | ) | [private] |
static Bool casa::ImageConcat< T >::_areBeamsEqual | ( | const GaussianBeam & | beamThis, |
const ImageBeamSet & | beamThat | ||
) | [static, private] |
static Bool casa::ImageConcat< T >::_areBeamsEquivalent | ( | const ImageInfo & | infoThis, |
const ImageInfo & | infoThat | ||
) | [static, private] |
void casa::ImageConcat< T >::_checkContiguous | ( | Bool & | isContig, |
Bool & | warnContig, | ||
const IPosition & | shape1, | ||
const CoordinateSystem & | cSys1, | ||
const CoordinateSystem & | cSys2, | ||
LogIO & | os, | ||
uInt | axis, | ||
Bool | relax | ||
) | [private] |
void casa::ImageConcat< T >::_doBeam | ( | const ImageInterface< T > & | image, |
const Bool | relax | ||
) | [private] |
void casa::ImageConcat< T >::_doMultiBeams | ( | const ImageInterface< T > & | image, |
const Bool | relax | ||
) | [private] |
void casa::ImageConcat< T >::_doSingleBeam | ( | const ImageInterface< T > & | image, |
const Bool | relax | ||
) | [private] |
void casa::ImageConcat< T >::_logBeamMessages | ( | const Bool | relax, |
const String & | msg1, | ||
const String | msg2 | ||
) | [private] |
uInt casa::ImageConcat< T >::axis | ( | ) | const [inline] |
Returns the current concatenation axis (0 relative)
Definition at line 169 of file ImageConcat.h.
References casa::ImageConcat< T >::latticeConcat_p.
void casa::ImageConcat< T >::checkNonConcatAxisCoordinates | ( | Bool & | warnRefPix, |
Bool & | warnRefVal, | ||
Bool & | warnInc, | ||
LogIO & | os, | ||
const ImageInterface< T > & | image, | ||
Bool | relax | ||
) | [private] |
virtual ImageInterface<T>* casa::ImageConcat< T >::cloneII | ( | ) | const [virtual] |
Make a copy of the object (reference semantics).
Implements casa::ImageInterface< T >.
Double casa::ImageConcat< T >::coordConvert | ( | Int & | worldAxis, |
LogIO & | os, | ||
const CoordinateSystem & | cSys, | ||
uInt | axis, | ||
Double | pixelCoord | ||
) | const [private] |
virtual Bool casa::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 casa::MaskedLattice< T >.
virtual Bool casa::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 casa::Lattice< T >.
virtual IPosition casa::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 casa::LatticeBase.
virtual void casa::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 casa::Lattice< T >.
virtual void casa::ImageConcat< T >::flush | ( | ) | [virtual] |
Flush the data (but do not unlock).
By default the function does not do anything at all.
Reimplemented from casa::LatticeBase.
virtual const LatticeRegion* casa::ImageConcat< T >::getRegionPtr | ( | ) | const [virtual] |
Get the region used (always returns 0)
Implements casa::MaskedLattice< T >.
virtual Bool casa::ImageConcat< T >::hasLock | ( | FileLocker::LockType | ) | const [virtual] |
Reimplemented from casa::LatticeBase.
virtual Bool casa::ImageConcat< T >::hasPixelMask | ( | ) | const [virtual] |
Does the image have a pixelmask?
Reimplemented from casa::MaskedLattice< T >.
uInt casa::ImageConcat< T >::imageDim | ( | ) | const [inline] |
Returns the number of dimensions of the input images/lattices Returns 0 if none yet set.
Definition at line 174 of file ImageConcat.h.
References casa::ImageConcat< T >::latticeConcat_p.
virtual String casa::ImageConcat< T >::imageType | ( | ) | const [virtual] |
Get the image type (returns name of derived class).
Implements casa::ImageInterface< T >.
virtual Bool casa::ImageConcat< T >::isMasked | ( | ) | const [virtual] |
Has the object really a mask?
Reimplemented from casa::MaskedLattice< T >.
virtual Bool casa::ImageConcat< T >::isWritable | ( | ) | const [virtual] |
If all of the underlying lattices are writable returns True.
Reimplemented from casa::LatticeBase.
virtual Bool casa::ImageConcat< T >::lock | ( | FileLocker::LockType | , |
uInt | nattempts | ||
) | [virtual] |
Handle the (un)locking and syncing, etc.
Reimplemented from casa::LatticeBase.
virtual LatticeIterInterface<T>* casa::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 casa::Lattice< T >.
Vector<Int> casa::ImageConcat< T >::makeNewStokes | ( | const Vector< Int > & | stokes1, |
const Vector< Int > & | stokes2 | ||
) | [private] |
virtual String casa::ImageConcat< T >::name | ( | Bool | stripPath = False | ) | const [virtual] |
Return the name of the current ImageInterface object.
Since many images may be concatenated, there is no sensible name. So returns the string "Concatenation :"
Implements casa::ImageInterface< T >.
uInt casa::ImageConcat< T >::nimages | ( | ) | const [inline] |
Return the number of images/lattices set so far.
Definition at line 165 of file ImageConcat.h.
References casa::ImageConcat< T >::latticeConcat_p.
virtual Bool casa::ImageConcat< T >::ok | ( | ) | const [virtual] |
Check class invariants.
Implements casa::ImageInterface< T >.
ImageConcat<T>& casa::ImageConcat< T >::operator= | ( | const ImageConcat< T > & | other | ) |
Assignment operator (reference semantics)
virtual const Lattice<Bool>& casa::ImageConcat< T >::pixelMask | ( | ) | const [virtual] |
Get access to the pixelmask.
An exception is thrown if the image does not have a pixelmask
Reimplemented from casa::MaskedLattice< T >.
virtual Lattice<Bool>& casa::ImageConcat< T >::pixelMask | ( | ) | [virtual] |
Reimplemented from casa::MaskedLattice< T >.
virtual void casa::ImageConcat< T >::reopen | ( | ) | [virtual] |
Explicitly reopen the temporarily closed lattice.
By default the function does not do anything at all.
Reimplemented from casa::LatticeBase.
virtual void casa::ImageConcat< T >::resize | ( | const TiledShape & | ) | [virtual] |
Throws an excpetion as you cannot reshape an ImageConcat object.
Implements casa::ImageInterface< T >.
virtual void casa::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 casa::LatticeBase.
void casa::ImageConcat< T >::setCoordinates | ( | ) | [private] |
void casa::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
void casa::ImageConcat< T >::setLattice | ( | MaskedLattice< T > & | lattice | ) |
Sets a new lattice into 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)
virtual IPosition casa::ImageConcat< T >::shape | ( | ) | const [virtual] |
Return the shape of the concatenated image.
Implements casa::LatticeBase.
virtual void casa::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 casa::LatticeBase.
virtual void casa::ImageConcat< T >::unlock | ( | ) | [virtual] |
Reimplemented from casa::LatticeBase.
Bool casa::ImageConcat< T >::_warnBeam [private] |
Definition at line 256 of file ImageConcat.h.
Bool casa::ImageConcat< T >::isContig_p [private] |
Definition at line 256 of file ImageConcat.h.
Vector<Bool> casa::ImageConcat< T >::isImage_p [private] |
Definition at line 257 of file ImageConcat.h.
LatticeConcat<T> casa::ImageConcat< T >::latticeConcat_p [private] |
Definition at line 253 of file ImageConcat.h.
Referenced by casa::ImageConcat< T >::axis(), casa::ImageConcat< T >::imageDim(), and casa::ImageConcat< T >::nimages().
Coordinate::Type casa::ImageConcat< T >::originalAxisType_p [private] |
Definition at line 260 of file ImageConcat.h.
Vector<Double> casa::ImageConcat< T >::pixelValues_p [private] |
Definition at line 258 of file ImageConcat.h.
Bool casa::ImageConcat< T >::warnAxisNames_p [private] |
Definition at line 254 of file ImageConcat.h.
Bool casa::ImageConcat< T >::warnAxisUnits_p [private] |
Definition at line 254 of file ImageConcat.h.
Bool casa::ImageConcat< T >::warnContig_p [private] |
Definition at line 255 of file ImageConcat.h.
Bool casa::ImageConcat< T >::warnImageUnits_p [private] |
Definition at line 254 of file ImageConcat.h.
Bool casa::ImageConcat< T >::warnInc_p [private] |
Definition at line 255 of file ImageConcat.h.
Bool casa::ImageConcat< T >::warnRefPix_p [private] |
Definition at line 255 of file ImageConcat.h.
Bool casa::ImageConcat< T >::warnRefVal_p [private] |
Definition at line 255 of file ImageConcat.h.
Bool casa::ImageConcat< T >::warnTab_p [private] |
Definition at line 255 of file ImageConcat.h.
Vector<Double> casa::ImageConcat< T >::worldValues_p [private] |
Definition at line 259 of file ImageConcat.h.