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
ossimIndexToRgbLutFilter Class Reference

#include <ossimIndexToRgbLutFilter.h>

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

Public Types

enum  Mode { LITERAL = 0, VERTICES = 1, REGULAR = 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

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

Protected Member Functions

void allocate ()
 Called on first getTile, will initialize all data needed. More...
 
bool initializeLut (const ossimKeywordlist *kwl, const char *prefix=0)
 
- 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

std::map< double, ossimRgbVectortheLut
 
double theMinValue
 
double theMaxValue
 
bool theMinValueOverride
 
bool theMaxValueOverride
 
Mode theMode
 
ossimRefPtr< ossimImageDatatheTile
 
ossimFilename theLutFile
 
- 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 103 of file ossimIndexToRgbLutFilter.h.

Member Enumeration Documentation

◆ Mode

Constructor & Destructor Documentation

◆ ossimIndexToRgbLutFilter()

ossimIndexToRgbLutFilter::ossimIndexToRgbLutFilter ( )

Definition at line 29 of file ossimIndexToRgbLutFilter.cpp.

References ossimConnectableObject::setDescription().

33  theMinValueOverride(false),
34  theMaxValueOverride(false),
36  theTile(0),
37  theLutFile("")
38 {
39  setDescription("Look-up-table remapper from single-band index image to 24-bit RGB.");
40 }
virtual void setDescription(const ossimString &description)
ossimImageSourceFilter(ossimObject *owner=NULL)
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
ossimRefPtr< ossimImageData > theTile

◆ ~ossimIndexToRgbLutFilter()

ossimIndexToRgbLutFilter::~ossimIndexToRgbLutFilter ( )
virtual

Definition at line 42 of file ossimIndexToRgbLutFilter.cpp.

43 {
44 }

Member Function Documentation

◆ allocate()

void ossimIndexToRgbLutFilter::allocate ( )
protected

Called on first getTile, will initialize all data needed.

Definition at line 176 of file ossimIndexToRgbLutFilter.cpp.

References ossimImageDataFactory::create(), ossimImageData::initialize(), ossimImageDataFactory::instance(), ossimImageSourceFilter::theInputConnection, theTile, and ossimRefPtr< T >::valid().

Referenced by getTile().

177 {
178  if(!theInputConnection) return;
179 
180  theTile = ossimImageDataFactory::instance()->create(this, 3, this);
181  if(theTile.valid())
182  {
183  theTile->initialize();
184  }
185 }
bool valid() const
Definition: ossimRefPtr.h:75
virtual void initialize()
Initialize the data buffer.
static ossimImageDataFactory * instance()
ossimImageSource * theInputConnection
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
ossimRefPtr< ossimImageData > theTile

◆ getMaxPixelValue()

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

Returns the max pixel of the band.

Reimplemented from ossimImageSource.

Definition at line 467 of file ossimIndexToRgbLutFilter.cpp.

468 {
469  return 255.0;
470 }

◆ getMaxValue()

double ossimIndexToRgbLutFilter::getMaxValue ( ) const

Definition at line 442 of file ossimIndexToRgbLutFilter.cpp.

References theMaxValue.

443 {
444  return theMaxValue;
445 }

◆ getMinPixelValue()

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

Returns the min pixel of the band.

Reimplemented from ossimImageSource.

Definition at line 462 of file ossimIndexToRgbLutFilter.cpp.

463 {
464  return 1.0;
465 }

◆ getMinValue()

double ossimIndexToRgbLutFilter::getMinValue ( ) const

Definition at line 437 of file ossimIndexToRgbLutFilter.cpp.

References theMinValue.

438 {
439  return theMinValue;
440 }

◆ getMode()

Mode ossimIndexToRgbLutFilter::getMode ( ) const
inline

Definition at line 120 of file ossimIndexToRgbLutFilter.h.

◆ getNullPixelValue()

double ossimIndexToRgbLutFilter::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 457 of file ossimIndexToRgbLutFilter.cpp.

458 {
459  return 0.0;
460 }

◆ getNumberOfOutputBands()

ossim_uint32 ossimIndexToRgbLutFilter::getNumberOfOutputBands ( ) const
virtual

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

Reimplemented from ossimImageSource.

Definition at line 408 of file ossimIndexToRgbLutFilter.cpp.

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

409 {
410  if(isSourceEnabled())
411  {
412  return 3;
413  }
415 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.

◆ getOutputScalarType()

ossimScalarType ossimIndexToRgbLutFilter::getOutputScalarType ( ) const
virtual

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

Please ignore the argument. It will soon be removed.

Reimplemented from ossimImageSource.

Definition at line 417 of file ossimIndexToRgbLutFilter.cpp.

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

418 {
419  if(isSourceEnabled())
420  {
421  return OSSIM_UCHAR;
422  }
423 
425 }
virtual bool isSourceEnabled() const
Definition: ossimSource.cpp:79
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
8 bit unsigned iteger

◆ getTile()

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

Reimplemented from ossimImageSource.

Definition at line 46 of file ossimIndexToRgbLutFilter.cpp.

References allocate(), ossimRgbVector::getB(), ossimImageData::getBuf(), ossimDataObject::getDataObjectStatus(), ossimRgbVector::getG(), ossimImageData::getHeight(), ossimImageData::getNullPix(), ossimImageSource::getNullPixelValue(), ossimRgbVector::getR(), ossimRectilinearDataObject::getScalarType(), ossimImageSource::getTile(), ossimImageData::getWidth(), LITERAL, ossimImageData::makeBlank(), OSSIM_DOUBLE, OSSIM_EMPTY, OSSIM_FLOAT, OSSIM_NORMALIZED_FLOAT, OSSIM_SSHORT16, OSSIM_UCHAR, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, OSSIM_USHORT15, OSSIM_USHORT16, REGULAR, ossimRgbVector::setB(), ossimRgbVector::setG(), ossimImageData::setImageRectangle(), ossimRgbVector::setR(), ossimImageSourceFilter::theInputConnection, theLut, theMaxValue, theMinValue, theMode, theTile, and ossimImageData::validate().

48 {
49  if(!theInputConnection || (theLut.size() == 0))
50  return 0;
51 
52  ossimRefPtr<ossimImageData> tile = theInputConnection->getTile(tileRect, resLevel);
53  if (!tile || !tile->getBuf())
54  return 0;
55  if(!theTile)
56  {
57  allocate();
58  if (!theTile)
59  return 0;
60  }
61 
62  theTile->setImageRectangle(tileRect);
63  theTile->makeBlank();
64 
65  // Quick handling special case of empty input tile:
66  if (tile->getDataObjectStatus() == OSSIM_EMPTY)
67  return theTile;
68 
69  ossim_uint8* outBuf[3];
70  outBuf[0] = (ossim_uint8*)(theTile->getBuf(0));
71  outBuf[1] = (ossim_uint8*)(theTile->getBuf(1));
72  outBuf[2] = (ossim_uint8*)(theTile->getBuf(2));
73 
74  ossim_uint32 maxLength = tile->getWidth()*tile->getHeight();
75  ossimRgbVector color;
76  const ossimRgbVector null_color (theTile->getNullPix(0), theTile->getNullPix(1), theTile->getNullPix(2));
77  double index;
78  std::map<double, ossimRgbVector>::const_iterator lut_entry;
79  double null_index = theInputConnection->getNullPixelValue();
80 
81  for (ossim_uint32 pixel=0; pixel<maxLength; ++pixel)
82  {
83  // Convert input pixel to a double index value:
84  switch(tile->getScalarType())
85  {
86  case OSSIM_DOUBLE:
87  index = ((double*) tile->getBuf())[pixel];
88  break;
89  case OSSIM_SSHORT16:
90  index = (double)(((ossim_sint16*) tile->getBuf())[pixel]);
91  break;
92  case OSSIM_FLOAT:
94  index = (double)(((float*) tile->getBuf())[pixel]);
95  break;
96  case OSSIM_UCHAR:
97  index = (double)(((ossim_uint8*) tile->getBuf())[pixel]);
98  break;
99  case OSSIM_USHORT16:
100  case OSSIM_USHORT11:
101  case OSSIM_USHORT12:
102  case OSSIM_USHORT13:
103  case OSSIM_USHORT14:
104  case OSSIM_USHORT15:
105  index = (double)(((ossim_uint16*) tile->getBuf())[pixel]);
106  break;
107  default:
108  break;
109  }
110 
111  // Do not remap null pixels, leave the output pixel "blank" which is null-pixel value:
112  if (index == null_index)
113  continue;
114 
115  // REGULAR mode needs to clamp the indices to min max for non-null pixels:
116  if (theMode == REGULAR)
117  {
118  if (index < theMinValue)
119  index = theMinValue;
120  else if (index > theMaxValue)
121  index = theMaxValue;
122  }
123 
124  // Now perform look-up depending on mode:
125  if (theMode == LITERAL)
126  {
127  lut_entry = theLut.find(index);
128  if (lut_entry == theLut.end())
129  color = null_color;
130  else
131  color = lut_entry->second;
132  }
133  else
134  {
135  // Vertices and Regular mode perform same interpolation here between the line segments
136  // vertices:
137  lut_entry = theLut.find(index);
138  if (lut_entry != theLut.end())
139  {
140  // Got exact match, no interpolation needed:
141  color = lut_entry->second;
142  }
143  else
144  {
145  lut_entry = theLut.upper_bound(index);
146  if ((lut_entry == theLut.end()) || (lut_entry == theLut.begin()))
147  color = null_color;
148  else
149  {
150  // Need to linearly interpolate:
151  double index_hi = lut_entry->first;
152  ossimRgbVector color_hi (lut_entry->second);
153  --lut_entry;
154  double index_lo = lut_entry->first;
155  ossimRgbVector color_lo (lut_entry->second);
156  double w_lo = (index_hi - index)/(index_hi - index_lo);
157  double w_hi = 1.0 - w_lo;
158  color.setR(ossim::round<ossim_uint8, double>( color_hi.getR()*w_hi + color_lo.getR()*w_lo ));
159  color.setG(ossim::round<ossim_uint8, double>( color_hi.getG()*w_hi + color_lo.getG()*w_lo ));
160  color.setB(ossim::round<ossim_uint8, double>( color_hi.getB()*w_hi + color_lo.getB()*w_lo ));
161  }
162  }
163  }
164 
165  // Assign this output pixel:
166  outBuf[0][pixel] = color.getR();
167  outBuf[1][pixel] = color.getG();
168  outBuf[2][pixel] = color.getB();
169 
170  } // end loop over tile's pixels
171 
172  theTile->validate();
173  return theTile;
174 }
16 bit unsigned integer (15 bits used)
virtual ossim_uint32 getWidth() const
unsigned char getR() const
virtual void setImageRectangle(const ossimIrect &rect)
void allocate()
Called on first getTile, will initialize all data needed.
void setR(unsigned char R)
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual ossim_uint32 getHeight() const
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
unsigned short ossim_uint16
void setB(unsigned char B)
virtual ossimDataObjectStatus validate() const
signed short ossim_sint16
ossimImageSource * theInputConnection
unsigned int ossim_uint32
virtual const ossim_float64 * getNullPix() const
32 bit normalized floating point
unsigned char getB() const
void setG(unsigned char G)
unsigned char getG() const
virtual ossimScalarType getScalarType() const
virtual void makeBlank()
Initializes data to null pixel values.
16 bit unsigned integer (11 bits used)
virtual const void * getBuf() const
std::map< double, ossimRgbVector > theLut
32 bit floating point
ossimRefPtr< ossimImageData > theTile
16 bit unsigned iteger
64 bit floating point
16 bit signed integer
unsigned char ossim_uint8
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.
8 bit unsigned iteger
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)
16 bit unsigned integer (12 bits used)

◆ initialize()

void ossimIndexToRgbLutFilter::initialize ( )
virtual

Reimplemented from ossimImageSourceFilter.

Definition at line 187 of file ossimIndexToRgbLutFilter.cpp.

References ossimImageSource::getMaxPixelValue(), ossimImageSource::getMinPixelValue(), ossimImageSourceFilter::initialize(), ossimImageSource::initialize(), ossimImageSourceFilter::theInputConnection, theMaxValue, theMaxValueOverride, theMinValue, theMinValueOverride, and theTile.

Referenced by ossimPointCloudTool::execute().

188 {
189  // This assigns theInputConnection if one is there.
191 
192  // theTile will get allocated on first getTile call.
193  theTile = 0;
194 
195  if ( theInputConnection )
196  {
197  // Initialize the chain on the left hand side of us.
204  swap(theMinValue, theMaxValue);
205  }
206 }
virtual double getMinPixelValue(ossim_uint32 band=0) const
Returns the min pixel of the band.
ossimImageSource * theInputConnection
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
virtual void initialize()=0
ossimRefPtr< ossimImageData > theTile

◆ initializeLut()

bool ossimIndexToRgbLutFilter::initializeLut ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)
protected

