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
30//# Includes
31#include <casacore/casa/aips.h>
32#include <casacore/lattices/LRegions/LCBox.h>
33#include <casacore/lattices/Lattices/PagedArray.h>
34
35
36namespace casacore { //# NAMESPACE CASACORE - BEGIN
37
38// <summary>
39// Class to define a rectangular mask as a region
40// </summary>
41
42// <use visibility=export>
43
44// <reviewed reviewer="" date="" tests="">
45// </reviewed>
46
47// <prerequisite>
48// <li> <linkto class=LCRegion>LCRegion</linkto>
49// </prerequisite>
50
51// <synopsis>
52// The LCPagedMask class is a specialization of class
53// <linkto class=LCRegion>LCRegion</linkto>.
54// </synopsis>
55
56// <example>
57// <srcblock>
58// </srcblock>
59// </example>
60
61// <todo asof="1997/11/11">
62// </todo>
63
65{
66public:
68
69 // Construct a PagedMask object for (part of) a lattice.
70 // The box defines the position of the mask.
71 // The default mask shape is the lattice shape.
72 // <group>
73 LCPagedMask (const TiledShape& latticeShape, const String& tableName);
74 LCPagedMask (const TiledShape& maskShape, const LCBox& box,
75 const String& tableName);
77 // </group>
78
79 // Copy constructor (copy semantics).
80 LCPagedMask (const LCPagedMask& other);
81
82 // Destructor
83 virtual ~LCPagedMask();
84
85 // Assignment (reference semantics).
87
88 // Comparison
89 virtual Bool operator==(const LCRegion& other) const;
90
91 // Make a copy of the derived object.
92 virtual LCRegion* cloneRegion() const;
93
94 // This function is used by the LatticeIterator class to generate an
95 // iterator of the correct type for this Lattice. Not recommended
96 // for general use.
98 (const LatticeNavigator& navigator,
99 Bool useRef) const;
100
101 // Returns the maximum recommended number of pixels for a cursor.
102 // This is the number of pixels in a tile.
103 virtual uInt advisedMaxPixels() const;
104
105 // Help the user pick a cursor for most efficient access.
106 virtual IPosition doNiceCursorShape (uInt maxPixels) const;
107
108 // Maximum size - not necessarily all used. In pixels.
109 virtual uInt maximumCacheSize() const;
110
111 // Set the maximum (allowed) cache size as indicated.
112 virtual void setMaximumCacheSize (uInt howManyPixels);
113
114 // Set the cache size as to "fit" the indicated path.
115 virtual void setCacheSizeFromPath (const IPosition& sliceShape,
116 const IPosition& windowStart,
117 const IPosition& windowLength,
118 const IPosition& axisPath);
119
120 // Set the actual cache size for this Array to be be big enough for the
121 // indicated number of tiles. This cache is not shared with PagedArrays
122 // in other rows and is always clipped to be less than the maximum value
123 // set using the setMaximumCacheSize member function.
124 // tiles. Tiles are cached using a first in first out algorithm.
125 virtual void setCacheSizeInTiles (uInt howManyTiles);
126
127 // Clears and frees up the caches, but the maximum allowed cache size is
128 // unchanged from when setCacheSize was called
129 virtual void clearCache();
130
131 // Report on cache success.
132 virtual void showCacheStatistics (ostream& os) const;
133
134 // Handle deletion of the region by deleting the associated table.
135 virtual void handleDelete();
136
137 // Handle renaming the region by renaming the associated table.
138 // If overwrite=False, an exception will be thrown if a table with the
139 // new name already exists.
140 virtual void handleRename (const String& newName, Bool overwrite);
141
142 // Handle the (un)locking.
143 // <group>
144 virtual Bool lock (FileLocker::LockType, uInt nattempts);
145 virtual void unlock();
147 // </group>
148
149 // Resynchronize the PagedArray object with the lattice file.
150 // This function is only useful if no read-locking is used, ie.
151 // if the table lock option is UserNoReadLocking or AutoNoReadLocking.
152 // In that cases the table system does not acquire a read-lock, thus
153 // does not synchronize itself automatically.
154 virtual void resync();
155
156 // Flush the data (but do not unlock).
157 virtual void flush();
158
159 // Temporarily close the lattice.
160 // It will be reopened automatically on the next access.
161 virtual void tempClose();
162
163 // Explicitly reopen the temporarily closed lattice.
164 virtual void reopen();
165
166 // Get the class name (to store in the record).
168
169 // Region type. Returns class name.
170 virtual String type() const;
171
172 // Convert the (derived) object to a record.
173 virtual TableRecord toRecord (const String& tableName) const;
174
175 // Convert correct object from a record.
177 const String& tablename);
178
179 // An LCPagedMask is writable if the underlying PagedArray is.
180 virtual Bool isWritable() const;
181
182protected:
183 // Construct another LCPagedMask (for e.g. another lattice) by moving
184 // this one. It recalculates the bounding mask.
185 // A positive translation value indicates "to right".
186 virtual LCRegion* doTranslate (const Vector<Float>& translateVector,
187 const IPosition& newLatticeShape) const;
188
189private:
190 // Create the object from a record (for an existing mask).
192 const IPosition& blc,
193 const IPosition& latticeShape);
194
195
198};
199
200
201
202} //# NAMESPACE CASACORE - END
203
204#endif
LockType
Define the possible lock types.
Definition FileLocker.h:93
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 void showCacheStatistics(ostream &os) const
Report on cache success.
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 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 Bool operator==(const LCRegion &other) const
Comparison.
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:229
String: the storage and methods of handling collections of characters.
Definition String.h:223
this file contains all the compiler specific defines
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