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

#include <ossimLinearStretchRemapper.h>

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

Public Member Functions

 ossimLinearStretchRemapper ()
 
virtual ~ossimLinearStretchRemapper ()
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIrect &origin, ossim_uint32 resLevel=0)
 
void setMinPixelValue (double value, ossim_uint32 band=0)
 
void setMaxPixelValue (double value, ossim_uint32 band=0)
 
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...
 
virtual ossimScalarType getOutputScalarType () const
 This will be used to query the output pixel type of the tile source. 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 getNumberOfOutputBands () const
 Returns the number of bands in a tile returned from this TileSource. 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 double getNullPixelValue (ossim_uint32 band=0) const
 Each band has a null pixel associated with it. 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...
 
- 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::vector< double > m_minValues
 
std::vector< double > m_maxValues
 
ossimRefPtr< ossimImageDatam_tile
 
- 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
 

Additional Inherited Members

- Public Types inherited from ossimConnectableObject
enum  ossimConnectableObjectDirectionType { CONNECTABLE_DIRECTION_NONE = 0, CONNECTABLE_DIRECTION_INPUT = 1, CONNECTABLE_DIRECTION_OUTPUT = 2 }
 
typedef std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
 

Detailed Description

Definition at line 34 of file ossimLinearStretchRemapper.h.

Constructor & Destructor Documentation

◆ ossimLinearStretchRemapper()

ossimLinearStretchRemapper::ossimLinearStretchRemapper ( )

Definition at line 26 of file ossimLinearStretchRemapper.cpp.

References ossimConnectableObject::setDescription().

27 {
28  setDescription("Remaps input from min-max to full range (0-1) of normalized float..");
29 }
virtual void setDescription(const ossimString &description)

◆ ~ossimLinearStretchRemapper()

ossimLinearStretchRemapper::~ossimLinearStretchRemapper ( )
virtual

Definition at line 31 of file ossimLinearStretchRemapper.cpp.

32 {
33 }

Member Function Documentation

◆ allocate()

void ossimLinearStretchRemapper::allocate ( )
protected

Called on first getTile, will initialize all data needed.

Definition at line 120 of file ossimLinearStretchRemapper.cpp.

References ossimImageDataFactory::create(), ossimImageSource::getNumberOfOutputBands(), ossimImageSource::getTileHeight(), ossimImageSource::getTileWidth(), ossimImageData::initialize(), ossimImageDataFactory::instance(), m_tile, OSSIM_NORMALIZED_DOUBLE, ossimImageSourceFilter::theInputConnection, and ossimRefPtr< T >::valid().

Referenced by initialize().

121 {
122  if(!theInputConnection)
123  return;
124 
130  if(m_tile.valid())
131  {
132  m_tile->initialize();
133  }
134 }
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.
virtual void initialize()
Initialize the data buffer.
virtual ossim_uint32 getTileWidth() const
Returns the default processing tile width.
static ossimImageDataFactory * instance()
ossimImageSource * theInputConnection
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
64 bit normalized floating point
ossimRefPtr< ossimImageData > m_tile

◆ getMaxPixelValue()

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

Returns the max pixel of the band.

Reimplemented from ossimImageSource.

Definition at line 215 of file ossimLinearStretchRemapper.cpp.

References m_maxValues, and ossim::nan().

216 {
217  if (band< m_maxValues.size())
218  return m_maxValues[band];
219  return ossim::nan();
220 }
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135

◆ getMinPixelValue()

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

Returns the min pixel of the band.

Reimplemented from ossimImageSource.

Definition at line 208 of file ossimLinearStretchRemapper.cpp.

References m_minValues, and ossim::nan().

209 {
210  if (band< m_minValues.size())
211  return m_minValues[band];
212  return ossim::nan();
213 }
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135

◆ getOutputScalarType()

virtual ossimScalarType ossimLinearStretchRemapper::getOutputScalarType ( ) const
inlinevirtual

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 56 of file ossimLinearStretchRemapper.h.

References OSSIM_NORMALIZED_DOUBLE.

56 { return OSSIM_NORMALIZED_DOUBLE; }
64 bit normalized floating point

◆ getTile()

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

Reimplemented from ossimImageSource.

Definition at line 35 of file ossimLinearStretchRemapper.cpp.