Definition at line 313 of file ossimIndexToRgbLutFilter.cpp.

References ossimString::chars(), ossimString::empty(), ossimKeywordlist::find(), ossimString::length(), LITERAL, ossimNotify(), ossimNotifyLevel_WARN, REGULAR, ossimRgbVector::setB(), ossimRgbVector::setG(), ossimRgbVector::setR(), ossimString::split(), theLut, theMaxValue, theMinValue, theMode, ossimString::toDouble(), ossimString::toString(), and VERTICES.

314 {
315  theLut.clear();
316 
317  const ossimString entry_kw ("entry");
318  ossimString keyword, base_keyword;
319  ossimString indexStr, rgbStr;
320  ossimString blank(" ");
321  std::vector<ossimString> rgbList;
322  double index;
323  ossimRgbVector rgbVector (0,0,0);
324  bool rtn_state = true;
325 
326  ossim_uint32 numEntries=0;
327  while (true)
328  {
329  base_keyword = entry_kw + ossimString::toString(numEntries);
330  if ((theMode == LITERAL) || (theMode == VERTICES))
331  {
332  // Index and color are subentries for this mode:
333  keyword = base_keyword + ".index";
334  indexStr = kwl->find(prefix, keyword.chars());
335  if (indexStr.empty())
336  break;
337 
338  index = indexStr.toDouble();
339  keyword = base_keyword + ".color";
340  rgbStr = kwl->find(prefix, keyword.chars());
341  }
342  else
343  {
344  // REGULAR mode: index is computed later to arrive at equally-spaced vertices. For now,
345  // just store entry number as index:
346  index = (double) numEntries;
347  keyword = base_keyword;
348  rgbStr = kwl->find(prefix, keyword.chars());
349  if (rgbStr.empty())
350  {
351  // Perhaps old bloated form with separate keywords for R, G, B
352  rgbStr = kwl->find(prefix, (keyword + ".r").chars());
353  rgbStr += " ";
354  rgbStr += kwl->find(prefix, (keyword + ".g").chars());
355  rgbStr += " ";
356  rgbStr += kwl->find(prefix, (keyword + ".b").chars());
357  if (rgbStr.length() < 5)
358  break;
359  }
360  }
361 
362  rgbStr.split(rgbList, blank, true);
363  if (rgbList.size() != 3)
364  {
365  ossimNotify(ossimNotifyLevel_WARN)<<"ossimIndexToRgbLutFilter::initializeLut() -- "
366  "Bad color specification in LUT KWL. LUT is not properly initialized."<<endl;
367  return false;
368  }
369 
370  rgbVector.setR(rgbList[0].toUInt8());
371  rgbVector.setG(rgbList[1].toUInt8());
372  rgbVector.setB(rgbList[2].toUInt8());
373  theLut.insert(std::pair<double, ossimRgbVector>(index, rgbVector));
374  rgbList.clear();
375  ++numEntries;
376  }
377 
378  // For REGULAR mode, need to adjust the indices to reflect a piecewise linear LUT with equally
379  // spaced vertices:
380  if (theMode == REGULAR)
381  {
382  std::map<double, ossimRgbVector> orig_lut = theLut;
383  std::map<double, ossimRgbVector>::iterator iter = orig_lut.begin();
384  theLut.clear();
385 
386  if (numEntries == 1)
387  {
388  // Insert the implied start index at black and endpoint at specified color:
389  theLut.insert(std::pair<double, ossimRgbVector>(theMinValue, ossimRgbVector (1, 1, 1)));
390  theLut.insert(std::pair<double, ossimRgbVector>(theMaxValue, iter->second));
391  }
392  else
393  {
394  // Loop to create equally-spaced vertices between min and max index values:
395  double interval = (theMaxValue - theMinValue) / (numEntries - 1);
396  while (iter != orig_lut.end())
397  {
398  index = theMinValue + iter->first*interval;
399  theLut.insert(std::pair<double, ossimRgbVector>(index, iter->second));
400  ++iter;
401  }
402  }
403  }
404 
405  return rtn_state;
406 }
const char * find(const char *key) const
static ossimString toString(bool aValue)
Numeric to string methods.
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.
std::string::size_type length() const
Definition: ossimString.h:408
unsigned int ossim_uint32
const char * chars() const
For backward compatibility.
Definition: ossimString.h:77
double toDouble() const
bool empty() const
Definition: ossimString.h:411
std::map< double, ossimRgbVector > theLut
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ loadState()

