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

#include <ossimImageToPlaneNormalFilter.h>

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

Public Member Functions

 ossimImageToPlaneNormalFilter ()
 
 ossimImageToPlaneNormalFilter (ossimImageSource *inputSource)
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIrect &tileRect, ossim_uint32 resLevel=0)
 
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 ossimScalarType getOutputScalarType () const
 This will be used to query the output pixel type of the tile source. More...
 
virtual ossim_uint32 getNumberOfOutputBands () const
 Returns the number of bands in a tile returned from this TileSource. More...
 
void setXScale (const double &scale)
 
void setYScale (const double &scale)
 
double getXScale () const
 
double getYScale () const
 
void setTrackScaleFlag (bool flag)
 
bool getTrackScaleFlag () const
 
void setSmoothnessFactor (double value)
 
double getSmoothnessFactor () const
 
bool loadState (const ossimKeywordlist &kwl, const char *prefix)
 Method to the load (recreate) the state of an object from a keyword list. More...
 
bool saveState (ossimKeywordlist &kwl, const char *prefix) const
 Method to save the state of an object to a keyword list. More...
 
virtual void initialize ()
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) 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 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 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 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 initializeTile ()
 
virtual void computeNormals (ossimRefPtr< ossimImageData > &inputTile, ossimRefPtr< ossimImageData > &outputTile)
 
template<class T >
void computeNormalsTemplate (T inputScalarTypeDummy, ossimRefPtr< ossimImageData > &inputTile, ossimRefPtr< ossimImageData > &outputTile)
 
- 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
 
ossimRefPtr< ossimImageDatatheBlankTile
 
ossimIrect theInputBounds
 
bool theTrackScaleFlag
 
double theXScale
 
double theYScale
 
double theSmoothnessFactor
 
- 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 16 of file ossimImageToPlaneNormalFilter.h.

Constructor & Destructor Documentation

◆ ossimImageToPlaneNormalFilter() [1/2]

ossimImageToPlaneNormalFilter::ossimImageToPlaneNormalFilter ( )

◆ ossimImageToPlaneNormalFilter() [2/2]

ossimImageToPlaneNormalFilter::ossimImageToPlaneNormalFilter ( ossimImageSource inputSource)

Member Function Documentation

◆ computeNormals()

void ossimImageToPlaneNormalFilter::computeNormals ( ossimRefPtr< ossimImageData > &  inputTile,
ossimRefPtr< ossimImageData > &  outputTile 
)
protectedvirtual

Definition at line 151 of file ossimImageToPlaneNormalFilter.cpp.

References computeNormalsTemplate(), ossimRectilinearDataObject::getScalarType(), OSSIM_DOUBLE, OSSIM_FLOAT, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SSHORT16, OSSIM_UCHAR, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, OSSIM_USHORT15, and OSSIM_USHORT16.

Referenced by getTile().

154 {
155  switch(inputTile->getScalarType())
156  {
157  case OSSIM_SSHORT16:
158  {
160  inputTile,
161  outputTile);
162  break;
163  }
164  case OSSIM_UCHAR:
165  {
167  inputTile,
168  outputTile);
169  break;
170  }
171  case OSSIM_USHORT11:
172  case OSSIM_USHORT12:
173  case OSSIM_USHORT13:
174  case OSSIM_USHORT14:
175  case OSSIM_USHORT15:
176  case OSSIM_USHORT16:
177  {
179  inputTile,
180  outputTile);
181  break;
182  }
184  case OSSIM_DOUBLE:
185  {
187  inputTile,
188  outputTile);
189  break;
190  }
192  case OSSIM_FLOAT:
193  {
195  inputTile,
196  outputTile);
197  break;
198  }
199  default:
200  break;
201  }
202 }
16 bit unsigned integer (15 bits used)
float ossim_float32
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
unsigned short ossim_uint16
double ossim_float64
signed short ossim_sint16
32 bit normalized floating point
virtual ossimScalarType getScalarType() const
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
void computeNormalsTemplate(T inputScalarTypeDummy, ossimRefPtr< ossimImageData > &inputTile, ossimRefPtr< ossimImageData > &outputTile)
32 bit floating point
16 bit unsigned iteger
64 bit floating point
16 bit signed integer
unsigned char ossim_uint8
8 bit unsigned iteger
16 bit unsigned integer (12 bits used)