References ossimImageData::getBuf(), ossimDataObject::getDataObjectStatus(), ossimImageData::getDoubleBuf(), ossimImageData::getFloatBuf(), ossimImageData::getHeight(), ossimImageSource::getNullPixelValue(), ossimImageSource::getNumberOfOutputBands(), ossimRectilinearDataObject::getScalarType(), ossimImageData::getSshortBuf(), ossimImageSource::getTile(), ossimImageData::getUcharBuf(), ossimImageData::getUshortBuf(), ossimImageData::getWidth(), initialize(), m_maxValues, m_minValues, m_tile, ossimImageData::makeBlank(), OSSIM_DOUBLE, OSSIM_EMPTY, OSSIM_FLOAT, OSSIM_NORMALIZED_DOUBLE, OSSIM_NORMALIZED_FLOAT, OSSIM_SSHORT16, OSSIM_UCHAR, OSSIM_USHORT11, OSSIM_USHORT12, OSSIM_USHORT13, OSSIM_USHORT14, OSSIM_USHORT15, OSSIM_USHORT16, ossimImageData::setImageRectangle(), ossimSource::theEnableFlag, ossimImageSourceFilter::theInputConnection, and ossimImageData::validate().

37 {
39  return 0;
40 
41  ossimRefPtr<ossimImageData> tile = theInputConnection->getTile(tileRect, resLevel);
42  if ( !theEnableFlag )
43  return tile;
44 
45  if (!tile || !tile->getBuf())
46  return 0;
47  if(!m_tile)
48  {
49  initialize();
50  if (!m_tile)
51  return 0;
52  }
53 
54  m_tile->setImageRectangle(tileRect);
55  m_tile->makeBlank();
56 
57  // Quick handling special case of empty input tile:
58  if (tile->getDataObjectStatus() == OSSIM_EMPTY)
59  return m_tile;
60 
61  ossim_uint32 maxLength = tile->getWidth()*tile->getHeight();
62  double pixel;
63  double null_pixel = theInputConnection->getNullPixelValue();
64 
66  for (int i=0; i<numBands; ++i)
67  {
68  double delta = m_maxValues[i] - m_minValues[i];
69  if (delta == 0)
70  continue;
71  double* outBuf = m_tile->getDoubleBuf(i);
72  for (ossim_uint32 offset=0; offset<maxLength; ++offset)
73  {
74  // Convert input pixel to a double index value:
75  switch(tile->getScalarType())
76  {
77  case OSSIM_DOUBLE:
79  pixel = tile->getDoubleBuf(i)[offset];
80  break;
81  case OSSIM_SSHORT16:
82  pixel = (double)(tile->getSshortBuf(i)[offset]);
83  break;
84  case OSSIM_FLOAT:
86  pixel = (double)(tile->getFloatBuf(i)[offset]);
87  break;
88  case OSSIM_UCHAR:
89  pixel = (double)(tile->getUcharBuf(i)[offset]);
90  break;
91  case OSSIM_USHORT16:
92  case OSSIM_USHORT11:
93  case OSSIM_USHORT12:
94  case OSSIM_USHORT13:
95  case OSSIM_USHORT14:
96  case OSSIM_USHORT15:
97  pixel = (double)(tile->getUshortBuf(i)[offset]);
98  break;
99  default:
100  break;
101  }
102 
103  // Do not remap null pixels, leave the output pixel "blank" which is null-pixel value:
104  if (pixel == null_pixel)
105  continue;
106 
107  // Do linear remap:
108  pixel = (pixel-m_minValues[i])/delta;
109  if (pixel < 0.0)
110  pixel = 0.0;
111  if (pixel > 1.0)
112  pixel = 1.0;
113  outBuf[offset] = pixel;
114  }
115  }
116  m_tile->validate();
117  return m_tile;
118 }
16 bit unsigned integer (15 bits used)
virtual ossim_uint32 getWidth() const
virtual void setImageRectangle(const ossimIrect &rect)
virtual const ossim_uint16 * getUshortBuf() const
virtual const ossim_uint8 * getUcharBuf() const
bool theEnableFlag
Definition: ossimSource.h:62
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual ossim_uint32 getHeight() const
16 bit unsigned integer (14 bits used)
16 bit unsigned integer (13 bits used)
virtual const ossim_sint16 * getSshortBuf() const
virtual ossimDataObjectStatus validate() const
ossimImageSource * theInputConnection
unsigned int ossim_uint32
32 bit normalized floating point
virtual const ossim_float32 * getFloatBuf() const
virtual ossimScalarType getScalarType() const
virtual void makeBlank()
Initializes data to null pixel values.
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
virtual const void * getBuf() const
ossimRefPtr< ossimImageData > m_tile
32 bit floating point
16 bit unsigned iteger
64 bit floating point
16 bit signed integer
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)
virtual const ossim_float64 * getDoubleBuf() const

