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

#include <ossimImageHistogramSource.h>

Inheritance diagram for ossimImageHistogramSource:
ossimHistogramSource ossimConnectableObjectListener ossimProcessInterface ossimSource ossimListener ossimConnectableObject ossimErrorStatusInterface ossimObject ossimListenerManager ossimPropertyInterface ossimReferenced

Public Member Functions

 ossimImageHistogramSource (ossimObject *owner=0)
 
virtual ossimObjectgetObject ()
 
virtual const ossimObjectgetObject () const
 
void setAreaOfInterest (const ossimIrect &rect)
 
ossimIrect getAreaOfInterest () const
 
void getAreaOfInterest (ossimIrect &rect) const
 
virtual ossim_uint32 getMaxNumberOfRLevels () const
 
virtual void setMaxNumberOfRLevels (ossim_uint32 number)
 
virtual ossimRefPtr< ossimMultiResLevelHistogramgetHistogram (const ossimIrect &rect)
 
virtual ossimRefPtr< ossimMultiResLevelHistogramgetHistogram ()
 
virtual bool execute ()
 
virtual bool canConnectMyInputTo (ossim_int32 myInputIndex, const ossimConnectableObject *object) const
 required to be overriden by derived classes More...
 
void setNumberOfBinsOverride (ossim_int32 numberOfBinsOverride)
 
void setMinValueOverride (ossim_float32 minValueOverride)
 
void setMaxValueOverride (ossim_float32 maxValueOverride)
 
void setNumberOfTiles (ossim_uint32 numberOfTiles)
 
ossimHistogramMode getComputationMode () const
 
void setComputationMode (ossimHistogramMode mode)
 
virtual void propertyEvent (ossimPropertyEvent &event)
 
virtual void connectInputEvent (ossimConnectionEvent &event)
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
- Public Member Functions inherited from ossimHistogramSource
virtual ~ossimHistogramSource ()
 
- 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 void initialize ()
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 
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 disconnectInputEvent (ossimConnectionEvent &)
 
virtual void disconnectOutputEvent (ossimConnectionEvent &)
 
virtual void connectOutputEvent (ossimConnectionEvent &)
 
virtual void addObjectEvent (ossimContainerEvent &)
 
virtual void removeObjectEvent (ossimContainerEvent &)
 
virtual void containerEvent (ossimContainerEvent &)
 
virtual void refreshEvent (ossimRefreshEvent &)
 
- Public Member Functions inherited from ossimListener
 ossimListener ()
 
virtual ~ossimListener ()
 
void enableListener ()
 
void disableListener ()
 
void setListenerEnableFlag (bool flag)
 
bool isListenerEnabled () const
 
bool getListenerEnableFlag () const
 
- Public Member Functions inherited from ossimProcessInterface
 ossimProcessInterface ()
 
virtual ~ossimProcessInterface ()
 
virtual void abort ()
 
bool needsAborting () const
 
bool isAbortRequested () const
 
bool isAborted () const
 
bool isExecuting () const
 
ossimProcessStatus getProcessStatus () const
 
virtual void setProcessStatus (ossimProcessStatus processStatus)
 
virtual double getPercentComplete () const
 
virtual void setPercentComplete (double percentComplete)
 
virtual ossimListenerManagergetManager ()
 
void enableEvents ()
 
void disableEvents ()
 
void setCurrentMessage (const ossimString &message)
 
virtual std::ostream & print (std::ostream &out) const
 

Protected Member Functions

virtual ~ossimImageHistogramSource ()
 
void getBinInformation (ossim_uint32 &numberOfBins, ossim_float64 &minValue, ossim_float64 &maxValue, ossim_uint32 band) const
 
virtual void computeNormalModeHistogram ()
 
virtual void computeFastModeHistogram ()
 
- Protected Member Functions inherited from ossimHistogramSource
 ossimHistogramSource (ossimObject *owner=NULL, ossim_uint32 numberOfInputs=0, ossim_uint32 numberOfOutputs=0, bool inputListFixedFlag=true, bool outputListFixedFlag=true)
 
- 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

ossimIrect theAreaOfInterest
 
bool theHistogramRecomputeFlag
 
ossim_uint32 theMaxNumberOfResLevels
 
ossim_float64 theMinValueOverride
 
ossim_float64 theMaxValueOverride
 
ossim_int32 theNumberOfBinsOverride
 
ossimHistogramMode theComputationMode
 
- Protected Attributes inherited from ossimHistogramSource
ossimRefPtr< ossimMultiResLevelHistogramtheHistogram
 
ossimFilename theFilename
 
- 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
 
- Protected Attributes inherited from ossimProcessInterface
double thePercentComplete
 
ossimProcessStatus theProcessStatus
 
ossimString theMessage
 
bool theEventFlag
 

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
 
- Public Types inherited from ossimProcessInterface
enum  ossimProcessStatus {
  PROCESS_STATUS_UNKNOWN = 0, PROCESS_STATUS_EXECUTING = 1, PROCESS_STATUS_ABORTED = 2, PROCESS_STATUS_ABORT_REQUEST = 3,
  PROCESS_STATUS_NOT_EXECUTING = 4
}
 

