bool ossimGeneralRasterInfo::initializeFromEnviHdr( const ossimEnviHeader& enviHdr ) { bool result = false; while( 1 ) { //--- // Go through the data members in order. // If a required item is not found break from loop. //-- theMetaData.clear(); // scalar ( required ) : if( enviHdr.getOssimScalarType() != OSSIM_SCALAR_UNKNOWN ) { theMetaData.setScalarType( enviHdr.getOssimScalarType() ); } else { break; } theImageFileList.clear(); // interleave ( required ): theInterleaveType = enviHdr.getOssimInterleaveType(); if ( theInterleaveType == OSSIM_INTERLEAVE_UNKNOWN ) { break; } // bands ( required ): if ( !enviHdr.getBands() ) { break; } theMetaData.setNumberOfBands( enviHdr.getBands() ); // lines ( required ): ossim_uint32 lines = enviHdr.getLines(); if ( !lines ) { break; } // samples ( required ): ossim_uint32 samples = enviHdr.getSamples(); if ( !samples ) { break; } // Set the rectangles: theRawImageRect = ossimIrect( 0, 0, samples - 1, lines - 1 ); theValidImageRect = theRawImageRect; theImageRect = theRawImageRect; // sample start ( not required ): theSubImageOffset.x = enviHdr.getXStart(); // line start ( not required ): theSubImageOffset.y = enviHdr.getYStart(); // header offset ( not required ): theHeaderSize = enviHdr.getHeaderOffset(); // null mode: theSetNullsMode = ossimGeneralRasterInfo::NONE; // pixels to chop: thePixelsToChop = 0; // Byte order, this will be system if not found. theImageDataByteOrder = enviHdr.getByteOrder(); result = true; break; // Trailing break to get out. } return result; } // End: ossimGeneralRasterInfo::initializeFromEnviHdr( 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& )