ifw-odp  2.0.0-alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mask.hpp
Go to the documentation of this file.
1 
9 #ifndef ODP_MASK_HPP
10 #define ODP_MASK_HPP
11 
12 #ifndef __cplusplus
13 #error This is a C++ include file and cannot be used from plain C
14 #endif
15 
16 #include <iostream>
17 #include "cpl_mask.h"
18 #include "cppcpl/error.hpp"
19 
20 namespace odp {
21 
22  // forward declaration
23  class Image;
24 
25 
37  class Mask: virtual public odp::Error
38  {
39  public:
46  Mask();
47 
56  explicit Mask(cpl_size width, cpl_size height);
57 
65  explicit Mask(const Mask &mask);
66 
79  explicit Mask(const Mask &mask,
80  const cpl_size llx,
81  const cpl_size lly,
82  const cpl_size urx,
83  const cpl_size ury);
84 
96  explicit Mask(const Image &image);
97 
107  explicit Mask(const Image &image, double lo_cut, double hi_cut);
108 
115  virtual ~Mask();
116 
122  inline bool IsMask() const;
123 
131  void GetMaskPtr(void **data_ptr) const;
132 
138  inline void* GetMaskPtr() const;
139 
145  inline cpl_mask* GetCplMask() const;
146 
153  inline void SetCplMask(cpl_mask *mask);
154 
161  inline cpl_size GetWidth() const;
162 
169  inline cpl_size GetHeight() const;
170 
182  void Get(cpl_size width,
183  cpl_size height,
184  bool *value) const;
185 
197  bool Get(cpl_size width,
198  cpl_size height) const;
199 
211  void Set(cpl_size row,
212  cpl_size col,
213  bool value);
214 
221  Mask& operator=(const Mask&) ;
222 
229  bool operator==(const Mask&) const;
230 
237  bool operator!=(const Mask&) const;
238 
239  friend std::ostream& operator<<(std::ostream &os, const Mask &mask);
240 
241  private:
249  void Delete();
250 
251  protected:
252  cpl_mask* m_cpl_mask;
253 
254  };
255 }
256 
257 #include "mask.ipp"
258 
259 #endif
This class is C++ wrapper for a CPL image object. It provides a simplified interface that allows to c...
Definition: image.hpp:43
virtual ~Mask()
Class destructor.
Definition: mask.cpp:110
bool operator!=(const Mask &) const
Overload operator !=.
Definition: mask.cpp:216
bool operator==(const Mask &) const
Overload operator==.
Definition: mask.cpp:189
friend std::ostream & operator<<(std::ostream &os, const Mask &mask)
Mask()
Class constructor.
Definition: mask.cpp:26
This class handle the errors produced by the calling of image processing routines.
Definition: error.hpp:34
cpl_size GetHeight() const
Get mask height.
void * GetMaskPtr() const
Get pointer to mask data.
cpl_size GetWidth() const
Get mask width.
bool IsMask() const
Check is CPL mask is not null.
void Get(cpl_size width, cpl_size height, bool *value) const
Get value of an element in the mask.
Definition: mask.cpp:124
Error class header file.
cpl_mask * GetCplMask() const
Get CPL mask pointer.
Mask & operator=(const Mask &)
Overload operator=.
Definition: mask.cpp:175
This class is C++ wrapper for a CPL mask object. It provides a simplified interface that allows to ca...
Definition: mask.hpp:37
void Set(cpl_size row, cpl_size col, bool value)
Set an element value in the mask.
Definition: mask.cpp:156
void SetCplMask(cpl_mask *mask)
Set CPL mask.
cpl_mask * m_cpl_mask
Definition: mask.hpp:252