OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ossimMeanMedianFilter Class Reference

#include <ossimMeanMedianFilter.h>

Inheritance diagram for ossimMeanMedianFilter:
ossimImageSourceFilter ossimImageSource ossimConnectableObjectListener ossimSource ossimListener ossimConnectableObject ossimErrorStatusInterface ossimObject ossimListenerManager ossimPropertyInterface ossimReferenced

Public Types

enum  ossimMeanMedianFilterType {
  OSSIM_MEDIAN = 0, OSSIM_MEDIAN_FILL_NULLS = 1, OSSIM_MEDIAN_NULL_CENTER_ONLY = 2, OSSIM_MEAN = 3,
  OSSIM_MEAN_FILL_NULLS = 4, OSSIM_MEAN_NULL_CENTER_ONLY = 5
}
 
- Public Types inherited from ossimConnectableObject
enum  ossimConnectableObjectDirectionType { CONNECTABLE_DIRECTION_NONE = 0, CONNECTABLE_DIRECTION_INPUT = 1, CONNECTABLE_DIRECTION_OUTPUT = 2 }
 
typedef std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
 

Public Member Functions

 ossimMeanMedianFilter (ossimObject *owner=NULL)
 
virtual ~ossimMeanMedianFilter ()
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIrect &rect, ossim_uint32 resLevel=0)
 
virtual void initialize ()
 
void setWindowSize (ossim_uint32 windowSize)
 
ossim_uint32 getWindowSize () const
 
void setAutoGrowRectFlag (bool flag)
 
bool getAutoGrowRectFlag () const
 
void setFilterType (ossimMeanMedianFilterType type)
 
void setFilterType (const ossimString &type)
 
ossimString getFilterTypeString () const
 
void getFilterTypeList (std::vector< ossimString > &list) const
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Method to save the state of an object to a keyword list. More...
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 Method to the load (recreate) the state of an object from a keyword list. More...
 
virtual ossimIrect getBoundingRect (ossim_uint32 resLevel=0) const
 
- Public Member Functions inherited from ossimImageSourceFilter
 ossimImageSourceFilter (ossimObject *owner=NULL)
 
 ossimImageSourceFilter (ossimImageSource *inputSource)
 
 ossimImageSourceFilter (ossimObject *owner, ossimImageSource *inputSource)
 
virtual void getOutputBandList (std::vector< ossim_uint32 > &bandList) const
 
virtual ossim_uint32 getNumberOfInputBands () const
 
bool canConnectMyInputTo (ossim_int32 inputIndex, const ossimConnectableObject *object) const
 required to be overriden by derived classes More...
 
virtual void connectInputEvent (ossimConnectionEvent &event)
 
virtual void disconnectInputEvent (ossimConnectionEvent &event)
 
virtual void propertyEvent (ossimPropertyEvent &event)
 
virtual void refreshEvent (ossimRefreshEvent &event)
 
- Public Member Functions inherited from ossimImageSource
 ossimImageSource (ossimObject *owner=0)
 
 ossimImageSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimImageSource ()
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIpt &origin, ossim_uint32 resLevel=0)
 
virtual bool getTile (ossimImageData *result, ossim_uint32 resLevel=0)
 Method to get a tile. More...
 
virtual ossimObjectgetObject ()
 For RTTI support. More...
 
virtual const ossimObjectgetObject () const
 For RTTI support. More...
 
virtual void getDecimationFactor (ossim_uint32 resLevel, ossimDpt &result) const
 Will return the decimation factor for the given resolution level. More...
 
virtual void getDecimationFactors (std::vector< ossimDpt > &decimations) const
 Will return an array of all decimations for each resolution level. More...
 
virtual ossim_uint32 getNumberOfDecimationLevels () const
 Will return the number of resolution levels. More...
 
virtual ossim_uint32 getNumberOfOutputBands () const
 Returns the number of bands in a tile returned from this TileSource. More...
 
virtual ossimScalarType getOutputScalarType () const
 This will be used to query the output pixel type of the tile source. More...
 
virtual ossim_uint32 getTileWidth () const
 Returns the default processing tile width. More...
 
virtual ossim_uint32 getTileHeight () const
 Returns the default processing tile height. More...
 
virtual double getNullPixelValue (ossim_uint32 band=0) const
 Each band has a null pixel associated with it. More...
 
virtual double getMinPixelValue (ossim_uint32 band=0) const
 Returns the min pixel of the band. More...
 
virtual double getMaxPixelValue (ossim_uint32 band=0) const
 Returns the max pixel of the band. More...
 
virtual void getBoundingRect (ossimIrect &rect, ossim_uint32 resLevel=0) const
 Gets the bounding rectangle of the source. More...
 
virtual void getValidImageVertices (std::vector< ossimIpt > &validVertices, ossimVertexOrdering ordering=OSSIM_CLOCKWISE_ORDER, ossim_uint32 resLevel=0) const
 ordering specifies how the vertices should be arranged. More...
 
virtual ossimRefPtr< ossimImageGeometrygetImageGeometry ()
 Returns the image geometry object associated with this tile source or NULL if not defined. More...
 
virtual void setImageGeometry (const ossimImageGeometry *geom)
 Default implementation sets geometry of the first input to the geometry specified. More...
 
virtual void saveImageGeometry () const
 Default method to call input's saveImageGeometry. More...
 
virtual void saveImageGeometry (const ossimFilename &geometry_file) const
 Default method to call input's saveImageGeometry. More...
 
virtual bool isIndexedData () const
 
- Public Member Functions inherited from ossimSource
 ossimSource (ossimObject *owner=0)
 
 ossimSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimSource ()
 
virtual bool isSourceEnabled () const
 
virtual void enableSource ()
 
virtual void disableSource ()
 
virtual bool getEnableFlag () const
 
virtual void setEnableFlag (bool flag)
 
virtual bool isInitialized () const
 
virtual void setInitializedFlag (bool flag)
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
- Public Member Functions inherited from ossimConnectableObject
 ossimConnectableObject (ossimObject *owner=0)
 Base constructor of this object. More...
 
 ossimConnectableObject (ossimObject *owner, ossim_int32 inputListSize, ossim_int32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimConnectableObject ()
 
void setId (const ossimId &id)
 All connectable objects will have id's. More...
 
const ossimIdgetId () const
 Will allow us to get this object's id. More...
 
const ossimObjectgetOwner () const
 Fetches the current owner, most likely a container but not limited to one. More...
 
virtual void changeOwner (ossimObject *owner)
 Permits changing the object's owner. More...
 
virtual void setDescription (const ossimString &description)
 
virtual ossimString getDescription () const
 
virtual bool isConnected (ossimConnectableObjectDirectionType direction=CONNECTABLE_DIRECTION_INPUT) const
 will check the direction specified to see if all slots are full. More...
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findConnectableObject(const ossimId &id))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(RTTItypeid typeId, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(const ossimString &obj, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findInputObjectOfType(const ossimString &className))
 
virtual ossim_int32 findInputIndex (const ossimConnectableObject *object)
 Return a valid index of the input list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findInputIndex (const ossimId &id)
 Return a valid index of the input list if the passed id is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimConnectableObject *object)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimId &id)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 getMyInputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual ossim_int32 getMyOutputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual bool canConnectMyOutputTo (ossim_int32 myOutputIndex, const ossimConnectableObject *object) const
 default implementation is to allow anyone to connect to us. More...
 
