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

#include <ossimGammaRemapper.h>

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

Public Member Functions

 ossimGammaRemapper (ossimObject *owner=NULL)
 
 ossimGammaRemapper (ossimImageSource *inputSource)
 
 ossimGammaRemapper (ossimObject *owner, ossimImageSource *inputSource)
 
virtual ossimString getShortName () const
 
virtual void initialize ()
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIrect &tile_rect, ossim_uint32 resLevel=0)
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual ostream & print (ostream &os) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
void setMinMaxPixelValues (const vector< double > &v_min, const vector< double > &v_max)
 
virtual void enableSource ()
 
- 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
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Method to save the state of an object to a keyword list. More...
 
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 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 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 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 disableSource ()
 
virtual bool getEnableFlag () const
 
virtual void setEnableFlag (bool flag)
 
virtual bool isInitialized () const
 
virtual void setInitializedFlag (bool flag)
 
- 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 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

virtual ~ossimGammaRemapper ()
 
void verifyEnabled ()
 
- 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< ossimImageDatatheTile
 
double * theBuffer
 
vector< double > theMinPixelValue
 
vector< double > theMaxPixelValue
 
vector< double > theGamma
 
bool theUserDisabledFlag
 
- 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
 

Friends

ostream & operator<< (ostream &os, const ossimGammaRemapper &hr)
 

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 21 of file ossimGammaRemapper.h.

Constructor & Destructor Documentation

◆ ossimGammaRemapper() [1/3]

ossimGammaRemapper::ossimGammaRemapper ( ossimObject owner = NULL)

Definition at line 36 of file ossimGammaRemapper.cpp.

References ossimSource::disableSource().

37  :
38  ossimImageSourceFilter (owner), // base class
39  theTile (NULL),
40  theBuffer (NULL),
41  theMinPixelValue (0),
42  theMaxPixelValue (0),
43  theGamma (0),
44  theUserDisabledFlag (false)
45 {
46  //***
47  // Set the base class "theEnableFlag" to off since no adjustments have been
48  // made yet.
49  //***
50  disableSource();
51 
52  // Construction not complete.
53 }
ossimImageSourceFilter(ossimObject *owner=NULL)
virtual void disableSource()
Definition: ossimSource.cpp:89
vector< double > theGamma
vector< double > theMinPixelValue
vector< double > theMaxPixelValue
ossimRefPtr< ossimImageData > theTile

◆ ossimGammaRemapper() [2/3]

ossimGammaRemapper::ossimGammaRemapper ( ossimImageSource inputSource)

Definition at line 56 of file ossimGammaRemapper.cpp.

References ossimSource::disableSource(), initialize(), and ossimErrorStatusInterface::setErrorStatus().

57  :
58  ossimImageSourceFilter (NULL, inputSource), // base class
59  theTile (NULL),
60  theBuffer (NULL),
61  theMinPixelValue (0),
62  theMaxPixelValue (0),
63  theGamma (0),
64  theUserDisabledFlag (false)
65 {
66  //***
67  // Set the base class "theEnableFlag" to off since no adjustments have been
68  // made yet.
69  //***
70  disableSource();
71 
72  if (inputSource == NULL)
73  {
75  cerr << "ossimGammaRemapper::ossimGammaRemapper ERROR:"
76  << "\nNull input source passed to constructor!" << endl;
77  return;
78  }
79 
80  initialize();
81 }
ossimImageSourceFilter(ossimObject *owner=NULL)
virtual void disableSource()
Definition: ossimSource.cpp:89
vector< double > theGamma
vector< double > theMinPixelValue
vector< double > theMaxPixelValue
ossimRefPtr< ossimImageData > theTile

◆ ossimGammaRemapper() [3/3]

ossimGammaRemapper::ossimGammaRemapper ( ossimObject owner,
ossimImageSource inputSource 
)

Definition at line 84 of file ossimGammaRemapper.cpp.

References ossimSource::disableSource(), initialize(), and ossimErrorStatusInterface::setErrorStatus().

