Isis 3 Programmer Reference
PhotometricFunction.cpp
1 #include <SpiceUsr.h>
2 #include <SpiceZfc.h>
3 #include <SpiceZmc.h>
4 
5 #include "Angle.h"
6 #include "Camera.h"
7 #include "DbProfile.h"
8 #include "PhotometricFunction.h"
9 #include "PvlObject.h"
10 
11 using namespace std;
12 
13 namespace Isis {
26  PhotometricFunction::PhotometricFunction( PvlObject &pvl, Cube &cube , bool useCamera ) {
27  if (useCamera) {
28  m_camera = cube.camera();
29  }
30  }
31 
32 
36  PhotometricFunction::~PhotometricFunction() {}
37 
38 
44  void PhotometricFunction::setCamera(Camera *cam) {
45  m_camera = cam;
46  }
47 
48 
56  QString PhotometricFunction::algorithmName( const PvlObject &pvl ) {
57  return pvl.findObject("PhotometricModel").findGroup("Algorithm", Pvl::Traverse).findKeyword("Name")[0];
58  }
59 
60 
77  double PhotometricFunction::compute( const double &line, const double &sample, int band, bool useDem) {
78  // Update band if necessary
79  if (m_camera->Band() != band) {
80  m_camera->SetBand(band);
81  }
82  // Return null if not able to set image
83  if (!m_camera->SetImage(sample, line)) {
84  return (Null);
85  }
86  // calculate photometric angles
87  double i = m_camera->IncidenceAngle();
88  double e = m_camera->EmissionAngle();
89  double g = m_camera->PhaseAngle();
90  bool success = true;
91 
92  if (useDem) {
93  Angle phase, incidence, emission;
94  m_camera->LocalPhotometricAngles(phase, incidence, emission, success);
95 
96  if (success) {
97  g = phase.degrees();
98  i = incidence.degrees();
99  e = emission.degrees();
100  }
101  }
102 
103  if ( !success || i < minimumIncidenceAngle() || i > maximumIncidenceAngle() || e < minimumEmissionAngle() || e
104  > maximumEmissionAngle() || g < minimumPhaseAngle() || g > maximumPhaseAngle()) {
105  return (Null);
106  }
107 
108  return photometry(i, e, g, band);
109  }
110 
111 
123  void PhotometricFunction::setMinimumIncidenceAngle(double angle) {
124  m_minimumIncidenceAngle = angle;
125  }
126 
127 
139  void PhotometricFunction::setMaximumIncidenceAngle(double angle) {
140  m_maximumIncidenceAngle = angle;
141  }
142 
143 
155  void PhotometricFunction::setMinimumEmissionAngle(double angle) {
156  m_minimumEmissionAngle = angle;
157  }
158 
159 
171  void PhotometricFunction::setMaximumEmissionAngle(double angle) {
172  m_maximumEmissionAngle = angle;
173  }
174 
175 
187  void PhotometricFunction::setMinimumPhaseAngle(double angle) {
188  m_minimumPhaseAngle = angle;
189  }
190 
191 
203  void PhotometricFunction::setMaximumPhaseAngle(double angle) {
204  m_maximumPhaseAngle = angle;
205  }
206 
207 
219  double PhotometricFunction::minimumIncidenceAngle() {
220  return m_minimumIncidenceAngle;
221  }
222 
223 
235  double PhotometricFunction::maximumIncidenceAngle() {
236  return m_maximumIncidenceAngle;
237  }
238 
239 
251  double PhotometricFunction::minimumEmissionAngle() {
252  return m_minimumEmissionAngle;
253  }
254 
255 
267  double PhotometricFunction::maximumEmissionAngle() {
268  return m_maximumEmissionAngle;
269  }
270 
271 
283  double PhotometricFunction::minimumPhaseAngle() {
284  return m_minimumPhaseAngle;
285  }
286 
287 
299  double PhotometricFunction::maximumPhaseAngle() {
300  return m_maximumPhaseAngle;
301  }
302 
303 }
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:110
Camera * camera()
Return a camera associated with the cube.
Definition: Cube.cpp:1166
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
Namespace for the standard library.
double degrees() const
Get the angle in units of Degrees.
Definition: Angle.h:249
Defines an angle and provides unit conversions.
Definition: Angle.h:62
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
IO Handler for Isis Cubes.
Definition: Cube.h:170