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

#include <ossimHlzTool.h>

Inheritance diagram for ossimHlzTool::LsFitPatchProcessorJob:
ossimHlzTool::PatchProcessorJob ossimJob

Public Member Functions

 LsFitPatchProcessorJob (ossimHlzTool *hlzUtil, const ossimIpt &origin, ossim_uint32 chip_id=0)
 
 ~LsFitPatchProcessorJob ()
 
virtual bool level1Test ()
 
- Public Member Functions inherited from ossimHlzTool::PatchProcessorJob
 PatchProcessorJob (ossimHlzTool *hlzUtil, const ossimIpt &origin, ossim_uint32 chip_id=0)
 
bool level2Test ()
 
bool maskTest ()
 
- Public Member Functions inherited from ossimJob
 ossimJob ()
 
virtual void start ()
 Main entry point to the job. More...
 
std::shared_ptr< ossimJobgetSharedFromThis ()
 This is a convenience method to get the shared representation of this pointer. More...
 
std::shared_ptr< const ossimJobgetSharedFromThis () const
 This is a convenience method to get the shared representation of this pointer. More...
 
void setPercentComplete (double value)
 When the pernet complete is set for the job it will call any callbacks and nofity percentCompleteChanged. More...
 
void setPriority (double value)
 sets the priority of the job More...
 
double priority () const
 
virtual void release ()
 If derived interfaces implement a block this will allow one to release. More...
 
State state () const
 
virtual void resetState (int value)
 Will clear out the state and the call setState. More...
 
virtual void setState (int value, bool on=true)
 Will allow you to set the state of the job. More...
 
bool isCanceled () const
 
virtual void cancel ()
 Sets the state if the object as cancelled. More...
 
virtual void ready ()
 Sets the state if the object as ready. More...
 
virtual void running ()
 Sets the state if the object as running. More...
 
virtual void finished ()
 Sets the state if the object as finished. More...
 
bool isReady () const
 
bool isStopped () const
 
bool isFinished () const
 
bool isRunning () const
 
void setCallback (std::shared_ptr< ossimJobCallback > callback)
 
void setName (const ossimString &value)
 Sets the name of a job. More...
 
const ossimStringname () const
 
void setId (const ossimString &value)
 
const ossimStringid () const
 
void setDescription (const ossimString &value)
 
const ossimStringdescription () const
 
std::shared_ptr< ossimJobCallbackcallback ()
 

Public Attributes

ossimLeastSquaresPlanem_plane
 
- Public Attributes inherited from ossimHlzTool::PatchProcessorJob
ossimHlzToolm_hlzUtil
 
ossimIpt m_demPatchUL
 
ossimIpt m_demPatchLR
 
ossim_uint8 m_status
 
float m_nullValue
 

Additional Inherited Members

- Public Types inherited from ossimJob
enum  State {
  ossimJob_NONE = 0, ossimJob_READY = 1, ossimJob_RUNNING = 2, ossimJob_CANCEL = 4,
  ossimJob_FINISHED = 8, ossimJob_ALL = (ossimJob_READY|ossimJob_RUNNING|ossimJob_CANCEL|ossimJob_FINISHED)
}
 
This is a Bit vector. More...
 
typedef std::list< std::shared_ptr< ossimJob > > List
 
- Static Public Attributes inherited from ossimHlzTool::PatchProcessorJob
static std::mutex m_bufMutex
 
- Protected Member Functions inherited from ossimHlzTool::PatchProcessorJob
virtual void run ()
 Abstract method and must be overriden by the base class. More...
 
- Protected Attributes inherited from ossimJob
std::mutex m_jobMutex
 
ossimString m_name
 
ossimString m_description
 
ossimString m_id
 
State m_state
 
double m_priority
 
std::shared_ptr< ossimJobCallbackm_callback
 

Detailed Description

Definition at line 121 of file ossimHlzTool.h.

Constructor & Destructor Documentation

◆ LsFitPatchProcessorJob()

ossimHlzTool::LsFitPatchProcessorJob::LsFitPatchProcessorJob ( ossimHlzTool hlzUtil,
const ossimIpt origin,
ossim_uint32  chip_id = 0 
)
inline

