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

#include <ossim3x3ConvolutionFilter.h>

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

Public Member Functions

 ossim3x3ConvolutionFilter (ossimObject *owner=NULL)
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual void getKernel (double kernel[3][3])
 
virtual void setKernel (double kernel[3][3])
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIrect &tileRect, ossim_uint32 resLevel=0)
 
virtual void initialize ()
 
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 setProperty (ossimRefPtr< ossimProperty > property)
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 
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 bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Method to save the state of an object to a keyword list. More...
 
- 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 ossimIrect getBoundingRect (ossim_uint32 resLevel=0) const
 This will return the bounding rect of the source. 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 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

virtual ~ossim3x3ConvolutionFilter ()
 
void allocate ()
 Allocates theTile. More...
 
void clearNullMinMax ()
 Clears data members theNullPixValue, theMinPixValue, and theMaxPixValue. More...
 
void computeNullMinMax ()
 Computes null, min, and max considering input connection and theKernel. More...
 
template<class T >
void convolveFull (T, ossimRefPtr< ossimImageData > inputData, ossimRefPtr< ossimImageData > outputData)
 
template<class T >
void convolvePartial (T, ossimRefPtr< ossimImageData > inputData, ossimRefPtr< ossimImageData > outputData)
 
- 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
 
double theKernel [3][3]
 
vector< double > theNullPixValue
 
vector< double > theMinPixValue
 
vector< double > theMaxPixValue
 
- 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
 

Additional Inherited Members

- 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
 

Detailed Description

Definition at line 17 of file ossim3x3ConvolutionFilter.h.

Constructor & Destructor Documentation

◆ ossim3x3ConvolutionFilter()

ossim3x3ConvolutionFilter::ossim3x3ConvolutionFilter ( ossimObject owner = NULL)

Definition at line 21 of file ossim3x3ConvolutionFilter.cpp.

References theKernel.

22  :ossimImageSourceFilter(owner),
23  theTile(NULL),
24  theNullPixValue(0),
25  theMinPixValue(0),
27 {
28  theKernel[0][0] = 0.0; theKernel[0][1] = 0.0; theKernel[0][2] = 0.0;
29  theKernel[1][0] = 0.0; theKernel[1][1] = 1.0; theKernel[1][2] = 0.0;
30  theKernel[2][0] = 0.0; theKernel[2][1] = 0.0; theKernel[2][2] = 0.0;
31 
32 }
ossimImageSourceFilter(ossimObject *owner=NULL)
ossimRefPtr< ossimImageData > theTile

◆ ~ossim3x3ConvolutionFilter()

ossim3x3ConvolutionFilter::~ossim3x3ConvolutionFilter ( )
protectedvirtual

Definition at line 34 of file ossim3x3ConvolutionFilter.cpp.

35 {
36 }

Member Function Documentation

◆ allocate()

void ossim3x3ConvolutionFilter::allocate ( )
protected

Allocates theTile.

Definition at line 370 of file ossim3x3ConvolutionFilter.cpp.

References ossimImageDataFactory::create(), ossimImageData::initialize(), ossimImageDataFactory::instance(), ossimImageSourceFilter::theInputConnection, and theTile.

Referenced by getTile().

371 {
373  {
375 
376  theTile = idf->create(this,
377  this);
378 
379  theTile->initialize();
380  }
381 }
virtual void initialize()
Initialize the data buffer.
static ossimImageDataFactory * instance()
ossimImageSource * theInputConnection
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
ossimRefPtr< ossimImageData > theTile

◆ clearNullMinMax()

void ossim3x3ConvolutionFilter::clearNullMinMax ( )
protected

Clears data members theNullPixValue, theMinPixValue, and theMaxPixValue.

Definition at line 561 of file ossim3x3ConvolutionFilter.cpp.

References theMaxPixValue, theMinPixValue, and theNullPixValue.

Referenced by initialize(), and setKernel().

562 {
563  theNullPixValue.clear();
564  theMinPixValue.clear();
565  theMaxPixValue.clear();
566 }

◆ computeNullMinMax()

void ossim3x3ConvolutionFilter::computeNullMinMax ( )
protected

Computes null, min, and max considering input connection and theKernel.

