casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
casa::ComponentListImage Class Reference

Read, store, and manipulate an astronomical image based on a component list. More...

#include <ComponentListImage.h>

Inheritance diagram for casa::ComponentListImage:
casacore::ImageInterface< casacore::Float > casacore::MaskedLattice< casacore::Float > casacore::Lattice< casacore::Float > casacore::LatticeBase

Public Member Functions

 ComponentListImage (const ComponentList &compList, const casacore::CoordinateSystem &csys, const casacore::IPosition &shape, const casacore::String &tableName, const casacore::Bool doCache=casacore::True)
 Create a new ComponentListImage from a component list, coordinate system, and shape. More...
 
 ComponentListImage (const ComponentList &compList, const casacore::CoordinateSystem &csys, const casacore::IPosition &shape, const casacore::Bool doCache=casacore::True)
 This constructor creates a temporary ComponentListImage. More...
 
 ComponentListImage (const casacore::String &filename, const casacore::Bool doCache=casacore::True, casacore::MaskSpecifier maskSpec=casacore::MaskSpecifier())
 Construct an object by reading a persistent ComponentListImage from disk. More...
 
 ComponentListImage (const ComponentListImage &image)
 Copy constructor uses reference semantics. More...
 
 ~ComponentListImage ()
 
ComponentListImageoperator= (const ComponentListImage &other)
 Assignment operator using reference semantics. More...
 
void apply (casacore::Float(*function)(casacore::Float))
 These override the methods in Lattice and always throw an exception because there is not a general way to do this for a component list. More...
 
void apply (casacore::Float(*function)(const casacore::Float &))
 
void apply (const casacore::Functional< casacore::Float, casacore::Float > &function)
 
casacore::ImageInterface
< casacore::Float > * 
cloneII () const
 Create an ImageInterface clone using reference semantics. More...
 
const ComponentListcomponentList () const
 get a const reference to the underlying ComponentList More...
 
casacore::Bool doGetMaskSlice (casacore::Array< casacore::Bool > &buffer, const casacore::Slicer &section)
 The function (in the derived classes) doing the actual work. More...
 
void copyData (const casacore::Lattice< casacore::Float > &)
 This method overrides that in Lattice and always throw exceptions as there is not general way to do this for component lists. More...
 
bool doGetSlice (casacore::Array< casacore::Float > &buffer, const casacore::Slicer &section)
 The functions (in the derived classes) doing the actual work. More...
 
void doPutSlice (const casacore::Array< casacore::Float > &buffer, const casacore::IPosition &where, const casacore::IPosition &stride)
 This method overrides that in Lattice and always throws an exception as there is not general way to do this for component lists. More...
 
const casacore::LatticeRegiongetRegionPtr () const
 Get a pointer the default pixelmask object used with this image. More...
 
casacore::Bool hasPixelMask () const
 Does the lattice have a pixelmask? The default implementation returns False. More...
 
casacore::String imageType () const
 Get the image type (returns name of derived class). More...
 
casacore::Bool isMasked () const
 Has the object really a mask? The default implementation returns True if the MaskedLattice has a region with a mask. More...
 
casacore::Bool isPaged () const
 returns True if there is a persistent table associated with this object. More...
 
casacore::Bool isPersistent () const
 returns True if there is a persistent table associated with this object. More...
 
casacore::Bool isWritable () const
 Overrides the LatticeBase method. More...
 
casacore::String name (bool stripPath=false) const
 If there is no persistent table associated with this object, returns "Temporary ComponentListImage". More...
 
casacore::Bool ok () const
 Check class invariants. More...
 
const casacore::Lattice
< casacore::Bool > & 
pixelMask () const
 Throws an exception is there is no pixel mask. More...
 
void removeRegion (const casacore::String &name, casacore::RegionHandler::GroupType=casacore::RegionHandler::Any, casacore::Bool throwIfUnknown=casacore::True)
 overrides ImageInterface method More...
 