Detailed Description

This source expects as input an ossimImageSource. it will slice up the requested region into tiles and compute the histogram of the passed in rectangle.

Definition at line 23 of file ossimImageHistogramSource.h.

Constructor & Destructor Documentation

◆ ossimImageHistogramSource()

ossimImageHistogramSource::ossimImageHistogramSource ( ossimObject owner = 0)

Definition at line 22 of file ossimImageHistogramSource.cpp.

References ossimListenerManager::addListener(), ossimIrect::makeNan(), ossim::nan(), theAreaOfInterest, theMaxValueOverride, theMinValueOverride, and theNumberOfBinsOverride.

23  :ossimHistogramSource(owner,
24  1, // one input
25  0, // no outputs
26  true, // input list is fixed
27  false),// output can still grow though
31  // theNumberOfTilesToUseInFastMode(100)
32 {
35 
39 }
virtual bool addListener(ossimListener *listener)
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
ossimHistogramSource(ossimObject *owner=NULL, ossim_uint32 numberOfInputs=0, ossim_uint32 numberOfOutputs=0, bool inputListFixedFlag=true, bool outputListFixedFlag=true)
void makeNan()
Definition: ossimIrect.h:329

◆ ~ossimImageHistogramSource()

ossimImageHistogramSource::~ossimImageHistogramSource ( )
protectedvirtual

Member Function Documentation

◆ canConnectMyInputTo()

bool ossimImageHistogramSource::canConnectMyInputTo ( ossim_int32  myInputIndex,
const ossimConnectableObject object 
) const
virtual

required to be overriden by derived classes

Implements ossimConnectableObject.

Definition at line 149 of file ossimImageHistogramSource.cpp.

References PTR_CAST.

151 {
152  return ((myInputIndex==0)&&PTR_CAST(ossimImageSource,
153  object));
154 }
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321

◆ computeFastModeHistogram()

void ossimImageHistogramSource::computeFastModeHistogram ( )
protectedvirtual

Definition at line 434 of file ossimImageHistogramSource.cpp.

References ossimMultiBandHistogram::create(), ossimMultiResLevelHistogram::create(), getBinInformation(), ossimImageData::getBuf(), ossimDataObject::getDataObjectStatus(), ossimConnectableObject::getInput(), ossimMultiResLevelHistogram::getMultiBandHistogram(), ossimImageSource::getNumberOfOutputBands(), ossimImageSource::getTile(), ossimImageSource::getTileHeight(), ossimImageSource::getTileWidth(), ossimIrect::height(), ossim::max(), ossim::min(), ossimProcessInterface::needsAborting(), OSSIM_EMPTY, ossimImageData::populateHistogram(), PTR_CAST, ossimProcessInterface::setPercentComplete(), ossimIrect::stretchToTileBoundary(), theAreaOfInterest, ossimHistogramSource::theHistogram, ossimIrect::ul(), ossimRefPtr< T >::valid(), ossimIrect::width(), ossimIpt::x, x, ossimIpt::y, and y.

Referenced by execute().