Definition at line 124 of file ossimHlzTool.h.

125  : PatchProcessorJob(hlzUtil, origin, chip_id),
PatchProcessorJob(ossimHlzTool *hlzUtil, const ossimIpt &origin, ossim_uint32 chip_id=0)
ossimLeastSquaresPlane * m_plane
Definition: ossimHlzTool.h:130
Provide 2D Least Squares Plane model fitting The math model is that of a plane of the form: ...

◆ ~LsFitPatchProcessorJob()

ossimHlzTool::LsFitPatchProcessorJob::~LsFitPatchProcessorJob ( )
inline

Definition at line 128 of file ossimHlzTool.h.

128 { delete m_plane; }
ossimLeastSquaresPlane * m_plane
Definition: ossimHlzTool.h:130

Member Function Documentation

◆ level1Test()

bool ossimHlzTool::LsFitPatchProcessorJob::level1Test ( )
virtual

Implements ossimHlzTool::PatchProcessorJob.

Definition at line 581 of file ossimHlzTool.cpp.

References ossim::acosd(), distance(), ossim::isnan(), ossimIpt::x, and ossimIpt::y.

582 {
583  // Start with computing best-fit plane:
584  ossimIpt p;
585  double z;
586  double y_meters;
587  for (p.y = m_demPatchUL.y; p.y < m_demPatchLR.y; ++p.y)
588  {
589  y_meters = p.y*m_hlzUtil->m_gsd.y;
590  for (p.x = m_demPatchUL.x; p.x < m_demPatchLR.x; ++p.x)
591  {
592  z = m_hlzUtil->m_demBuffer->getPix(p, 0);
593  if ((z == m_nullValue) || ossim::isnan(z))
594  return false;
595  m_plane->addSample(p.x*m_hlzUtil->m_gsd.x, y_meters, z);
596  }
597  }
598  if (!m_plane->solveLS())
599  return false;
600 
601  // The slope is derived from the normal unit vector. Extract that from the solution and test
602  // against threshold:
603  double a, b, c;
604  m_plane->getLSParms(a, b, c);
605  double z_proj = 1.0 / sqrt(a*a + b*b + 1.0);
606  double theta = fabs(ossim::acosd(z_proj));
607  if (theta > m_hlzUtil->m_slopeThreshold)
608  return false;
609 
610  // Passed the slope test. Now measure the roughness as peak deviation from the plane:
611  double distance;
612  for (p.y = m_demPatchUL.y; (p.y < m_demPatchLR.y); ++p.y)
613  {
614  for (p.x = m_demPatchUL.x; (p.x < m_demPatchLR.x); ++p.x)
615  {
616  z = m_hlzUtil->m_demBuffer->getPix(p, 0);
617  distance = fabs(z_proj * (a*p.x + b*p.y + c - z));
619  return false;
620  }
621  }
622 
623  m_status = 1; // indicates passed level 1
624  return true;
625 }
double m_slopeThreshold
Definition: ossimHlzTool.h:78
double m_roughnessThreshold
Definition: ossimHlzTool.h:79
double y
Definition: ossimDpt.h:165
virtual void addSample(double x, double y, double z_mea)
add a single data sample.
double acosd(double x)
Definition: ossimCommon.h:264
virtual ossim_float64 getPix(const ossimIpt &position, ossim_uint32 band=0) const
Will return the pixel at location position.
ossimRefPtr< ossimImageData > m_demBuffer
Definition: ossimHlzTool.h:83
ossimLeastSquaresPlane * m_plane
Definition: ossimHlzTool.h:130
bool solveLS()
compute least squares parameter solution - true if succesfull.
ossim_int32 y
Definition: ossimIpt.h:142
double x
Definition: ossimDpt.h:164
virtual bool getLSParms(double &pa, double &pb, double &pc) const
return LS solution parameters.
ossim_int32 x
Definition: ossimIpt.h:141
float distance(double lat1, double lon1, double lat2, double lon2, int units)
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

Member Data Documentation

◆ m_plane

ossimLeastSquaresPlane* ossimHlzTool::LsFitPatchProcessorJob::m_plane

Definition at line 130 of file ossimHlzTool.h.


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