◆ initialize()

void ossimLinearStretchRemapper::initialize ( )
virtual

Reimplemented from ossimImageSourceFilter.

Definition at line 136 of file ossimLinearStretchRemapper.cpp.

References allocate(), ossimImageSource::getMaxPixelValue(), ossimImageSource::getMinPixelValue(), ossimImageSource::getNumberOfOutputBands(), ossimImageSourceFilter::initialize(), m_maxValues, m_minValues, m_tile, and ossimImageSourceFilter::theInputConnection.

Referenced by getTile().

137 {
138  // This assigns theInputConnection if one is there.
140 
141  m_tile = 0;
142  if ( theInputConnection )
143  {
144  // Initialize the chain on the left hand side of us.
145  //theInputConnection->initialize(); This is done by base class
146  int numBands = theInputConnection->getNumberOfOutputBands();
147  if ((m_minValues.size() != numBands) && (m_maxValues.size() != numBands))
148  {
149  m_minValues.resize(numBands);
150  m_maxValues.resize(numBands);
151  for (int i=0; i<numBands; ++i)
152  {
155  }
156  }
157  allocate();
158  }
159 }
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
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.
ossimRefPtr< ossimImageData > m_tile
void allocate()
Called on first getTile, will initialize all data needed.

◆ loadState()

bool ossimLinearStretchRemapper::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 182 of file ossimLinearStretchRemapper.cpp.

References ossimKeywordlist::find(), m_maxValues, and m_minValues.

183 {
184  bool return_state = true;
185  m_minValues.clear();
186  m_maxValues.clear();
187 
188  vector<ossimString> minimums;
189  vector<ossimString> maximums;
190  ossimString minVals = kwl.find(prefix, MIN_VALUE_KW);
191  ossimString maxVals = kwl.find(prefix, MAX_VALUE_KW);
192  if(!minVals.empty() && !maxVals.empty())
193  {
194  minimums = minVals.split(" ");
195  maximums = maxVals.split(" ");
196  if (minimums.size() != maximums.size())
197  return false;
198 
199  for (int i=0; i<minimums.size(); ++i)
200  {
201  m_minValues[i] = minimums[i].toDouble();
202  m_maxValues[i] = maximums[i].toDouble();
203  }
204  }
205  return true;
206 }
const char * find(const char *key) const
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 empty() const
Definition: ossimString.h:411

◆ saveState()

bool ossimLinearStretchRemapper::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 161 of file ossimLinearStretchRemapper.cpp.

References ossimKeywordlist::add(), m_maxValues, and m_minValues.

162 {
163  bool rtn_stat = true;
164  ostringstream minstr, maxstr;
165  int numBands = m_minValues.size();
166  if ((numBands == 0) || (numBands != m_maxValues.size()))
167  rtn_stat = false;
168 
169  for (int i=0; i<numBands; ++i)
170  {
171  minstr << " " << m_minValues[i];
172  maxstr << " " << m_maxValues[i];
173  }
174 
175  kwl.add(prefix, MIN_VALUE_KW, minstr.str().c_str(), true);
176  kwl.add(prefix, MAX_VALUE_KW, maxstr.str().c_str(), true);
177 
178  rtn_stat &= ossimImageSourceFilter::saveState(kwl, prefix);
179  return rtn_stat;
180 }
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.

◆ setMaxPixelValue()

void ossimLinearStretchRemapper::setMaxPixelValue ( double  value,
ossim_uint32  band = 0 
)

Definition at line 229 of file ossimLinearStretchRemapper.cpp.

References m_maxValues.

230 {
231  if (m_maxValues.size() <= band)
232  m_maxValues.resize(band+1);
233  m_maxValues[band] = value;
234 }

◆ setMinPixelValue()

void ossimLinearStretchRemapper::setMinPixelValue ( double  value,
ossim_uint32  band = 0 
)

Definition at line 222 of file ossimLinearStretchRemapper.cpp.

References m_minValues.

223 {
224  if (m_minValues.size() <= band)
225  m_minValues.resize(band+1);
226  m_minValues[band] = value;
227 }

Member Data Documentation

◆ m_maxValues

std::vector<double> ossimLinearStretchRemapper::m_maxValues
protected

◆ m_minValues

std::vector<double> ossimLinearStretchRemapper::m_minValues
protected

◆ m_tile

ossimRefPtr<ossimImageData> ossimLinearStretchRemapper::m_tile
protected

Definition at line 67 of file ossimLinearStretchRemapper.h.

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


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