Definition at line 568 of file ossim3x3ConvolutionFilter.cpp.

References ossim::defaultMax(), ossim::defaultMin(), ossim::defaultNull(), getMaxPixelValue(), ossimImageSource::getMaxPixelValue(), getMinPixelValue(), ossimImageSource::getMinPixelValue(), ossimImageSource::getNullPixelValue(), ossimImageSource::getNumberOfOutputBands(), ossimImageSource::getOutputScalarType(), ossimImageSourceFilter::theInputConnection, theKernel, theMaxPixValue, theMinPixValue, and theNullPixValue.

Referenced by getTile().

569 {
570  const ossim_uint32 BANDS = getNumberOfOutputBands();
571 
572  theNullPixValue.resize(BANDS);
573  theMinPixValue.resize(BANDS);
574  theMaxPixValue.resize(BANDS);
575 
579 
580  for (ossim_uint32 band = 0; band < BANDS; ++band)
581  {
583  {
587  ossim_float64 tempMin = 0.0;
588  ossim_float64 tempMax = 0.0;
589  ossim_float64 k = 0.0;
590  for(int i=0;i<3;++i)
591  {
592  for(int j=0;j<3;++j)
593  {
594  k=theKernel[i][j];
595  tempMin += (k<0.0) ? k*inputMax : k*inputMin;
596  tempMax += (k>0.0) ? k*inputMax : k*inputMin;
597  }
598  }
599 
600  if((inputNull < getMinPixelValue(band)) ||
601  (inputNull > getMaxPixelValue(band)))
602  {
603  theNullPixValue[band] = inputNull;
604  }
605  else
606  {
608  }
609 
610  if((tempMin >= defaultMin) && (tempMin <= defaultMax))
611  {
612  theMinPixValue[band] = tempMin;
613  }
614  else
615  {
616  theMinPixValue[band] = defaultMin;
617  }
618 
619  if((tempMax >= defaultMin) && (tempMax <= defaultMax))
620  {
621  theMaxPixValue[band] = tempMax;
622  }
623  else
624  {
625  theMaxPixValue[band] = defaultMax;
626  }
627 
628  }
629  else // No input connection...
630  {
632  theMinPixValue[band] = defaultMin;
633  theMaxPixValue[band] = defaultMax;
634  }
635 
636  } // End of band loop.
637 }
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual double getMinPixelValue(ossim_uint32 band=0) const
Returns the min pixel of the band.
double ossim_float64
OSSIM_DLL double defaultMin(ossimScalarType scalarType)
Definition: ossimCommon.cpp:73
OSSIM_DLL double defaultNull(ossimScalarType scalarType)
ossimImageSource * theInputConnection
unsigned int ossim_uint32
virtual double getMinPixelValue(ossim_uint32 band=0) const
Returns the min pixel of the band.
OSSIM_DLL double defaultMax(ossimScalarType scalarType)
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.

◆ convolveFull()

template<class T >
void ossim3x3ConvolutionFilter::convolveFull ( ,
ossimRefPtr< ossimImageData inputData,
ossimRefPtr< ossimImageData outputData 
)
protected

Convolve full means that the input data is full and has no null data. We don't have to compare for nulls here

Definition at line 275 of file ossim3x3ConvolutionFilter.cpp.

References abs, ossimImageData::getBuf(), ossimImageData::getHeight(), getMaxPixelValue(), getMinPixelValue(), ossimImageData::getNumberOfBands(), ossimImageData::getOrigin(), ossimImageData::getWidth(), theKernel, ossimIpt::x, and ossimIpt::y.

Referenced by getTile().

