OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimPixelFlipper.h
Go to the documentation of this file.
1 //*******************************************************************
2 // Copyright (C) 2002 ImageLinks Inc.
3 //
4 // License: MIT
5 //
6 // See LICENSE.txt file in the top level directory for more details.
7 //
8 // Author: David Burken
9 //
10 // Description:
11 //
12 // Class to scan pixels and flip target dn pixel value to new dn pixel value.
13 // This was written to fix partial null pixels.
14 //
15 //*************************************************************************
16 // $Id: ossimPixelFlipper.h 19728 2011-06-06 21:31:17Z dburken $
17 #ifndef ossimPixelFlipper_HEADER
18 #define ossimPixelFlipper_HEADER
19 
22 #include <mutex>
23 
38 {
39 public:
40  static const char PF_TARGET_VALUE_KW[];
41  static const char PF_TARGET_RANGE_KW[];
42  static const char PF_REPLACEMENT_VALUE_KW[];
43  static const char PF_REPLACEMENT_MODE_KW[];
44  static const char PF_CLAMP_VALUE_KW[];
45  static const char PF_CLAMP_VALUE_LO_KW[];
46  static const char PF_CLAMP_VALUE_HI_KW[];
47  static const char PF_CLIP_MODE_KW[];
48 
82  {
83  REPLACE_BAND_IF_TARGET = 0,
84  REPLACE_BAND_IF_PARTIAL_TARGET = 1,
85  REPLACE_ALL_BANDS_IF_PARTIAL_TARGET = 2,
86  REPLACE_ONLY_FULL_TARGETS = 3,
87  REPLACE_ALL_BANDS_IF_ANY_TARGET = 4,
88  };
89 
95  {
96  DISABLED = 0,
97  CLAMPING_LO = 1,
98  CLAMPING_HI = 2,
99  CLAMPING_LO_AND_HI = 3,
100  };
101 
102  enum ClipMode
103  {
104  NONE = 0,
105  BOUNDING_RECT = 1,
106  VALID_VERTICES = 2
107  };
108 
110  ossimPixelFlipper(ossimObject* owner=NULL);
111 
112 
114  virtual ossimString getShortName()const;
115 
117  virtual void initialize();
118 
132  virtual ossimRefPtr<ossimImageData> getTile(const ossimIrect& tile_rect,
133  ossim_uint32 resLevel=0);
134 
135  virtual bool saveState(ossimKeywordlist& kwl,
136  const char* prefix=0)const;
137 
142  virtual bool loadState(const ossimKeywordlist& kwl,
143  const char* prefix=0);
144 
145  virtual ossimScalarType getOutputScalarType() const;
146  virtual ossim_float64 getMaxPixelValue (ossim_uint32 band = 0 ) const;
147  virtual ossim_float64 getMinPixelValue (ossim_uint32 band = 0 ) const;
148 
149  virtual std::ostream& print(std::ostream& out) const;
150 
155  void setTargetValue(ossim_float64 target_value);
156 
163  void setTargetRange(ossim_float64 target_min, ossim_float64 target_max);
164 
169  void setReplacementValue(ossim_float64 replacement_value);
170 
179  void setClampValue(ossim_float64 clamp_value, bool is_high_clamp_value=true);
180  void setClampValues(ossim_float64 clamp_value_lo, ossim_float64 clamp_value_hi);
181 
183  void setReplacementMode(ossimPixelFlipper::ReplacementMode mode);
184 
188  bool setReplacementMode(const ossimString& modeString);
189 
194  void setClipMode(const ossimString& modeString);
195  void setClipMode(ClipMode mode);
196 
197  //ossim_float64 getTargetValue() const;
198  ossim_float64 getReplacementValue() const;
199  //ossim_float64 getClampValue() const;
200  ossimPixelFlipper::ReplacementMode getReplacementMode() const;
201  ossimString getReplacementModeString() const;
202  ossimString getClipModeString() const;
203  ClipMode getClipMode() const;
204 
205  virtual ossimRefPtr<ossimProperty> getProperty(const ossimString& name)const;
206  virtual void setProperty(ossimRefPtr<ossimProperty> property);
207  virtual void getPropertyNames(std::vector<ossimString>& propertyNames)const;
208 
209 
210 protected:
212  virtual ~ossimPixelFlipper();
214  template <class T>
215  void flipPixels(T dummy, ossimImageData *inpuTile, ossim_uint32 resLevel);
216 
217  template <class T>
218  void clipTile(T dummy,
219  ossimImageData *inpuTile,
220  ossim_uint32 resLevel);
221 
226  bool inRange(ossim_float64 value) const;
227 
228  void allocateClipTileBuffer(ossimRefPtr<ossimImageData> inputImage);
229 
234 
239 
245 
262 
264  mutable std::recursive_mutex theMutex;
265 
266  mutable std::vector<ossimPolygon> theValidVertices;
267  mutable std::vector<ossimIrect> theBoundingRects;
268 
270 
271  TYPE_DATA
272 };
273 
274 
275 #endif
ossim_float64 theReplacementValue
When target values are defined, this is the value the pixel will assume if the pixel falls within the...
virtual void setProperty(ossimRefPtr< ossimProperty > property)
ReplacementMode
Target Replacement Mode:
Represents serializable keyword/value map.
ClipMode theClipMode
Border Clip mode.
ReplacementMode theReplacementMode
See documentation for ReplacementMode enum above.
std::recursive_mutex theMutex
For lock and unlock.
ossim_float64 theTargetValueLo
The value range to replace.
virtual ossimString getShortName() const
Definition: ossimObject.cpp:48
ClampingMode
When either a lo and/or hi clamp value is set, the clamping mode will be enabled accordingly and over...
virtual double getMinPixelValue(ossim_uint32 band=0) const
Returns the min pixel of the band.
double ossim_float64
virtual std::ostream & print(std::ostream &out) const
Outputs theErrorStatus as an ossimErrorCode and an ossimString.
ossim_float64 theTargetValueHi
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
#define TYPE_DATA
Definition: ossimRtti.h:339
unsigned int ossim_uint32
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
ClampingMode theClampingMode
ossim_float64 theClampValueHi
ossimScalarType
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
Class to scan pixels and flip target dn value to a replacement dn value.
#define OSSIM_DLL
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
ossim_float64 theClampValueLo
The range of desired pixel values.
ossimRefPtr< ossimImageData > theClipTileBuffer
std::vector< ossimIrect > theBoundingRects
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
std::vector< ossimPolygon > theValidVertices
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)