diff --git a/Testing/Code/Projections/otbGenericRSTransformGenericConversionCheckingFromGCP.cxx b/Testing/Code/Projections/otbGenericRSTransformGenericConversionCheckingFromGCP.cxx index 2e3051264564921e1b2cd43aa2ec366cdb7c7dc9..3c8d295db2de7e952e1807942f6d6aff2bfcda5f 100644 --- a/Testing/Code/Projections/otbGenericRSTransformGenericConversionCheckingFromGCP.cxx +++ b/Testing/Code/Projections/otbGenericRSTransformGenericConversionCheckingFromGCP.cxx @@ -112,18 +112,26 @@ int otbGenericRSTransformGenericConversionCheckingFromGCP(int argc, char* argv[] std::cerr<<"GCP #"<<GCPid<<": ["<<ImgGCP[0]<<","<<ImgGCP[1]<<"] -> "<<"["<<GeoGCP[0]<<","<<GeoGCP[1]<<"]"<<std::endl; std::cerr<<"Estimated Positions: "<<std::endl; - std::cerr<<"Geographic (WGS84): "<<" ["<<estimatedGeoGCP[0]<<","<<estimatedGeoGCP[1]<<"]"<<std::endl; + std::cerr<<"Geographic (WGS84): "<<" ["<<estimatedGeoGCP[0]<<","<<estimatedGeoGCP[1]<<"]"; if((geoRes > geoTol) || vnl_math_isnan(geoRes)) { - std::cerr<<"!!! Geographic (WGS84) residual is too high: "<<geoRes<<" meters !!!"<<std::endl; + std::cerr<<" -> !!! Geographic (WGS84) residual is too high: "<<geoRes<<" meters !!!"<<std::endl; pass = false; } - std::cerr<<"Image index: "<<" ["<<estimatedImgGCP[0]<<","<<estimatedImgGCP[1]<<"]"<<std::endl; + else + { + std::cerr<<std::endl; + } + std::cerr<<"Image index: "<<" ["<<estimatedImgGCP[0]<<","<<estimatedImgGCP[1]<<"]"; if((imgRes > imgTol) || vnl_math_isnan(imgRes)) { - std::cerr<<"!!! Image residual is too high: "<<imgRes<<" pixels !!!"<<std::endl; + std::cerr<<" -> !!! Image residual is too high: "<<imgRes<<" pixels !!!"<<std::endl; pass = false; } + else + { + std::cerr<<std::endl; + } std::cerr<<"## ---------- ##"<<std::endl; } diff --git a/Utilities/otbossim/include/ossim/base/ossimColumnVector3d.h b/Utilities/otbossim/include/ossim/base/ossimColumnVector3d.h index ab72bffa503f30f6e75468a77de7b6f701e072b5..7cda6fce75fd9ba3fd5dfa722b80cb3837a7d7ca 100644 --- a/Utilities/otbossim/include/ossim/base/ossimColumnVector3d.h +++ b/Utilities/otbossim/include/ossim/base/ossimColumnVector3d.h @@ -8,7 +8,7 @@ // coordinate. // //******************************************************************* -// $Id: ossimColumnVector3d.h 9532 2006-09-11 11:20:05Z dburken $ +// $Id: ossimColumnVector3d.h 20039 2011-09-06 14:58:16Z oscarkramer $ #ifndef ossimColumnVector3d_HEADER #define ossimColumnVector3d_HEADER #include <ossim/base/ossimConstants.h> @@ -40,11 +40,16 @@ public: } ossimColumnVector3d(const ossimColumnVector3d &rhs) - { - data[0] = rhs.data[0]; - data[1] = rhs.data[1]; - data[2] = rhs.data[2]; - } + { + data[0] = rhs.data[0]; + data[1] = rhs.data[1]; + data[2] = rhs.data[2]; + } + + ossimColumnVector3d(const NEWMAT::ColumnVector& rhs) + { + *this = rhs; + } const ossimColumnVector3d& operator=(const NEWMAT::ColumnVector& rhs) { diff --git a/Utilities/otbossim/include/ossim/base/ossimCommon.h b/Utilities/otbossim/include/ossim/base/ossimCommon.h index d8dbe0076ad9333585acd07fece8049ad0320ec5..48e32c6349114b5121c5f1dd98418b2a556b9e06 100644 --- a/Utilities/otbossim/include/ossim/base/ossimCommon.h +++ b/Utilities/otbossim/include/ossim/base/ossimCommon.h @@ -10,7 +10,7 @@ // Description: Common file for utility functions. // //************************************************************************* -// $Id: ossimCommon.h 19948 2011-08-12 19:02:41Z gpotts $ +// $Id: ossimCommon.h 20040 2011-09-06 14:59:05Z oscarkramer $ #ifndef ossimCommon_HEADER #define ossimCommon_HEADER @@ -486,7 +486,7 @@ namespace ossim if(!valuesList.empty()) { ossim_uint32 idx = 0; - ossim_uint32 size = (valuesList.size()-1); + ossim_uint32 size = (ossim_uint32) (valuesList.size()-1); for(idx = 0; idx < size; ++idx) { out << valuesList[idx] << ","; diff --git a/Utilities/otbossim/include/ossim/base/ossimDblGrid.h b/Utilities/otbossim/include/ossim/base/ossimDblGrid.h index 611bc69da60a622d50cfd01bdc711ed9f7472840..64e51c01aa586496f885cd0fbaf7a8a655b0aae4 100644 --- a/Utilities/otbossim/include/ossim/base/ossimDblGrid.h +++ b/Utilities/otbossim/include/ossim/base/ossimDblGrid.h @@ -1,7 +1,7 @@ //***************************************************************************** -// FILE: ossimDblGrid.h +// O S S I M // -// Copyright (C) 2001 ImageLinks, Inc. +// FILE: ossimDblGrid.h // // License: See top level LICENSE.txt file. // @@ -24,7 +24,7 @@ // spacing are specified to the constructor. // //***************************************************************************** -// $Id: ossimDblGrid.h 19441 2011-04-25 16:47:28Z dburken $ +// $Id: ossimDblGrid.h 20044 2011-09-06 15:02:43Z oscarkramer $ #ifndef ossimDblGrid_HEADER #define ossimDblGrid_HEADER diff --git a/Utilities/otbossim/include/ossim/base/ossimEcefPoint.h b/Utilities/otbossim/include/ossim/base/ossimEcefPoint.h index 25fbb1c7b846aa63576495d0e8ce07e41f19e98a..070f5269883dec674bb2efb0e03850a9b4bac2c1 100644 --- a/Utilities/otbossim/include/ossim/base/ossimEcefPoint.h +++ b/Utilities/otbossim/include/ossim/base/ossimEcefPoint.h @@ -13,7 +13,7 @@ // Initial coding. //< //***************************************************************************** -// $Id: ossimEcefPoint.h 11860 2007-10-15 19:59:10Z dburken $ +// $Id: ossimEcefPoint.h 20043 2011-09-06 15:00:55Z oscarkramer $ #ifndef ossimEcefPoint_HEADER #define ossimEcefPoint_HEADER @@ -22,10 +22,12 @@ #include <ossim/base/ossimColumnVector3d.h> #include <ossim/base/ossimNotify.h> #include <ossim/base/ossimString.h> +#include <ossim/matrix/newmat.h> class ossimGpt; class ossimEcefVector; class ossimDpt3d; + //***************************************************************************** // CLASS: ossimEcefPoint // @@ -52,6 +54,9 @@ public: ossimEcefPoint(const ossimColumnVector3d& assign_this) : theData(assign_this) {} + ossimEcefPoint(const NEWMAT::ColumnVector& assign_this) + : theData(assign_this) {} + ossimEcefPoint(const ossimDpt3d& pt); void makeNan() @@ -151,6 +156,27 @@ public: */ void toPoint(const std::string& s); + //! Converts this point to a 3D column vector. + NEWMAT::ColumnVector toVector() const + { + NEWMAT::ColumnVector v (3); + v(0) = theData[0]; + v(1) = theData[1]; + v(2) = theData[2]; + return v; + } + + //! Converts 3D column vector to this point. + void toPoint(const NEWMAT::ColumnVector& v) + { + if (v.Nrows() == 3) + { + theData[0] = v[0]; + theData[1] = v[1]; + theData[2] = v[2]; + } + } + /*! * Debug Dump: */ diff --git a/Utilities/otbossim/include/ossim/base/ossimEcefVector.h b/Utilities/otbossim/include/ossim/base/ossimEcefVector.h index 83f29cf2bdd2f3a63963c585d492abdcaba4da2f..ee928eefee106769a26311d7a87ea40c3a486153 100644 --- a/Utilities/otbossim/include/ossim/base/ossimEcefVector.h +++ b/Utilities/otbossim/include/ossim/base/ossimEcefVector.h @@ -16,7 +16,7 @@ // Initial coding. //< //***************************************************************************** -// $Id: ossimEcefVector.h 11398 2007-07-26 13:29:58Z dburken $ +// $Id: ossimEcefVector.h 20043 2011-09-06 15:00:55Z oscarkramer $ #ifndef ossimEcefVector_HEADER #define ossimEcefVector_HEADER @@ -26,6 +26,7 @@ #include <ossim/base/ossimColumnVector3d.h> #include <ossim/base/ossimEcefPoint.h> #include <ossim/base/ossimString.h> +#include <ossim/matrix/newmat.h> class ossimGpt; @@ -45,6 +46,9 @@ public: ossimEcefVector(const ossimEcefVector& copy_this) : theData (copy_this.theData) {} + ossimEcefVector(const NEWMAT::ColumnVector& assign_this) + : theData (assign_this) {} + ossimEcefVector(const ossimEcefPoint& from, const ossimEcefPoint& to) : theData (to.data() - from.data()) {} @@ -148,6 +152,16 @@ public: */ void toPoint(const std::string& s); + //! Converts this point to a 3D column vector. + NEWMAT::ColumnVector toVector() const + { + NEWMAT::ColumnVector v (3); + v(0) = theData[0]; + v(1) = theData[1]; + v(2) = theData[2]; + return v; + } + /*! * Debug Dump: */ diff --git a/Utilities/otbossim/include/ossim/base/ossimGzStream.h b/Utilities/otbossim/include/ossim/base/ossimGzStream.h index f338cbb0d6a2027eae5926a1f57440f2d9201a73..133c827a198cdbb7db481f6acc31ad2bc9c97d8d 100644 --- a/Utilities/otbossim/include/ossim/base/ossimGzStream.h +++ b/Utilities/otbossim/include/ossim/base/ossimGzStream.h @@ -19,7 +19,7 @@ // // File : gzstream.h // Revision : $Revision: 13050 $ -// Revision_date : $Date: 2008-06-20 02:07:35 +0800 (Fri, 20 Jun 2008) $ +// Revision_date : $Date: 2008-06-19 20:07:35 +0200 (jeu., 19 juin 2008) $ // Author(s) : Deepak Bandyopadhyay, Lutz Kettner // // Standard streambuf implementation following Nicolai Josuttis, "The diff --git a/Utilities/otbossim/include/ossim/base/ossimLagrangeInterpolator.h b/Utilities/otbossim/include/ossim/base/ossimLagrangeInterpolator.h new file mode 100644 index 0000000000000000000000000000000000000000..9929feed3acb2a6d11f8ce7da324bbdfa33efba8 --- /dev/null +++ b/Utilities/otbossim/include/ossim/base/ossimLagrangeInterpolator.h @@ -0,0 +1,46 @@ +//************************************************************************************************** +// OSSIM -- Open Source Software Image Map +// +// LICENSE: See top level LICENSE.txt file. +// +// AUTHOR: Oscar Kramer, GeoEye Inc. +// +// DESCRIPTION: Contains Lagrange Interpolator class +// +// $Id$ +//************************************************************************************************** +#ifndef LagrangeInterp_HEADER +#define LagrangeInterp_HEADER + +#include <iostream> +#include <vector> +#include <ossim/matrix/newmat.h> +#include <ossim/base/ossimReferenced.h> + +//****************************************************************************** +// CLASS: ossimLagrangeInterpolator +//****************************************************************************** +class ossimLagrangeInterpolator : public ossimReferenced +{ + friend std::ostream& operator<<(std::ostream&, const ossimLagrangeInterpolator&); + friend std::istream& operator>>(std::istream&, ossimLagrangeInterpolator&); + +public: + ossimLagrangeInterpolator() : theNumElements(0) {} + ossimLagrangeInterpolator(std::istream&); + ossimLagrangeInterpolator(const std::vector<double>& t_array, + const std::vector<NEWMAT::ColumnVector>& data_array); + ~ossimLagrangeInterpolator(); + + void addData(const double& t, const NEWMAT::ColumnVector& data); + + bool interpolate(const double& t, NEWMAT::ColumnVector& result) const; + +private: + std::vector<double> theTeeArray; + std::vector<NEWMAT::ColumnVector> theDataArray; + std::vector<double> theNormalizer; + ossim_uint32 theNumElements; +}; + +#endif diff --git a/Utilities/otbossim/include/ossim/elevation/ossimDtedElevationDatabase.h b/Utilities/otbossim/include/ossim/elevation/ossimDtedElevationDatabase.h index 79a73aa0bb0ef011fdaabc5d581f5a691dc96a5d..af9046da529882c3b4142f9c5ed9dde390270c69 100644 --- a/Utilities/otbossim/include/ossim/elevation/ossimDtedElevationDatabase.h +++ b/Utilities/otbossim/include/ossim/elevation/ossimDtedElevationDatabase.h @@ -71,7 +71,9 @@ public: protected: ossimString m_extension; - + ossimRefPtr<ossimElevCellHandler> m_lastHandler; + mutable OpenThreads::Mutex m_mutex; + bool openDtedDirectory(const ossimFilename& dir); void createRelativePath(ossimFilename& file, const ossimGpt& gpt)const; void createFullPath(ossimFilename& file, const ossimGpt& gpt)const @@ -81,42 +83,6 @@ protected: file = ossimFilename(m_connectionString).dirCat(relativeFile); } virtual ossimRefPtr<ossimElevCellHandler> createCell(const ossimGpt& gpt); -#if 0 - ossimRefPtr<ossimElevCellHandler> getOrCreateHandler(const ossimGpt& gpt) - { - ossimRefPtr<ossimElevCellHandler> result = 0; - ossim_uint64 id = createId(gpt); - m_cacheMapMutex.lock(); - CellMap::iterator iter = m_cacheMap.find(id); - - if(iter != m_cacheMap.end()) - { - iter->second->updateTimestamp(); - result = iter->second->m_handler.get(); - } - else - { - ossimFilename f; - createFullPath(f, gpt); - if(f.exists()) - { - ossimRefPtr<ossimDtedHandler> h = new ossimDtedHandler(f, m_memoryMapCellsFlag); - if (!(h->getErrorStatus())) - { - m_cacheMap.insert(std::make_pair(id, new CellInfo(createId(gpt), h.get()))); - result = h.get(); - } - } - if(m_cacheMap.size() > m_maxOpenCells) - { - flushCacheToMinOpenCells(); - } - } - m_cacheMapMutex.unlock(); - - return result; - } -#endif TYPE_DATA }; #endif diff --git a/Utilities/otbossim/include/ossim/kbool/graph.h b/Utilities/otbossim/include/ossim/kbool/graph.h index 7c51be019aece3bd2efe22536b6a95751500697c..4aaf038a3e150104b3459a79feea0406bada4c2c 100644 --- a/Utilities/otbossim/include/ossim/kbool/graph.h +++ b/Utilities/otbossim/include/ossim/kbool/graph.h @@ -8,7 +8,7 @@ RCS-ID: $Id: graph.h 9094 2006-06-13 19:12:40Z dburken $ */ -/* @@(#) $Source$ $Revision: 9094 $ $Date: 2006-06-14 03:12:40 +0800 (Wed, 14 Jun 2006) $ */ +/* @@(#) $Source$ $Revision: 9094 $ $Date: 2006-06-13 21:12:40 +0200 (mar., 13 juin 2006) $ */ /* Program GRAPH.H diff --git a/Utilities/otbossim/include/ossim/kbool/graphlst.h b/Utilities/otbossim/include/ossim/kbool/graphlst.h index 51976ebe6bc0362576a9bcbff5b986ab871d5093..16a718ed3ff4e29642c4208075fbc872bd605335 100644 --- a/Utilities/otbossim/include/ossim/kbool/graphlst.h +++ b/Utilities/otbossim/include/ossim/kbool/graphlst.h @@ -8,7 +8,7 @@ RCS-ID: $Id: graphlst.h 9094 2006-06-13 19:12:40Z dburken $ */ -/* @@(#) $Source$ $Revision: 9094 $ $Date: 2006-06-14 03:12:40 +0800 (Wed, 14 Jun 2006) $ */ +/* @@(#) $Source$ $Revision: 9094 $ $Date: 2006-06-13 21:12:40 +0200 (mar., 13 juin 2006) $ */ /* Program GRAPHLST.H diff --git a/Utilities/otbossim/include/ossim/kbool/lpoint.h b/Utilities/otbossim/include/ossim/kbool/lpoint.h index 441fcd916431a083c2a638b18dcb65929b041513..b14ed831477f45ea5eb6a507bb9239fbef9786a4 100644 --- a/Utilities/otbossim/include/ossim/kbool/lpoint.h +++ b/Utilities/otbossim/include/ossim/kbool/lpoint.h @@ -8,7 +8,7 @@ RCS-ID: $Id: lpoint.h 9094 2006-06-13 19:12:40Z dburken $ */ -/* @@(#) $Source$ $Revision: 9094 $ $Date: 2006-06-14 03:12:40 +0800 (Wed, 14 Jun 2006) $ */ +/* @@(#) $Source$ $Revision: 9094 $ $Date: 2006-06-13 21:12:40 +0200 (mar., 13 juin 2006) $ */ /* Program LPOINT.H diff --git a/Utilities/otbossim/include/ossim/ossimConfig.h b/Utilities/otbossim/include/ossim/ossimConfig.h deleted file mode 100644 index be4e5707b47b3357deb99cfd9bf0d97aed89d6a2..0000000000000000000000000000000000000000 --- a/Utilities/otbossim/include/ossim/ossimConfig.h +++ /dev/null @@ -1,20 +0,0 @@ -/* $Id: ossimConfig.h.in 13607 2008-09-25 19:39:45Z gpotts $ */ -#ifndef ossimConfig_HEADER -#define ossimConfig_HEADER - -/* Define to "1" if you have libz installed, "0" if not. */ -#define OSSIM_HAS_LIBZ 1 - -/* Define to "1" if you have MPI(lam/mpi), "0" if not. */ -#define OSSIM_HAS_MPI 0 - -/* Define to "1" if you have FREETYPE, "0" if not. */ -#define OSSIM_HAS_FREETYPE 0 - -/* Define to "1" if you have GEOTIFF, "0" if not. */ -#define OSSIM_HAS_GEOTIFF 1 - -/* Enable cvs id strings for use with "ident" application. */ -#define OSSIM_ID_ENABLED 1 - -#endif /* End of "#ifndef ossimConfig_HEADER" */ diff --git a/Utilities/otbossim/include/ossim/ossimVersion.h b/Utilities/otbossim/include/ossim/ossimVersion.h deleted file mode 100644 index 080ffa9b44621e8baf5a74ed967f8f4e69b4376a..0000000000000000000000000000000000000000 --- a/Utilities/otbossim/include/ossim/ossimVersion.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef ossimVersion_HEADER -#define ossimVersion_HEADER - -#define OSSIM_VERSION "1.8.6" -#define OSSIM_MAJOR_VERSION_NUMBER 1 -#define OSSIM_MINOR_VERSION_NUMBER 8 -#define OSSIM_PATCH_VERSION_NUMBER 6 -#define OSSIM_RELEASE_NUMBER 1 -#define OSSIM_REVISION_NUMBER 20036 - -// date format = (yyyymmdd) -#define OSSIM_BUILD_DATE "20110904" - -#endif /* End of #ifndef ossimVersion_HEADER */ diff --git a/Utilities/otbossim/include/ossim/parallel/ossimJobMultiThreadQueue.h b/Utilities/otbossim/include/ossim/parallel/ossimJobMultiThreadQueue.h index b1695bc1b0629a91f4a2ada7573e097b4fe5bf9c..27e61fc423fa92d724345cbca8cbb77195c21444 100644 --- a/Utilities/otbossim/include/ossim/parallel/ossimJobMultiThreadQueue.h +++ b/Utilities/otbossim/include/ossim/parallel/ossimJobMultiThreadQueue.h @@ -14,6 +14,9 @@ public: void setNumberOfThreads(ossim_uint32 nThreads); ossim_uint32 numberOfBusyThreads()const; bool areAllThreadsBusy()const; + + bool hasJobsToProcess()const; + protected: mutable OpenThreads::Mutex m_mutex; ossimRefPtr<ossimJobQueue> m_jobQueue; diff --git a/Utilities/otbossim/include/ossim/parallel/ossimJobThreadQueue.h b/Utilities/otbossim/include/ossim/parallel/ossimJobThreadQueue.h index 38f8e8bc6e00ef4474aa1307d666b8bc791f7a77..1e03dc5a7984d2e30edaa810d5cd1a7e4edacc06 100644 --- a/Utilities/otbossim/include/ossim/parallel/ossimJobThreadQueue.h +++ b/Utilities/otbossim/include/ossim/parallel/ossimJobThreadQueue.h @@ -30,6 +30,8 @@ public: bool isProcessingJob()const; + bool hasJobsToProcess()const; + protected: virtual ~ossimJobThreadQueue(); diff --git a/Utilities/otbossim/include/ossim/projection/ossimRS1SarModel.h b/Utilities/otbossim/include/ossim/projection/ossimRS1SarModel.h new file mode 100644 index 0000000000000000000000000000000000000000..1cea8ef7fed410b59c2286acebe2a4cb74a6f472 --- /dev/null +++ b/Utilities/otbossim/include/ossim/projection/ossimRS1SarModel.h @@ -0,0 +1,150 @@ +//******************************************************************* +// +// License: See top level LICENSE.txt file. +// +// Author: Oscar Kramer +// +// Description: +// +// Sensor Model for Radarsat1 SAR sensor. +// +//******************************************************************* +// $Id:$ + +#ifndef ossimRS1SarModel_HEADER +#define ossimRS1SarModel_HEADER + +#include <ossim/base/ossimLsrPoint.h> +#include <ossim/base/ossimLsrVector.h> +#include <ossim/base/ossimEcefPoint.h> +#include <ossim/base/ossimGpt.h> +#include <ossim/base/ossimDrect.h> +#include <ossim/base/ossimFilename.h> +#include <ossim/base/ossimDblGrid.h> +#include <ossim/projection/ossimSarModel.h> +#include <ossim/base/ossimLagrangeInterpolator.h> +#include <ossim/support_data/ossimCeosData.h> + +class NEWMAT::Matrix; + +//***************************************************************************** +// CLASS: ossimRS1SarModel +//***************************************************************************** +class ossimRS1SarModel : public ossimSensorModel +{ +public: + ossimRS1SarModel(); + ossimRS1SarModel(const ossimFilename& imageDir); + ossimRS1SarModel(const ossimKeywordlist& geom_kwl); + ossimRS1SarModel(const ossimRS1SarModel& copy_this); + + virtual ~ossimRS1SarModel(); + + enum ImagingMode + { + UNKNOWN_MODE = 0, + SCN, // ScanSAR Narrow Beam + SCW, // ScanSAR Wide Beam + SGC, // SAR Georeferenced Coarse Resolution + SGF, // SAR Georeferenced Fine Resolution + SGX, // SAR Georeferenced Extra Fine Resolution + SLC, // Single Look Complex + SPG, // SAR Precision Geocoded + SSG, // SAR Systematically Geocoded + RAW, + ERS + }; + + enum DirectionFlag + { + UNKNOWN_DIRECTION = 0, + ASCENDING, + DESCENDING + }; + + //! Fulfills ossimObject base-class pure virtuals. Saves modeling info to KWL. + //! Returns true if successful. + virtual bool saveState(ossimKeywordlist& kwl, const char* prefix=NULL) const; + + //! Fulfills ossimObject base-class pure virtuals. Reads modeling info from KWL. + //! Returns true if successful. + virtual bool loadState(const ossimKeywordlist& kwl, const char* prefix=NULL); + + //! Establishes geographic 3D point given image line, sample and MSL elevation. + virtual void lineSampleHeightToWorld(const ossimDpt& imagePt, + const double& heightMSL, + ossimGpt& worldPt) const; + + //! Given an image point, returns a ray originating at some arbitrarily high + //! point (in this model at the sensor position) and pointing towards the target. + virtual void imagingRay(const ossimDpt& image_point, ossimEcefRay& image_ray) const; + +protected: + void setImagingMode(char* modeStr); + void initFromCeos(const ossimFilename& dataDir); + void initAdjParms(); + void establishEphemeris(); + void eciToEcfXform(const double& julianDay, NEWMAT::Matrix& xform) const; + void establishOrpInterp(); + void establishOrpGrid(); + void establishVehicleSpace(); + void interpolatedScanORP(const ossimDpt& orp, ossimEcefPoint& orp_ecf) const; + void deallocateMemory(); + + ossimRefPtr<ossimCeosData> theCeosData; + ossimRefPtr<ossimLagrangeInterpolator> theArpPosInterp; // in ECF + ossimRefPtr<ossimLagrangeInterpolator> theArpVelInterp; // in ECF + ossimRefPtr<ossimLagrangeInterpolator> theLocalOrpInterp; // in ECF + ImagingMode theImagingMode; + double theIllumAzimuth; + double theIllumElevation; + ossimEcefPoint theORP; + double theRefHeight; + double theGHA; // Greenwich Hour Angle of first eph. pt. + double theEphFirstSampTime; // in seconds from start of day + double theSinOrientation; + double theCosOrientation; + double theSinSkew; + ossimLsrSpace theVehicleSpace; + ossimEcefVector thePosCorrection; + int theFirstLineDay; // julian day + double theFirstLineTime; // seconds + double theTimePerLine; // seconds + DirectionFlag theDirectionFlag; + double theSrGrCoeff[6]; + ossimDpt thePixelSpacing; + //*** + // Additional data members used for scan-mode imagery: + //*** + ossimDblGrid theLatGrid; + ossimDblGrid theLonGrid; + + //*** + // Adjustable Parameters: + //*** + double theInTrackOffset; // meters + double theCrTrackOffset; // meters + double theRadialOffset; // meters + double theLineScale; + double theSkew; + double theOrientation; // degrees + + //*** + // Adjustable model parameters array indexes: + //*** + enum ADJUSTABLE_PARAM_INDEXES + { + INTRACK_OFFSET, + CRTRACK_OFFSET, + RADIAL_OFFSET, + LINE_SCALE, + SKEW, + ORIENTATION, + NUM_ADJUSTABLE_PARAMS // not a parameter + }; + +}; + + +#endif + diff --git a/Utilities/otbossim/include/ossim/support_data/ossimCeosData.h b/Utilities/otbossim/include/ossim/support_data/ossimCeosData.h new file mode 100644 index 0000000000000000000000000000000000000000..b191e6e17367fccc2921eb28d0f589cb3b47f397 --- /dev/null +++ b/Utilities/otbossim/include/ossim/support_data/ossimCeosData.h @@ -0,0 +1,1054 @@ +//******************************************************************* +// +// License: See top level LICENSE.txt file. +// +// Author: Oscar Kramer +// +// Description: +// +// Class for reading CEOS-formatted metadata. +// +//******************************************************************* +// $Id:$ +#ifndef ossimCeosData_HEADER +#define ossimCeosData_HEADER + +#include <cstdio> +#include <iostream> + +#include <ossim/base/ossimFilename.h> +#include <ossim/base/ossimReferenced.h> + +struct desc_rec // Record description +{ + ossim_int32 rec_seq; // Record sequence number (B4) + ossim_uint8 rec_sub1; // First record sub-type code (B1) + ossim_uint8 rec_type; // Record type code (B1) + ossim_uint8 rec_sub2; // Second record sub-type code (B1) + ossim_uint8 rec_sub3; // Third record sub-type code (B1) + ossim_int32 length; // Length of this record, bytes (B4) +}; + + +struct vol_desc_rec // Volume descriptor record +{ + struct desc_rec desc; // Record description + char ascii_flag[2]; // ASCII flag (A2) + char spare1[2]; // Unused (A2) + char format_doc[12]; // Format control documentation (A12) + char format_ver[2]; // Format doc version (A2) + char format_rev[2]; // Format doc revision (A2) + char software_id[12]; // Software identifier (A12) + char phyvol_id[16]; // Physical volume identifier (A16) + char logvol_id[16]; // Logical volume identifier (A16) + char volset_id[16]; // Volume set identifier (A16) + char phyvol_cnt[2]; // Total physical volume count (I2) + char first_phyvol[2]; // Physical vol of first tape (I2) + char last_phyvol[2]; // Physical vol of last tape (I2) + char curr_phyvol[2]; // Physical vol of current tape (I2) + char first_file[4]; // First file number in phyvol (I4) + char volset_log[4]; // Logical volume within set (I4) + char phyvol_log[4]; // Logical volume within phyvol (I4) + char logvol_date[8]; // Logvol creation date (A8) + char logvol_time[8]; // Logvol creation time (A8) + char logvol_country[12]; // Logvol generation country (A12) + char logvol_agency[8]; // Logvol generation agency (A8) + char logvol_facility[12]; // Logvol generation facility (A12) + char n_filepoint[4]; // Number of file pointer records (I4) + char n_voldir[4]; // Number of voldir records (I4) + char spare2[92]; // Unused (A92) + char product_id[8]; // Product identifier (A8) + char spare3[92]; // Local use segment (A92) +}; + + +struct file_pntr_rec // File pointer record +{ + struct desc_rec desc; // Record description + char ascii_flag[2]; // ASCII flag (A2) + char spare1[2]; // Unused (A2) + char file_num[4]; // Referenced file number (I4) + char file_name[16]; // Referenced file name (A16) + char file_class[28]; // Referenced file class (A28) + char file_code[4]; // Referenced file class code (A4) + char data_type[28]; // Referenced file data type (A28) + char data_code[4]; // Referenced file data type code (A4) + char nrec[8]; // Referenced file record count (I8) + char first_len[8]; // First record length, bytes (I8) + char max_len[8]; // Maximum record length, bytes (I8) + char len_type[12]; // Record length type (A12) + char len_code[4]; // Record length type code (A4) + char first_phyvol[2]; // First physical volume (I2) + char last_phyvol[2]; // Last physical volume (I2) + char first_rec[8]; // First phyvol record (I8) + char last_rec[8]; // Last phyvol record (I8) + char spare2[100]; // Unused (A100) + char spare3[100]; // Unused (A100) +}; + + +struct text_rec // Text record +{ + struct desc_rec desc; // Record description + char ascii_flag[2]; // ASCII flag (A2) + char cont_flag[2]; // Continuation flag (A2) + char product_type[40]; // Product type specifier (A40) + char product_create[60]; // Product creation info (A60) + char phyvol_id[40]; // Physical volume identifier (A40) + char scene_id[40]; // Scene identifier (A40) + char scene_loc[40]; // Scene location (A40) + char copyright_info[20]; // Unused (A20) + char spare2[104]; // Unused (A104) +}; + + +struct sar_desc_rec // SAR leader/trailer descriptor +{ + struct desc_rec desc; // Record description + char ascii_flag[2]; // ASCII flag (A2) + char spare1[2]; // Unused (A2) + char format_doc[12]; // Format control document (A12) + char format_rev[2]; // Format document revision (A2) + char design_rev[2]; // File design revision (A2) + char software_id[12]; // Software identifier (A12) + char file_num[4]; // File number (I4) + char file_name[16]; // File name (A16) + char rec_seq[4]; // Record sequence/location flag (A4) + char seq_loc[8]; // Sequence number location (I8) + char seq_len[4]; // Sequence number length (I4) + char rec_code[4]; // Record code/location flag (A4) + char code_loc[8]; // Record code location (I8) + char code_len[4]; // Record code length (I4) + char rec_len[4]; // Record length/location flag (A4) + char rlen_loc[8]; // Record length location (I8) + char rlen_len[4]; // Record length, bytes (I4) + char spare2; // Reserved (A1) + char spare3; // Reserved (A1) + char spare4; // Reserved (A1) + char spare5; // Reserved (A1) + char spare6[64]; // Reserved segment (A64) + char n_dataset[6]; // Number of dataset summary records (I6) + char l_dataset[6]; // Data set summary record length, bytes (I6) + char n_map_proj[6]; // Number of map proj records (I6) + char l_map_proj[6]; // Map proj record length, bytes (I6) + char n_plat_pos[6]; // Number of plat pos records (I6) + char l_plat_pos[6]; // Plat pos record length, bytes (I6) + char n_att_data[6]; // Number of att data records (I6) + char l_att_data[6]; // Att data record length, bytes (I6) + char n_radi_data[6]; // Number of radiometric data records (I6) + char l_radi_data[6]; // Radi data record length, bytes (I6) + char n_radi_comp[6]; // Number of radiometric compensation records (I6) + char l_radi_comp[6]; // Radiometric compensation record length, bytes (I6) + char n_qual_sum[6]; // Number of data qual sum records (I6) + char l_qual_sum[6]; // Dat qual sum record length,bytes (I6) + char n_data_hist[6]; // Number of data histogram records (I6) + char l_data_hist[6]; // Data hist record length, bytes (I6) + char n_rang_spec[6]; // Number of range spectra records (I6) + char l_rang_spec[6]; // Range spectra record length, bytes (I6) + char n_dem_desc[6]; // Number of DEM descriptor records (I6) + char l_dem_desc[6]; // DEM desc record length, bytes (I6) + char n_radar_par[6]; // Number of RADAR par records (I6) + char l_radar_par[6]; // RADAR par record length, bytes (I6) + char n_anno_data[6]; // Number of annotation data records (I6) + char l_anno_data[6]; // Annotation data record length, bytes (I6) + char n_det_proc[6]; // Number of processing parameter records (I6) + char l_det_proc[6]; // Processing parameter record length, bytes (I6) + char n_cal[6]; // Number of calibration records (I6) + char l_cal[6]; // Calibration record length, bytes (I6) + char n_gcp[6]; // Number of GCP records (I6) + char l_gcp[6]; // GCP record length, bytes (I6) + char spare7[10][6]; // Unused (I6) + char n_fac_data[6]; // Number of facility data records (I6) + char l_fac_data[6]; // Fac data record length, bytes (I6) + char spare8[288]; // Unused (A288) +}; + + +struct dataset_sum_rec // Data set summary record +{ + struct desc_rec desc; // Record description + char seq_num[4]; // Sequence number (I4) + char sar_chn[4]; // SAR channel indicator (I4) + char scene_id[16]; // Scene identifier (A16) + char scene_des[32]; // Scene designator (A32) + char inp_sctim[32]; // Input scene centre time (A32) + char asc_des[16]; // Ascending/descending (A16) + char pro_lat[16]; // Processed scene centre latitude (F16.7) + char pro_long[16]; // Processed scene centre longitude (F16.7) + char pro_head[16]; // Processed scene centre headng (F16.7) + char ellip_des[16]; // Ellipsoid designator (A16) + char ellip_maj[16]; // Ellipsoid semi-major axis, km (F16.7) + char ellip_min[16]; // Ellipsoid semi_minor axis, km (F16.7) + char earth_mass[16]; // Earth's mass (E16.7) + char grav_const[16]; // Gravitational constant (E16.7) + char ellip_j[3][16]; // Ellipsoid J2-4 parameters (E16.7) + char spare1[16]; // Unused (A16) + char terrain_h[16]; // Average terrain height, km (F16.7) + char sc_lin[8]; // Scene centre line number (I8) + char sc_pix[8]; // Scene centre pixel number (I8) + char scene_len[16]; // Scene length, km (F16.7) + char scene_wid[16]; // Scene width, km (F16.7) + char spare2[16]; // Unused (A16) + char nchn[4]; // Number of SAR channels (I4) + char spare3[4]; // Unused (A4) + char mission_id[16]; // Mission identifier (A16) + char sensor_id[32]; // Sensor identifier (A32) + char orbit_num[8]; // Orbit number (A8) + char plat_lat[8]; // Platform geodetic latitude (F8.3) + char plat_long[8]; // Platform geodetic longitude (F8.3) + char plat_head[8]; // Platform heading (F8.3) + char clock_ang[8]; // Sensor clock angle (F8.3) + char incident_ang[8]; // Incidence angle (F8.3) + char spare4[8]; // Unused (A8) + char wave_length[16]; // Radar wave length (F16.7) + char motion_comp[2]; // Motion compensation indicator (A2) + char pulse_code[16]; // Range pulse code specifier (A16) + char ampl_coef[5][16]; // Range chirp coefficients (E16.7) + char phas_coef[5][16]; // Range phase coefficients (E16.7) + char chirp_ext_ind[8]; // Chirp extraction index (I8) + char spare5[8]; // Unused (A8) + char fr[16]; // Range sampling rate (F16.7) + char rng_gate[16]; // Range gate start time (F16.7) + char rng_length[16]; // Range pulse length (F16.7) + char baseband_f[4]; // Baseband conversion flag (A4) + char rngcmp_f[4]; // Range compressed flag (A4) + char gn_polar[16]; // Like polarized gain (F16.7) + char gn_cross[16]; // Cross polarized gain (F16.7) + char chn_bits[8]; // Number of bits per channel (I8) + char quant_desc[12]; // Quantization descriptor (A12) + char i_bias[16]; // I channel DC bias (F16.7) + char q_bias[16]; // Q channel DC bias (F16.7) + char iq_ratio[16]; // I/Q channel ratio (F16.7) + char spare6[16]; // Unused (F16.7) + char spare7[16]; // Unused (F16.7) + char ele_sight[16]; // Electronic boresight (F16.7) + char mech_sight[16]; // Mechanical boresight (F16.7) + char echo_track[4]; // Echo tracker on/off flag (A4) + char fa[16]; // Nominal PRF, Hz (F16.7) + char elev_beam[16]; // Elevation beamwidth (F16.7) + char azim_beam[16]; // Azimuth beamwidth (F16.7) + char sat_bintim[16]; // Satellite binary time (I16) + char sat_clktim[32]; // Satellite clock time (I32) + char sat_clkinc[8]; // Satellite clock increment (I8) + char spare8[8]; // Unused (A8) + char fac_id[16]; // Processing facility identifier (A16) + char sys_id[8]; // Processing system identifier (A8) + char ver_id[8]; // Processing version identifier (A8) + char fac_code[16]; // Facility process code (A16) + char lev_code[16]; // Product level code (A16) + char prod_type[32]; // Product type specifier (A32) + char algor_id[32]; // Processing algorithm identifier (A32) + char n_azilok[16]; // Number of azimuth looks (F16.7) + char n_rnglok[16]; // Number of range looks (F16.7) + char bnd_azilok[16]; // Bandwidth per look in azimuth,Hz (F16.7) + char bnd_rnglok[16]; // Bandwidth per look in range,Hz (F16.7) + char bnd_azi[16]; // Total azimuth look bandwidth (F16.7) + char bnd_rng[16]; // Total range look bandwidth (F16.7) + char azi_weight[32]; // Azimuth weighting designator (A32) + char rng_weight[32]; // Range weighting designator (A32) + char data_inpsrc[16]; // Data input source (A16) + char rng_res[16]; // Range resolution, meter (F16.7) + char azi_res[16]; // Azimuth resolution, meter (F16.7) + char radi_stretch[2][16]; // Radiometric stretch terms (F16.7) + char alt_dopcen[3][16]; // Along track Doppler frequency terms (E16.7) + char spare9[16]; // Unused (A16) + char crt_dopcen[3][16]; // Cross track Doppler frequency terms (E16.7) + char time_dir_pix[8]; // Pixel time direction indicator (A8) + char time_dir_lin[8]; // Line time direction indicator (A8) + char alt_rate[3][16]; // Along track Doppler rate term (E16.7) + char spare10[16]; // Unused (A16) + char crt_rate[3][16]; // Cross track Doppler rate term (E16.7) + char spare11[16]; // Unused (A16) + char line_cont[8]; // Line content indicator (A8) + char clutter_lock[4]; // Clutter lock applied flag (A4) + char auto_focus[4]; // Auto-focus applied flag (A4) + char line_spacing[16]; // Line spacing, meters (F16.7) + char pix_spacing[16]; // Pixel spacing, meters (F16.7) + char rngcmp_desg[16]; // Range compression designator (A16) + char spare12[2362]; // Unused (A2362) +}; + + +struct rad_unc_rec // Radiometric uncertainty record +{ + char db[16]; // Units of db (F16.7) + char deg[16]; // Units of deg (F16.7) +}; + +struct misreg_rec // Misregistration record +{ + char alt_m[16]; // Nominal along track misregistration (F16.7) + char crt_m[16]; // Nominal cross track misregistration (F16.7) +}; + +struct qual_sum_rec // Data quality summary record +{ + struct desc_rec desc; // Record description + char rec_seq[4]; // Record sequence number (I4) + char sar_chn[4]; // SAR channel indicator (A4) + char cali_date[6]; // Calibration update date (A6) + char nchn[4]; // Number of channels (I4) + char islr[16]; // Nominal integrated side lobe ratio (F16.7) + char pslr[16]; // Nominal peak side lobe ratio (F16.7) + char azi_ambig[16]; // Nominal azimuth ambiguity (F16.7) + char rng_ambig[16]; // Nominal range ambiguity (F16.7) + char snr[16]; // Nominal signal to noise ratio (F16.7) + char ber[16]; // Nominal bit error rate (F16.7) + char rng_res[16]; // Nominal slant range resolution (F16.7) + char azi_res[16]; // Nominal azimuth resolution,meter (F16.7) + char rad_res[16]; // Nominal radiometric resolution,dB (F16.7) + char dyn_rng[16]; // Instantaneous dynamic range (F16.7) + char rad_unc_db[16]; // Nominal radiometric uncertainty,dB (F16.7) + char rad_unc_deg[16]; // Nominal Radiometric uncertainty,deg (F16.7) + struct rad_unc_rec rad_unc[16]; // Radiometric data quality + char alt_locerr[16]; // Nominal along track location error (F16.7) + char crt_locerr[16]; // Nominal cross track location error (F16.7) + char alt_scale[16]; // Nominal along track distortion scale (F16.7) + char crt_scale[16]; // Nominal cross track distortion scale (F16.7) + char dis_skew[16]; // Nominal distortion skew (F16.7) + char ori_err[16]; // Nominal Scene orientation error (F16.7) + struct misreg_rec misreg[16]; // Misregistration error + char nesz[16]; // Nominal noise equivalent sigma zero (F16.7) + char enl[16]; // Nominal equivalent number of looks (F16.7) + char tb_update[8]; // Default parameters table update date (A8) + char spare[238]; // Unused (A238) +}; + + +struct sdr_htab_rec // Histogram table record +{ + char hist_desc[32]; // Histogram descriptor (A32) + char nrec[4]; // Records per table (I4) + char tab_seq[4]; // Table sequence number (I4) + char nbin[8]; // Total number of table bins (I8) + char ns_lin[8]; // Total number of lines (I8) + char ns_pix[8]; // Total number of pixels per line (I8) + char ngrp_lin[8]; // Group size along line axis (I8) + char ngrp_pix[8]; // Group size along pixel axis (I8) + char nsamp_lin[8]; // Number of samples used per group along line axis (I8) + char nsamp_pix[8]; // Number of samples used per group along pixel (I8) + char min_smp[16]; // Minimum first bin (E16.7) + char max_smp[16]; // Maximum last bin (E16.7) + char mean_smp[16]; // Mean sample value (E16.7) + char std_smp[16]; // Sample standard deviation (E16.7) + char smp_inc[16]; // Sample value increment (E16.7) + char min_hist[16]; // Minimum histogram value (E16.7) + char max_hist[16]; // Maximum histogram value (E16.7) + char mean_hist[16]; // Histogram mean value (E16.7) + char std_hist[16]; // Histogram standard deviation (E16.7) + char nhist[8]; // Histogram table size (I8) + char hist[256][8]; // 256 histogram table values of 16 bins + // I x 16 bins Q (I8) +}; + +struct sdr_hist_rec // Data histogram record +{ + struct desc_rec desc; // Record description + char rec_seq[4]; // Record sequence number (I4) + char sar_chn[4]; // SAR channel number (I4) + char ntab[8]; // Number of histogram table data sets in this record (I8) + char ltab[8]; // Histogram table data set size (I8) + struct sdr_htab_rec htab; // Histogram tables + char spare[14588]; // Unused (A14588) +}; + + +struct pdr16_htab_rec // Histogram table record +{ + char hist_desc[32]; // Histogram descriptor (A32) + char nrec[4]; // Records per table (I4) + char tab_seq[4]; // Table sequence number (I4) + char nbin[8]; // Total number of table bins (I8) + char ns_lin[8]; // Total number of lines n (I8) + char ns_pix[8]; // Total number of pixels per line (I8) + char ngrp_lin[8]; // Group size along line axis (I8) + char ngrp_pix[8]; // Group size along pixel axis (I8) + char nsamp_lin[8]; // Number of samples used per group along line axis (I8) + char nsamp_pix[8]; // Number of samples used per group along pixel (I8) + char min_smp[16]; // Minimum first bin (E16.7) + char max_smp[16]; // Maximum last bin (E16.7) + char mean_smp[16]; // Mean sample value (E16.7) + char std_smp[16]; // Sample standard deviation (E16.7) + char smp_inc[16]; // Sample value increment (E16.7) + char min_hist[16]; // Minimum histogram value (E16.7) + char max_hist[16]; // Maximum histogram value (E16.7) + char mean_hist[16]; // Histogram mean value (E16.7) + char std_hist[16]; // Histogram standard deviation (E16.7) + char nhist[8]; // Histogram table size (I8) + char hist[1024][8]; // 1024 histogram table values for 1024 bins + // (I8) +}; + +struct pdr16_hist_rec // Data histogram record +{ + struct desc_rec desc; // Record description + char rec_seq[4]; // Record sequence number (I4) + char sar_chn[4]; // SAR channel number (I4) + char ntab[8]; // Number of histogram table data sets in this record (I8) + char ltab[8]; // Histogram table data set size (I8) + struct pdr16_htab_rec htab[2];// Histogram tables + char spare[3]; // Unused (A3) +}; + + +struct pix_count_rec // Beam pixel count record +{ + char pix_update[21]; // Pixel count update date/time (A21) + char n_pix[4][8]; // Count of image pixels in beams (4I8) +}; + +struct beam_info_rec // Beam information record +{ + char beam_type[3]; // Beam type (A3) + char beam_look_src[9]; // Elevation beam look angle source (A9) + char beam_look_ang[16]; // Applied elevation beam look angle (deg) (F16.7) + char prf[16]; // Actual PRF (Hz) (F16.7) +}; + +struct temp_rec // Temperature settings record +{ + char temp_set[4][4]; // Temperature settings (4I4) +}; + +struct dopcen_est_rec +{ + char dopcen_conf[16]; // Doppler centroid confidence measure (F16.7) + char dopcen_ref_tim[16]; // Doppler centroid reference time (sec) (F16.7) + char dopcen_coef[4][16]; // Doppler centroid coefficients (4F16.7) +}; + +struct srgr_coefset_rec +{ + char srgr_update[21]; // SRGR update date/time (A21) + char srgr_coef[6][16]; // SRGR coefficients (6F16.7) +}; + +struct proc_parm_rec // Detailed processing parameters record +{ + struct desc_rec desc; // Record description + char rec_seq[4]; // Record sequence number (I4) + char spare1[4]; // Unused (A4) + char inp_media[3]; // Input media (A3) + char n_tape_id[4]; // Number of tape input ids (I4) + char tape_id[10][8]; // Tape identifiers (10A8) + char exp_ing_start[21]; // Expected ingest start time (A21) + char exp_ing_stop[21]; // Expected ingest stop time (A21) + char act_ing_start[21]; // Actual ingest start time (A21) + char act_ing_stop[21]; // Actual ingest stop time (A21) + char proc_start[21]; // Processing start time (A21) + char proc_stop[21]; // Processing stop time (A21) + char mn_sig_lev[10][16]; // Mean signal levels across range (10F16.7) + char scr_data_ind[4]; // Source data quality indicator (I4) + char miss_ln[8]; // Number of missing lines (I8) + char rej_ln[8]; // Number of rejected lines (I8) + char large_gap[8]; // Number of time inconsistencies (large gaps) (I8) + char bit_err_rate[16]; // Measured bit error rate (E16.7) + char fm_crc_err[16]; // Percent of frames with CRC errors (E16.7) + char date_incons[8]; // Number of date inconsistencies (I8) + char prf_changes[8]; // Number of unexpected PRF changes (I8) + char delay_changes[8]; // Number of delay changes (I8) + char skipd_frams[8]; // Number of skipped frames (I8) + char rej_bf_start[8]; // Range lines rejected before start time (I8) + char rej_few_fram[8]; // Range lines rejected due to too few frames (I8) + char rej_many_fram[8]; // Range lines rejected due to too many frames (I8) + char rej_mchn_err[8]; // Frames rejected due to master channel error (I8) + char rej_vchn_err[8]; // Frames rejected due to virtual channel error (I8) + char rej_rec_type[8]; // Frames rejected due to incorrect recording type (I8) + char sens_config[10]; // Sensor configuration (A10) + char sens_orient[9]; // Sensor orientation (A9) + char sych_marker[8]; // Frame synch marker (I8) + char rng_ref_src[12]; // Range reference function source (A12) + char rng_amp_coef[4][16]; // Range reference amplitude coefficients (4E16.7) + char rng_phas_coef[4][16]; // Range reference phase coefficients (4E16.7) + char err_amp_coef[4][16]; // Error function amplitude coefficients (4E16.7) + char err_phas_coef[4][16]; // Error function phase coefficients (4E16.7) + char pulse_bandw[4]; // Pulse bandwidth code (I4) + char adc_samp_rate[5]; // ADC sampling rate (I5) + char rep_agc_attn[16]; // Replica AGC attenuation (F16.7) + char gn_corctn_fctr[16]; // Gain correction factor (dB) (F16.7) + char rep_energy_gn[16]; // Replica energy gain correction (F16.7) + char orb_data_src[11]; // Orbit data source (A11) + char pulse_cnt_1[4]; // Pulse count 1 (I4) + char pulse_cnt_2[4]; // Pulse count 2 (I4) + char beam_edge_rqd[3]; // Beam edge detection requested (A3) + char beam_edge_conf[16]; // Beam edge confidence measure (F16.7) + char pix_overlap[4]; // Number of pixels in beam overlap (I4) + char n_beams[4]; // Number of beams (I4) + struct beam_info_rec beam_info[4]; // Beam info + char n_pix_updates[4]; // Number of pixel count updates (I4) + struct pix_count_rec pix_count[20]; // Beam pixel counts + char pwin_start[16]; // Processing window start time (sec) (F16.7) + char pwin_end[16]; // Processing window end time (sec) (F16.7) + char recd_type[9]; // Recording type (A9) + char temp_set_inc[16]; // Time increment between temperature settings (sec) (F16.7) + char n_temp_set[4]; // Number of temperature settings (I4) + struct temp_rec temp[20]; // Temperature settings + char n_image_pix[8]; // Number of image pixels (I8) + char prc_zero_pix[16]; // Percent zero pixels (F16.7) + char prc_satur_pix[16]; // Percent saturated pixels (F16.7) + char img_hist_mean[16]; // Image histogram mean intensity (F16.7) + char img_cumu_dist[3][16]; // Image cumulative distribution (3F16.7) + char pre_img_gn[16]; // Pre-image calibration gain factor (F16.7) + char post_img_gn[16]; // Post-image calibration gain factor (F16.7) + char dopcen_inc[16]; // Time increment between Dopcen estimates (sec) (F16.7) + char n_dopcen[4]; // Number of Doppler centroid estimates (I4) + struct dopcen_est_rec dopcen_est[20]; // Doppler centroid estimates + char dop_amb_err[4]; // Doppler ambiguity error (I4) + char dopamb_conf[16]; // Doppler ambiguity confidence measure (F16.7) + char eph_orb_data[7][16]; // Ephemeris orbit data (7E16.7) + char appl_type[12]; // Application type (A12) + char slow_time_coef[5][22]; // Slow time coefficients (5D22.15) + char n_srgr[4]; // Number of SRGR coefficient sets (I4) + struct srgr_coefset_rec srgr_coefset[20]; // SRGR coefficient sets + char pixel_spacing[16]; // SGF product pixel spacing (F16.7) + char gics_reqd[3]; // GICS product required (A3) + char wo_number[8]; // Work order identifier (A8) + char wo_date[20]; // Work order entry date (A20) + char satellite_id[10]; // Satellite identifier (A10) + char user_id[20]; // User id (A20) + char complete_msg[3]; // Completion message required flag (A3) + char scene_id[15]; // SGF product scene identifier (A15) + char density_in[4]; // Density of SGF product media (A4) + char media_id[8]; // SGF product identifier (A8) + char angle_first[16]; // Incidence angle of first pixel in SGF product line (F16.7) + char angle_last[16]; // Incidence angle of last pixel in SGF product line (F16.7) + char prod_type[3]; // GICS output product type (A3) + char map_system[16]; // Map system identifier (A16) + char centre_lat[22]; // GICS output product scene centre latitude (D22.15) + char centre_long[22]; // GICS output product scene centre longitude (D22.15) + char span_x[22]; // GICS output product size - map eastings (km) (D22.15) + char span_y[22]; // GICS output product size - map northings (km) (D22.15) + char apply_dtm[3]; // DTM correction to be applied flag (A3) + char density_out[4]; // GICS output product density (A4) + char state_time[21]; // Time of the first state vector (A21) + char num_state_vectors[4]; // Number of state vectors (I4) + char state_time_inc[16]; // Time increment between state vectors (F16.7) + char spare2[206]; // Unused (A207) +}; + + +struct map_proj_rec // Map projection data record +{ + struct desc_rec desc; // Record description + char spare1[16]; // Unused (A16) + char map_desc[32]; // Map projection descriptor (A32) + char n_pixel[16]; // Pixels per line (I16) + char n_line[16]; // Lines per processed band (I16) + char pixel_spacing[16]; // Inter-pixel distance (F16.7) + char line_spacing[16]; // Inter-line distance (F16.7) + char osc_orient[16]; // Output scene cntr orientation (F16.7) + char orb_incl[16]; // Orbital inclination (F16.7) + char asc_node[16]; // Ascending node (F16.7) + char isc_dist[16]; // Input scene cntr plat dist (F16.7) + char geo_alt[16]; // Geodedic platform altitude (F16.7) + char isc_vel[16]; // Ground speed at input scene (F16.7) + char plat_head[16]; // Platform heading (F16.7) + char ref_ellip[32]; // Reference ellipsoid name (A32) + char semi_major[16]; // Ellipsoid semi-major axis (F16.7) + char semi_minor[16]; // Ellipsoid semi-minor axis (F16.7) + char datum_shift[3][16]; // Datum shift parameters (F16.7) + char aux_datum_shift[3][16];// Aux datum shift parameters (F16.7) + char scal_ellip[16]; // Ellisoid scale factor (F16.7) + char proj_desc[32]; // Map projection description (A32) + char utm_desc[32]; // UTM descriptor (A32) + char utm_zone_sig[4]; // UTM zone signature (A4) + char utm_east_orig[16]; // Map origin, false easting (F16.7) + char utm_north_orig[16]; // Map origin, false northing (F16.7) + char utm_cent_long[16]; // Projection centre longitude (F16.7) + char utm_cent_lat[16]; // Projection centre latitude (F16.7) + char utm_stand_par[2][16]; // Standard parallels (F16.7) + char utm_scale[16]; // Scale factor (F16.7) + char ups_desc[32]; // UPS descriptor (A32) + char ups_cent_long[16]; // Projection centre longitude (F16.7) + char ups_cent_lat[16]; // Projection centre latitude (F16.7) + char ups_scale[16]; // Scale factor (F16.7) + char nsp_desc[32]; // NSP descriptor (A32) + char nsp_east_orig[16]; // Map origin, false easting (F16.7) + char nsp_north_orig[16]; // Map origin, false northing (F16.7) + char nsp_cent_long[16]; // Projection centre longitude (F16.7) + char nsp_cent_lat[16]; // Projection centre latitude (F16.7) + char nsp_stand_par[4][16]; // Standard parallels (F16.7) + char nsp_stand_mer[3][16]; // Standard meridians (F16.7) + char nsp_spare[4][16]; // Project dependent (4A16) + char corner_ne[8][16]; // Corner northing/easting (F16.7) + char corner_ll[8][16]; // Corner latitude/longitude (F16.7) + char terr_height[4][16]; // Corner terrain height (F16.7) + char lp_conv_coef[8][20]; // Line/pixel coefficients (E20.10) + char mp_conv_coef[8][20]; // Map proj coefficients (E20.10) + char dem_type[4]; // DEM type (A4) + char spare3[32]; // Unused (A32) +}; + + +struct pos_vect_rec // Position vector record +{ + char pos[3][22]; // Data point position (D22.15) + char vel[3][22]; // Data point velocity (D22.15) +}; + +struct pos_data_rec // Platform position data record +{ + struct desc_rec desc; // Record description + char orbit_ele_desg[32]; // Orbital elements designator (A32) + char orbit_ele[6][16]; // Orbital elements (F16.7) + char ndata[4]; // Number of data points (I4) + char year[4]; // Year of data point (I4) + char month[4]; // Month of data point (I4) + char day[4]; // Day of data point (I4) + char gmt_day[4]; // Day of year (I4) + char gmt_sec[22]; // Seconds of day (D22.15) + char data_int[22]; // Data sampling interval (D22.15) + char ref_coord[64]; // Reference coordinate system (A64) + char hr_angle[22]; // Greenwich mean hour angle (D22.15) + char alt_poserr[16]; // Along track position error (F16.7) + char crt_poserr[16]; // Cross track position error (F16.7) + char rad_poserr[16]; // Radial position error (F16.7) + char alt_velerr[16]; // Along track velocity error (F16.7) + char crt_velerr[16]; // Cross track velocity error (F16.7) + char rad_velerr[16]; // Radial velocity error (F16.7) + struct pos_vect_rec pos_vect[64]; // Data point position/velocity + char spare[126]; // Unused (A126) +}; + + +struct att_vect_rec // Attitude point record +{ + char gmt_day[4]; // Day of the year, GMT (I4) + char gmt_sec[8]; // Milliseconds of day, GMT (I8) + char pitch_flag[4]; // Pitch data quality flag (I4) + char roll_flag[4]; // Roll data quality flag (I4) + char yaw_flag[4]; // Yaw data quality flag (I4) + char pitch[14]; // Pitch error, degrees (E14.6) + char roll[14]; // Roll error, degrees (E14.6) + char yaw[14]; // Yaw error, degrees (E14.6) + char pitch_rate_flag[4]; // Pitch rate data quality flag (I4) + char roll_rate_flag[4]; // Roll rate data quality flag (I4) + char yaw_rate_flag[4]; // Yaw rate data quality flag (I4) + char pitch_rate[14]; // Pitch rate, degrees/sec (E14.6) + char roll_rate[14]; // Roll rate, degrees/sec (E14.6) + char yaw_rate[14]; // Yaw rate, degrees/sec (E14.6) +}; + +struct att_data_rec // Attitude data record +{ + struct desc_rec desc; // Record description + char npoint[4]; // Number of data points (I4) + struct att_vect_rec att_vect[20]; // Data points + char pitch_bias[14]; // Pitch bias (degrees) (E14.6) + char roll_bias[14]; // Roll bias (degrees) (E14.6) + char yaw_bias[14]; // Yaw bias (degrees) (E14.6) + char spare[6502]; // Unused (A6502) +}; + + +struct radi_dset_rec // Radiometric data set record +{ + char chan_ind[4]; // SAR channel indicator (A4) + char spare1[4]; // Unused (A4) + char table_desig[24]; // Table designator (A24) + char n_samp[8]; // Number of lookup table samples (I8) + char samp_type[16]; // Sample type designator (A16) + char samp_inc[4]; // Increment between table entries, range samples (I4) + char lookup_tab[512][16]; // Output scaling gain table (E16.7) + char spare2[4]; // Unused (A4) + char noise_scale[16]; // Thermal noise reference level (F16.7) + char spare3[16]; // Unused (A16) + char offset[16]; // Scaling offset (E16.7) + char calib_const[16]; // Calibration constant (E16.7) +}; + +struct radi_data_rec // Radiometric data record +{ + struct desc_rec desc; // Record description + char seq_num[4]; // Record sequence number (I4) + char n_data[4]; // Number of data fields (I4) + char field_size[8]; // Field size in bytes (I8) + struct radi_dset_rec dset[1]; // Radiometric data set records + char spare1[1512]; // Unused (A1512) +}; + + +struct comp_dset_rec // Compensation data set record +{ + char comp_desig[8]; // Compensation data designator (A8) + char comp_descr[32]; // Compensation data descriptor (A32) + char n_comp_rec[4]; // Number of compensation records (I4) + char comp_seq_no[4]; // Compensation record sequence number (I4) + char beam_tab_size[8]; // Number of beam table entries (I8) + char beam_tab[256][16]; // Elevation gain beam profile (256F16.7) + char beam_type[16]; // Beam type (A16) + char look_angle[16]; // Look angle of beam table centre (F16.7) + char beam_tab_inc[16]; // Increment between beam table entries (F16.7) +}; + +struct radi_comp_rec // Radiometric compensation data record +{ + struct desc_rec desc; // Record description + char seq_num[4]; // Record sequence number (I4) + char chan_ind[4]; // SAR channel indicator (A4) + char n_dset[8]; // Number of data sets in record (I8) + char dset_size[8]; // Compensation data set size (I8) + struct comp_dset_rec dset[4]; // Compensation data set records +}; + + +struct imop_desc_rec // Image options file descriptor +{ + struct desc_rec desc; // Record description + char ascii_flag[2]; // ASCII flag (A2) + char spare1[2]; // Unused (A2) + char format_doc[12]; // Format control document (A12) + char format_rev[2]; // Format document revision (A2) + char design_rev[2]; // File design revision (A2) + char software_id[12]; // Software identifier (A12) + char file_num[4]; // File number (I4) + char file_name[16]; // File name (A16) + char rec_seq[4]; // Record sequence/location flag (A4) + char seq_loc[8]; // Sequence number location (I8) + char seq_len[4]; // Sequence number length (I4) + char rec_code[4]; // Record code/location flag (A4) + char code_loc[8]; // Record code location (I8) + char code_len[4]; // Record code length (I4) + char rec_len[4]; // Record length/location flag (A4) + char rlen_loc[8]; // Record length location (I8) + char rlen_len[4]; // Record length length (I4) + char spare2[4]; // Reserved (4A1) + char spare3[64]; // Reserved segment (A64) + char n_dataset[6]; // Number of SAR data records (I6) + char l_dataset[6]; // SAR data record length (I6) + char spare4[24]; // Unused (A24) + char nbit[4]; // Number of bits per sample (I4) + char nsamp[4]; // Samples per data group (I4) + char nbyte[4]; // Bytes per data group (I4) + char justify[4]; // Sample justification and order (A4) + char nchn[4]; // Number of SAR channels (I4) + char nlin[8]; // Lines per data set (I8) + char nleft[4]; // Left border pixels per line (I4) + char ngrp[8]; // Groups per line per channel (I8) + char nright[4]; // Right border pixels per line (I4) + char ntop[4]; // Top border lines (I4) + char nbott[4]; // Bottom border lines (I4) + char intleav[4]; // Interleave indicator (A4) + char nrec_lin[2]; // Number of physical records per line (I2) + char nrec_chn[2]; // Number of physical records per multi-channel line in this file (I2) + char n_prefix[4]; // Number of bytes of prefix data per record (I4) + char n_sar[8]; // Number of bytes of SAR data (or pixel data) per record (I8) + char n_suffix[4]; // Number of bytes of suffix data per record (I4) + char spare5[4]; // Unused (A4) + char lin_loc[8]; // Line number locator (A8) + char chn_loc[8]; // Channel number locator (A8) + char tim_loc[8]; // Time locator (A8) + char left_loc[8]; // Left fill locator (A8) + char right_loc[8]; // Right fill locator (A8) + char pad_ind[4]; // Pad pixel indicator (A4) + char spare6[28]; // Unused (A28) + char qual_loc[8]; // Quality code locator (A8) + char cali_loc[8]; // Calibration info locator (A8) + char gain_loc[8]; // Gain value locator (A8) + char bias_loc[8]; // Bias value locator (A8) + char type_id[28]; // Data type identifier (A28) + char type_code[4]; // Data type code (A4) + char left_fill[4]; // Number of left fill bits (I4) + char right_fill[4]; // Number of right fill bits (I4) + char pix_rng[8]; // Maximum data range of pixel (I8) + char spare7[15804]; // Unused (A15804) +}; + + +struct acq_date_rec // Acquisition date/time +{ + ossim_int32 acq_year; // Acquisition year (B4) + ossim_int32 acq_day; // Acquisition day of year (B4) + ossim_int32 acq_msec; // Acquisition msecs of day (B4) +}; + +struct sdr_prefix_rec // Signal data prefix data +{ + ossim_int32 line_num; // Image data line number (B4) + ossim_int32 rec_num; // Image data record index (B4) + ossim_int32 n_left_pixel; // Left fill pixel count (B4) + ossim_int32 n_data_pixel; // Data pixel count (B4) + ossim_int32 n_right_pixel; // Right fill pixel count. (B4) + ossim_int32 sensor_updf; // Sensor parameter update flag (B4) + struct acq_date_rec acq_date; // Acquisition date + ossim_int16 sar_chan_ind; // SAR channel indicator (B2) + ossim_int16 sar_chan_code; // SAR channel code (B2) + ossim_int16 tran_polar; // Transmitted polarization (B2) + ossim_int16 recv_polar; // Received polarization (B2) + ossim_int32 prf; // Pulse repetition frequency, Hz (B4) + ossim_uint8 spare1[4]; // Unused (B4) + ossim_int16 obrc; // On-board range compressed flag (B2) + ossim_int16 pulse_type; // Pulse type designator (B2) + ossim_int32 chp_len; // Chirp length, ns (B4) + ossim_int32 chp_coef1; // Chirp constant coefficient,Hz (B4) + ossim_int32 chp_coef2; // Chirp linear coefficient,Hz/usec (B4) + ossim_int32 chp_coef3; // Chirp quadratic coefficient,Hz/usec^2 (B4) + ossim_uint8 spare2[2][4]; // Spare (2B4) + ossim_int32 recv_gain; // Receiver gain (B4) + ossim_int32 nt_line; // Nought line flag (B4) + ossim_int32 ele_nadir; // Elec. nadir angle, 10**-6 deg (B4) + ossim_int32 mec_nadir; // Mech. nadir angle, 10**-6 deg (B4) + ossim_int32 ele_squint; // Elec. squint angle, 10**-6 deg (B4) + ossim_int32 mec_squint; // Mech. squint angle, 10**-6 deg (B4) + ossim_int32 sr_first; // First sample slant range, m (B4) + ossim_int32 dr_window; // Data record window time, ns (B4) + ossim_uint8 spare3[4]; // Spare (B4) + ossim_int32 plat_updf; // Platform position update flag (B4) + ossim_int32 plat_lat; // Platform latitude, 10**-6 deg (B4) + ossim_int32 plat_long; // Platform longitude, 10**-6 deg (B4) + ossim_int32 plat_alt; // Platform altitude, m (B4) + ossim_int32 plat_speed; // Platform speed, cm/s (B4) + ossim_int32 plat_vel[3]; // Platform velocity, cm/s (3B4) + ossim_int32 plat_acc[3]; // Platform acceleration, cm/s (3B4) + ossim_int32 plat_track; // Platform track, 10**-6 deg (B4) + ossim_int32 plat_head; // Platform heading, 10**-6 deg (B4) + ossim_int32 plat_pitch; // Platform pitch, 10**-6 deg (B4) + ossim_int32 plat_roll; // Platform roll, 10**-6 deg (B4) + ossim_int32 plat_yaw; // Platform yaw, 10**-6 deg (B4) +}; + +struct sdr_data_rec // Signal data record +{ + struct desc_rec desc; // Record description + struct sdr_prefix_rec prefix; // Prefix data + ossim_uint8 sdr_data; // SAR signal data (jBk) +}; + + +struct pdr_prefix_rec // Processed data prefix data +{ + ossim_int32 line_num; // Image data line number (B4) + ossim_int32 rec_num; // Image data record index (B4) + ossim_int32 n_left_pixel; // Left fill pixel count (B4) + ossim_int32 n_data_pixel; // Data pixel count (B4) + ossim_int32 n_right_pixel; // Right fill pixel count (B4) + ossim_int32 sensor_updf; // Sensor parameter update flag (B4) + struct acq_date_rec acq_date; // Acquisition date + ossim_int16 sar_chan_ind; // SAR channel indicator (B2) + ossim_int16 sar_chan_code; // SAR channel code (B2) + ossim_int16 tran_polar; // Transmitted polarization (B2) + ossim_int16 recv_polar; // Received polarization (B2) + ossim_int32 prf; // Pulse repetition frequency, Hz (B4) + ossim_uint8 spare1[4]; // Unused (B4) + ossim_int32 sr_first; // Slant range to first pixel, m (B4) + ossim_int32 sr_mid; // Slant range to mid-pixel, m (B4) + ossim_int32 sr_last; // Slant range to last pixel, m (B4) + ossim_int32 fdc_first; // First pixel Doppler centroid, Hz (B4) + ossim_int32 fdc_mid; // Mid-pixel Doppler centroid, Hz (B4) + ossim_int32 fdc_last; // Last pixel Doppler centroid, Hz (B4) + ossim_int32 ka_first; // First pixel azimuth FM rate, Hz (B4) + ossim_int32 ka_mid; // Mid-pixel azimuth FM rate, Hz (B4) + ossim_int32 ka_last; // Last pixel azimuth FM rate, Hz (B4) + ossim_int32 nadir_ang; // Nadir look angle, 10**-6 deg (B4) + ossim_int32 squint_ang; // Azimuth squint angle, 10**-6 deg (B4) + ossim_int32 null_f; // Null line flag - 1 for NULL line, 0 for otherwise (B4) + ossim_uint8 spare2[4][4]; // Unused (4B4) + ossim_int32 geo_updf; // Geographic parameter update flag (B4) + ossim_int32 lat_first; // First pixel latitude, millionths of deg (B4) + ossim_int32 lat_mid; // Mid-pixel latitude (B4) + ossim_int32 lat_last; // Last pixel latitude (B4) + ossim_int32 long_first; // First pixel longitude, millionths of deg (B4) + ossim_int32 long_mid; // Mid pixel longitue (B4) + ossim_int32 long_last; // Last pixel longitude (B4) + ossim_int32 north_first; // Northing of first pixel, m (B4) + ossim_uint8 spare3[4]; // Unused (B4) + ossim_int32 north_last; // Northing of last pixel, m (B4) + ossim_int32 east_first; // Easting of first pixel, m (B4) + ossim_uint8 spare4[4]; // Spare (B4) + ossim_int32 east_last; // Easting of last pixel, m (B4) + ossim_int32 heading; // Line heading, millionths of deg (B4) + ossim_uint8 spare5[8]; // Unused (B8) +}; + +struct pdr_data_rec // Processed data record +{ + struct desc_rec desc; // Record description + struct pdr_prefix_rec prefix; // Prefix data +}; + + +struct pdr8_htab_rec // Histogram table record +{ + char hist_desc[32]; // Histogram descriptor (A32) + char nrec[4]; // Records per table (I4) + char tab_seq[4]; // Table sequence number (I4) + char nbin[8]; // Total number of table bins (I8) + char ns_lin[8]; // Total number of pixels in line direction (I8) + char ns_pix[8]; // Total number of lines (I8) + char ngrp_lin[8]; // Group size along pixel axis (I8) + char ngrp_pix[8]; // Group size along line axis (I8) + char nsamp_lin[8]; // Number of samples used per group along pixel axis (I8) + char nsamp_pix[8]; // Number of samples used per group along line (I8) + char min_smp[16]; // Minimum first bin (E16.7) + char max_smp[16]; // Maximum last bin (E16.7) + char mean_smp[16]; // Mean sample value (E16.7) + char std_smp[16]; // Sample standard deviation (E16.7) + char smp_inc[16]; // Sample value increment (E16.7) + char min_hist[16]; // Minimum histogram value (E16.7) + char max_hist[16]; // Maximum histogram value (E16.7) + char mean_hist[16]; // Histogram mean value (E16.7) + char std_hist[16]; // Histogram standard deviation (E16.7) + char nhist[8]; // Histogram table size (I8) + char hist[256][8]; // 256 histogram table values for 256 bins (I8) +}; + +struct pdr8_hist_rec // Data histogram record +{ + struct desc_rec desc; // Record description + char rec_seq[4]; // Record sequence number (I4) + char sar_chn[4]; // SAR channel number (I4) + char ntab[8]; // Num hist. table data sets in record (I8) + char ltab[8]; // Histogram table data set size (I8) + struct pdr8_htab_rec htab; // Histogram tables + char spare[14588]; // Unused (A14588) +}; + + +struct null_vol_rec // Null volume descriptor record +{ + struct desc_rec desc; // Record description + char ascii_flag[2]; // ASCII flag (A2) + char spare1[2]; // Unused (A2) + char format_doc[12]; // Format control doc (A12) + char format_ver[2]; // Format doc version (A2) + char format_rev[2]; // Format doc revision (A2) + char software_id[12]; // Software identifier (A12) + char tape_id[16]; // Physical tape id (A16) + char logvol_id[16]; // Logical volume id (A16) + char phyvol_id[16]; // Physical volume id (A16) + char n_phyvol[2]; // Total physical volume count (I2) + char first_phyvol[2]; // First physical volume (I2) + char last_phyvol[2]; // Last physical volume (I2) + char curr_phyvol[2]; // Current physical volume (I2) + char first_file[4]; // First file in volume (I4) + char volset_log[4]; // Logical volume within set (I4) + char logvol_vol[4]; // Logical volume within phyvol (I4) + char spare2[248]; // Unused (A248) +}; + +struct VolumeDirectoryFile +{ + vol_desc_rec volDescRec; + file_pntr_rec leaderFilePntrRec; + file_pntr_rec imageOptionsFilePntrRec; + file_pntr_rec trailerFilePntrRec; + text_rec textRec; +}; + +struct SarLeaderFile +{ + sar_desc_rec sarDescRec; + dataset_sum_rec dataSetSumRec; + qual_sum_rec qualSumRec; + sdr_hist_rec sdrHistRec; + pdr16_hist_rec pdr16HistRec; + proc_parm_rec procParmRec; + map_proj_rec mapProjRec; + pos_data_rec posDataRec; + att_data_rec attDataRec; + radi_data_rec radiDataRec; + radi_comp_rec radiCompRec; +}; + +struct SarTrailerFile +{ + sar_desc_rec sarDescRec; + dataset_sum_rec dataSetSumRec; + qual_sum_rec qualSumRec; + sdr_hist_rec sdrHistRec; + pdr8_hist_rec pdr8HistRec; + proc_parm_rec procParmRec; + att_data_rec attDataRec; + radi_data_rec radiDataRec; + radi_comp_rec radiCompRec; +}; + +class ossimCeosData : public ossimReferenced +{ +public: + + enum ErrorStatus + { + OK = 0, + ERROR + }; + + ossimCeosData(const ossimFilename& volDirFile, + const ossimFilename& leaderFile, + const ossimFilename& imageFile, + const ossimFilename& trailerFile); + + ossimCeosData(const ossimFilename& imageDir); + + bool errorStatus() const { return theErrorStatus; } + + const ossimFilename& volDirFile() const { return theVolDirFileName; } + const ossimFilename& leaderFile() const { return theLeaderFileName; } + const ossimFilename& imageFile() const { return theImageFileName; } + const ossimFilename& trailerFile() const { return theTrailerFileName; } + + const vol_desc_rec* volDescRec() const { return theVolDescRec; } + const text_rec* textRec() const { return theTextRec; } + const imop_desc_rec* imopDescRec() const { return &theImopDescRec; } + const dataset_sum_rec* dataSetSumRec() const { return theDataSetSumRec; } + const qual_sum_rec* qualSumRec() const { return theQualSumRec; } + const sdr_hist_rec* sdrHistRec() const { return theSdrHistRec; } + const pdr16_hist_rec* pdr16HistRec() const { return thePdr16HistRec; } + const pdr8_hist_rec* pdr8HistRec() const { return thePdr8HistRec; } + const proc_parm_rec* procParmRec() const { return theProcParmRec; } + const map_proj_rec* mapProjRec() const { return theMapProjRec; } + const pos_data_rec* posDataRec() const { return thePosDataRec; } + const att_data_rec* attDataRec() const { return theAttDataRec; } + const radi_data_rec* radiDataRec() const { return theRadiDataRec; } + const radi_comp_rec* radiCompRec() const { return theRadiCompRec; } + + void dump(std::ostream& strm = std::clog) const; + void dumpVolDescRec (std::ostream&) const; + void dumpTextRec (std::ostream&) const; + void dumpImopDescRec (std::ostream&) const; + void dumpDataSetSumRec(std::ostream&) const; + void dumpQualSumRec (std::ostream&) const; + void dumpSdrHistRec (std::ostream&) const; + void dumpPdr16HistRec (std::ostream&) const; + void dumpPdr8HistRec (std::ostream&) const; + void dumpProcParmRec (std::ostream&) const; + void dumpMapProjRec (std::ostream&) const; + void dumpPosDataRec (std::ostream&) const; + void dumpAttDataRec (std::ostream&) const; + void dumpRadiDataRec (std::ostream&) const; + void dumpRadiCompRec (std::ostream&) const; + +private: + void loadCeosRecords(); + ossim_int32 sizeOfNextRec(FILE*); + + VolumeDirectoryFile theVolumeDirectory; + SarLeaderFile theSarLeaderFile; + imop_desc_rec theImopDescRec; + SarTrailerFile theSarTrailerFile; + + ossimFilename theVolDirFileName; + ossimFilename theLeaderFileName; + ossimFilename theImageFileName; + ossimFilename theTrailerFileName; + + bool theErrorStatus; + + vol_desc_rec* theVolDescRec; + text_rec* theTextRec; + dataset_sum_rec* theDataSetSumRec; + qual_sum_rec* theQualSumRec; + sdr_hist_rec* theSdrHistRec; + pdr16_hist_rec* thePdr16HistRec; + pdr8_hist_rec* thePdr8HistRec; + proc_parm_rec* theProcParmRec; + map_proj_rec* theMapProjRec; + pos_data_rec* thePosDataRec; + att_data_rec* theAttDataRec; + radi_data_rec* theRadiDataRec; + radi_comp_rec* theRadiCompRec; +}; + + + +#endif diff --git a/Utilities/otbossim/src/ossim/CMakeLists.txt b/Utilities/otbossim/src/ossim/CMakeLists.txt index 40b79c176e1b5b03b7dad5bf5fd0032eb151f541..abc0a965984bf9c61ae06a280e93768de5999130 100644 --- a/Utilities/otbossim/src/ossim/CMakeLists.txt +++ b/Utilities/otbossim/src/ossim/CMakeLists.txt @@ -44,6 +44,7 @@ FILE(GLOB ossim_vec_HDRS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT FILE(GLOB ossim_video_HDRS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/../../include/ossim/video/*.h") FILE(GLOB ossim_vpfutil_HDRS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/../../include/ossim/vpfutil/*.h") +MESSAGE( "${ossim_HDRS}" ) SET(OSSIM_HEADER_FILES ${ossim_HDRS} ${ossim_base_HDRS} ${ossim_elevation_HDRS} ${ossim_font_HDRS} ${ossim_imaging_HDRS} ${ossim_init_HDRS} ${ossim_kbool_HDRS} @@ -109,8 +110,8 @@ OSSIM_LINK_LIBRARY(${LIB_NAME} COMPONENT_NAME ossim TYPE ${OSSIM_USER_DEFINED_DYNAMIC_OR_STATIC} LIBRARIES ${ossimDependentLibs} -# HEADERS "${OSSIM_HEADER_FILES}" -# PUBLIC_HEADERS "${ossim_HDRS}" + HEADERS "${OSSIM_HEADER_FILES}" + PUBLIC_HEADERS "${ossim_HDRS}" SOURCE_FILES "${ossim_SRCS}" INSTALL_LIB VERSION_SYMLINKS INSTALL_HEADERS) diff --git a/Utilities/otbossim/src/ossim/base/ossimCommon.cpp b/Utilities/otbossim/src/ossim/base/ossimCommon.cpp index 23593c1cba1d3c51f8340b963f16d32b0be4c886..5028e4326fd249534ed415f874902092bd06d39c 100644 --- a/Utilities/otbossim/src/ossim/base/ossimCommon.cpp +++ b/Utilities/otbossim/src/ossim/base/ossimCommon.cpp @@ -9,7 +9,7 @@ // Description: Common file for global functions. // //************************************************************************* -// $Id: ossimCommon.cpp 19927 2011-08-10 11:25:11Z gpotts $ +// $Id: ossimCommon.cpp 20041 2011-09-06 14:59:46Z oscarkramer $ #include <sstream> @@ -931,7 +931,7 @@ void ossim::toSimpleStringList(ossimString& result, if(!valuesList.empty()) { ossim_uint32 idx = 0; - ossim_uint32 size = (valuesList.size()-1); + ossim_uint32 size = (ossim_uint32)(valuesList.size()-1); for(idx = 0; idx < size; ++idx) { out << ((ossim_uint32)valuesList[idx]) << ","; diff --git a/Utilities/otbossim/src/ossim/base/ossimDatumFactory.inc b/Utilities/otbossim/src/ossim/base/ossimDatumFactory.inc index 0c2a304aa677eb5edc0a33b1f043a942705d58f9..60babb19e30a4ca01a1fe607d425d80460a848c2 100644 --- a/Utilities/otbossim/src/ossim/base/ossimDatumFactory.inc +++ b/Utilities/otbossim/src/ossim/base/ossimDatumFactory.inc @@ -46,7 +46,7 @@ public: }; #define NUMBER_OF_SEVEN_PARAM_DATUMS 2 -#define NUMBER_OF_THREE_PARAM_DATUMS 229 +#define NUMBER_OF_THREE_PARAM_DATUMS 226 static ossimThreeParamDatumType threeParamDatum[] = { {"ADI-A", "ADINDAN, Ethiopia", "CD", 3, 3, 3, 26, 50, -3, 25, -165, -11, 206}, @@ -276,7 +276,6 @@ static ossimThreeParamDatumType threeParamDatum[] = { {"WGE", "World Geodetic System 1984", "WE", 0, 0, 0, -180.0, 180.0, -90, 90, 0, 0, 0}, {"YAC", "YACARE, Uruguay", "IN", -1, -1, -1, -65, -47, -40, -25, -155, 171, 37}, {"ZAN", "ZANDERIJ, Suriname", "IN", 5, 5, 8, -76, -47, -10, 20, -265, 120, -358}, -{"WE-EPSG-3857", "Ploppy", "PV", 0, 0, 0, -180.0, 180.0, -85, 85, 0, 0, 0}, {"6055", "Popular Visualisation", "7059", 0, 0, 0, -180.0, 180.0, -85, 85, 0, 0, 0}, {"", "", "", 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0} }; diff --git a/Utilities/otbossim/src/ossim/base/ossimGzStream.cpp b/Utilities/otbossim/src/ossim/base/ossimGzStream.cpp index fccd52b6a076bb97945f4b31231797dd45612292..b98da3d5373a72da7f9a16543446b4fb4450b211 100644 --- a/Utilities/otbossim/src/ossim/base/ossimGzStream.cpp +++ b/Utilities/otbossim/src/ossim/base/ossimGzStream.cpp @@ -19,7 +19,7 @@ // // File : gzstream.C // Revision : $Revision: 17195 $ -// Revision_date : $Date: 2010-04-24 01:32:18 +0800 (Sat, 24 Apr 2010) $ +// Revision_date : $Date: 2010-04-23 19:32:18 +0200 (ven., 23 avril 2010) $ // Author(s) : Deepak Bandyopadhyay, Lutz Kettner // // Standard streambuf implementation following Nicolai Josuttis, "The diff --git a/Utilities/otbossim/src/ossim/base/ossimLagrangeInterpolator.cpp b/Utilities/otbossim/src/ossim/base/ossimLagrangeInterpolator.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a1622e104280ee6205599558f2dc218ad03fb219 --- /dev/null +++ b/Utilities/otbossim/src/ossim/base/ossimLagrangeInterpolator.cpp @@ -0,0 +1,191 @@ +//************************************************************************************************** +// OSSIM -- Open Source Software Image Map +// +// LICENSE: See top level LICENSE.txt file. +// +// AUTHOR: Oscar Kramer, GeoEye Inc. +// +// DESCRIPTION: Contains Lagrange Interpolator class +// +//************************************************************************************************** +// $Id$ +#include <iomanip> +#include <string> +using namespace std; + +#include "ossim/base/ossimLagrangeInterpolator.h" + +// Define Trace flags for use within this file: +#include "ossim/base/ossimTrace.h" +static ossimTrace traceDebug ("ossimLagrangeInterpolator:debug"); + +static const char HEADER_LABEL[] = "LAGRANGE_INTERP"; + + +//************************************************************************************************** +// CONSTRUCTOR: ossimLagrangeInterpolator() +//************************************************************************************************** +ossimLagrangeInterpolator::ossimLagrangeInterpolator(istream& stream) +{ + static const char MODULE[] = "ossimLagrangeInterpolator(istream&) CONSTRUCTOR"; + if (traceDebug()) CLOG << "entering..." << endl; + + stream >> *this; + + if (traceDebug()) CLOG << "returning..." << endl; +} + + +//************************************************************************************************** +// CONSTRUCTOR: ossimLagrangeInterpolator() +//************************************************************************************************** +ossimLagrangeInterpolator::ossimLagrangeInterpolator(const std::vector<double>& t_array, + const std::vector<NEWMAT::ColumnVector>& data_array) +: theTeeArray (t_array), + theDataArray(data_array), + theNumElements(0) +{ + static const char MODULE[]="ossimLagrangeInterpolator(int, double, Vector) CONSTRUCTOR"; + if (traceDebug()) CLOG << "entering..." << endl; + + // Assign data members: + ossim_uint32 numPoints = (ossim_uint32) theTeeArray.size(); + if (theDataArray.size() > 0) + theNumElements = theDataArray[0].Nrows(); + + ossim_uint32 i; + double n; + for (i=0; i<numPoints; i++) + { + // Compute the normalizer value at this data point: + n = 1.0; + for (ossim_uint32 j=0; j<numPoints; j++) + { + if (i != j) + n *= (theTeeArray[i] - theTeeArray[j]); + } + theNormalizer.push_back(n); + } + + if (traceDebug()) CLOG << "returning..." << endl; +} + + +//************************************************************************************************** +// DESTRUCTOR: ossimLagrangeInterpolator +//************************************************************************************************** +ossimLagrangeInterpolator::~ossimLagrangeInterpolator() +{ +} + +//************************************************************************************************** +// Adds one data sample to the collection. +//************************************************************************************************** +void ossimLagrangeInterpolator::addData(const double& t, const NEWMAT::ColumnVector& data) +{ + theTeeArray.push_back(t); + theDataArray.push_back(data); +} + +//************************************************************************************************** +// PUBLIC METHOD: ossimLagrangeInterpolator::interpolate(double t) +//************************************************************************************************** +bool ossimLagrangeInterpolator::interpolate(const double& t, NEWMAT::ColumnVector& result) const +{ + static const char MODULE[] = "ossimLagrangeInterpolator::interpolate()"; + if (traceDebug()) CLOG << "entering..." << endl; + + // Prepare to sum: + double weight; + + // Perform interpolation: + ossim_uint32 numPoints = (ossim_uint32) theTeeArray.size(); + for (ossim_uint32 i=0; i<numPoints; i++) + { + weight = 1.0/theNormalizer[i]; + for (ossim_uint32 j=0; j<numPoints; j++) + { + if (i != j) + weight *= (t - theTeeArray[j]); + } + + result += theDataArray[i] * weight; + } + + if (traceDebug()) CLOG << "leaving." << endl; + return true; +} + + +//***************************************************************************** +// Outputs contents to output stream. Compatible with input operator >> for +// restoring state of interpolator from file: +//***************************************************************************** +ostream& operator << (ostream& stream, const ossimLagrangeInterpolator& interpolator) +{ + stream << "\n" << HEADER_LABEL + << " " << interpolator.theTeeArray.size() + << " " << interpolator.theNumElements << endl; + + for (int i=0; i<interpolator.theTeeArray.size(); i++) + { + stream << setprecision(20); + stream << interpolator.theTeeArray[i] << " " + << interpolator.theNormalizer[i] << endl + << "( "<<interpolator.theDataArray[i](0) + << interpolator.theDataArray[i](1) + << interpolator.theDataArray[2](1) << " )" << endl; + } + + return stream; +} + + +//***************************************************************************** +// Inputs object from input stream. Compatible with output operator << for +// restoring state of interpolator from file. Assumes 3D data vector. +//***************************************************************************** +istream& operator >> (istream& stream, ossimLagrangeInterpolator& interpolator) +{ + // Start with ensuring we're at the right spot. Let it go a max of ten + // reads. If we go beyond that there's a problem... + string s; + int count = 0; + stream >> s; + while (s != "LAGRANGE_INTERP") + { + stream >> s; + ++count; + if (count == 10) break; // Avoid infinite loop... + } + + if (count == 10) + { + cerr << "ossimLagrangeInterpolator operator>> ERROR:" + << "\nStream seems to not contain LAGRANGE_INTERP header!" + << "\nReturning..." << endl; + return stream; + } + + ossim_uint32 numPoints; + stream >> numPoints >> interpolator.theNumElements; + + interpolator.theTeeArray.clear(); + interpolator.theDataArray.clear(); + interpolator.theNormalizer.clear(); + + double tee, normalizer; + NEWMAT::ColumnVector v(3); + for (ossim_uint32 i=0; i<numPoints; i++) + { + stream >> tee >> v(0) >> v(1) >> v(2) >> normalizer; + if (!stream.fail()) + { + interpolator.theTeeArray.push_back(tee); + interpolator.theDataArray.push_back(v); + interpolator.theNormalizer.push_back(normalizer); + } + } + + return stream; +} diff --git a/Utilities/otbossim/src/ossim/base/ossimRectilinearDataObject.cpp b/Utilities/otbossim/src/ossim/base/ossimRectilinearDataObject.cpp index 67ca5309c7a49f529b9d83dc85a9c4f4f3d10e4e..4be74da86dee0324a5b51bae3ed9dae10e1fd314 100644 --- a/Utilities/otbossim/src/ossim/base/ossimRectilinearDataObject.cpp +++ b/Utilities/otbossim/src/ossim/base/ossimRectilinearDataObject.cpp @@ -8,7 +8,7 @@ // Contributor: David A. Horner (DAH) - http://dave.thehorners.com // //************************************************************************* -// $Id: ossimRectilinearDataObject.cpp 19946 2011-08-12 18:45:36Z gpotts $ +// $Id: ossimRectilinearDataObject.cpp 20045 2011-09-06 15:03:11Z oscarkramer $ #include <ossim/base/ossimRectilinearDataObject.h> #include <ossim/base/ossimScalarTypeLut.h> @@ -286,7 +286,7 @@ bool ossimRectilinearDataObject::loadState(const ossimKeywordlist& kwl, const ch m_scalarType = OSSIM_SCALAR_UNKNOWN; } - m_numberOfDataComponents = m_spatialExtents.size(); + m_numberOfDataComponents = (ossim_uint32) m_spatialExtents.size(); return true; diff --git a/Utilities/otbossim/src/ossim/elevation/ossimDtedElevationDatabase.cpp b/Utilities/otbossim/src/ossim/elevation/ossimDtedElevationDatabase.cpp index da357ed5d788d614aec0bc98e83ebe24885dd293..a8c595317644dc08a00e7c37641d01632ae75e79 100644 --- a/Utilities/otbossim/src/ossim/elevation/ossimDtedElevationDatabase.cpp +++ b/Utilities/otbossim/src/ossim/elevation/ossimDtedElevationDatabase.cpp @@ -13,11 +13,26 @@ RTTI_DEF1(ossimDtedElevationDatabase, "ossimDtedElevationDatabase", ossimElevati double ossimDtedElevationDatabase::getHeightAboveMSL(const ossimGpt& gpt) { if(!isSourceEnabled()) return ossim::nan(); - ossimRefPtr<ossimElevCellHandler> handler = getOrCreateCellHandler(gpt); - if(handler.valid()) + m_mutex.lock(); + if(m_lastHandler.valid()) { - return handler->getHeightAboveMSL(gpt); // still need to shift + if(m_lastHandler->pointHasCoverage(gpt)) + { + double result = m_lastHandler->getHeightAboveMSL(gpt); + m_mutex.unlock(); + + return result; + } + } + m_lastHandler = getOrCreateCellHandler(gpt); + + if(m_lastHandler.valid()) + { + double result = m_lastHandler->getHeightAboveMSL(gpt); + m_mutex.unlock(); + return result; // still need to shift } + m_mutex.unlock(); return ossim::nan(); } diff --git a/Utilities/otbossim/src/ossim/imaging/ossimImageGeometry.cpp b/Utilities/otbossim/src/ossim/imaging/ossimImageGeometry.cpp index bbcfbb7c6b039551539fee53a32876e245dd287e..f354a7b17551d7b7ea7d4b48f039f5e39a5150b9 100644 --- a/Utilities/otbossim/src/ossim/imaging/ossimImageGeometry.cpp +++ b/Utilities/otbossim/src/ossim/imaging/ossimImageGeometry.cpp @@ -13,6 +13,7 @@ #include <ossim/imaging/ossimImageGeometry.h> #include <ossim/projection/ossimProjection.h> +#include <ossim/projection/ossimMapProjection.h> #include <ossim/base/ossimRefPtr.h> #include <ossim/projection/ossimProjectionFactoryRegistry.h> #include <ossim/base/ossimKeywordNames.h> @@ -271,40 +272,40 @@ const ossimDpt& ossimImageGeometry::getMetersPerPixel() const //************************************************************************************************** void ossimImageGeometry::computeGsd()const { - //--- - // We need to do the local-to-world but eliminating elevation effects, - // hence the complication: - // - // Note that by doing the rnToFull the tranform and decimation are account for. - //--- - - if (m_projection.valid()) + if (!m_projection.valid()) { - // Get three points in full image space. - ossimDpt pL0 (m_imageSize/2); - ossimDpt pLx (pL0.x+1, pL0.y); - ossimDpt pLy (pL0.x, pL0.y+1); - ossimDpt pF0; - ossimDpt pFx; - ossimDpt pFy; - rnToFull(pL0, 0, pF0); - rnToFull(pLx, 0, pFx); - rnToFull(pLy, 0, pFy); - - ossimGpt g0, gx, gy; - - m_projection->lineSampleToWorld(pF0, g0); - m_projection->lineSampleHeightToWorld(pFx, g0.height(), gx); - m_projection->lineSampleHeightToWorld(pFy, g0.height(), gy); - - // Compute horizontal distance for one pixel: - m_gsd.x = g0.distanceTo(gx); - m_gsd.y = g0.distanceTo(gy); + m_gsd.makeNan(); + return; } - else + + // See if we can just copy the map projection's GSD: + ossimMapProjection* map_proj = PTR_CAST(ossimMapProjection, m_projection.get()); + if (map_proj != NULL) { - m_gsd.makeNan(); + m_gsd = map_proj->getMetersPerPixel(); + return; } + + // Must be some kind of sensor model. Need to compute GSD. Get three points in full image space. + ossimDpt pL0 (m_imageSize/2); + ossimDpt pLx (pL0.x+1, pL0.y); + ossimDpt pLy (pL0.x, pL0.y+1); + ossimDpt pF0; + ossimDpt pFx; + ossimDpt pFy; + rnToFull(pL0, 0, pF0); + rnToFull(pLx, 0, pFx); + rnToFull(pLy, 0, pFy); + + ossimGpt g0, gx, gy; + + m_projection->lineSampleToWorld(pF0, g0); + m_projection->lineSampleHeightToWorld(pFx, g0.height(), gx); + m_projection->lineSampleHeightToWorld(pFy, g0.height(), gy); + + // Compute horizontal distance for one pixel: + m_gsd.x = g0.distanceTo(gx); + m_gsd.y = g0.distanceTo(gy); } //************************************************************************************************** diff --git a/Utilities/otbossim/src/ossim/imaging/ossimNitfTileSource.cpp b/Utilities/otbossim/src/ossim/imaging/ossimNitfTileSource.cpp index ffbdbfb0d5d4b66ad9259997495a8afcde28356f..cddc0968bf5c196e20ae0ac526fa76b02459988b 100644 --- a/Utilities/otbossim/src/ossim/imaging/ossimNitfTileSource.cpp +++ b/Utilities/otbossim/src/ossim/imaging/ossimNitfTileSource.cpp @@ -39,11 +39,6 @@ #include <ossim/support_data/ossimNitfStdidcTag.h> #include <ossim/support_data/ossimNitfVqCompressionHeader.h> - -#if defined(JPEG_DUAL_MODE_8_12) -#undef JPEG_DUAL_MODE_8_12 -#endif - #if defined(JPEG_DUAL_MODE_8_12) #include <ossim/imaging/ossimNitfTileSource_12.h> #endif diff --git a/Utilities/otbossim/src/ossim/imaging/ossimNitfTileSource_12.cpp b/Utilities/otbossim/src/ossim/imaging/ossimNitfTileSource_12.cpp index b6b882deac91249505e66ed5c610598b708e6371..55be3030c6bbb450d7035e91fc4a1a7acdf8db6f 100644 --- a/Utilities/otbossim/src/ossim/imaging/ossimNitfTileSource_12.cpp +++ b/Utilities/otbossim/src/ossim/imaging/ossimNitfTileSource_12.cpp @@ -16,10 +16,6 @@ //#if defined(JPEG_DUAL_MODE_8_12) #include <fstream> -#if defined(JPEG_DUAL_MODE_8_12) -#undef JPEG_DUAL_MODE_8_12 -#endif - #if defined(JPEG_DUAL_MODE_8_12) #include <jpeg12/jpeglib.h> diff --git a/Utilities/otbossim/src/ossim/parallel/ossimJobMultiThreadQueue.cpp b/Utilities/otbossim/src/ossim/parallel/ossimJobMultiThreadQueue.cpp index 538c0fd3d38b54b06048aced3467688a34f7dda5..ec312480d9642b1493328bfb2541a8818335041d 100644 --- a/Utilities/otbossim/src/ossim/parallel/ossimJobMultiThreadQueue.cpp +++ b/Utilities/otbossim/src/ossim/parallel/ossimJobMultiThreadQueue.cpp @@ -78,3 +78,20 @@ bool ossimJobMultiThreadQueue::areAllThreadsBusy()const return true; } + +bool ossimJobMultiThreadQueue::hasJobsToProcess()const +{ + bool result = false; + { + OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_mutex); + ossim_uint32 queueSize = m_threadQueueList.size(); + ossim_uint32 idx = 0; + for(idx = 0; ((idx<queueSize)&&!result);++idx) + { + result = m_threadQueueList[idx]->hasJobsToProcess(); + } + } + + return result; +} + diff --git a/Utilities/otbossim/src/ossim/parallel/ossimJobThreadQueue.cpp b/Utilities/otbossim/src/ossim/parallel/ossimJobThreadQueue.cpp index 49986bcf15d0fa15e12be2e16e7aefedaa85bf1d..0fba609e11d76b02077af2dac9a8ab4cd44df2f4 100644 --- a/Utilities/otbossim/src/ossim/parallel/ossimJobThreadQueue.cpp +++ b/Utilities/otbossim/src/ossim/parallel/ossimJobThreadQueue.cpp @@ -82,12 +82,12 @@ void ossimJobThreadQueue::run() { job->resetState(ossimJob::ossimJob_RUNNING); job->start(); - job->setState(ossimJob::ossimJob_FINISHED); } { OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_threadMutex); m_currentJob = 0; } + job->setState(ossimJob::ossimJob_FINISHED); job = 0; } @@ -102,6 +102,10 @@ void ossimJobThreadQueue::run() if(job.valid()&&m_doneFlag&&job->isReady()) { + { + OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_threadMutex); + m_currentJob = 0; + } job->cancel(); } { @@ -210,6 +214,18 @@ void ossimJobThreadQueue::startThreadForQueue() } } } + +bool ossimJobThreadQueue::hasJobsToProcess()const +{ + bool result = false; + { + OpenThreads::ScopedLock<OpenThreads::Mutex> lock(m_threadMutex); + result = !m_jobQueue->isEmpty()||m_currentJob.valid(); + } + + return result; +} + ossimRefPtr<ossimJob> ossimJobThreadQueue::nextJob() { ossimRefPtr<ossimJob> job; diff --git a/Utilities/otbossim/src/ossim/projection/ossimEquDistCylProjection.cpp b/Utilities/otbossim/src/ossim/projection/ossimEquDistCylProjection.cpp index a388a3ea0849a0487e1512ef6806b8c182dc0c1d..43bc3321d2bc2e37acea03024acdf317a14a1a56 100644 --- a/Utilities/otbossim/src/ossim/projection/ossimEquDistCylProjection.cpp +++ b/Utilities/otbossim/src/ossim/projection/ossimEquDistCylProjection.cpp @@ -9,7 +9,7 @@ // // Calls Geotrans Equidistant Cylinder projection code. //******************************************************************* -// $Id: ossimEquDistCylProjection.cpp 19880 2011-07-30 16:27:15Z dburken $ +// $Id: ossimEquDistCylProjection.cpp 20042 2011-09-06 14:59:56Z gpotts $ #include <ossim/projection/ossimEquDistCylProjection.h> #include <ossim/base/ossimKeywordNames.h> @@ -355,10 +355,15 @@ bool ossimEquDistCylProjection::loadState(const ossimKeywordlist& kwl, const cha void ossimEquDistCylProjection::setDecimalDegreesPerPixel(const ossimDpt& dpp) { // Adjust the origin latitude in order to achieve the gsd ratio scaling first: - if (dpp.lon != 0.0) + //if (dpp.lon != 0.0) + if (!ossim::almostEqual(dpp.lon,0.0)) { double ratio = dpp.lat/dpp.lon; - if (ratio > 1.0) + if(ossim::almostEqual(ratio, 1.0)) + { + ratio = 1.0; + } + else if (ratio > 1.0) ratio = 1.0; else if (ratio < -1.0) ratio = -1.0; @@ -366,7 +371,7 @@ void ossimEquDistCylProjection::setDecimalDegreesPerPixel(const ossimDpt& dpp) } // Check hemisphere against tiepoint: - if (!theUlGpt.hasNans() && (theUlGpt.lat < 0)) + if (!theUlGpt.isLatNan()&&!theUlGpt.isLonNan() && (theUlGpt.lat < 0)) theOrigin.lat *= -1.0; ossimMapProjection::setDecimalDegreesPerPixel(dpp); diff --git a/Utilities/otbossim/src/ossim/projection/ossimRS1SarModel.cpp b/Utilities/otbossim/src/ossim/projection/ossimRS1SarModel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..01b2af8a13eb71eb2fcdb73e741c4bcdd919908f --- /dev/null +++ b/Utilities/otbossim/src/ossim/projection/ossimRS1SarModel.cpp @@ -0,0 +1,1084 @@ +//******************************************************************* +// +// License: See top level LICENSE.txt file. +// +// Author: Oscar Kramer +// +// Description: +// +// Sensor Model for Radarsat1 SAR sensor. +// +//******************************************************************* +// $Id:$ + +#include <ossim/projection/ossimRS1SarModel.h> +#include <cstdio> +#include <fstream> +#include <iomanip> +#include <iostream> +#include <sstream> +#include <string> +#include <ossim/base/ossimTrace.h> +#include <ossim/matrix/newmat.h> +#include <ossim/base/ossimLsrPoint.h> +#include <ossim/elevation/ossimElevManager.h> + + +using namespace std; +using namespace ossim; + +static ossimTrace traceDebug("ossimRS1SarModel:debug"); + +static const double SEC_PER_DAY = 86400.0; +static const double NOMINAL_ORBIT_ELEVATION = 798000.0; // m +static const double DEG_PER_SEC = 0.004178074; +static const double INTRACK_OFFSET_SIGMA = 1000.0; // meters +static const double CRTRACK_OFFSET_SIGMA = 300.0; +static const double RADIAL_OFFSET_SIGMA = 300.0; +static const double LINE_SCALE_SIGMA = 0.01; +static const double SKEW_SIGMA = 0.1; // deg +static const double ORIENTATION_SIGMA = 0.2; // deg +static const double EARTH_ANGULAR_VELOCITY = 7.2921151467e-05; // radians/sec +static const char* IMAGING_MODE_ID[] = +{"UNKNOWN", "SCN", "SCW", "SGC", "SGF", "SGX", "SLC", "SPG", "SSG","RAW","ERS"}; + + +//****************************************************************************** +// CONSTRUCTOR: ossimRS1SarModel(const ossimFilename& imageDir) +// +// Takes a ossimFilename& directory containing support data, initializes the model, +// and writes out the initial geometry file. +// +//****************************************************************************** +ossimRS1SarModel::ossimRS1SarModel(const ossimFilename& imageFile) + : + theCeosData (0), + theImagingMode (UNKNOWN_MODE) +{ + static const char MODULE[] = "Constructor ossimRS1SarModel(ossimFilename)"; + if (traceDebug()) CLOG << "entering..." << endl; + + // Parse the CEOS data files: + ossimFilename dataDirName (imageFile.path()); + initFromCeos(dataDirName); + + if (theImagingMode == UNKNOWN_MODE) + { + if (traceDebug()) CLOG << "returning with error..." << endl; + return; + } + + // Parse the image data file for the local ORPs interpolator: + if ((theImagingMode == SCN) || (theImagingMode == SCW)) + establishOrpGrid(); + else + establishOrpInterp(); + + // Establish the ephemeris interpolator: + establishEphemeris(); + + initAdjParms(); + establishVehicleSpace(); + + if (traceDebug()) CLOG << "returning..." << endl; + return; +} + + +//****************************************************************************** +// DESTRUCTOR: ~ossimRS1SarModel +//****************************************************************************** +ossimRS1SarModel::~ossimRS1SarModel() +{ + deallocateMemory(); +} + +//****************************************************************************** +// loadSate() +//****************************************************************************** +bool ossimRS1SarModel::loadState(const ossimKeywordlist& kwl, const char* prefix) +{ + // NOT YET IMPLEMENTED + return false; +} + +//****************************************************************************** +// saveState() +//****************************************************************************** +bool ossimRS1SarModel::saveState(ossimKeywordlist& kwl, const char* prefix) const +{ + // NOT YET IMPLEMENTED + return false; +} + +//************************************************************************************************* +//! Given an image point, returns a ray originating at some arbitrarily high +//! point (in this model at the sensor position) and pointing towards the target. +//************************************************************************************************* +void ossimRS1SarModel::imagingRay(const ossimDpt& image_point, ossimEcefRay& image_ray) const +{ + const char* MODULE = "ossimRS1SarModel::imagingRay()"; + + // Apply offset, scale, skew, and rotation to image point: + ossimDpt offset (theImageSize.line/2.0, theImageSize.samp/2.0); + ossimDpt ip1 = image_point - offset; + ossimDpt ip2; + ip2.line = ip1.line*theCosOrientation*theLineScale + + ip1.samp*(theCosOrientation*theSinSkew+theSinOrientation); + ip2.samp = -ip1.line*theSinOrientation*theLineScale - + ip1.samp*(theSinOrientation*theSinSkew-theCosOrientation); + + // Offset point back to origin of image: + ip1 = ip2 + offset; + + // Given new line number, obtain the interpolated ORP: + ossimEcefPoint localORP; + if ((theImagingMode == SCN) || (theImagingMode == SCW)) + { + ossimGpt gpt (theLatGrid(ip1.x, ip1.y), theLonGrid(ip1.x, ip1.y), theRefHeight); + localORP = ossimEcefPoint(gpt); + } + else + { + NEWMAT::ColumnVector orpPos(3); + theLocalOrpInterp->interpolate(ip1.line, orpPos); + localORP = ossimEcefPoint(orpPos[0], orpPos[1], orpPos[2]); + } + + // Establish imaging line time (zero-Doppler time): + double arpTime = theFirstLineTime + ip1.line*theTimePerLine; + + NEWMAT::ColumnVector arpEph(3); + theArpPosInterp->interpolate(arpTime, arpEph); + ossimEcefPoint ecfArpPos (arpEph[0], arpEph[1], arpEph[2]); + + theArpVelInterp->interpolate(arpTime, arpEph); + ossimEcefVector ecfArpVel (arpEph[0], arpEph[1], arpEph[2]); + + // Need to correct the velocity vector by the earth rotational velocity: + ossimEcefVector earthVel + (-ecfArpPos.y()*EARTH_ANGULAR_VELOCITY, ecfArpPos.x()*EARTH_ANGULAR_VELOCITY, 0.0); + ecfArpVel = ecfArpVel - earthVel; + + // Compute a vehicle space with Z near intrack, X normal to Z and range + // vector to ORP (slant range normal), and Y in range direction. + // Note the application of the position adjustable parameter to the space's + // origin (after the range vector was established): + ossimEcefVector rangeVector = localORP - ecfArpPos; + ossimEcefVector rangeNormal = rangeVector.cross(ecfArpVel); + ossimEcefVector zDirection = rangeNormal.cross(rangeVector); + ossimLsrSpace localVehicleSpace (ossimEcefPoint(ecfArpPos + thePosCorrection), // origin + rangeNormal, // X-direction + rangeVector, 0); // Y-direction (Z not specified + double local_orp_range = rangeVector.length(); + + // Compute slant range distance to pixel in question: + double slant_range = local_orp_range; + switch (theImagingMode) + { + case SLC: + if (theDirectionFlag == ASCENDING) + slant_range += thePixelSpacing.samp*ip1.samp; + else + slant_range += (theImageSize.samp-1.0-ip1.samp) * thePixelSpacing.samp; + break; + + case SGC: + case SGF: + case SGX: + case ERS: + { + // Compute the slant range as a polynomial expansion given ground range + double ground_range; + if (theDirectionFlag == ASCENDING) + ground_range = ip1.samp * thePixelSpacing.samp; + else + ground_range = (theImageSize.samp - 1.0 - ip1.samp) * + thePixelSpacing.samp; + // double delta_g_i = 1.0; + // for (int 0=1; i<6; i++) + double delta_g_i = ground_range; + for (int i=1; i<6; i++) // NOTE: not using offset (i=0) term + { + slant_range += theSrGrCoeff[i] * delta_g_i; + delta_g_i *= ground_range; + } + } + break; + + case SCN: + case SCW: + slant_range = local_orp_range; + break; + + default: + CLOG << "ERROR: Invalid imaging mode encountered." << endl; + } +} + +//****************************************************************************** +// PUBLIC METHOD: ossimRS1SarModel::phiLambda(image_point, height, is_inside_image) +// +// Performs image to ground projection. +//****************************************************************************** +void ossimRS1SarModel::lineSampleHeightToWorld(const ossimDpt& image_point, + const double& heightMSL, + ossimGpt& worldPt) const +{ + static const char MODULE[] = "ossimRS1SarModel::lineSampleHeightToWorld()"; + if (traceDebug()) CLOG << "entering..." << endl; + + static const int MAX_NUM_ITERS = 50; + static const double MAX_ELEV_DIFF = 0.001; + + ossimEcefRay imaging_ray; + imagingRay(image_point, imaging_ray); + + // Convert MSL height to Ellipsoid height and do intersection: + worldPt = imaging_ray.intersectAboveEarthEllipsoid(0.0); + double hgt_ell = 0.0; + double delta_hgt; + int num_iters = 0; + ossimElevManager* emgr = ossimElevManager::instance(); + do + { + delta_hgt = heightMSL - worldPt.heightMSL(); + hgt_ell += delta_hgt; + worldPt = imaging_ray.intersectAboveEarthEllipsoid(hgt_ell); + ++num_iters; + } while ((fabs(delta_hgt) > MAX_ELEV_DIFF) && (num_iters < MAX_NUM_ITERS)); + + if (num_iters == MAX_NUM_ITERS) + { + ossimNotify(ossimNotifyLevel_WARN)<<MODULE<<" Exceeded max allowed number of iterations " + "solving for range arc intersection with elevation. Result may be incorrect."<<endl; + } + + if (traceDebug()) CLOG << "returning..." << endl; +} + +//****************************************************************************** +// This method sets theImagingMode data member given a character string +// abbreviation of the mode. +//****************************************************************************** +void ossimRS1SarModel::setImagingMode(char* modeStr) +{ + static const char MODULE[] = "ossimRS1SarModel::setImagingMode(modeStr)"; + if (traceDebug()) CLOG << "entering..." << endl; + + bool illegal_mode = false; + + if (strcmp(modeStr, "SCN") == 0) + { + theImagingMode = SCN; + } + else if (strcmp(modeStr, "SCW") == 0) + { + theImagingMode = SCW; + } + else if (strcmp(modeStr, "SGC") == 0) + { + theImagingMode = SGC; + } + else if (strcmp(modeStr, "SGF") == 0) + { + theImagingMode = SGF; + } + else if (strcmp(modeStr, "SGX") == 0) + { + theImagingMode = SGX; + } + else if (strcmp(modeStr, "SLC") == 0) + { + theImagingMode = SLC; + } + else if (strcmp(modeStr, "SPG") == 0) + { + theImagingMode = SPG; + illegal_mode = true; + } + else if (strcmp(modeStr, "SSG") == 0) + { + theImagingMode = SSG; + illegal_mode = true; + } + else if (strcmp(modeStr, "RAW") == 0) + { + theImagingMode = RAW; + illegal_mode = true; + } + else if (strcmp(modeStr, "ERS") == 0) + { + theImagingMode = ERS; + } + else + { + theImagingMode = UNKNOWN_MODE; + illegal_mode = true; + } + + // Test for ERS product: + if ((theImagingMode == UNKNOWN_MODE) && theCeosData.valid()) + { + char buf[] = "xxx"; + strncpy(buf, &(theCeosData->textRec()->product_type[8]), 3); + if (strcmp(buf, "ERS") == 0) + { + theImagingMode = ERS; + illegal_mode = false; + } + } + + // Filter the imaging modes that are not handled: + if (illegal_mode) + { + CLOG << "\n\t ERROR: The imaging mode <" + << IMAGING_MODE_ID[(int) theImagingMode] + << "> is currently not supported. \n" << endl; + theImagingMode = UNKNOWN_MODE; + } + + if (traceDebug()) CLOG << "returning..." << endl; +} + + +//****************************************************************************** +// Initialize various data members from the CEOS records. +//****************************************************************************** +void ossimRS1SarModel::initFromCeos(const ossimFilename& fname) +{ + static const char MODULE[] = "ossimRS1SarModel::initFromCeos()"; + if (traceDebug()) CLOG << "entering..." << endl; + + // Instantiate a CeosData object: + theCeosData = new ossimCeosData(fname); + + const dataset_sum_rec* dsr = theCeosData->dataSetSumRec(); + const proc_parm_rec* ppr = theCeosData->procParmRec(); + char buf[1024]; + + // Set imaging mode: + strncpy(buf, &(theCeosData->volDescRec()->logvol_id[11]), 3); + buf[3] = '\0'; + setImagingMode(buf); + + // Determine whether ascending or descending path acquisition. This flag + // dictates whether the first or last pixel of a line is of shorter range: + if (theImagingMode == ERS) + { + theDirectionFlag = DESCENDING; + } + else + { + if (dsr->asc_des[0] == 'A') + theDirectionFlag = ASCENDING; + else if (dsr->asc_des[0] == 'D') + theDirectionFlag = DESCENDING; + else + { + CLOG << "ERROR: Direction Flag: " << dsr->asc_des << " not supported" + << endl; + theDirectionFlag = UNKNOWN_DIRECTION; + if (traceDebug()) CLOG << "returning with error..." << endl; + return; + } + } + + // Image (Product) ID: + buf[8] = '\0'; + strncpy(buf, theCeosData->volDescRec()->product_id, 8); + theImageID = buf; + + // pixel spacing in range: + buf[16] = '\0'; + strncpy(buf, dsr->pix_spacing, 16); + thePixelSpacing.samp = atof(buf); + + // pixel spacing in azimuth: + strncpy(buf, dsr->line_spacing, 16); + buf[16] = '\0'; + thePixelSpacing.line = atof(buf); + + // The ground reference point (ORP) latitude: + ossimGpt grp; + strncpy(buf, dsr->pro_lat, 16); + buf[16] = '\0'; + grp.lat = atof(buf); + + // The ground reference point (ORP) longitude: + strncpy(buf, dsr->pro_long, 16); + buf[16] = '\0'; + grp.lon = atof(buf); + + // The ground reference point (ORP) elevation: + strncpy(buf, dsr->terrain_h, 16); + buf[16] = '\0'; + grp.hgt = atof(buf); + theORP = ossimEcefPoint(grp); + theRefHeight = grp.hgt; + + // Illumination elevation: + strncpy(buf, dsr->incident_ang, 8); + buf[8] = '\0'; + double incidence = atof(buf); + theIllumElevation = 90.0 - incidence; + + // Illumination azimuth -- need to determine whether sensor is in normal + // right-looking mode or "antarctic" (left-looking) mode: + strncpy(buf, dsr->plat_head, 8); + theIllumAzimuth = atof(buf); + char sensor_orientation[] = "123456789"; + strncpy(sensor_orientation, ppr->sens_orient, 9); + if (strcmp(sensor_orientation, "ANTARCTIC") == 0) + { + theIllumAzimuth -= 90.0; + if (theIllumAzimuth < 0.0) theIllumAzimuth += 360.0; + } + else + { + theIllumAzimuth += 90.0; + if (theIllumAzimuth >= 360.0) theIllumAzimuth -= 360.0; + } + + // Determine the number of lines per image and pixels per line. NOTE: if + // image is scan mode, the number of lines must be computed indirectly. + if ((theImagingMode == SCN) || (theImagingMode == SCW)) + { + FILE* fptr = fopen(theCeosData->imageFile().chars(), "r"); + if (!fptr) + { + CLOG << " ERROR:\n\tCannot open CEOS image file: " + << theCeosData->imageFile() << endl; + return; + } + fseek(fptr, 0, SEEK_END); + long byte_count = ftell(fptr); + buf[6] = '\0'; + strncpy(buf, theCeosData->imopDescRec()->l_dataset, 6); + int lengthOfRec = atoi(buf); + theImageSize.line = (byte_count - sizeof(*theCeosData->imopDescRec())) + /lengthOfRec; + fclose(fptr); + } + else + { + strncpy(buf, theCeosData->imopDescRec()->n_dataset, 6); + buf[6] = '\0'; + theImageSize.line = atoi(buf); + } + strncpy(buf, theCeosData->imopDescRec()->nleft, 4); + buf[4] = '\0'; + int left_pixels = atoi(buf); + strncpy(buf, theCeosData->imopDescRec()->ngrp, 8); + buf[8] = '\0'; + int data_pixels = atoi(buf); + strncpy(buf, theCeosData->imopDescRec()->nright, 4); + buf[4] = '\0'; + int right_pixels = atoi(buf); + theImageSize.samp = left_pixels + data_pixels + right_pixels; + + // If ground range product, need to read the ground-to-slant range + // conversion coefficients from the proc_parm_rec. NOTE: only single-look + // products handled properly. ScanSAR requires reading multiple coefficient + // sets. See MDA Detailed Processing Parameter Record Description sec.3.84. + if ((theImagingMode==SGC) || + (theImagingMode==SGF) || + (theImagingMode==SGX) || + (theImagingMode==ERS)) + { + buf[16] = '\0'; + for (int i=0; i<6; i++) + { + strncpy(buf, ppr->srgr_coefset[0].srgr_coef[i], 16); + theSrGrCoeff[i] = atof(buf); + } + } + else + { + theSrGrCoeff[0] = 0.0; + theSrGrCoeff[1] = 1.0; // note 1.0 here (should never be accessed) + theSrGrCoeff[2] = 0.0; + theSrGrCoeff[3] = 0.0; + theSrGrCoeff[4] = 0.0; + theSrGrCoeff[5] = 0.0; + } + + if (traceDebug()) + { + CLOG << "DEBUG -- " + << "\n\t theDirectionFlag = " << theDirectionFlag + << "\n\t thePixelSpacing = " << thePixelSpacing + << "\n\t theORP = " << theORP + << "\n\t theRefHeight = " << theRefHeight + << "\n\t theImageSize = " << theImageSize + << "\n\t sensor_orientation = " << sensor_orientation + << "\n\t theIllumElevation = " << theIllumElevation + << "\n\t theIllumAzimuth = " << theIllumAzimuth + << endl; + } + + if (traceDebug()) CLOG << "returning..." << endl; +} + + +//****************************************************************************** +// This method sets the rigorous model adjustable parameters to +// their initial values. +//****************************************************************************** +void ossimRS1SarModel::initAdjParms() +{ + // Adjustable model not yet implemented +#if 0 + + static const char* MODULE = "ossimRS1SarModel::initAdjParms()"; + if (traceDebug()) CLOG << "entering..." << endl; + + theInTrackOffset = (init_adj_parm[INTRACK_OFFSET]+adj_parm[INTRACK_OFFSET]) + * adj_sigma[INTRACK_OFFSET]; + + theCrTrackOffset = (init_adj_parm[CRTRACK_OFFSET]+adj_parm[CRTRACK_OFFSET]) + * adj_sigma[CRTRACK_OFFSET]; + + theRadialOffset = (init_adj_parm[RADIAL_OFFSET]+adj_parm[RADIAL_OFFSET]) + * adj_sigma[RADIAL_OFFSET]; + + theLineScale = (init_adj_parm[LINE_SCALE]+adj_parm[LINE_SCALE]) + * adj_sigma[LINE_SCALE]; + + theSkew = (init_adj_parm[SKEW]+adj_parm[SKEW]) + * adj_sigma[SKEW]; + + theOrientation = (init_adj_parm[ORIENTATION]+adj_parm[ORIENTATION]); + + // Initialize base-class initial adjustable parameter array: + init_adj_parm[INTRACK_OFFSET] = theInTrackOffset/adj_sigma[INTRACK_OFFSET]; + init_adj_parm[CRTRACK_OFFSET] = theCrTrackOffset/adj_sigma[CRTRACK_OFFSET]; + init_adj_parm[RADIAL_OFFSET] = theRadialOffset/adj_sigma[RADIAL_OFFSET]; + init_adj_parm[LINE_SCALE] = theLineScale/adj_sigma[LINE_SCALE]; + init_adj_parm[SKEW] = theSkew/adj_sigma[SKEW]; + init_adj_parm[ORIENTATION] = theOrientation/adj_sigma[ORIENTATION]; + + // Initialize sensor adjustable parameter description strings: + strncpy (adj_desc[INTRACK_OFFSET], "intrack_offset", MAX_DESC_CHARS); + strncpy (adj_desc[CRTRACK_OFFSET], "crtrack_offset", MAX_DESC_CHARS); + strncpy (adj_desc[RADIAL_OFFSET], "radial_offset", MAX_DESC_CHARS); +// strncpy (adj_desc[SAMP_SCALE], "samp_scale", MAX_DESC_CHARS); + strncpy (adj_desc[LINE_SCALE], "line_scale", MAX_DESC_CHARS); + strncpy (adj_desc[SKEW], "image_skew", MAX_DESC_CHARS); + strncpy (adj_desc[ORIENTATION], "image_orientation",MAX_DESC_CHARS); + + // Initialize the adj_parms (parameter corrections) to 0: + for (int i=0; i<num_adj_parm; i++) + adj_parm[i] = 0.0; + + if (traceDebug()) CLOG << "returning..." << endl; +#endif +} + + +//****************************************************************************** +// This method parses the SAR header information associated with the +// ephemeris state vectors, and instantiates a Lagrange interpolator object +// for interpolating intermediate ehemeris states. +//****************************************************************************** +void ossimRS1SarModel::establishEphemeris() +{ + static const char MODULE[] = "ossimRS1SarModel::establishEphemeris()"; + if (traceDebug()) CLOG << "entering..." << endl; + + char buf[23]; + + // Establish pointer to platform position data record: + const pos_data_rec* pdr = theCeosData->posDataRec(); + + // Establish the Greenwich mean hour angle at time of first sample: + char gha_str [23]; + strncpy(gha_str, pdr->hr_angle, 22); + gha_str[22] = '\0'; + theGHA = atof(gha_str); + + // Fetch number of points in record and allocate memory: + strncpy(buf, pdr->ndata, 4); + buf[4] = '\0'; + int numPoints = atoi(buf); + + // Fetch sampling period: + strncpy(buf, pdr->data_int, 22); + buf[22] = '\0'; + double sampling_period = atof(buf); + + // Establish the first sample time's day: + strncpy(buf, pdr->gmt_day, 4); + buf[4] = '\0'; + int first_day = atoi(buf); + double time_offset = (double) (first_day - theFirstLineDay)*SEC_PER_DAY; + + // Establish the first sample time in seconds from beginning of day: + strncpy(buf, pdr->gmt_sec, 22); + buf[22] = '\0'; + theEphFirstSampTime = atof(buf) + time_offset; + + int i, j; + double sample_time = theEphFirstSampTime; + buf[22] = '\0'; + NEWMAT::ColumnVector eciArpPos(3); + NEWMAT::ColumnVector eciArpVel(3); + NEWMAT::ColumnVector ecfArpPos(3); + NEWMAT::ColumnVector ecfArpVel(3); + NEWMAT::ColumnVector earthVel(3); + NEWMAT::Matrix xform; + theArpPosInterp = new ossimLagrangeInterpolator; + theArpVelInterp = new ossimLagrangeInterpolator; + + // Loop over each point, converting them to vectors: + for (i=0; i<numPoints; i++) + { + for (j=0; j<3; j++) + { + strncpy(buf, pdr->pos_vect[i].pos[j], 22); + eciArpPos[j] = atof(buf); + strncpy(buf, pdr->pos_vect[i].vel[j], 22); + eciArpVel[j] = atof(buf)/1000.0; + } + + // Convert pos and vel vectors from ECI to ECF: + eciToEcfXform(sample_time, xform); + ecfArpPos = xform*eciArpPos; + ecfArpVel = xform*eciArpVel; + theArpPosInterp->addData(sample_time, ecfArpPos); + + // Correct velocity for earth rotation: + earthVel[0] = -ecfArpPos[1]*EARTH_ANGULAR_VELOCITY; + earthVel[1] = ecfArpPos[0]*EARTH_ANGULAR_VELOCITY; + earthVel[2] = 0.0; + ecfArpVel = ecfArpVel - earthVel; + theArpVelInterp->addData(sample_time, ecfArpVel); + + sample_time += sampling_period; + } + + if (traceDebug()) + { + CLOG << "DEBUG -- " + << "\n\t theGHA: " << theGHA + << "\n\t numPoints: " << numPoints + << "\n\t sampling_period: " << sampling_period + << "\n\t theEphFirstSampTime: " << theEphFirstSampTime << endl; + } + + if (traceDebug()) CLOG << "returning..." << endl; +} + + +//****************************************************************************** +// Returns 3x3 transform to rotate ECI into ECF. The argument is +// in seconds of the day. +//****************************************************************************** +void ossimRS1SarModel::eciToEcfXform(const double& acq_time, NEWMAT::Matrix& xform) const +{ + static const char MODULE[] = "ossimRS1SarModel::eciToEcfXform(acq_time)"; + if (traceDebug()) CLOG << "entering..." << endl; + + // Determine time elapsed since ephemeris first sample time: + double delta_t = acq_time - theEphFirstSampTime; + + // Compute GHA at time of this image line (in degrees): + double gha = theGHA + delta_t*DEG_PER_SEC; + if (gha >= 360.0) + gha -=360.0; + else if (gha < 0.0) + gha += 360.0; + + // Establish rotation: + double cos_gha = ossim::cosd(gha); + double sin_gha = sind(gha); + + // Establish rotation matrix: + xform = ossimMatrix3x3::create(cos_gha, sin_gha, 0.0, + -sin_gha, cos_gha, 0.0, + 0.0, 0.0, 1.0); + if (traceDebug()) + { + CLOG << "DEBUG -- " + << "\n\t acq_time = " << acq_time + << "\n\t delta_t = " << delta_t + << "\n\t gha = " << gha << endl; + } + + if (traceDebug()) CLOG << "returning..." << endl; +} + + +//****************************************************************************** +// PRIVATE METHOD: ossimRS1SarModel::establishOrpInterp() +// +// This method reads the image data file for obtaining the local ORPs (taken +// to be the lat-lon of the nearest pixel for each line), and the zero-doppler +// time for each line. These ORPs are used for computing SPNs. +// +// The processed data records correspond to lines of imagery. Accompanying +// each data line is the lat-lon (at the ellipsoid) of the first, middle, and +// last sample of the line, the time of zero-doppler (broadside) imaging for +// the line. +// +// A Lagrange interpolator is established with N data points representing the +// local ORPs and their corresponding image line numbers +// uniformly distributed over the image. +// +// If the image is a ground range product, need to also read the ground-to- +// slant range conversion coefficients. +// +//****************************************************************************** +void ossimRS1SarModel::establishOrpInterp() +{ + static const char MODULE[] = "ossimRS1SarModel::establishOrpInterp()"; + if (traceDebug()) CLOG << "entering..." << endl; + + if (traceDebug()) + CLOG << "DEBUG -- " << endl; + + static const int NUM_DATA_POINTS = 11; + + desc_rec descRec; + pdr_prefix_rec prefix; + int sizeOfDescRec = sizeof(descRec); + int sizeOfPrefRec = sizeof(prefix); + int headerSize = sizeOfDescRec + sizeOfPrefRec; + char buf[] = "123456"; + ossimGpt localOrp (0.0, 0.0, theRefHeight); + std::vector<double> line_numbers_list; + std::vector<NEWMAT::ColumnVector> orpVectorList; // X, Y, Z + + if (traceDebug()) + { + CLOG << "DEBUG:" + << "\nsizeOfDescRec: " << sizeOfDescRec + << "\nsizeOfPrefRec: " << sizeOfPrefRec << endl; + } + + // Open the image data file given the image directory name and seek to first + // SAR data record: + FILE* fptr = fopen(theCeosData->imageFile().chars(), "r"); + if (!fptr) + { + CLOG << "ERROR: Could not open data file <" << theCeosData->imageFile() + << ">" << endl; + return; + } + fseek(fptr, theCeosData->imopDescRec()->desc.length, SEEK_SET); + + // Declare some constants and variables used in loop: + int last_line = (int) theImageSize.line - 1; + int delta_line = (int)ceil(last_line/((double)NUM_DATA_POINTS-1.0)); + int line_number = 0; + + // Compute the number of SAR data bytes to skip to reach prefix of next + // record of interest: + strncpy(buf, theCeosData->imopDescRec()->l_dataset, 6); + int record_size = atoi(buf); + + // Loop over each imaging line: + int index; + theLocalOrpInterp = new ossimLagrangeInterpolator; + for (index=0; index<NUM_DATA_POINTS; index++) + { + if (traceDebug()) + clog << "\t Processing ORP for line number " << line_number << endl; + + // Read the image line prefix info: + fread(&descRec, sizeOfDescRec, 1, fptr); + fread(&prefix, sizeOfPrefRec, 1, fptr); + + // Verify correct line number being read: + if ((prefix.line_num-1) != line_number) + { + CLOG << "\n\tERROR: Synchronization error reading image file. " + << "Expected line number " << line_number+1 + << " but read line number " << prefix.line_num << "." << endl; + return; + } + + // Latch the imaging time for the first line collected: + if (index == 0) + { + theFirstLineDay = prefix.acq_date.acq_day; + theFirstLineTime = (double) prefix.acq_date.acq_msec/1000.0; + } + + // Read the local ORP for this line and convert to ECF: + if (theDirectionFlag == ASCENDING) + { + localOrp.lat = (double) prefix.lat_first / 1.0e6; + localOrp.lon = (double) prefix.long_first / 1.0e6; + } + else + { + localOrp.lat = (double) prefix.lat_last / 1.0e6; + localOrp.lon = (double) prefix.long_last / 1.0e6; + } + + theLocalOrpInterp->addData(line_number, ossimEcefPoint(localOrp).toVector()); + + // Update the line number for next record, insuring we don't go passed + // the last line: + line_number += delta_line; + if (line_number > last_line) + { + delta_line -= line_number - last_line; // adjust for fseek below + line_number = last_line; + } + + // Advance to read the next prefix record of interest: + fseek(fptr, (delta_line)*record_size-headerSize, SEEK_CUR); + } + + // Compute time interval between each line, handle possible day rollover: + double lastLineTime = (double) prefix.acq_date.acq_msec/1000.0; + if ((lastLineTime-theFirstLineTime) > (SEC_PER_DAY/2.0)) + lastLineTime -= SEC_PER_DAY; + else if ((theFirstLineTime-lastLineTime) > (SEC_PER_DAY/2.0)) + lastLineTime += SEC_PER_DAY; + theTimePerLine = (lastLineTime - theFirstLineTime)/line_number; + + if (traceDebug()) + { + clog << "\n\t line_number (last) = " << line_number + << "\n\t last_line (in image) = " << last_line + << "\n\t theFirstLineTime = " << theFirstLineTime + << "\n\t lastLineTime = " << lastLineTime + << "\n\t theTimePerLine = " << theTimePerLine + << endl; + } + + if (traceDebug()) CLOG << "returning..." << endl; +} + +//****************************************************************************** +// This method establishes a common mean intrack-crosstrack-radial LSR +// space at the ARP. +//****************************************************************************** +void ossimRS1SarModel::establishVehicleSpace() +{ + static const char MODULE[] = "ossimRS1SarModel::establishVehicleSpace()"; + if (traceDebug()) CLOG << "entering..." << endl; + + // Obtain the imaging time when the vehicle is at the ARP: + double line = theImageSize.line/2.0; + double arpTime = theFirstLineTime + line*theTimePerLine; + + // Obtain the ephemeris at this time: + NEWMAT::ColumnVector arpPos(3); + theArpPosInterp->interpolate(arpTime, arpPos); + NEWMAT::ColumnVector arpVel(3); + theArpVelInterp->interpolate(arpTime, arpVel); + + // Convert ephemeris to ECF: + NEWMAT::Matrix xform; + eciToEcfXform(arpTime, xform); + ossimEcefPoint ecfArpPos (xform * arpPos); + ossimEcefVector ecfArpVel (xform * arpVel); + + // Need to correct the velocity vector by the earth rotational velocity: + ossimEcefVector earthVel(-ecfArpPos.y()*EARTH_ANGULAR_VELOCITY, + ecfArpPos.x()*EARTH_ANGULAR_VELOCITY, + 0.0); + ecfArpVel = ecfArpVel - earthVel; + + // Establish LSR space for intrack-crosstrack-radial at vehicle: + ossimEcefVector intrackDir (ecfArpVel); + ossimEcefVector crtrackDir (ecfArpPos.data().cross(intrackDir.data())); + theVehicleSpace = ossimLsrSpace (ecfArpPos, intrackDir, crtrackDir, 0); + + if (traceDebug()) + { + CLOG << "DEBUG -- " + << "\n\t theVehicleSpace: " << theVehicleSpace << endl; + } + + if (traceDebug()) CLOG << "returning..." << endl; +} + + +//****************************************************************************** +// For scan-mode imagery, this method interpolates the lat/lon given the image pixel. +//****************************************************************************** +void ossimRS1SarModel::interpolatedScanORP(const ossimDpt& orp, ossimEcefPoint& orp_ecf) const +{ + static const char MODULE[] = "ossimRS1SarModel::interpolatedScanORP(gDblPoint)"; + if (traceDebug()) CLOG << "entering..." << endl; + + ossimGpt gpt; + gpt.lat = theLatGrid(orp); + gpt.lon = theLonGrid(orp); + + // Convert to ECF: + orp_ecf = ossimEcefPoint(gpt); + + if (traceDebug()) CLOG << "returning..." << endl; +} + + +//****************************************************************************** +// PRIVATE METHOD: ossimRS1SarModel::establishOrpGrid() +// +// This method establishes a grid of lat-lon across the image for interpolating +// the geographic point on the ellipsoid given a pixel value. This is used for +// scan-mode imagery for obtaining a local ORP. +// +//****************************************************************************** +void ossimRS1SarModel::establishOrpGrid() +{ + static const char MODULE[] = "ossimRS1SarModel::establishOrpGrid()"; + if (traceDebug()) CLOG << "entering..." << endl; + + if (traceDebug()) + { + CLOG << "DEBUG -- " << endl; + } + + static const int NUM_GRID_POINTS_U = 11; + + desc_rec descRec; + pdr_prefix_rec prefix; + int sizeOfDescRec = sizeof(descRec); + int sizeOfPrefRec = sizeof(prefix); + int headerSize = sizeOfDescRec + sizeOfPrefRec; + char buf[] = "123456"; + ossimDpt gridSize ((double) NUM_GRID_POINTS_U, 3.0); + ossimDpt cellSize (theImageSize.line/gridSize.u, theImageSize.samp/gridSize.v); + + // Because we are doing integer arithmetic, it will be necessary to + // consider the last grid cells as being of a slightly different size: + //theLastGridCellSize.line = theImageSize.line - 1.0 - + // (theGridSize.u-2.0)*theGridCellSize.u; + //theLastGridCellSize.samp = theImageSize.samp - 1.0 - + // (theGridSize.v-2.0)*theGridCellSize.v; + + // Open the image data file given the image directory name and seek to first + // SAR data record: + FILE* fptr = fopen(theCeosData->imageFile().chars(), "r"); + if (!fptr) + { + CLOG << "ERROR: Could not open data file <" << theCeosData->imageFile() + << ">" << endl; + return; + } + fseek(fptr, theCeosData->imopDescRec()->desc.length, SEEK_SET); + + // Declare some constants and variables used in loop: + int last_line = (int) theImageSize.line - 1; + int delta_line = (int) cellSize.u; + int line_number = 0; + + // Allocate memory for coarse grid: + theLatGrid.initialize(gridSize, ossimDpt(0,0), ossimDpt(1,1)); + theLonGrid.initialize(gridSize, ossimDpt(0,0), ossimDpt(1,1)); + + // Compute the number of SAR data bytes to skip to reach prefix of next + // record of interest: + strncpy(buf, theCeosData->imopDescRec()->l_dataset, 6); + int record_size = atoi(buf); + int test_line = (int) gridSize.u - 2; + + // Loop over each imaging line: + for (int u=0; u<(int)gridSize.u; u++) + { + if (traceDebug()) + { + clog << "\t Processing grid line number " << u << endl; + } + + // Read the image line prefix info: + fread(&descRec, sizeOfDescRec, 1, fptr); + fread(&prefix, sizeOfPrefRec, 1, fptr); + + // Verify correct line number being read: + if ((prefix.line_num-1) != line_number) + { + CLOG << "\n\tERROR: Synchronization error reading image file. " + << "Expected line number " << line_number+1 + << " but read line number " << prefix.line_num << "." << endl; + return; + } + + // Latch the imaging time for the first line collected: + if (u == 0) + { + theFirstLineDay = prefix.acq_date.acq_day; + theFirstLineTime = (double) prefix.acq_date.acq_msec/1000.0; + } + + // Read the ground points for this line: + theLatGrid.setNode(u, 0, (double) prefix.lat_first /1.0e6); + theLatGrid.setNode(u, 1, (double) prefix.lat_mid /1.0e6); + theLatGrid.setNode(u, 2, (double) prefix.lat_last /1.0e6); + theLonGrid.setNode(u, 0, (double) prefix.long_first/1.0e6); + theLonGrid.setNode(u, 1, (double) prefix.long_mid /1.0e6); + theLonGrid.setNode(u, 2, (double) prefix.long_last /1.0e6); + + // Update the line number for next record, insuring we don't go passed + // the last line: + if (u == test_line) + { + delta_line = last_line - line_number; + line_number = last_line; + } + else + { + line_number += delta_line; + } + + //*** + // Advance to read the next prefix record of interest: + //*** + fseek(fptr, (delta_line)*record_size-headerSize, SEEK_CUR); + } + + // Compute time interval between each line, handle possible day rollover: + double lastLineTime = (double) prefix.acq_date.acq_msec/1000.0; + if ((lastLineTime-theFirstLineTime) > (SEC_PER_DAY/2.0)) + { + lastLineTime -= SEC_PER_DAY; + } + else if ((theFirstLineTime-lastLineTime) > (SEC_PER_DAY/2.0)) + { + lastLineTime += SEC_PER_DAY; + } + theTimePerLine = (lastLineTime - theFirstLineTime)/line_number; + + if (traceDebug()) + { + clog << "\n\t line_number (last) = " << line_number + << "\n\t last_line (in image) = " << last_line + << "\n\t theFirstLineTime = " << theFirstLineTime + << "\n\t lastLineTime = " << lastLineTime + << "\n\t theTimePerLine = " << theTimePerLine + << endl; + } + + if (traceDebug()) CLOG << "returning..." << endl; +} + +//****************************************************************************** +// PRIVATE METHOD: deallocateMemory() +// +// This method permits the partial destruction of the object so that it may +// be reconstructed without invoking the destructor. +// +//****************************************************************************** +void ossimRS1SarModel::deallocateMemory() +{ + static const char MODULE[] = "ossimRS1SarModel::deallocateMemory()"; + if (traceDebug()) CLOG << "entering..." << endl; + + theArpPosInterp = 0; + theArpVelInterp = 0; + theLocalOrpInterp = 0; + theCeosData = 0; + theLatGrid.clear(); + theLonGrid.clear(); + + if (traceDebug()) CLOG << "returning..." << endl; +} + + diff --git a/Utilities/otbossim/src/ossim/support_data/ossimCeosData.cpp b/Utilities/otbossim/src/ossim/support_data/ossimCeosData.cpp new file mode 100644 index 0000000000000000000000000000000000000000..446729cd88dd829249cbfcc401d5c90b2d4f647b --- /dev/null +++ b/Utilities/otbossim/src/ossim/support_data/ossimCeosData.cpp @@ -0,0 +1,1373 @@ +//******************************************************************* +// +// License: See top level LICENSE.txt file. +// +// Author: Oscar Kramer +// +// Description: +// +// Class for reading CEOS-formatted metadata. +// +//******************************************************************* +// $Id:$ + +#include <cstdio> +#include <cstdlib> +#include <cstring> +using namespace std; + +#include <ossim/support_data/ossimCeosData.h> +#include "ossim/base/ossimCommon.h" +#include <ossim/base/ossimTrace.h> + +// Define Trace flags for use within this file: +static ossimTrace traceExec ("ossimCeosData:exec"); +static ossimTrace traceDebug ("ossimCeosData:debug"); + +static const ossimFilename CEOS_VOL_DIR_FILENAME = "vdf_dat.001"; +static const ossimFilename CEOS_LEADER_FILENAME = "lea_01.001"; +static const ossimFilename CEOS_IMAGE_FILENAME = "dat_01.001"; +static const ossimFilename CEOS_TRAILER_FILENAME = "tra_01.001"; + + +//****************************************************************************** +// CONSTRUCTOR: +//****************************************************************************** +ossimCeosData::ossimCeosData(const ossimFilename& volDirFile, + const ossimFilename& leaderFile, + const ossimFilename& imageFile, + const ossimFilename& trailerFile) + : + theVolDirFileName (volDirFile), + theLeaderFileName (leaderFile), + theImageFileName (imageFile), + theTrailerFileName (trailerFile), + theErrorStatus (OK), + theVolDescRec (0), + theTextRec (0), + theDataSetSumRec (0), + theQualSumRec (0), + theSdrHistRec (0), + thePdr16HistRec (0), + thePdr8HistRec (0), + theProcParmRec (0), + theMapProjRec (0), + thePosDataRec (0), + theAttDataRec (0), + theRadiDataRec (0), + theRadiCompRec (0) +{ + static const char MODULE[] = "ossimCeosData Constructor #1"; + if (traceExec()) CLOG << "entering..." << endl; + + loadCeosRecords(); + + if (traceExec()) CLOG << "returning..." << endl; +} + + +//****************************************************************************** +// CONSTRUCTOR: ossimCeosData(ossimFilename) +// +// Initializes given the image directory (assumes default filenames). +// +//****************************************************************************** +ossimCeosData::ossimCeosData(const ossimFilename& imageDir) + : + theErrorStatus (OK), + theVolDescRec (0), + theTextRec (0), + theDataSetSumRec (0), + theQualSumRec (0), + theSdrHistRec (0), + thePdr16HistRec (0), + thePdr8HistRec (0), + theProcParmRec (0), + theMapProjRec (0), + thePosDataRec (0), + theAttDataRec (0), + theRadiDataRec (0), + theRadiCompRec (0) +{ + static const char MODULE[] = "ossimCeosData Constructor #1"; + if (traceExec()) CLOG << "entering..." << endl; + + //*** + // Assign values to ossimFilename data members: + //*** + theVolDirFileName = imageDir.dirCat(CEOS_VOL_DIR_FILENAME); + theLeaderFileName = imageDir.dirCat(CEOS_LEADER_FILENAME); + theImageFileName = imageDir.dirCat(CEOS_IMAGE_FILENAME); + theTrailerFileName = imageDir.dirCat(CEOS_TRAILER_FILENAME); + + loadCeosRecords(); + + if (traceExec()) CLOG << "returning..." << endl; +} + + +//****************************************************************************** +// PUBLIC METHOD: ossimCeosData::dump(ostream&) +// +//****************************************************************************** +void ossimCeosData::dump(ostream& stream) const +{ + static const char MODULE[] = "ossimCeosData::dump(ostream& stream)"; + if (traceExec()) CLOG << "entering..." << endl; + + stream << "\nDump of ossimCeosData Object -----------------------------" << endl; + + if (theVolDescRec) + dumpVolDescRec(stream); + else + stream << "\n\n\tvol_desc_rec not present." << endl; + + if (theTextRec) + dumpTextRec(stream); + else + stream << "\n\n\ttext_rec not present." << endl; + + if (imopDescRec()) + dumpImopDescRec(stream); + else + stream << "\n\n\timop_desc_rec not present." << endl; + + if (theDataSetSumRec) + dumpDataSetSumRec(stream); + else + stream << "\n\n\tdataset_sum_rec not present." << endl; + + if (theQualSumRec) + dumpQualSumRec(stream); + else + stream << "\n\n\tqual_sum_rec not present." << endl; + + if (theSdrHistRec) + dumpSdrHistRec(stream); + else + stream << "\n\n\tsdr_hist_rec not present." << endl; + + if (thePdr16HistRec) + dumpPdr16HistRec(stream); + else + stream << "\n\n\tpdr16_hist_rec not present." << endl; + + if (thePdr8HistRec) + dumpPdr8HistRec(stream); + else + stream << "\n\n\tpdr8_hist_rec not present." << endl; + + if (theProcParmRec) + dumpProcParmRec(stream); + else + stream << "\n\n\tproc_parm_rec not present." << endl; + + if (theMapProjRec) + dumpMapProjRec(stream); + else + stream << "\n\n\tmap_proj_rec not present." << endl; + + if (thePosDataRec) + dumpPosDataRec(stream); + else + stream << "\n\n\tpos_data_rec not present." << endl; + + if (theAttDataRec) + dumpAttDataRec(stream); + else + stream << "\n\n\tatt_data_rec not present." << endl; + + if (theRadiDataRec) + dumpRadiDataRec(stream); + else + stream << "\n\n\tradi_data_rec not present." << endl; + + if (theRadiCompRec) + dumpRadiCompRec(stream); + else + stream << "\n\n\tradi_comp_rec not present." << endl; + + stream << "\nEnd of ossimCeosData Object Dump -------------------------" << endl; + + if (traceExec()) CLOG << "returning..." << endl; + return; +} + +//****************************************************************************** +// PRIVATE METHOD: ossimCeosData::dumpVolDescRec() +// +//****************************************************************************** +void ossimCeosData::dumpVolDescRec(ostream& stream) const +{ + const vol_desc_rec* p = theVolDescRec; + + stream << "\n\n\tContents of vol_desc_rec:\n"; + stream << "\n\t ascii_flag \""; stream.write(p->ascii_flag, 2); + stream << "\"\n\t format_doc \""; stream.write(p->format_doc, 12); + stream << "\"\n\t format_ver \""; stream.write(p->format_ver, 2); + stream << "\"\n\t format_rev \""; stream.write(p->format_rev, 2); + stream << "\"\n\t software_id \""; stream.write(p->software_id, 12); + stream << "\"\n\t phyvol_id \""; stream.write(p->phyvol_id, 16); + stream << "\"\n\t logvol_id \""; stream.write(p->logvol_id, 16); + stream << "\"\n\t volset_id \""; stream.write(p->volset_id, 16); + stream << "\"\n\t phyvol_cnt \""; stream.write(p->phyvol_cnt, 2); + stream << "\"\n\t first_phyvol \""; stream.write(p->first_phyvol, 2); + stream << "\"\n\t last_phyvol \""; stream.write(p->last_phyvol, 2); + stream << "\"\n\t curr_phyvol \""; stream.write(p->curr_phyvol, 2); + stream << "\"\n\t first_file \""; stream.write(p->first_file, 4); + stream << "\"\n\t volset_log \""; stream.write(p->volset_log, 4); + stream << "\"\n\t phyvol_log \""; stream.write(p->phyvol_log, 4); + stream << "\"\n\t logvol_date \""; stream.write(p->logvol_date, 8); + stream << "\"\n\t logvol_time \""; stream.write(p->logvol_time, 8); + stream << "\"\n\t logvol_country \""; + stream.write(p->logvol_country, 12); + stream << "\"\n\t logvol_agency \""; stream.write(p->logvol_agency, 8); + stream << "\"\n\t logvol_facility \""; + stream.write(p->logvol_facility,12); + stream << "\"\n\t n_filepoint \""; stream.write(p->n_filepoint, 4); + stream << "\"\n\t n_voldir \""; stream.write(p->n_voldir, 4); + stream << "\"\n\t product_id \""; stream.write(p->product_id, 8); + + stream << "\"" << endl; +} + +//****************************************************************************** +// PRIVATE METHOD: ossimCeosData::dumpTextRec() +// +//****************************************************************************** +void ossimCeosData::dumpTextRec(ostream& stream) const +{ + const text_rec* p = theTextRec; + + stream << "\n\n\tContents of text_rec:\n\t"; + stream << "\n\t ascii_flag \""; stream.write(p->ascii_flag, 2); + stream << "\"\n\t cont_flag \""; stream.write(p->cont_flag, 2); + stream << "\"\n\t product_type \""; stream.write(p->product_type, 40); + stream << "\"\n\t product_create \""; + stream.write(p->product_create, 60); + stream << "\"\n\t phyvol_id \""; stream.write(p->phyvol_id, 40); + stream << "\"\n\t scene_id \""; stream.write(p->scene_id, 40); + stream << "\"\n\t scene_loc \""; stream.write(p->scene_loc, 40); + stream << "\"" << endl; +} + +//****************************************************************************** +// PRIVATE METHOD: ossimCeosData::dumpImopDescRec() +// +//****************************************************************************** +void ossimCeosData::dumpImopDescRec(ostream& stream) const +{ + const imop_desc_rec* p = &theImopDescRec; + + stream << "\n\n\tContents of imop_desc_rec:\n\t"; + stream << "\n\t ascii_flag \""; stream.write(p->ascii_flag, 2); + stream << "\"\n\t spare1 \""; stream.write(p->spare1, 2); + stream << "\"\n\t format_doc \""; stream.write(p->format_doc, 12); + stream << "\"\n\t format_rev \""; stream.write(p->format_rev, 2); + stream << "\"\n\t design_rev \""; stream.write(p->design_rev, 2); + stream << "\"\n\t software_id \""; stream.write(p->software_id, 12); + stream << "\"\n\t file_num \""; stream.write(p->file_num, 4); + stream << "\"\n\t file_name \""; stream.write(p->file_name, 16); + stream << "\"\n\t rec_seq \""; stream.write(p->rec_seq, 4); + stream << "\"\n\t seq_loc \""; stream.write(p->seq_loc, 8); + stream << "\"\n\t seq_len \""; stream.write(p->seq_len, 4); + stream << "\"\n\t rec_code \""; stream.write(p->rec_code, 4); + stream << "\"\n\t code_loc \""; stream.write(p->code_loc, 8); + stream << "\"\n\t code_len \""; stream.write(p->code_len, 4); + stream << "\"\n\t rec_len \""; stream.write(p->rec_len, 4); + stream << "\"\n\t rlen_loc \""; stream.write(p->rlen_loc, 8); + stream << "\"\n\t rlen_len \""; stream.write(p->rlen_len, 4); + stream << "\"\n\t spare2 \""; stream.write(p->spare2, 4); + stream << "\"\n\t spare3 \""; stream.write(p->spare3, 64); + stream << "\"\n\t n_dataset \""; stream.write(p->n_dataset, 6); + stream << "\"\n\t l_dataset \""; stream.write(p->l_dataset, 6); + stream << "\"\n\t spare4 \""; stream.write(p->spare4, 24); + stream << "\"\n\t nbit \""; stream.write(p->nbit, 4); + stream << "\"\n\t nsamp \""; stream.write(p->nsamp, 4); + stream << "\"\n\t nbyte \""; stream.write(p->nbyte, 4); + stream << "\"\n\t justify \""; stream.write(p->justify, 4); + stream << "\"\n\t nchn \""; stream.write(p->nchn, 4); + stream << "\"\n\t nlin \""; stream.write(p->nlin, 8); + stream << "\"\n\t nleft \""; stream.write(p->nleft, 4); + stream << "\"\n\t ngrp \""; stream.write(p->ngrp, 8); + stream << "\"\n\t nright \""; stream.write(p->nright, 4); + stream << "\"\n\t ntop \""; stream.write(p->ntop, 4); + stream << "\"\n\t nbott \""; stream.write(p->nbott, 4); + stream << "\"\n\t intleav \""; stream.write(p->intleav, 4); + stream << "\"\n\t nrec_lin \""; stream.write(p->nrec_lin, 2); + stream << "\"\n\t nrec_chn \""; stream.write(p->nrec_chn, 2); + stream << "\"\n\t n_prefix \""; stream.write(p->n_prefix, 4); + stream << "\"\n\t n_sar \""; stream.write(p->n_sar, 8); + stream << "\"\n\t n_suffix \""; stream.write(p->n_suffix, 4); + stream << "\"\n\t spare5 \""; stream.write(p->spare5, 4); + stream << "\"\n\t lin_loc \""; stream.write(p->lin_loc, 8); + stream << "\"\n\t chn_loc \""; stream.write(p->chn_loc, 8); + stream << "\"\n\t tim_loc \""; stream.write(p->tim_loc, 8); + stream << "\"\n\t left_loc \""; stream.write(p->left_loc, 8); + stream << "\"\n\t right_loc \""; stream.write(p->right_loc, 8); + stream << "\"\n\t pad_ind \""; stream.write(p->pad_ind, 4); + stream << "\"\n\t spare6 \""; stream.write(p->spare6, 28); + stream << "\"\n\t qual_loc \""; stream.write(p->qual_loc, 8); + stream << "\"\n\t cali_loc \""; stream.write(p->cali_loc, 8); + stream << "\"\n\t gain_loc \""; stream.write(p->gain_loc, 8); + stream << "\"\n\t bias_loc \""; stream.write(p->bias_loc, 8); + stream << "\"\n\t type_id \""; stream.write(p->type_id, 28); + stream << "\"\n\t type_code \""; stream.write(p->type_code, 4); + stream << "\"\n\t left_fill \""; stream.write(p->left_fill, 4); + stream << "\"\n\t right_fill \""; stream.write(p->right_fill, 4); + stream << "\"\n\t pix_rng \""; stream.write(p->pix_rng, 8); + stream << "\"" << endl; +} + +//****************************************************************************** +// PRIVATE METHOD: ossimCeosData::dumpDataSetSumRec() +// +//****************************************************************************** +void ossimCeosData::dumpDataSetSumRec(ostream& stream) const +{ + const dataset_sum_rec* p = theDataSetSumRec; + + stream << "\n\n\tContents of dataset_sum_rec:\n\t \""; + stream << "\n\t seq_num \""; stream.write(p->seq_num, 4); + stream << "\"\n\t sar_chn \""; stream.write(p->sar_chn, 4); + stream << "\"\n\t scene_id \""; stream.write(p->scene_id, 16); + stream << "\"\n\t scene_des \""; stream.write(p->scene_des, 32); + stream << "\"\n\t inp_sctim \""; stream.write(p->inp_sctim, 32); + stream << "\"\n\t asc_des \""; stream.write(p->asc_des, 16); + stream << "\"\n\t pro_lat \""; stream.write(p->pro_lat, 16); + stream << "\"\n\t pro_long \""; stream.write(p->pro_long, 16); + stream << "\"\n\t pro_head \""; stream.write(p->pro_head, 16); + stream << "\"\n\t ellip_des \""; stream.write(p->ellip_des, 16); + stream << "\"\n\t ellip_maj \""; stream.write(p->ellip_maj, 16); + stream << "\"\n\t ellip_min \""; stream.write(p->ellip_min, 16); + stream << "\"\n\t earth_mass \""; stream.write(p->earth_mass, 16); + stream << "\"\n\t grav_const \""; stream.write(p->grav_const, 16); + stream << "\"\n\t ellip_j[0] \""; stream.write(p->ellip_j[0], 16); + stream << "\"\n\t ellip_j[1] \""; stream.write(p->ellip_j[1], 16); + stream << "\"\n\t ellip_j[2] \""; stream.write(p->ellip_j[2], 16); + stream << "\"\n\t spare1 \""; stream.write(p->spare1, 16); + stream << "\"\n\t terrain_h \""; stream.write(p->terrain_h, 16); + stream << "\"\n\t sc_lin \""; stream.write(p->sc_lin, 8); + stream << "\"\n\t sc_pix \""; stream.write(p->sc_pix, 8); + stream << "\"\n\t scene_len \""; stream.write(p->scene_len, 16); + stream << "\"\n\t scene_wid \""; stream.write(p->scene_wid, 16); + stream << "\"\n\t spare2 \""; stream.write(p->spare2, 16); + stream << "\"\n\t nchn \""; stream.write(p->nchn, 4); + stream << "\"\n\t spare3 \""; stream.write(p->spare3, 4); + stream << "\"\n\t mission_id \""; stream.write(p->mission_id, 16); + stream << "\"\n\t sensor_id \""; stream.write(p->sensor_id, 32); + stream << "\"\n\t orbit_num \""; stream.write(p->orbit_num, 8); + stream << "\"\n\t plat_lat \""; stream.write(p->plat_lat, 8); + stream << "\"\n\t plat_long \""; stream.write(p->plat_long, 8); + stream << "\"\n\t plat_head \""; stream.write(p->plat_head, 8); + stream << "\"\n\t clock_ang \""; stream.write(p->clock_ang, 8); + stream << "\"\n\t incident_ang \""; stream.write(p->incident_ang, 8); + stream << "\"\n\t spare4 \""; stream.write(p->spare4, 8); + stream << "\"\n\t wave_length \""; stream.write(p->wave_length, 16); + stream << "\"\n\t motion_comp \""; stream.write(p->motion_comp, 2); + stream << "\"\n\t pulse_code \""; stream.write(p->pulse_code, 16); + stream << "\"\n\t ampl_coef[0] \""; stream.write(p->ampl_coef[0], 16); + stream << "\"\n\t ampl_coef[1] \""; stream.write(p->ampl_coef[1], 16); + stream << "\"\n\t ampl_coef[2] \""; stream.write(p->ampl_coef[2], 16); + stream << "\"\n\t ampl_coef[3] \""; stream.write(p->ampl_coef[3], 16); + stream << "\"\n\t ampl_coef[4] \""; stream.write(p->ampl_coef[4], 16); + stream << "\"\n\t phas_coef[0] \""; stream.write(p->phas_coef[0], 16); + stream << "\"\n\t phas_coef[1] \""; stream.write(p->phas_coef[1], 16); + stream << "\"\n\t phas_coef[2] \""; stream.write(p->phas_coef[2], 16); + stream << "\"\n\t phas_coef[3] \""; stream.write(p->phas_coef[3], 16); + stream << "\"\n\t phas_coef[4] \""; stream.write(p->phas_coef[4], 16); + stream << "\"\n\t chirp_ext_ind \""; stream.write(p->chirp_ext_ind, 8); + stream << "\"\n\t spare5 \""; stream.write(p->spare5, 8); + stream << "\"\n\t fr \""; stream.write(p->fr, 16); + stream << "\"\n\t rng_gate \""; stream.write(p->rng_gate, 16); + stream << "\"\n\t rng_length \""; stream.write(p->rng_length, 16); + stream << "\"\n\t baseband_f \""; stream.write(p->baseband_f, 4); + stream << "\"\n\t rngcmp_f \""; stream.write(p->rngcmp_f, 4); + stream << "\"\n\t gn_polar \""; stream.write(p->gn_polar, 16); + stream << "\"\n\t gn_cross \""; stream.write(p->gn_cross, 16); + stream << "\"\n\t chn_bits \""; stream.write(p->chn_bits, 8); + stream << "\"\n\t quant_desc \""; stream.write(p->quant_desc, 12); + stream << "\"\n\t i_bias \""; stream.write(p->i_bias, 16); + stream << "\"\n\t q_bias \""; stream.write(p->q_bias, 16); + stream << "\"\n\t iq_ratio \""; stream.write(p->iq_ratio, 16); + stream << "\"\n\t spare6 \""; stream.write(p->spare6, 16); + stream << "\"\n\t spare7 \""; stream.write(p->spare7, 16); + stream << "\"\n\t ele_sight \""; stream.write(p->ele_sight, 16); + stream << "\"\n\t mech_sight \""; stream.write(p->mech_sight, 16); + stream << "\"\n\t echo_track \""; stream.write(p->echo_track, 4); + stream << "\"\n\t fa \""; stream.write(p->fa, 16); + stream << "\"\n\t elev_beam \""; stream.write(p->elev_beam, 16); + stream << "\"\n\t azim_beam \""; stream.write(p->azim_beam, 16); + stream << "\"\n\t sat_bintim \""; stream.write(p->sat_bintim, 16); + stream << "\"\n\t sat_clktim \""; stream.write(p->sat_clktim, 32); + stream << "\"\n\t sat_clkinc \""; stream.write(p->sat_clkinc, 8); + stream << "\"\n\t spare8 \""; stream.write(p->spare8, 8); + stream << "\"\n\t fac_id \""; stream.write(p->fac_id, 16); + stream << "\"\n\t sys_id \""; stream.write(p->sys_id, 8); + stream << "\"\n\t ver_id \""; stream.write(p->ver_id, 8); + stream << "\"\n\t fac_code \""; stream.write(p->fac_code, 16); + stream << "\"\n\t lev_code \""; stream.write(p->lev_code, 16); + stream << "\"\n\t prod_type \""; stream.write(p->prod_type, 32); + stream << "\"\n\t algor_id \""; stream.write(p->algor_id, 32); + stream << "\"\n\t n_azilok \""; stream.write(p->n_azilok, 16); + stream << "\"\n\t n_rnglok \""; stream.write(p->n_rnglok, 16); + stream << "\"\n\t bnd_azilok \""; stream.write(p->bnd_azilok, 16); + stream << "\"\n\t bnd_rnglok \""; stream.write(p->bnd_rnglok, 16); + stream << "\"\n\t bnd_azi \""; stream.write(p->bnd_azi, 16); + stream << "\"\n\t bnd_rng \""; stream.write(p->bnd_rng, 16); + stream << "\"\n\t azi_weight \""; stream.write(p->azi_weight, 32); + stream << "\"\n\t rng_weight \""; stream.write(p->rng_weight, 32); + stream << "\"\n\t data_inpsrc \""; stream.write(p->data_inpsrc, 16); + stream << "\"\n\t rng_res \""; stream.write(p->rng_res, 16); + stream << "\"\n\t azi_res \""; stream.write(p->azi_res, 16); + stream << "\"\n\t radi_stretch[0] \""; + stream.write(p->radi_stretch[0],16); + stream << "\"\n\t radi_stretch[1] \""; + stream.write(p->radi_stretch[1],16); + stream << "\"\n\t alt_dopcen[0] \""; stream.write(p->alt_dopcen[0],16); + stream << "\"\n\t alt_dopcen[1] \""; stream.write(p->alt_dopcen[1],16); + stream << "\"\n\t alt_dopcen[2] \""; stream.write(p->alt_dopcen[2],16); + stream << "\"\n\t spare9 \""; stream.write(p->spare9, 16); + stream << "\"\n\t crt_dopcen[0] \""; stream.write(p->crt_dopcen[0],16); + stream << "\"\n\t crt_dopcen[1] \""; stream.write(p->crt_dopcen[1],16); + stream << "\"\n\t crt_dopcen[2] \""; stream.write(p->crt_dopcen[2],16); + stream << "\"\n\t time_dir_pix \""; stream.write(p->time_dir_pix, 8); + stream << "\"\n\t time_dir_lin \""; stream.write(p->time_dir_lin, 8); + stream << "\"\n\t alt_rate[0] \""; stream.write(p->alt_rate[0], 16); + stream << "\"\n\t alt_rate[1] \""; stream.write(p->alt_rate[1], 16); + stream << "\"\n\t alt_rate[2] \""; stream.write(p->alt_rate[2], 16); + stream << "\"\n\t spare10 \""; stream.write(p->spare10, 16); + stream << "\"\n\t crt_rate[0] \""; stream.write(p->crt_rate[0], 16); + stream << "\"\n\t crt_rate[1] \""; stream.write(p->crt_rate[1], 16); + stream << "\"\n\t crt_rate[2] \""; stream.write(p->crt_rate[2], 16); + stream << "\"\n\t spare11 \""; stream.write(p->spare11, 16); + stream << "\"\n\t line_cont \""; stream.write(p->line_cont, 8); + stream << "\"\n\t clutter_lock \""; stream.write(p->clutter_lock, 4); + stream << "\"\n\t auto_focus \""; stream.write(p->auto_focus, 4); + stream << "\"\n\t line_spacing \""; stream.write(p->line_spacing, 16); + stream << "\"\n\t pix_spacing \""; stream.write(p->pix_spacing, 16); + stream << "\"\n\t rngcmp_desg \""; stream.write(p->rngcmp_desg, 16); + stream << "\"" << endl; +} + +//****************************************************************************** +// PRIVATE METHOD: ossimCeosData::dumpQualSumRec() +// +//****************************************************************************** +void ossimCeosData::dumpQualSumRec(ostream& stream) const +{ + const qual_sum_rec* p = theQualSumRec; + + stream << "\n\n\tContents of qual_sum_rec:\n\t"; + stream << "\n\t rec_seq \""; stream.write(p->rec_seq, 4); + stream << "\"\n\t sar_chn \""; stream.write(p->sar_chn, 4); + stream << "\"\n\t cali_date \""; stream.write(p->cali_date, 6); + stream << "\"\n\t nchn \""; stream.write(p->nchn, 4); + stream << "\"\n\t islr \""; stream.write(p->islr, 16); + stream << "\"\n\t pslr \""; stream.write(p->pslr, 16); + stream << "\"\n\t azi_ambig \""; stream.write(p->azi_ambig, 16); + stream << "\"\n\t rng_ambig \""; stream.write(p->rng_ambig, 16); + stream << "\"\n\t snr \""; stream.write(p->snr, 16); + stream << "\"\n\t ber \""; stream.write(p->ber, 16); + stream << "\"\n\t rng_res \""; stream.write(p->rng_res, 16); + stream << "\"\n\t azi_res \""; stream.write(p->azi_res, 16); + stream << "\"\n\t rad_res \""; stream.write(p->rad_res, 16); + stream << "\"\n\t dyn_rng \""; stream.write(p->dyn_rng, 16); + stream << "\"\n\t rad_unc_db \""; stream.write(p->rad_unc_db, 16); + stream << "\"\n\t rad_unc_deg \""; stream.write(p->rad_unc_deg, 16); + int i; + for (i=0; i<16; i++) + { + stream << "\"\n\t rad_unc[" << i << "]:"; + stream << "\n\t db \""; + stream.write(p->rad_unc[i].db, 16); + stream << "\"\n\t deg \""; + stream.write(p->rad_unc[i].deg, 16); + } + stream << "\"\n\t alt_locerr \""; stream.write(p->alt_locerr, 16); + stream << "\"\n\t crt_locerr \""; stream.write(p->crt_locerr, 16); + stream << "\"\n\t alt_scale \""; stream.write(p->alt_scale, 16); + stream << "\"\n\t crt_scale \""; stream.write(p->crt_scale, 16); + stream << "\"\n\t dis_skew \""; stream.write(p->dis_skew, 16); + stream << "\"\n\t ori_err \""; stream.write(p->ori_err, 16); + for (i=0; i<16; i++) + { + stream << "\"\n\t misreg[" << i << "]:"; + stream << "\n\t alt_m \""; + stream.write(p->misreg[i].alt_m, 16); + stream << "\"\n\t crt_m \""; + stream.write(p->misreg[i].crt_m, 16); + } + stream << "\"\n\t nesz \""; stream.write(p->nesz, 16); + stream << "\"\n\t enl \""; stream.write(p->enl, 16); + stream << "\"\n\t tb_update \""; stream.write(p->tb_update, 8); + stream << "\"" << endl; +} + +//****************************************************************************** +// PRIVATE METHOD: ossimCeosData::dumpSdrHistRec() +// +//****************************************************************************** +void ossimCeosData::dumpSdrHistRec(ostream& stream) const +{ + const sdr_hist_rec* p = theSdrHistRec; + + stream << "\n\n\tContents of sdr_hist_rec:\n\t"; + stream << "\n\t rec_seq \""; stream.write(p->rec_seq, 4); + stream << "\"\n\t sar_chn \""; stream.write(p->sar_chn, 4); + stream << "\"\n\t ntab \""; stream.write(p->ntab, 8); + stream << "\"\n\t ltab \""; stream.write(p->ltab, 8); + stream << "\"\n\t htab[0] (only one sdr_htab_rec declared in data struct):"; + stream << "\n\t hist_desc \""; + stream.write(p->htab.hist_desc, 32); + stream << "\"\n\t nrec \""; stream.write(p->htab.nrec, 4); + stream << "\"\n\t tab_seq \""; stream.write(p->htab.tab_seq, 4); + stream << "\"\n\t nbin \""; stream.write(p->htab.nbin, 8); + stream << "\"\n\t ns_lin \""; stream.write(p->htab.ns_lin, 8); + stream << "\"\n\t ns_pix \""; stream.write(p->htab.ns_pix, 8); + stream << "\"\n\t ngrp_lin \""; stream.write(p->htab.ngrp_lin, 8); + stream << "\"\n\t ngrp_pix \""; stream.write(p->htab.ngrp_pix, 8); + stream << "\"\n\t nsamp_lin \""; stream.write(p->htab.nsamp_lin,8); + stream << "\"\n\t nsamp_pix \""; stream.write(p->htab.nsamp_pix,8); + stream << "\"\n\t min_smp \""; stream.write(p->htab.min_smp, 16); + stream << "\"\n\t max_smp \""; stream.write(p->htab.max_smp, 16); + stream << "\"\n\t mean_smp \""; stream.write(p->htab.mean_smp,16); + stream << "\"\n\t std_smp \""; stream.write(p->htab.std_smp, 16); + stream << "\"\n\t smp_inc \""; stream.write(p->htab.smp_inc, 16); + stream << "\"\n\t min_hist \""; stream.write(p->htab.min_hist,16); + stream << "\"\n\t max_hist \""; stream.write(p->htab.max_hist,16); + stream << "\"\n\t mean_hist \""; + stream.write(p->htab.mean_hist, 16); + stream << "\"\n\t std_hist \""; stream.write(p->htab.std_hist,16); + stream << "\"\n\t nhist \""; stream.write(p->htab.nhist, 16); + stream << "\"\n\t [Use debugger to view histogram]"; + stream << endl; +} + +//****************************************************************************** +// PRIVATE METHOD: ossimCeosData::dumpPdr16HistRec() +// +//****************************************************************************** +void ossimCeosData::dumpPdr16HistRec(ostream& stream) const +{ + const pdr16_hist_rec* p = thePdr16HistRec; + + stream << "\n\n\tContents of pdr16_hist_rec:\n\t"; + stream << "\n\t rec_seq \""; stream.write(p->rec_seq, 4); + stream << "\"\n\t sar_chn \""; stream.write(p->sar_chn, 4); + stream << "\"\n\t ntab \""; stream.write(p->ntab, 8); + stream << "\"\n\t ltab \""; stream.write(p->ltab, 8); + + char buf[] = "12345678"; + strncpy(buf, p->ntab, 8); + int n = atoi(buf); + for (int i=0; i<n; i++) + { + stream << "\"\n\t htab[" << i << "]:"; + stream << "\n\t hist_desc \""; + stream.write(p->htab[i].hist_desc, 32); + stream << "\"\n\t nrec \""; + stream.write(p->htab[i].nrec, 4); + stream << "\"\n\t tab_seq \""; + stream.write(p->htab[i].tab_seq, 4); + stream << "\"\n\t nbin \""; + stream.write(p->htab[i].nbin, 8); + stream << "\"\n\t ns_lin \""; + stream.write(p->htab[i].ns_lin, 8); + stream << "\"\n\t ns_pix \""; + stream.write(p->htab[i].ns_pix, 8); + stream << "\"\n\t ngrp_lin \""; + stream.write(p->htab[i].ngrp_lin, 8); + stream << "\"\n\t ngrp_pix \""; + stream.write(p->htab[i].ngrp_pix, 8); + stream << "\"\n\t nsamp_lin \""; + stream.write(p->htab[i].nsamp_lin, 8); + stream << "\"\n\t nsamp_pix \""; + stream.write(p->htab[i].nsamp_pix, 8); + stream << "\"\n\t min_smp \""; + stream.write(p->htab[i].min_smp, 16); + stream << "\"\n\t max_smp \""; + stream.write(p->htab[i].max_smp, 16); + stream << "\"\n\t mean_smp \""; + stream.write(p->htab[i].mean_smp, 16); + stream << "\"\n\t std_smp \""; + stream.write(p->htab[i].std_smp, 16); + stream << "\"\n\t smp_inc \""; + stream.write(p->htab[i].smp_inc, 16); + stream << "\"\n\t min_hist \""; + stream.write(p->htab[i].min_hist, 16); + stream << "\"\n\t max_hist \""; + stream.write(p->htab[i].max_hist, 16); + stream << "\"\n\t mean_hist \""; + stream.write(p->htab[i].mean_hist, 16); + stream << "\"\n\t std_hist \""; + stream.write(p->htab[i].std_hist, 16); + stream << "\"\n\t nhist \""; + stream.write(p->htab[i].nhist, 16); + stream << "\n\t [Use debugger to view histogram]"; + } + stream << "\"" << endl; +} + +//****************************************************************************** +// PRIVATE METHOD: ossimCeosData::dumpPdr8HistRec() +// +//****************************************************************************** +void ossimCeosData::dumpPdr8HistRec(ostream& stream) const +{ + const pdr8_hist_rec* p = thePdr8HistRec; + + stream << "\n\n\tContents of pdr18hist_rec:\n\t"; + stream << "\n\t rec_seq \""; stream.write(p->rec_seq, 4); + stream << "\"\n\t sar_chn \""; stream.write(p->sar_chn, 4); + stream << "\"\n\t ntab \""; stream.write(p->ntab, 8); + stream << "\"\n\t ltab \""; stream.write(p->ltab, 8); + stream << "\"\n\t htab[0] (only one sdr_htab_rec declared in data struct):"; + stream << "\n\t hist_desc \""; + stream.write(p->htab.hist_desc, 32); + stream << "\"\n\t nrec \""; stream.write(p->htab.nrec, 4); + stream << "\"\n\t tab_seq \""; stream.write(p->htab.tab_seq, 4); + stream << "\"\n\t nbin \""; stream.write(p->htab.nbin, 8); + stream << "\"\n\t ns_lin \""; stream.write(p->htab.ns_lin, 8); + stream << "\"\n\t ns_pix \""; stream.write(p->htab.ns_pix, 8); + stream << "\"\n\t ngrp_lin \""; stream.write(p->htab.ngrp_lin, 8); + stream << "\"\n\t ngrp_pix \""; stream.write(p->htab.ngrp_pix, 8); + stream << "\"\n\t nsamp_lin \""; stream.write(p->htab.nsamp_lin,8); + stream << "\"\n\t nsamp_pix \""; stream.write(p->htab.nsamp_pix,8); + stream << "\"\n\t min_smp \""; stream.write(p->htab.min_smp, 16); + stream << "\"\n\t max_smp \""; stream.write(p->htab.max_smp, 16); + stream << "\"\n\t mean_smp \""; stream.write(p->htab.mean_smp,16); + stream << "\"\n\t std_smp \""; stream.write(p->htab.std_smp, 16); + stream << "\"\n\t smp_inc \""; stream.write(p->htab.smp_inc, 16); + stream << "\"\n\t min_hist \""; stream.write(p->htab.min_hist,16); + stream << "\"\n\t max_hist \""; stream.write(p->htab.max_hist,16); + stream << "\"\n\t mean_hist \""; + stream.write(p->htab.mean_hist, 16); + stream << "\"\n\t std_hist \""; stream.write(p->htab.std_hist,16); + stream << "\"\n\t nhist \""; stream.write(p->htab.nhist, 16); + stream << "\"\n\t [Use debugger to view histogram]"; + stream << endl; +} + +//****************************************************************************** +// PRIVATE METHOD: ossimCeosData::dumpProcParmRec() +// +//****************************************************************************** +void ossimCeosData::dumpProcParmRec(ostream& stream) const +{ + const proc_parm_rec* p = theProcParmRec; + + stream << "\n\n\tContents of proc_parm_rec:\n\t"; + stream << "\n\t slow_time_coef[1] \""; + stream.write(p->slow_time_coef[1], 22); + stream << "\"\n\t rec_seq \""; stream.write(p->rec_seq, 4); + stream << "\"\n\t spare1 \""; stream.write(p->spare1, 4); + stream << "\"\n\t inp_media \""; stream.write(p->inp_media, 3); + stream << "\"\n\t n_tape_id \""; stream.write(p->n_tape_id, 4); + stream << "\"\n\t tape_id[0] \""; stream.write(p->tape_id[0], 8); + stream << "\"\n\t exp_ing_start \""; stream.write(p->exp_ing_start,21); + stream << "\"\n\t exp_ing_stop \""; stream.write(p->exp_ing_stop, 21); + stream << "\"\n\t act_ing_start \""; stream.write(p->act_ing_start,21); + stream << "\"\n\t act_ing_stop \""; stream.write(p->act_ing_stop, 21); + stream << "\"\n\t proc_start \""; stream.write(p->proc_start, 21); + stream << "\"\n\t proc_stop \""; stream.write(p->proc_stop, 21); + stream << "\"\n\t mn_sig_lev[0] \""; stream.write(p->mn_sig_lev[0],16); + stream << "\"\n\t mn_sig_lev[1] \""; stream.write(p->mn_sig_lev[1],16); + stream << "\"\n\t mn_sig_lev[2] \""; stream.write(p->mn_sig_lev[2],16); + stream << "\"\n\t mn_sig_lev[3] \""; stream.write(p->mn_sig_lev[3],16); + stream << "\"\n\t mn_sig_lev[4] \""; stream.write(p->mn_sig_lev[4],16); + stream << "\"\n\t mn_sig_lev[5] \""; stream.write(p->mn_sig_lev[5],16); + stream << "\"\n\t mn_sig_lev[6] \""; stream.write(p->mn_sig_lev[6],16); + stream << "\"\n\t mn_sig_lev[7] \""; stream.write(p->mn_sig_lev[7],16); + stream << "\"\n\t mn_sig_lev[8] \""; stream.write(p->mn_sig_lev[8],16); + stream << "\"\n\t mn_sig_lev[9] \""; stream.write(p->mn_sig_lev[9],16); + stream << "\"\n\t scr_data_ind \""; stream.write(p->scr_data_ind, 4); + stream << "\"\n\t miss_ln \""; stream.write(p->miss_ln, 8); + stream << "\"\n\t rej_ln \""; stream.write(p->rej_ln, 8); + stream << "\"\n\t large_gap \""; stream.write(p->large_gap, 8); + stream << "\"\n\t bit_err_rate \""; stream.write(p->bit_err_rate, 16); + stream << "\"\n\t fm_crc_err \""; stream.write(p->fm_crc_err, 16); + stream << "\"\n\t date_incons \""; stream.write(p->date_incons, 8); + stream << "\"\n\t prf_changes \""; stream.write(p->prf_changes, 8); + stream << "\"\n\t delay_changes \""; stream.write(p->delay_changes, 8); + stream << "\"\n\t skipd_frams \""; stream.write(p->skipd_frams, 8); + stream << "\"\n\t rej_bf_start \""; stream.write(p->rej_bf_start, 8); + stream << "\"\n\t rej_few_fram \""; stream.write(p->rej_few_fram, 8); + stream << "\"\n\t rej_many_fram \""; stream.write(p->rej_many_fram, 8); + stream << "\"\n\t rej_mchn_err \""; stream.write(p->rej_mchn_err, 8); + stream << "\"\n\t rej_vchn_err \""; stream.write(p->rej_vchn_err, 8); + stream << "\"\n\t rej_rec_type \""; stream.write(p->rej_rec_type, 8); + stream << "\"\n\t sens_config \""; stream.write(p->sens_config, 10); + stream << "\"\n\t sens_orient \""; stream.write(p->sens_orient, 9); + stream << "\"\n\t sych_marker \""; stream.write(p->sych_marker, 8); + stream << "\"\n\t rng_ref_src \""; stream.write(p->rng_ref_src, 12); + stream << "\"\n\t rng_amp_coef[0] \""; + stream.write(p->rng_amp_coef[0],16); + stream << "\"\n\t rng_amp_coef[1] \""; + stream.write(p->rng_amp_coef[1],16); + stream << "\"\n\t rng_amp_coef[2] \""; + stream.write(p->rng_amp_coef[2],16); + stream << "\"\n\t rng_amp_coef[3] \""; + stream.write(p->rng_amp_coef[3],16); + stream << "\"\n\t rng_phas_coef[0] \""; + stream.write(p->rng_phas_coef[0], 16); + stream << "\"\n\t rng_phas_coef[1] \""; + stream.write(p->rng_phas_coef[1], 16); + stream << "\"\n\t rng_phas_coef[2] \""; + stream.write(p->rng_phas_coef[2], 16); + stream << "\"\n\t rng_phas_coef[3] \""; + stream.write(p->rng_phas_coef[3], 16); + stream << "\"\n\t err_amp_coef[0] \""; + stream.write(p->err_amp_coef[0],16); + stream << "\"\n\t err_amp_coef[1] \""; + stream.write(p->err_amp_coef[1],16); + stream << "\"\n\t err_amp_coef[2] \""; + stream.write(p->err_amp_coef[2],16); + stream << "\"\n\t err_amp_coef[3] \""; + stream.write(p->err_amp_coef[3],16); + stream << "\"\n\t err_phas_coef[0] \""; + stream.write(p->err_phas_coef[0], 16); + stream << "\"\n\t err_phas_coef[1] \""; + stream.write(p->err_phas_coef[1], 16); + stream << "\"\n\t err_phas_coef[2] \""; + stream.write(p->err_phas_coef[2], 16); + stream << "\"\n\t err_phas_coef[3] \""; + stream.write(p->err_phas_coef[3], 16); + stream << "\"\n\t pulse_bandw \""; stream.write(p->pulse_bandw, 4); + stream << "\"\n\t adc_samp_rate \""; stream.write(p->adc_samp_rate, 5); + stream << "\"\n\t rep_agc_attn \""; stream.write(p->rep_agc_attn, 16); + stream << "\"\n\t gn_corctn_fctr \""; + stream.write(p->gn_corctn_fctr, 16); + stream << "\"\n\t rep_energy_gn \""; stream.write(p->rep_energy_gn,16); + stream << "\"\n\t orb_data_src \""; stream.write(p->orb_data_src, 11); + stream << "\"\n\t pulse_cnt_1 \""; stream.write(p->pulse_cnt_1, 4); + stream << "\"\n\t pulse_cnt_2 \""; stream.write(p->pulse_cnt_2, 4); + stream << "\"\n\t beam_edge_rqd \""; stream.write(p->beam_edge_rqd, 3); + stream << "\"\n\t beam_edge_conf \""; + stream.write(p->beam_edge_conf, 16); + stream << "\"\n\t pix_overlap \""; stream.write(p->pix_overlap, 4); + stream << "\"\n\t n_beams \""; stream.write(p->n_beams, 4); + stream << "\"\n\t [Use debugger to view contents of beam_info record] "; + stream << "\n\t n_pix_updates \""; stream.write(p->n_pix_updates, 4); + stream << "\"\n\t [Use debugger to view contents of pix_count record] "; + stream << "\n\t pwin_start \""; stream.write(p->pwin_start, 16); + stream << "\"\n\t pwin_end \""; stream.write(p->pwin_end, 16); + stream << "\"\n\t recd_type \""; stream.write(p->recd_type, 9); + stream << "\"\n\t temp_set_inc \""; stream.write(p->temp_set_inc, 16); + stream << "\"\n\t n_temp_set \""; stream.write(p->n_temp_set, 4); + stream << "\"\n\t [Use debugger to view contents of temp record] "; + stream << "\n\t n_image_pix \""; stream.write(p->n_image_pix, 8); + stream << "\"\n\t prc_zero_pix \""; stream.write(p->prc_zero_pix, 16); + stream << "\"\n\t prc_satur_pix \""; stream.write(p->prc_satur_pix,16); + stream << "\"\n\t img_hist_mean \""; stream.write(p->img_hist_mean,16); + stream << "\"\n\t img_cumu_dist[0] \""; + stream.write(p->img_cumu_dist[0], 16); + stream << "\"\n\t img_cumu_dist[1] \""; + stream.write(p->img_cumu_dist[1], 16); + stream << "\"\n\t img_cumu_dist[2] \""; + stream.write(p->img_cumu_dist[2], 16); + stream << "\"\n\t pre_img_gn \""; stream.write(p->pre_img_gn, 16); + stream << "\"\n\t post_img_gn \""; stream.write(p->post_img_gn, 16); + stream << "\"\n\t dopcen_inc \""; stream.write(p->dopcen_inc, 16); + stream << "\"\n\t n_dopcen \""; stream.write(p->n_dopcen, 4); + stream << "\"\n\t [Use debugger to view contents of dopcen_est record] "; + stream << "\n\t dop_amb_err \""; stream.write(p->dop_amb_err, 4); + stream << "\"\n\t dopamb_conf \""; stream.write(p->dopamb_conf, 16); + stream << "\"\n\t eph_orb_data[0] \""; + stream.write(p->eph_orb_data[0],16); + stream << "\"\n\t eph_orb_data[1] \""; + stream.write(p->eph_orb_data[1],16); + stream << "\"\n\t eph_orb_data[2] \""; + stream.write(p->eph_orb_data[2],16); + stream << "\"\n\t eph_orb_data[3] \""; + stream.write(p->eph_orb_data[3],16); + stream << "\"\n\t eph_orb_data[4] \""; + stream.write(p->eph_orb_data[4],16); + stream << "\"\n\t eph_orb_data[5] \""; + stream.write(p->eph_orb_data[5],16); + stream << "\"\n\t eph_orb_data[6] \""; + stream.write(p->eph_orb_data[6],16); + stream << "\"\n\t appl_type \""; stream.write(p->appl_type, 12); + stream << "\"\n\t slow_time_coef[1] \""; + stream.write(p->slow_time_coef[1], 22); + stream << "\"\n\t slow_time_coef[2] \""; + stream.write(p->slow_time_coef[2], 22); + stream << "\"\n\t slow_time_coef[3] \""; + stream.write(p->slow_time_coef[3], 22); + stream << "\"\n\t slow_time_coef[4] \""; + stream.write(p->slow_time_coef[4], 22); + stream << "\"\n\t n_srgr \""; stream.write(p->n_srgr, 4); + stream << "\"\n\t [Use debugger to view contents of srgr_coefset record]"; + stream << "\n\t pixel_spacing \""; stream.write(p->pixel_spacing,16); + stream << "\"\n\t gics_reqd \""; stream.write(p->gics_reqd, 3); + stream << "\"\n\t wo_number \""; stream.write(p->wo_number, 8); + stream << "\"\n\t wo_date \""; stream.write(p->wo_date, 20); + stream << "\"\n\t satellite_id \""; stream.write(p->satellite_id, 10); + stream << "\"\n\t user_id \""; stream.write(p->user_id, 20); + stream << "\"\n\t complete_msg \""; stream.write(p->complete_msg, 3); + stream << "\"\n\t scene_id \""; stream.write(p->scene_id, 5); + stream << "\"\n\t density_in \""; stream.write(p->density_in, 4); + stream << "\"\n\t media_id \""; stream.write(p->media_id, 8); + stream << "\"\n\t angle_first \""; stream.write(p->angle_first, 16); + stream << "\"\n\t angle_last \""; stream.write(p->angle_last, 16); + stream << "\"\n\t prod_type \""; stream.write(p->prod_type, 3); + stream << "\"\n\t map_system \""; stream.write(p->map_system, 16); + stream << "\"\n\t centre_lat \""; stream.write(p->centre_lat, 22); + stream << "\"\n\t centre_long \""; stream.write(p->centre_long, 22); + stream << "\"\n\t span_x \""; stream.write(p->span_x, 22); + stream << "\"\n\t span_y \""; stream.write(p->span_y, 22); + stream << "\"\n\t apply_dtm \""; stream.write(p->apply_dtm, 3); + stream << "\"\n\t density_out \""; stream.write(p->density_out, 4); + stream << "\"\n\t state_time \""; stream.write(p->state_time, 21); + stream << "\"\n\t num_state_vectors \""; + stream.write(p->num_state_vectors, 4); + stream << "\"\n\t state_time_inc \""; + stream.write(p->state_time_inc, 16); + stream << "\"" << endl; +} + +//****************************************************************************** +// PRIVATE METHOD: ossimCeosData::dumpMapProjRec() +// +//****************************************************************************** +void ossimCeosData::dumpMapProjRec(ostream& stream) const +{ + const map_proj_rec* p = theMapProjRec; + + stream << "\n\n\tContents of map_proj_rec:\n\t"; + stream << "\n\t spare1 \""; stream.write(p->spare1, 16); + stream << "\"\n\t map_desc \""; stream.write(p->map_desc, 32); + stream << "\"\n\t n_pixel \""; stream.write(p->n_pixel, 16); + stream << "\"\n\t n_line \""; stream.write(p->n_line, 16); + stream << "\"\n\t pixel_spacing \""; stream.write(p->pixel_spacing,16); + stream << "\"\n\t line_spacing \""; stream.write(p->line_spacing, 16); + stream << "\"\n\t osc_orient \""; stream.write(p->osc_orient, 16); + stream << "\"\n\t orb_incl \""; stream.write(p->orb_incl, 16); + stream << "\"\n\t asc_node \""; stream.write(p->asc_node, 16); + stream << "\"\n\t isc_dist \""; stream.write(p->isc_dist, 16); + stream << "\"\n\t geo_alt \""; stream.write(p->geo_alt, 16); + stream << "\"\n\t isc_vel \""; stream.write(p->isc_vel, 16); + stream << "\"\n\t plat_head \""; stream.write(p->plat_head, 16); + stream << "\"\n\t ref_ellip \""; stream.write(p->ref_ellip, 32); + stream << "\"\n\t semi_major \""; stream.write(p->semi_major, 16); + stream << "\"\n\t semi_minor \""; stream.write(p->semi_minor, 16); + stream << "\"\n\t datum_shift[0] \""; + stream.write(p->datum_shift[0], 16); + stream << "\"\n\t datum_shift[1] \""; + stream.write(p->datum_shift[1], 16); + stream << "\"\n\t datum_shift[2] \""; + stream.write(p->datum_shift[2], 16); + stream << "\"\n\t aux_datum_shift[0] \""; + stream.write(p->aux_datum_shift[0], 16); + stream << "\"\n\t aux_datum_shift[1] \""; + stream.write(p->aux_datum_shift[1], 16); + stream << "\"\n\t aux_datum_shift[2] \""; + stream.write(p->aux_datum_shift[2], 16); + stream << "\"\n\t scal_ellip \""; stream.write(p->scal_ellip, 16); + stream << "\"\n\t proj_desc \""; stream.write(p->proj_desc, 32); + stream << "\"\n\t utm_desc \""; stream.write(p->utm_desc, 32); + stream << "\"\n\t utm_zone_sig \""; stream.write(p->utm_zone_sig, 4); + stream << "\"\n\t utm_east_orig \""; stream.write(p->utm_east_orig,16); + stream << "\"\n\t utm_north_orig \""; + stream.write(p->utm_north_orig, 16); + stream << "\"\n\t utm_cent_long \""; stream.write(p->utm_cent_long,16); + stream << "\"\n\t utm_cent_lat \""; stream.write(p->utm_cent_lat, 16); + stream << "\"\n\t utm_stand_par[0] \""; + stream.write(p->utm_stand_par[0], 16); + stream << "\"\n\t utm_stand_par[1] \""; + stream.write(p->utm_stand_par[1], 16); + stream << "\"\n\t utm_scale \""; stream.write(p->utm_scale, 16); + stream << "\"\n\t ups_desc \""; stream.write(p->ups_desc, 32); + stream << "\"\n\t ups_cent_long \""; stream.write(p->ups_cent_long,16); + stream << "\"\n\t ups_cent_lat \""; stream.write(p->ups_cent_lat, 16); + stream << "\"\n\t ups_scale \""; stream.write(p->ups_scale, 16); + stream << "\"\n\t nsp_desc \""; stream.write(p->nsp_desc, 32); + stream << "\"\n\t nsp_east_orig \""; stream.write(p->nsp_east_orig,16); + stream << "\"\n\t nsp_north_orig \""; + stream.write(p->nsp_north_orig,16); + stream << "\"\n\t nsp_cent_long \""; stream.write(p->nsp_cent_long,16); + stream << "\"\n\t nsp_cent_lat \""; stream.write(p->nsp_cent_lat, 16); + stream << "\"\n\t nsp_stand_par[0] \""; + stream.write(p->nsp_stand_par[0], 16); + stream << "\"\n\t nsp_stand_par[1] \""; + stream.write(p->nsp_stand_par[1], 16); + stream << "\"\n\t nsp_stand_par[2] \""; + stream.write(p->nsp_stand_par[2], 16); + stream << "\"\n\t nsp_stand_par[3] \""; + stream.write(p->nsp_stand_par[3], 16); + stream << "\"\n\t nsp_stand_mer[0] \""; + stream.write(p->nsp_stand_mer[0], 16); + stream << "\"\n\t nsp_stand_mer[1] \""; + stream.write(p->nsp_stand_mer[1], 16); + stream << "\"\n\t nsp_stand_mer[2] \""; + stream.write(p->nsp_stand_mer[2], 16); + stream << "\"\n\t nsp_spare[0] \""; stream.write(p->nsp_spare[0], 16); + stream << "\"\n\t nsp_spare[1] \""; stream.write(p->nsp_spare[1], 16); + stream << "\"\n\t nsp_spare[2] \""; stream.write(p->nsp_spare[2], 16); + stream << "\"\n\t nsp_spare[3] \""; stream.write(p->nsp_spare[3], 16); + stream << "\"\n\t corner_ne[0] \""; stream.write(p->corner_ne[0], 16); + stream << "\"\n\t corner_ne[1] \""; stream.write(p->corner_ne[1], 16); + stream << "\"\n\t corner_ne[2] \""; stream.write(p->corner_ne[2], 16); + stream << "\"\n\t corner_ne[3] \""; stream.write(p->corner_ne[3], 16); + stream << "\"\n\t corner_ne[4] \""; stream.write(p->corner_ne[4], 16); + stream << "\"\n\t corner_ne[5] \""; stream.write(p->corner_ne[5], 16); + stream << "\"\n\t corner_ne[6] \""; stream.write(p->corner_ne[6], 16); + stream << "\"\n\t corner_ne[7] \""; stream.write(p->corner_ne[7], 16); + stream << "\"\n\t corner_ll[0] \""; stream.write(p->corner_ll[0], 16); + stream << "\"\n\t corner_ll[1] \""; stream.write(p->corner_ll[1], 16); + stream << "\"\n\t corner_ll[2] \""; stream.write(p->corner_ll[2], 16); + stream << "\"\n\t corner_ll[3] \""; stream.write(p->corner_ll[3], 16); + stream << "\"\n\t corner_ll[4] \""; stream.write(p->corner_ll[4], 16); + stream << "\"\n\t corner_ll[5] \""; stream.write(p->corner_ll[5], 16); + stream << "\"\n\t corner_ll[6] \""; stream.write(p->corner_ll[6], 16); + stream << "\"\n\t corner_ll[7] \""; stream.write(p->corner_ll[7], 16); + stream << "\"\n\t terr_height[0] \""; + stream.write(p->terr_height[0], 16); + stream << "\"\n\t terr_height[1] \""; + stream.write(p->terr_height[1], 16); + stream << "\"\n\t terr_height[2] \""; + stream.write(p->terr_height[2], 16); + stream << "\"\n\t terr_height[3] \""; + stream.write(p->terr_height[3], 16); + stream << "\"\n\t lp_conv_coef[0] \""; + stream.write(p->lp_conv_coef[0],20); + stream << "\"\n\t lp_conv_coef[1] \""; + stream.write(p->lp_conv_coef[1],20); + stream << "\"\n\t lp_conv_coef[2] \""; + stream.write(p->lp_conv_coef[2],20); + stream << "\"\n\t lp_conv_coef[3] \""; + stream.write(p->lp_conv_coef[3],20); + stream << "\"\n\t lp_conv_coef[4] \""; + stream.write(p->lp_conv_coef[4],20); + stream << "\"\n\t lp_conv_coef[5] \""; + stream.write(p->lp_conv_coef[5],20); + stream << "\"\n\t lp_conv_coef[6] \""; + stream.write(p->lp_conv_coef[6],20); + stream << "\"\n\t lp_conv_coef[7] \""; + stream.write(p->lp_conv_coef[7],20); + stream << "\"\n\t mp_conv_coef[0] \""; + stream.write(p->mp_conv_coef[0],20); + stream << "\"\n\t mp_conv_coef[1] \""; + stream.write(p->mp_conv_coef[1],20); + stream << "\"\n\t mp_conv_coef[2] \""; + stream.write(p->mp_conv_coef[2],20); + stream << "\"\n\t mp_conv_coef[3] \""; + stream.write(p->mp_conv_coef[3],20); + stream << "\"\n\t mp_conv_coef[4] \""; + stream.write(p->mp_conv_coef[4],20); + stream << "\"\n\t mp_conv_coef[5] \""; + stream.write(p->mp_conv_coef[5],20); + stream << "\"\n\t mp_conv_coef[6] \""; + stream.write(p->mp_conv_coef[6],20); + stream << "\"\n\t mp_conv_coef[7] \""; + stream.write(p->mp_conv_coef[7],20); + stream << "\"\n\t dem_type \""; stream.write(p->dem_type, 4); + stream << "\"\n\t spare3 \""; stream.write(p->spare3, 32); + stream << "\"" << endl; +} + +//****************************************************************************** +// PRIVATE METHOD: ossimCeosData::dumpPosDataRec() +// +//****************************************************************************** +void ossimCeosData::dumpPosDataRec(ostream& stream) const +{ + const pos_data_rec* p = thePosDataRec; + + stream << "\n\n\tContents of pos_data_rec:\n\t"; + stream << "\n\t orbit_ele_desg \""; stream.write(p->orbit_ele_desg, 32); + stream << "\"\n\t orbit_ele[0] \""; stream.write(p->orbit_ele[0], 16); + stream << "\"\n\t orbit_ele[1] \""; stream.write(p->orbit_ele[1], 16); + stream << "\"\n\t orbit_ele[2] \""; stream.write(p->orbit_ele[2], 16); + stream << "\"\n\t orbit_ele[3] \""; stream.write(p->orbit_ele[3], 16); + stream << "\"\n\t orbit_ele[4] \""; stream.write(p->orbit_ele[4], 16); + stream << "\"\n\t orbit_ele[5] \""; stream.write(p->orbit_ele[5], 16); + stream << "\"\n\t ndata \""; stream.write(p->ndata, 4); + stream << "\"\n\t year \""; stream.write(p->year, 4); + stream << "\"\n\t month \""; stream.write(p->month, 4); + stream << "\"\n\t day \""; stream.write(p->day, 4); + stream << "\"\n\t gmt_day \""; stream.write(p->gmt_day, 4); + stream << "\"\n\t gmt_sec \""; stream.write(p->gmt_sec, 22); + stream << "\"\n\t data_int \""; stream.write(p->data_int, 22); + stream << "\"\n\t ref_coord \""; stream.write(p->ref_coord, 64); + stream << "\"\n\t hr_angle \""; stream.write(p->hr_angle, 22); + stream << "\"\n\t alt_poserr \""; stream.write(p->alt_poserr, 16); + stream << "\"\n\t crt_poserr \""; stream.write(p->crt_poserr, 16); + stream << "\"\n\t rad_poserr \""; stream.write(p->rad_poserr, 16); + stream << "\"\n\t alt_velerr \""; stream.write(p->alt_velerr, 16); + stream << "\"\n\t crt_velerr \""; stream.write(p->crt_velerr, 16); + stream << "\"\n\t rad_velerr \""; stream.write(p->rad_velerr, 16); + stream << "\"\n\t [Use debugger to view contents of pos_vect record]"; + stream << endl; +} + +//****************************************************************************** +// PRIVATE METHOD: ossimCeosData::dumpAttDataRec() +// +//****************************************************************************** +void ossimCeosData::dumpAttDataRec(ostream& stream) const +{ + const att_data_rec* p = theAttDataRec; + + stream << "\n\n\tContents of att_data_rec:\n\t"; + stream << "\n\t npoint \""; stream.write(p->npoint, 4); + stream << "\"\n\t [Use debugger to view contents of att_vect record]"; + stream << "\n\t pitch_bias \""; stream.write(p->pitch_bias, 14); + stream << "\"\n\t roll_bias \""; stream.write(p->roll_bias, 14); + stream << "\"\n\t yaw_bias \""; stream.write(p->yaw_bias, 14); + stream << "\"" << endl; +} + +//****************************************************************************** +// PRIVATE METHOD: ossimCeosData::dumpRadiDataRec() +// +//****************************************************************************** +void ossimCeosData::dumpRadiDataRec(ostream& stream) const +{ + const radi_data_rec* p = theRadiDataRec; + + stream << "\n\n\tContents of radi_data_rec:\n\t"; + stream << "\n\t seq_num \""; stream.write(p->seq_num, 4); + stream << "\"\n\t n_data \""; stream.write(p->n_data, 4); + stream << "\"\n\t field_size \""; stream.write(p->field_size, 8); + stream << "\"\n\t [Use debugger to view contents of dset record]"; + stream << endl; +} + +//****************************************************************************** +// PRIVATE METHOD: ossimCeosData::dumpRadiCompRec() +// +//****************************************************************************** +void ossimCeosData::dumpRadiCompRec(ostream& stream) const +{ + const radi_comp_rec* p = theRadiCompRec; + + stream << "\n\n\tContents of radi_comp_rec:\n\t"; + stream << "\n\t seq_num \""; stream.write(p->seq_num, 4); + stream << "\"\n\t chan_ind \""; stream.write(p->chan_ind, 4); + stream << "\"\n\t n_dset \""; stream.write(p->n_dset, 8); + stream << "\"\n\t dset_size \""; stream.write(p->dset_size, 8); + stream << "\"\n\t [Use debugger to view contents of dset record]"; + stream << endl; +} + + +//***************************************************************************** +// PRIVATE METHOD: ossimCeosData::loadCeosRecords() +// +// Reads the data files and initializes the data members. +// +//***************************************************************************** +void ossimCeosData::loadCeosRecords() +{ + static const char MODULE[] = "ossimCeosData::loadCeosFile()"; + if (traceExec()) CLOG << " Entered method." << endl; + + int sizeOfRec; + char bufI6[] = "123456"; + int numRecords; + + //*** + // Open Volume Directory File and parse: + //*** + FILE* fptr = fopen(theVolDirFileName.chars(), "r"); + if (!fptr) + { + CLOG << " ERROR:\n\tCannot open CEOS Volume Directory file: " + << theVolDirFileName << endl; + theErrorStatus = ERROR; + return; + } + sizeOfRec = sizeof(theVolumeDirectory); + fread(&theVolumeDirectory, sizeOfRec, 1, fptr); + fclose(fptr); + theVolDescRec = &theVolumeDirectory.volDescRec; + theTextRec = &theVolumeDirectory.textRec; + + if (traceDebug()) + { + CLOG << "DEBUG\n -- List of Records Present ---" << endl; + } + + //*** + // Open and parse Leader File: + //*** + if (!theLeaderFileName.empty()) + { + fptr = fopen(theLeaderFileName.chars(), "r"); + if (!fptr) + { + CLOG << " ERROR:\n\tCannot open CEOS Leader file: " + << theLeaderFileName << endl; + theErrorStatus = ERROR; + return; + } + fread(&(theSarLeaderFile.sarDescRec), 720, 1, fptr); + + //*** + // Establish which CEOS records are in the leader file, and read them. + // First the dataset summary record: + //*** + strncpy(bufI6, theSarLeaderFile.sarDescRec.n_dataset, 6); + numRecords = atoi(bufI6); + if (numRecords) + { + fread(&theSarLeaderFile.dataSetSumRec, sizeOfNextRec(fptr), 1, fptr); + theDataSetSumRec = &(theSarLeaderFile.dataSetSumRec); + if (traceDebug()) clog << "\t Leader: dataSetSumRec" << endl; + } + + //*** + // Data quality summary record: + //*** + strncpy(bufI6, theSarLeaderFile.sarDescRec.n_qual_sum, 6); + numRecords = atoi(bufI6); + if (numRecords) + { + fread(&(theSarLeaderFile.qualSumRec), sizeOfNextRec(fptr), 1, fptr); + theQualSumRec = &(theSarLeaderFile.qualSumRec); + if (traceDebug()) clog << "\t Leader: qualSumRec" << endl; + } + + //*** + // Histogram records: + //*** + strncpy(bufI6, theSarLeaderFile.sarDescRec.n_data_hist, 6); + numRecords = atoi(bufI6); + if (numRecords) + { + fread(&(theSarLeaderFile.sdrHistRec), sizeOfNextRec(fptr), 1, fptr); + theSdrHistRec = &(theSarLeaderFile.sdrHistRec); + fread(&(theSarLeaderFile.pdr16HistRec), sizeOfNextRec(fptr), 1, fptr); + thePdr16HistRec = &(theSarLeaderFile.pdr16HistRec); + if (traceDebug()) clog << "\t Leader: sdrHistRec & pdr16HistRec" + << endl; + } + + //*** + // Processing parameter record: + //*** + strncpy(bufI6, theSarLeaderFile.sarDescRec.n_det_proc, 6); + numRecords = atoi(bufI6); + if (numRecords) + { + fread(&(theSarLeaderFile.procParmRec), sizeOfNextRec(fptr), 1, fptr); + theProcParmRec = &(theSarLeaderFile.procParmRec); + if (traceDebug()) clog << "\t Leader: procParmRec" << endl; + } + + //*** + // Map projection record: + //*** + strncpy(bufI6, theSarLeaderFile.sarDescRec.n_map_proj, 6); + numRecords = atoi(bufI6); + if (numRecords) + { + fread(&(theSarLeaderFile.mapProjRec), sizeOfNextRec(fptr), 1, fptr); + theMapProjRec = &(theSarLeaderFile.mapProjRec); + if (traceDebug()) clog << "\t Leader: mapProjRec" << endl; + } + + //*** + // Position data record: + //*** + strncpy(bufI6, theSarLeaderFile.sarDescRec.n_plat_pos, 6); + numRecords = atoi(bufI6); + if (numRecords) + { + fread(&(theSarLeaderFile.posDataRec), sizeOfNextRec(fptr), 1, fptr); + thePosDataRec = &(theSarLeaderFile.posDataRec); + if (traceDebug()) clog << "\t Leader: posDataRec" << endl; + } + + //*** + // Attitude data record: + //*** + strncpy(bufI6, theSarLeaderFile.sarDescRec.n_att_data, 6); + numRecords = atoi(bufI6); + if (numRecords) + { + fread(&(theSarLeaderFile.attDataRec), sizeOfNextRec(fptr), 1, fptr); + theAttDataRec = &(theSarLeaderFile.attDataRec); + if (traceDebug()) clog << "\t Leader: attDataRec" << endl; + } + + //*** + // Radiometric data record: + //*** + strncpy(bufI6, theSarLeaderFile.sarDescRec.n_radi_data, 6); + numRecords = atoi(bufI6); + if (numRecords) + { + fread(&(theSarLeaderFile.radiDataRec), sizeOfNextRec(fptr), 1, fptr); + theRadiDataRec = &(theSarLeaderFile.radiDataRec); + if (traceDebug()) clog << "\t Leader: radiDataRec" << endl; + } + + //*** + // Radiometric compensation data record: + //*** + strncpy(bufI6, theSarLeaderFile.sarDescRec.n_radi_comp, 6); + numRecords = atoi(bufI6); + if (numRecords) + { + fread(&(theSarLeaderFile.radiCompRec), sizeOfNextRec(fptr), 1, fptr); + theRadiCompRec = &(theSarLeaderFile.radiCompRec); + if (traceDebug()) clog << "\t Leader: radiCompRec" << endl; + } + + fclose(fptr); + } + + //*** + // Open and parse CEOS SAR data File to read the image options: + //*** + fptr = fopen(theImageFileName.chars(), "r"); + if (!fptr) + { + CLOG << " ERROR:\n\tCannot open CEOS image file: " << theImageFileName + << endl; + theErrorStatus = ERROR; + return; + } + sizeOfRec = sizeof(theImopDescRec); + fread(&theImopDescRec, sizeOfRec, 1, fptr); + fclose(fptr); + + //*** + // Open and parse trailer file: + //*** + if (!theTrailerFileName.empty()) + { + fptr = fopen(theTrailerFileName.chars(), "r"); + if (!fptr) + { + CLOG << " ERROR:\n\tCannot open CEOS Trailer file: " + << theTrailerFileName << endl; + theErrorStatus = ERROR; + return; + } + fread(&(theSarTrailerFile.sarDescRec), 720, 1, fptr); + + //*** + // Establish which CEOS records are in the Trailer file, and read them. + // First the dataset summary record: + //*** + strncpy(bufI6, theSarTrailerFile.sarDescRec.n_dataset, 6); + numRecords = atoi(bufI6); + if (numRecords) + { + fread(&(theSarTrailerFile.dataSetSumRec), sizeOfNextRec(fptr),1, fptr); + theDataSetSumRec = &(theSarTrailerFile.dataSetSumRec); + if (traceDebug()) clog << "\t Trailer: dataSetSumRec" << endl; + } + + //*** + // Data quality summary record: + //*** + strncpy(bufI6, theSarTrailerFile.sarDescRec.n_qual_sum, 6); + numRecords = atoi(bufI6); + if (numRecords) + { + fread(&(theSarTrailerFile.qualSumRec), sizeOfNextRec(fptr), 1, fptr); + theQualSumRec = &(theSarTrailerFile.qualSumRec); + if (traceDebug()) clog << "\t Trailer: qualSumRec" << endl; + } + + //*** + // Histogram records: + //*** + strncpy(bufI6, theSarTrailerFile.sarDescRec.n_data_hist, 6); + numRecords = atoi(bufI6); + if (numRecords) + { + fread(&(theSarTrailerFile.sdrHistRec), sizeOfNextRec(fptr), 1, fptr); + theSdrHistRec = &(theSarTrailerFile.sdrHistRec); + fread(&(theSarTrailerFile.pdr8HistRec), 16920, 1, fptr); + thePdr8HistRec = &(theSarTrailerFile.pdr8HistRec); + if (traceDebug()) clog << "\t Trailer: sdrHistRec & pdr8HistRec" + << endl; + } + + //*** + // Processing parameter record: + //*** + strncpy(bufI6, theSarTrailerFile.sarDescRec.n_det_proc, 6); + numRecords = atoi(bufI6); + if (numRecords) + { + fread(&(theSarTrailerFile.procParmRec), sizeOfNextRec(fptr), 1, fptr); + theProcParmRec = &(theSarTrailerFile.procParmRec); + if (traceDebug()) clog << "\t Trailer: procParmRec" << endl; + } + + //*** + // Attitude data record: + //*** + strncpy(bufI6, theSarTrailerFile.sarDescRec.n_att_data, 6); + numRecords = atoi(bufI6); + if (numRecords) + { + fread(&(theSarTrailerFile.attDataRec), sizeOfNextRec(fptr), 1, fptr); + theAttDataRec = &(theSarTrailerFile.attDataRec); + if (traceDebug()) clog << "\t Trailer: attDataRec" << endl; + } + + //*** + // Radiometric data record: + //*** + strncpy(bufI6, theSarTrailerFile.sarDescRec.n_radi_data, 6); + numRecords = atoi(bufI6); + if (numRecords) + { + fread(&(theSarTrailerFile.radiDataRec), sizeOfNextRec(fptr), 1, fptr); + theRadiDataRec = &(theSarTrailerFile.radiDataRec); + if (traceDebug()) clog << "\t Trailer: radiDataRec" << endl; + } + + //*** + // Radiometric compensation data record: + //*** + strncpy(bufI6, theSarTrailerFile.sarDescRec.n_radi_comp, 6); + numRecords = atoi(bufI6); + if (numRecords) + { + fread(&(theSarTrailerFile.radiCompRec), sizeOfNextRec(fptr), 1, fptr); + theRadiCompRec = &(theSarTrailerFile.radiCompRec); + if (traceDebug()) clog << "\t Trailer: radiCompRec" << endl; + } + + fclose(fptr); + } + + if (traceExec()) CLOG << " Exiting method." << endl; +} + + +//****************************************************************************** +// PRIVATE METHOD: ossimCeosData::sizeOfNextRec(FILE*) +// +// Reads the descriptor record pointed to by the file ptr and returns the +// size of the following record in bytes. +// +//****************************************************************************** +int ossimCeosData::sizeOfNextRec(FILE* fptr) +{ + static const char MODULE[] = "ossimCeosData::sizeOfNextRec(FILE* fptr)"; + if (traceExec()) CLOG << "entering..." << endl; + + static desc_rec descRec; + static int DESC_REC_SIZE = 12; + + fread(&descRec, DESC_REC_SIZE, 1, fptr); + fseek(fptr, (long) -DESC_REC_SIZE, SEEK_CUR); + + if (traceDebug()) + { + CLOG << "DEBUG -- " + << "\n\t length = " << descRec.length << endl; + } + + if (traceExec()) CLOG << "returning..." << endl; + return descRec.length; +} diff --git a/Utilities/otbossim/src/ossim/version-config.cpp b/Utilities/otbossim/src/ossim/version-config.cpp index 9c5e5b6cf31d2fb6e6004f7e779f5fad0264ab3a..5f6c3e3169d6ef33c1e55fd5bcb77927190f3f1d 100644 --- a/Utilities/otbossim/src/ossim/version-config.cpp +++ b/Utilities/otbossim/src/ossim/version-config.cpp @@ -55,6 +55,7 @@ int main(int argc, char* argv[]) std::string releaseVersion = "0"; std::string::size_type pos1 = std::string::npos; std::string::size_type pos2 = std::string::npos; + std::string::size_type pos3 = std::string::npos; pos1 = versionNumber.find(".", 0); if(pos1 != std::string::npos)