void resize (const casacore::TiledShape &newShape)
 Function which changes the shape of the image (N.B. More...
 
void set (const casacore::Float &value)
 Overrides Lattice method. More...
 
void setCache (casacore::Bool doCache)
 controls if pixel values, directions, and frequencies are cached. More...
 
casacore::Bool setCoordinateInfo (const casacore::CoordinateSystem &coords)
 Set the coordinate system. More...
 
void setDefaultMask (const casacore::String &regionName)
 Set the default pixelmask to the mask with the given name (which has to exist in the "masks" group). More...
 
casacore::Bool setImageInfo (const casacore::ImageInfo &info)
 
casacore::Bool setMiscInfo (const casacore::RecordInterface &newInfo)
 
casacore::Bool setUnits (const casacore::Unit &newUnits)
 An exception is thrown if newUnits are anything but Jy/pixel. More...
 
casacore::IPosition shape () const
 return the shape of the image. More...
 
void useMask (casacore::MaskSpecifier=casacore::MaskSpecifier())
 Overrides ImageInterface method. More...
 
- Public Member Functions inherited from casacore::ImageInterface< casacore::Float >
 ImageInterface ()
 
 ImageInterface (const RegionHandler &regionHandler)
 Construct for a specific region handler object. More...
 
 ImageInterface (const ImageInterface &other)
 Copy constructor (copy semantics). More...
 
virtual ~ImageInterface ()
 
virtual MaskedLattice
< casacore::Float > * 
cloneML () const
 Make a copy of the derived object (reference semantics). More...
 
virtual const Unitunits () const
 
const CoordinateSystemcoordinates () const
 
virtual LELCoordinates lelCoordinates () const
 Function to get a LELCoordinate object containing the coordinates. More...
 
LoggerHolderlogger ()
 Get access to the LoggerHolder. More...
 
const LoggerHolderlogger () const
 
LogIOlogSink ()
 Allow messages to be logged to this ImageInterface. More...
 
const LogIOlogSink () const
 
void appendLog (const LoggerHolder &other)
 Add the messages from the other image logger to this one. More...
 
const TableRecordmiscInfo () const
 Often we have miscellaneous information we want to attach to an image. More...
 
const ImageInfoimageInfo () const
 The ImageInfo object contains some miscellaneous information about the image which unlike that stored in MiscInfo, has a standard list of things, such as the restoring beam. More...
 
ImageInforwImageInfo ()
 Get non-const access to the ImageInfo. More...
 
virtual ImageAttrHandlerattrHandler (Bool createHandler=False)
 Get access to the attribute handler. More...
 
ImageAttrHandlerroAttrHandler () const
 
Bool canDefineRegion () const
 Can the image handle region definition? More...
 
virtual ImageRegion makeMask (const String &name, Bool defineAsRegion=True, Bool setAsDefaultMask=True, Bool initialize=False, Bool value=True)
 Make a mask which is suitable for the type of image. More...
 
virtual void defineRegion (const String &name, const ImageRegion &region, RegionHandler::GroupType, Bool overwrite=False)
 Define a region/mask belonging to the image. More...
 
virtual Bool hasRegion (const String &regionName, RegionHandler::GroupType=RegionHandler::Any) const
 Does the image have a region with the given name? More...
 
virtual ImageRegiongetImageRegionPtr (const String &name, RegionHandler::GroupType=RegionHandler::Any, Bool throwIfUnknown=True) const
 Get a region/mask belonging to the image from the given group (which can be Any). More...
 
virtual void renameRegion (const String &newName, const String &oldName, RegionHandler::GroupType=RegionHandler::Any, Bool overwrite=False)
 Rename a region. More...
 
virtual Vector< StringregionNames (RegionHandler::GroupType=RegionHandler::Any) const
 Get the names of all regions/masks. More...
 
virtual String getDefaultMask () const
 Get the name of the default pixelmask. More...
 
ImageRegion getRegion (const String &regionName, RegionHandler::GroupType=RegionHandler::Any) const
 Get a region belonging to the image. More...
 
String makeUniqueRegionName (const String &rootName, uInt startNumber=1) const
 Make a unique region name from the given root name, thus make it such that the name is not already in use for a region or mask. More...
 
Bool toRecord (String &error, RecordInterface &outRec)
 Save and restore an ImageInterface object to or from a state Record. More...
 
Bool fromRecord (String &error, const RecordInterface &inRec)
 
- Public Member Functions inherited from casacore::MaskedLattice< casacore::Float >
 MaskedLattice ()
 Default constructor. More...
 
 MaskedLattice (const MaskedLattice< casacore::Float > &)
 Copy constructor. More...
 
virtual ~MaskedLattice ()
 a virtual destructor is needed so that it will use the actual destructor in the derived class More...
 
virtual Lattice
< casacore::Float > * 
clone () const
 Make a copy of the derived object (reference semantics). More...
 
virtual Lattice< Bool > & pixelMask ()
 
const LatticeRegionregion () const
 Get the region used. More...
 
Bool getMask (COWPtr< Array< Bool > > &buffer, Bool removeDegenerateAxes=False) const
 Get the mask or a slice from the mask. More...
 
Bool getMask (Array< Bool > &buffer, Bool removeDegenerateAxes=False)
 
Array< BoolgetMask (Bool removeDegenerateAxes=False) const
 
Bool getMaskSlice (COWPtr< Array< Bool > > &buffer, const Slicer &section, Bool removeDegenerateAxes=False) const
 
Bool getMaskSlice (COWPtr< Array< Bool > > &buffer, const IPosition &start, const IPosition &shape, Bool removeDegenerateAxes=False) const
 
Bool getMaskSlice (COWPtr< Array< Bool > > &buffer, const IPosition &start, const IPosition &shape, const IPosition &stride, Bool removeDegenerateAxes=False) const
 
Bool getMaskSlice (Array< Bool > &buffer, const Slicer &section, Bool removeDegenerateAxes=False)
 
Bool getMaskSlice (Array< Bool > &buffer, const IPosition &start, const IPosition &shape, Bool removeDegenerateAxes=False)
 
Bool getMaskSlice (Array< Bool > &buffer, const IPosition &start, const IPosition &shape, const IPosition &stride, Bool removeDegenerateAxes=False)
 
Array< BoolgetMaskSlice (const Slicer &section, Bool removeDegenerateAxes=False) const
 
Array< BoolgetMaskSlice (const IPosition &start, const IPosition &shape, Bool removeDegenerateAxes=False) const
 
Array< BoolgetMaskSlice (const IPosition &start, const IPosition &shape, const IPosition &stride, Bool removeDegenerateAxes=False) const
 
- Public Member Functions inherited from casacore::Lattice< casacore::Float >
virtual ~Lattice ()
 a virtual destructor is needed so that it will use the actual destructor in the derived class More...
 
virtual DataType dataType () const
 Get the data type of the lattice. More...
 
casacore::Float operator() (const IPosition &where) const
 Return the value of the single element located at the argument IPosition. More...
 
virtual casacore::Float getAt (const IPosition &where) const
 
virtual void putAt (const casacore::Float &value, const IPosition &where)
 Put the value of a single element. More...
 
Bool get (COWPtr< Array< casacore::Float > > &buffer, Bool removeDegenerateAxes=False) const
 Functions which extract an Array of values from a Lattice. More...
 
Bool get (Array< casacore::Float > &buffer, Bool removeDegenerateAxes=False)
 
Array< casacore::Floatget (Bool removeDegenerateAxes=False) const
 
Bool getSlice (COWPtr< Array< casacore::Float > > &buffer, const Slicer &section, Bool removeDegenerateAxes=False) const
 
Bool getSlice (COWPtr< Array< casacore::Float > > &buffer, const IPosition &start, const IPosition &shape, Bool removeDegenerateAxes=False) const
 
Bool getSlice (COWPtr< Array< casacore::Float > > &buffer, const IPosition &start, const IPosition &shape, const IPosition &stride, Bool removeDegenerateAxes=False) const
 
Bool getSlice (Array< casacore::Float > &buffer, const Slicer &section, Bool removeDegenerateAxes=False)
 
Bool getSlice (Array< casacore::Float > &buffer, const IPosition &start, const IPosition &shape, Bool removeDegenerateAxes=False)
 
Bool getSlice (Array< casacore::Float > &buffer, const IPosition &start, const IPosition &shape, const IPosition &stride, Bool removeDegenerateAxes=False)
 
Array< casacore::FloatgetSlice (const Slicer &section, Bool removeDegenerateAxes=False) const
 
Array< casacore::FloatgetSlice (const IPosition &start, const IPosition &shape, Bool removeDegenerateAxes=False) const
 
Array< casacore::FloatgetSlice (const IPosition &start, const IPosition &shape, const IPosition &stride, Bool removeDegenerateAxes=False) const
 
void putSlice (const Array< casacore::Float > &sourceBuffer, const IPosition &where, const IPosition &stride)
 A function which places an Array of values within this instance of the Lattice at the location specified by the IPosition "where", incrementing by "stride". More...
 
void putSlice (const Array< casacore::Float > &sourceBuffer, const IPosition &where)
 
void put (const Array< casacore::Float > &sourceBuffer)
 
void operator+= (const Lattice< casacore::Float > &other)
 Add, subtract, multiple, or divide by another Lattice. More...
 
void operator-= (const Lattice< casacore::Float > &other)
 
void operator*= (const Lattice< casacore::Float > &other)
 
void operator/= (const Lattice< casacore::Float > &other)
 
virtual void copyDataTo (Lattice< casacore::Float > &to) const
 Copy the data from this lattice to the given lattice. More...
 
virtual uInt advisedMaxPixels () const
 This function returns the advised maximum number of pixels to include in the cursor of an iterator. More...
 
virtual LatticeIterInterface
< casacore::Float > * 
makeIter (const LatticeNavigator &navigator, Bool useRef) const
 These functions are used by the LatticeIterator class to generate an iterator of the correct type for a specified Lattice. More...
 
- Public Member Functions inherited from casacore::LatticeBase
virtual ~LatticeBase ()
 A virtual destructor is needed so that it will use the actual destructor in the derived class. More...
 
virtual Bool canReferenceArray () const
 Can the lattice data be referenced as an array section? That is the case for an ArrayLattice or a Temp/SubLattice using it. More...
 
virtual void save (const String &fileName) const
 Save the image in an AipsIO file with the given name. More...
 
virtual Bool lock (FileLocker::LockType, uInt nattempts)
 It is strongly recommended to use class LatticeLocker to handle lattice locking. More...
 
virtual void unlock ()
 
virtual Bool hasLock (FileLocker::LockType) const
 
virtual void resync ()
 Resynchronize the Lattice object with the lattice file. More...
 
virtual void flush ()
 Flush the data (but do not unlock). More...
 
virtual void tempClose ()
 Temporarily close the lattice. More...
 
virtual void reopen ()
 Explicitly reopen the temporarily closed lattice. More...
 
virtual uInt ndim () const
 Return the number of axes in this Lattice. More...
 
virtual size_t nelements () const
 Return the total number of elements in this Lattice. More...
 
size_t size () const
 
Bool conform (const LatticeBase &other) const
 Return a value of "True" if this instance of Lattice and 'other' have the same shape, otherwise returns a value of "False". More...
 
IPosition niceCursorShape (uInt maxPixels) const
 Returns a recommended cursor shape for iterating through all the pixels in the Lattice. More...
 
IPosition niceCursorShape () const
 
virtual IPosition doNiceCursorShape (uInt maxPixels) const
 The function (in the derived classes) doing the actual work. More...
 
virtual uInt maximumCacheSize () const
 Maximum cache size - not necessarily all used. More...
 
virtual void setMaximumCacheSize (uInt howManyPixels)
 Set the maximum (allowed) cache size as indicated. More...
 
virtual void setCacheSizeInTiles (uInt howManyTiles)
 Set the actual cache size for this Array to be big enough for the indicated number of tiles. More...
 
virtual void setCacheSizeFromPath (const IPosition &sliceShape, const IPosition &windowStart, const IPosition &windowLength, const IPosition &axisPath)
 Set the cache size as to "fit" the indicated path. More...
 
virtual void clearCache ()
 Clears and frees up the caches, but the maximum allowed cache size is unchanged from when setCacheSize was called. More...
 
virtual void showCacheStatistics (ostream &os) const
 Report on cache success. More...
 

Static Public Member Functions

static casacore::TablegetTable (void *imagePtr, casacore::Bool writable)
 Return the internal Table object to the RegionHandler. More...
 
static casacore::LatticeBaseopenCLImage (const casacore::String &name, const casacore::MaskSpecifier &)
 Open an existing ComponentListImage. More...
 
static void registerOpenFunction ()
 In general, clients shouldn't need to call this. More...
 

Static Public Attributes

static const casacore::String IMAGE_TYPE
 

Protected Member Functions

void handleMath (const casacore::Lattice< casacore::Float > &from, int oper)
 Overrides Lattice. More...
 
- Protected Member Functions inherited from casacore::ImageInterface< casacore::Float >
ImageInterfaceoperator= (const ImageInterface &other)
 Assignment (copy semantics) is only useful for derived classes. More...
 
Bool restoreImageInfo (const RecordInterface &rec)
 Restore the image info from the record. More...
 
void setLogMember (const LoggerHolder &logger)
 Set the image logger variable. More...
 
void setImageInfoMember (const ImageInfo &imageInfo)
 Set the image info variable. More...
 
void setCoordsMember (const CoordinateSystem &coords)
 Set the coordinate system variable. More...
 
void setUnitMember (const Unit &unit)
 Set the unit variable. More...
 
void setMiscInfoMember (const RecordInterface &rec)
 Set the miscinfo variable. More...
 
RegionHandlergetRegionHandler ()
 Get access to the region handler. More...
 
- Protected Member Functions inherited from casacore::MaskedLattice< casacore::Float >
MaskedLattice< casacore::Float > & operator= (const MaskedLattice< casacore::Float > &)
 Assignment can only be used by derived classes. More...
 
- Protected Member Functions inherited from casacore::Lattice< casacore::Float >
 Lattice ()
 Define default constructor to satisfy compiler. More...
 
 Lattice (const Lattice< casacore::Float > &)
 Copy constructor and assignment can only be used by derived classes. More...
 
virtual void handleMathTo (Lattice< casacore::Float > &to, int oper) const
 
Lattice< casacore::Float > & operator= (const Lattice< casacore::Float > &)
 
- Protected Member Functions inherited from casacore::LatticeBase
 LatticeBase ()
 Define default constructor to be used by derived classes. More...
 
 LatticeBase (const LatticeBase &)
 Copy constructor and assignment can only be used by derived classes. More...
 
LatticeBaseoperator= (const LatticeBase &)
 
void throwBoolMath () const
 Throw an exception for arithmetic on a Bool Lattice. More...
 

Private Types

enum  PtFound {
  FOUND_INSIDE,
  FOUND_OUTSIDE,
  NOT_FOUND
}
 
using PtStoreType = std::map< std::pair< casacore::uInt, casacore::uInt >, casacore::Matrix< casacore::Float > >
 yes it really does need to be initialized here (or in the constructor) because initializing to nullptr will have undesirable effects when copying. More...
 

Private Member Functions

void _applyMask (const casacore::String &maskName)
 
void _applyMaskSpecifier (const casacore::MaskSpecifier &spec)
 
void _cacheCoordinateInfo (const casacore::CoordinateSystem &csys)
 
void _computePointSourcePixelValues ()
 improve performance by caching point source pixel values. More...
 
void _deleteCache ()
 
void _fillBuffer (casacore::Array< casacore::Float > &buffer, const casacore::IPosition &chunkShape, const casacore::IPosition &secStart, casacore::uInt nFreqs, const casacore::Cube< casacore::Double > &pixelVals) const
 
PtFound _findPixel (casacore::Cube< casacore::Double > &values, const casacore::IPosition &pixelPosition, const casacore::DirectionCoordinate &dirCoord, const SkyComponent &point, const casacore::Vector< casacore::MVFrequency > &freqValues) const
 
PtFound _findPixelIn3x3Box (casacore::IPosition &pixelPosition, casacore::Cube< casacore::Double > &values, const casacore::DirectionCoordinate &dirCoord, const SkyComponent &point, const casacore::Vector< casacore::MVFrequency > &freqValues) const
 
void _findPointSoures (std::vector< casacore::uInt > &foundPtSourceIdx, casacore::uInt &nInside, casacore::uInt &nOutside, const std::set< casacore::uInt > &pointSourceIdx)
 
casacore::Vector
< casacore::MVFrequency
_getAllFreqValues (casacore::uInt nFreqs)
 
void _getDirValsDoCache (casacore::Vector< casacore::MVDirection > &dirVals, const casacore::IPosition &secStart, casacore::uInt endLong, casacore::uInt endLat, const casacore::DirectionCoordinate &dirCoord)
 
void _getDirValsNoCache (casacore::Vector< casacore::MVDirection > &dirVals, const casacore::IPosition &secStart, casacore::uInt endLong, casacore::uInt endLat, const casacore::DirectionCoordinate &dirCoord) const
 
void _getFreqValsDoCache (casacore::Vector< casacore::MVFrequency > &freqVals, const casacore::IPosition &secStart, casacore::uInt nFreqs, const casacore::SpectralCoordinate &specCoord)
 
void _getFreqValsNoCache (casacore::Vector< casacore::MVFrequency > &freqVals, const casacore::IPosition &secStart, casacore::uInt nFreqs, const casacore::SpectralCoordinate &specCoord) const
 
void _initCache ()
 
void _openLogTable ()
 
void _reopenRW ()
 
void _resize (const casacore::TiledShape &shape)
 
void _restoreAll (const casacore::TableRecord &rec)
 
void _restoreImageInfo (const casacore::TableRecord &rec)
 
void _restoreMiscInfo (const casacore::TableRecord &rec)
 
void _restoreUnits (const casacore::TableRecord &rec)
 

Private Attributes

ComponentList _cl
 
ComponentList _modifiedCL
 
casacore::IPosition _shape
 
std::shared_ptr
< casacore::LatticeRegion
_mask
 
casacore::Int _latAxis
 
casacore::Int _longAxis
 
casacore::Int _freqAxis
 
casacore::Int _stokesAxis
 
casacore::MVAngle _pixelLongSize
 
casacore::MVAngle _pixelLatSize
 
casacore::MeasRef
< casacore::MDirection
_dirRef
 
casacore::Matrix
< std::shared_ptr
< casacore::MVDirection > > 
_dirVals
 
casacore::MeasRef
< casacore::MFrequency
_freqRef
 
casacore::Vector
< std::shared_ptr
< casacore::MVFrequency > > 
_freqVals
 
std::shared_ptr< PtStoreType_ptSourcePixelVals
 
casacore::Vector< casacore::Int_pixelToIQUV
 
casacore::Bool _cache
 
casacore::Bool _hasFreq
 
casacore::Bool _hasStokes
 
std::shared_ptr< casacore::Bool_computedPtSources
 Yes this really has to be a shared_ptr so that _ptSourcePixelVals can be computed outside the constructor and copying the image will work properly. More...
 
casacore::MFrequency _defaultFreq
 
std::shared_ptr
< casacore::TempImage
< casacore::Float > > 
_valueCache
 

Detailed Description

Read, store, and manipulate an astronomical image based on a component list.

Prerequisite

Etymology

An Image comprised of a ComponentList.

Synopsis

A ComponentListImage is an image based on a ComponentList table. Upon construction, the pixel values are not known, and are computed on the fly when doGetSlice() is called.

AXES A ComponetListImage must have 2, 3, or 4 axes. At least two of these axes must be associated with a direction coordinate. Optionally, a ComponentListImage can also have a frequency and/or polarization axis. The maximum length of the polarization axis is four pixels, and the associated polarization values are constrained to be in the set of stokes parameters I, Q, U, and/or V.

UNITS A ComponentListImage must have units of Jy/pixel, and setUnit() will thrown an exception if directed to set the brightness unit to something other than this.

BEAMS ComponentListImages do not support beams, and setImageInfo() will throw an exception if beam information is included in the passed object. One can of course create another type of image using the pixel values of a ComponentListImage and modify metadata of the non-ComponentListImage to their heart's content.

CACHING PIXEL VALUES The pixel values can be cached for the life of the object for fast retrieval if they are needed again. In this case, a TemporaryImage is created to hold the pixel values, The associated mask of this TempImage indicates if the corresponding pixel values have been computed or not; pixel values are computed as needed. In addition, the world coordinate values of all the direction and frequency pixels in the image are cached if caching is requested, as these computations can be expensive.

CACHING OF POINT SOURCE PIXEL POSITIONS Computing samples for point source sky components on a pixel by pixel basis can be expensive (cf CAS-5688), and in comparison, caching their values for later use takes relatively little memory (I estimate 16 bytes * nchan * nstokes per point source). For this reason, if the associated component list contains point sources, the pixel coordinates of all the point sources are computed in a highly optimized way on the first call to doGetSlice() and are cached for later use; computing their values on a pixel by pixel basis is not done. Pixel coordinates for point sources which fall outside the image boundaries are not cached.

MODIFYING PIXEL VALUES Pixel values are computed from sky components; one cannot set pixel values explicitly. Any method that ultimately calls doPutSlice will throw an exception. Note however, that masks can be added, removed, and modified in the usual ways.

Example

Motivation

Kumar Golap is the motivation. See CAS-5837 and CAS-7309. The idea being that an image which can be represented by sky components takes a small fraction of the space to store compared to a PagedImage with identical pixel values.

Definition at line 118 of file ComponentListImage.h.

Member Typedef Documentation

yes it really does need to be initialized here (or in the constructor) because initializing to nullptr will have undesirable effects when copying.

The copied image will initialize this, but since it is a nullptr in the original, it doesn't get initialized in the original. Trust me, you don't want to deal with this issue.

Definition at line 302 of file ComponentListImage.h.

Member Enumeration Documentation

Enumerator
FOUND_INSIDE 
FOUND_OUTSIDE 
NOT_FOUND 

Definition at line 278 of file ComponentListImage.h.

Constructor & Destructor Documentation

casa::ComponentListImage::ComponentListImage ( const ComponentList compList,
const casacore::CoordinateSystem csys,
const casacore::IPosition shape,
const casacore::String tableName,
const casacore::Bool  doCache = casacore::True 
)

Create a new ComponentListImage from a component list, coordinate system, and shape.

The input component list will be copied (via the ComponentList::copy() method, so that the constructed object has a unique ComponentList that is not referenced by any other objects. Exceptions are thrown if the shape has fewer than 2 or more than 4 elements, the number of pixel axes in csys is not equal to the number of elements in shape, or if csys does not have a direction coordinate. The brightness units are automatically set to Jy/pixel.

This constructor creates a persistent ComponentListImage of name tableName. If tableName is empty, an exception is thrown.

casa::ComponentListImage::ComponentListImage ( const ComponentList compList,
const casacore::CoordinateSystem csys,
const casacore::IPosition shape,
const casacore::Bool  doCache = casacore::True 
)

This constructor creates a temporary ComponentListImage.

casa::ComponentListImage::ComponentListImage ( const casacore::String filename,
const casacore::Bool  doCache = casacore::True,
casacore::MaskSpecifier  maskSpec = casacore::MaskSpecifier() 
)
explicit

Construct an object by reading a persistent ComponentListImage from disk.

By default the image's default mask is used if it exists.

casa::ComponentListImage::ComponentListImage ( const ComponentListImage image)

Copy constructor uses reference semantics.

casa::ComponentListImage::~ComponentListImage ( )

Member Function Documentation

void casa::ComponentListImage::_applyMask ( const casacore::String maskName)
private
void casa::ComponentListImage::_applyMaskSpecifier ( const casacore::MaskSpecifier spec)
private
void casa::ComponentListImage::_cacheCoordinateInfo ( const casacore::CoordinateSystem csys)
private
void casa::ComponentListImage::_computePointSourcePixelValues ( )
private

improve performance by caching point source pixel values.

This is always done; the value of _cache has no effect on it.

void casa::ComponentListImage::_deleteCache ( )
private
void casa::ComponentListImage::_fillBuffer ( casacore::Array< casacore::Float > &  buffer,
const casacore::IPosition chunkShape,
const casacore::IPosition secStart,
casacore::uInt  nFreqs,
const casacore::Cube< casacore::Double > &  pixelVals 
) const
private
PtFound casa::ComponentListImage::_findPixel ( casacore::Cube< casacore::Double > &  values,
const casacore::IPosition pixelPosition,
const casacore::DirectionCoordinate dirCoord,
const SkyComponent point,
const casacore::Vector< casacore::MVFrequency > &  freqValues 
) const
private
PtFound casa::ComponentListImage::_findPixelIn3x3Box ( casacore::IPosition pixelPosition,
casacore::Cube< casacore::Double > &  values,
const casacore::DirectionCoordinate dirCoord,
const SkyComponent point,
const casacore::Vector< casacore::MVFrequency > &  freqValues 
) const
private
void casa::ComponentListImage::_findPointSoures ( std::vector< casacore::uInt > &  foundPtSourceIdx,
casacore::uInt nInside,
casacore::uInt nOutside,
const std::set< casacore::uInt > &  pointSourceIdx 
)
private
casacore::Vector<casacore::MVFrequency> casa::ComponentListImage::_getAllFreqValues ( casacore::uInt  nFreqs)
private
void casa::ComponentListImage::_getDirValsDoCache ( casacore::Vector< casacore::MVDirection > &  dirVals,
const casacore::IPosition secStart,
casacore::uInt  endLong,
casacore::uInt  endLat,
const casacore::DirectionCoordinate dirCoord 
)
private
void casa::ComponentListImage::_getDirValsNoCache ( casacore::Vector< casacore::MVDirection > &  dirVals,
const casacore::IPosition secStart,
casacore::uInt  endLong,
casacore::uInt  endLat,
const casacore::DirectionCoordinate dirCoord 
) const
private
void casa::ComponentListImage::_getFreqValsDoCache ( casacore::Vector< casacore::MVFrequency > &  freqVals,
const casacore::IPosition secStart,
casacore::uInt  nFreqs,
const casacore::SpectralCoordinate specCoord 
)
private
void casa::ComponentListImage::_getFreqValsNoCache ( casacore::Vector< casacore::MVFrequency > &  freqVals,
const casacore::IPosition secStart,
casacore::uInt  nFreqs,
const casacore::SpectralCoordinate specCoord 
) const
private
void casa::ComponentListImage::_initCache ( )
private
void casa::ComponentListImage::_openLogTable ( )
private
void casa::ComponentListImage::_reopenRW ( )
private
void casa::ComponentListImage::_resize ( const casacore::TiledShape shape)
private
void casa::ComponentListImage::_restoreAll ( const casacore::TableRecord rec)
private
void casa::ComponentListImage::_restoreImageInfo ( const casacore::TableRecord rec)
private
void casa::ComponentListImage::_restoreMiscInfo ( const casacore::TableRecord rec)
private
void casa::ComponentListImage::_restoreUnits ( const casacore::TableRecord rec)
private
void casa::ComponentListImage::apply ( casacore::Float(*)(casacore::Float function)
virtual

These override the methods in Lattice and always throw an exception because there is not a general way to do this for a component list.

Reimplemented from casacore::Lattice< casacore::Float >.

void casa::ComponentListImage::apply ( casacore::Float(*)(const casacore::Float &)  function)
virtual
void casa::ComponentListImage::apply ( const casacore::Functional< casacore::Float, casacore::Float > &  function)
virtual
casacore::ImageInterface<casacore::Float>* casa::ComponentListImage::cloneII ( ) const
virtual

Create an ImageInterface clone using reference semantics.

Implements casacore::ImageInterface< casacore::Float >.

const ComponentList& casa::ComponentListImage::componentList ( ) const

get a const reference to the underlying ComponentList

void casa::ComponentListImage::copyData ( const casacore::Lattice< casacore::Float > &  )
virtual

This method overrides that in Lattice and always throw exceptions as there is not general way to do this for component lists.

Reimplemented from casacore::Lattice< casacore::Float >.

casacore::Bool casa::ComponentListImage::doGetMaskSlice ( casacore::Array< casacore::Bool > &  buffer,
const casacore::Slicer section 
)
virtual

The function (in the derived classes) doing the actual work.

These functions are public, so they can be used internally in the various Lattice classes.
However, doGetMaskSlice does not call Slicer::inferShapeFromSource to fill in possible unspecified section values. Therefore one should normally use one of the getMask(Slice) functions. doGetMaskSlice should be used with care and only when performance is an issue.
The default implementation gets the mask from the region and fills the buffer with True values if there is no region.

Reimplemented from casacore::MaskedLattice< casacore::Float >.

bool casa::ComponentListImage::doGetSlice ( casacore::Array< casacore::Float > &  buffer,
const casacore::Slicer section 
)
virtual

The functions (in the derived classes) doing the actual work.

These functions are public, so they can be used internally in the various Lattice classes, which is especially useful for doGetSlice.
However, doGetSlice does not call Slicer::inferShapeFromSource to fill in possible unspecified section values. Therefore one should normally use one of the get(Slice) functions. doGetSlice should be used with care and only when performance is an issue.

Implements casacore::Lattice< casacore::Float >.

void casa::ComponentListImage::doPutSlice ( const casacore::Array< casacore::Float > &  buffer,
const casacore::IPosition where,
const casacore::IPosition stride 
)
virtual

This method overrides that in Lattice and always throws an exception as there is not general way to do this for component lists.

Implements casacore::Lattice< casacore::Float >.

const casacore::LatticeRegion* casa::ComponentListImage::getRegionPtr ( ) const
virtual

Get a pointer the default pixelmask object used with this image.

It returns nullptr if no default pixelmask is used.

Implements casacore::MaskedLattice< casacore::Float >.

static casacore::Table& casa::ComponentListImage::getTable ( void *  imagePtr,
casacore::Bool  writable 
)
static

Return the internal Table object to the RegionHandler.

void casa::ComponentListImage::handleMath ( const casacore::Lattice< casacore::Float > &  from,
int  oper 
)
protectedvirtual

Overrides Lattice.

Always throws exception; arbitrary math cannot be represented with components.

Reimplemented from casacore::Lattice< casacore::Float >.

casacore::Bool casa::ComponentListImage::hasPixelMask ( ) const
virtual

Does the lattice have a pixelmask? The default implementation returns False.

Reimplemented from casacore::MaskedLattice< casacore::Float >.

casacore::String casa::ComponentListImage::imageType ( ) const
virtual

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

Implements casacore::ImageInterface< casacore::Float >.

casacore::Bool casa::ComponentListImage::isMasked ( ) const
virtual

Has the object really a mask? The default implementation returns True if the MaskedLattice has a region with a mask.

Reimplemented from casacore::MaskedLattice< casacore::Float >.

casacore::Bool casa::ComponentListImage::isPaged ( ) const
virtual

returns True if there is a persistent table associated with this object.

Reimplemented from casacore::LatticeBase.

casacore::Bool casa::ComponentListImage::isPersistent ( ) const
virtual

returns True if there is a persistent table associated with this object.

Reimplemented from casacore::LatticeBase.

casacore::Bool casa::ComponentListImage::isWritable ( ) const
virtual

Overrides the LatticeBase method.

The method refers to the Lattice characteristic and therefore always returns False.

Reimplemented from casacore::LatticeBase.

casacore::String casa::ComponentListImage::name ( bool  stripPath = false) const
virtual

If there is no persistent table associated with this object, returns "Temporary ComponentListImage".

Returns the name of the table otherwise.

Implements casacore::ImageInterface< casacore::Float >.

casacore::Bool casa::ComponentListImage::ok ( ) const
virtual

Check class invariants.

Implements casacore::ImageInterface< casacore::Float >.

static casacore::LatticeBase* casa::ComponentListImage::openCLImage ( const casacore::String name,
const casacore::MaskSpecifier  
)
static

Open an existing ComponentListImage.

This gets registered with ImageOpener. It simply calls and returns the result of new ComponentListImage(name).

ComponentListImage& casa::ComponentListImage::operator= ( const ComponentListImage other)

Assignment operator using reference semantics.

const casacore::Lattice<casacore::Bool>& casa::ComponentListImage::pixelMask ( ) const
virtual

Throws an exception is there is no pixel mask.

Reimplemented from casacore::MaskedLattice< casacore::Float >.

static void casa::ComponentListImage::registerOpenFunction ( )
static

In general, clients shouldn't need to call this.

This is for registering how to open a ComponentListImage with casacore ImageOpener.

void casa::ComponentListImage::removeRegion ( const casacore::String name,
casacore::RegionHandler::GroupType  = casacore::RegionHandler::Any,
casacore::Bool  throwIfUnknown = casacore::True 
)
virtual

overrides ImageInterface method

Reimplemented from casacore::ImageInterface< casacore::Float >.

void casa::ComponentListImage::resize ( const casacore::TiledShape newShape)
virtual

Function which changes the shape of the image (N.B.

the data is thrown away - the Image will be filled with nonsense afterwards)

Implements casacore::ImageInterface< casacore::Float >.

void casa::ComponentListImage::set ( const casacore::Float value)
virtual

Overrides Lattice method.

Always throws exception; there is no way to represent with a single component a source with constant intensity everywhere.

Reimplemented from casacore::Lattice< casacore::Float >.

void casa::ComponentListImage::setCache ( casacore::Bool  doCache)

controls if pixel values, directions, and frequencies are cached.

If doCache is false, existing cache values are destroyed if they exist.

casacore::Bool casa::ComponentListImage::setCoordinateInfo ( const casacore::CoordinateSystem coords)
virtual

Set the coordinate system.

Flush the new coordinate system to disk if the table exists is writable.

Reimplemented from casacore::ImageInterface< casacore::Float >.

void casa::ComponentListImage::setDefaultMask ( const casacore::String regionName)
virtual

Set the default pixelmask to the mask with the given name (which has to exist in the "masks" group).

If the image table is writable, the setting is persistent by writing the name as a keyword. If the given regionName is the empty string, the default pixelmask is unset.

Reimplemented from casacore::ImageInterface< casacore::Float >.

casacore::Bool casa::ComponentListImage::setImageInfo ( const casacore::ImageInfo info)
virtual
casacore::Bool casa::ComponentListImage::setMiscInfo ( const casacore::RecordInterface newInfo)
virtual
casacore::Bool casa::ComponentListImage::setUnits ( const casacore::Unit newUnits)
virtual

An exception is thrown if newUnits are anything but Jy/pixel.

Reimplemented from casacore::ImageInterface< casacore::Float >.

casacore::IPosition casa::ComponentListImage::shape ( ) const
virtual

return the shape of the image.

Implements casacore::LatticeBase.

void casa::ComponentListImage::useMask ( casacore::MaskSpecifier  = casacore::MaskSpecifier())
virtual

Overrides ImageInterface method.

Reimplemented from casacore::ImageInterface< casacore::Float >.

Member Data Documentation

casacore::Bool casa::ComponentListImage::_cache
private

Definition at line 307 of file ComponentListImage.h.

ComponentList casa::ComponentListImage::_cl
private

Definition at line 284 of file ComponentListImage.h.

std::shared_ptr<casacore::Bool> casa::ComponentListImage::_computedPtSources
private

Yes this really has to be a shared_ptr so that _ptSourcePixelVals can be computed outside the constructor and copying the image will work properly.

Definition at line 312 of file ComponentListImage.h.

casacore::MFrequency casa::ComponentListImage::_defaultFreq
private

Definition at line 315 of file ComponentListImage.h.

casacore::MeasRef<casacore::MDirection> casa::ComponentListImage::_dirRef
private

Definition at line 290 of file ComponentListImage.h.

casacore::Matrix<std::shared_ptr<casacore::MVDirection> > casa::ComponentListImage::_dirVals
private

Definition at line 291 of file ComponentListImage.h.

casacore::Int casa::ComponentListImage::_freqAxis
private

Definition at line 288 of file ComponentListImage.h.

casacore::MeasRef<casacore::MFrequency> casa::ComponentListImage::_freqRef
private

Definition at line 292 of file ComponentListImage.h.

casacore::Vector<std::shared_ptr<casacore::MVFrequency> > casa::ComponentListImage::_freqVals
private

Definition at line 293 of file ComponentListImage.h.

casacore::Bool casa::ComponentListImage::_hasFreq
private

Definition at line 308 of file ComponentListImage.h.

casacore::Bool casa::ComponentListImage::_hasStokes
private

Definition at line 309 of file ComponentListImage.h.

casacore::Int casa::ComponentListImage::_latAxis
private

Definition at line 288 of file ComponentListImage.h.

casacore::Int casa::ComponentListImage::_longAxis
private

Definition at line 288 of file ComponentListImage.h.

std::shared_ptr<casacore::LatticeRegion> casa::ComponentListImage::_mask
private

Definition at line 287 of file ComponentListImage.h.

ComponentList casa::ComponentListImage::_modifiedCL
private

Definition at line 284 of file ComponentListImage.h.

casacore::MVAngle casa::ComponentListImage::_pixelLatSize
private

Definition at line 289 of file ComponentListImage.h.

casacore::MVAngle casa::ComponentListImage::_pixelLongSize
private

Definition at line 289 of file ComponentListImage.h.

casacore::Vector<casacore::Int> casa::ComponentListImage::_pixelToIQUV
private

Definition at line 306 of file ComponentListImage.h.

std::shared_ptr<PtStoreType> casa::ComponentListImage::_ptSourcePixelVals
private

Definition at line 303 of file ComponentListImage.h.

casacore::IPosition casa::ComponentListImage::_shape
private

Definition at line 286 of file ComponentListImage.h.

casacore::Int casa::ComponentListImage::_stokesAxis
private

Definition at line 288 of file ComponentListImage.h.

std::shared_ptr<casacore::TempImage<casacore::Float> > casa::ComponentListImage::_valueCache
private

Definition at line 316 of file ComponentListImage.h.

const casacore::String casa::ComponentListImage::IMAGE_TYPE
static

Definition at line 121 of file ComponentListImage.h.


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