casacore
Loading...
Searching...
No Matches
LCPagedMask.h
Go to the documentation of this file.
1// # LCPagedMask.h: Class to define a rectangular mask as a region
2// # Copyright (C) 1998,1999,2000,2003
3// # Associated Universities, Inc. Washington DC, USA.
4// #
5// # This library is free software; you can redistribute it and/or modify it
6// # under the terms of the GNU Library General Public License as published by
7// # the Free Software Foundation; either version 2 of the License, or (at your
8// # option) any later version.
9// #
10// # This library is distributed in the hope that it will be useful, but WITHOUT
11// # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12// # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13// # License for more details.
14// #
15// # You should have received a copy of the GNU Library General Public License
16// # along with this library; if not, write to the Free Software Foundation,
17// # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18// #
19// # Correspondence concerning AIPS++ should be addressed as follows:
20// # Internet email: casa-feedback@nrao.edu.
21// # Postal address: AIPS++ Project Office
22// # National Radio Astronomy Observatory
23// # 520 Edgemont Road
24// # Charlottesville, VA 22903-2475 USA
25
26#ifndef LATTICES_LCPAGEDMASK_H
27#define LATTICES_LCPAGEDMASK_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/lattices/LRegions/LCBox.h>
32#include <casacore/lattices/Lattices/PagedArray.h>
33
34namespace casacore { // # NAMESPACE CASACORE - BEGIN
35
36// <summary>
37// Class to define a rectangular mask as a region
38// </summary>
39
40// <use visibility=export>
41
42// <reviewed reviewer="" date="" tests="">
43// </reviewed>
44
45// <prerequisite>
46// <li> <linkto class=LCRegion>LCRegion</linkto>
47// </prerequisite>
48
49// <synopsis>
50// The LCPagedMask class is a specialization of class
51// <linkto class=LCRegion>LCRegion</linkto>.
52// </synopsis>
53
54// <example>
55// <srcblock>
56// </srcblock>
57// </example>
58
59// <todo asof="1997/11/11">
60// </todo>
61
63 public:
65
66 // Construct a PagedMask object for (part of) a lattice.
67 // The box defines the position of the mask.
68 // The default mask shape is the lattice shape.
69 // <group>
70 LCPagedMask(const TiledShape& latticeShape, const String& tableName);
71 LCPagedMask(const TiledShape& maskShape, const LCBox& box, const String& tableName);
73 // </group>
74
75 // Copy constructor (copy semantics).
76 LCPagedMask(const LCPagedMask& other);
77
78 // Destructor
79 virtual ~LCPagedMask();
80
81 // Assignment (reference semantics).
83
84 // Make a copy of the derived object.
85 virtual LCRegion* cloneRegion() const;
86
87 // This function is used by the LatticeIterator class to generate an
88 // iterator of the correct type for this Lattice. Not recommended
89 // for general use.
91 Bool useRef) const;
92
93 // Returns the maximum recommended number of pixels for a cursor.
94 // This is the number of pixels in a tile.
95 virtual uInt advisedMaxPixels() const;
96
97 // Help the user pick a cursor for most efficient access.
98 virtual IPosition doNiceCursorShape(uInt maxPixels) const;
99
100 // Maximum size - not necessarily all used. In pixels.
101 virtual uInt maximumCacheSize() const;
102
103 // Set the maximum (allowed) cache size as indicated.
104 virtual void setMaximumCacheSize(uInt howManyPixels);
105
106 // Set the cache size as to "fit" the indicated path.
107 virtual void setCacheSizeFromPath(const IPosition& sliceShape, const IPosition& windowStart,
108 const IPosition& windowLength, const IPosition& axisPath);
109
110 // Set the actual cache size for this Array to be be big enough for the
111 // indicated number of tiles. This cache is not shared with PagedArrays
112 // in other rows and is always clipped to be less than the maximum value
113 // set using the setMaximumCacheSize member function.
114 // tiles. Tiles are cached using a first in first out algorithm.
115 virtual void setCacheSizeInTiles(uInt howManyTiles);
116
117 // Clears and frees up the caches, but the maximum allowed cache size is
118 // unchanged from when setCacheSize was called
119 virtual void clearCache();
120
121 // Report on cache success.
122 virtual void showCacheStatistics(std::ostream& os) const;
123
124 // Handle deletion of the region by deleting the associated table.
125 virtual void handleDelete();
126
127 // Handle renaming the region by renaming the associated table.
128 // If overwrite=False, an exception will be thrown if a table with the
129 // new name already exists.
130 virtual void handleRename(const String& newName, Bool overwrite);
131
132 // Handle the (un)locking.
133 // <group>
134 virtual Bool lock(FileLocker::LockType, uInt nattempts);
135 virtual void unlock();
137 // </group>
138
139 // Resynchronize the PagedArray object with the lattice file.
140 // This function is only useful if no read-locking is used, ie.
141 // if the table lock option is UserNoReadLocking or AutoNoReadLocking.
142 // In that cases the table system does not acquire a read-lock, thus
143 // does not synchronize itself automatically.
144 virtual void resync();
145
146 // Flush the data (but do not unlock).
147 virtual void flush();
148
149 // Temporarily close the lattice.
150 // It will be reopened automatically on the next access.
151 virtual void tempClose();
152
153 // Explicitly reopen the temporarily closed lattice.
154 virtual void reopen();
155
156 // Get the class name (to store in the record).
158
159 // Region type. Returns class name.
160 virtual String type() const;
161
162 // Convert the (derived) object to a record.
163 virtual TableRecord toRecord(const String& tableName) const;
164
165 // Convert correct object from a record.
166 static LCPagedMask* fromRecord(const TableRecord&, const String& tablename);
167
168 // An LCPagedMask is writable if the underlying PagedArray is.
169 virtual Bool isWritable() const;
170
171 protected:
172 // Comparison
173 virtual Bool equals(const LCRegion& other) const;
174
175 // Construct another LCPagedMask (for e.g. another lattice) by moving
176 // this one. It recalculates the bounding mask.
177 // A positive translation value indicates "to right".
178 virtual LCRegion* doTranslate(const Vector<Float>& translateVector,
179 const IPosition& newLatticeShape) const;
180
181 private:
182 // Create the object from a record (for an existing mask).
184
187};
188
189} // namespace casacore
190
191#endif
LockType
Define the possible lock types.
Definition FileLocker.h:89
LCPagedMask & operator=(const LCPagedMask &other)
Assignment (reference semantics).
virtual void handleDelete()
Handle deletion of the region by deleting the associated table.
virtual LCRegion * doTranslate(const Vector< Float > &translateVector, const IPosition &newLatticeShape) const
Construct another LCPagedMask (for e.g.
static LCPagedMask * fromRecord(const TableRecord &, const String &tablename)
Convert correct object from a record.
virtual Bool equals(const LCRegion &other) const
Comparison.
LCPagedMask(const TiledShape &latticeShape, const String &tableName)
Construct a PagedMask object for (part of) a lattice.
virtual Bool isWritable() const
An LCPagedMask is writable if the underlying PagedArray is.
virtual String type() const
Region type.
virtual void unlock()
virtual uInt maximumCacheSize() const
Maximum size - not necessarily all used.
virtual Bool hasLock(FileLocker::LockType) const
static String className()
Get the class name (to store in the record).
virtual LCRegion * cloneRegion() const
Make a copy of the derived object.
virtual void setCacheSizeInTiles(uInt howManyTiles)
Set the actual cache size for this Array to be be big enough for the indicated number of tiles.
virtual void reopen()
Explicitly reopen the temporarily closed lattice.
virtual void resync()
Resynchronize the PagedArray object with the lattice file.
virtual uInt advisedMaxPixels() const
Returns the maximum recommended number of pixels for a cursor.
LCPagedMask(const LCPagedMask &other)
Copy constructor (copy semantics).
LCPagedMask(const TiledShape &maskShape, const LCBox &box, const String &tableName)
LCPagedMask(PagedArray< Bool > &mask, const LCBox &box)
PagedArray< Bool > itsMask
virtual void tempClose()
Temporarily close the lattice.
virtual ~LCPagedMask()
Destructor.
virtual LatticeIterInterface< Bool > * makeIter(const LatticeNavigator &navigator, Bool useRef) const
This function is used by the LatticeIterator class to generate an iterator of the correct type for th...
virtual void showCacheStatistics(std::ostream &os) const
Report on cache success.
virtual IPosition doNiceCursorShape(uInt maxPixels) const
Help the user pick a cursor for most efficient access.
virtual Bool lock(FileLocker::LockType, uInt nattempts)
Handle the (un)locking.
virtual void flush()
Flush the data (but do not unlock).
virtual void setMaximumCacheSize(uInt howManyPixels)
Set the maximum (allowed) cache size as indicated.
virtual TableRecord toRecord(const String &tableName) const
Convert the (derived) object to a record.
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.
virtual void handleRename(const String &newName, Bool overwrite)
Handle renaming the region by renaming the associated table.
virtual void clearCache()
Clears and frees up the caches, but the maximum allowed cache size is unchanged from when setCacheSiz...
LCPagedMask(PagedArray< Bool > &mask, const IPosition &blc, const IPosition &latticeShape)
Create the object from a record (for an existing mask).
const IPosition & latticeShape() const
Give the full lattice shape.
Definition LCRegion.h:211
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40