86  :
87  ossimImageSourceFilter (owner, inputSource), // base class
88  theTile (NULL),
89  theBuffer (NULL),
90  theMinPixelValue (0),
91  theMaxPixelValue (0),
92  theGamma (0)
93 {
94  //***
95  // Set the base class "theEnableFlag" to off since no adjustments have been
96  // made yet.
97  //***
98  disableSource();
99 
100  if (inputSource == NULL)
101  {
102  setErrorStatus();
103  cerr << "ossimGammaRemapper::ossimGammaRemapper ERROR:"
104  << "\nNull input source passed to constructor!" << endl;
105  return;
106  }
107 
108  initialize();
109 }
ossimImageSourceFilter(ossimObject *owner=NULL)
virtual void disableSource()
Definition: ossimSource.cpp:89
vector< double > theGamma
vector< double > theMinPixelValue
vector< double > theMaxPixelValue
ossimRefPtr< ossimImageData > theTile

◆ ~ossimGammaRemapper()

ossimGammaRemapper::~ossimGammaRemapper ( )
protectedvirtual

Definition at line 111 of file ossimGammaRemapper.cpp.

References theBuffer.

112 {
113  if (theBuffer)
114  {
115  delete [] theBuffer;
116  theBuffer = NULL;
117  }
118 }

Member Function Documentation

◆ enableSource()

void ossimGammaRemapper::enableSource ( )
virtual

Reimplemented from ossimSource.

Definition at line 419 of file ossimGammaRemapper.cpp.

References ossimSource::enableSource(), and theUserDisabledFlag.

Referenced by verifyEnabled().

420 {
421  // Clear the flag...
422  theUserDisabledFlag = false;
424 }
virtual void enableSource()
Definition: ossimSource.cpp:84

◆ getShortName()

ossimString ossimGammaRemapper::getShortName ( ) const
virtual

Reimplemented from ossimObject.

Definition at line 426 of file ossimGammaRemapper.cpp.

427 {
428  return ossimString("Gamma Remapper");
429 }

◆ getTile()

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

Reimplemented from ossimImageSource.

Definition at line 120 of file ossimGammaRemapper.cpp.

References ossimImageData::copyNormalizedBufferToTile(), ossimImageData::copyTileToNormalizedBuffer(), ossimDataObject::getDataObjectStatus(), ossimImageData::getHeight(), ossimImageData::getMinNormalizedPix(), ossimImageData::getNumberOfBands(), ossimImageData::getSizePerBand(), ossimImageSource::getTile(), ossimImageData::getWidth(), ossimIrect::height(), ossimImageData::initialize(), ossimSource::isInitialized(), ossimImageData::makeBlank(), OSSIM_EMPTY, OSSIM_NULL, ossimDataObject::setDataObjectStatus(), ossimImageData::setOrigin(), ossimImageData::setWidthHeight(), theBuffer, ossimSource::theEnableFlag, theGamma, ossimImageSourceFilter::theInputConnection, theMaxPixelValue, theMinPixelValue, theTile, ossimIrect::ul(), ossimRefPtr< T >::valid(), and ossimIrect::width().

