bool ossimWavelength::initialize( const ossimEnviHeader& hdr ) { //--- // Example envi wavelength format: // wavelength = { 374.323608, 382.530487, 390.737427 } //--- ossimString value; // Check the units... ossimString key = "wavelength units"; if ( hdr.getValue( key, value ) ) { if ( value.downcase() == "nanometers" ) { // Check for wavelength key: key = "wavelength"; if ( hdr.getValue( key, value ) ) { if ( value.size() ) { // Split into array. value.trim( ossimString("{}") ); std::vector<ossimString> list; value.split( list, ossimString(","), true ); if ( list.size() ) { // Initialize the map: std::vector<ossimString>::const_iterator i = list.begin(); ossim_uint32 band = 0; ossim_float32 wavelength = 0.0; while ( i != list.end() ) { wavelength = (*i).toFloat64(); m_map.insert( std::make_pair( wavelength, band ) ); ++band; ++i; } } } } } } return ( m_map.size() ? true : false); } // End: bool ossimWavelength::initialize(const ossimEnviHeader&)
bool ossimAlphaSensorSupportData::readHdrFile(const ossimEnviHeader& hdr) { bool result = false; while( 1 ) { // Required stuff will break from loop if not found/valid. m_sensorType = hdr.getSensorType(); if ( m_sensorType.empty() ) break; if ( m_sensorType == "Unknown" ) { // Make an assumption from file name... if ( hdr.getFile().file().contains( ossimString("HSI") ) ) { m_sensorType = "ACES_YOGI-HSI"; } else if ( hdr.getFile().file().contains( ossimString("HRI") ) ) { m_sensorType = "ACES_YOGI-HRI2"; } } if ( m_sensorType == "Unknown" ) { break; // Get out... } // Set the hsi flag: if ( m_sensorType.contains("HSI") || (hdr.getBands() > 63 ) ) // arbitrary... { m_isHSI = true; } else { m_isHSI = false; } m_imageSize.x = hdr.getSamples(); m_imageSize.y = hdr.getLines(); if ( !m_imageSize.x || !m_imageSize.y ) break; ossimString value; hdr.getValue("roll bias", value); if ( value.size() ) { m_rollBias = ossimString::toDouble(value); } else { break; } hdr.getValue("pitch bias", value); if ( value.size() ) { m_pitchBias = ossimString::toDouble(value); } else { break; } hdr.getValue("heading bias", value); if ( value.size() ) { m_headingBias = ossimString::toDouble(value); } else { break; } hdr.getValue("fpa fov deg", value); if ( value.size() ) { m_fov = ossimString::toDouble(value); } else { break; } hdr.getValue("slit rotation deg", value); if ( value.size() ) { m_slitRot = ossimString::toDouble(value); } else { // Removed requirement. Missing in some support data and always 0 when present. if ( traceDebug() ) { ossimNotify(ossimNotifyLevel_NOTICE) << "Missing: \"slit rotation deg\"\n"; } } if (traceDebug()) { ossimNotify(ossimNotifyLevel_DEBUG) << "ossimAlphaSensorSupportData::readHdrFile DEBUG:" << "\n getSensorType = " << m_sensorType << "\n getSamples = " << m_imageSize.x << "\n getLines = " << m_imageSize.y << "\n roll bias = " << m_rollBias << "\n pitch bias = " << m_pitchBias << "\n heading bias = " << m_headingBias << "\n fpa fov deg = " << m_fov << "\n slit rotation deg = " << m_slitRot << "\n"; } // Last two lines of while forever. If we get here, set status true and break out. result = true; break; } return result; } // End: bool ossimAlphaSensorSupportData::readHdrFile(const ossimEnviHeader& )