279 {
280  // let's set up some temporary variables so we don't
281  // have to call the functions in loops. Iknow that compilers
282  // typically optimize this out but if we are in debug mode
283  // with no optimization it will still run fast
284  //
285  double sum = 0.0;
286  ossim_int32 inputW = static_cast<ossim_int32>(inputData->getWidth());
287  ossim_uint32 outputW = outputData->getWidth();
288  ossim_uint32 outputH = outputData->getHeight();
289  ossim_uint32 numberOfBands = inputData->getNumberOfBands();
290  ossimIpt outputOrigin = outputData->getOrigin();
291  ossimIpt inputOrigin = inputData->getOrigin();
292 
293  ossim_int32 startInputOffset = std::abs(outputOrigin.y - inputOrigin.y)*
294  inputW + std::abs(outputOrigin.x - inputOrigin.x);
295  ossim_int32 ulKernelStart = -inputW - 1;
296  ossim_int32 leftKernelStart = -1;
297  ossim_int32 llKernelStart = inputW - 1;
298 
299  T* ulKernelStartBuf = NULL;
300  T* leftKernelStartBuf = NULL;
301  T* llKernelStartBuf = NULL;
302 
303  for(ossim_uint32 band = 0; band < numberOfBands; ++band)
304  {
305  T* inputBuf = static_cast<T*>(inputData->getBuf(band))+startInputOffset;
306  T* outputBuf = static_cast<T*>(outputData->getBuf(band));
307  T maxPix = static_cast<T>(getMaxPixelValue(band));
308  T minPix = static_cast<T>(getMinPixelValue(band));
309 
310  if(inputBuf&&outputBuf)
311  {
312  for(ossim_uint32 row = 0; row < outputW; ++row)
313  {
314  ossim_int32 rowOffset = inputW*row;
315  ulKernelStartBuf = inputBuf + (rowOffset + ulKernelStart);
316  leftKernelStartBuf = inputBuf + (rowOffset + leftKernelStart);
317  llKernelStartBuf = inputBuf + (rowOffset + llKernelStart);
318  for(ossim_uint32 col = 0; col < outputH; ++col)
319  {
320  sum = theKernel[0][0]*(double)ulKernelStartBuf[0] +
321  theKernel[0][1]*(double)ulKernelStartBuf[1] +
322  theKernel[0][2]*(double)ulKernelStartBuf[2] +
323  theKernel[1][0]*(double)leftKernelStartBuf[0] +
324  theKernel[1][1]*(double)leftKernelStartBuf[1] +
325  theKernel[1][2]*(double)leftKernelStartBuf[2] +
326  theKernel[2][0]*(double)llKernelStartBuf[0] +
327  theKernel[2][1]*(double)llKernelStartBuf[1] +
328  theKernel[2][2]*(double)llKernelStartBuf[2];
329 
330  if(sum > maxPix)
331  {
332  *outputBuf = maxPix;
333  }
334  else if(sum < minPix)
335  {
336  *outputBuf = minPix;
337  }
338  else
339  {
340  *outputBuf = static_cast<T>(sum);
341  }
342  //
343  // Need to implement the convolution here.
344  //
345 
346 
347  ++ulKernelStartBuf;
348  ++leftKernelStartBuf;
349  ++llKernelStartBuf;
350  ++outputBuf;
351  }
352  }
353  }
354  }
355 }
virtual ossim_uint32 getWidth() const
virtual ossim_uint32 getNumberOfBands() const
virtual ossim_uint32 getHeight() const
#define abs(a)
Definition: auxiliary.h:74
unsigned int ossim_uint32
virtual double getMinPixelValue(ossim_uint32 band=0) const
Returns the min pixel of the band.
ossim_int32 y
Definition: ossimIpt.h:142
virtual const void * getBuf() const
ossim_int32 x
Definition: ossimIpt.h:141
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
virtual const ossimIpt & getOrigin() const
int ossim_int32

◆ convolvePartial()

template<class T >
void ossim3x3ConvolutionFilter::convolvePartial ( ,
ossimRefPtr< ossimImageData inputData,
ossimRefPtr< ossimImageData outputData 
)
protected

Convolve partial means that the input data is has some null data. We will have to compare nulls

Definition at line 177 of file ossim3x3ConvolutionFilter.cpp.

References abs, ossimImageData::getBuf(), ossimImageData::getHeight(), getMaxPixelValue(), getMinPixelValue(), ossimImageData::getNullPix(), getNullPixelValue(), ossimImageData::getNumberOfBands(), ossimImageData::getOrigin(), ossimImageData::getWidth(), theKernel, ossimIpt::x, and ossimIpt::y.

Referenced by getTile().

