OSSIM - Open Source Software Image Map
Version 1.9.0 (20180803)
|
Class for reading and writing an ENVI (The Environment for Visualizing Images) header file. More...
#include <ossimEnviHeader.h>
Public Member Functions | |
ossimEnviHeader () | |
default construtor More... | |
virtual | ~ossimEnviHeader () |
virtual destructor More... | |
virtual void | reset () |
const ossimKeywordlist & | getMap () const |
ossimKeywordlist & | getMap () |
bool | getValue (const ossimString &key, ossimString &value) const |
Gets value for key. More... | |
bool | findCaseInsensitive (const ossimString &key, ossimString &value) const |
Gets value for key. More... | |
bool | findSubStringCaseInsensitive (const ossimString &key, ossimString &value) const |
Gets value for key. More... | |
bool | open (const ossimFilename &file) |
Opens an envi header. More... | |
bool | writeFile (const ossimFilename &file) |
Writes header to file in a standard envi format. More... | |
std::ostream & | print (std::ostream &out) const |
Prints header to out in a standard envi format. More... | |
ossimString | getDescription () const |
void | setDescription (const ossimString &description) |
ossim_uint32 | getSamples () const |
void | setSamples (ossim_uint32 samples) |
Sets the number of samples. More... | |
ossim_uint32 | getLines () const |
void | setLines (ossim_uint32 lines) |
Sets the number of lines. More... | |
ossim_uint32 | getBands () const |
void | setBands (ossim_uint32 bands) |
Sets the number of bands. More... | |
bool | getDefaultBands (std::vector< ossim_uint32 > &bands) const |
Gets default bands if "default bands" keyword is present. More... | |
bool | getRgbBandsFromWaveLength (std::vector< ossim_uint32 > &bands) const |
Gets rgb bands if "wavelength" keyword is present. More... | |
ossim_uint32 | getHeaderOffset () const |
void | setHeaderOffset (ossim_uint32 headerOffset) |
Sets the header offset in bytes. More... | |
ossimString | getFileType () const |
void | setFileType (const ossimString &fileType) |
Sets the file type. More... | |
ossim_uint32 | getDataType () const |
ossimScalarType | getOssimScalarType () const |
void | setDataType (ossimScalarType scalar) |
Sets the envi data type based on the ossimScalarType. More... | |
ossimString | getInterleaveType () const |
ossimInterleaveType | getOssimInterleaveType () const |
void | setInterleaveType (ossimInterleaveType interleave) |
Sets the envi interleave type string based on the ossimInterleaveType. More... | |
ossimString | getSensorType () const |
void | setSensorType (const ossimString &sensorType) |
Sets the envi sensor type string. More... | |
ossimByteOrder | getByteOrder () const |
void | setByteorder (ossimByteOrder byteOrder) |
Sets the envi byte order from the ossimByteOrder. More... | |
ossim_int32 | getXStart () const |
void | setXStart (ossim_int32 xstart) |
Sets the x start. More... | |
ossim_int32 | getYStart () const |
void | setYStart (ossim_int32 ystart) |
Sets the y start. More... | |
ossimString | getMapInfo () const |
void | setMapInfo (const ossimString &mapInfo) |
Sets the envi map info string. More... | |
void | setMapInfo (const ossimKeywordlist &kwl, const char *prefix=0) |
Sets the envi map info string from a keyword list containing geometry information. More... | |
ossimString | getWavelengthUnits () const |
void | setWavelengthUnits (const ossimString &wavelenghtUnits) |
Sets the envi wavelength units string. More... | |
void | getBandNames (std::vector< ossimString > &bandNames) const |
void | setBandNames (const std::vector< ossimString > &bandNames) |
Sets the band name string vector. More... | |
void | getWavelengths (std::vector< ossimString > &wavelengths) const |
void | setWavelengths (const std::vector< ossimString > &wavelengths) |
Sets the envi band name string. More... | |
bool | loadState (const ossimKeywordlist &kwl, const char *prefix=0) |
Method to the load (recreate) the state of the object from a keyword list. More... | |
const ossimFilename & | getFile () const |
![]() | |
ossimReferenced () | |
ossimReferenced (const ossimReferenced &) | |
ossimReferenced & | operator= (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 |
Static Public Member Functions | |
static bool | isEnviHeader (const ossimFilename &file) |
Global method to test first line of file for "ENVI". More... | |
static bool | isEnviHeader (std::istream &in) |
Global method to test first line of stream for "ENVI". More... | |
Private Member Functions | |
bool | rangeCheckBands (const std::vector< ossim_uint32 > &bands) const |
Check band list to see if any are outside of range of bands. More... | |
bool | readStream (std::istream &in) |
Parses stream. More... | |
Private Attributes | |
ossimFilename | m_file |
ossimKeywordlist | m_keywords |
Friends | |
OSSIM_DLL std::ostream & | operator<< (std::ostream &out, const ossimEnviHeader &obj) |
friend operator<< More... | |
Additional Inherited Members | |
![]() | |
virtual | ~ossimReferenced () |
Class for reading and writing an ENVI (The Environment for Visualizing Images) header file.
Definition at line 30 of file ossimEnviHeader.h.
ossimEnviHeader::ossimEnviHeader | ( | ) |
default construtor
Definition at line 66 of file ossimEnviHeader.cpp.
References m_keywords.
|
virtual |
bool ossimEnviHeader::findCaseInsensitive | ( | const ossimString & | key, |
ossimString & | value | ||
) | const |
Gets value for key.
key | |
value |
bool ossimEnviHeader::findSubStringCaseInsensitive | ( | const ossimString & | key, |
ossimString & | value | ||
) | const |
Gets value for key.
key | |
value |
Definition at line 113 of file ossimEnviHeader.cpp.
References ossimKeywordlist::findValue(), and m_keywords.
void ossimEnviHeader::getBandNames | ( | std::vector< ossimString > & | bandNames | ) | const |
bandNames | Vector of strings to initialize with band names. |
Definition at line 690 of file ossimEnviHeader.cpp.
References m_keywords, and ossimString::split().
ossim_uint32 ossimEnviHeader::getBands | ( | ) | const |
Definition at line 271 of file ossimEnviHeader.cpp.
References ossimKeywordlist::findKey(), m_keywords, ossimString::size(), and ossimString::toUInt32().
Referenced by ossimGeneralRasterInfo::initializeFromEnviHdr(), rangeCheckBands(), and ossimAlphaSensorSupportData::readHdrFile().
ossimByteOrder ossimEnviHeader::getByteOrder | ( | ) | const |
Definition at line 510 of file ossimEnviHeader.cpp.
References ossim::byteOrder(), m_keywords, OSSIM_BIG_ENDIAN, OSSIM_LITTLE_ENDIAN, and ossimString::toInt32().
Referenced by ossimGeneralRasterInfo::initializeFromEnviHdr().
ossim_uint32 ossimEnviHeader::getDataType | ( | ) | const |
Definition at line 366 of file ossimEnviHeader.cpp.
References m_keywords, and ossimString::toUInt32().
bool ossimEnviHeader::getDefaultBands | ( | std::vector< ossim_uint32 > & | bands | ) | const |
Gets default bands if "default bands" keyword is present.
bands | Initialized by this. |
Definition at line 287 of file ossimEnviHeader.cpp.
References ossimKeywordlist::findKey(), m_keywords, ossimNotify(), ossimNotifyLevel_WARN, rangeCheckBands(), ossimString::size(), ossimString::split(), and true.
ossimString ossimEnviHeader::getDescription | ( | ) | const |
Definition at line 229 of file ossimEnviHeader.cpp.
References ossimKeywordlist::findKey(), and m_keywords.
const ossimFilename & ossimEnviHeader::getFile | ( | ) | const |
Definition at line 928 of file ossimEnviHeader.cpp.
References m_file.
Referenced by ossimAlphaSensorSupportData::readHdrFile(), and ossimAlphaSensorSupportData::readSupportFiles().
ossimString ossimEnviHeader::getFileType | ( | ) | const |
ossim_uint32 ossimEnviHeader::getHeaderOffset | ( | ) | const |
Definition at line 340 of file ossimEnviHeader.cpp.
References m_keywords, ossimString::size(), and ossimString::toUInt32().
Referenced by ossimGeneralRasterInfo::initializeFromEnviHdr().
ossimString ossimEnviHeader::getInterleaveType | ( | ) | const |
Definition at line 454 of file ossimEnviHeader.cpp.
References m_keywords.
Referenced by getOssimInterleaveType().
ossim_uint32 ossimEnviHeader::getLines | ( | ) | const |
Definition at line 255 of file ossimEnviHeader.cpp.
References ossimKeywordlist::findKey(), m_keywords, ossimString::size(), and ossimString::toUInt32().
Referenced by ossimGeneralRasterInfo::initializeFromEnviHdr(), and ossimAlphaSensorSupportData::readHdrFile().
const ossimKeywordlist & ossimEnviHeader::getMap | ( | ) | const |
Definition at line 88 of file ossimEnviHeader.cpp.
References m_keywords.
Referenced by ossimEnviInfo::print().
ossimKeywordlist & ossimEnviHeader::getMap | ( | ) |
ossimString ossimEnviHeader::getMapInfo | ( | ) | const |
Definition at line 576 of file ossimEnviHeader.cpp.
References m_keywords.
ossimInterleaveType ossimEnviHeader::getOssimInterleaveType | ( | ) | const |
Definition at line 458 of file ossimEnviHeader.cpp.
References getInterleaveType(), OSSIM_BIL, OSSIM_BIP, OSSIM_BSQ, and OSSIM_INTERLEAVE_UNKNOWN.
Referenced by ossimGeneralRasterInfo::initializeFromEnviHdr().
ossimScalarType ossimEnviHeader::getOssimScalarType | ( | ) | const |
Definition at line 371 of file ossimEnviHeader.cpp.
References m_keywords, OSSIM_CFLOAT32, OSSIM_CFLOAT64, OSSIM_FLOAT32, OSSIM_FLOAT64, OSSIM_SCALAR_UNKNOWN, OSSIM_SINT16, OSSIM_SINT32, OSSIM_UINT16, OSSIM_UINT32, OSSIM_UINT8, and ossimString::toUInt32().
Referenced by ossimGeneralRasterInfo::initializeFromEnviHdr().
bool ossimEnviHeader::getRgbBandsFromWaveLength | ( | std::vector< ossim_uint32 > & | bands | ) | const |
Gets rgb bands if "wavelength" keyword is present.
bands | Initialized by this. |
ossim_uint32 ossimEnviHeader::getSamples | ( | ) | const |
Definition at line 239 of file ossimEnviHeader.cpp.
References ossimKeywordlist::findKey(), m_keywords, ossimString::size(), and ossimString::toUInt32().
Referenced by ossimGeneralRasterInfo::initializeFromEnviHdr(), and ossimAlphaSensorSupportData::readHdrFile().
ossimString ossimEnviHeader::getSensorType | ( | ) | const |
Definition at line 500 of file ossimEnviHeader.cpp.
References m_keywords.
Referenced by ossimAlphaSensorSupportData::readHdrFile().
bool ossimEnviHeader::getValue | ( | const ossimString & | key, |
ossimString & | value | ||
) | const |
Gets value for key.
key | To search for. |
value | Initialized by this. |
Definition at line 98 of file ossimEnviHeader.cpp.
References ossimKeywordlist::findKey(), ossimKeywordlist::hasKey(), m_keywords, ossimString::size(), and ossimString::string().
Referenced by ossimWavelength::initialize(), and ossimAlphaSensorSupportData::readHdrFile().
void ossimEnviHeader::getWavelengths | ( | std::vector< ossimString > & | wavelengths | ) | const |
wavelengths | Vector of strings to initialize with wave lengths. |
Definition at line 704 of file ossimEnviHeader.cpp.
References m_keywords.
ossimString ossimEnviHeader::getWavelengthUnits | ( | ) | const |
Definition at line 679 of file ossimEnviHeader.cpp.
References m_keywords.
ossim_int32 ossimEnviHeader::getXStart | ( | ) | const |
Definition at line 536 of file ossimEnviHeader.cpp.
References ossimKeywordlist::findKey(), m_keywords, and ossimString::toInt32().
Referenced by ossimGeneralRasterInfo::initializeFromEnviHdr().
ossim_int32 ossimEnviHeader::getYStart | ( | ) | const |
Definition at line 556 of file ossimEnviHeader.cpp.
References ossimKeywordlist::findKey(), m_keywords, and ossimString::toInt32().
Referenced by ossimGeneralRasterInfo::initializeFromEnviHdr().
|
static |
Global method to test first line of file for "ENVI".
Definition at line 900 of file ossimEnviHeader.cpp.
References ossimString::c_str().
Referenced by ossimEnviInfo::open(), and readStream().
|
static |
Global method to test first line of stream for "ENVI".
Definition at line 913 of file ossimEnviHeader.cpp.
References ossim::skipws().
bool ossimEnviHeader::loadState | ( | const ossimKeywordlist & | kwl, |
const char * | prefix = 0 |
||
) |
Method to the load (recreate) the state of the object from a keyword list.
kwl | Keyword list to initialize from. |
prefix | Usually something like: "object1." |
Keywords picked up by loadState:
description: My_file
number_samples: 1024
number_lines: 512
number_bands: 3
header_offset: 0
file_type: ENVI Standard
data_type: 1
interleave_type: bil
sensor_type: Unknown
(little_endian or big_endian) byte_order: little_endian
map_info: Unknown
wavelength_units:
band_name0: Red band band_name1: Green band band_name2: Blue band
wavelength0: 620.25 wavelength1: 514.5 wavelength2: 470.0
Definition at line 720 of file ossimEnviHeader.cpp.
References ossimKeywordNames::DESCRIPTION_KW, ossimKeywordNames::FILENAME_KW, ossimKeywordlist::findKey(), m_file, m_keywords, ossimKeywordNames::NUMBER_BANDS_KW, ossimKeywordNames::NUMBER_LINES_KW, ossimKeywordNames::NUMBER_SAMPLES_KW, reset(), setDescription(), and ossimString::string().
Referenced by ossimEnviHeaderFileWriter::loadState().
bool ossimEnviHeader::open | ( | const ossimFilename & | file | ) |
Opens an envi header.
Definition at line 120 of file ossimEnviHeader.cpp.
References ossimString::c_str(), m_file, readStream(), and reset().
Referenced by ossimGeneralRasterInfo::initializeFromEnviHdr(), ossimEnviInfo::print(), ossimAlphaSensorSupportData::readHdrFile(), and ossimAlphaSensorSupportData::readSupportFiles().
std::ostream & ossimEnviHeader::print | ( | std::ostream & | out | ) | const |
Prints header to out in a standard envi format.
out | Stream to write to. |
Definition at line 218 of file ossimEnviHeader.cpp.
References m_keywords.
Referenced by operator<<(), and writeFile().
|
private |
Check band list to see if any are outside of range of bands.
Bands should be zero base.
Definition at line 933 of file ossimEnviHeader.cpp.
References getBands().
Referenced by getDefaultBands().
|
private |
Parses stream.
Definition at line 140 of file ossimEnviHeader.cpp.
References ossimKeywordlist::add(), ossimKeywordlist::clear(), ossimKeywordlist::findKey(), isEnviHeader(), m_keywords, reset(), ossim::skipws(), and ossimString::trim().
Referenced by open().
|
virtual |
Definition at line 80 of file ossimEnviHeader.cpp.
References ossimKeywordlist::clear(), m_file, m_keywords, and ossimString::string().
Referenced by loadState(), open(), and readStream().
void ossimEnviHeader::setBandNames | ( | const std::vector< ossimString > & | bandNames | ) |
Sets the band name string vector.
bandNames | Vector of band name strings. |
Definition at line 697 of file ossimEnviHeader.cpp.
References ossimString::c_str(), ossimString::join(), and m_keywords.
void ossimEnviHeader::setBands | ( | ossim_uint32 | bands | ) |
Sets the number of bands.
bands | The number of bands. |
Definition at line 282 of file ossimEnviHeader.cpp.
References ossimString::c_str(), m_keywords, and ossimString::toString().
Referenced by ossimEnviHeaderFileWriter::writeFile().
void ossimEnviHeader::setByteorder | ( | ossimByteOrder | byteOrder | ) |
Sets the envi byte order from the ossimByteOrder.
byteorder | The ossimByteOrder of the image. |
Definition at line 524 of file ossimEnviHeader.cpp.
References ossim::byteOrder(), m_keywords, and OSSIM_LITTLE_ENDIAN.
void ossimEnviHeader::setDataType | ( | ossimScalarType | scalar | ) |
Sets the envi data type based on the ossimScalarType.
scalar | The ossimScalarType of the image. |
Definition at line 413 of file ossimEnviHeader.cpp.
References ossimString::c_str(), ossimString::empty(), m_keywords, OSSIM_CFLOAT32, OSSIM_CFLOAT64, OSSIM_FLOAT32, OSSIM_FLOAT64, OSSIM_SINT16, OSSIM_SINT32, OSSIM_UINT16, OSSIM_UINT32, and OSSIM_UINT8.
void ossimEnviHeader::setDescription | ( | const ossimString & | description | ) |
description | The description of the file. |
Definition at line 234 of file ossimEnviHeader.cpp.
References ossimString::c_str(), and m_keywords.
Referenced by loadState().
void ossimEnviHeader::setFileType | ( | const ossimString & | fileType | ) |
Sets the file type.
fileType | The sensor type as a string. |
Definition at line 361 of file ossimEnviHeader.cpp.
References m_keywords.
void ossimEnviHeader::setHeaderOffset | ( | ossim_uint32 | headerOffset | ) |
Sets the header offset in bytes.
headerOffset | The number of header offset in bytes. |
Definition at line 351 of file ossimEnviHeader.cpp.
References ossimString::c_str(), m_keywords, and ossimString::toString().
void ossimEnviHeader::setInterleaveType | ( | ossimInterleaveType | interleave | ) |
Sets the envi interleave type string based on the ossimInterleaveType.
interleave | The ossimInterleaveType of the image. |
Definition at line 479 of file ossimEnviHeader.cpp.
References m_keywords, OSSIM_BIL, OSSIM_BIP, and OSSIM_BSQ.
void ossimEnviHeader::setLines | ( | ossim_uint32 | lines | ) |
Sets the number of lines.
lines | The number of lines. |
Definition at line 266 of file ossimEnviHeader.cpp.
References ossimString::c_str(), m_keywords, and ossimString::toString().
Referenced by ossimEnviHeaderFileWriter::writeFile().
void ossimEnviHeader::setMapInfo | ( | const ossimString & | mapInfo | ) |
Sets the envi map info string.
mapInfo | envi map info string. |
Definition at line 581 of file ossimEnviHeader.cpp.
References ossimString::c_str(), and m_keywords.
Referenced by ossimEnviHeaderFileWriter::writeFile().
void ossimEnviHeader::setMapInfo | ( | const ossimKeywordlist & | kwl, |
const char * | prefix = 0 |
||
) |
Sets the envi map info string from a keyword list containing geometry information.
kwl | Keyword list containing geometry information. |
Definition at line 586 of file ossimEnviHeader.cpp.
void ossimEnviHeader::setSamples | ( | ossim_uint32 | samples | ) |
Sets the number of samples.
samples | The number of samples. |
Definition at line 250 of file ossimEnviHeader.cpp.
References ossimString::c_str(), m_keywords, and ossimString::toString().
Referenced by ossimEnviHeaderFileWriter::writeFile().
void ossimEnviHeader::setSensorType | ( | const ossimString & | sensorType | ) |
Sets the envi sensor type string.
sensorType | The sensor type as a string. |
Definition at line 505 of file ossimEnviHeader.cpp.
References ossimString::c_str(), and m_keywords.
void ossimEnviHeader::setWavelengths | ( | const std::vector< ossimString > & | wavelengths | ) |
Sets the envi band name string.
wavelengths | Vector of band name strings. |
Definition at line 712 of file ossimEnviHeader.cpp.
References ossimString::join(), and m_keywords.
void ossimEnviHeader::setWavelengthUnits | ( | const ossimString & | wavelenghtUnits | ) |
Sets the envi wavelength units string.
wavelengthUnits | envi wavelength units string. |
Definition at line 684 of file ossimEnviHeader.cpp.
References ossimString::c_str(), and m_keywords.
void ossimEnviHeader::setXStart | ( | ossim_int32 | xstart | ) |
Sets the x start.
xStart |
Definition at line 551 of file ossimEnviHeader.cpp.
References ossimString::c_str(), m_keywords, and ossimString::toString().
void ossimEnviHeader::setYStart | ( | ossim_int32 | ystart | ) |
Sets the y start.
ystart |
Definition at line 571 of file ossimEnviHeader.cpp.
References ossimString::c_str(), m_keywords, and ossimString::toString().
bool ossimEnviHeader::writeFile | ( | const ossimFilename & | file | ) |
Writes header to file in a standard envi format.
file | File to write to. |
Definition at line 199 of file ossimEnviHeader.cpp.
References ossimString::c_str(), ossimKeywordlist::findKey(), m_keywords, and print().
Referenced by ossimEnviHeaderFileWriter::writeFile().
|
friend |
friend operator<<
Definition at line 224 of file ossimEnviHeader.cpp.
|
private |
Definition at line 411 of file ossimEnviHeader.h.
Referenced by getFile(), loadState(), open(), and reset().
|
private |
Definition at line 412 of file ossimEnviHeader.h.
Referenced by findSubStringCaseInsensitive(), getBandNames(), getBands(), getByteOrder(), getDataType(), getDefaultBands(), getDescription(), getFileType(), getHeaderOffset(), getInterleaveType(), getLines(), getMap(), getMapInfo(), getOssimScalarType(), getSamples(), getSensorType(), getValue(), getWavelengths(), getWavelengthUnits(), getXStart(), getYStart(), loadState(), ossimEnviHeader(), print(), readStream(), reset(), setBandNames(), setBands(), setByteorder(), setDataType(), setDescription(), setFileType(), setHeaderOffset(), setInterleaveType(), setLines(), setMapInfo(), setSamples(), setSensorType(), setWavelengths(), setWavelengthUnits(), setXStart(), setYStart(), and writeFile().