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

#include <ossimHlzTool.h>

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

Public Member Functions

 PatchProcessorJob (ossimHlzTool *hlzUtil, const ossimIpt &origin, ossim_uint32 chip_id=0)
 
virtual bool level1Test ()=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

ossimHlzToolm_hlzUtil
 
ossimIpt m_demPatchUL
 
ossimIpt m_demPatchLR
 
ossim_uint8 m_status
 
float m_nullValue
 

Static Public Attributes

static std::mutex m_bufMutex
 

Protected Member Functions

virtual void run ()
 Abstract method and must be overriden by the base class. More...
 

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
 
- 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 98 of file ossimHlzTool.h.

Constructor & Destructor Documentation

◆ PatchProcessorJob()

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

Definition at line 550 of file ossimHlzTool.cpp.

References ossimHlzTool::m_demFilterSize, m_demPatchLR, m_demPatchUL, m_hlzUtil, ossimIpt::x, and ossimIpt::y.

552 : m_hlzUtil (hlzUtil),
553  m_demPatchUL (origin),
554  m_status (0),
555  m_nullValue (hlzUtil->m_demBuffer->getNullPix(0))
556 {
559 }
ossimIpt m_demFilterSize
Definition: ossimHlzTool.h:82
ossimRefPtr< ossimImageData > m_demBuffer
Definition: ossimHlzTool.h:83
virtual const ossim_float64 * getNullPix() const
ossim_int32 y
Definition: ossimIpt.h:142
ossim_int32 x
Definition: ossimIpt.h:141

Member Function Documentation

◆ level1Test()

virtual bool ossimHlzTool::PatchProcessorJob::level1Test ( )
pure virtual

◆ level2Test()

bool ossimHlzTool::PatchProcessorJob::level2Test ( )

Definition at line 647 of file ossimHlzTool.cpp.

References ossimPointBlock::empty(), ossimPointCloudHandler::getBlock(), ossimPointCloudHandler::getBounds(), ossimGpt::hgt, ossimGrect::intersects(), ossim::nan(), ossimPointRecord::NumberOfReturns, ossimPointRecord::ReturnNumber, and ossimPointBlock::size().

648 {
649  // Level 2 only valid if a point cloud dataset is available:
650  if (m_hlzUtil->m_pcSources.empty())
651  {
652  ++m_status; // assumes level2 passes
653  return true;
654  }
655 
656  // Need to convert DEM file coordinate bounds to geographic.
657  ossimGpt chipUlGpt, chipLrGpt;
660  chipUlGpt.hgt = ossim::nan();
661  chipLrGpt.hgt = ossim::nan();
662  ossimGrect grect (chipUlGpt, chipLrGpt);
663 
664  // TODO: LIMITATION: Only a single point cloud source is considered. Need to expand to handle
665  // a list:
666  const ossimPointCloudHandler* pc_src = m_hlzUtil->m_pcSources[0].get();
667 
668  // First check if there is even any coverage:
669  m_status = 0; // reset assumes no coverage
670  ossimGrect bb;
671  pc_src->getBounds(bb);
672  if (!bb.intersects(grect))
673  return false;
674 
676  pc_src->getBlock(grect, pc_block);
677  if (pc_block.empty())
678  return false;
679 
680  bool found_obstruction = false;
681 
682  // Scan the block for obstructions:
683  ossimGpt point_plh;
684  ossimDpt point_xy;
685  ossim_uint32 numPoints = pc_block.size();
686  for (ossim_uint32 i=0; (i<numPoints) && !found_obstruction; ++i)
687  {
688  //If this is not the only return, implies clutter along the ray:
689  int num_returns = (int) pc_block[i]->getField(ossimPointRecord::NumberOfReturns);
690  if (num_returns > 1)
691  {
692  found_obstruction = true;
693  break;
694  }
695  }
696 
697  if (!found_obstruction)
698  m_status = 2;
699 
700  return true;
701 }
ossimRefPtr< ossimImageGeometry > m_geom
std::vector< ossimRefPtr< ossimPointCloudHandler > > m_pcSources
Definition: ossimHlzTool.h:91
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
virtual void getBounds(ossimGrect &bounds) const
ossim_float64 hgt
Height in meters above the ellipsiod.
Definition: ossimGpt.h:274
bool localToWorld(const ossimDpt &local_pt, ossimGpt &world_pt) const
Exposes the 3D projection from image to world coordinates.
unsigned int ossim_uint32
virtual void getBlock(const ossimGrect &bounds, ossimPointBlock &block) const
Fetches the block of points inside the block bounds.
Base class for all point-cloud file readers.
bool intersects(const ossimGrect &rect) const
Definition: ossimGrect.cpp:266

