casacore
Loading...
Searching...
No Matches
LCMask.h
Go to the documentation of this file.
1//# LCMask.h: Class to define a rectangular mask as a temporary region
2//# Copyright (C) 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_LCMASK_H
27#define LATTICES_LCMASK_H
28
29
30//# Includes
31#include <casacore/casa/aips.h>
32#include <casacore/lattices/LRegions/LCBox.h>
33#include <casacore/lattices/Lattices/Lattice.h>
34
35
36namespace casacore { //# NAMESPACE CASACORE - BEGIN
37
38// <summary>
39// Class to define a rectangular mask as a temporary 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 LCMask class is a specialization of class
53// <linkto class=LCRegion>LCRegion</linkto>.
54// <br>
55// It can be used to define a temporary mask (e.g. for a
56// <linkto class=TempImage>TempImage</linkto>).
57// It is possible to define the mask for the full lattice, but one
58// can also define it for part of a lattice. In the latter case a
59// <linkto class=LCBox>LCBox</linkto> has to be given as well to
60// define for which part of the image the mask has to be used.
61// </synopsis>
62
63// <example>
64// <srcblock>
65// </srcblock>
66// </example>
67
68// <todo asof="1997/11/11">
69// </todo>
70
72{
73public:
75
76 // Construct an LCMask object for a full lattice with the given shape.
77 // It creates a TempLattice<Bool> to hold the mask.
78 explicit LCMask (const IPosition& latticeShape);
79
80 // Construct an LCMask object for a full lattice with the shape of the mask.
81 // It clones the mask object.
83
84 // Construct an LCMask object for the part of a lattice given by the box.
85 // The box defines the position of the mask in the lattice.
86 // The box shape and given mask shape should be equal.
87 // It creates a TempImage<Bool> to hold the mask.
88 LCMask (const IPosition& maskShape, const LCBox& box);
89
90 // Construct an LCMask object for the part of a lattice given by the box.
91 // The box defines the position of the mask in the lattice.
92 // The box shape and given mask shape should be equal.
93 // It clones the mask object.
95
96 // Copy constructor (copy semantics).
97 LCMask (const LCMask& other);
98
99 // Destructor
100 virtual ~LCMask();
101
102 // Assignment (reference semantics).
103 LCMask& operator= (const LCMask& other);
104
105 // Comparison
106 virtual Bool operator==(const LCRegion& other) const;
107
108 // Make a copy of the derived object.
109 virtual LCRegion* cloneRegion() const;
110
111 // This function is used by the LatticeIterator class to generate an
112 // iterator of the correct type for this Lattice. Not recommended
113 // for general use.
115 (const LatticeNavigator& navigator,
116 Bool useRef) const;
117
118 // Returns the maximum recommended number of pixels for a cursor.
119 // This is the number of pixels in a tile.
120 virtual uInt advisedMaxPixels() const;
121
122 // Help the user pick a cursor for most efficient access.
123 virtual IPosition doNiceCursorShape (uInt maxPixels) const;
124
125 // Maximum size - not necessarily all used. In pixels.
126 virtual uInt maximumCacheSize() const;
127
128 // Set the maximum (allowed) cache size as indicated.
129 virtual void setMaximumCacheSize (uInt howManyPixels);
130
131 // Set the cache size as to "fit" the indicated path.
132 virtual void setCacheSizeFromPath (const IPosition& sliceShape,
133 const IPosition& windowStart,
134 const IPosition& windowLength,
135 const IPosition& axisPath);
136
137 // Set the actual cache size for this Array to be be big enough for the
138 // indicated number of tiles. This cache is not shared with PagedArrays
139 // in other rows and is always clipped to be less than the maximum value
140 // set using the setMaximumCacheSize member function.
141 // tiles. Tiles are cached using a first in first out algorithm.
142 virtual void setCacheSizeInTiles (uInt howManyTiles);
143
144 // Clears and frees up the caches, but the maximum allowed cache size is
145 // unchanged from when setCacheSize was called
146 virtual void clearCache();
147
148 // Report on cache success.
149 virtual void showCacheStatistics (ostream& os) const;
150
151 // Handle the (un)locking.
152 // <group>
153 virtual Bool lock (FileLocker::LockType, uInt nattempts);
154 virtual void unlock();
156 // </group>
157
158 // Resynchronize the object with the contenta tof the possible file.
159 // This function is only useful if no read-locking is used, ie.
160 // if the table lock option is UserNoReadLocking or AutoNoReadLocking.
161 // In that cases the table system does not acquire a read-lock, thus
162 // does not synchronize itself automatically.
163 virtual void resync();
164
165 // Flush the data (but do not unlock).
166 virtual void flush();
167
168 // Temporarily close the lattice.
169 // It will be reopened automatically on the next access.
170 virtual void tempClose();
171
172 // Explicitly reopen the temporarily closed lattice.
173 virtual void reopen();
174
175 // Get the class name (to store in the record).
177
178 // Region type. Returns class name.
179 virtual String type() const;
180
181 // Convert the (derived) object to a record.
182 // This cannot be done and results in an exception.
183 virtual TableRecord toRecord (const String& tableName) const;
184
185 // An LCMask is writable if the underlying Lattice is.
186 virtual Bool isWritable() const;
187
188protected:
189 // Construct another LCMask (for e.g. another lattice) by moving
190 // this one. It recalculates the bounding mask.
191 // A positive translation value indicates "to right".
192 virtual LCRegion* doTranslate (const Vector<Float>& translateVector,
193 const IPosition& newLatticeShape) const;
194
195private:
198};
199
200
201
202} //# NAMESPACE CASACORE - END
203
204#endif
LockType
Define the possible lock types.
Definition FileLocker.h:93
LCMask(const IPosition &latticeShape)
Construct an LCMask object for a full lattice with the given shape.
static String className()
Get the class name (to store in the record).
virtual uInt advisedMaxPixels() const
Returns the maximum recommended number of pixels for a cursor.
virtual ~LCMask()
Destructor.
LCMask(const IPosition &maskShape, const LCBox &box)
Construct an LCMask object for the part of a lattice given by the box.
virtual IPosition doNiceCursorShape(uInt maxPixels) const
Help the user pick a cursor for most efficient access.
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 uInt maximumCacheSize() const
Maximum size - not necessarily all used.
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 String type() const
Region type.
LCMask(const LCMask &other)
Copy constructor (copy semantics).
virtual void unlock()
virtual TableRecord toRecord(const String &tableName) const
Convert the (derived) object to a record.
virtual Bool hasLock(FileLocker::LockType) const
virtual Bool lock(FileLocker::LockType, uInt nattempts)
Handle the (un)locking.
virtual LCRegion * cloneRegion() const
Make a copy of the derived object.
virtual void tempClose()
Temporarily close the lattice.
LCMask(Lattice< Bool > &mask)
Construct an LCMask object for a full lattice with the shape of the mask.
virtual void showCacheStatistics(ostream &os) const
Report on cache success.
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 flush()
Flush the data (but do not unlock).
LCMask(Lattice< Bool > &mask, const LCBox &box)
Construct an LCMask object for the part of a lattice given by the box.
virtual void setMaximumCacheSize(uInt howManyPixels)
Set the maximum (allowed) cache size as indicated.
Lattice< Bool > * itsMask
Definition LCMask.h:197
virtual void clearCache()
Clears and frees up the caches, but the maximum allowed cache size is unchanged from when setCacheSiz...
virtual void resync()
Resynchronize the object with the contenta tof the possible file.
virtual void reopen()
Explicitly reopen the temporarily closed lattice.
virtual Bool operator==(const LCRegion &other) const
Comparison.
LCMask & operator=(const LCMask &other)
Assignment (reference semantics).
virtual Bool isWritable() const
An LCMask is writable if the underlying Lattice is.
virtual LCRegion * doTranslate(const Vector< Float > &translateVector, const IPosition &newLatticeShape) const
Construct another LCMask (for e.g.
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