Isis 3.0 Application Source Code Reference |
Home |
00001 #if !defined(Hillier_h) 00002 #define Hillier_h 00003 /** 00004 * @file 00005 * $Revision: 1.2 $ 00006 * $Date: 2010/02/24 09:54:18 $ 00007 * 00008 * Unless noted otherwise, the portions of Isis written by the USGS are 00009 * public domain. See individual third-party library and package descriptions 00010 * for intellectual property information, user agreements, and related 00011 * information. 00012 * 00013 * Although Isis has been used by the USGS, no warranty, expressed or 00014 * implied, is made by the USGS as to the accuracy and functioning of such 00015 * software and related material nor shall the fact of distribution 00016 * constitute any such warranty, and no responsibility is assumed by the 00017 * USGS in connection therewith. 00018 * 00019 * For additional information, launch 00020 * $ISISROOT/doc//documents/Disclaimers/Disclaimers.html 00021 * in a browser or see the Privacy & Disclaimers page on the Isis website, 00022 * http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on 00023 * http://www.usgs.gov/privacy.html. 00024 */ 00025 00026 #include <iostream> 00027 #include <sstream> 00028 #include <iomanip> 00029 00030 #include "iString.h" 00031 #include "Camera.h" 00032 #include "DbProfile.h" 00033 #include "SpecialPixel.h" 00034 00035 namespace Isis { 00036 00037 /** Implement templatized MIN fumnction */ 00038 template <typename T> inline T MIN(const T &A, const T &B) { 00039 if(A < B) { 00040 return (A); 00041 } 00042 else { 00043 return (B); 00044 } 00045 } 00046 00047 /** Implement templatized MAX function */ 00048 template <typename T> inline T MAX(const T &A, const T &B) { 00049 if(A > B) { 00050 return (A); 00051 } 00052 else { 00053 return (B); 00054 } 00055 } 00056 00057 00058 class PvlObject; 00059 class Camera; 00060 00061 /** 00062 * @brief An implementation of the Hillier photometric function 00063 * 00064 * This class implements the Hillier-Buratti-Hill photometric 00065 * equation as outline in thier paper "Multispectral Photometry 00066 * of the Moon and Absolute Calibration of the Clementine UV/VIS 00067 * Camera", published in Icaris v141, pg. 205-255 (1999). 00068 * 00069 * @author 2010-02-15 Kris Becker 00070 * 00071 * @internal 00072 * @history 2010-02-24 Kris Becker - Changed include paths by adding "naif" to NAIF 00073 * includes 00074 * 00075 */ 00076 class Hillier { 00077 public: 00078 /** 00079 * @brief Create Hilier photometric object 00080 * 00081 */ 00082 Hillier(PvlObject &pvl, Cube &cube); 00083 00084 //! Destructor 00085 virtual ~Hillier() {}; 00086 00087 void setCamera(Camera *cam) { 00088 _camera = cam; 00089 } 00090 double Compute(const double &line, const double &sample, int band = 1); 00091 double photometry(double i, double e, double g, int band = 1) const; 00092 void Report(PvlContainer &pvl); 00093 00094 private: 00095 /** 00096 * @brief Container for band photometric correction parameters 00097 * 00098 * @author Kris Becker - 2/21/2010 00099 */ 00100 struct Parameters { 00101 Parameters() : b0(0.0), b1(0.0), a0(0.0), a1(0.0), a2(0.0), a3(0.0), 00102 a4(0.0), wavelength(0.0), tolerance(0.0), 00103 units("Degrees"), phaUnit(1.0), band(0), phoStd(0.0), 00104 iProfile(-1) { } 00105 ~Parameters() { } 00106 bool IsValid() const { 00107 return (iProfile != -1); 00108 } 00109 double b0, b1, a0, a1, a2, a3, a4; //<! Hillier parameters 00110 double wavelength; //<! Wavelength for correction 00111 double tolerance; //<! Wavelenght Range/Tolerance 00112 iString units; //<! Phase units of Hiller eq. 00113 double phaUnit; // 1 for degrees, Pi/180 for radians 00114 int band; //<! Cube band parameters 00115 double phoStd; //<! Computed photometric std. 00116 int iProfile; //<! Profile index of this data 00117 }; 00118 00119 DbProfile _normProf; 00120 std::vector<DbProfile> _profiles; 00121 std::vector<Parameters> _bandpho; 00122 Camera *_camera; 00123 double _iRef; //!< Incidence refernce angle 00124 double _eRef; // Emission reference angle 00125 double _gRef; // Phase reference angle 00126 00127 double photometry(const Parameters &parms, double i, double e, 00128 double g) const; 00129 00130 Parameters findParameters(const double wavelength) const; 00131 Parameters extract(const DbProfile &profile) const; 00132 void init(PvlObject &pvl, Cube &cube); 00133 00134 /** 00135 * @brief Helper method to initialize parameters 00136 * 00137 * This method will check the existance of a keyword and extract the value 00138 * if it exists to the passed parameter (type). If it doesn't exist, the 00139 * default values is returned. 00140 * 00141 * @param T Templated variable type 00142 * @param conf Parameter profile container 00143 * @param keyname Name of keyword to get a value from 00144 * @param defval Default value it keyword/value doesn't exist 00145 * @param index Optional index of the value for keyword arrays 00146 * 00147 * @return T Return type 00148 */ 00149 template <typename T> 00150 T ConfKey(const DbProfile &conf, const std::string &keyname, 00151 const T &defval, int index = 0) const { 00152 if(!conf.exists(keyname)) { 00153 return (defval); 00154 } 00155 if(conf.count(keyname) < index) { 00156 return (defval); 00157 } 00158 iString iValue(conf.value(keyname, index)); 00159 T value = iValue; // This makes it work with a string? 00160 return (value); 00161 } 00162 }; 00163 00164 }; 00165 00166 #endif 00167