bool ossimIndexToRgbLutFilter::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 267 of file ossimIndexToRgbLutFilter.cpp.

References ossimKeywordlist::find(), and theLutFile.

Referenced by ossimPointCloudTool::execute(), and setLut().

268 {
269  bool return_state = true;
270  ossimKeywordlist* kwl = new ossimKeywordlist(orig_kwl); // need non-const copy
271 
272  // First look for a LUT filename, and add its contents to the original KWL:
273  theLutFile = kwl->find(prefix, LUT_FILE_KW);
274  if (!theLutFile.empty())
275  {
276  // Need new (non const) KWL to hold merged contents, maintaining proper prefix if any:
277  ossimKeywordlist lut_kwl;
278  if (lut_kwl.addFile(theLutFile))
279  kwl->add(prefix, lut_kwl, false); // appends all entries of lut_kwl with prefix before adding
280  }
281 
282  theMinValueOverride = false;
283  ossimString lookup = kwl->find(prefix, MIN_VALUE_KW);
284  if(!lookup.empty())
285  {
286  theMinValue =lookup.toDouble();
287  theMinValueOverride = true;
288  }
289 
290  theMaxValueOverride = false;
291  lookup = kwl->find(prefix, MAX_VALUE_KW);
292  if(!lookup.empty())
293  {
294  theMaxValue = lookup.toDouble();
295  theMaxValueOverride = true;
296  }
297 
298  lookup = kwl->find(prefix, MODE_KW);
299  if (lookup.contains("literal"))
300  theMode = LITERAL;
301  else if (lookup.contains("vertices"))
302  theMode = VERTICES;
303  else
304  theMode = REGULAR;
305 
306  return_state &= initializeLut(kwl, prefix);
307  return_state &= ossimImageSourceFilter::loadState(orig_kwl, prefix);
308 
309  delete kwl;
310  return return_state;
311 }
Represents serializable keyword/value map.
bool addFile(const char *file)
const char * find(const char *key) const
bool contains(char aChar) const
Definition: ossimString.h:58
bool initializeLut(const ossimKeywordlist *kwl, const char *prefix=0)
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
double toDouble() const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
bool empty() const
Definition: ossimString.h:411