◆ computeNormalsTemplate()

template<class T >
void ossimImageToPlaneNormalFilter::computeNormalsTemplate ( inputScalarTypeDummy,
ossimRefPtr< ossimImageData > &  inputTile,
ossimRefPtr< ossimImageData > &  outputTile 
)
protected

Definition at line 204 of file ossimImageToPlaneNormalFilter.cpp.

References ossimImageData::getBuf(), ossimImageData::getHeight(), ossimImageData::getNullPix(), ossimImageData::getWidth(), n, theSmoothnessFactor, theXScale, theYScale, ossimColumnVector3d::unit(), x, and y.

Referenced by computeNormals().

208 {
209  T inputNull = (T) inputTile->getNullPix(0);
210  T* inbuf = (T*) inputTile->getBuf();
211  T outputNull = (T) outputTile->getNullPix(0);
212  double* normX = (double*)outputTile->getBuf(0);
213  double* normY = (double*)outputTile->getBuf(1);
214  double* normZ = (double*)outputTile->getBuf(2);
215  ossim_int32 inbuf_width = inputTile->getWidth();
216  ossim_int32 normbuf_width = outputTile->getWidth();
217  ossim_int32 normbuf_height = outputTile->getHeight();
218  ossimColumnVector3d normal;
219  bool valid_component = true;
220  for (ossim_int32 y=0; y<normbuf_height; y++)
221  {
222  // Establish offsets into the image and output normals buffers given row:
223  ossim_uint32 n = y*normbuf_width;
224  ossim_uint32 i = (y+1)*inbuf_width + 1;
225 
226  // Loop to compute the gradient (normal) vector [dh/dx, dh/dy, 1]:
227  for (ossim_int32 x=0; x<normbuf_width; x++)
228  {
229  // Default in case of null inputs is a flat earth:
230  normal[0] = 0;
231  normal[1] = 0;
232  normal[2] = 1.0;
233 
234  // Compute the x-direction differential:
235  if (inbuf[i+1] != inputNull)
236  {
237  if (inbuf[i-1] != inputNull)
238  normal[0] = theXScale*theSmoothnessFactor*(inbuf[i+1] - inbuf[i-1]) / 2.0;
239  else if (inbuf[i] != inputNull)
240  normal[0] = theXScale*theSmoothnessFactor*(inbuf[i+1] - inbuf[i]);
241  }
242  else if ((inbuf[i] != inputNull) && (inbuf[i-1] != inputNull))
243  {
244  normal[0] = theXScale*theSmoothnessFactor*(inbuf[i] - inbuf[i-1]);
245  }
246  else
247  {
248  valid_component = false;
249  }
250 
251  // Compute the y-direction differential:
252  if (valid_component)
253  {
254  if (inbuf[i+inbuf_width] != inputNull)
255  {
256  if (inbuf[i-inbuf_width] != inputNull)
257  normal[1] = theYScale*theSmoothnessFactor*(inbuf[i+inbuf_width] - inbuf[i-inbuf_width]) / 2.0;
258  else if (inbuf[i] != inputNull)
259  normal[1] = theYScale*theSmoothnessFactor*(inbuf[i+inbuf_width] - inbuf[i]);
260  }
261  else if ((inbuf[i] != inputNull) && (inbuf[i-inbuf_width] != inputNull))
262  {
263  normal[1] = theYScale*theSmoothnessFactor*(inbuf[i] - inbuf[i-inbuf_width]);
264  }
265  else
266  {
267  valid_component = false;
268  }
269  }
270 
271  // Stuff the normalized gradient vector into the output buffers:
272  if (valid_component)
273  {
274  normal = normal.unit();
275  normX[n] = normal[0];
276  normY[n] = normal[1];
277  normZ[n] = normal[2];
278  }
279  else
280  {
281  normX[n] = outputNull;
282  normY[n] = outputNull;
283  normZ[n] = outputNull;
284  }
285 
286  ++n;
287  ++i;
288  valid_component = true;
289  }
290  }
291 }
virtual ossim_uint32 getWidth() const
ossim_uint32 x
ossim_uint32 y
ossimColumnVector3d unit() const
virtual ossim_uint32 getHeight() const
os2<< "> n<< " > nendobj n
unsigned int ossim_uint32
virtual const ossim_float64 * getNullPix() const
virtual const void * getBuf() const
int ossim_int32