virtual void disconnect (ossimConnectableObject *object=0)
 Will disconnect the object passed in. More...
 
virtual void disconnect (const ossimId &id)
 Will disconnect the object passed in. More...
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyInput (ossim_int32 inputIndex, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given input index and generate a connection event. More...
 
virtual void disconnectMyInput (ossimConnectableObject *input, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Finds the index of the passed in input and calls disconnectMyInput(inputIndex, disconnectOutputFlag, createEventFlag);. More...
 
virtual void disconnectMyInputs (ConnectableObjectList &inputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyOutput (ossim_int32 outputIndex, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given output index and generate a connection event. More...
 
virtual void disconnectMyOutput (ossimConnectableObject *output, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the output object. More...
 
virtual void disconnectMyOutputs (ConnectableObjectList &outputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual void disconnectAllInputs ()
 Will disconnect all of the input objects. More...
 
virtual void disconnectAllOutputs ()
 Will disconnect all of the output objects. More...
 
virtual ossim_int32 connectMyInputTo (ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will try to connect this objects input to the passed in object. More...
 
virtual ossim_int32 connectMyInputTo (ossim_int32 inputIndex, ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will connect the specified input to the passed in object. More...
 
virtual bool connectMyInputTo (ConnectableObjectList &inputList, bool makeOutputConnection=true, bool createEventFlag=true)
 
virtual ossim_int32 connectMyOutputTo (ossimConnectableObject *outputObject, bool makeInputConnection=true, bool createEventFlag=true)
 Will try to connect this objects output to the passed in object. More...
 
virtual bool connectMyOutputTo (ConnectableObjectList &outputList, bool makeInputConnection=true, bool createEventFlag=true)
 
virtual bool connectInputList (ConnectableObjectList &inputList)
 Will disconnect itself from all inputs and reset to the passed in input list. More...
 
virtual bool connectOutputList (ConnectableObjectList &outputList)
 Will disconnect itself from all outputs and reset to the passed in output list. More...
 
virtual ossim_uint32 getNumberOfInputs () const
 Returns the number of input objects. More...
 
virtual ossim_uint32 getNumberOfOutputs () const
 Return the number of output objects. More...
 
ossimConnectableObjectgetInput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetInput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
ossimConnectableObjectgetOutput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetOutput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
virtual void setNumberOfInputs (ossim_int32 numberOfInputs)
 Will set the number of inputs. More...
 
virtual bool getInputListIsFixedFlag () const
 
virtual bool getOutputListIsFixedFlag () const
 
virtual void setNumberOfOutputs (ossim_int32 numberOfInputs)
 Will set the number of outputs. More...
 
const ConnectableObjectListgetInputList () const
 
const ConnectableObjectListgetOutputList () const
 
ConnectableObjectListgetInputList ()
 
ConnectableObjectListgetOutputList ()
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const RTTItypeid &typeInfo, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const ossimString &className, bool recurse=true))
 
virtual void propagateEventToOutputs (ossimEvent &event)
 
virtual void propagateEventToInputs (ossimEvent &event)
 
virtual void setProperty (const ossimString &name, const ossimString &value)
 
virtual ossim_uint32 saveStateOfAllInputs (ossimKeywordlist &kwl, bool saveThisStateFlag=true, ossim_uint32 objectIndex=1, const char *prefix=0) const
 Save the state of all inputs to a keyword list. More...
 
virtual bool fillContainer (ossimConnectableContainer &container)
 Inserts this object and all of its children and inputs into the container provided. More...
 
bool moveInputUp (const ossimId &id)
 Moves the input connection matching id up one in the connection list. More...
 
bool moveInputDown (const ossimId &id)
 Moves the input connection matching id down one in the connection list. More...
 
bool moveInputToTop (const ossimId &id)
 Moves the input connection matching id to the top of the connection list. More...
 
bool moveInputToBottom (const ossimId &id)
 Moves the input connection matching id to the bottom of the connection list. More...
 
virtual void accept (ossimVisitor &visitor)
 We will add a visitor interface for all connectable objects. More...
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimListenerManager
 ossimListenerManager ()
 
virtual ~ossimListenerManager ()
 
virtual void fireEvent (ossimEvent &event)
 
virtual bool addListener (ossimListener *listener)
 
virtual bool removeListener (ossimListener *listener)
 
virtual bool findListener (ossimListener *listener)
 
- Public Member Functions inherited from ossimPropertyInterface
 ossimPropertyInterface ()
 
virtual ~ossimPropertyInterface ()
 
virtual ossimString getPropertyValueAsString (const ossimString &name) const
 
void getPropertyList (std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
 
void setProperties (std::vector< ossimRefPtr< ossimProperty > > &propertyList)
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 
- Public Member Functions inherited from ossimConnectableObjectListener
 ossimConnectableObjectListener ()
 
virtual ~ossimConnectableObjectListener ()
 
virtual void processEvent (ossimEvent &event)
 ProcessEvent. More...
 
virtual void objectDestructingEvent (ossimObjectDestructingEvent &)
 
virtual void connectionEvent (ossimConnectionEvent &)
 
virtual void disconnectOutputEvent (ossimConnectionEvent &)
 
virtual void connectOutputEvent (ossimConnectionEvent &)
 
virtual void addObjectEvent (ossimContainerEvent &)
 
virtual void removeObjectEvent (ossimContainerEvent &)
 
virtual void containerEvent (ossimContainerEvent &)
 
- Public Member Functions inherited from ossimListener
 ossimListener ()
 
virtual ~ossimListener ()
 
void enableListener ()
 
void disableListener ()
 
void setListenerEnableFlag (bool flag)
 
bool isListenerEnabled () const
 
bool getListenerEnableFlag () const
 

Protected Member Functions

void applyFilter (ossimRefPtr< ossimImageData > &input)
 
template<class T >
void applyMean (T dummyVariable, ossimRefPtr< ossimImageData > &inputData)
 
template<class T >
void applyMeanNullCenterOnly (T dummyVariable, ossimRefPtr< ossimImageData > &inputData)
 
template<class T >
void applyMedian (T dummyVariable, ossimRefPtr< ossimImageData > &inputData)
 
template<class T >
void applyMedianNullCenterOnly (T dummyVariable, ossimRefPtr< ossimImageData > &inputData)
 
- Protected Member Functions inherited from ossimImageSourceFilter
virtual ~ossimImageSourceFilter ()
 
- Protected Member Functions inherited from ossimImageSource
 ossimImageSource (const ossimImageSource &rhs)
 
const ossimImageSourceoperator= (const ossimImageSource &)
 
- Protected Member Functions inherited from ossimSource
 ossimSource (const ossimSource &rhs)
 
const ossimSourceoperator= (const ossimSource &rhs)
 
- Protected Member Functions inherited from ossimConnectableObject
ossimConnectableObjectfindObjectOfType (ConnectableObjectList *connectableList, ossimVisitor &visitor)
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimListenerManager
 ossimListenerManager (const ossimListenerManager &rhs)
 

Protected Attributes

ossimRefPtr< ossimImageDatatheTile
 
ossimMeanMedianFilterType theFilterType
 
ossim_uint32 theWindowSize
 
bool theEnableFillNullFlag
 Used by applyMean and applyMedian for "fill null" modes. More...
 
bool theAutoGrowRectFlag
 If true rectangle is expanded by half filter in each direction if the theFilterType fills nulls. More...
 
- Protected Attributes inherited from ossimImageSourceFilter
ossimImageSourcetheInputConnection
 
- Protected Attributes inherited from ossimSource
bool theEnableFlag
 
bool theInitializedFlag
 
- Protected Attributes inherited from ossimConnectableObject
ossimId theId
 
ossimString theDescription
 
ossimObjecttheOwner
 
bool theInputListIsFixedFlag
 Indicates whether the theInputObjectList is fixed. More...
 
bool theOutputListIsFixedFlag
 Indicates whether the theOutputObjectList is fixed. More...
 
ConnectableObjectList theInputObjectList
 Holds a list of input objects. More...
 
ConnectableObjectList theOutputObjectList
 Holds a list of output objects. More...
 
- Protected Attributes inherited from ossimListenerManager
std::list< ossimListener * > theListenerList
 
bool theEnabledFlag
 
std::list< ossimListener * > theDelayedAdd
 
std::list< ossimListener * > theDelayedRemove
 
bool theFireEventFlag
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 
- Protected Attributes inherited from ossimListener
bool theListenerEnableFlag
 

Detailed Description

class ossimMeanMedianFilter

Allows you to change between a median or mean filter. You can also specify a window size which the median or mean is computed and the center pixel is replaced.

Definition at line 25 of file ossimMeanMedianFilter.h.

Member Enumeration Documentation

◆ ossimMeanMedianFilterType

Enumerator
OSSIM_MEDIAN 

Applies filter to any non-null center pixel.

OSSIM_MEDIAN_FILL_NULLS 

Applies filter to all pixels including null center pixels.

OSSIM_MEDIAN_NULL_CENTER_ONLY 

Applies filter to only null center pixels.

OSSIM_MEAN 

Applies filter to any non-null center pixel.

OSSIM_MEAN_FILL_NULLS 
OSSIM_MEAN_NULL_CENTER_ONLY 

Applies filter to only null center pixels.

Definition at line 29 of file ossimMeanMedianFilter.h.

30  {
32  OSSIM_MEDIAN = 0,
33 
36 
39 
41  OSSIM_MEAN = 3,
42 
43  /* Applies filter to all pixels including null center pixels. */
45 
48  };
Applies filter to only null center pixels.
Applies filter to only null center pixels.
Applies filter to all pixels including null center pixels.
Applies filter to any non-null center pixel.
Applies filter to any non-null center pixel.

Constructor & Destructor Documentation

◆ ossimMeanMedianFilter()

ossimMeanMedianFilter::ossimMeanMedianFilter ( ossimObject owner = NULL)

Definition at line 33 of file ossimMeanMedianFilter.cpp.

References ossimConnectableObject::setDescription().

34  :ossimImageSourceFilter(owner),
35  theTile(0),
37  theWindowSize(3),
38  theEnableFillNullFlag(false),
39  theAutoGrowRectFlag(false)
40 {
41  setDescription(ossimString("Mean Median Filter"));
42 }
virtual void setDescription(const ossimString &description)
ossimMeanMedianFilterType theFilterType
ossimRefPtr< ossimImageData > theTile
ossimImageSourceFilter(ossimObject *owner=NULL)
bool theEnableFillNullFlag
Used by applyMean and applyMedian for "fill null" modes.
bool theAutoGrowRectFlag
If true rectangle is expanded by half filter in each direction if the theFilterType fills nulls...
Applies filter to any non-null center pixel.

◆ ~ossimMeanMedianFilter()

ossimMeanMedianFilter::~ossimMeanMedianFilter ( )
virtual

Definition at line 44 of file ossimMeanMedianFilter.cpp.

45 {
46 }

Member Function Documentation

◆ applyFilter()

void ossimMeanMedianFilter::applyFilter ( ossimRefPtr< ossimImageData > &  input)
protected

Definition at line 108 of file ossimMeanMedianFilter.cpp.

References applyMean(), applyMeanNullCenterOnly(), applyMedian(), applyMedianNullCenterOnly(), ossimRectilinearDataObject::getScalarType(), OSSIM_FLOAT32, OSSIM_FLOAT64, OSSIM_MEAN, OSSIM_MEAN_FILL_NULLS, OSSIM_MEAN_NULL_CENTER_ONLY, OSSIM_MEDIAN, OSSIM_MEDIAN_FILL_NULLS, OSSIM_MEDIAN_NULL_CENTER_ONLY, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SINT16, OSSIM_UINT16, OSSIM_UINT32, OSSIM_UINT8, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, OSSIM_USHORT15, ossimNotify(), ossimNotifyLevel_WARN, and theFilterType.

Referenced by getTile().

109 {
110  switch(input->getScalarType())
111  {
112  case OSSIM_UINT8:
113  {
114  switch (theFilterType)
115  {
116  case OSSIM_MEDIAN:
118  applyMedian(ossim_uint8(0), input);
119  break;
120 
123  break;
124 
125  case OSSIM_MEAN:
127  applyMean(ossim_uint8(0), input);
128  break;
129 
132 
133  default:
134  break;
135  }
136  break;
137  }
138  case OSSIM_USHORT11:
139  case OSSIM_USHORT12:
140  case OSSIM_USHORT13:
141  case OSSIM_USHORT14:
142  case OSSIM_USHORT15:
143  case OSSIM_UINT16:
144  {
145  switch (theFilterType)
146  {
147  case OSSIM_MEDIAN:
149  applyMedian(ossim_uint16(0), input);
150  break;
151 
154  break;
155 
156  case OSSIM_MEAN:
158  applyMean(ossim_uint16(0), input);
159  break;
160 
163  break;
164 
165  default:
166  break;
167  }
168  break;
169  }
170  case OSSIM_SINT16:
171  {
172  switch (theFilterType)
173  {
174  case OSSIM_MEDIAN:
176  applyMedian(ossim_sint16(0), input);
177  break;
178 
181  break;
182 
183  case OSSIM_MEAN:
185  applyMean(ossim_sint16(0), input);
186  break;
187 
190  break;
191 
192  default:
193  break;
194  }
195  break;
196  }
197  case OSSIM_UINT32:
198  {
199  switch (theFilterType)
200  {
201  case OSSIM_MEDIAN:
203  applyMedian(ossim_uint32(0), input);
204  break;
205 
208  break;
209 
210  case OSSIM_MEAN:
212  applyMean(ossim_uint32(0), input);
213  break;
214 
217  break;
218 
219  default:
220  break;
221  }
222  }
223  case OSSIM_FLOAT32:
225  {
226  switch (theFilterType)
227  {
228  case OSSIM_MEDIAN:
230  applyMedian(ossim_float32(0.0), input);
231  break;
232 
235  break;
236 
237  case OSSIM_MEAN:
239  applyMean(ossim_float32(0.0), input);
240  break;
241 
244  break;
245 
246  default:
247  break;
248  }
249  break;
250  }
251  case OSSIM_FLOAT64:
253  {
254  switch (theFilterType)
255  {
256  case OSSIM_MEDIAN:
258  applyMedian(ossim_float64(0.0), input);
259  break;
260 
263  break;
264 
265  case OSSIM_MEAN:
267  applyMean(ossim_float64(0.0), input);
268  break;
269 
272  break;
273 
274  default:
275  break;
276  }
277  break;
278  }
279  default:
280  {
282  << "ossimMeanMedianFilter::applyFilter WARNING:\n"
283  << "Unhandled scalar type!" << endl;
284  }
285  }
286 }
16 bit unsigned integer (15 bits used)
64 bit floating point
Applies filter to only null center pixels.
16 bit unsigned integer
ossimMeanMedianFilterType theFilterType
float ossim_float32
16 bit signed integer
void applyMedian(T dummyVariable, ossimRefPtr< ossimImageData > &inputData)
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
32 bit floating point
unsigned short ossim_uint16
32 bit unsigned integer
Applies filter to only null center pixels.
Applies filter to all pixels including null center pixels.
double ossim_float64
void applyMedianNullCenterOnly(T dummyVariable, ossimRefPtr< ossimImageData > &inputData)
signed short ossim_sint16
void applyMean(T dummyVariable, ossimRefPtr< ossimImageData > &inputData)
unsigned int ossim_uint32
32 bit normalized floating point
void applyMeanNullCenterOnly(T dummyVariable, ossimRefPtr< ossimImageData > &inputData)
Applies filter to any non-null center pixel.
Applies filter to any non-null center pixel.
virtual ossimScalarType getScalarType() const
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
8 bit unsigned integer
unsigned char ossim_uint8
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
16 bit unsigned integer (12 bits used)

◆ applyMean()

template<class T >
void ossimMeanMedianFilter::applyMean ( dummyVariable,
ossimRefPtr< ossimImageData > &  inputData 
)
protected

Definition at line 289 of file ossimMeanMedianFilter.cpp.

References ossimImageData::getBuf(), ossimDataObject::getDataObjectStatus(), ossimImageData::getHeight(), ossimImageData::getNullPix(), ossimImageData::getNumberOfBands(), ossimImageData::getWidth(), ossim::min(), OSSIM_FULL, status, theEnableFillNullFlag, theTile, theWindowSize, x, and y.

Referenced by applyFilter().

291 {
292  ossim_uint32 halfWindow = (theWindowSize >> 1);
293  ossim_uint32 bandIdx = 0;
294  ossim_uint32 x = 0;
295  ossim_uint32 y = 0;
296  ossim_uint32 kernelX = 0;
297  ossim_uint32 kernelY = 0;
298  ossim_uint32 kernelIdx = 0;
299  ossim_uint32 iw = inputData->getWidth();
300  ossim_uint32 ow = theTile->getWidth();
302  ossim_uint32 numberOfBands = ossim::min(theTile->getNumberOfBands(),
303  inputData->getNumberOfBands());
305  std::vector<double> values(theWindowSize*theWindowSize);
306 
307  if(status == OSSIM_FULL)
308  {
309  for(bandIdx = 0; bandIdx < numberOfBands; ++bandIdx)
310  {
311  T* inputBuf = (T*)inputData->getBuf(bandIdx);
312  T* outputBuf = (T*)theTile->getBuf(bandIdx);
313 
314  if(inputBuf&&outputBuf)
315  {
316  for(y = 0; y < oh; ++y)
317  {
318  for(x = 0; x < ow; ++x)
319  {
320  kernelIdx = 0;
321  for(kernelY = 0; kernelY < theWindowSize; ++kernelY)
322  {
323  for(kernelX = 0; kernelX < theWindowSize;++kernelX)
324  {
325  values[kernelIdx] = *(inputBuf+kernelX + kernelY*iw);
326  ++kernelIdx;
327  }
328  }
329 
330 
331  if(values.size() > 0)
332  {
333  double sum = std::accumulate(values.begin(),
334  values.end(),
335  0.0);
336  double average = sum/(double)values.size();
337  (*outputBuf) = (T)average;
338  }
339  ++inputBuf;
340  ++outputBuf;
341  }
342 
343  inputBuf+=(halfWindow<<1);
344  }
345  }
346  }
347  }
348  else
349  {
350  for(bandIdx = 0; bandIdx < numberOfBands; ++bandIdx)
351  {
352  T* inputBuf = (T*)inputData->getBuf(bandIdx);
353  T* outputBuf = (T*)theTile->getBuf(bandIdx);
354  T np = (T)inputData->getNullPix(bandIdx);
355  if(inputBuf&&outputBuf)
356  {
357  for(y = 0; y < oh; ++y)
358  {
359  for(x = 0; x < ow; ++x)
360  {
361  values.clear();
362  for(kernelY = 0; kernelY < theWindowSize; ++kernelY)
363  {
364  for(kernelX = 0; kernelX < theWindowSize;++kernelX)
365  {
366  T tempValue = *(inputBuf+kernelX + kernelY*iw);
367 
368  if(tempValue != np)
369  {
370  values.push_back((double)tempValue);
371  }
372  }
373  }
374 
375 
376  if(values.size() > 0)
377  {
378  double accumulate = std::accumulate(values.begin(),
379  values.end(),
380  0.0);
381  double average = accumulate/(double)values.size();
382  if(*(inputBuf+halfWindow + halfWindow*iw) == np)
383  {
385  {
386  (*outputBuf) = (T)average;
387  }
388  else
389  {
390  (*outputBuf) = np;
391  }
392  }
393  else
394  {
395  (*outputBuf) = (T)average;
396  }
397  }
398  else
399  {
400  *outputBuf = np;
401  }
402  ++inputBuf;
403  ++outputBuf;
404  }
405 
406  inputBuf+=(halfWindow<<1);
407  }
408  }
409  }
410  }
411 }
virtual ossim_uint32 getWidth() const
ossim_uint32 x
virtual ossim_uint32 getNumberOfBands() const
ossimRefPtr< ossimImageData > theTile
ossim_uint32 y
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual ossim_uint32 getHeight() const
bool theEnableFillNullFlag
Used by applyMean and applyMedian for "fill null" modes.
unsigned int ossim_uint32
virtual const ossim_float64 * getNullPix() const
T min(T a, T b)
Definition: ossimCommon.h:203
return status
virtual const void * getBuf() const
ossimDataObjectStatus
Definitions for data object status.

◆ applyMeanNullCenterOnly()

template<class T >
void ossimMeanMedianFilter::applyMeanNullCenterOnly ( dummyVariable,
ossimRefPtr< ossimImageData > &  inputData 
)
protected

Definition at line 413 of file ossimMeanMedianFilter.cpp.

References ossimRefPtr< T >::get(), ossimImageData::getBuf(), ossimDataObject::getDataObjectStatus(), ossimImageData::getHeight(), ossimImageData::getNullPix(), ossimImageData::getNumberOfBands(), ossimImageData::getWidth(), ossimImageData::loadTile(), ossim::min(), OSSIM_FULL, status, theTile, theWindowSize, x, and y.

Referenced by applyFilter().

416 {
417  ossim_uint32 halfWindow = (theWindowSize >> 1);
418  ossim_uint32 bandIdx = 0;
419  ossim_uint32 x = 0;
420  ossim_uint32 y = 0;
421  ossim_uint32 kernelX = 0;
422  ossim_uint32 kernelY = 0;
423  ossim_uint32 iw = inputData->getWidth();
424  ossim_uint32 ow = theTile->getWidth();
426  ossim_uint32 numberOfBands = ossim::min(theTile->getNumberOfBands(),
427  inputData->getNumberOfBands());
429  std::vector<double> values;
430 
431  if(status == OSSIM_FULL)
432  {
433  // Nothing to do just copy the tile.
434  theTile->loadTile(inputData.get());
435  }
436  else
437  {
438  // Partial tile with nulls in it.
439  for(bandIdx = 0; bandIdx < numberOfBands; ++bandIdx)
440  {
441  T* inputBuf = (T*)inputData->getBuf(bandIdx);
442  T* outputBuf = (T*)theTile->getBuf(bandIdx);
443  if (!inputBuf || !outputBuf)
444  {
445  return; // Shouldn't happen...
446  }
447 
448  const T NP = (T)inputData->getNullPix(bandIdx);
449 
450  for(y = 0; y < oh; ++y)
451  {
452  for(x = 0; x < ow; ++x)
453  {
454  // Get the center input pixel.
455  const T CP = *(inputBuf+halfWindow + halfWindow*iw);
456  if (CP == NP)
457  {
458  values.clear();
459  for(kernelY = 0; kernelY < theWindowSize; ++kernelY)
460  {
461  for(kernelX = 0; kernelX < theWindowSize;++kernelX)
462  {
463  T tempValue = *(inputBuf+kernelX + kernelY*iw);
464 
465  if(tempValue != NP)
466  {
467  values.push_back((double)tempValue);
468  }
469  }
470  }
471 
472  if(values.size() > 0)
473  {
474  double accumulate = std::accumulate(values.begin(),
475  values.end(),
476  0.0);
477  double average = accumulate/(double)values.size();
478  (*outputBuf) = (T)average;
479  }
480  else
481  {
482  (*outputBuf) = NP;
483  }
484 
485  }
486  else // Center pixel (CP) not null.
487  {
488  (*outputBuf) = CP;
489  }
490 
491  // Move over...
492  ++inputBuf;
493  ++outputBuf;
494 
495  } // End of loop in x direction.
496 
497  // Move down...
498  inputBuf+=(halfWindow<<1);
499 
500  } // End of loop in y direction.
501 
502  } // End of band loop.
503 
504  } // End of else "partial tile" block.
505 }
virtual ossim_uint32 getWidth() const
ossim_uint32 x
virtual ossim_uint32 getNumberOfBands() const
ossimRefPtr< ossimImageData > theTile
ossim_uint32 y
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual ossim_uint32 getHeight() const
virtual void loadTile(const void *src, const ossimIrect &src_rect, ossimInterleaveType il_type)
unsigned int ossim_uint32
virtual const ossim_float64 * getNullPix() const
T min(T a, T b)
Definition: ossimCommon.h:203
return status
virtual const void * getBuf() const
ossimDataObjectStatus
Definitions for data object status.

◆ applyMedian()

template<class T >
void ossimMeanMedianFilter::applyMedian ( dummyVariable,
ossimRefPtr< ossimImageData > &  inputData 
)
protected

Definition at line 508 of file ossimMeanMedianFilter.cpp.

References ossimImageData::getBuf(), ossimDataObject::getDataObjectStatus(), ossimImageData::getHeight(), ossimImageData::getNullPix(), ossimImageData::getNumberOfBands(), ossimImageData::getWidth(), ossim::min(), OSSIM_FULL, status, theEnableFillNullFlag, theTile, theWindowSize, x, and y.

Referenced by applyFilter().

510 {
511  ossim_uint32 halfWindow = (theWindowSize >> 1);
512  ossim_uint32 bandIdx = 0;
513  ossim_uint32 x = 0;
514  ossim_uint32 y = 0;
515  ossim_uint32 kernelX = 0;
516  ossim_uint32 kernelY = 0;
517  ossim_uint32 kernelIdx = 0;
518  ossim_uint32 iw = inputData->getWidth();
519  ossim_uint32 ow = theTile->getWidth();
521  ossim_uint32 numberOfBands = ossim::min(theTile->getNumberOfBands(),
522  inputData->getNumberOfBands());
524  std::vector<T> values(theWindowSize*theWindowSize);
525 
526  if(status == OSSIM_FULL)
527  {
528  for(bandIdx = 0; bandIdx < numberOfBands; ++bandIdx)
529  {
530  T* inputBuf = (T*)inputData->getBuf(bandIdx);
531  T* outputBuf = (T*)theTile->getBuf(bandIdx);
532 
533  if(inputBuf&&outputBuf)
534  {
535  for(y = 0; y < oh; ++y)
536  {
537  for(x = 0; x < ow; ++x)
538  {
539  kernelIdx = 0;
540  for(kernelY = 0; kernelY < theWindowSize; ++kernelY)
541  {
542  for(kernelX = 0; kernelX < theWindowSize;++kernelX)
543  {
544  values[kernelIdx] = *(inputBuf+kernelX + kernelY*iw);
545  ++kernelIdx;
546  }
547  }
548 
549  std::sort(values.begin(),
550  values.end());
551 
552  if(values.size() > 0)
553  {
554  (*outputBuf) = values[values.size()>>1];
555  }
556  ++inputBuf;
557  ++outputBuf;
558  }
559 
560  inputBuf+=(halfWindow<<1);
561  }
562  }
563  }
564  }
565  else
566  {
567  for(bandIdx = 0; bandIdx < numberOfBands; ++bandIdx)
568  {
569  T* inputBuf = (T*)inputData->getBuf(bandIdx);
570  T* outputBuf = (T*)theTile->getBuf(bandIdx);
571  T np = (T)inputData->getNullPix(bandIdx);
572  if(inputBuf&&outputBuf)
573  {
574  for(y = 0; y < oh; ++y)
575  {
576  for(x = 0; x < ow; ++x)
577  {
578  values.clear();
579  for(kernelY = 0; kernelY < theWindowSize; ++kernelY)
580  {
581  for(kernelX = 0; kernelX < theWindowSize;++kernelX)
582  {
583  T tempValue = *(inputBuf+kernelX + kernelY*iw);
584 
585  if(tempValue != np)
586  {
587  values.push_back(tempValue);
588  }
589  }
590  }
591 
592  std::sort(values.begin(),
593  values.end());
594 
595  if(values.size() > 0)
596  {
597  if(*(inputBuf+halfWindow + halfWindow*iw) == np)
598  {
600  {
601  (*outputBuf) = values[values.size()>>1];
602  }
603  else
604  {
605  (*outputBuf) = np;
606  }
607  }
608  else
609  {
610  (*outputBuf) = values[values.size()>>1];
611  }
612  }
613  else
614  {
615  *outputBuf = np;
616  }
617  ++inputBuf;
618  ++outputBuf;
619  }
620 
621  inputBuf+=(halfWindow<<1);
622  }
623  }
624  }
625  }
626 }
virtual ossim_uint32 getWidth() const
ossim_uint32 x
virtual ossim_uint32 getNumberOfBands() const
ossimRefPtr< ossimImageData > theTile
ossim_uint32 y
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual ossim_uint32 getHeight() const
bool theEnableFillNullFlag
Used by applyMean and applyMedian for "fill null" modes.
unsigned int ossim_uint32
virtual const ossim_float64 * getNullPix() const
T min(T a, T b)
Definition: ossimCommon.h:203
return status
virtual const void * getBuf() const
ossimDataObjectStatus
Definitions for data object status.

◆ applyMedianNullCenterOnly()

template<class T >
void ossimMeanMedianFilter::applyMedianNullCenterOnly ( dummyVariable,
ossimRefPtr< ossimImageData > &  inputData 
)
protected

Definition at line 628 of file ossimMeanMedianFilter.cpp.

References ossimRefPtr< T >::get(), ossimImageData::getBuf(), ossimDataObject::getDataObjectStatus(), ossimImageData::getHeight(), ossimImageData::getNullPix(), ossimImageData::getNumberOfBands(), ossimImageData::getWidth(), ossimImageData::loadTile(), ossim::min(), OSSIM_FULL, status, theTile, theWindowSize, x, and y.

Referenced by applyFilter().

631 {
632  ossim_uint32 halfWindow = (theWindowSize >> 1);
633  ossim_uint32 bandIdx = 0;
634  ossim_uint32 x = 0;
635  ossim_uint32 y = 0;
636  ossim_uint32 kernelX = 0;
637  ossim_uint32 kernelY = 0;
638  ossim_uint32 iw = inputData->getWidth();
639  ossim_uint32 ow = theTile->getWidth();
641  ossim_uint32 numberOfBands = ossim::min(theTile->getNumberOfBands(),
642  inputData->getNumberOfBands());
644  std::vector<T> values;
645 
646  if(status == OSSIM_FULL)
647  {
648  // Nothing to do just copy the tile.
649  theTile->loadTile(inputData.get());
650  }
651  else
652  {
653  // Partial tile with nulls in it.
654  for(bandIdx = 0; bandIdx < numberOfBands; ++bandIdx)
655  {
656  T* inputBuf = (T*)inputData->getBuf(bandIdx);
657  T* outputBuf = (T*)theTile->getBuf(bandIdx);
658  if (!inputBuf || !outputBuf)
659  {
660  return; // Shouldn't happen...
661  }
662 
663  const T NP = (T)inputData->getNullPix(bandIdx);
664 
665  for(y = 0; y < oh; ++y)
666  {
667  for(x = 0; x < ow; ++x)
668  {
669  // Get the center input pixel.
670  const T CP = *(inputBuf+halfWindow + halfWindow*iw);
671  if (CP == NP)
672  {
673  values.clear();
674  for(kernelY = 0; kernelY < theWindowSize; ++kernelY)
675  {
676  for(kernelX = 0; kernelX < theWindowSize;++kernelX)
677  {
678  T tempValue = *(inputBuf+kernelX + kernelY*iw);
679 
680  if(tempValue != NP)
681  {
682  values.push_back(tempValue);
683  }
684  }
685  }
686 
687  std::sort(values.begin(),
688  values.end());
689 
690  if(values.size() > 0)
691  {
692  (*outputBuf) = values[values.size()>>1];
693  }
694  else
695  {
696  (*outputBuf) = NP;
697  }
698  }
699  else // Center pixel (CP) not null.
700  {
701  (*outputBuf) = CP;
702  }
703 
704  // Move over...
705  ++inputBuf;
706  ++outputBuf;
707 
708  } // End of loop in x direction.
709 
710  // Move down...
711  inputBuf+=(halfWindow<<1);
712 
713  } // End of loop in y direction.
714 
715  } // End of band loop.
716 
717  } // End of else "partial tile" block.
718 }
virtual ossim_uint32 getWidth() const
ossim_uint32 x
virtual ossim_uint32 getNumberOfBands() const
ossimRefPtr< ossimImageData > theTile
ossim_uint32 y
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual ossim_uint32 getHeight() const
virtual void loadTile(const void *src, const ossimIrect &src_rect, ossimInterleaveType il_type)
unsigned int ossim_uint32
virtual const ossim_float64 * getNullPix() const
T min(T a, T b)
Definition: ossimCommon.h:203
return status
virtual const void * getBuf() const
ossimDataObjectStatus
Definitions for data object status.

◆ getAutoGrowRectFlag()

bool ossimMeanMedianFilter::getAutoGrowRectFlag ( ) const

Definition at line 879 of file ossimMeanMedianFilter.cpp.

References theAutoGrowRectFlag.

880 {
881  return theAutoGrowRectFlag;
882 }
bool theAutoGrowRectFlag
If true rectangle is expanded by half filter in each direction if the theFilterType fills nulls...

◆ getBoundingRect()

ossimIrect ossimMeanMedianFilter::getBoundingRect ( ossim_uint32  resLevel = 0) const
virtual
Returns
Returns the bounding rectangle which is the input bounding rectangle with any expansion (from autogrow) added in.

Reimplemented from ossimImageSource.

Definition at line 904 of file ossimMeanMedianFilter.cpp.

References ossimImageSource::getBoundingRect(), ossimIrect::hasNans(), ossimIrect::lr(), OSSIM_MEAN_FILL_NULLS, OSSIM_MEAN_NULL_CENTER_ONLY, OSSIM_MEDIAN_FILL_NULLS, OSSIM_MEDIAN_NULL_CENTER_ONLY, ossimIrect::set_lr(), ossimIrect::set_ul(), theAutoGrowRectFlag, theFilterType, theWindowSize, ossimIrect::ul(), ossimIpt::x, and ossimIpt::y.

905 {
906  // Get the input rectangle.
908  if (!theAutoGrowRectFlag || rect.hasNans())
909  {
910  return rect; // Not in autogrow mode or no input connection yet...
911  }
912 
917  {
918  ossimIpt pt = rect.ul();
919  const ossim_int32 HW = (theWindowSize >> 1); // half window size.
920 
921  // Adjust the upper left.
922  pt.x = pt.x-HW;
923  pt.y = pt.y-HW;
924  rect.set_ul(pt);
925 
926  // Adjust the lower right.
927  pt = rect.lr();
928  pt.x = pt.x+HW;
929  pt.y = pt.y+HW;
930  rect.set_lr(pt);
931  }
932 
933  return rect;
934 }
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
Applies filter to only null center pixels.
ossimMeanMedianFilterType theFilterType
const ossimIpt & ul() const
Definition: ossimIrect.h:274
Applies filter to only null center pixels.
bool theAutoGrowRectFlag
If true rectangle is expanded by half filter in each direction if the theFilterType fills nulls...
Applies filter to all pixels including null center pixels.
void set_ul(const ossimIpt &pt)
Definition: ossimIrect.h:589
const ossimIpt & lr() const
Definition: ossimIrect.h:276
void set_lr(const ossimIpt &pt)
Definition: ossimIrect.h:623
ossim_int32 y
Definition: ossimIpt.h:142
bool hasNans() const
Definition: ossimIrect.h:337
ossim_int32 x
Definition: ossimIpt.h:141
int ossim_int32

◆ getFilterTypeList()

void ossimMeanMedianFilter::getFilterTypeList ( std::vector< ossimString > &  list) const

Definition at line 891 of file ossimMeanMedianFilter.cpp.

References OSSIM_MEAN_NULL_CENTER_ONLY.

Referenced by getFilterTypeString(), and setFilterType().

893 {
894  list.resize(OSSIM_MEAN_NULL_CENTER_ONLY+1);
895 
896  list[0] = ossimString("median");
897  list[1] = ossimString("median_fill_nulls");
898  list[2] = ossimString("median_null_center_only");
899  list[3] = ossimString("mean");
900  list[4] = ossimString("mean_fill_nulls");
901  list[5] = ossimString("mean_null_center_only");
902 }
Applies filter to only null center pixels.

◆ getFilterTypeString()

ossimString ossimMeanMedianFilter::getFilterTypeString ( ) const

Definition at line 884 of file ossimMeanMedianFilter.cpp.

References getFilterTypeList(), and theFilterType.

885 {
886  std::vector<ossimString> list;
887  getFilterTypeList(list);
888  return list[theFilterType];
889 }
ossimMeanMedianFilterType theFilterType
void getFilterTypeList(std::vector< ossimString > &list) const

◆ getProperty()

ossimRefPtr< ossimProperty > ossimMeanMedianFilter::getProperty ( const ossimString name) const
virtual

Reimplemented from ossimImageSourceFilter.

Definition at line 750 of file ossimMeanMedianFilter.cpp.

751 {
752  if (name == WINDOW_SIZE_KW)
753  {
754  ossimProperty* prop =
755  new ossimNumericProperty(WINDOW_SIZE_KW,
757  3,
758  25);
759  prop->setCacheRefreshBit();
760 
761  return prop;
762  }
763  else if (name == FILTER_TYPE_KW)
764  {
765  std::vector<ossimString> constraintList;
766  getFilterTypeList(constraintList);
768  ossimProperty* prop = new ossimStringProperty(FILTER_TYPE_KW,
769  value,
770  false,
771  constraintList);
772  prop->setCacheRefreshBit();
773 
774  return prop;
775  }
776  else if (name == AUTO_GROW_KW)
777  {
779  AUTO_GROW_KW, getAutoGrowRectFlag());
780  p->setFullRefreshBit();
781  return p;
782  }
784 }
static ossimString toString(bool aValue)
Numeric to string methods.
void setFullRefreshBit()
ossimString getFilterTypeString() const
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
void getFilterTypeList(std::vector< ossimString > &list) const
void setCacheRefreshBit()

◆ getPropertyNames()

void ossimMeanMedianFilter::getPropertyNames ( std::vector< ossimString > &  propertyNames) const
virtual

Reimplemented from ossimImageSourceFilter.

Definition at line 786 of file ossimMeanMedianFilter.cpp.

788 {
789  propertyNames.push_back(WINDOW_SIZE_KW);
790  propertyNames.push_back(FILTER_TYPE_KW);
791  propertyNames.push_back(AUTO_GROW_KW);
792 
794 }
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const

◆ getTile()

ossimRefPtr< ossimImageData > ossimMeanMedianFilter::getTile ( const ossimIrect rect,
ossim_uint32  resLevel = 0 
)
virtual
Returns
the requested region of interest

Reimplemented from ossimImageSource.

Definition at line 48 of file ossimMeanMedianFilter.cpp.

References applyFilter(), ossimImageData::dup(), ossimImageSource::getTile(), getWindowSize(), ossimSource::isSourceEnabled(), ossimIrect::lr(), ossimDataObject::setDataObjectStatus(), ossimImageData::setImageRectangle(), ossimImageData::setImageRectangleAndBands(), theEnableFillNullFlag, theTile, ossimIrect::ul(), ossimRefPtr< T >::valid(), ossimImageData::validate(), ossimIpt::x, and ossimIpt::y.

50 {
51  if(!isSourceEnabled())
52  {
53  return ossimImageSourceFilter::getTile(rect, resLevel);
54  }
55 
56  ossim_uint32 halfSize = getWindowSize()>>1;
57 
58  ossimIrect requestRect(rect.ul().x - halfSize,
59  rect.ul().y - halfSize,
60  rect.lr().x + halfSize,
61  rect.lr().y + halfSize);
62 
63  ossimRefPtr<ossimImageData> inputData =
64  ossimImageSourceFilter::getTile(requestRect, resLevel);
65  if(!inputData.valid() || !inputData->getBuf())
66  {
67  return inputData;
68  }
69 
70  if(!theTile.valid())
71  {
72  theTile = (ossimImageData*)inputData->dup();
74  }
75  else
76  {
77  theTile->setImageRectangleAndBands(rect, inputData->getNumberOfBands());
78  }
79 
80  applyFilter(inputData);
81 
82  theTile->setDataObjectStatus(inputData->getDataObjectStatus());
84  {
85  theTile->validate();
86  }
87 
88  return theTile;
89 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual void setImageRectangle(const ossimIrect &rect)
ossimRefPtr< ossimImageData > theTile
bool valid() const
Definition: ossimRefPtr.h:75
const ossimIpt & ul() const
Definition: ossimIrect.h:274
bool theEnableFillNullFlag
Used by applyMean and applyMedian for "fill null" modes.
virtual ossimObject * dup() const
ossim_uint32 getWindowSize() const
virtual ossimDataObjectStatus validate() const
virtual void setImageRectangleAndBands(const ossimIrect &rect, ossim_uint32 numberOfBands)
unsigned int ossim_uint32
const ossimIpt & lr() const
Definition: ossimIrect.h:276
ossim_int32 y
Definition: ossimIpt.h:142
virtual void setDataObjectStatus(ossimDataObjectStatus status) const
Full list found in ossimConstants.h.
ossim_int32 x
Definition: ossimIpt.h:141
void applyFilter(ossimRefPtr< ossimImageData > &input)
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)

◆ getWindowSize()

ossim_uint32 ossimMeanMedianFilter::getWindowSize ( ) const

Definition at line 96 of file ossimMeanMedianFilter.cpp.

References theWindowSize.

Referenced by getTile().

97 {
98  return theWindowSize;
99 }

◆ initialize()

void ossimMeanMedianFilter::initialize ( )
virtual

Reimplemented from ossimImageSourceFilter.

Definition at line 101 of file ossimMeanMedianFilter.cpp.

References ossimImageSourceFilter::initialize(), and theTile.

102 {
104 
105  theTile = NULL;
106 }
ossimRefPtr< ossimImageData > theTile

◆ loadState()

bool ossimMeanMedianFilter::loadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)
virtual

Method to the load (recreate) the state of an object from a keyword list.

Return true if ok or false on error.

Reimplemented from ossimImageSourceFilter.

Definition at line 815 of file ossimMeanMedianFilter.cpp.

References ossimKeywordlist::find().

817 {
818  const char* lookup = NULL;
819 
820  lookup = kwl.find(prefix, WINDOW_SIZE_KW.c_str());
821  if(lookup)
822  {
823  theWindowSize = ossimString(lookup).toUInt32();
824  }
825 
826  lookup = kwl.find(prefix, FILTER_TYPE_KW.c_str());
827  if(lookup)
828  {
829  ossimString type = lookup;
830  setFilterType(type);
831  }
832 
833  lookup = kwl.find(prefix, AUTO_GROW_KW.c_str());
834  if(lookup)
835  {
836  ossimString flag = lookup;
837  setAutoGrowRectFlag(flag.toBool());
838  }
839 
840  return ossimImageSourceFilter::loadState(kwl, prefix);
841 }
const char * find(const char *key) const
ossim_uint32 toUInt32() const
bool toBool() const
String to numeric methods.
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
void setFilterType(ossimMeanMedianFilterType type)
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396

◆ saveState()

bool ossimMeanMedianFilter::saveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const
virtual

Method to save the state of an object to a keyword list.

Return true if ok or false on error.

Reimplemented from ossimImageSourceFilter.

Definition at line 796 of file ossimMeanMedianFilter.cpp.

References ossimKeywordlist::add().

798 {
799  kwl.add(prefix,
800  WINDOW_SIZE_KW.c_str(),
802  true);
803  kwl.add(prefix,
804  FILTER_TYPE_KW.c_str(),
806  true);
807  kwl.add(prefix,
808  AUTO_GROW_KW.c_str(),
809  (theAutoGrowRectFlag?"true":"false"),
810  true);
811 
812  return ossimImageSourceFilter::saveState(kwl, prefix);
813 }
bool theAutoGrowRectFlag
If true rectangle is expanded by half filter in each direction if the theFilterType fills nulls...
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
ossimString getFilterTypeString() const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396

◆ setAutoGrowRectFlag()

void ossimMeanMedianFilter::setAutoGrowRectFlag ( bool  flag)
Parameters
flagSet "theAutoGrowRectFlag". This only affects filter types that set nulls. Will have a growing affect on the edges.

Definition at line 874 of file ossimMeanMedianFilter.cpp.

References theAutoGrowRectFlag.

875 {
876  theAutoGrowRectFlag = flag;
877 }
bool theAutoGrowRectFlag
If true rectangle is expanded by half filter in each direction if the theFilterType fills nulls...

◆ setFilterType() [1/2]

void ossimMeanMedianFilter::setFilterType ( ossimMeanMedianFilterType  type)

Definition at line 842 of file ossimMeanMedianFilter.cpp.

References theFilterType.

843 {
844  theFilterType = type;
845 }
ossimMeanMedianFilterType theFilterType

◆ setFilterType() [2/2]

void ossimMeanMedianFilter::setFilterType ( const ossimString type)

Definition at line 847 of file ossimMeanMedianFilter.cpp.

References ossimString::downcase(), getFilterTypeList(), OSSIM_MEAN_FILL_NULLS, OSSIM_MEDIAN_FILL_NULLS, theEnableFillNullFlag, and theFilterType.

848 {
849  ossimString s = type;
850  s.downcase();
851 
852  std::vector<ossimString> list;
853  getFilterTypeList(list);
854 
855  for (ossim_uint32 i = 0; i < list.size(); ++i)
856  {
857  if (s == list[i])
858  {
859  theFilterType = static_cast<ossimMeanMedianFilterType>(i);
860  }
861  }
862 
865  {
866  theEnableFillNullFlag = true;
867  }
868  else
869  {
870  theEnableFillNullFlag = false;
871  }
872 }
ossimMeanMedianFilterType theFilterType
bool theEnableFillNullFlag
Used by applyMean and applyMedian for "fill null" modes.
Applies filter to all pixels including null center pixels.
unsigned int ossim_uint32
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
void getFilterTypeList(std::vector< ossimString > &list) const

◆ setProperty()

void ossimMeanMedianFilter::setProperty ( ossimRefPtr< ossimProperty property)
virtual

Reimplemented from ossimImageSourceFilter.

Definition at line 720 of file ossimMeanMedianFilter.cpp.

References ossimRefPtr< T >::valid().

721 {
722  if(!property.valid())
723  {
724  return;
725  }
726 
727  ossimString name = property->getName();
728 
729  if (name == WINDOW_SIZE_KW)
730  {
731  theWindowSize = property->valueToString().toUInt32();
732  }
733  else if (name == FILTER_TYPE_KW)
734  {
735  ossimString value = property->valueToString();
736  setFilterType(value);
737  }
738  else if (name == AUTO_GROW_KW)
739  {
740  ossimString value;
741  property->valueToString(value);
742  setAutoGrowRectFlag(value.toBool());
743  }
744  else
745  {
747  }
748 }
virtual void setProperty(ossimRefPtr< ossimProperty > property)
bool valid() const
Definition: ossimRefPtr.h:75
bool toBool() const
String to numeric methods.
void setFilterType(ossimMeanMedianFilterType type)

◆ setWindowSize()

void ossimMeanMedianFilter::setWindowSize ( ossim_uint32  windowSize)

Definition at line 91 of file ossimMeanMedianFilter.cpp.

References theWindowSize.

92 {
93  theWindowSize = windowSize;
94 }

Member Data Documentation

◆ theAutoGrowRectFlag

bool ossimMeanMedianFilter::theAutoGrowRectFlag
protected

If true rectangle is expanded by half filter in each direction if the theFilterType fills nulls.

Definition at line 109 of file ossimMeanMedianFilter.h.

Referenced by getAutoGrowRectFlag(), getBoundingRect(), and setAutoGrowRectFlag().

◆ theEnableFillNullFlag

bool ossimMeanMedianFilter::theEnableFillNullFlag
protected

Used by applyMean and applyMedian for "fill null" modes.

Definition at line 103 of file ossimMeanMedianFilter.h.

Referenced by applyMean(), applyMedian(), getTile(), and setFilterType().

◆ theFilterType

ossimMeanMedianFilterType ossimMeanMedianFilter::theFilterType
protected

◆ theTile

ossimRefPtr<ossimImageData> ossimMeanMedianFilter::theTile
protected

◆ theWindowSize

ossim_uint32 ossimMeanMedianFilter::theWindowSize
protected

The documentation for this class was generated from the following files: