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

#include <ossimImageMetaData.h>

Public Member Functions

 ossimImageMetaData ()
 
 ossimImageMetaData (ossimScalarType aType, ossim_uint32 numberOfBands)
 
 ossimImageMetaData (const ossimImageMetaData &rhs)
 
const ossimImageMetaDataoperator= (const ossimImageMetaData &rhs)
 
 ~ossimImageMetaData ()
 
void clear ()
 
void setDefaultsForArrays ()
 
void setNumberOfBands (ossim_uint32 numberOfBands)
 
ossim_uint32 getNumberOfBands () const
 
const std::string & getRgbBands () const
 
bool getRgbBands (std::vector< ossim_uint32 > &bandList) const
 Convenience method to get the zero based rgb output band list. More...
 
void setScalarType (ossimScalarType aType)
 
ossimScalarType getScalarType () const
 
ossim_uint32 getBytesPerPixel () const
 
double getMinPix (ossim_uint32 band) const
 
void setMinPix (ossim_uint32 band, double pix)
 
void setMaxPix (ossim_uint32 band, double pix)
 
void setNullPix (ossim_uint32 band, double pix)
 
double getMaxPix (ossim_uint32 band) const
 
double getNullPix (ossim_uint32 band) const
 
const double * getMinPixelArray () const
 
const double * getMaxPixelArray () const
 
const double * getNullPixelArray () const
 
void setMinValuesValid (bool flag)
 
void setMaxValuesValid (bool flag)
 
void setNullValuesValid (bool flag)
 
bool getMinValuesValidFlag () const
 
bool getMaxValuesValidFlag () const
 
bool getNullValuesValidFlag () const
 
bool isValid () const
 
bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
void updateMetaData (const ossimKeywordlist &kwl, const std::string &prefix)
 Method to update band values. More...
 
std::ostream & print (std::ostream &out) const
 Print method. More...
 

Private Member Functions

ossim_uint32 getBandCount (const ossimKeywordlist &kwl, const std::string &prefix) const
 Looks for ossimKeywordNames::NUMBER_BANDS_KW, if not found looks for. More...
 

Private Attributes

double * theNullPixelArray
 
double * theMinPixelArray
 
double * theMaxPixelArray
 
bool theMinValuesValidFlag
 
bool theMaxValuesValidFlag
 
bool theNullValuesValidFlag
 
ossimScalarType theScalarType
 
ossim_uint32 theBytesPerPixel
 
ossim_uint32 theNumberOfBands
 
std::string theRgbBands
 

Friends

OSSIM_DLL std::ostream & operator<< (std::ostream &out, const ossimImageMetaData &obj)
 

Detailed Description

Definition at line 26 of file ossimImageMetaData.h.

Constructor & Destructor Documentation

◆ ossimImageMetaData() [1/3]

ossimImageMetaData::ossimImageMetaData ( )

◆ ossimImageMetaData() [2/3]

ossimImageMetaData::ossimImageMetaData ( ossimScalarType  aType,
ossim_uint32  numberOfBands 
)

Definition at line 42 of file ossimImageMetaData.cpp.

References ossim::scalarSizeInBytes(), setDefaultsForArrays(), theBytesPerPixel, theMaxPixelArray, theMinPixelArray, theNullPixelArray, and theNumberOfBands.

47  theMinValuesValidFlag(false),
48  theMaxValuesValidFlag(false),
50  theScalarType(aType),
52  theNumberOfBands(numberOfBands),
53  theRgbBands()
54 {
56  {
57  theNullPixelArray = new double[theNumberOfBands];
58  theMinPixelArray = new double[theNumberOfBands];
59  theMaxPixelArray = new double[theNumberOfBands];
60 
62  }
64 }
ossimScalarType theScalarType
ossim_uint32 theNumberOfBands
OSSIM_DLL ossim_uint32 scalarSizeInBytes(ossimScalarType scalarType)
ossim_uint32 theBytesPerPixel

◆ ossimImageMetaData() [3/3]

ossimImageMetaData::ossimImageMetaData ( const ossimImageMetaData rhs)

Definition at line 66 of file ossimImageMetaData.cpp.

References theMaxPixelArray, theMinPixelArray, theNullPixelArray, and theNumberOfBands.