◆ getMaxPixelValue()

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

Returns the max pixel of the band.

Reimplemented from ossimImageSource.

Definition at line 356 of file ossimImageToPlaneNormalFilter.cpp.

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

357 {
358  if(!isSourceEnabled())
359  {
361  }
362  return 1.0;
363 }
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 ossimImageToPlaneNormalFilter::getMinPixelValue ( ossim_uint32  band = 0) const
virtual

Returns the min pixel of the band.

Reimplemented from ossimImageSource.

Definition at line 347 of file ossimImageToPlaneNormalFilter.cpp.

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

348 {
349  if(!isSourceEnabled())
350  {
352  }
353  return -1;
354 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual double getMinPixelValue(ossim_uint32 band=0) const
Returns the min pixel of the band.

◆ getNumberOfOutputBands()

ossim_uint32 ossimImageToPlaneNormalFilter::getNumberOfOutputBands ( ) const
virtual

Returns the number of bands in a tile returned from this TileSource.

Reimplemented from ossimImageSource.

Definition at line 375 of file ossimImageToPlaneNormalFilter.cpp.

References ossimImageSource::getNumberOfOutputBands(), and ossimSource::isSourceEnabled().

376 {
377  if(isSourceEnabled())
378  {
379  return 3;
380  }
382 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.

◆ getOutputScalarType()

ossimScalarType ossimImageToPlaneNormalFilter::getOutputScalarType ( ) const
virtual

This will be used to query the output pixel type of the tile source.

Please ignore the argument. It will soon be removed.

Reimplemented from ossimImageSource.

Definition at line 365 of file ossimImageToPlaneNormalFilter.cpp.

References ossimImageSource::getOutputScalarType(), ossimSource::isSourceEnabled(), and OSSIM_DOUBLE.

366 {
367  if(isSourceEnabled())
368  {
369  return OSSIM_DOUBLE;
370  }
371 
373 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
64 bit floating point

◆ getProperty()

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

Reimplemented from ossimImageSourceFilter.

Definition at line 454 of file ossimImageToPlaneNormalFilter.cpp.

References ossimImageSourceFilter::getProperty(), ossimProperty::setCacheRefreshBit(), theSmoothnessFactor, theTrackScaleFlag, theXScale, theYScale, and ossimString::toString().

455 {
456  if((name == "smoothnessFactor")||
457  (name == "gain"))
458  {
460  prop->setCacheRefreshBit();
461  return prop;
462  }
463  else if(name == "xscale")
464  {
466  prop->setCacheRefreshBit();
467  return prop;
468  }
469  else if(name == "yscale")
470  {
472  prop->setCacheRefreshBit();
473  return prop;
474  }
475  else if(name == "autoTrackScaleFlag")
476  {
478  prop->setCacheRefreshBit();
479  return prop;
480  }
481 
483 }
static ossimString toString(bool aValue)
Numeric to string methods.
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
void setCacheRefreshBit()

◆ getPropertyNames()

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

Reimplemented from ossimImageSourceFilter.

Definition at line 485 of file ossimImageToPlaneNormalFilter.cpp.

References ossimImageSourceFilter::getPropertyNames().

486 {
488  propertyNames.push_back("gain");
489  propertyNames.push_back("xscale");
490  propertyNames.push_back("yscale");
491  propertyNames.push_back("autoTrackScaleFlag");
492 }
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const

◆ getSmoothnessFactor()

double ossimImageToPlaneNormalFilter::getSmoothnessFactor ( ) const

Definition at line 419 of file ossimImageToPlaneNormalFilter.cpp.

References theSmoothnessFactor.

◆ getTile()

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

Reimplemented from ossimImageSource.

Definition at line 47 of file ossimImageToPlaneNormalFilter.cpp.

References ossimIrect::completely_within(), computeNormals(), ossimRefPtr< T >::get(), ossimImageSource::getDecimationFactor(), ossimImageSource::getTile(), ossimDpt::hasNans(), initialize(), initializeTile(), ossimSource::isSourceEnabled(), ossimIrect::lr(), OSSIM_EMPTY, ossimImageData::setImageRectangle(), theBlankTile, theInputBounds, ossimImageSourceFilter::theInputConnection, theTile, theXScale, theYScale, ossimIrect::ul(), ossimRefPtr< T >::valid(), ossimImageData::validate(), ossimIpt::x, ossimDpt::x, ossimIpt::y, and ossimDpt::y.

Referenced by ossimSlopeFilter::getTile().

50 {
52  {
53  return ossimImageSourceFilter::getTile(tileRect, resLevel);
54  }
55 
56  if(!theTile.valid())
57  {
58  initialize();
59  }
60 
61  if(!theTile.valid())
62  {
63  return ossimImageSourceFilter::getTile(tileRect, resLevel);
64  }
65 
66  theTile->setImageRectangle(tileRect);
67 
68  ossimIrect requestRect(tileRect.ul().x - 1,
69  tileRect.ul().y - 1,
70  tileRect.lr().x + 1,
71  tileRect.lr().y + 1);
72 
74  theInputConnection->getTile(requestRect, resLevel);
75 
76  if(!input||(input->getDataObjectStatus()==OSSIM_EMPTY)||!input->getBuf())
77  {
78  if(tileRect.completely_within(theInputBounds))
79  {
81  theTile->validate();
82  return theTile.get();
83  }
85  return theBlankTile;
86  }
87 
88  double oldScaleX = theXScale;
89  double oldScaleY = theYScale;
90 
91  if(resLevel > 0)
92  {
93  ossimDpt scaleFactor;
94  theInputConnection->getDecimationFactor(resLevel, scaleFactor);
95 
96  if(!scaleFactor.hasNans())
97  {
98  theXScale *= scaleFactor.x;
99  theYScale *= scaleFactor.y;
100  }
101  }
102 
103  computeNormals(input, theTile);
104 
105  theXScale = oldScaleX;
106  theYScale = oldScaleY;
107 
108  theTile->validate();
109 
110  return theTile;
111 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual void setImageRectangle(const ossimIrect &rect)
bool valid() const
Definition: ossimRefPtr.h:75
double y
Definition: ossimDpt.h:165
ossimRefPtr< ossimImageData > theTile
virtual ossimDataObjectStatus validate() const
ossimImageSource * theInputConnection
bool hasNans() const
Definition: ossimDpt.h:67
double x
Definition: ossimDpt.h:164
virtual void computeNormals(ossimRefPtr< ossimImageData > &inputTile, ossimRefPtr< ossimImageData > &outputTile)
virtual void getDecimationFactor(ossim_uint32 resLevel, ossimDpt &result) const
Will return the decimation factor for the given resolution level.
ossimRefPtr< ossimImageData > theBlankTile
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)

◆ getTrackScaleFlag()

bool ossimImageToPlaneNormalFilter::getTrackScaleFlag ( ) const

Definition at line 409 of file ossimImageToPlaneNormalFilter.cpp.

References theTrackScaleFlag.

◆ getXScale()

double ossimImageToPlaneNormalFilter::getXScale ( ) const

Definition at line 389 of file ossimImageToPlaneNormalFilter.cpp.

References theXScale.

390 {
391  return theXScale;
392 }

◆ getYScale()

double ossimImageToPlaneNormalFilter::getYScale ( ) const

Definition at line 394 of file ossimImageToPlaneNormalFilter.cpp.

References theYScale.

395 {
396  return theYScale;
397 }

◆ initialize()

void ossimImageToPlaneNormalFilter::initialize ( )
virtual

Reimplemented from ossimImageSourceFilter.

Definition at line 124 of file ossimImageToPlaneNormalFilter.cpp.

References ossimImageDataFactory::create(), ossimImageData::dup(), ossimImageSource::getBoundingRect(), ossimImageSource::getImageGeometry(), ossimImageGeometry::getMetersPerPixel(), ossimDpt::hasNans(), ossimImageSource::initialize(), ossimImageData::initialize(), ossimImageDataFactory::instance(), theBlankTile, theInputBounds, ossimImageSourceFilter::theInputConnection, theTile, theTrackScaleFlag, theXScale, theYScale, ossimRefPtr< T >::valid(), ossimDpt::x, and ossimDpt::y.

Referenced by getTile(), ossimSlopeFilter::initialize(), and setProperty().

125 {
127  {
129 
133  theTile->initialize();
134 
136  {
138  if( geom.valid() )
139  {
140  ossimDpt pt = geom->getMetersPerPixel();
141  if(!pt.hasNans())
142  {
143  theXScale = 1.0/pt.x;
144  theYScale = 1.0/pt.y;
145  }
146  }
147  }
148  }
149 }
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const
This will return the bounding rect of the source.
bool valid() const
Definition: ossimRefPtr.h:75
double y
Definition: ossimDpt.h:165
virtual void initialize()
Initialize the data buffer.
virtual ossimObject * dup() const
static ossimImageDataFactory * instance()
ossimRefPtr< ossimImageData > theTile
ossimImageSource * theInputConnection
ossimDpt getMetersPerPixel() const
Returns the GSD associated with this image in the active projection.
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
bool hasNans() const
Definition: ossimDpt.h:67
virtual ossimRefPtr< ossimImageGeometry > getImageGeometry()
Returns the image geometry object associated with this tile source or NULL if not defined...
double x
Definition: ossimDpt.h:164
virtual void initialize()=0
ossimRefPtr< ossimImageData > theBlankTile

◆ initializeTile()

void ossimImageToPlaneNormalFilter::initializeTile ( )
protected

Definition at line 113 of file ossimImageToPlaneNormalFilter.cpp.

References ossimImageData::getBuf(), ossimImageData::getSizePerBand(), theTile, x, and y.

Referenced by getTile().

114 {
115  double* x = static_cast<double*>(theTile->getBuf(0));
116  double* y = static_cast<double*>(theTile->getBuf(1));
117  double* z = static_cast<double*>(theTile->getBuf(2));
118 
119  if(x) std::fill(x, x+theTile->getSizePerBand(), 0.0);
120  if(y) std::fill(y, y+theTile->getSizePerBand(), 0.0);
121  if(z) std::fill(z, z+theTile->getSizePerBand(), 1.0);
122 }
ossim_uint32 x
ossim_uint32 y
ossimRefPtr< ossimImageData > theTile
virtual ossim_uint32 getSizePerBand() const
Returns the number of pixels in a single band in a tile.
virtual const void * getBuf() const

◆ loadState()

bool ossimImageToPlaneNormalFilter::loadState ( const ossimKeywordlist kwl,
const char *  prefix 
)
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 293 of file ossimImageToPlaneNormalFilter.cpp.

References ossimKeywordlist::find(), ossimKeywordNames::SCALE_PER_PIXEL_X_KW, and ossimKeywordNames::SCALE_PER_PIXEL_Y_KW.

295 {
298  ossimString trackFlag = kwl.find(prefix, "track_scale_flag");
299  ossimString smoothness = kwl.find(prefix, SMOOTHNESS_FACTOR_KW);
300 
301  if(scaleX != "")
302  {
303  theXScale = scaleX.toDouble();
304  }
305  if(scaleY != "")
306  {
307  theYScale = scaleY.toDouble();
308  }
309  if(trackFlag != "")
310  {
311  theTrackScaleFlag = trackFlag.toBool();
312  }
313  if(smoothness!="")
314  {
315  theSmoothnessFactor = smoothness.toDouble();
316  }
317 
318  return ossimImageSourceFilter::loadState(kwl, prefix);
319 }
const char * find(const char *key) const
static const char * SCALE_PER_PIXEL_X_KW
bool toBool() const
String to numeric 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.
static const char * SCALE_PER_PIXEL_Y_KW

◆ saveState()

bool ossimImageToPlaneNormalFilter::saveState ( ossimKeywordlist kwl,
const char *  prefix 
) 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 321 of file ossimImageToPlaneNormalFilter.cpp.

References ossimKeywordlist::add(), ossimKeywordNames::SCALE_PER_PIXEL_X_KW, ossimKeywordNames::SCALE_PER_PIXEL_Y_KW, theTrackScaleFlag, and theXScale.

323 {
324  kwl.add(prefix,
326  theXScale,
327  true);
328 
329  kwl.add(prefix,
331  theXScale,
332  true);
333 
334  kwl.add(prefix,
335  "track_scale_flag",
337  true);
338 
339  kwl.add(prefix,
340  SMOOTHNESS_FACTOR_KW,
342  true);
343 
344  return ossimImageSourceFilter::saveState(kwl, prefix);
345 }
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
static const char * SCALE_PER_PIXEL_X_KW
unsigned int ossim_uint32
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
static const char * SCALE_PER_PIXEL_Y_KW

◆ setProperty()

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

Reimplemented from ossimImageSourceFilter.

Definition at line 424 of file ossimImageToPlaneNormalFilter.cpp.

References initialize(), ossimImageSourceFilter::setProperty(), theSmoothnessFactor, theTrackScaleFlag, theXScale, and theYScale.

425 {
426  ossimString name = property->getName();
427  if((name == "smoothnessFactor")||
428  (name == "gain"))
429  {
430  theSmoothnessFactor = property->valueToString().toDouble();
431  initialize();
432  }
433  else if(name == "xscale")
434  {
435  theXScale = property->valueToString().toDouble();
436  initialize();
437  }
438  else if(name == "yscale")
439  {
440  theYScale = property->valueToString().toDouble();
441  initialize();
442  }
443  else if(name == "autoTrackScaleFlag")
444  {
445  theTrackScaleFlag = property->valueToString().toDouble();
446  initialize();
447  }
448  else
449  {
451  }
452 }
virtual void setProperty(ossimRefPtr< ossimProperty > property)

◆ setSmoothnessFactor()

void ossimImageToPlaneNormalFilter::setSmoothnessFactor ( double  value)

◆ setTrackScaleFlag()

void ossimImageToPlaneNormalFilter::setTrackScaleFlag ( bool  flag)

◆ setXScale()

void ossimImageToPlaneNormalFilter::setXScale ( const double &  scale)

Definition at line 384 of file ossimImageToPlaneNormalFilter.cpp.

References theXScale.

385 {
386  theXScale = scale;
387 }

◆ setYScale()

void ossimImageToPlaneNormalFilter::setYScale ( const double &  scale)

Definition at line 399 of file ossimImageToPlaneNormalFilter.cpp.

References theYScale.

400 {
401  theYScale = scale;
402 }

Member Data Documentation

◆ theBlankTile

ossimRefPtr<ossimImageData> ossimImageToPlaneNormalFilter::theBlankTile
protected

Definition at line 56 of file ossimImageToPlaneNormalFilter.h.

Referenced by getTile(), and initialize().

◆ theInputBounds

ossimIrect ossimImageToPlaneNormalFilter::theInputBounds
protected

Definition at line 57 of file ossimImageToPlaneNormalFilter.h.

Referenced by getTile(), and initialize().

◆ theSmoothnessFactor

double ossimImageToPlaneNormalFilter::theSmoothnessFactor
protected

◆ theTile

ossimRefPtr<ossimImageData> ossimImageToPlaneNormalFilter::theTile
protected

Definition at line 55 of file ossimImageToPlaneNormalFilter.h.

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

◆ theTrackScaleFlag

bool ossimImageToPlaneNormalFilter::theTrackScaleFlag
protected

◆ theXScale

double ossimImageToPlaneNormalFilter::theXScale
protected

◆ theYScale

double ossimImageToPlaneNormalFilter::theYScale
protected

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