casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: 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 //#
26 //# $Id$
27 
28 #ifndef LATTICES_LCHDF5MASK_H
29 #define LATTICES_LCHDF5MASK_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38  // <summary>
39  // Class to define a rectangular mask as a region
40  // </summary>
41 
42  // <use visibility=local>
43 
44  // <reviewed reviewer="" date="" tests="">
45  // </reviewed>
46 
47  // <prerequisite>
48  // <li> <linkto class=LCRegionSingle>LCRegionSingle</linkto>
49  // </prerequisite>
50 
51  // <synopsis>
52  // The LCHDF5Mask class is a specialization of class
53  // <linkto class=LCRegionSingle>LCRegionSingle</linkto>.
54  // It holds a mask for an HDF5Image in an HDF5Lattice<Bool> object.
55  // </synopsis>
56 
57  class LCHDF5Mask: public LCRegionSingle
58  {
59  public:
60  LCHDF5Mask();
61 
62  // Construct an HDF5Mask object for (part of) a lattice.
63  // It is put in group Masks of the HDF5 file.
64  // The group is created if not existing yet.
65  // The box defines the position of the mask.
66  // The default mask shape is the lattice shape.
67  // <group>
69  const CountedPtr<HDF5File>& file, const String& maskName);
70  LCHDF5Mask (const TiledShape& maskShape, const LCBox& box,
71  const CountedPtr<HDF5File>& file, const String& maskName);
72  LCHDF5Mask (HDF5Lattice<Bool>& mask, const LCBox& box);
73  // </group>
74 
75  // Copy constructor (copy semantics).
76  LCHDF5Mask (const LCHDF5Mask& other);
77 
78  // Destructor
79  virtual ~LCHDF5Mask();
80 
81  // Assignment (reference semantics).
82  LCHDF5Mask& operator= (const LCHDF5Mask& other);
83 
84  // Comparison
85  virtual Bool operator==(const LCRegion& other) const;
86 
87  // Make a copy of the derived object.
88  virtual LCRegion* cloneRegion() const;
89 
90  // This function is used by the LatticeIterator class to generate an
91  // iterator of the correct type for this Lattice. Not recommended
92  // for general use.
94  (const LatticeNavigator& navigator,
95  Bool useRef) const;
96 
97  // Returns the maximum recommended number of pixels for a cursor.
98  // This is the number of pixels in a tile.
99  virtual uInt advisedMaxPixels() const;
100 
101  // Help the user pick a cursor for most efficient access.
102  virtual IPosition doNiceCursorShape (uInt maxPixels) const;
103 
104  // Flush the data (but do not unlock).
105  virtual void flush();
106 
107  // Get the class name (to store in the record).
108  static String className();
109 
110  // Region type. Returns class name.
111  virtual String type() const;
112 
113  // Convert the (derived) object to a record.
114  virtual TableRecord toRecord (const String& tableName) const;
115 
116  // Convert correct object from a record.
117  static LCHDF5Mask* fromRecord (const TableRecord&,
118  const String& tablename);
119 
120  // An LCHDF5Mask is writable if the underlying HDF5Lattice is.
121  virtual Bool isWritable() const;
122 
123  protected:
124  // Construct another LCHDF5Mask (for e.g. another lattice) by moving
125  // this one. It recalculates the bounding mask.
126  // A positive translation value indicates "to right".
127  virtual LCRegion* doTranslate (const Vector<Float>& translateVector,
128  const IPosition& newLatticeShape) const;
129 
130  private:
131  // Create the object from a record (for an existing mask).
133  const IPosition& blc,
134  const IPosition& latticeShape);
135 
136 
139  };
140 
141 
142 
143 } //# NAMESPACE CASACORE - END
144 
145 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:118
virtual void flush()
Flush the data (but do not unlock).
Class to define a rectangular box of interest.
Definition: LCBox.h:67
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
virtual uInt advisedMaxPixels() const
Returns the maximum recommended number of pixels for a cursor.
virtual Bool isWritable() const
An LCHDF5Mask is writable if the underlying HDF5Lattice is.
Class to define a rectangular mask as a region.
Definition: LCHDF5Mask.h:57
virtual IPosition doNiceCursorShape(uInt maxPixels) const
Help the user pick a cursor for most efficient access.
A base class for Lattice iterators.
Definition: ImageExpr.h:47
Define the shape and tile shape.
Definition: TiledShape.h:96
static String className()
Get the class name (to store in the record).
Referenced counted pointer for constant data.
Definition: CountedPtr.h:80
const IPosition & latticeShape() const
Give the full lattice shape.
Definition: LCRegion.h:231
virtual LCRegion * doTranslate(const Vector< Float > &translateVector, const IPosition &newLatticeShape) const
Construct another LCHDF5Mask (for e.g.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
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...
A hierarchical collection of named fields of various types.
Definition: TableRecord.h:185
virtual TableRecord toRecord(const String &tableName) const
Convert the (derived) object to a record.
LCHDF5Mask & operator=(const LCHDF5Mask &other)
Assignment (reference semantics).
virtual LCRegion * cloneRegion() const
Make a copy of the derived object.
virtual Bool operator==(const LCRegion &other) const
Comparison.
static LCHDF5Mask * fromRecord(const TableRecord &, const String &tablename)
Convert correct object from a record.
virtual ~LCHDF5Mask()
Destructor.
String: the storage and methods of handling collections of characters.
Definition: String.h:225
Abstract base class to define a single region.
virtual String type() const
Region type.
unsigned int uInt
Definition: aipstype.h:51
Abstract base class to steer lattice iterators.
Abstract base class to define a region of interest in lattice coordinates.
Definition: LCRegion.h:87
HDF5Lattice< Bool > itsMask
Definition: LCHDF5Mask.h:138