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

#include <ossimBandSelector.h>

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

Public Types

enum  ossimBandSelectorWithinRangeFlagState { ossimBandSelectorWithinRangeFlagState_NOT_SET = 0, ossimBandSelectorWithinRangeFlagState_IN_RANGE = 1, ossimBandSelectorWithinRangeFlagState_OUT_OF_RANGE = 2 }
 
- 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 Member Functions

 ossimBandSelector ()
 
virtual ~ossimBandSelector ()
 
virtual ossimString getLongName () const
 
virtual ossimString getShortName () const
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIrect &tileRect, ossim_uint32 resLevel=0)
 
virtual void getOutputBandList (std::vector< ossim_uint32 > &bandList) const
 Initializes bandList to the zero based order of output bands. More...
 
virtual void setThreeBandRgb ()
 Will set to three bands (rgb) out. More...
 
virtual void setOutputBandList (const vector< ossim_uint32 > &outputBandList, bool disablePassThru=false)
 Sets the output band list. More...
 
virtual ossim_uint32 getNumberOfOutputBands () const
 Returns the number of bands in a tile returned from this TileSource. More...
 
virtual ossim_uint32 getNumberOfInputBands () const
 Returns the number of input bands. More...
 
virtual void initialize ()
 
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 double getNullPixelValue (ossim_uint32 band=0) const
 Each band has a null pixel associated with it. More...
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=NULL) const
 Method to save the state of an object to a keyword list. More...
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=NULL)
 Method to the load (recreate) the state of an object from a keyword list. More...
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 Override base class so that a disableSource event does not reinitialize the object and enable itself. More...
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 
virtual bool isSourceEnabled () const
 
- Public Member Functions inherited from ossimImageSourceFilter
 ossimImageSourceFilter (ossimObject *owner=NULL)
 
 ossimImageSourceFilter (ossimImageSource *inputSource)
 
 ossimImageSourceFilter (ossimObject *owner, ossimImageSource *inputSource)
 
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 ossimScalarType getOutputScalarType () const
 This will be used to query the output pixel type of the tile source. More...
 
virtual ossim_uint32 getTileWidth () const
 Returns the default processing tile width. More...
 
virtual ossim_uint32 getTileHeight () const
 Returns the default processing tile height. More...
 
virtual ossimIrect getBoundingRect (ossim_uint32 resLevel=0) const
 This will return the bounding rect of the source. More...
 
virtual void getBoundingRect (ossimIrect &rect, ossim_uint32 resLevel=0) const
 Gets the bounding rectangle of the source. More...
 
virtual void getValidImageVertices (std::vector< ossimIpt > &validVertices, ossimVertexOrdering ordering=OSSIM_CLOCKWISE_ORDER, ossim_uint32 resLevel=0) const
 ordering specifies how the vertices should be arranged. More...
 
virtual ossimRefPtr< ossimImageGeometrygetImageGeometry ()
 Returns the image geometry object associated with this tile source or NULL if not defined. More...
 
virtual void setImageGeometry (const ossimImageGeometry *geom)
 Default implementation sets geometry of the first input to the geometry specified. More...
 
virtual void saveImageGeometry () const
 Default method to call input's saveImageGeometry. More...
 
virtual void saveImageGeometry (const ossimFilename &geometry_file) const
 Default method to call input's saveImageGeometry. More...
 
virtual bool isIndexedData () const
 
- Public Member Functions inherited from ossimSource
 ossimSource (ossimObject *owner=0)
 
 ossimSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimSource ()
 
virtual void enableSource ()
 
virtual void disableSource ()
 
virtual bool getEnableFlag () const
 
virtual void setEnableFlag (bool flag)
 
virtual bool isInitialized () const
 
virtual void setInitializedFlag (bool flag)
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
- Public Member Functions inherited from ossimConnectableObject
 ossimConnectableObject (ossimObject *owner=0)
 Base constructor of this object. More...
 
 ossimConnectableObject (ossimObject *owner, ossim_int32 inputListSize, ossim_int32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimConnectableObject ()
 
void setId (const ossimId &id)
 All connectable objects will have id's. More...
 
const ossimIdgetId () const
 Will allow us to get this object's id. More...
 
const ossimObjectgetOwner () const
 Fetches the current owner, most likely a container but not limited to one. More...
 
virtual void changeOwner (ossimObject *owner)
 Permits changing the object's owner. More...
 
virtual void setDescription (const ossimString &description)
 
virtual ossimString getDescription () const
 
virtual bool isConnected (ossimConnectableObjectDirectionType direction=CONNECTABLE_DIRECTION_INPUT) const
 will check the direction specified to see if all slots are full. More...
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findConnectableObject(const ossimId &id))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(RTTItypeid typeId, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(const ossimString &obj, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findInputObjectOfType(const ossimString &className))
 
virtual ossim_int32 findInputIndex (const ossimConnectableObject *object)
 Return a valid index of the input list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findInputIndex (const ossimId &id)
 Return a valid index of the input list if the passed id is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimConnectableObject *object)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimId &id)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 getMyInputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual ossim_int32 getMyOutputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual bool canConnectMyOutputTo (ossim_int32 myOutputIndex, const ossimConnectableObject *object) const
 default implementation is to allow anyone to connect to us. More...
 
virtual void disconnect (ossimConnectableObject *object=0)
 Will disconnect the object passed in. More...
 
