casacore
Loading...
Searching...
No Matches
LCHDF5Mask.h
Go to the documentation of this file.
1// # LCHDF5Mask.h: Class to define a rectangular mask of interest
2// # Copyright (C) 2008
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_LCHDF5MASK_H
27#define LATTICES_LCHDF5MASK_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/lattices/LRegions/LCBox.h>
32#include <casacore/lattices/Lattices/HDF5Lattice.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=local>
41
42// <reviewed reviewer="" date="" tests="">
43// </reviewed>
44
45// <prerequisite>
46// <li> <linkto class=LCRegionSingle>LCRegionSingle</linkto>
47// </prerequisite>
48
49// <synopsis>
50// The LCHDF5Mask class is a specialization of class
51// <linkto class=LCRegionSingle>LCRegionSingle</linkto>.
52// It holds a mask for an HDF5Image in an HDF5Lattice<Bool> object.
53// </synopsis>
54
55class LCHDF5Mask : public LCRegionSingle {
56 public:
58
59 // Construct an HDF5Mask object for (part of) a lattice.
60 // It is put in group Masks of the HDF5 file.
61 // The group is created if not existing yet.
62 // The box defines the position of the mask.
63 // The default mask shape is the lattice shape.
64 // <group>
65 LCHDF5Mask(const TiledShape& latticeShape, const std::shared_ptr<HDF5File>& file,
66 const String& maskName);
67 LCHDF5Mask(const TiledShape& maskShape, const LCBox& box, const std::shared_ptr<HDF5File>& file,
68 const String& maskName);
70 // </group>
71
72 // Copy constructor (copy semantics).
73 LCHDF5Mask(const LCHDF5Mask& other);
74
75 // Destructor
76 virtual ~LCHDF5Mask();
77
78 // Assignment (reference semantics).
80
81 // Make a copy of the derived object.
82 LCRegion* cloneRegion() const override;
83
84 // This function is used by the LatticeIterator class to generate an
85 // iterator of the correct type for this Lattice. Not recommended
86 // for general use.
88 Bool useRef) const override;
89
90 // Returns the maximum recommended number of pixels for a cursor.
91 // This is the number of pixels in a tile.
92 uInt advisedMaxPixels() const override;
93
94 // Help the user pick a cursor for most efficient access.
95 IPosition doNiceCursorShape(uInt maxPixels) const override;
96
97 // Flush the data (but do not unlock).
98 void flush() override;
99
100 // Get the class name (to store in the record).
102
103 // Region type. Returns class name.
104 String type() const override;
105
106 // Convert the (derived) object to a record.
107 TableRecord toRecord(const String& tableName) const override;
108
109 // Convert correct object from a record.
110 static LCHDF5Mask* fromRecord(const TableRecord&, const String& tablename);
111
112 // An LCHDF5Mask is writable if the underlying HDF5Lattice is.
113 Bool isWritable() const override;
114
115 protected:
116 // Construct another LCHDF5Mask (for e.g. another lattice) by moving
117 // this one. It recalculates the bounding mask.
118 // A positive translation value indicates "to right".
119 LCRegion* doTranslate(const Vector<Float>& translateVector,
120 const IPosition& newLatticeShape) const override;
121
122 private:
123 // Comparison
124 Bool equals(const LCRegion& other) const override;
125
126 // Create the object from a record (for an existing mask).
128
131};
132
133} // namespace casacore
134
135#endif
LCHDF5Mask & operator=(const LCHDF5Mask &other)
Assignment (reference semantics).
Bool isWritable() const override
An LCHDF5Mask is writable if the underlying HDF5Lattice is.
LCHDF5Mask(const TiledShape &latticeShape, const std::shared_ptr< HDF5File > &file, const String &maskName)
Construct an HDF5Mask object for (part of) a lattice.
String type() const override
Region type.
LCHDF5Mask(HDF5Lattice< Bool > &mask, const IPosition &blc, const IPosition &latticeShape)
Create the object from a record (for an existing mask).
Bool equals(const LCRegion &other) const override
Comparison.
TableRecord toRecord(const String &tableName) const override
Convert the (derived) object to a record.
LCRegion * cloneRegion() const override
Make a copy of the derived object.
LCHDF5Mask(HDF5Lattice< Bool > &mask, const LCBox &box)
uInt advisedMaxPixels() const override
Returns the maximum recommended number of pixels for a cursor.
LCHDF5Mask(const LCHDF5Mask &other)
Copy constructor (copy semantics).
LCRegion * doTranslate(const Vector< Float > &translateVector, const IPosition &newLatticeShape) const override
Construct another LCHDF5Mask (for e.g.
LCHDF5Mask(const TiledShape &maskShape, const LCBox &box, const std::shared_ptr< HDF5File > &file, const String &maskName)
HDF5Lattice< Bool > itsMask
Definition LCHDF5Mask.h:130
LatticeIterInterface< Bool > * makeIter(const LatticeNavigator &navigator, Bool useRef) const override
This function is used by the LatticeIterator class to generate an iterator of the correct type for th...
virtual ~LCHDF5Mask()
Destructor.
IPosition doNiceCursorShape(uInt maxPixels) const override
Help the user pick a cursor for most efficient access.
static String className()
Get the class name (to store in the record).
void flush() override
Flush the data (but do not unlock).
static LCHDF5Mask * fromRecord(const TableRecord &, const String &tablename)
Convert correct object from a record.
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