◆ maskTest()

bool ossimHlzTool::PatchProcessorJob::maskTest ( )

Definition at line 703 of file ossimHlzTool.cpp.

References ossimImageData::getPix(), ossimIpt::x, and ossimIpt::y.

704 {
705  // Threat dome only valid if a mask source is available:
706  if (m_hlzUtil->m_maskSources.empty())
707  return true;
708 
710  vector<MaskSource>::iterator mask_source = m_hlzUtil->m_maskSources.begin();
711  bool test_passed = true;
712  ossimIpt p;
713  ossim_uint8 mask_value;
714 
715  while ((mask_source != m_hlzUtil->m_maskSources.end()) && test_passed)
716  {
717  ossimRefPtr<ossimImageData> mask_data = mask_source->image->getTile(chipRect);
718  for (p.y = m_demPatchUL.y; (p.y < m_demPatchLR.y) && test_passed; ++p.y)
719  {
720  for (p.x = m_demPatchUL.x; (p.x < m_demPatchLR.x) && test_passed; ++p.x)
721  {
722  mask_value = mask_data->getPix(p);
723  if (( mask_value && mask_source->exclude) || (!mask_value && !mask_source->exclude))
724  test_passed = false;
725  }
726  }
727  ++mask_source;
728  }
729 
730  return test_passed;
731 }
virtual ossim_float64 getPix(const ossimIpt &position, ossim_uint32 band=0) const
Will return the pixel at location position.
ossim_int32 y
Definition: ossimIpt.h:142
ossim_int32 x
Definition: ossimIpt.h:141
std::vector< MaskSource > m_maskSources
Definition: ossimHlzTool.h:92
unsigned char ossim_uint8

◆ run()

void ossimHlzTool::PatchProcessorJob::run ( )
protectedvirtual

Abstract method and must be overriden by the base class.

The base ossimJob will call run from the start method after setting some variables.

Implements ossimJob.

Definition at line 561 of file ossimHlzTool.cpp.

References ossimIpt::x, and ossimIpt::y.

562 {
563  bool passed = level1Test() && level2Test() && maskTest();
564  ossimIpt p;
565 
566  std::lock_guard<std::mutex> lock (m_bufMutex);
567  for (p.y = m_demPatchUL.y; p.y < m_demPatchLR.y; ++p.y)
568  {
569  for (p.x = m_demPatchUL.x; p.x < m_demPatchLR.x; ++p.x)
570  {
571  if (passed && (m_status == 2))
573  else if (passed && (m_status == 1))
575  else
577  }
578  }
579 }
virtual void setValue(ossim_int32 x, ossim_int32 y, ossim_float64 color)
ossim_uint8 m_goodLzValue
Definition: ossimHlzTool.h:88
ossim_uint8 m_badLzValue
Definition: ossimHlzTool.h:86
ossimRefPtr< ossimImageData > m_outBuffer
Definition: ossimHlzTool.h:84
ossim_uint8 m_marginalLzValue
Definition: ossimHlzTool.h:87
ossim_int32 y
Definition: ossimIpt.h:142
ossim_int32 x
Definition: ossimIpt.h:141

Member Data Documentation

◆ m_bufMutex

std::mutex ossimHlzTool::PatchProcessorJob::m_bufMutex
static

Definition at line 114 of file ossimHlzTool.h.

◆ m_demPatchLR

ossimIpt ossimHlzTool::PatchProcessorJob::m_demPatchLR

Definition at line 109 of file ossimHlzTool.h.

Referenced by PatchProcessorJob().

◆ m_demPatchUL

ossimIpt ossimHlzTool::PatchProcessorJob::m_demPatchUL

Definition at line 108 of file ossimHlzTool.h.

Referenced by PatchProcessorJob().

◆ m_hlzUtil

ossimHlzTool* ossimHlzTool::PatchProcessorJob::m_hlzUtil

Definition at line 107 of file ossimHlzTool.h.

Referenced by PatchProcessorJob().

◆ m_nullValue

float ossimHlzTool::PatchProcessorJob::m_nullValue

Definition at line 111 of file ossimHlzTool.h.

◆ m_status

ossim_uint8 ossimHlzTool::PatchProcessorJob::m_status

Definition at line 110 of file ossimHlzTool.h.


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