◆ saveState()

bool ossimIndexToRgbLutFilter::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 208 of file ossimIndexToRgbLutFilter.cpp.

References ossimKeywordlist::add(), and theMinValueOverride.

209 {
211  kwl.add(prefix, MIN_VALUE_KW, theMinValue, true);
212 
214  kwl.add(prefix, MAX_VALUE_KW, theMaxValue, true);
215 
216  ossimString value;
217  switch (theMode)
218  {
219  case LITERAL:
220  value = "literal";
221  break;
222  case VERTICES:
223  value = "vertices";
224  break;
225  default:
226  value = "regular";
227  }
228  kwl.add(prefix, MODE_KW, value.c_str(), true);
229 
230  bool rtn_stat = true;
231 
232  // Save the actual LUT:
233  const ossimString entry_kw ("entry");
234  ossimString color_keyword, base_keyword;
235  ossimRgbVector rgbVector;
236  ossimString blank(" ");
237 
238  ossim_uint32 entry = 0;
239  std::map<double, ossimRgbVector>::const_iterator iter = theLut.begin();
240  while (iter != theLut.end())
241  {
242  base_keyword = entry_kw + ossimString::toString(entry);
243  if ((theMode == LITERAL) || (theMode == VERTICES))
244  {
245  // Index and color are sub-entries for these modes:
246  kwl.add(prefix, (base_keyword+".index").chars(), iter->first);
247  color_keyword = base_keyword + ".color";
248  }
249  else
250  {
251  color_keyword = base_keyword;
252  }
253 
254  rgbVector = iter->second;
255  value = ossimString::toString((int)rgbVector.getR()) + blank +
256  ossimString::toString((int)rgbVector.getG()) + blank +
257  ossimString::toString((int)rgbVector.getB());
258  kwl.add(prefix, color_keyword.chars(), value.chars());
259  ++iter;
260  ++entry;
261  }
262 
263  rtn_stat &= ossimImageSourceFilter::saveState(kwl, prefix);
264  return rtn_stat;
265 }
unsigned char getR() const
static ossimString toString(bool aValue)
Numeric to string methods.
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
unsigned int ossim_uint32
const char * chars() const
For backward compatibility.
Definition: ossimString.h:77
unsigned char getB() const
unsigned char getG() const
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
std::map< double, ossimRgbVector > theLut