435 {
436  // Compute at most 9 x 9 tiles of 16 x 16 tile size.
437 
438  ossim_uint32 resLevelsToCompute = 1;
439 
440  // ref ptr, not a leak.
442  theHistogram->create(resLevelsToCompute);
444  if(!input)
445  {
446  setPercentComplete(100.0);
447  return;
448  }
449  // sum up all tiles needing processing. We will use the sequencer.
450  // ossim_uint32 numberOfResLevels = input->getNumberOfDecimationLevels();
451  double tileCount = 0.0;
452  double totalTiles = 0.0;
453  ossim_uint32 numberOfBands = input->getNumberOfOutputBands();
454  ossim_uint32 numberOfBins = 0;
455  ossim_float64 minValue = 0;
456  ossim_float64 maxValue = 0;
457  getBinInformation(numberOfBins, minValue, maxValue, 0);
458 
459  // Fixed 16 x 16 tile size:
460  ossimIpt tileSize( 16, 16 );
461 
462  ossimIrect tileBoundary = theAreaOfInterest;
463  tileBoundary.stretchToTileBoundary(tileSize);
464 
465  // Max of 9 x 9 tiles accross the image.
466  const ossim_uint32 MAX_TILES_WIDE = 9;
467 
468  ossim_uint32 tilesWide = ossim::min( (ossim_uint32)(tileBoundary.width()/tileSize.x),
469  MAX_TILES_WIDE);
470  ossim_uint32 tilesHigh = ossim::min( (ossim_uint32)(tileBoundary.height()/tileSize.y),
471  MAX_TILES_WIDE);
472 
473  totalTiles = tilesWide*tilesHigh;
474 
475  if(numberOfBins > 0)
476  {
477  ossimIpt origin = theAreaOfInterest.ul();
478 
479  ossim_uint32 xTileOffset = tileBoundary.width() / tilesWide;
480  ossim_uint32 yTileOffset = tileBoundary.height() / tilesHigh;
481 
482  theHistogram->getMultiBandHistogram(0)->create(numberOfBands,
483  numberOfBins,
484  minValue,
485  maxValue);
486  ossim_uint32 x = 0;
487  ossim_uint32 y = 0;
488  tileCount = 0;
489  totalTiles = tilesWide*tilesHigh;
490 
491  for(y = 0; y < tilesHigh; ++y)
492  {
493  for(x = 0; x < tilesWide; ++x)
494  {
495  ossimIpt ul( origin.x + (x*xTileOffset), origin.y + (y*yTileOffset) );
496  ossimIrect tileRect(ul.x, ul.y, ul.x + tileSize.x-1, ul.y + tileSize.y-1);
497 
498  ossimRefPtr<ossimImageData> data = input->getTile(tileRect);
499 
500  if(data.valid()&&data->getBuf()&&(data->getDataObjectStatus() != OSSIM_EMPTY))
501  {
503  }
504 
505  // Check for abort request.
506  if (needsAborting())
507  {
508  break;
509  }
510 
511  ++tileCount;
512  }
513 
514  // Check for abort request.
515  if (needsAborting())
516  {
517  setPercentComplete(100);
518  break;
519  }
520 
521  setPercentComplete((100.0*(tileCount/totalTiles)));
522  }
523  }
524 
525 #if 0 /* drb - old code was not working... */
526 
527  // We will only compute a full res histogram in fast mode. and will only do a MAX of 100 tiles.
528  //
529  ossim_uint32 resLevelsToCompute = 1;
530 
531  // ref ptr, not a leak.
533  theHistogram->create(resLevelsToCompute);
535  if(!input)
536  {
537  setPercentComplete(100.0);
538  return;
539  }
540  // sum up all tiles needing processing. We will use the sequencer.
541  // ossim_uint32 numberOfResLevels = input->getNumberOfDecimationLevels();
542  double tileCount = 0.0;
543  double totalTiles = 0.0;
544  ossim_uint32 numberOfBands = input->getNumberOfOutputBands();
545  ossim_uint32 numberOfBins = 0;
546  ossim_float64 minValue = 0;
547  ossim_float64 maxValue = 0;
548  getBinInformation(numberOfBins, minValue, maxValue, 0);
549 
550  ossimIrect tileBoundary = theAreaOfInterest;
551  // ossimIpt tileSize(ossim::max((ossim_uint32)input->getTileWidth(), (ossim_uint32)64),
552  // ossim::max((ossim_uint32)input->getTileHeight(), (ossim_uint32)64));
553 
554  ossimIpt tileSize(ossim::max<ossim_uint32>(input->getTileWidth(), (ossim_uint32)64),
556 
557  tileBoundary.stretchToTileBoundary(tileSize);
558  ossim_uint32 tilesWide = (tileBoundary.width()/tileSize.x);
559  ossim_uint32 tilesHigh = (tileBoundary.height()/tileSize.y);
560  totalTiles = tilesWide*tilesHigh;
561 
562  if(totalTiles > theNumberOfTilesToUseInFastMode)
563  {
564  ossim_uint32 testTiles = (ossim_uint32) (std::sqrt((double)theNumberOfTilesToUseInFastMode)+.5);
565  tilesWide = testTiles>tilesWide?tilesWide:testTiles;
566  tilesHigh = testTiles>tilesHigh?tilesHigh:testTiles;
567  }
568  if(numberOfBins > 0)
569  {
570  ossimIpt origin = theAreaOfInterest.ul();
571 
572  ossim_uint32 widthWithExcess = (ossim_uint32)(((ossim_float64)tileBoundary.width()/(tilesWide*tileSize.x))*tileSize.x);
573  ossim_uint32 heightWithExcess = ((ossim_uint32)((ossim_float64)tileBoundary.height()/(tilesHigh*tileSize.y))*tileSize.y);
574  theHistogram->getMultiBandHistogram(0)->create(numberOfBands,
575  numberOfBins,
576  minValue,
577  maxValue);
578 
579  ossim_uint32 x = 0;
580  ossim_uint32 y = 0;
581  tileCount = 0;
582  totalTiles = tilesWide*tilesHigh;
583  for(y = 0; y < tilesHigh; ++y)
584  {
585  for(x = 0; x < tilesWide; ++x)
586  {
587  ossimIpt ul(origin.x + (x*widthWithExcess),
588  origin.y + (y*heightWithExcess));
589  ossimIrect tileRect(ul.x, ul.y, ul.x + tileSize.x-1, ul.y + tileSize.y-1);
590  ossimRefPtr<ossimImageData> data = input->getTile(tileRect);
591 
592  if(data.valid()&&data->getBuf()&&(data->getDataObjectStatus() != OSSIM_EMPTY))
593  {
595  }
596  ++tileCount;
597  setPercentComplete((100.0*(tileCount/totalTiles)));
598  }
599  }
600  }
601 
602 #endif
603 }
ossim_uint32 x
T max(T a, T b)
Definition: ossimCommon.h:236
virtual void populateHistogram(ossimRefPtr< ossimMultiBandHistogram > histo)
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
ossim_uint32 y
bool valid() const
Definition: ossimRefPtr.h:75
ossim_uint32 height() const
Definition: ossimIrect.h:487
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.
virtual void setPercentComplete(double percentComplete)
const ossimIpt & ul() const
Definition: ossimIrect.h:274
virtual ossimDataObjectStatus getDataObjectStatus() const
void create(ossim_uint32 numberOfResLevels)
virtual ossim_uint32 getTileWidth() const
Returns the default processing tile width.
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
void getBinInformation(ossim_uint32 &numberOfBins, ossim_float64 &minValue, ossim_float64 &maxValue, ossim_uint32 band) const
double ossim_float64
ossimRefPtr< ossimMultiResLevelHistogram > theHistogram
unsigned int ossim_uint32
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
T min(T a, T b)
Definition: ossimCommon.h:203
ossim_uint32 width() const
Definition: ossimIrect.h:500
ossim_int32 y
Definition: ossimIpt.h:142
virtual const void * getBuf() const
void stretchToTileBoundary(const ossimIpt &tileWidthHeight)
Definition: ossimIrect.cpp:212
ossim_int32 x
Definition: ossimIpt.h:141
ossimRefPtr< ossimMultiBandHistogram > getMultiBandHistogram(ossim_uint32 resLevel) const
void create(const ossimImageSource *input)
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)

