casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //# $Id$
26 
27 
28 
29 #ifndef LATTICES_LCLELMASK_H
30 #define LATTICES_LCLELMASK_H
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
37 
38 
39 namespace casacore { //# NAMESPACE CASACORE - BEGIN
40 
41 //# Forward Declarations
42 class TableRecord;
43 class IPosition;
44 
45 
46 // <summary>
47 // Class to define a mask as a LEL expression
48 // </summary>
49 
50 // <use visibility=export>
51 
52 // <reviewed reviewer="" date="" tests="">
53 // </reviewed>
54 
55 // <prerequisite>
56 // <li> <linkto class=LCRegion>LCRegion</linkto>
57 // <li> <linkto class=ImageExpr>ImageExpr</linkto>
58 // </prerequisite>
59 
60 // <synopsis>
61 // The LCLELMask class is a specialization of class
62 // <linkto class=LCRegion>LCRegion</linkto>.
63 // <br>
64 // It can be used to define an on-the-fly mask for a lattice
65 // using a boolean <linkto class=LatticeExpr>LatticeExpr</linkto>.
66 // The contents of the mask are calculated on the fly from the expression.
67 // Thus the mask may change if the data in the lattice(s) used in the
68 // expression change.
69 // <note role=caution>
70 // This mask is not persistent, thus it cannot be saved with an image.
71 // Use class <linkto class=WCLELMask>WCLELMask</linkto> to have a
72 // persistent on-the-fly mask. It means that normally a WCLELMask should
73 // be used (which gets converted to an LCLELMask when applied to an image).
74 // </note>
75 // </synopsis>
76 
77 // <example>
78 // </example>
79 
80 // <motivation>
81 // LCLELMask is needed to make
82 // </motivation>
83 
84 //# <todo asof="1998/05/20">
85 //# <li>
86 //# </todo>
87 
88 class LCLELMask : public LCRegionSingle
89 {
90 public:
91  LCLELMask();
92 
93  // Construct from vectors of world coordinates
94  // defining the box corners. It is assumed that the
95  // order of the values is in the order of the pixel axes.
96  explicit LCLELMask (const LatticeExpr<Bool>& expr);
97 
98  // Copy constructor (copy semantics).
99  LCLELMask (const LCLELMask& other);
100 
101  // Destructor
102  virtual ~LCLELMask();
103 
104  // Assignment (copy semantics)
105  LCLELMask& operator= (const LCLELMask& other);
106 
107  // Comparison
108  virtual Bool operator== (const LCRegion& other) const;
109 
110  // Clone a LCLELMask object.
111  virtual LCRegion* cloneRegion() const;
112 
113  // Handle the (un)locking.
114  // <group>
115  virtual Bool lock (FileLocker::LockType, uInt nattempts);
116  virtual void unlock();
117  virtual Bool hasLock (FileLocker::LockType) const;
118  // </group>
119 
120  // Resynchronize the PagedArray object with the lattice file.
121  // This function is only useful if no read-locking is used, ie.
122  // if the table lock option is UserNoReadLocking or AutoNoReadLocking.
123  // In that cases the table system does not acquire a read-lock, thus
124  // does not synchronize itself automatically.
125  virtual void resync();
126 
127  // Temporarily close the lattice.
128  // It will be reopened automatically on the next access.
129  virtual void tempClose();
130 
131  // Explicitly reopen the temporarily closed lattice.
132  virtual void reopen();
133 
134  // Returns LCLELMask
135  static String className();
136 
137  // Return region type. Returns the class name
138  virtual String type() const;
139 
140  // Convert the LCLELMask object to a record.
141  // This cannot be done as a Lattice expression cannot be made persistent
142  // (only Image expressions can, thus only WCLELMask is persistent).
143  // <br>So this function throws an exception.
144  virtual TableRecord toRecord (const String& tableName) const;
145 
146 
147 protected:
148  // Translating an LCLELMask is not possible, so it throws an exception.
149  virtual LCRegion* doTranslate (const Vector<Float>& translateVector,
150  const IPosition& newLatticeShape) const;
151 
152 private:
155 };
156 
157 
158 
159 } //# NAMESPACE CASACORE - END
160 
161 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:118
virtual void tempClose()
Temporarily close the lattice.
LCLELMask & operator=(const LCLELMask &other)
Assignment (copy semantics)
Class to define a rectangular box of interest.
Definition: LCBox.h:67
virtual void resync()
Resynchronize the PagedArray object with the lattice file.
virtual Bool operator==(const LCRegion &other) const
Comparison.
virtual ~LCLELMask()
Destructor.
LatticeExpr< Bool > itsExpr
Definition: LCLELMask.h:154
virtual void reopen()
Explicitly reopen the temporarily closed lattice.
virtual Bool lock(FileLocker::LockType, uInt nattempts)
Handle the (un)locking.
virtual LCRegion * doTranslate(const Vector< Float > &translateVector, const IPosition &newLatticeShape) const
Translating an LCLELMask is not possible, so it throws an exception.
Class to define a mask as a LEL expression.
Definition: LCLELMask.h:88
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual TableRecord toRecord(const String &tableName) const
Convert the LCLELMask object to a record.
A hierarchical collection of named fields of various types.
Definition: TableRecord.h:185
static String className()
Returns LCLELMask.
String: the storage and methods of handling collections of characters.
Definition: String.h:225
virtual String type() const
Return region type.
virtual void unlock()
LockType
Define the possible lock types.
Definition: FileLocker.h:95
virtual LCRegion * cloneRegion() const
Clone a LCLELMask object.
Abstract base class to define a single region.
virtual Bool hasLock(FileLocker::LockType) const
unsigned int uInt
Definition: aipstype.h:51
Abstract base class to define a region of interest in lattice coordinates.
Definition: LCRegion.h:87