122 {
123  if (!isInitialized())
124  {
125  cerr << "ossimGammaRemapper::getTile ERROR:"
126  << "\nNot initialized!"
127  << endl;
129  }
130 
131  // Fetch tile from pointer from the input source.
133  tile_rect, resLevel);
134 
135  if (!inputTile.valid()) // Just in case...
136  {
137  cerr << "ossimGammaRemapper::getTile ERROR:"
138  << "\nReceived null pointer to tile from input source!"
139  << "\nReturning blank tile."
140  << endl;
141  theTile->makeBlank();
142  return theTile;
143  }
144 
145  // Get its status.
146  ossimDataObjectStatus tile_status = inputTile->getDataObjectStatus();
147 
148  //---
149  // Check for remap bypass:
150  //---
151  if (!theEnableFlag || tile_status == OSSIM_NULL ||!theTile.valid() ||
152  tile_status == OSSIM_EMPTY)
153  {
154  return inputTile;
155  }
156 
157  ossim_uint32 w = tile_rect.width();
158  ossim_uint32 h = tile_rect.height();
159  ossim_uint32 tw = theTile->getWidth();
162 
163  // Set the origin of the output tile.
164  theTile->setOrigin(tile_rect.ul());
165 
166  if(w*h != tw*th)
167  {
168  theTile->setWidthHeight(w, h);
169  theTile->initialize();
170  if(theBuffer)
171  {
172  delete [] theBuffer;
173  theBuffer = NULL;
174  }
175  }
176 
177  if(!theBuffer)
178  {
179  theBuffer = new double[w*h*bands];
180  }
181 
182  // Copy the source tile into the buffer at the same time normalizing it.
184 
185  // for each band, get the radiance value
186 
187  ossim_uint32 buffer_index = 0;
188  const double MP = theTile->getMinNormalizedPix(); // Minimum normalized pix.
189  const ossim_uint32 PPTB = theTile->getSizePerBand(); // Pixels Per Tile Band
190 
191  for (ossim_uint32 band=0; band<bands; ++band)
192  {
193  for (ossim_uint32 i=0; i<PPTB; ++i)
194  {
195  double p = theBuffer[buffer_index]; // input pixel
196  // double p = getPix(buffer_index);
197 
198  if (p)
199  {
200  // cout<<"p before: "<<p<<endl;
201  // Stretch it...
202  p = (p - theMinPixelValue[band]) /
203  (theMaxPixelValue[band] -
204  theMinPixelValue[band]);
205 
206  p = pow(p, theGamma[band]);
207 
208 
209  //***
210  // Since it wasn't null to start with clip / clamp between minimum
211  // normalized pixel and one(max).
212  //***
213  p = ( p > MP ? ( p < 1.0 ? p : 1.0) : MP );
214 
215  theBuffer[buffer_index] = p;
216  }
217  else
218  {
219  theBuffer[buffer_index] = 0.0;
220  }
221 
222  ++buffer_index;
223  }
224  }
225 
226  // Copy the buffer to the output tile at the same time unnormalizing it.
228 
229  // Set the status to that of the input tile.
230  theTile->setDataObjectStatus(tile_status);
231 
232  return theTile;
233 }
virtual ossim_uint32 getWidth() const
virtual bool isInitialized() const
virtual ossim_uint32 getNumberOfBands() const
virtual ossim_float64 getMinNormalizedPix() const
returns normalized minimum pixel value of band zero.
virtual void setWidthHeight(ossim_uint32 w, ossim_uint32 h)
bool theEnableFlag
Definition: ossimSource.h:62
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimDataObjectStatus getDataObjectStatus() const
virtual ossim_uint32 getHeight() const
vector< double > theGamma
virtual void initialize()
Initialize the data buffer.
vector< double > theMinPixelValue
vector< double > theMaxPixelValue
virtual ossim_uint32 getSizePerBand() const
Returns the number of pixels in a single band in a tile.
ossimImageSource * theInputConnection
unsigned int ossim_uint32
virtual void copyTileToNormalizedBuffer(ossim_float64 *buf) const
Copies entire tile to buf passed in.
virtual void copyNormalizedBufferToTile(ossim_float64 *buf)
Copies buf passed in to tile.
virtual void setOrigin(const ossimIpt &origin)
virtual void makeBlank()
Initializes data to null pixel values.
virtual void setDataObjectStatus(ossimDataObjectStatus status) const
Full list found in ossimConstants.h.
ossimDataObjectStatus
Definitions for data object status.
ossimRefPtr< ossimImageData > theTile
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)

◆ initialize()

void ossimGammaRemapper::initialize ( )
virtual

Reimplemented from ossimImageSourceFilter.

Definition at line 235 of file ossimGammaRemapper.cpp.

References ossimErrorStatusInterface::clearErrorStatus(), ossimImageDataFactory::create(), ossimImageData::getHeight(), ossimImageData::getNumberOfBands(), ossimImageData::getWidth(), ossimImageData::initialize(), ossimImageDataFactory::instance(), ossimErrorStatusInterface::setErrorStatus(), ossimSource::setInitializedFlag(), theBuffer, ossimImageSourceFilter::theInputConnection, theTile, and verifyEnabled().

Referenced by ossimGammaRemapper().

236 {
238  {
241  theTile->initialize();
242 
243  if(theBuffer)
244  {
245  delete []theBuffer;
246  theBuffer = NULL;
247  }
248 
249  ossim_uint32 tw = theTile->getWidth();
252 
253  theBuffer = new double[tw*th*bands];
254  memset(theBuffer, '\0', tw*th*bands);
255 
256  setInitializedFlag(true);
258  }
259  else
260  {
261  setInitializedFlag(false);
262  setErrorStatus();
263  cerr << "ossimGammaRemapper::initialize ERROR:"
264  << "\nCannot call method when input connection is NULL!"
265  << endl;
266  };
267 
268  verifyEnabled();
269 }
virtual ossim_uint32 getWidth() const
virtual ossim_uint32 getNumberOfBands() const
virtual ossim_uint32 getHeight() const
virtual void setInitializedFlag(bool flag)
virtual void initialize()
Initialize the data buffer.
static ossimImageDataFactory * instance()
ossimImageSource * theInputConnection
unsigned int ossim_uint32
virtual ossimRefPtr< ossimImageData > create(ossimSource *owner, ossimScalarType scalar, ossim_uint32 bands=1) const
ossimRefPtr< ossimImageData > theTile