67  :
78 {
80  {
81  theNullPixelArray = new double[theNumberOfBands];
82  theMinPixelArray = new double[theNumberOfBands];
83  theMaxPixelArray = new double[theNumberOfBands];
84 
85  std::copy(rhs.theNullPixelArray,
88  std::copy(rhs.theMinPixelArray,
91  std::copy(rhs.theMaxPixelArray,
94  }
95 }
ossimScalarType theScalarType
ossim_uint32 theNumberOfBands
ossim_uint32 theBytesPerPixel

◆ ~ossimImageMetaData()

ossimImageMetaData::~ossimImageMetaData ( )

Definition at line 129 of file ossimImageMetaData.cpp.

References clear().

130 {
131  clear();
132 }

Member Function Documentation

◆ clear()

void ossimImageMetaData::clear ( )

Definition at line 134 of file ossimImageMetaData.cpp.

References OSSIM_SCALAR_UNKNOWN, theBytesPerPixel, theMaxPixelArray, theMinPixelArray, theNullPixelArray, theNumberOfBands, theRgbBands, and theScalarType.

Referenced by ossimGeneralRasterInfo::clear(), ossimGeneralRasterInfo::initializeFromEnviHdr(), ossimGeneralRasterInfo::initializeFromHdr(), ossimGeneralRasterInfo::initializeFromXml(), ossimImageHandler::loadMetaData(), loadState(), operator=(), and ~ossimImageMetaData().

135 {
137  {
138  delete [] theNullPixelArray;
139  theNullPixelArray = 0;
140  }
141  if(theMinPixelArray)
142  {
143  delete [] theMinPixelArray;
144  theMinPixelArray = 0;
145  }
146  if(theMaxPixelArray)
147  {
148  delete [] theMaxPixelArray;
149  theMaxPixelArray = 0;
150  }
152  theBytesPerPixel = 0;
153  theNumberOfBands = 0;
154  theRgbBands.clear();
155 }
ossimScalarType theScalarType
ossim_uint32 theNumberOfBands
ossim_uint32 theBytesPerPixel

◆ getBandCount()

ossim_uint32 ossimImageMetaData::getBandCount ( const ossimKeywordlist kwl,
const std::string &  prefix 
) const
private

Looks for ossimKeywordNames::NUMBER_BANDS_KW, if not found looks for.

Definition at line 554 of file ossimImageMetaData.cpp.

References ossimKeywordlist::findKey(), ossimKeywordlist::getSubstringKeyList(), ossimKeywordNames::NUMBER_BANDS_KW, ossimString::size(), ossimString::string(), and ossimString::toUInt32().

Referenced by loadState(), and updateMetaData().

556 {
557  ossim_uint32 result = 0;
558 
559  ossimString value;
560  value.string() = kwl.findKey( prefix, std::string(ossimKeywordNames::NUMBER_BANDS_KW) );
561  if ( value.size() )
562  {
563  result = value.toUInt32();
564  }
565  else
566  {
567  value.string() = std::string("^(") + prefix + std::string("band[0-9]+.)");
568  std::vector<ossimString> keys = kwl.getSubstringKeyList( value );
569  result = static_cast<ossim_uint32>( keys.size() );
570  }
571  return result;
572 }
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
ossim_uint32 toUInt32() const
std::string::size_type size() const
Definition: ossimString.h:405
unsigned int ossim_uint32
static const char * NUMBER_BANDS_KW
std::vector< ossimString > getSubstringKeyList(const ossimString &regularExpression) const
const std::string & string() const
Definition: ossimString.h:414

◆ getBytesPerPixel()

ossim_uint32 ossimImageMetaData::getBytesPerPixel ( ) const
Returns
The bytes per pixel. This is for a single band.

Definition at line 334 of file ossimImageMetaData.cpp.

References theBytesPerPixel.

Referenced by ossimGeneralRasterTileSource::allocateBuffer(), and ossimGeneralRasterInfo::bytesPerPixel().

335 {
336  return theBytesPerPixel;
337 }
ossim_uint32 theBytesPerPixel

◆ getMaxPix()

double ossimImageMetaData::getMaxPix ( ossim_uint32  band) const

◆ getMaxPixelArray()

const double * ossimImageMetaData::getMaxPixelArray ( ) const

Definition at line 400 of file ossimImageMetaData.cpp.

References theMaxPixelArray.

401 {
402  return theMaxPixelArray;
403 }

◆ getMaxValuesValidFlag()

bool ossimImageMetaData::getMaxValuesValidFlag ( ) const

Definition at line 430 of file ossimImageMetaData.cpp.

References theMaxValuesValidFlag.

Referenced by ossimERSTileSource::open().

431 {
432  return theMaxValuesValidFlag;
433 }

◆ getMinPix()

double ossimImageMetaData::getMinPix ( ossim_uint32  band) const

◆ getMinPixelArray()

const double * ossimImageMetaData::getMinPixelArray ( ) const

Definition at line 396 of file ossimImageMetaData.cpp.

References theMinPixelArray.

397 {
398  return theMinPixelArray;
399 }

◆ getMinValuesValidFlag()

bool ossimImageMetaData::getMinValuesValidFlag ( ) const

Definition at line 425 of file ossimImageMetaData.cpp.

References theMinValuesValidFlag.

Referenced by ossimERSTileSource::open().

426 {
427  return theMinValuesValidFlag;
428 }

◆ getNullPix()

double ossimImageMetaData::getNullPix ( ossim_uint32  band) const

◆ getNullPixelArray()

const double * ossimImageMetaData::getNullPixelArray ( ) const

Definition at line 405 of file ossimImageMetaData.cpp.

References theNullPixelArray.

406 {
407  return theNullPixelArray;
408 }

◆ getNullValuesValidFlag()

bool ossimImageMetaData::getNullValuesValidFlag ( ) const

Definition at line 435 of file ossimImageMetaData.cpp.

References theNullValuesValidFlag.

Referenced by ossimERSTileSource::open().

436 {
437  return theNullValuesValidFlag;
438 }

◆ getNumberOfBands()

ossim_uint32 ossimImageMetaData::getNumberOfBands ( ) const

◆ getRgbBands() [1/2]

const std::string & ossimImageMetaData::getRgbBands ( ) const
Returns
string reference containing rgb band order, e.g. "(2,1,0)". Will be an emptry string if not set.

Definition at line 300 of file ossimImageMetaData.cpp.

References theRgbBands.

Referenced by ossimImageHandler::getRgbBandList().

301 {
302  return theRgbBands;
303 }

◆ getRgbBands() [2/2]

bool ossimImageMetaData::getRgbBands ( std::vector< ossim_uint32 > &  bandList) const

Convenience method to get the zero based rgb output band list.

This method returns true on success; false, if rgb_bands key is not set in dot omd file.

Note
: Current ossimImageMetaData logic requires key "number_bands" to be set and at least 3.
Parameters
bandListInitialized by this on success.
Returns
false

Definition at line 305 of file ossimImageMetaData.cpp.

References theNumberOfBands, theRgbBands, and ossim::toSimpleVector().

306 {
307  bool result = false;
308  if ( ( theNumberOfBands > 2) && theRgbBands.size() )
309  {
311  if ( bandList.size() == 3 )
312  {
313  result = true;
314  }
315  else
316  {
317  bandList.clear();
318  }
319  }
320  return result;
321 }
ossim_uint32 theNumberOfBands
bool toSimpleVector(std::vector< T > &result, const ossimString &stringOfPoints)
Definition: ossimCommon.h:537

◆ getScalarType()

ossimScalarType ossimImageMetaData::getScalarType ( ) const

Definition at line 329 of file ossimImageMetaData.cpp.

References theScalarType.

Referenced by ossimGeneralRasterTileSource::allocateTile(), and ossimGeneralRasterElevHandler::setFilename().

330 {
331  return theScalarType;
332 }
ossimScalarType theScalarType

◆ isValid()

bool ossimImageMetaData::isValid ( void  ) const

Definition at line 440 of file ossimImageMetaData.cpp.

References theNumberOfBands.

Referenced by ossimImageHandler::hasMetaData().

441 {
442  return (theNumberOfBands > 0);
443 // return ((theNumberOfBands>0)&&
444 // (theScalarType != OSSIM_SCALAR_UNKNOWN));
445 }
ossim_uint32 theNumberOfBands

◆ loadState()

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

Definition at line 199 of file ossimImageMetaData.cpp.

References clear(), ossimKeywordlist::findKey(), getBandCount(), setNumberOfBands(), theMaxValuesValidFlag, theMinValuesValidFlag, theNullValuesValidFlag, theRgbBands, and updateMetaData().

Referenced by ossimImageHandler::loadMetaData(), and ossimERSTileSource::open().

200 {
201  bool result = false; // return status
202 
203  // Clear the object:
204  clear();
205 
206  std::string pfx = ( prefix ? prefix : "" );
207 
208  theRgbBands = kwl.findKey( pfx, std::string("rgb_bands") );
209 
210  ossim_uint32 bands = getBandCount( kwl, pfx );
211  if ( bands )
212  {
213  result = true;
214 
215  setNumberOfBands( bands );
216 
217  theMinValuesValidFlag = true;
218  theMaxValuesValidFlag = true;
219  theNullValuesValidFlag = true;
220 
221  updateMetaData( kwl, pfx ); // Initializes the rest of object.
222  }
223  else
224  {
225  if (traceDebug())
226  {
228  << " ERROR:\n"
229  << "Required keyword not found: " << ossimKeywordNames::NUMBER_BANDS_KW << std::endl;
230  }
231  }
232 
233  if (traceDebug())
234  {
236  }
237 
238  return result;
239 }
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
std::ostream & print(std::ostream &out) const
Print method.
ossim_uint32 getBandCount(const ossimKeywordlist &kwl, const std::string &prefix) const
Looks for ossimKeywordNames::NUMBER_BANDS_KW, if not found looks for.
void setNumberOfBands(ossim_uint32 numberOfBands)
unsigned int ossim_uint32
static const char * NUMBER_BANDS_KW
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
void updateMetaData(const ossimKeywordlist &kwl, const std::string &prefix)
Method to update band values.

◆ operator=()

const ossimImageMetaData & ossimImageMetaData::operator= ( const ossimImageMetaData rhs)

Definition at line 97 of file ossimImageMetaData.cpp.

References clear(), theBytesPerPixel, theMaxPixelArray, theMaxValuesValidFlag, theMinPixelArray, theMinValuesValidFlag, theNullPixelArray, theNullValuesValidFlag, theNumberOfBands, theRgbBands, and theScalarType.

98 {
99  if( this != &rhs )
100  {
101  clear();
108  if(theNumberOfBands)
109  {
110  theNullPixelArray = new double[theNumberOfBands];
111  theMinPixelArray = new double[theNumberOfBands];
112  theMaxPixelArray = new double[theNumberOfBands];
113 
114  std::copy(rhs.theNullPixelArray,
117  std::copy(rhs.theMinPixelArray,
120  std::copy(rhs.theMaxPixelArray,
123  }
124  theRgbBands = rhs.theRgbBands;
125  }
126  return *this;
127 }
ossimScalarType theScalarType
ossim_uint32 theNumberOfBands
ossim_uint32 theBytesPerPixel

◆ print()

std::ostream & ossimImageMetaData::print ( std::ostream &  out) const

Print method.

Returns
std::ostream&

Definition at line 541 of file ossimImageMetaData.cpp.

References saveState().

Referenced by operator<<().

542 {
543  ossimKeywordlist kwl;
544  saveState( kwl, 0 );
545  out << kwl << std::endl;
546  return out;
547 }
Represents serializable keyword/value map.
bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const

◆ saveState()

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

Definition at line 241 of file ossimImageMetaData.cpp.

References ossimKeywordlist::add(), ossimKeywordNames::BAND_KW, ossimString::c_str(), ossimScalarTypeLut::instance(), ossimKeywordNames::MAX_VALUE_KW, ossimKeywordNames::MIN_VALUE_KW, ossimKeywordNames::NULL_VALUE_KW, ossimKeywordNames::NUMBER_BANDS_KW, ossimKeywordNames::SCALAR_TYPE_KW, theBytesPerPixel, theMaxPixelArray, theMinPixelArray, theNullPixelArray, theNumberOfBands, theRgbBands, theScalarType, ossimString::toString(), and true.

Referenced by print(), and ossimGeneralRasterInfo::saveState().

243 {
244  kwl.add(prefix, "type", "ossimImageMetaData", true);
245  if ( theNumberOfBands )
246  {
247  ossim_uint32 band = 0;
248 
249  for (band=0; band < theNumberOfBands; ++band)
250  {
252  ossimString::toString(band+1) + "." +
255  ossimString::toString(band+1) + "." +
258  ossimString::toString(band+1) + "." +
260 
261  kwl.add(prefix,
262  kwMin.c_str(),
263  theMinPixelArray[band],
264  true);
265  kwl.add(prefix,
266  kwMax.c_str(),
267  theMaxPixelArray[band],
268  true);
269  kwl.add(prefix,
270  kwNull.c_str(),
271  theNullPixelArray[band],
272  true);
273  }
274  // std::cout << "added bands ******************" << std::endl;
275  kwl.add(prefix,
278  true);
279  kwl.add(prefix,
281  (ossimScalarTypeLut::instance()->getEntryString(theScalarType)),
282  true);
283 
284  kwl.add( prefix, "bytes_per_pixel", theBytesPerPixel, true );
285  }
286 
287  if ( theRgbBands.size() )
288  {
289  kwl.add( prefix, "rgb_bands", theRgbBands.c_str(), true );
290  }
291 
292  return true;
293 }
static const char * MIN_VALUE_KW
ossimScalarType theScalarType
ossim_uint32 theNumberOfBands
static const char * MAX_VALUE_KW
static const char * NULL_VALUE_KW
static ossimString toString(bool aValue)
Numeric to string methods.
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
static ossimScalarTypeLut * instance()
Returns the static instance of an ossimScalarTypeLut object.
unsigned int ossim_uint32
static const char * NUMBER_BANDS_KW
static const char * BAND_KW
ossim_uint32 theBytesPerPixel
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
static const char * SCALAR_TYPE_KW

◆ setDefaultsForArrays()

void ossimImageMetaData::setDefaultsForArrays ( )

Definition at line 157 of file ossimImageMetaData.cpp.

References ossim::defaultMax(), ossim::defaultMin(), ossim::defaultNull(), theMaxPixelArray, theMinPixelArray, theNullPixelArray, theNumberOfBands, and theScalarType.

Referenced by ossimImageMetaData(), and setNumberOfBands().

158 {
159  ossim_uint32 i=0;
160 
161  for(i = 0; i < theNumberOfBands; ++i)
162  {
166  }
167 }
ossimScalarType theScalarType
ossim_uint32 theNumberOfBands
OSSIM_DLL double defaultMin(ossimScalarType scalarType)
Definition: ossimCommon.cpp:73
OSSIM_DLL double defaultNull(ossimScalarType scalarType)
unsigned int ossim_uint32
OSSIM_DLL double defaultMax(ossimScalarType scalarType)

◆ setMaxPix()

void ossimImageMetaData::setMaxPix ( ossim_uint32  band,
double  pix 
)

Definition at line 347 of file ossimImageMetaData.cpp.

References theMaxPixelArray, and theNumberOfBands.

Referenced by ossimERSTileSource::open(), and ossimImageHandler::setMaxPixelValue().

348 {
349  if((band < theNumberOfBands) && theMaxPixelArray)
350  {
351  theMaxPixelArray[band] = pix;
352  }
353 }
ossim_uint32 theNumberOfBands

◆ setMaxValuesValid()

void ossimImageMetaData::setMaxValuesValid ( bool  flag)

Definition at line 415 of file ossimImageMetaData.cpp.

References theMaxValuesValidFlag.

416 {
417  theMaxValuesValidFlag = flag;
418 }

◆ setMinPix()

void ossimImageMetaData::setMinPix ( ossim_uint32  band,
double  pix 
)

Definition at line 339 of file ossimImageMetaData.cpp.

References theMinPixelArray, and theNumberOfBands.

Referenced by ossimERSTileSource::open(), and ossimImageHandler::setMinPixelValue().

340 {
341  if((band < theNumberOfBands)&&(theMinPixelArray))
342  {
343  theMinPixelArray[band] = pix;
344  }
345 }
ossim_uint32 theNumberOfBands

◆ setMinValuesValid()

void ossimImageMetaData::setMinValuesValid ( bool  flag)

Definition at line 410 of file ossimImageMetaData.cpp.

References theMinValuesValidFlag.

411 {
412  theMinValuesValidFlag = flag;
413 }

◆ setNullPix()

void ossimImageMetaData::setNullPix ( ossim_uint32  band,
double  pix 
)

Definition at line 355 of file ossimImageMetaData.cpp.

References theNullPixelArray, and theNumberOfBands.

Referenced by ossimGeneralRasterInfo::initializeFromHdr(), ossimERSTileSource::open(), and ossimImageHandler::setNullPixelValue().

356 {
357  if((band < theNumberOfBands)&&(theNullPixelArray))
358  {
359  theNullPixelArray[band] = pix;
360  }
361 }
ossim_uint32 theNumberOfBands

◆ setNullValuesValid()

void ossimImageMetaData::setNullValuesValid ( bool  flag)

Definition at line 420 of file ossimImageMetaData.cpp.

References theNullValuesValidFlag.

Referenced by ossimGeneralRasterInfo::initializeFromHdr().

421 {
422  theNullValuesValidFlag = flag;
423 }

◆ setNumberOfBands()

void ossimImageMetaData::setNumberOfBands ( ossim_uint32  numberOfBands)

Definition at line 169 of file ossimImageMetaData.cpp.

References setDefaultsForArrays(), theMaxPixelArray, theMinPixelArray, theNullPixelArray, and theNumberOfBands.

Referenced by ossimGeneralRasterInfo::initializeFromEnviHdr(), ossimGeneralRasterInfo::initializeFromHdr(), ossimGeneralRasterInfo::initializeFromXml(), loadState(), and updateMetaData().

170 {
172  {
173  delete [] theNullPixelArray;
174  theNullPixelArray = 0;
175  }
176  if(theMinPixelArray)
177  {
178  delete [] theMinPixelArray;
179  theMinPixelArray = 0;
180  }
181  if(theMaxPixelArray)
182  {
183  delete [] theMaxPixelArray;
184  theMaxPixelArray = 0;
185  }
186 
187  theNumberOfBands = numberOfBands;
188 
189  if(theNumberOfBands)
190  {
191  theNullPixelArray = new double[theNumberOfBands];
192  theMinPixelArray = new double[theNumberOfBands];
193  theMaxPixelArray = new double[theNumberOfBands];
194 
196  }
197 }
ossim_uint32 theNumberOfBands

◆ setScalarType()

void ossimImageMetaData::setScalarType ( ossimScalarType  aType)

◆ updateMetaData()

void ossimImageMetaData::updateMetaData ( const ossimKeywordlist kwl,
const std::string &  prefix 
)

Method to update band values.

Assumes a previous initialization and does not error out if band data is not found. This does NOT clear the object prior to loading like the loadState(...) method. Can be used to update min/max values from a "compute min max".

Parameters
kwlKeyword list to initialize from.
prefixPrefix, e.g. "image0.".

Definition at line 447 of file ossimImageMetaData.cpp.

References ossimString::empty(), ossimKeywordlist::findKey(), getBandCount(), ossimScalarTypeLut::getScalarTypeFromString(), ossimKeywordlist::getSubstringKeyList(), ossimScalarTypeLut::instance(), ossimKeywordNames::MAX_VALUE_KW, ossimKeywordNames::MIN_VALUE_KW, ossimKeywordNames::NULL_VALUE_KW, OSSIM_SCALAR_UNKNOWN, ossimKeywordNames::SCALAR_TYPE_KW, ossim::scalarSizeInBytes(), setNumberOfBands(), ossimString::size(), ossimString::string(), theBytesPerPixel, theMaxPixelArray, theMinPixelArray, theNullPixelArray, theNumberOfBands, theScalarType, ossimString::toFloat64(), and ossimString::toString().

Referenced by loadState().

449 {
450  ossimString value;
451  std::string key;
452 
453  // Get the bands:
454  if ( !theNumberOfBands )
455  {
456  ossim_uint32 bands = getBandCount( kwl, prefix );
457  if ( bands )
458  {
459  setNumberOfBands( bands );
460  }
461  }
462 
463  if ( theNumberOfBands )
464  {
465  //---
466  // See if bands are zero or one based. Bands are ONE based in the "omd"
467  // file! If band0 is present assume zero based.
468  //---
469 
470  ossimString regExpression = std::string("^(") + prefix + std::string("band0+.)");
471  std::vector<ossimString> keys = kwl.getSubstringKeyList( regExpression );
472 
473  ossim_uint32 startBand = (keys.size() ? 0 : 1);
474 
475  ossim_uint32 limit = theNumberOfBands+startBand; // For for loop:
476 
477  std::string bs = "band"; // band sting
478  std::string base;
479 
480  for ( ossim_uint32 band = startBand; band < limit; ++band )
481  {
482  base = bs + ossimString::toString( band ).string() + std::string(".") ;
483 
484  // Min:
485  key = base + std::string(ossimKeywordNames::MIN_VALUE_KW);
486  value = kwl.findKey( prefix, key );
487 
488  if ( value.size() )
489  {
490  theMinPixelArray[ band - startBand ] = value.toFloat64();
491  }
492 
493  // Max:
494  key = base + std::string(ossimKeywordNames::MAX_VALUE_KW);
495  value = kwl.findKey( prefix, key );
496  if ( value.size() )
497  {
498  theMaxPixelArray[ band - startBand ] = value.toFloat64();
499  }
500 
501  // Null:
502  key = base + std::string(ossimKeywordNames::NULL_VALUE_KW);
503  value = kwl.findKey( prefix, key );
504  if ( value.size() )
505  {
506  theNullPixelArray[ band - startBand ] = value.toFloat64();
507  }
508  }
509  }
510 
511 
512  // Scalar, only look for if not set.
514  {
515  key = ossimKeywordNames::SCALAR_TYPE_KW; // "scalar_type"
516  value.string() = kwl.findKey( prefix, key );
517  if ( value.empty() )
518  {
519  key = "radiometry";
520  value.string() = kwl.findKey( prefix, key );
521  }
522  if ( value.size() )
523  {
525  }
526 
528  {
530  }
531  }
532 
533  if (traceDebug())
534  {
536  << "ossimImageMetaData::updateMetaData DEBUG"
537  << *this << std::endl;
538  }
539 }
static const char * MIN_VALUE_KW
ossimScalarType getScalarTypeFromString(const ossimString &s) const
const std::string & findKey(const std::string &key) const
Find methods that take std::string(s).
ossimScalarType theScalarType
ossim_uint32 theNumberOfBands
static const char * MAX_VALUE_KW
static const char * NULL_VALUE_KW
static ossimString toString(bool aValue)
Numeric to string methods.
ossim_uint32 getBandCount(const ossimKeywordlist &kwl, const std::string &prefix) const
Looks for ossimKeywordNames::NUMBER_BANDS_KW, if not found looks for.
void setNumberOfBands(ossim_uint32 numberOfBands)
static ossimScalarTypeLut * instance()
Returns the static instance of an ossimScalarTypeLut object.
std::string::size_type size() const
Definition: ossimString.h:405
unsigned int ossim_uint32
ossim_float64 toFloat64() const
OSSIM_DLL ossim_uint32 scalarSizeInBytes(ossimScalarType scalarType)
ossim_uint32 theBytesPerPixel
std::vector< ossimString > getSubstringKeyList(const ossimString &regularExpression) const
static const char * SCALAR_TYPE_KW
bool empty() const
Definition: ossimString.h:411
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
const std::string & string() const
Definition: ossimString.h:414

Friends And Related Function Documentation

◆ operator<<

OSSIM_DLL std::ostream& operator<< ( std::ostream &  out,
const ossimImageMetaData obj 
)
friend
Note
Since the print method is virtual, derived classes only need to implement that, not an addition operator<<.

Definition at line 549 of file ossimImageMetaData.cpp.

550 {
551  return obj.print( out );
552 }
std::ostream & print(std::ostream &out) const
Print method.

Member Data Documentation

◆ theBytesPerPixel

ossim_uint32 ossimImageMetaData::theBytesPerPixel
private

◆ theMaxPixelArray

double* ossimImageMetaData::theMaxPixelArray
private

◆ theMaxValuesValidFlag

bool ossimImageMetaData::theMaxValuesValidFlag
private

◆ theMinPixelArray

double* ossimImageMetaData::theMinPixelArray
private

◆ theMinValuesValidFlag

bool ossimImageMetaData::theMinValuesValidFlag
private

◆ theNullPixelArray

double* ossimImageMetaData::theNullPixelArray
private

◆ theNullValuesValidFlag

bool ossimImageMetaData::theNullValuesValidFlag
private

◆ theNumberOfBands

ossim_uint32 ossimImageMetaData::theNumberOfBands
private

◆ theRgbBands

std::string ossimImageMetaData::theRgbBands
private

Definition at line 164 of file ossimImageMetaData.h.

Referenced by clear(), getRgbBands(), loadState(), operator=(), and saveState().

◆ theScalarType

ossimScalarType ossimImageMetaData::theScalarType
private

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