casacore
Loading...
Searching...
No Matches
LCLELMask.h
Go to the documentation of this file.
1// # LCLELMask.h: Class to define a mask as a LEL expression
2// # Copyright (C) 2000
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_LCLELMASK_H
27#define LATTICES_LCLELMASK_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/lattices/LRegions/LCRegionSingle.h>
32#include <casacore/lattices/LRegions/LCBox.h>
33#include <casacore/lattices/LEL/LatticeExpr.h>
34
35namespace casacore { // # NAMESPACE CASACORE - BEGIN
36
37// # Forward Declarations
38class TableRecord;
39class IPosition;
40
41// <summary>
42// Class to define a mask as a LEL expression
43// </summary>
44
45// <use visibility=export>
46
47// <reviewed reviewer="" date="" tests="">
48// </reviewed>
49
50// <prerequisite>
51// <li> <linkto class=LCRegion>LCRegion</linkto>
52// <li> <linkto class=ImageExpr>ImageExpr</linkto>
53// </prerequisite>
54
55// <synopsis>
56// The LCLELMask class is a specialization of class
57// <linkto class=LCRegion>LCRegion</linkto>.
58// <br>
59// It can be used to define an on-the-fly mask for a lattice
60// using a boolean <linkto class=LatticeExpr>LatticeExpr</linkto>.
61// The contents of the mask are calculated on the fly from the expression.
62// Thus the mask may change if the data in the lattice(s) used in the
63// expression change.
64// <note role=caution>
65// This mask is not persistent, thus it cannot be saved with an image.
66// Use class <linkto class=WCLELMask>WCLELMask</linkto> to have a
67// persistent on-the-fly mask. It means that normally a WCLELMask should
68// be used (which gets converted to an LCLELMask when applied to an image).
69// </note>
70// </synopsis>
71
72// <example>
73// </example>
74
75// <motivation>
76// LCLELMask is needed to make
77// </motivation>
78
79// # <todo asof="1998/05/20">
80// # <li>
81// # </todo>
82
83class LCLELMask : public LCRegionSingle {
84 public:
86
87 // Construct from vectors of world coordinates
88 // defining the box corners. It is assumed that the
89 // order of the values is in the order of the pixel axes.
90 explicit LCLELMask(const LatticeExpr<Bool>& expr);
91
92 // Copy constructor (copy semantics).
93 LCLELMask(const LCLELMask& other);
94
95 // Destructor
96 virtual ~LCLELMask();
97
98 // Assignment (copy semantics)
100
101 // Clone a LCLELMask object.
102 LCRegion* cloneRegion() const override;
103
104 // Handle the (un)locking.
105 // <group>
106 Bool lock(FileLocker::LockType, uInt nattempts) override;
107 void unlock() override;
109 // </group>
110
111 // Resynchronize the PagedArray object with the lattice file.
112 // This function is only useful if no read-locking is used, ie.
113 // if the table lock option is UserNoReadLocking or AutoNoReadLocking.
114 // In that cases the table system does not acquire a read-lock, thus
115 // does not synchronize itself automatically.
116 void resync() override;
117
118 // Temporarily close the lattice.
119 // It will be reopened automatically on the next access.
120 void tempClose() override;
121
122 // Explicitly reopen the temporarily closed lattice.
123 void reopen() override;
124
125 // Returns LCLELMask
127
128 // Return region type. Returns the class name
129 String type() const override;
130
131 // Convert the LCLELMask object to a record.
132 // This cannot be done as a Lattice expression cannot be made persistent
133 // (only Image expressions can, thus only WCLELMask is persistent).
134 // <br>So this function throws an exception.
135 TableRecord toRecord(const String& tableName) const override;
136
137 protected:
138 // Comparison
139 Bool equals(const LCRegion& other) const override;
140
141 // Translating an LCLELMask is not possible, so it throws an exception.
142 LCRegion* doTranslate(const Vector<Float>& translateVector,
143 const IPosition& newLatticeShape) const override;
144
145 private:
148};
149
150} // namespace casacore
151
152#endif
LockType
Define the possible lock types.
Definition FileLocker.h:89
LCRegion * doTranslate(const Vector< Float > &translateVector, const IPosition &newLatticeShape) const override
Translating an LCLELMask is not possible, so it throws an exception.
Bool lock(FileLocker::LockType, uInt nattempts) override
Handle the (un)locking.
void tempClose() override
Temporarily close the lattice.
TableRecord toRecord(const String &tableName) const override
Convert the LCLELMask object to a record.
LatticeExpr< Bool > itsExpr
Definition LCLELMask.h:147
String type() const override
Return region type.
void unlock() override
void resync() override
Resynchronize the PagedArray object with the lattice file.
LCLELMask & operator=(const LCLELMask &other)
Assignment (copy semantics).
virtual ~LCLELMask()
Destructor.
LCLELMask(const LCLELMask &other)
Copy constructor (copy semantics).
LCRegion * cloneRegion() const override
Clone a LCLELMask object.
Bool hasLock(FileLocker::LockType) const override
LCLELMask(const LatticeExpr< Bool > &expr)
Construct from vectors of world coordinates defining the box corners.
void reopen() override
Explicitly reopen the temporarily closed lattice.
Bool equals(const LCRegion &other) const override
Comparison.
static String className()
Returns LCLELMask.
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
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40