◆ loadState()

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

References ossimKeywordNames::ENABLED_KW, ossimKeywordlist::find(), ossimImageData::getNumberOfBands(), ossimSource::theEnableFlag, theGamma, theTile, theUserDisabledFlag, ossimString::toBool(), and ossimString::toString().

309 {
310  //***
311  // Call the base class to pick up the enable flag. Note that the
312  // verifyEnabled flag can override this.
313  //***
314  ossimString pref;
315  if (prefix) pref += prefix;
316  pref += "gamma_remapper.";
317 
318  if (!theTile)
319  {
320  cerr << "ossimGammaRemapper::loadState: ERROR"
321  << "Not initialized yet!" << endl;
322  return false;
323  }
324 
325  //---
326  // NOTE:
327  // base class seems to call initialize which in turn errors if you don't
328  // have a connection yet, so check for the enable keyword here...
329  // ossimSource::loadState(kwl, pref.c_str());
330  //---
331  cout << "pref: " << pref
332  << "kw: " << ossimKeywordNames::ENABLED_KW << endl;
333 
334  const char* lookup = kwl.find(pref, ossimKeywordNames::ENABLED_KW);
335  if(lookup)
336  {
337  theEnableFlag = ossimString(lookup).toBool();
338  if (theEnableFlag == false)
339  {
340  // User want filter disabled...
341  theUserDisabledFlag = true;
342  }
343  }
344 
346 
347  theGamma.clear();
348  theGamma.resize(bands, 1.0);
349 
350  for(ossim_uint32 band = 0; band < bands; ++band)
351  {
352  ossimString band_string = ".band";
353  band_string += ossimString::toString(band+1); // Start at one.
354 
355  ossimString kw = GAMMA_REMAPPER_GAMMA_KW;
356  kw += band_string;
357  lookup = kwl.find(prefix, kw.c_str());
358  if (lookup)
359  {
360  theGamma[band] = atof(lookup);
361  }
362  else
363  {
364  cout << "MODULE NOTICE:"
365  << "\nlookup failed for keyword: " << kw.c_str()
366  << "\nGamma set to " << DEFAULT_GAMMA << " for band: "
367  << (band+1) << endl;
368  theGamma[band] = DEFAULT_GAMMA;
369  }
370  }
371 
372  if (traceDebug())
373  {
374  cout << "ossimGammaRemapper DEBUG:"
375  << *this
376  << endl;
377  }
378 
379  return true;
380 }
virtual ossim_uint32 getNumberOfBands() const
bool theEnableFlag
Definition: ossimSource.h:62
const char * find(const char *key) const
static ossimString toString(bool aValue)
Numeric to string methods.
vector< double > theGamma
bool toBool() const
String to numeric methods.
unsigned int ossim_uint32
static const char * ENABLED_KW
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
ossimRefPtr< ossimImageData > theTile

◆ print()

ostream & ossimGammaRemapper::print ( ostream &  out) const
virtual

Outputs theErrorStatus as an ossimErrorCode and an ossimString.

Returns
std::ostream&
Note
Derived classes should only have to implement a virtual print, not an operator<< funtion as it's implemented here.

Reimplemented from ossimSource.

Definition at line 382 of file ossimGammaRemapper.cpp.

References ossimSource::theEnableFlag, theGamma, theMaxPixelValue, and theMinPixelValue.

Referenced by operator<<().