◆ computeNormalModeHistogram()

void ossimImageHistogramSource::computeNormalModeHistogram ( )
protectedvirtual

Definition at line 321 of file ossimImageHistogramSource.cpp.

References ossimConnectableObject::connectMyInputTo(), ossimMultiBandHistogram::create(), ossimMultiResLevelHistogram::create(), ossimConnectableObject::disconnect(), getBinInformation(), ossimImageData::getBuf(), ossimDataObject::getDataObjectStatus(), ossimImageSource::getDecimationFactors(), ossimConnectableObject::getInput(), ossimMultiResLevelHistogram::getMultiBandHistogram(), ossimImageSourceSequencer::getNextTile(), ossimImageSource::getNumberOfOutputBands(), ossimImageSourceSequencer::getNumberOfTiles(), ossimImageSourceSequencer::initialize(), ossim::min(), ossimProcessInterface::needsAborting(), OSSIM_EMPTY, ossimNotify(), ossimNotifyLevel_WARN, ossimImageData::populateHistogram(), PTR_CAST, ossimImageSourceSequencer::setAreaOfInterest(), ossimProcessInterface::setPercentComplete(), ossimImageSourceSequencer::setToStartOfSequence(), theAreaOfInterest, ossimHistogramSource::theHistogram, theMaxNumberOfResLevels, and ossimRefPtr< T >::valid().

Referenced by execute().

