casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImageMaskHandler.h
Go to the documentation of this file.
1 #ifndef IMAGEANALYSIS_IMAGEMASKHANDLER_H
2 #define IMAGEANALYSIS_IMAGEMASKHANDLER_H
3 
4 #include <casa/BasicSL/String.h>
5 #include <casa/Arrays/Vector.h>
6 
8 
9 // #include <lattices/Lattices/LatticeExprNode.h>
10 
11 #include <set>
12 
13 namespace casacore{
14 
15 class ImageRegion;
16 class LatticeExprNode;
17 template <class T> class MaskedLattice;
18 }
19 
20 namespace casa {
21 
22 
23 template <class T> class ImageMaskHandler {
24 
25  // <summary>
26  // Perform various image mask operations
27  // </summary>
28 
29  // <reviewed reviewer="" date="" tests="" demos="">
30  // </reviewed>
31 
32  // <prerequisite>
33  // </prerequisite>
34 
35  // <etymology>
36  // </etymology>
37 
38  // <synopsis>
39  // </synopsis>
40 
41 public:
43 
45 
46  // set default mask. Empty string means unset default mask.
47  void set(const casacore::String& name);
48 
49  // return the default mask name
51 
52  // delete specified masks
53  void deleteMasks(const std::set<casacore::String>& masks);
54 
55  // rename a mask
56  void rename(const casacore::String& oldName, const casacore::String& newName);
57 
58  // get all mask names
60 
61  // copy mask
62  void copy(const casacore::String& currentName, const casacore::String& newName);
63 
64  void calcmask(
65  const casacore::String& mask, casacore::Record& regions,
66  const casacore::String& name, casacore::Bool asdefault=true
67  );
68 
69  // copy the mask from the specified lattice to the image's (default) mask. The mask
70  // and the image must have the same shape.
71  template <class U> void copy(const casacore::MaskedLattice<U>& mask);
72 
73 private:
74  const SPIIT _image;
75 
76  void _calcmask(
77  const casacore::LatticeExprNode& node,
78  const casacore::String& name, const casacore::Bool makedefault
79  );
80 
81  // Make a block of regions from a Record
82  static void _makeRegionBlock(
84  const casacore::Record& Regions
85  );
86 };
87 
88 }
89 
90 #ifndef AIPS_NO_TEMPLATE_SRC
91 #include <imageanalysis/ImageAnalysis/ImageMaskHandler.tcc>
92 #endif
93 
94 #endif
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
void copy(const casacore::String &currentName, const casacore::String &newName)
copy mask
casacore::String defaultMask() const
return the default mask name
static void _makeRegionBlock(casacore::PtrBlock< const casacore::ImageRegion * > &regions, const casacore::Record &Regions)
Make a block of regions from a Record.
A templated, abstract base class for array-like objects with masks.
void set(const casacore::String &name)
set default mask.
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
void _calcmask(const casacore::LatticeExprNode &node, const casacore::String &name, const casacore::Bool makedefault)
void rename(const casacore::String &oldName, const casacore::String &newName)
rename a mask
#define SPIIT
Definition: ImageTypedefs.h:34
void deleteMasks(const std::set< casacore::String > &masks)
delete specified masks
ImageMaskHandler(SPIIT)
Perform various image mask operations.
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void calcmask(const casacore::String &mask, casacore::Record &regions, const casacore::String &name, casacore::Bool asdefault=true)
A drop-in replacement for Block&lt;T*&gt;.
Definition: WProjectFT.h:54
Bridging class to allow C++ expressions involving lattices.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42