383 {
384  os << setprecision(15) << setiosflags(ios::fixed)
385  << "ossimGammaRemapper:"
386  << "\ntheEnableFlag: " << (theEnableFlag?"enabled":"disabled")
387  << endl;
388 
389  ossim_uint32 band = 1;
390  vector<double>::const_iterator i = theMinPixelValue.begin();
391  while (i != theMinPixelValue.end())
392  {
393  os << "band[" << band << "] min: " << (*i) << endl;
394  ++i;
395  ++band;
396  }
397 
398  band = 1;
399  i = theMaxPixelValue.begin();
400  while (i != theMaxPixelValue.end())
401  {
402  os << "band[" << band << "] max: " << (*i) << endl;
403  ++i;
404  ++band;
405  }
406 
407  band = 1;
408  i = theGamma.begin();
409  while (i != theGamma.end())
410  {
411  os << "band[" << band << "] gamma: " << (*i) << endl;
412  ++i;
413  ++band;
414  }
415 
416  return os;
417 }
bool theEnableFlag
Definition: ossimSource.h:62
vector< double > theGamma
vector< double > theMinPixelValue
vector< double > theMaxPixelValue
unsigned int ossim_uint32

◆ setMinMaxPixelValues()

void ossimGammaRemapper::setMinMaxPixelValues ( const vector< double > &  v_min,
const vector< double > &  v_max 
)

Definition at line 271 of file ossimGammaRemapper.cpp.

References theMaxPixelValue, theMinPixelValue, and verifyEnabled().

273 {
274  theMinPixelValue = v_min;
275  theMaxPixelValue = v_max;
276  verifyEnabled();
277 }
vector< double > theMinPixelValue
vector< double > theMaxPixelValue

◆ verifyEnabled()

void ossimGammaRemapper::verifyEnabled ( )
protected

Method to set unset the enable flag.

Definition at line 279 of file ossimGammaRemapper.cpp.

References ossimSource::disableSource(), enableSource(), ossimImageData::getNumberOfBands(), theBuffer, ossimImageSourceFilter::theInputConnection, theMaxPixelValue, theMinPixelValue, theTile, and theUserDisabledFlag.

Referenced by initialize(), and setMinMaxPixelValues().

280 {
281  // Check all the pointers...
282  if ( !theInputConnection || !theTile || !theBuffer )
283  {
284  disableSource();
285  return;
286  }
287 
289  if ( (theMinPixelValue.size() != bands) ||
290  (theMaxPixelValue.size() != bands) )
291  {
292  disableSource();
293  return;
294  }
295 
296  if (theUserDisabledFlag == false)
297  {
298  enableSource();
299  }
300 
301  if (traceDebug())
302  {
303  cout << *this << endl;
304  }
305 }
virtual ossim_uint32 getNumberOfBands() const
virtual void disableSource()
Definition: ossimSource.cpp:89
vector< double > theMinPixelValue
vector< double > theMaxPixelValue
ossimImageSource * theInputConnection
unsigned int ossim_uint32
virtual void enableSource()
ossimRefPtr< ossimImageData > theTile

Friends And Related Function Documentation

◆ operator<<

ostream& operator<< ( ostream &  os,
const ossimGammaRemapper hr 
)
friend

Definition at line 431 of file ossimGammaRemapper.cpp.

432 {
433  return hr.print(os);
434 }
virtual ostream & print(ostream &os) const
Outputs theErrorStatus as an ossimErrorCode and an ossimString.

Member Data Documentation

◆ theBuffer

double* ossimGammaRemapper::theBuffer
protected

Definition at line 62 of file ossimGammaRemapper.h.

Referenced by getTile(), initialize(), verifyEnabled(), and ~ossimGammaRemapper().

◆ theGamma

vector<double> ossimGammaRemapper::theGamma
protected

Definition at line 65 of file ossimGammaRemapper.h.

Referenced by getTile(), loadState(), and print().

◆ theMaxPixelValue

vector<double> ossimGammaRemapper::theMaxPixelValue
protected

Definition at line 64 of file ossimGammaRemapper.h.

Referenced by getTile(), print(), setMinMaxPixelValues(), and verifyEnabled().

◆ theMinPixelValue

vector<double> ossimGammaRemapper::theMinPixelValue
protected

Definition at line 63 of file ossimGammaRemapper.h.

Referenced by getTile(), print(), setMinMaxPixelValues(), and verifyEnabled().

◆ theTile

ossimRefPtr<ossimImageData> ossimGammaRemapper::theTile
protected

Definition at line 61 of file ossimGammaRemapper.h.

Referenced by getTile(), initialize(), loadState(), and verifyEnabled().

◆ theUserDisabledFlag

bool ossimGammaRemapper::theUserDisabledFlag
protected

Definition at line 66 of file ossimGammaRemapper.h.

Referenced by enableSource(), loadState(), and verifyEnabled().


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