322 {
323  // ref ptr, not a leak.
325 
327  if(!input)
328  {
329  setPercentComplete(100.0);
330  return;
331  }
332 
333  if(getInput(0))
334  {
335  // sum up all tiles needing processing. We will use the sequencer.
336  // ossim_uint32 numberOfResLevels = input->getNumberOfDecimationLevels();
337  ossim_uint32 index = 0;
338  double tileCount = 0.0;
339  double totalTiles = 0.0;
340  ossim_uint32 numberOfBands = input->getNumberOfOutputBands();
341  ossim_uint32 numberOfBins = 0;
342  ossim_float64 minValue = 0;
343  ossim_float64 maxValue = 0;
344  getBinInformation(numberOfBins, minValue, maxValue, 0);
345 
347  sequencer->connectMyInputTo(0, getInput(0));
348  sequencer->initialize();
349 
350  vector<ossimDpt> decimationFactors;
351  input->getDecimationFactors(decimationFactors);
352  if ( !decimationFactors.size() )
353  {
355  << "ossimImageHistogramSource::computeNormalModeHistogram WARNING:"
356  << "\nNo decimation factors from input. returning..." << std::endl;
357  return;
358  }
359 
361  (ossim_uint32)decimationFactors.size());
362 
363  if( decimationFactors.size() < theMaxNumberOfResLevels)
364  {
365  ossimNotify(ossimNotifyLevel_WARN) << "Number Decimations is smaller than the request number of r-levels defaulting to the smallest of the 2 numbers" << endl;
366  }
367 
368  theHistogram->create(resLevelsToCompute);
369  for(index = 0; index < resLevelsToCompute; ++index)
370  {
371  sequencer->setAreaOfInterest(theAreaOfInterest*decimationFactors[index]);
372 
373  totalTiles += sequencer->getNumberOfTiles();
374  }
375 
376 
377  if(numberOfBins > 0)
378  {
379  setPercentComplete(0.0);
380  for(index = 0;
381  (index < resLevelsToCompute);
382  ++index)
383  {
384  // Check for abort request.
385  if (needsAborting())
386  {
387  setPercentComplete(100);
388  break;
389  }
390 
391  //sequencer->setAreaOfInterest(input->getBoundingRect(index));
392  sequencer->setAreaOfInterest(theAreaOfInterest*decimationFactors[index]);
393 
394  sequencer->setToStartOfSequence();
395 
396  theHistogram->getMultiBandHistogram(index)->create(numberOfBands,
397  numberOfBins,
398  minValue,
399  maxValue);
400 
401  ossimRefPtr<ossimImageData> data = sequencer->getNextTile(index);
402  ++tileCount;
403  setPercentComplete((100.0*(tileCount/totalTiles)));
404 
405  ossim_uint32 resLevelTotalTiles = sequencer->getNumberOfTiles();
406  for (ossim_uint32 resLevelTileCount = 0;
407  resLevelTileCount < resLevelTotalTiles;
408  ++resLevelTileCount)
409  {
410  if(data.valid()&&data->getBuf()&&(data->getDataObjectStatus() != OSSIM_EMPTY))
411  {
413  }
414 
415  // Check for abort request.
416  if (needsAborting())
417  {
418  setPercentComplete(100);
419  break;
420  }
421 
422 
423  data = sequencer->getNextTile(index);
424  ++tileCount;
425  setPercentComplete((100.0*(tileCount/totalTiles)));
426  }
427  }
428  }
429  sequencer->disconnect();
430  sequencer = 0;
431  }
432 }
virtual void disconnect(ossimConnectableObject *object=0)
Will disconnect the object passed in.
virtual void populateHistogram(ossimRefPtr< ossimMultiBandHistogram > histo)
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimRefPtr< ossimImageData > getNextTile(ossim_uint32 resLevel=0)
virtual void setPercentComplete(double percentComplete)
virtual ossimDataObjectStatus getDataObjectStatus() const
void create(ossim_uint32 numberOfResLevels)
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
void getBinInformation(ossim_uint32 &numberOfBins, ossim_float64 &minValue, ossim_float64 &maxValue, ossim_uint32 band) const
double ossim_float64
ossimRefPtr< ossimMultiResLevelHistogram > theHistogram
virtual void setAreaOfInterest(const ossimIrect &areaOfInterest)
unsigned int ossim_uint32
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
virtual ossim_int32 connectMyInputTo(ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
Will try to connect this objects input to the passed in object.
T min(T a, T b)
Definition: ossimCommon.h:203
virtual const void * getBuf() const
ossimRefPtr< ossimMultiBandHistogram > getMultiBandHistogram(ossim_uint32 resLevel) const
void create(const ossimImageSource *input)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
virtual void getDecimationFactors(std::vector< ossimDpt > &decimations) const
Will return an array of all decimations for each resolution level.

◆ connectInputEvent()

void ossimImageHistogramSource::connectInputEvent ( ossimConnectionEvent event)
virtual

Reimplemented from ossimConnectableObjectListener.

Definition at line 185 of file ossimImageHistogramSource.cpp.

References theHistogramRecomputeFlag.

186 {
188 }

◆ execute()

bool ossimImageHistogramSource::execute ( )
virtual

Implements ossimProcessInterface.

Definition at line 101 of file ossimImageHistogramSource.cpp.

References computeFastModeHistogram(), computeNormalModeHistogram(), ossimConnectableObject::getInput(), ossimIrect::hasNans(), ossimSource::isSourceEnabled(), ossimProcessInterface::needsAborting(), OSSIM_HISTO_MODE_FAST, OSSIM_HISTO_MODE_NORMAL, ossimProcessInterface::PROCESS_STATUS_ABORTED, ossimProcessInterface::PROCESS_STATUS_EXECUTING, ossimProcessInterface::PROCESS_STATUS_NOT_EXECUTING, PTR_CAST, ossimProcessInterface::setProcessStatus(), theAreaOfInterest, theComputationMode, ossimHistogramSource::theHistogram, theHistogramRecomputeFlag, and ossimRefPtr< T >::valid().

Referenced by getHistogram(), and ossimKMeansFilter::initialize().

102 {
103  if(!isSourceEnabled())
104  {
105  return theHistogram.valid();
106  }
107 
110  {
112  {
114  if(interface)
115  {
116  theAreaOfInterest = interface->getBoundingRect();
117  }
118  }
119 
120  switch(theComputationMode)
121  {
123  {
125  break;
126  }
128  default:
129  {
131  break;
132  }
133  }
134  }
135 
136  if (needsAborting())
137  {
140  }
141  else
142  {
144  }
145 
146  return true;
147 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
bool valid() const
Definition: ossimRefPtr.h:75
virtual void setProcessStatus(ossimProcessStatus processStatus)
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
ossimRefPtr< ossimMultiResLevelHistogram > theHistogram
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
bool hasNans() const
Definition: ossimIrect.h:337

◆ getAreaOfInterest() [1/2]

ossimIrect ossimImageHistogramSource::getAreaOfInterest ( ) const

Definition at line 65 of file ossimImageHistogramSource.cpp.

References theAreaOfInterest.

66 {
67  return theAreaOfInterest;
68 }

◆ getAreaOfInterest() [2/2]

void ossimImageHistogramSource::getAreaOfInterest ( ossimIrect rect) const

Definition at line 70 of file ossimImageHistogramSource.cpp.

References theAreaOfInterest.

71 {
72  rect = theAreaOfInterest;
73 }

◆ getBinInformation()

void ossimImageHistogramSource::getBinInformation ( ossim_uint32 numberOfBins,
ossim_float64 minValue,
ossim_float64 maxValue,
ossim_uint32  band 
) const
protected

Definition at line 196 of file ossimImageHistogramSource.cpp.

References ossimConnectableObject::getInput(), ossimImageSource::getMaxPixelValue(), ossimImageSource::getMinPixelValue(), ossimImageSource::getOutputScalarType(), OSSIM_DEFAULT_MAX_PIX_SINT16, OSSIM_DEFAULT_MAX_PIX_UCHAR, OSSIM_DEFAULT_MAX_PIX_UINT11, OSSIM_DEFAULT_MAX_PIX_UINT12, OSSIM_DEFAULT_MAX_PIX_UINT13, OSSIM_DEFAULT_MAX_PIX_UINT14, OSSIM_DEFAULT_MAX_PIX_UINT15, OSSIM_DEFAULT_MAX_PIX_UINT16, OSSIM_DEFAULT_MIN_PIX_SINT16, OSSIM_FLOAT32, OSSIM_FLOAT64, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SINT16, OSSIM_SINT32, OSSIM_UINT16, OSSIM_UINT32, OSSIM_UINT8, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, OSSIM_USHORT15, and PTR_CAST.

Referenced by computeFastModeHistogram(), and computeNormalModeHistogram().

200 {
201  numberOfBins = 0;
202  minValue = 0;
203  maxValue = 0;
204 
206  if(input)
207  {
208  minValue = input->getMinPixelValue(band);
209  maxValue = input->getMaxPixelValue(band);
210  switch(input->getOutputScalarType())
211  {
212  case OSSIM_UINT8:
213  {
214  minValue = 0;
215  maxValue = OSSIM_DEFAULT_MAX_PIX_UCHAR;
216  numberOfBins = 256;
217 
218  break;
219  }
220  case OSSIM_USHORT11:
221  {
222  minValue = 0;
223  maxValue = OSSIM_DEFAULT_MAX_PIX_UINT11;
224  numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT11 + 1;
225 
226  break;
227  }
228  case OSSIM_USHORT12:
229  {
230  minValue = 0;
231  maxValue = OSSIM_DEFAULT_MAX_PIX_UINT12;
232  numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT12 + 1;
233 
234  break;
235  }
236  case OSSIM_USHORT13:
237  {
238  minValue = 0;
239  maxValue = OSSIM_DEFAULT_MAX_PIX_UINT13;
240  numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT13 + 1;
241 
242  break;
243  }
244  case OSSIM_USHORT14:
245  {
246  minValue = 0;
247  maxValue = OSSIM_DEFAULT_MAX_PIX_UINT14;
248  numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT14 + 1;
249 
250  break;
251  }
252  case OSSIM_USHORT15:
253  {
254  minValue = 0;
255  maxValue = OSSIM_DEFAULT_MAX_PIX_UINT15;
256  numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT15 + 1;
257 
258  break;
259  }
260  case OSSIM_UINT16:
261  {
262  minValue = 0;
263  maxValue = OSSIM_DEFAULT_MAX_PIX_UINT16;
264  numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT16 + 1;
265 
266  break;
267  }
268  case OSSIM_SINT16:
269  {
270  minValue = OSSIM_DEFAULT_MIN_PIX_SINT16;
271  maxValue = OSSIM_DEFAULT_MAX_PIX_SINT16;
273  break;
274  }
275  case OSSIM_SINT32:
276  case OSSIM_UINT32:
277  {
278  numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT16+1;
279  break;
280  }
281  case OSSIM_FLOAT32:
282  case OSSIM_FLOAT64:
283  {
284  numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT16+1;
285  break;
286  }
289  {
290  minValue = 0;
291  maxValue = 1.0;
292  numberOfBins = OSSIM_DEFAULT_MAX_PIX_UINT16+1;
293  break;
294  }
295  default:
296  {
297  if(traceDebug())
298  {
300  << "Unsupported scalar type in ossimImageHistogramSource::computeHistogram()" << endl;
301  }
302  return;
303  }
304  }
305  }
306 
307  if(ossim::isnan(theMinValueOverride) == false)
308  {
309  minValue = (float)theMinValueOverride;
310  }
311  if(ossim::isnan(theMaxValueOverride) == false)
312  {
313  maxValue = (float)theMaxValueOverride;
314  }
316  {
317  numberOfBins = theNumberOfBinsOverride;
318  }
319 }
16 bit unsigned integer (15 bits used)
#define OSSIM_DEFAULT_MAX_PIX_UINT16
64 bit floating point
16 bit unsigned integer
#define OSSIM_DEFAULT_MAX_PIX_UCHAR
16 bit signed integer
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
32 bit floating point
32 bit unsigned integer
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
virtual double getMinPixelValue(ossim_uint32 band=0) const
Returns the min pixel of the band.
#define OSSIM_DEFAULT_MAX_PIX_UINT12
#define OSSIM_DEFAULT_MIN_PIX_SINT16
32 bit signed integer
#define OSSIM_DEFAULT_MAX_PIX_UINT15
32 bit normalized floating point
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
#define OSSIM_DEFAULT_MAX_PIX_UINT13
#define OSSIM_DEFAULT_MAX_PIX_SINT16
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
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.
#define OSSIM_DEFAULT_MAX_PIX_UINT14
#define OSSIM_DEFAULT_MAX_PIX_UINT11
8 bit unsigned integer
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
16 bit unsigned integer (12 bits used)
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ getComputationMode()

ossimHistogramMode ossimImageHistogramSource::getComputationMode ( ) const

Definition at line 170 of file ossimImageHistogramSource.cpp.

References theComputationMode.

171 {
172  return theComputationMode;
173 }

◆ getHistogram() [1/2]

ossimRefPtr< ossimMultiResLevelHistogram > ossimImageHistogramSource::getHistogram ( const ossimIrect rect)
virtual

The first argument is the region of interest that you wish to use for the histogram. If the region is different than what it has already computed before then the histogram is considered dirty and will be re-computed. The returned object is a multi-reslevel histogram

Definition at line 89 of file ossimImageHistogramSource.cpp.

References getHistogram(), ossimIrect::hasNans(), theAreaOfInterest, and theHistogramRecomputeFlag.

Referenced by ossimKMeansFilter::initialize().

90 {
91  if((theAreaOfInterest != rect)||
93  {
94  theAreaOfInterest = rect;
96  }
97 
98  return getHistogram();
99 }
virtual ossimRefPtr< ossimMultiResLevelHistogram > getHistogram()
bool hasNans() const
Definition: ossimIrect.h:337

◆ getHistogram() [2/2]

ossimRefPtr< ossimMultiResLevelHistogram > ossimImageHistogramSource::getHistogram ( )
virtual

Reimplemented from ossimHistogramSource.

Definition at line 190 of file ossimImageHistogramSource.cpp.

References execute(), and ossimHistogramSource::theHistogram.

Referenced by getHistogram().

191 {
192  execute();
193  return theHistogram;
194 }
ossimRefPtr< ossimMultiResLevelHistogram > theHistogram

◆ getMaxNumberOfRLevels()

ossim_uint32 ossimImageHistogramSource::getMaxNumberOfRLevels ( ) const
virtual

Definition at line 75 of file ossimImageHistogramSource.cpp.

References theMaxNumberOfResLevels.

76 {
78 }

◆ getObject() [1/2]

ossimObject * ossimImageHistogramSource::getObject ( )
virtual

Implements ossimProcessInterface.

Definition at line 46 of file ossimImageHistogramSource.cpp.

47 {
48  return this;
49 }

◆ getObject() [2/2]

const ossimObject * ossimImageHistogramSource::getObject ( ) const
virtual

Implements ossimProcessInterface.

Definition at line 51 of file ossimImageHistogramSource.cpp.

52 {
53  return this;
54 }

◆ loadState()

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

Method to the load (recreate) the state of the object from a keyword list. Return true if ok or false on error.

Reimplemented from ossimHistogramSource.

Definition at line 605 of file ossimImageHistogramSource.cpp.

References ossimString::downcase(), ossimString::empty(), ossimKeywordlist::find(), ossimConnectableObject::getNumberOfInputs(), ossimHistogramSource::loadState(), ossimIrect::loadState(), OSSIM_HISTO_MODE_FAST, OSSIM_HISTO_MODE_NORMAL, ossimConnectableObject::setNumberOfInputs(), theAreaOfInterest, theComputationMode, ossimConnectableObject::theInputListIsFixedFlag, and ossimConnectableObject::theOutputListIsFixedFlag.

607 {
608  ossimHistogramSource::loadState(kwl, prefix);
610  ossimString rect = kwl.find(prefix, "rect");
611 
612  if(!rect.empty())
613  {
614  loadState(kwl, prefix);
615  }
616  else
617  {
618  ossimString newPrefix = ossimString(prefix) + "area_of_interest.";
619  theAreaOfInterest.loadState(kwl, newPrefix);
620  }
621 
622  ossimString mode = kwl.find(prefix, "mode");
623  mode = mode.downcase();
624  if(mode == "normal")
625  {
627  }
628  else if(mode == "fast")
629  {
631  }
632  if(getNumberOfInputs()!=1)
633  {
635  }
636 
637  // ossimString numberOfTiles = kwl.find(prefix, "number_of_tiles");
638  // if(!numberOfTiles.empty())
639  // {
640  // theNumberOfTilesToUseInFastMode = numberOfTiles.toUInt32();
641  // }
642 
644  theOutputListIsFixedFlag = false;
645 
646  return true;
647 }
virtual void setNumberOfInputs(ossim_int32 numberOfInputs)
Will set the number of inputs.
const char * find(const char *key) const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Definition: ossimIrect.cpp:641
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
virtual ossim_uint32 getNumberOfInputs() const
Returns the number of input objects.
bool theInputListIsFixedFlag
Indicates whether the theInputObjectList is fixed.
bool empty() const
Definition: ossimString.h:411
bool theOutputListIsFixedFlag
Indicates whether the theOutputObjectList is fixed.

◆ propertyEvent()

void ossimImageHistogramSource::propertyEvent ( ossimPropertyEvent event)
virtual

Reimplemented from ossimConnectableObjectListener.

Definition at line 180 of file ossimImageHistogramSource.cpp.

References theHistogramRecomputeFlag.

181 {
183 }

◆ saveState()

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

Method to save the state of the object to a keyword list. Return true if ok or false on error.

Reimplemented from ossimHistogramSource.

Definition at line 649 of file ossimImageHistogramSource.cpp.

References ossimHistogramSource::saveState(), ossimIrect::saveState(), and theAreaOfInterest.

651 {
652  bool result = ossimHistogramSource::saveState(kwl, prefix);
653  if(result)
654  {
655  ossimString newPrefix = ossimString(prefix) + "area_of_interest.";
656  theAreaOfInterest.saveState(kwl, newPrefix);
657  }
658  return result;
659 }
bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Definition: ossimIrect.cpp:589
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const

◆ setAreaOfInterest()

void ossimImageHistogramSource::setAreaOfInterest ( const ossimIrect rect)

Definition at line 56 of file ossimImageHistogramSource.cpp.

References theAreaOfInterest, and theHistogramRecomputeFlag.

57 {
58  if(rect != theAreaOfInterest)
59  {
61  }
62  theAreaOfInterest = rect;
63 }

◆ setComputationMode()

void ossimImageHistogramSource::setComputationMode ( ossimHistogramMode  mode)

Definition at line 175 of file ossimImageHistogramSource.cpp.

References theComputationMode.

Referenced by ossimImageHandler::buildHistogram(), and ossimKMeansFilter::initialize().

176 {
177  theComputationMode = mode;
178 }

◆ setMaxNumberOfRLevels()

void ossimImageHistogramSource::setMaxNumberOfRLevels ( ossim_uint32  number)
virtual

◆ setMaxValueOverride()

void ossimImageHistogramSource::setMaxValueOverride ( ossim_float32  maxValueOverride)

Definition at line 165 of file ossimImageHistogramSource.cpp.

References theMaxValueOverride.

166 {
167  theMaxValueOverride = maxValueOverride;
168 }

◆ setMinValueOverride()

void ossimImageHistogramSource::setMinValueOverride ( ossim_float32  minValueOverride)

Definition at line 161 of file ossimImageHistogramSource.cpp.

References theMinValueOverride.

162 {
163  theMinValueOverride = minValueOverride;
164 }

◆ setNumberOfBinsOverride()

void ossimImageHistogramSource::setNumberOfBinsOverride ( ossim_int32  numberOfBinsOverride)

Definition at line 156 of file ossimImageHistogramSource.cpp.

References theNumberOfBinsOverride.

157 {
158  theNumberOfBinsOverride = numberOfBinsOverride;
159 }

◆ setNumberOfTiles()

void ossimImageHistogramSource::setNumberOfTiles ( ossim_uint32  numberOfTiles)

Member Data Documentation

◆ theAreaOfInterest

ossimIrect ossimImageHistogramSource::theAreaOfInterest
protected

◆ theComputationMode

ossimHistogramMode ossimImageHistogramSource::theComputationMode
protected

◆ theHistogramRecomputeFlag

bool ossimImageHistogramSource::theHistogramRecomputeFlag
protected

◆ theMaxNumberOfResLevels

ossim_uint32 ossimImageHistogramSource::theMaxNumberOfResLevels
protected

Will default to 1. This means it will use up to max number of res levels for the histogram.

Definition at line 98 of file ossimImageHistogramSource.h.

Referenced by computeNormalModeHistogram(), getMaxNumberOfRLevels(), and setMaxNumberOfRLevels().

◆ theMaxValueOverride

ossim_float64 ossimImageHistogramSource::theMaxValueOverride
protected

Definition at line 100 of file ossimImageHistogramSource.h.

Referenced by ossimImageHistogramSource(), and setMaxValueOverride().

◆ theMinValueOverride

ossim_float64 ossimImageHistogramSource::theMinValueOverride
protected

Definition at line 99 of file ossimImageHistogramSource.h.

Referenced by ossimImageHistogramSource(), and setMinValueOverride().

◆ theNumberOfBinsOverride

ossim_int32 ossimImageHistogramSource::theNumberOfBinsOverride
protected

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