181 {
182  // let's set up some temporary variables so we don't
183  // have to call the functions in loops. Iknow that compilers
184  // typically optimize this out but if we are in debug mode
185  // with no optimization it will still run fast
186  //
187  double sum = 0.0;
188  ossim_int32 inputW = (ossim_int32)inputData->getWidth();
189  ossim_int32 outputW = (ossim_int32)outputData->getWidth();
190  ossim_int32 outputH = (ossim_int32)outputData->getHeight();
191  ossim_int32 numberOfBands = (ossim_int32)inputData->getNumberOfBands();
192  ossimIpt outputOrigin = outputData->getOrigin();
193  ossimIpt inputOrigin = inputData->getOrigin();
194 
195  ossim_int32 startInputOffset = std::abs(outputOrigin.y - inputOrigin.y)*
196  inputW + std::abs(outputOrigin.x - inputOrigin.x);
197  ossim_int32 ulKernelStart = -inputW - 1;
198  ossim_int32 leftKernelStart = -1;
199  ossim_int32 llKernelStart = inputW - 1;
200 
201  T* ulKernelStartBuf = NULL;
202  T* leftKernelStartBuf = NULL;
203  T* llKernelStartBuf = NULL;
204 
205  for(ossim_int32 band = 0; band < numberOfBands; ++band)
206  {
207  T* inputBuf = static_cast<T*>(inputData->getBuf(band))+startInputOffset;
208  T* outputBuf = static_cast<T*>(outputData->getBuf(band));
209  T maxPix = static_cast<T>(getMaxPixelValue(band));
210  T minPix = static_cast<T>(getMinPixelValue(band));
211  T nullPix = static_cast<T>(inputData->getNullPix(band));
212  T oNullPix = static_cast<T>(getNullPixelValue(band));
213 
214  if(inputBuf&&outputBuf)
215  {
216  for(ossim_int32 row = 0; row < outputW; ++row)
217  {
218  ossim_int32 rowOffset = inputW*row;
219  ulKernelStartBuf = inputBuf + (rowOffset + ulKernelStart);
220  leftKernelStartBuf = inputBuf + (rowOffset + leftKernelStart);
221  llKernelStartBuf = inputBuf + (rowOffset + llKernelStart);
222  for(ossim_int32 col = 0; col < outputH; ++col)
223  {
224 
225  if((ulKernelStartBuf[0] != nullPix)&&
226  (ulKernelStartBuf[1] != nullPix)&&
227  (ulKernelStartBuf[2] != nullPix)&&
228  (leftKernelStartBuf[0] != nullPix)&&
229  (leftKernelStartBuf[1] != nullPix)&&
230  (leftKernelStartBuf[2] != nullPix)&&
231  (llKernelStartBuf[0] != nullPix)&&
232  (llKernelStartBuf[1] != nullPix)&&
233  (llKernelStartBuf[2] != nullPix))
234  {
235  sum = theKernel[0][0]*(double)ulKernelStartBuf[0] +
236  theKernel[0][1]*(double)ulKernelStartBuf[1] +
237  theKernel[0][2]*(double)ulKernelStartBuf[2] +
238  theKernel[1][0]*(double)leftKernelStartBuf[0] +
239  theKernel[1][1]*(double)leftKernelStartBuf[1] +
240  theKernel[1][2]*(double)leftKernelStartBuf[2] +
241  theKernel[2][0]*(double)llKernelStartBuf[0] +
242  theKernel[2][1]*(double)llKernelStartBuf[1] +
243  theKernel[2][2]*(double)llKernelStartBuf[2];
244 
245  if(sum > maxPix)
246  {
247  *outputBuf = maxPix;
248  }
249  else if(sum < minPix)
250  {
251  *outputBuf = minPix;
252  }
253  else
254  {
255  *outputBuf = static_cast<T>(sum);
256  }
257  }
258  else {
259  *outputBuf = oNullPix;
260  }
261  //
262  // Need to implement the convolution here
263  //
264 
265  ++ulKernelStartBuf;
266  ++leftKernelStartBuf;
267  ++llKernelStartBuf;
268  ++outputBuf;
269  }
270  }
271  }
272  }
273 }
virtual ossim_uint32 getWidth() const
virtual ossim_uint32 getNumberOfBands() const
virtual ossim_uint32 getHeight() const
#define abs(a)
Definition: auxiliary.h:74
virtual const ossim_float64 * getNullPix() const
virtual double getMinPixelValue(ossim_uint32 band=0) const
Returns the min pixel of the band.
ossim_int32 y
Definition: ossimIpt.h:142
virtual const void * getBuf() const
ossim_int32 x
Definition: ossimIpt.h:141
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.
virtual const ossimIpt & getOrigin() const
int ossim_int32