◆ setLut()

void ossimIndexToRgbLutFilter::setLut ( const ossimFilename file)

Set lookup table(lut) method.

This opens the keyword list and initializes lut.

CAUTION: Requires theMinValue, theMaxValue, and theMode to be set. Typically a connection is made prior to this call. If not connected to an input, "min", "max" and "mode" keywords should be passed in the keyword list file.

Parameters
fileKeyword list containing lut.

Definition at line 427 of file ossimIndexToRgbLutFilter.cpp.

References ossimFilename::exists(), loadState(), and theLutFile.

428 {
429  theLutFile = file;
430  if(file.exists())
431  {
433  loadState(kwl);
434  }
435 }
Represents serializable keyword/value map.
bool exists() const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=NULL)
Method to the load (recreate) the state of an object from a keyword list.

◆ setMaxValue()

void ossimIndexToRgbLutFilter::setMaxValue ( double  value)

Definition at line 452 of file ossimIndexToRgbLutFilter.cpp.

References theMaxValue.

453 {
454  theMaxValue = value;
455 }

◆ setMinValue()

void ossimIndexToRgbLutFilter::setMinValue ( double  value)

Definition at line 447 of file ossimIndexToRgbLutFilter.cpp.

References theMinValue.

448 {
449  theMinValue = value;
450 }

