USGS

Isis 3.0 Application Source Code Reference

Home

GainFlatField.h

Go to the documentation of this file.
00001 #if !defined(GainFlatField_h)
00002 #define GainFlatField_h
00003 /**                                                                       
00004  * @file                                                                  
00005  * $Revision: 1.4 $
00006  * $Date: 2009/09/15 21:56:44 $
00007  * $Id: GainFlatField.h,v 1.4 2009/09/15 21:56:44 kbecker Exp $
00008  * 
00009  *   Unless noted otherwise, the portions of Isis written by the USGS are 
00010  *   public domain. See individual third-party library and package descriptions 
00011  *   for intellectual property information, user agreements, and related  
00012  *   information.                                                         
00013  *                                                                        
00014  *   Although Isis has been used by the USGS, no warranty, expressed or   
00015  *   implied, is made by the USGS as to the accuracy and functioning of such 
00016  *   software and related material nor shall the fact of distribution     
00017  *   constitute any such warranty, and no responsibility is assumed by the
00018  *   USGS in connection therewith.                                        
00019  *                                                                        
00020  *   For additional information, launch                                   
00021  *   $ISISROOT/doc//documents/Disclaimers/Disclaimers.html                
00022  *   in a browser or see the Privacy & Disclaimers page on the Isis website,
00023  *   http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on
00024  *   http://www.usgs.gov/privacy.html.                                    
00025  */                                                                       
00026 #include <cmath>
00027 #include <string>
00028 #include <vector>
00029 
00030 #include "iString.h"
00031 #include "HiCalTypes.h"
00032 #include "HiCalUtil.h"
00033 #include "HiCalConf.h"
00034 #include "Module.h"
00035 #include "Filename.h"
00036 #include "Statistics.h"
00037 #include "iException.h"
00038 
00039 namespace Isis {
00040 
00041   /**
00042    * @brief GainFlatField Module - Computes flat field correction for sample 
00043    * 
00044    * This class computes the HiRISE flat field correction component using the A
00045    * matrix.
00046    * 
00047    * @ingroup Utility
00048    * 
00049    * @author 2008-03-04 Kris Becker 
00050    * @history 2009-09-14 Kris Becker Removed temperature components and placed 
00051    *          them in the GainTemperature module.
00052    * @history 2010-04-16 Kris Becker Modified to used the standardized CSV 
00053    *          reader for the A matrix.
00054    */
00055   class GainFlatField : public Module {
00056 
00057     public: 
00058       //  Constructors and Destructor
00059       GainFlatField() : Module("GainFlatField") { }
00060       GainFlatField(const HiCalConf &conf) : Module("GainFlatField") {
00061         init(conf);
00062       }
00063 
00064       /** Destructor */
00065       virtual ~GainFlatField() { }
00066 
00067       /** 
00068        * @brief Return statistics A matrix corection
00069        * 
00070        * @return const Statistics&  Statistics class with all stats
00071        */
00072       const Statistics &Stats() const { return (_stats); }
00073 
00074     private:
00075       std::string _amatrix;
00076       Statistics _stats;      // Stats Results
00077 
00078       void init(const HiCalConf &conf) {
00079         _history.clear();
00080         DbProfile prof = conf.getMatrixProfile();
00081         _history.add("Profile["+ prof.Name()+"]");
00082         int nsamps = ToInteger(prof("Samples"));
00083 
00084         //  Get parameters from A-Matrix coefficients file
00085         _data = loadCsv("Flats", conf, prof, nsamps);
00086         _stats.Reset();
00087         for ( int i = 0 ; i < _data.dim() ; i++ ) {
00088           _stats.AddData(_data[i]);
00089         }
00090 
00091         _history.add("Statistics(Average["+ToString(_stats.Average())+
00092                      "],StdDev["+ToString(_stats.StandardDeviation())+"])"); 
00093         return;
00094       }
00095 
00096   };
00097 
00098 }     // namespace Isis
00099 #endif
00100