◆ getKernel()

void ossim3x3ConvolutionFilter::getKernel ( double  kernel[3][3])
virtual

Definition at line 502 of file ossim3x3ConvolutionFilter.cpp.

References theKernel.

503 {
504  kernel[0][0] = theKernel[0][0];
505  kernel[0][1] = theKernel[0][1];
506  kernel[0][2] = theKernel[0][2];
507  kernel[1][0] = theKernel[1][0];
508  kernel[1][1] = theKernel[1][1];
509  kernel[1][2] = theKernel[1][2];
510  kernel[2][0] = theKernel[2][0];
511  kernel[2][1] = theKernel[2][1];
512  kernel[2][2] = theKernel[2][2];
513 }

◆ getLongName()

virtual ossimString ossim3x3ConvolutionFilter::getLongName ( ) const
inlinevirtual

Reimplemented from ossimObject.

Definition at line 23 of file ossim3x3ConvolutionFilter.h.

23 {return ossimString("Convolves the input image with a 3x3 kernel");}

◆ getMaxPixelValue()

double ossim3x3ConvolutionFilter::getMaxPixelValue ( ossim_uint32  band = 0) const
virtual

Returns the max pixel of the band.

Reimplemented from ossimImageSource.

Definition at line 551 of file ossim3x3ConvolutionFilter.cpp.

References ossimImageSource::getMaxPixelValue(), ossimSource::isSourceEnabled(), and theMaxPixValue.

Referenced by computeNullMinMax(), convolveFull(), and convolvePartial().