◆ setMode()

void ossimIndexToRgbLutFilter::setMode ( Mode  mode)
inline

Definition at line 119 of file ossimIndexToRgbLutFilter.h.

Member Data Documentation

◆ theLut

std::map<double, ossimRgbVector> ossimIndexToRgbLutFilter::theLut
protected

Definition at line 158 of file ossimIndexToRgbLutFilter.h.

Referenced by getTile(), and initializeLut().

◆ theLutFile

ossimFilename ossimIndexToRgbLutFilter::theLutFile
protected

Definition at line 166 of file ossimIndexToRgbLutFilter.h.

Referenced by loadState(), and setLut().

◆ theMaxValue

double ossimIndexToRgbLutFilter::theMaxValue
protected

◆ theMaxValueOverride

bool ossimIndexToRgbLutFilter::theMaxValueOverride
protected

Definition at line 163 of file ossimIndexToRgbLutFilter.h.

Referenced by initialize().

◆ theMinValue

double ossimIndexToRgbLutFilter::theMinValue
protected

◆ theMinValueOverride

bool ossimIndexToRgbLutFilter::theMinValueOverride
protected

Definition at line 162 of file ossimIndexToRgbLutFilter.h.

Referenced by initialize(), and saveState().

◆ theMode

Mode ossimIndexToRgbLutFilter::theMode
protected

Definition at line 164 of file ossimIndexToRgbLutFilter.h.

Referenced by getTile(), and initializeLut().

◆ theTile

ossimRefPtr<ossimImageData> ossimIndexToRgbLutFilter::theTile
protected

Definition at line 165 of file ossimIndexToRgbLutFilter.h.

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


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