virtual void disconnect (const ossimId &id)
 Will disconnect the object passed in. More...
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyInput (ossim_int32 inputIndex, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given input index and generate a connection event. More...
 
virtual void disconnectMyInput (ossimConnectableObject *input, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Finds the index of the passed in input and calls disconnectMyInput(inputIndex, disconnectOutputFlag, createEventFlag);. More...
 
virtual void disconnectMyInputs (ConnectableObjectList &inputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyOutput (ossim_int32 outputIndex, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given output index and generate a connection event. More...
 
virtual void disconnectMyOutput (ossimConnectableObject *output, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the output object. More...
 
virtual void disconnectMyOutputs (ConnectableObjectList &outputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual void disconnectAllInputs ()
 Will disconnect all of the input objects. More...
 
virtual void disconnectAllOutputs ()
 Will disconnect all of the output objects. More...
 
virtual ossim_int32 connectMyInputTo (ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will try to connect this objects input to the passed in object. More...
 
virtual ossim_int32 connectMyInputTo (ossim_int32 inputIndex, ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will connect the specified input to the passed in object. More...
 
virtual bool connectMyInputTo (ConnectableObjectList &inputList, bool makeOutputConnection=true, bool createEventFlag=true)
 
virtual ossim_int32 connectMyOutputTo (ossimConnectableObject *outputObject, bool makeInputConnection=true, bool createEventFlag=true)
 Will try to connect this objects output to the passed in object. More...
 
virtual bool connectMyOutputTo (ConnectableObjectList &outputList, bool makeInputConnection=true, bool createEventFlag=true)
 
virtual bool connectInputList (ConnectableObjectList &inputList)
 Will disconnect itself from all inputs and reset to the passed in input list. More...
 
virtual bool connectOutputList (ConnectableObjectList &outputList)
 Will disconnect itself from all outputs and reset to the passed in output list. More...
 
virtual ossim_uint32 getNumberOfInputs () const
 Returns the number of input objects. More...
 
virtual ossim_uint32 getNumberOfOutputs () const
 Return the number of output objects. More...
 
ossimConnectableObjectgetInput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetInput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
ossimConnectableObjectgetOutput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetOutput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
virtual void setNumberOfInputs (ossim_int32 numberOfInputs)
 Will set the number of inputs. More...
 
virtual bool getInputListIsFixedFlag () const
 
virtual bool getOutputListIsFixedFlag () const
 
virtual void setNumberOfOutputs (ossim_int32 numberOfInputs)
 Will set the number of outputs. More...
 
const ConnectableObjectListgetInputList () const
 
const ConnectableObjectListgetOutputList () const
 
ConnectableObjectListgetInputList ()
 
ConnectableObjectListgetOutputList ()
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const RTTItypeid &typeInfo, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const ossimString &className, bool recurse=true))
 
virtual void propagateEventToOutputs (ossimEvent &event)
 
virtual void propagateEventToInputs (ossimEvent &event)
 
virtual void setProperty (const ossimString &name, const ossimString &value)
 
virtual ossim_uint32 saveStateOfAllInputs (ossimKeywordlist &kwl, bool saveThisStateFlag=true, ossim_uint32 objectIndex=1, const char *prefix=0) const
 Save the state of all inputs to a keyword list. More...
 
virtual bool fillContainer (ossimConnectableContainer &container)
 Inserts this object and all of its children and inputs into the container provided. More...
 
bool moveInputUp (const ossimId &id)
 Moves the input connection matching id up one in the connection list. More...
 
bool moveInputDown (const ossimId &id)
 Moves the input connection matching id down one in the connection list. More...
 
bool moveInputToTop (const ossimId &id)
 Moves the input connection matching id to the top of the connection list. More...
 
bool moveInputToBottom (const ossimId &id)
 Moves the input connection matching id to the bottom of the connection list. More...
 
virtual void accept (ossimVisitor &visitor)
 We will add a visitor interface for all connectable objects. More...
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimListenerManager
 ossimListenerManager ()
 
virtual ~ossimListenerManager ()
 
virtual void fireEvent (ossimEvent &event)
 
virtual bool addListener (ossimListener *listener)
 
virtual bool removeListener (ossimListener *listener)
 
virtual bool findListener (ossimListener *listener)
 
- Public Member Functions inherited from ossimPropertyInterface
 ossimPropertyInterface ()
 
virtual ~ossimPropertyInterface ()
 
virtual ossimString getPropertyValueAsString (const ossimString &name) const
 
void getPropertyList (std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
 
void setProperties (std::vector< ossimRefPtr< ossimProperty > > &propertyList)
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 
- Public Member Functions inherited from ossimConnectableObjectListener
 ossimConnectableObjectListener ()
 
virtual ~ossimConnectableObjectListener ()
 
virtual void processEvent (ossimEvent &event)
 ProcessEvent. More...
 
virtual void objectDestructingEvent (ossimObjectDestructingEvent &)
 
virtual void connectionEvent (ossimConnectionEvent &)
 
virtual void disconnectOutputEvent (ossimConnectionEvent &)
 
virtual void connectOutputEvent (ossimConnectionEvent &)
 
virtual void addObjectEvent (ossimContainerEvent &)
 
virtual void removeObjectEvent (ossimContainerEvent &)
 
virtual void containerEvent (ossimContainerEvent &)
 
- Public Member Functions inherited from ossimListener
 ossimListener ()
 
virtual ~ossimListener ()
 
void enableListener ()
 
void disableListener ()
 
void setListenerEnableFlag (bool flag)
 
bool isListenerEnabled () const
 
bool getListenerEnableFlag () const
 

Protected Member Functions

void allocate ()
 Called on first getTile, will initialize all data needed. More...
 
void checkPassThrough ()
 Will check all combinations of the band list to see if its. More...
 
bool outputBandsWithinInputRange () const
 
ossimRefPtr< ossimImageHandlergetBandSelectableImageHandler () const
 Finds and returns band selectable image handler. More...
 
bool getRgbBandList (std::vector< ossim_uint32 > &bandList) const
 Attempts to derive rgb bands from image handler to the left of the band selector. More...
 
- 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< ossimImageDatam_tile
 
std::vector< ossim_uint32m_outputBandList
 
ossimBandSelectorWithinRangeFlagState m_withinRangeFlag
 
bool m_passThroughFlag
 
bool m_delayLoadRgbFlag
 
bool m_inputIsSelectable
 
- 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
 

Detailed Description

Definition at line 20 of file ossimBandSelector.h.

Member Enumeration Documentation

◆ ossimBandSelectorWithinRangeFlagState

Constructor & Destructor Documentation

◆ ossimBandSelector()

ossimBandSelector::ossimBandSelector ( )

Definition at line 30 of file ossimBandSelector.cpp.

31  :
33  m_tile(0),
36  m_passThroughFlag(false),
37  m_delayLoadRgbFlag(false),
38  m_inputIsSelectable(false)
39 {
40 // theEnableFlag = false; // Start off disabled.
41  theEnableFlag = true;
42 }
ossimRefPtr< ossimImageData > m_tile
bool theEnableFlag
Definition: ossimSource.h:62
ossimImageSourceFilter(ossimObject *owner=NULL)
ossimBandSelectorWithinRangeFlagState m_withinRangeFlag
std::vector< ossim_uint32 > m_outputBandList

◆ ~ossimBandSelector()

ossimBandSelector::~ossimBandSelector ( )
virtual

Definition at line 44 of file ossimBandSelector.cpp.

References m_tile.

45 {
46  m_tile = 0;
47 }
ossimRefPtr< ossimImageData > m_tile

Member Function Documentation

◆ allocate()

void ossimBandSelector::allocate ( )
protected

Called on first getTile, will initialize all data needed.

Definition at line 276 of file ossimBandSelector.cpp.

References ossimImageDataFactory::create(), ossimImageData::initialize(), ossimImageDataFactory::instance(), and m_tile.

Referenced by getTile().

277 {
278  //initialize(); // Update the connection.
279  //theOrderedCorrectlyFlag = isOrderedCorrectly();
281  m_tile->initialize();
282 }
ossimRefPtr< ossimImageData > m_tile
virtual void initialize()
Initialize the data buffer.
static ossimImageDataFactory * instance()
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const

◆ checkPassThrough()

void ossimBandSelector::checkPassThrough ( )
protected

Will check all combinations of the band list to see if its.

Definition at line 459 of file ossimBandSelector.cpp.

References ossimImageSource::getOutputBandList(), m_outputBandList, m_passThroughFlag, outputBandsWithinInputRange(), and ossimImageSourceFilter::theInputConnection.

Referenced by setOutputBandList().

460 {
462 
463  // check if marked with improper bands
465  return;
466 
468  {
469  std::vector<ossim_uint32> inputList;
471 
472  if ( inputList.size() == m_outputBandList.size() )
473  {
474  const std::vector<ossim_uint32>::size_type SIZE = m_outputBandList.size();
475 
476  std::vector<ossim_uint32>::size_type i = 0;
477  while (i < SIZE)
478  {
479  if ( inputList[i] != m_outputBandList[i] )
480  {
481  break;
482  }
483  ++i;
484  }
485  if (i == SIZE)
486  {
487  m_passThroughFlag = true;
488  }
489  }
490  }
491  else
492  {
493  if(traceDebug())
494  {
495  ossimNotify(ossimNotifyLevel_WARN) << "ossimBandSelector::isOrderedCorrectly() ERROR: "
496  "Method called prior to initialization!\n";
497  }
498  }
499 
500 }
virtual void getOutputBandList(std::vector< ossim_uint32 > &bandList) const
Initializes bandList.
ossimImageSource * theInputConnection
std::vector< ossim_uint32 > m_outputBandList
bool outputBandsWithinInputRange() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ getBandSelectableImageHandler()

ossimRefPtr< ossimImageHandler > ossimBandSelector::getBandSelectableImageHandler ( ) const
protected

Finds and returns band selectable image handler.

To get a valid pointer there must be one and only one image handler on the input connection and it must be a band selector. In other words, must be a single image chain input and ossimImageHandler::isBandSelector() must return true.

Returns
Pointer to image handler wrapped in an ossimRefPtr on success; null, on error.

GP: We will only allow the immediate input check for an image handler and if one is present then check if selectable

Definition at line 653 of file ossimBandSelector.cpp.

References ossimConnectableObject::accept(), ossimCollectionVisitor::getObjectAs(), ossimCollectionVisitor::getObjects(), ossimImageHandler::isBandSelector(), ossimImageSourceFilter::theInputConnection, ossimRefPtr< T >::valid(), ossimVisitor::VISIT_CHILDREN, and ossimVisitor::VISIT_INPUTS.

Referenced by getNumberOfInputBands(), and setOutputBandList().

654 {
656 
657  if ( theInputConnection )
658  {
663  ossimTypeNameVisitor visitor(ossimString("ossimImageHandler"),
664  true,
666  ossimTypeNameVisitor bandSelectorVisitor(ossimString("ossimBandSelector"),
667  true,
669 
670  theInputConnection->accept(visitor);
671  theInputConnection->accept(bandSelectorVisitor);
672  // if there is a band selector before us then do not
673  // set the image handler
674  if(bandSelectorVisitor.getObjects().size() < 1)
675  {
676  // If there are multiple image handlers, e.g. a mosaic do not uses.
677  if ( visitor.getObjects().size() == 1 )
678  {
679  ih = visitor.getObjectAs<ossimImageHandler>( 0 );
680  if ( ih.valid() )
681  {
682  if ( ih->isBandSelector() == false )
683  {
684  ih = 0;
685  }
686  }
687  }
688 
689  }
690 
691  } // Matches: if ( theInputConnection )
692  return ih;
693 
694 } // End: ossimBandSelector::getBandSelectableImageHandler()
bool valid() const
Definition: ossimRefPtr.h:75
ossimImageSource * theInputConnection
virtual bool isBandSelector() const
Indicates whether or not the image handler can control output band selection via the setOutputBandLis...
This class defines an abstract Handler which all image handlers(loaders) should derive from...
virtual void accept(ossimVisitor &visitor)
We will add a visitor interface for all connectable objects.

◆ getLongName()

ossimString ossimBandSelector::getLongName ( ) const
virtual

Reimplemented from ossimObject.

Definition at line 556 of file ossimBandSelector.cpp.

557 {
558  return ossimString("Band Selector, maps an input band to the output band.");
559 }

◆ getMaxPixelValue()

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

Returns the max pixel of the band.

Reimplemented from ossimImageSource.

Definition at line 345 of file ossimBandSelector.cpp.

References DBL_EPSILON, ossimImageSource::getMaxPixelValue(), isSourceEnabled(), m_outputBandList, and ossimImageSourceFilter::theInputConnection.

346 {
348  {
349  if (isSourceEnabled())
350  {
351  if(band < m_outputBandList.size())
352  {
353  return theInputConnection->
355  }
356  else
357  {
358  return theInputConnection->getMaxPixelValue(band);
359  }
360  }
361  else
362  {
363  return theInputConnection->getMaxPixelValue(band);
364  }
365  }
366  return 1.0/DBL_EPSILON;
367 }
virtual bool isSourceEnabled() const
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
ossimImageSource * theInputConnection
#define DBL_EPSILON
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
std::vector< ossim_uint32 > m_outputBandList

◆ getMinPixelValue()

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

Returns the min pixel of the band.

Reimplemented from ossimImageSource.

Definition at line 296 of file ossimBandSelector.cpp.

References ossimImageSource::getMinPixelValue(), isSourceEnabled(), m_outputBandList, and ossimImageSourceFilter::theInputConnection.

297 {
299  {
300  if (isSourceEnabled())
301  {
302  if(band < m_outputBandList.size())
303  {
304  return theInputConnection->
306  }
307  else
308  {
309  return theInputConnection->getMinPixelValue(band);
310  }
311  }
312  else
313  {
314  return theInputConnection->getMinPixelValue(band);
315  }
316  }
317  return 0;
318 }
virtual bool isSourceEnabled() const
virtual double getMinPixelValue(ossim_uint32 band=0) const
Returns the min pixel of the band.
virtual double getMinPixelValue(ossim_uint32 band=0) const
Returns the min pixel of the band.
ossimImageSource * theInputConnection
std::vector< ossim_uint32 > m_outputBandList

◆ getNullPixelValue()

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

Each band has a null pixel associated with it.

The null pixel represents an invalid value.

Reimplemented from ossimImageSource.

Definition at line 320 of file ossimBandSelector.cpp.

References ossimImageSource::getNullPixelValue(), isSourceEnabled(), m_outputBandList, and ossimImageSourceFilter::theInputConnection.

321 {
323  {
324  if (isSourceEnabled())
325  {
326  if(band < m_outputBandList.size())
327  {
328  return theInputConnection->
330  }
331  else
332  {
334  }
335  }
336  else
337  {
339  }
340  }
341 
342  return 0;
343 }
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.
virtual bool isSourceEnabled() const
ossimImageSource * theInputConnection
std::vector< ossim_uint32 > m_outputBandList
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.

◆ getNumberOfInputBands()

ossim_uint32 ossimBandSelector::getNumberOfInputBands ( ) const
virtual

Returns the number of input bands.

Overrides ossimImageSourceFilter::getNumberOfInputBands to check for a single image chain band selectable image handler on the input. If one is present it returns it's number of input bands instead of the number of the input connection's output bands(our input). This is needed so callers, e.g. band selector dialog box can query the number of bands available.

Returns
Number of bands available.

Reimplemented from ossimImageSourceFilter.

Definition at line 183 of file ossimBandSelector.cpp.

References getBandSelectableImageHandler(), ossimImageSourceFilter::getNumberOfInputBands(), ossimImageSource::getNumberOfInputBands(), and ossimRefPtr< T >::valid().

Referenced by outputBandsWithinInputRange().

184 {
185  ossim_uint32 bands;
186 
187  // See if we have a single image chain with band selectable image handler.
189  if ( ih.valid() )
190  {
191  bands = ih->getNumberOfInputBands();
192  }
193  else
194  {
196  }
197 
198  return bands;
199 }
virtual ossim_uint32 getNumberOfInputBands() const
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimImageHandler > getBandSelectableImageHandler() const
Finds and returns band selectable image handler.
unsigned int ossim_uint32
virtual ossim_uint32 getNumberOfInputBands() const =0

◆ getNumberOfOutputBands()

ossim_uint32 ossimBandSelector::getNumberOfOutputBands ( ) const
virtual

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

Reimplemented from ossimImageSource.

Definition at line 161 of file ossimBandSelector.cpp.

References ossimImageSourceFilter::getNumberOfInputBands(), isSourceEnabled(), and m_outputBandList.

Referenced by ossimSingleImageChain::setToThreeBands().

162 {
163  ossim_uint32 bands;
164 
165  if(isSourceEnabled())
166  {
167  bands = static_cast<ossim_uint32>(m_outputBandList.size());
168  }
169  else
170  {
171  //---
172  // Note:
173  // This returns theInputConnection->getNumberOfOutputBands() which is our
174  // input. Calling ossimBandSelector::getNumberOfInputBands() will produce
175  // an error if we are bypassed due to a band selectable image handler.
176  //---
178  }
179 
180  return bands;
181 }
virtual ossim_uint32 getNumberOfInputBands() const
virtual bool isSourceEnabled() const
unsigned int ossim_uint32
std::vector< ossim_uint32 > m_outputBandList

◆ getOutputBandList()

void ossimBandSelector::getOutputBandList ( std::vector< ossim_uint32 > &  bandList) const
virtual

Initializes bandList to the zero based order of output bands.

Reimplemented from ossimImageSourceFilter.

Definition at line 540 of file ossimBandSelector.cpp.

References ossimImageSource::getOutputBandList(), isSourceEnabled(), m_outputBandList, and ossimImageSourceFilter::theInputConnection.

Referenced by getProperty().

541 {
542  if ( isSourceEnabled()&&m_outputBandList.size() )
543  {
544  bandList = m_outputBandList;
545  }
546  else if (theInputConnection)
547  {
549  }
550  else
551  {
552  bandList.clear();
553  }
554 }
virtual bool isSourceEnabled() const
virtual void getOutputBandList(std::vector< ossim_uint32 > &bandList) const
Initializes bandList.
ossimImageSource * theInputConnection
std::vector< ossim_uint32 > m_outputBandList

◆ getProperty()

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

Reimplemented from ossimImageSourceFilter.

Definition at line 603 of file ossimBandSelector.cpp.

References ossimProperty::clearChangeType(), getOutputBandList(), ossimImageSourceFilter::getProperty(), ossimString::join(), m_outputBandList, ossimProperty::setCacheRefreshBit(), ossimProperty::setReadOnlyFlag(), ossim::toSimpleStringList(), and ossimString::toString().

604 {
605  if( name == "bands" )
606  {
607  ossimString bandsString;
608  ossim::toSimpleStringList(bandsString,
610  ossimStringProperty* stringProp = new ossimStringProperty(name, bandsString);
611 
612  stringProp->clearChangeType();
613  stringProp->setReadOnlyFlag(false);
614  stringProp->setCacheRefreshBit();
615 
616  return stringProp;
617  }
618  else if( name == "bandSelection" )
619  {
620  std::vector<ossim_uint32> bands;
621 
622  getOutputBandList( bands );
623 
624  std::vector<ossimString> bandNames;
625 
626  for(ossim_uint32 i = 0; i < bands.size(); i++)
627  {
628  bandNames.push_back( ossimString::toString( bands[i] ) );
629  }
630 
631  ossimString str;
632 
633  str.join( bandNames, " " );
634 
635  ossimStringProperty* stringProp = new ossimStringProperty(name, str);
636 
637  stringProp->clearChangeType();
638  stringProp->setReadOnlyFlag(false);
639  stringProp->setCacheRefreshBit();
640 
641  return stringProp;
642  }
643 
645 }
const ossimString & join(const std::vector< ossimString > &stringList, const ossimString &separator)
static ossimString toString(bool aValue)
Numeric to string methods.
void toSimpleStringList(ossimString &result, const std::vector< T > &valuesList)
This will output a vector of values inst a string.
Definition: ossimCommon.h:484
virtual void setReadOnlyFlag(bool flag)
void clearChangeType()
unsigned int ossim_uint32
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
std::vector< ossim_uint32 > m_outputBandList
virtual void getOutputBandList(std::vector< ossim_uint32 > &bandList) const
Initializes bandList to the zero based order of output bands.
void setCacheRefreshBit()

◆ getPropertyNames()

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

Reimplemented from ossimImageSourceFilter.

Definition at line 647 of file ossimBandSelector.cpp.

References ossimImageSourceFilter::getPropertyNames().

648 {
650  propertyNames.push_back("bands");
651 }
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const

◆ getRgbBandList()

bool ossimBandSelector::getRgbBandList ( std::vector< ossim_uint32 > &  bandList) const
protected

Attempts to derive rgb bands from image handler to the left of the band selector.

Must be one and only one image handler on the input connection. In other words, must be a single image chain input.

Returns
true on success, false on error.

Definition at line 696 of file ossimBandSelector.cpp.

References ossimConnectableObject::accept(), ossimCollectionVisitor::getObjectAs(), ossimCollectionVisitor::getObjects(), ossimImageHandler::getRgbBandList(), ossimImageSourceFilter::theInputConnection, ossimRefPtr< T >::valid(), ossimVisitor::VISIT_CHILDREN, and ossimVisitor::VISIT_INPUTS.

697 {
698  bool result = false;
699 
700  if ( theInputConnection )
701  {
702  ossimTypeNameVisitor visitor(ossimString("ossimImageHandler"),
703  true,
705 
706  theInputConnection->accept(visitor);
707 
708  // If there are multiple image handlers, e.g. a mosaic do not uses.
709  if ( visitor.getObjects().size() == 1 )
710  {
711  ossimRefPtr<ossimImageHandler> ih = visitor.getObjectAs<ossimImageHandler>( 0 );
712  if ( ih.valid() )
713  {
714  result = ih->getRgbBandList( bandList );
715  }
716  }
717 
718  } // Matches: if ( theInputConnection )
719 
720  return result;
721 
722 } // End: ossimBandSelector::getRgbBandList( ... )
bool valid() const
Definition: ossimRefPtr.h:75
ossimImageSource * theInputConnection
virtual bool getRgbBandList(std::vector< ossim_uint32 > &bandList) const
Convenience method to get the zero based rgb output band list.
This class defines an abstract Handler which all image handlers(loaders) should derive from...
virtual void accept(ossimVisitor &visitor)
We will add a visitor interface for all connectable objects.

◆ getShortName()

ossimString ossimBandSelector::getShortName ( ) const
virtual

Reimplemented from ossimObject.

Definition at line 561 of file ossimBandSelector.cpp.

562 {
563  return ossimString("Band Selector");
564 }

◆ getTile()

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

Reimplemented from ossimImageSource.

Definition at line 49 of file ossimBandSelector.cpp.

References allocate(), ossimImageData::assignBand(), ossimRefPtr< T >::get(), ossimDataObject::getDataObjectStatus(), ossimImageSource::getTile(), isSourceEnabled(), m_outputBandList, m_passThroughFlag, m_tile, m_withinRangeFlag, ossimImageData::makeBlank(), OSSIM_EMPTY, OSSIM_NULL, ossimBandSelectorWithinRangeFlagState_IN_RANGE, ossimBandSelectorWithinRangeFlagState_NOT_SET, ossimBandSelectorWithinRangeFlagState_OUT_OF_RANGE, outputBandsWithinInputRange(), ossimImageData::setImageRectangle(), ossimImageSourceFilter::theInputConnection, ossimRefPtr< T >::valid(), and ossimImageData::validate().

52 {
53  if (!theInputConnection)
54  {
56  }
57 
58  // Get the tile from the source.
60 
61 
63  {
64  return t; // This tile source bypassed, return the input tile source.
65  }
66 
67  if(!m_tile.valid()) // First time through, might not be initialized...
68  {
69  allocate();
70  if (!m_tile.valid())
71  {
72  // Should never happen...
73  return t; // initialize failed.
74  }
75  }
76 
77  m_tile->setImageRectangle(tileRect);
79  {
83  }
85  {
86  m_tile->makeBlank();
87  return m_tile;
88  }
89 
90  if ( !t.valid() ||
91  (t->getDataObjectStatus() == OSSIM_EMPTY) ||
93  {
94  //---
95  // Since we're enabled, we must return our tile not "t" so the
96  // correct number of bands goes through the chain.
97  //---
98  m_tile->makeBlank();
99  return m_tile;
100  }
101 
102  // Copy selected bands to our tile.
103  for ( ossim_uint32 i = 0; i < m_outputBandList.size(); ++i)
104  {
105  m_tile->assignBand(t.get(), m_outputBandList[i], i);
106  }
107 
108  m_tile->validate();
109 
110  return m_tile;
111 }
ossimRefPtr< ossimImageData > m_tile
virtual void setImageRectangle(const ossimIrect &rect)
bool valid() const
Definition: ossimRefPtr.h:75
virtual bool isSourceEnabled() const
virtual ossimDataObjectStatus getDataObjectStatus() const
void allocate()
Called on first getTile, will initialize all data needed.
virtual void assignBand(const ossimImageData *data, ossim_uint32 source_band, ossim_uint32 output_band)
virtual ossimDataObjectStatus validate() const
ossimImageSource * theInputConnection
unsigned int ossim_uint32
ossimBandSelectorWithinRangeFlagState m_withinRangeFlag
virtual void makeBlank()
Initializes data to null pixel values.
std::vector< ossim_uint32 > m_outputBandList
bool outputBandsWithinInputRange() const
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)

◆ initialize()

void ossimBandSelector::initialize ( )
virtual

Reimplemented from ossimImageSourceFilter.

Definition at line 202 of file ossimBandSelector.cpp.

Referenced by loadState(), and setThreeBandRgb().

203 {
204  if(traceDebug())
205  {
206  ossimNotify(ossimNotifyLevel_WARN) << "ossimBandSelector::initialize() entered...\n";
207  }
208 
209  // Base class will recapture "theInputConnection".
211 
213 
215  {
216  if ( !m_outputBandList.size() )
217  {
218  // First time through...
219  if ( m_delayLoadRgbFlag )
220  {
221  //---
222  // "bands" key was set to "rgb" or "default" in loadState but there
223  // was not a connection to derive rgb bands from image handler.
224  //---
225  if ( getRgbBandList( m_outputBandList ) == false )
226  {
227  //---
228  // Could not derive from input. Assuming caller wanted three bands.
229  // Call to checkPassThrough()->outputBandsWithinInputRange()
230  // will check the range of output band list.
231  //---
233  {
234  m_outputBandList.resize(3);
235  m_outputBandList[0] = 0;
236  m_outputBandList[1] = 1;
237  m_outputBandList[2] = 2;
238  }
239  else
240  {
241  m_outputBandList.resize(1);
242  m_outputBandList[0] = 0;
243  }
244  }
245 
246  m_delayLoadRgbFlag = false; // clear flag.
247  }
248 
249  if ( !m_outputBandList.size() )
250  {
251  // Set the output band list to input if not set above.
253  }
254 
255  if( m_outputBandList.size() )
256  {
257  // Call to setOutputBandList configures band selector.
259  }
260 
261  } // if ( !m_outputBandList.size() )
262 
263  } // if(theInputConnection)
264 
265  if ( !isSourceEnabled() )
266  {
267  m_tile = 0;
268  }
269 
270  if(traceDebug())
271  {
272  ossimNotify(ossimNotifyLevel_WARN) << "ossimBandSelector::initialize() exited...\n";
273  }
274 }
ossimRefPtr< ossimImageData > m_tile
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual bool isSourceEnabled() const
virtual void getOutputBandList(std::vector< ossim_uint32 > &bandList) const
Initializes bandList.
ossimImageSource * theInputConnection
ossimBandSelectorWithinRangeFlagState m_withinRangeFlag
virtual void setOutputBandList(const vector< ossim_uint32 > &outputBandList, bool disablePassThru=false)
Sets the output band list.
bool getRgbBandList(std::vector< ossim_uint32 > &bandList) const
Attempts to derive rgb bands from image handler to the left of the band selector. ...
std::vector< ossim_uint32 > m_outputBandList
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ isSourceEnabled()

bool ossimBandSelector::isSourceEnabled ( ) const
virtual

Reimplemented from ossimSource.

Definition at line 284 of file ossimBandSelector.cpp.

References ossimSource::isSourceEnabled(), and m_passThroughFlag.

Referenced by getMaxPixelValue(), getMinPixelValue(), getNullPixelValue(), getNumberOfOutputBands(), getOutputBandList(), and getTile().

285 {
287  if(result)
288  {
289  // if I am not marked to pass information on through then enable me
290  result = !m_passThroughFlag;
291  }
292 
293  return result;
294 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79

◆ loadState()

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

References ossimKeywordNames::BANDS_KW, ossimString::downcase(), ossimString::empty(), ossimKeywordlist::find(), ossimKeywordlist::getSubstringKeyList(), initialize(), ossimImageSourceFilter::loadState(), m_delayLoadRgbFlag, m_outputBandList, ossimString::toInt(), ossim::toSimpleVector(), and ossimString::toString().

402 {
403  bool result = false;
404 
406 
407  m_outputBandList.clear();
408 
409  ossimString copyPrefix = prefix;
410 
411  ossimString bands = kwl.find(prefix, ossimKeywordNames::BANDS_KW);
412  if(!bands.empty())
413  {
414  ossimString bs = bands;
415  bs.downcase();
416  if ( (bs == "rgb" ) || (bs == "default"))
417  {
418  // Flag initialize() to set the band list on first connection.
419  m_delayLoadRgbFlag = true;
420  }
421  else
422  {
423  // Load from key:value, e.g. bands:(2,1,0)
425  result = true;
426  }
427  }
428  else
429  {
430  ossimString regExpression = ossimString("^(") + copyPrefix + "band[0-9]+)";
431 
432  vector<ossimString> keys = kwl.getSubstringKeyList( regExpression );
433  long numberOfBands = (long)keys.size();
434  ossim_uint32 offset = (ossim_uint32)(copyPrefix+"band").size();
435  std::vector<int>::size_type idx = 0;
436  std::vector<int> numberList(numberOfBands);
437  for(idx = 0; idx < keys.size();++idx)
438  {
439  ossimString numberStr(keys[idx].begin() + offset,
440  keys[idx].end());
441  numberList[idx] = numberStr.toInt();
442  }
443  std::sort(numberList.begin(), numberList.end());
444  for(idx=0;idx < numberList.size();++idx)
445  {
446  const char* bandValue =
447  kwl.find(copyPrefix,
448  ("band"+ossimString::toString(numberList[idx])).c_str());
449  m_outputBandList.push_back( ossimString(bandValue).toLong()-1);
450  }
451  result = true;
452  }
453 
454  initialize();
455 
456  return result;
457 }
const char * find(const char *key) const
static ossimString toString(bool aValue)
Numeric to string methods.
bool toSimpleVector(std::vector< T > &result, const ossimString &stringOfPoints)
Definition: ossimCommon.h:537
unsigned int ossim_uint32
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 ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
static const char * BANDS_KW
virtual void initialize()
std::vector< ossimString > getSubstringKeyList(const ossimString &regularExpression) const
bool empty() const
Definition: ossimString.h:411
std::vector< ossim_uint32 > m_outputBandList

◆ outputBandsWithinInputRange()

bool ossimBandSelector::outputBandsWithinInputRange ( ) const
protected
Returns
true if all bands in theOutputBandList are less than the number of input's bands.

Definition at line 502 of file ossimBandSelector.cpp.

References getNumberOfInputBands(), m_outputBandList, and ossimImageSourceFilter::theInputConnection.

Referenced by checkPassThrough(), and getTile().

503 {
504  bool result = false;
505 
507  {
508  result = true;
509  const ossim_uint32 HIGHEST_BAND = getNumberOfInputBands() - 1;
510  const ossim_uint32 OUTPUT_BANDS = (ossim_uint32)m_outputBandList.size();
511  for (ossim_uint32 i=0; i<OUTPUT_BANDS; ++i)
512  {
513  if (m_outputBandList[i] > HIGHEST_BAND)
514  {
515  if(traceDebug())
516  {
518  << "ossimBandSelector::outputBandsWithinInputRange() ERROR:"
519  << "Output band greater than highest input band. "
520  << m_outputBandList[i] << " > " << HIGHEST_BAND << "."
521  << std::endl;
522  }
523  result = false;
524  break;
525  }
526  }
527  }
528  else
529  {
530  if(traceDebug())
531  {
533  << "ossimBandSelector::outputBandsWithinInputRange() ERROR:"
534  << "Method called prior to initialization!" << std::endl;
535  }
536  }
537  return result;
538 }
virtual ossim_uint32 getNumberOfInputBands() const
Returns the number of input bands.
ossimImageSource * theInputConnection
unsigned int ossim_uint32
std::vector< ossim_uint32 > m_outputBandList
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ saveState()

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

References ossimKeywordlist::add(), ossimKeywordNames::BANDS_KW, m_outputBandList, ossimKeywordNames::NUMBER_OUTPUT_BANDS_KW, ossimImageSourceFilter::saveState(), and ossim::toSimpleStringList().

371 {
372  ossimString temp;
373 
374  kwl.add(prefix,
376  static_cast<int>(m_outputBandList.size()),
377  true);
378 
379  ossimString bandsString;
380  ossim::toSimpleStringList(bandsString,
382  kwl.add(prefix,
384  bandsString,
385  true);
386 /*
387  for(ossim_uint32 counter = 0; counter < m_outputBandList.size();counter++)
388  {
389  temp = ossimKeywordNames::BAND_KW;
390  temp += ossimString::toString(counter+1);
391 
392  kwl.add(prefix,
393  temp.c_str(),
394  ossimString::toString(m_outputBandList[counter]+1).c_str());
395  }
396 */
397  return ossimImageSourceFilter::saveState(kwl, prefix);
398 }
void toSimpleStringList(ossimString &result, const std::vector< T > &valuesList)
This will output a vector of values inst a string.
Definition: ossimCommon.h:484
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
static const char * NUMBER_OUTPUT_BANDS_KW
static const char * BANDS_KW
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
std::vector< ossim_uint32 > m_outputBandList

◆ setOutputBandList()

void ossimBandSelector::setOutputBandList ( const vector< ossim_uint32 > &  outputBandList,
bool  disablePassThru = false 
)
virtual

Sets the output band list.

Parameters
outputBandListList of zero based bands.
disablePassThruIf true, forces the band selection to be performed by this filter. Otherwise, the image handler to the left is directed to select bands if it has that capability (default behavior).
Note
The input connection should be established prior to calling this.
Bands can be duplicated. So if you have a single band input you can do a band list like "1, 1, 1". Any band within the list must be available from the input. So if you have a 3 band input bands must be constrained to zero based bands "0, 1, or 2".
Calling this method does not enable filter so callers should do: theBandSelector->enableSource(); theBandSelector->setOutputBandList(bandList);

Definition at line 120 of file ossimBandSelector.cpp.

References checkPassThrough(), getBandSelectableImageHandler(), ossimImageData::getNumberOfBands(), ossimImageSource::getOutputScalarType(), ossimRectilinearDataObject::getScalarType(), m_outputBandList, m_passThroughFlag, m_tile, m_withinRangeFlag, ossimBandSelectorWithinRangeFlagState_NOT_SET, ossimImageHandler::setOutputBandList(), ossimImageSourceFilter::theInputConnection, and ossimRefPtr< T >::valid().

Referenced by ossimSingleImageChain::addBandSelector(), ATP::AtpAnnotatedImage::AtpAnnotatedImage(), ATP::AtpGenerator::constructChain(), main(), ossimSingleImageChain::setBandSelection(), and setProperty().

122 {
123  if ( outputBandList.size() )
124  {
125  m_outputBandList = outputBandList; // Assign the new list.
126  m_passThroughFlag = false; // Assume no pass thru first
127  if ( !disablePassThru )
128  {
129  bool setBands = false;
131  if ( ih.valid() )
132  {
133  // Our input is a single image chain that can do band selection.
134  if ( ih->setOutputBandList( outputBandList ) )
135  {
136  m_passThroughFlag = true;
137  setBands = true;
138  m_tile = 0; // Don't need.
139  }
140  }
141 
142  if ( setBands == false )
143  {
144  if ( m_tile.valid() )
145  {
146  // Check the tile band size and scalar.
147  if ( ( m_tile->getNumberOfBands() != outputBandList.size() ) ||
149  {
150  m_tile = 0; // Force an allocate call next getTile.
151  }
152  }
155  //theOrderedCorrectlyFlag = isOrderedCorrectly();
156  }
157  }
158  }
159 }
void checkPassThrough()
Will check all combinations of the band list to see if its.
ossimRefPtr< ossimImageData > m_tile
virtual ossim_uint32 getNumberOfBands() const
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimImageHandler > getBandSelectableImageHandler() const
Finds and returns band selectable image handler.
ossimImageSource * theInputConnection
ossimBandSelectorWithinRangeFlagState m_withinRangeFlag
virtual ossimScalarType getScalarType() const
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
std::vector< ossim_uint32 > m_outputBandList
virtual bool setOutputBandList(const std::vector< ossim_uint32 > &band_list)
If the image handler "isBandSeletor()" then the band selection of the output chip can be controlled...

◆ setProperty()

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

Override base class so that a disableSource event does not reinitialize the object and enable itself.

Reimplemented from ossimImageSourceFilter.

Definition at line 566 of file ossimBandSelector.cpp.

References ossimProperty::getName(), m_outputBandList, setOutputBandList(), ossimImageSourceFilter::setProperty(), ossimString::split(), ossim::toSimpleVector(), ossimRefPtr< T >::valid(), and ossimProperty::valueToString().

567 {
568  if( property.valid() )
569  {
570  if(property->getName() == "bands")
571  {
572  std::vector<ossim_uint32> selection;
573  if(ossim::toSimpleVector(selection, property->valueToString()))
574  {
575  m_outputBandList = selection;
577  }
578  }
579  else if(property->getName() == "bandSelection")
580  {
581  ossimString str = property->valueToString();
582  std::vector<ossimString> str_vec;
583  std::vector<ossim_uint32> int_vec;
584 
585  str.split( str_vec, " " );
586 
587  for ( ossim_uint32 i = 0; i < str_vec.size(); ++i )
588  {
589  if(!str_vec[i].empty())
590  {
591  int_vec.push_back( str_vec[i].toUInt32() );
592  }
593  }
594  setOutputBandList( int_vec );
595  }
596  else
597  {
599  }
600  }
601 }
virtual void valueToString(ossimString &valueResult) const =0
virtual void setProperty(ossimRefPtr< ossimProperty > property)
bool valid() const
Definition: ossimRefPtr.h:75
void split(std::vector< ossimString > &result, const ossimString &separatorList, bool skipBlankFields=false) const
Splits this string into a vector of strings (fields) using the delimiter list specified.
bool toSimpleVector(std::vector< T > &result, const ossimString &stringOfPoints)
Definition: ossimCommon.h:537
unsigned int ossim_uint32
virtual void setOutputBandList(const vector< ossim_uint32 > &outputBandList, bool disablePassThru=false)
Sets the output band list.
std::vector< ossim_uint32 > m_outputBandList
const ossimString & getName() const

◆ setThreeBandRgb()

void ossimBandSelector::setThreeBandRgb ( )
virtual

Will set to three bands (rgb) out.

This will attempt to auto detect the zero based rgb band order from the input image handler. If the result is < 3 bands we will not increase the band output by adding more bands. For example,
if the input is grey or thermal then it will just output one band for a default allocation. Note, this can be overriden by explicitly setting the output band list.
If the image handler implemented getRgbBandList(...) it will use that: bands = 2,1,0 ( or whatever handler thinks rgb is ) else if 3 band or greater and can't determine rgb: bands = 0,1,2 else (less than three bands) bands = 0

Definition at line 113 of file ossimBandSelector.cpp.

References initialize(), m_delayLoadRgbFlag, and m_outputBandList.

Referenced by ossimSingleImageChain::setDefaultBandSelection(), and ossimSingleImageChain::setToThreeBands().

114 {
115  m_outputBandList.clear();
116  m_delayLoadRgbFlag = true;
117  initialize();
118 }
virtual void initialize()
std::vector< ossim_uint32 > m_outputBandList

Member Data Documentation

◆ m_delayLoadRgbFlag

bool ossimBandSelector::m_delayLoadRgbFlag
protected

Definition at line 183 of file ossimBandSelector.h.

Referenced by loadState(), and setThreeBandRgb().

◆ m_inputIsSelectable

bool ossimBandSelector::m_inputIsSelectable
protected

Definition at line 184 of file ossimBandSelector.h.

◆ m_outputBandList

std::vector<ossim_uint32> ossimBandSelector::m_outputBandList
protected

◆ m_passThroughFlag

bool ossimBandSelector::m_passThroughFlag
protected

Definition at line 182 of file ossimBandSelector.h.

Referenced by checkPassThrough(), getTile(), isSourceEnabled(), and setOutputBandList().

◆ m_tile

ossimRefPtr<ossimImageData> ossimBandSelector::m_tile
protected

Definition at line 179 of file ossimBandSelector.h.

Referenced by allocate(), getTile(), setOutputBandList(), and ~ossimBandSelector().

◆ m_withinRangeFlag

ossimBandSelectorWithinRangeFlagState ossimBandSelector::m_withinRangeFlag
protected

Definition at line 181 of file ossimBandSelector.h.

Referenced by getTile(), and setOutputBandList().


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