552 {
553  if( isSourceEnabled() && (band < theMaxPixValue.size()) )
554  {
555  return theMaxPixValue[band];
556  }
557 
559 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.

◆ getMinPixelValue()

double ossim3x3ConvolutionFilter::getMinPixelValue ( ossim_uint32  band = 0) const
virtual

Returns the min pixel of the band.

Reimplemented from ossimImageSource.

Definition at line 541 of file ossim3x3ConvolutionFilter.cpp.

References ossimImageSource::getMinPixelValue(), ossimSource::isSourceEnabled(), and theMinPixValue.

Referenced by computeNullMinMax(), convolveFull(), and convolvePartial().

542 {
543  if( isSourceEnabled() && (band < theMinPixValue.size()) )
544  {
545  return theMinPixValue[band];
546  }
547 
549 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual double getMinPixelValue(ossim_uint32 band=0) const
Returns the min pixel of the band.

◆ getNullPixelValue()

double ossim3x3ConvolutionFilter::getNullPixelValue ( ossim_uint32  band = 0) const
virtual

Each band has a null pixel associated with it.

The null pixel represents an invalid value.

Reimplemented from ossimImageSource.

Definition at line 531 of file ossim3x3ConvolutionFilter.cpp.

References ossim::defaultNull(), ossimImageSource::getOutputScalarType(), ossimSource::isSourceEnabled(), and theNullPixValue.

Referenced by convolvePartial().

532 {
533  if( isSourceEnabled() && (band < theNullPixValue.size()) )
534  {
535  return theNullPixValue[band];
536  }
537 
539 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
OSSIM_DLL double defaultNull(ossimScalarType scalarType)
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.

◆ getProperty()

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

Reimplemented from ossimImageSourceFilter.

Definition at line 414 of file ossim3x3ConvolutionFilter.cpp.

References ossimImageSourceFilter::getProperty(), and theKernel.

415 {
416  if(name == "Kernel")
417  {
418  ossimMatrixProperty* property = new ossimMatrixProperty(name);
419  property->resize(3,3);
420  (*property)(0,0) = theKernel[0][0];
421  (*property)(1,0) = theKernel[1][0];
422  (*property)(2,0) = theKernel[2][0];
423  (*property)(0,1) = theKernel[0][1];
424  (*property)(1,1) = theKernel[1][1];
425  (*property)(2,1) = theKernel[2][1];
426  (*property)(0,2) = theKernel[0][2];
427  (*property)(1,2) = theKernel[1][2];
428  (*property)(2,2) = theKernel[2][2];
429  property->setCacheRefreshBit();
430 
431  return property;
432  }
434 }
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const

◆ getPropertyNames()

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

Reimplemented from ossimImageSourceFilter.

Definition at line 436 of file ossim3x3ConvolutionFilter.cpp.

References ossimImageSourceFilter::getPropertyNames().

437 {
439  propertyNames.push_back("Kernel");
440 }
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const

◆ getShortName()

virtual ossimString ossim3x3ConvolutionFilter::getShortName ( ) const
inlinevirtual

Reimplemented from ossimObject.

Definition at line 22 of file ossim3x3ConvolutionFilter.h.

22 {return ossimString("3x3 Convolution");}

◆ getTile()

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

Reimplemented from ossimImageSource.

Definition at line 38 of file ossim3x3ConvolutionFilter.cpp.

References allocate(), computeNullMinMax(), convolveFull(), convolvePartial(), ossimImageData::getBuf(), ossimDataObject::getDataObjectStatus(), ossimRectilinearDataObject::getScalarType(), ossimImageSource::getTile(), ossimSource::isSourceEnabled(), ossimIrect::lr(), ossimImageData::makeBlank(), OSSIM_DOUBLE, OSSIM_FLOAT, OSSIM_FULL, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SSHORT16, OSSIM_UCHAR, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, OSSIM_USHORT15, OSSIM_USHORT16, ossimNotify(), ossimNotifyLevel_WARN, ossimImageData::setImageRectangle(), ossimImageSourceFilter::theInputConnection, theNullPixValue, theTile, ossimIrect::ul(), ossimRefPtr< T >::valid(), ossimImageData::validate(), ossimIpt::x, and ossimIpt::y.

41 {
43  {
44  return theTile;
45  }
46 
47  if(!isSourceEnabled())
48  {
49  return theInputConnection->getTile(tileRect, resLevel);
50  }
51 
52  //---
53  // We have a 3x3 matrix so stretch the rect out to cover
54  // the required pixels. We only need 1 pixel to the left
55  // and right of the center pixel.
56  //---
57  ossimIrect newRect(ossimIpt(tileRect.ul().x - 1,
58  tileRect.ul().y - 1),
59  ossimIpt(tileRect.lr().x + 1,
60  tileRect.lr().y + 1));
61 
63  resLevel);
64 
65  if(!data.valid() || !data->getBuf())
66  {
67  return data;
68  }
69 
70  // First time through or after an initialize()...
71  if (!theTile.valid())
72  {
73  allocate();
74  if (!theTile.valid()) // Should never happen!
75  {
76  return data;
77  }
78  }
79 
80  // First time through, after an initialize() or a setKernel()...
81  if (!theNullPixValue.size())
82  {
84  if (!theNullPixValue.size()) // Should never happen!
85  {
86  return data;
87  }
88  }
89 
90  theTile->setImageRectangle(tileRect);
91  theTile->makeBlank();
92 
93  switch(data->getScalarType())
94  {
95  case OSSIM_UCHAR:
96  {
97  if(data->getDataObjectStatus() == OSSIM_FULL)
98  {
99  convolveFull(static_cast<ossim_uint8>(0), data, theTile);
100  }
101  else
102  {
103  convolvePartial(static_cast<ossim_uint8>(0), data, theTile);
104  }
105  break;
106  }
107  case OSSIM_FLOAT:
109  {
110  if(data->getDataObjectStatus() == OSSIM_FULL)
111  {
112  convolveFull(static_cast<float>(0), data, theTile);
113  }
114  else
115  {
116  convolvePartial(static_cast<float>(0), data, theTile);
117  }
118  break;
119  }
120  case OSSIM_USHORT16:
121  case OSSIM_USHORT11:
122  case OSSIM_USHORT12:
123  case OSSIM_USHORT13:
124  case OSSIM_USHORT14:
125  case OSSIM_USHORT15:
126  {
127  if(data->getDataObjectStatus() == OSSIM_FULL)
128  {
129  convolveFull(static_cast<ossim_uint16>(0), data, theTile);
130  }
131  else
132  {
133  convolvePartial(static_cast<ossim_uint16>(0), data, theTile);
134  }
135  break;
136  }
137  case OSSIM_SSHORT16:
138  {
139  if(data->getDataObjectStatus() == OSSIM_FULL)
140  {
141  convolveFull(static_cast<ossim_sint16>(0), data, theTile);
142  }
143  else
144  {
145  convolvePartial(static_cast<ossim_sint16>(0), data, theTile);
146  }
147  break;
148  }
149  case OSSIM_DOUBLE:
151  {
152  if(data->getDataObjectStatus() == OSSIM_FULL)
153  {
154  convolveFull(static_cast<double>(0), data, theTile);
155  }
156  else
157  {
158  convolvePartial(static_cast<double>(0), data, theTile);
159  }
160  break;
161  }
162  default:
163  {
165  << "ossim3x3ConvolutionFilter::getTile WARNING:\n"
166  << "Scalar type = " << theTile->getScalarType()
167  << " Not supported by ossim3x3ConvolutionFilter" << endl;
168  break;
169  }
170  }
171  theTile->validate();
172 
173  return theTile;
174 }
16 bit unsigned integer (15 bits used)
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual void setImageRectangle(const ossimIrect &rect)
bool valid() const
Definition: ossimRefPtr.h:75
void allocate()
Allocates theTile.
void convolvePartial(T, ossimRefPtr< ossimImageData > inputData, ossimRefPtr< ossimImageData > outputData)
virtual ossimDataObjectStatus getDataObjectStatus() const
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
void convolveFull(T, ossimRefPtr< ossimImageData > inputData, ossimRefPtr< ossimImageData > outputData)
void computeNullMinMax()
Computes null, min, and max considering input connection and theKernel.
virtual ossimDataObjectStatus validate() const
ossimImageSource * theInputConnection
32 bit normalized floating point
virtual ossimScalarType getScalarType() const
virtual void makeBlank()
Initializes data to null pixel values.
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
virtual const void * getBuf() const
32 bit floating point
16 bit unsigned iteger
64 bit floating point
16 bit signed integer
ossimRefPtr< ossimImageData > theTile
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
8 bit unsigned iteger
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)
16 bit unsigned integer (12 bits used)

◆ initialize()

void ossim3x3ConvolutionFilter::initialize ( )
virtual

Reimplemented from ossimImageSourceFilter.

Definition at line 357 of file ossim3x3ConvolutionFilter.cpp.

References clearNullMinMax(), and theTile.

358 {
359  //---
360  // NOTE:
361  // Since initialize get called often sequentially we will wipe things slick
362  // but not reallocate to avoid multiple delete/allocates.
363  //
364  // On the first getTile call things will be reallocated/computed.
365  //---
366  theTile = NULL;
367  clearNullMinMax();
368 }
void clearNullMinMax()
Clears data members theNullPixValue, theMinPixValue, and theMaxPixValue.
ossimRefPtr< ossimImageData > theTile

◆ loadState()

bool ossim3x3ConvolutionFilter::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 474 of file ossim3x3ConvolutionFilter.cpp.

References ossimString::c_str(), ossimKeywordlist::find(), ossimImageSourceFilter::loadState(), theKernel, ossimString::toDouble(), and ossimString::toString().

476 {
477  ossimString newPrefix = prefix;
478  newPrefix += ossimString("m");
479 
480  for(ossim_int32 r = 0; r < 3; r++)
481  {
482  for(ossim_int32 c = 0; c < 3; c++)
483  {
484  theKernel[r][c] = 0.0;
485 
486  ossimString value = ossimString::toString(r+1);
487  value += "_";
488  value += ossimString::toString(c+1);
489 
490  const char* v = kwl.find(newPrefix.c_str(),
491  value.c_str());
492  if(v)
493  {
494  theKernel[r][c] = ossimString(v).toDouble();
495  }
496  }
497  }
498 
499  return ossimImageSourceFilter::loadState(kwl, prefix);
500 }
const char * find(const char *key) const
static ossimString toString(bool aValue)
Numeric to string methods.
double toDouble() const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from 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
int ossim_int32

◆ saveState()

bool ossim3x3ConvolutionFilter::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 442 of file ossim3x3ConvolutionFilter.cpp.

References ossimKeywordlist::add(), ossimImageSourceFilter::saveState(), theKernel, and ossimString::toString().

444 {
445  kwl.add(prefix,
446  "rows",
447  3,
448  true);
449 
450  kwl.add(prefix,
451  "cols",
452  3,
453  true);
454 
455  for(ossim_int32 row = 0; row < 3; ++row)
456  {
457  for(ossim_int32 col =0; col < 3; ++col)
458  {
459  ossimString newPrefix = "m" +
460  ossimString::toString(row+1) + "_" +
461  ossimString::toString(col+1);
462  kwl.add(prefix,
463  newPrefix,
464  theKernel[row][col],
465  true);
466  }
467  }
468 
469 
470  return ossimImageSourceFilter::saveState(kwl, prefix);
471 }
static ossimString toString(bool aValue)
Numeric to string methods.
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
int ossim_int32

◆ setKernel()

void ossim3x3ConvolutionFilter::setKernel ( double  kernel[3][3])
virtual

Definition at line 515 of file ossim3x3ConvolutionFilter.cpp.

References clearNullMinMax(), and theKernel.

516 {
517  theKernel[0][0] = kernel[0][0];
518  theKernel[0][1] = kernel[0][1];
519  theKernel[0][2] = kernel[0][2];
520  theKernel[1][0] = kernel[1][0];
521  theKernel[1][1] = kernel[1][1];
522  theKernel[1][2] = kernel[1][2];
523  theKernel[2][0] = kernel[2][0];
524  theKernel[2][1] = kernel[2][1];
525  theKernel[2][2] = kernel[2][2];
526 
527  // Will be recomputed first getTile call.
528  clearNullMinMax();
529 }
void clearNullMinMax()
Clears data members theNullPixValue, theMinPixValue, and theMaxPixValue.

◆ setProperty()

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

Reimplemented from ossimImageSourceFilter.

Definition at line 383 of file ossim3x3ConvolutionFilter.cpp.

References ossimRefPtr< T >::get(), ossimProperty::getName(), PTR_CAST, ossimImageSourceFilter::setProperty(), and theKernel.

384 {
385  if(!property) return;
386  if(property->getName() == "Kernel")
387  {
389  property.get());
390  if(matrixProperty)
391  {
392  theKernel[0][0] = (*matrixProperty)(0,0);
393  theKernel[1][0] = (*matrixProperty)(1,0);
394  theKernel[2][0] = (*matrixProperty)(2,0);
395  theKernel[0][1] = (*matrixProperty)(0,1);
396  theKernel[1][1] = (*matrixProperty)(1,1);
397  theKernel[2][1] = (*matrixProperty)(2,1);
398  theKernel[0][2] = (*matrixProperty)(0,2);
399  theKernel[1][2] = (*matrixProperty)(1,2);
400  theKernel[2][2] = (*matrixProperty)(2,2);
401 
402  }
403  else
404  {
406  }
407  }
408  else
409  {
411  }
412 }
virtual void setProperty(ossimRefPtr< ossimProperty > property)
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
const ossimString & getName() const

Member Data Documentation

◆ theKernel

double ossim3x3ConvolutionFilter::theKernel[3][3]
protected

◆ theMaxPixValue

vector<double> ossim3x3ConvolutionFilter::theMaxPixValue
protected

◆ theMinPixValue

vector<double> ossim3x3ConvolutionFilter::theMinPixValue
protected

◆ theNullPixValue

vector<double> ossim3x3ConvolutionFilter::theNullPixValue
protected

◆ theTile

ossimRefPtr<ossimImageData> ossim3x3ConvolutionFilter::theTile
protected

Definition at line 68 of file ossim3x3ConvolutionFilter.h.

Referenced by allocate(), getTile(), and initialize().


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