Isis 3 Programmer Reference
Albedo.cpp
1 #include "Albedo.h"
2 #include "SpecialPixel.h"
3 #include "IException.h"
4 #include "IString.h"
5 #include "NormModel.h"
6 
7 namespace Isis {
14  Albedo::Albedo(Pvl &pvl, PhotoModel &pmodel) : NormModel(pvl, pmodel) {
15  PvlGroup &algorithm = pvl.findObject("NormalizationModel").findGroup("Algorithm", Pvl::Traverse);
16 
17  SetNormPharef(0.0);
18  SetNormIncref(0.0);
19  SetNormEmaref(0.0);
20  SetNormIncmat(0.0);
21  SetNormThresh(30.0);
22  SetNormAlbedo(1.0);
23 
24  // Get value from user
25  if(algorithm.hasKeyword("Incref")) {
26  SetNormIncref(algorithm["Incref"]);
27  }
28 
29  if(algorithm.hasKeyword("Pharef")) {
30  SetNormPharef(algorithm["Pharef"]);
31  } else {
33  }
34 
35  if(algorithm.hasKeyword("Emaref")) {
36  SetNormEmaref(algorithm["Emaref"]);
37  }
38 
39  if(algorithm.hasKeyword("Incmat")) {
40  SetNormIncmat(algorithm["Incmat"]);
41  }
42 
43  if(algorithm.hasKeyword("Thresh")) {
44  SetNormThresh(algorithm["Thresh"]);
45  }
46 
47  if(algorithm.hasKeyword("Albedo")) {
48  SetNormAlbedo(algorithm["Albedo"]);
49  }
50 
51  // Calculate normalization at standard conditions.
52  GetPhotoModel()->SetStandardConditions(true);
54  GetPhotoModel()->SetStandardConditions(false);
55  }
56 
57 
71  void Albedo::NormModelAlgorithm(double phase, double incidence,
72  double emission, double demincidence, double dememission,
73  double dn, double &albedo, double &mult, double &base) {
74  double psurf;
75  double result;
76 
77  // code for scaling each pixel
78  psurf = GetPhotoModel()->CalcSurfAlbedo(phase, demincidence, dememission);
79 
80  // thresh is a parameter limiting how much we amplify the dns
81  if(p_normPsurfref > psurf * p_normThresh) {
82  result = NULL8;
83  albedo = NULL8;
84  mult = 0.0;
85  base = 0.0;
86  }
87  else {
88  if(psurf == 0.0) {
89  QString msg = "Albedo math divide by zero error";
91  }
92  else {
93  result = dn * p_normPsurfref / psurf;
94  albedo = result;
95  mult = p_normPsurfref / psurf;
96  base = 0.0;
97  }
98  }
99  }
100 
101 
111  void Albedo::SetNormPharef(const double pharef) {
112  if(pharef < 0.0 || pharef >= 180.0) {
113  QString msg = "Invalid value of normalization pharef [" +
114  toString(pharef) + "]";
116  }
117  p_normPharef = pharef;
118  }
119 
129  void Albedo::SetNormIncref(const double incref) {
130  if(incref < 0.0 || incref >= 90.0) {
131  QString msg = "Invalid value of normalization incref [" +
132  toString(incref) + "]";
134  }
135  p_normIncref = incref;
136  }
137 
147  void Albedo::SetNormEmaref(const double emaref) {
148  if(emaref < 0.0 || emaref >= 90.0) {
149  QString msg = "Invalid value of normalization emaref [" +
150  toString(emaref) + "]";
152  }
153  p_normEmaref = emaref;
154  }
155 
162  void Albedo::SetNormIncmat(const double incmat) {
163  if(incmat < 0.0 || incmat >= 90.0) {
164  QString msg = "Invalid value of normalization incmat [" +
165  toString(incmat) + "]";
167  }
168  p_normIncmat = incmat;
169  }
170 
179  void Albedo::SetNormAlbedo(const double albedo) {
180  p_normAlbedo = albedo;
181  }
182 
197  void Albedo::SetNormThresh(const double thresh) {
198  p_normThresh = thresh;
199  }
200 }
201 
202 extern "C" Isis::NormModel *AlbedoPlugin(Isis::Pvl &pvl, Isis::PhotoModel &pmodel) {
203  return new Isis::Albedo(pvl, pmodel);
204 }
void SetNormIncref(const double incref)
Set the normalization function parameter.
Definition: Albedo.cpp:129
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
void SetNormAlbedo(const double albedo)
Set the normalization function parameter.
Definition: Albedo.cpp:179
double CalcSurfAlbedo(double pha, double inc, double ema)
Calculate the surface brightness using photometric angle information.
Definition: PhotoModel.cpp:171
void SetNormPharef(const double pharef)
Set parameters needed for albedo normalization.
Definition: Albedo.cpp:111
double p_normThresh
Used to amplify variations in the input image.
Definition: Albedo.h:95
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
Definition: PvlObject.h:286
double p_normIncmat
Incmat.
Definition: Albedo.h:96
double p_normPharef
The reference phase angle.
Definition: Albedo.h:92
Search child objects.
Definition: PvlObject.h:170
virtual void NormModelAlgorithm(double pha, double inc, double ema, double dn, double &albedo, double &mult, double &base)
Performs the normalization.
Definition: Albedo.h:76
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
double p_normIncref
The reference incidence angle.
Definition: Albedo.h:93
double p_normAlbedo
The albedo.
Definition: Albedo.h:97
void SetNormIncmat(const double incmat)
Set the normalization function parameter.
Definition: Albedo.cpp:162
void SetNormThresh(const double thresh)
Set the normalization function parameter.
Definition: Albedo.cpp:197
Albedo normalization.
Definition: Albedo.h:59
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
A type of error that could only have occurred due to a mistake on the user&#39;s part (e...
Definition: IException.h:142
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:134
Container for cube-like labels.
Definition: Pvl.h:135
void SetNormEmaref(const double emaref)
Set the normalization function parameter.
Definition: Albedo.cpp:147
double p_normPsurfref
???
Definition: Albedo.h:91
Isis exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
double p_normEmaref
The reference emission angle.
Definition: Albedo.h:94
Albedo(Pvl &pvl, PhotoModel &pmodel)
Constructs an Albedo object.
Definition: Albedo.cpp:14
virtual void SetStandardConditions(bool standard)
Sets whether standard conditions will be used.
Definition: PhotoModel.cpp:44