File failed to load: https://isis.astrogeology.usgs.gov/6.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
PushFrameCameraCcdLayout.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 #include <iostream>
8 #include <sstream>
9 
10 #include <SpiceUsr.h>
11 #include <SpiceZfc.h>
12 #include <SpiceZmc.h>
13 
14 #include "FileName.h"
15 #include "IString.h"
16 #include "PushFrameCameraCcdLayout.h"
17 #include "NaifStatus.h"
18 
19 namespace Isis {
25  m_ccdId = 1;
26  }
27 
28 
35  m_ccdId = ccdId;
36  }
37 
38 
43  }
44 
45 
56  bool PushFrameCameraCcdLayout::addKernel(const QString &kernel) {
57  FileName kern(kernel);
58  if ( kern.isVersioned()) {
59  kern = kern.highestVersion();
60  }
61  m_kernels.Add(kern.expanded());
62  int nloaded = m_kernels.Load();
63  return (nloaded > 0);
64  }
65 
66 
74  QString var = "INS" + toString(m_ccdId) + "_FILTER_SAMPLES";
75  return (getSpiceInt(var));
76  }
77 
78 
86  QString var = "INS" + toString(m_ccdId) + "_FILTER_LINES";
87  return (getSpiceInt(var));
88  }
89 
90 
101  const int &frameId,
102  const QString &name) const {
103  FrameletInfo finfo(frameId);
104  finfo.m_filterName = name;
105 
106  QString base = "INS" + toString(frameId);
107  try {
108  finfo.m_samples = getSpiceInt(base + "_FILTER_SAMPLES");
109  finfo.m_lines = getSpiceInt(base + "_FILTER_LINES");
110  finfo.m_startLine = getSpiceInt(base + "_FILTER_OFFSET");
111  }
112  catch (IException &e) {
113  QString msg = "Could not find layout information for framelet ["
114  + toString(frameId) + "].";
115  throw IException(e, IException::Io, msg, _FILEINFO_);
116  }
117  finfo.m_startSample = 1;
118 
119  if ( finfo.m_filterName.isEmpty()) {
120  try {
121  finfo.m_filterName = getSpiceString(base + "_FILTER_NAME");
122  } catch (IException &ie) {
123  // noop - leave name empty
124  }
125  }
126 
127  return (finfo);
128  }
129 
130 
141  int PushFrameCameraCcdLayout::getSpiceInt(const QString &var,
142  const int index) const {
143  SpiceBoolean found = false;
144  SpiceInt numValuesRead;
145  SpiceInt kernelValue;
146  gipool_c(var.toLatin1().data(), (SpiceInt) index, 1, &numValuesRead,
147  &kernelValue, &found);
148 
149  // Gotta throw an error here if not found
150  if (!found) {
152  QString msg = "Can not find [" + var + "] in text kernels";
153  throw IException(IException::Io, msg, _FILEINFO_);
154  }
155 
156  return ( (int) kernelValue );
157  }
158 
159 
170  double PushFrameCameraCcdLayout::getSpiceDouble(const QString &var,
171  const int index) const {
172  SpiceBoolean found = false;
173  SpiceInt numValuesRead;
174  SpiceDouble kernelValue;
175  gdpool_c(var.toLatin1().data(), (SpiceInt) index, 1, &numValuesRead,
176  &kernelValue, &found);
177 
178  // Gotta throw an error here if not found
179  if (!found) {
181  QString msg = "Can not find [" + var + "] in text kernels";
182  throw IException(IException::Io, msg, _FILEINFO_);
183  }
184 
185  return ( (double) kernelValue );
186  }
187 
188 
199  QString PushFrameCameraCcdLayout::getSpiceString(const QString &var,
200  const int index) const {
201  SpiceBoolean found = false;
202  SpiceInt numValuesRead;
203  char kernelValue[512];
204  gcpool_c(var.toLatin1().data(), (SpiceInt) index, 1, sizeof(kernelValue),
205  &numValuesRead, kernelValue, &found);
206 
207  // Gotta throw an error here if not found
208  if (!found) {
210  QString msg = "Can not find [" + var + "] in text kernels";
211  throw IException(IException::Io, msg, _FILEINFO_);
212  }
213 
214  return ( QString(kernelValue) );
215  }
216 
217 };
Isis::PushFrameCameraCcdLayout::getSpiceInt
int getSpiceInt(const QString &var, const int index=0) const
Query the loaded kernels for an integer valued keyword.
Definition: PushFrameCameraCcdLayout.cpp:141
Isis::IException::Io
@ Io
A type of error that occurred when performing an actual I/O operation.
Definition: IException.h:155
Isis::PushFrameCameraCcdLayout::getSpiceDouble
double getSpiceDouble(const QString &var, const int index=0) const
Query the loaded kernels for a double valued keyword.
Definition: PushFrameCameraCcdLayout.cpp:170
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::PushFrameCameraCcdLayout::FrameletInfo
Container for the layout of a specific framelet on the detector.
Definition: PushFrameCameraCcdLayout.h:44
Isis::PushFrameCameraCcdLayout::getFrameInfo
FrameletInfo getFrameInfo(const int &frameId, const QString &name="") const
Get the layout information for a framelet.
Definition: PushFrameCameraCcdLayout.cpp:100
Isis::NaifStatus::CheckErrors
static void CheckErrors(bool resetNaif=true)
This method looks for any naif errors that might have occurred.
Definition: NaifStatus.cpp:28
Isis::PushFrameCameraCcdLayout::m_kernels
Kernels m_kernels
NAIF kernel manager.
Definition: PushFrameCameraCcdLayout.h:80
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::PushFrameCameraCcdLayout::PushFrameCameraCcdLayout
PushFrameCameraCcdLayout()
Push frame full CCD layout class.
Definition: PushFrameCameraCcdLayout.cpp:24
Isis::Kernels::Add
bool Add(const QString &kfile)
Add a new kernel to the list.
Definition: Kernels.cpp:178
Isis::PushFrameCameraCcdLayout::FrameletInfo::m_samples
int m_samples
The number of samples in the framelet.
Definition: PushFrameCameraCcdLayout.h:59
Isis::PushFrameCameraCcdLayout::~PushFrameCameraCcdLayout
virtual ~PushFrameCameraCcdLayout()
Destructor.
Definition: PushFrameCameraCcdLayout.cpp:42
Isis::PushFrameCameraCcdLayout::FrameletInfo::m_filterName
QString m_filterName
The name of the framelet.
Definition: PushFrameCameraCcdLayout.h:56
Isis::FileName::expanded
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:196
Isis::PushFrameCameraCcdLayout::FrameletInfo::m_startLine
int m_startLine
The first line of the framelet on the detector.
Definition: PushFrameCameraCcdLayout.h:58
Isis::PushFrameCameraCcdLayout::FrameletInfo::m_startSample
int m_startSample
The first sample of the framelet on the detector.
Definition: PushFrameCameraCcdLayout.h:57
Isis::PushFrameCameraCcdLayout::m_ccdId
int m_ccdId
NAIF ID of the CCD.
Definition: PushFrameCameraCcdLayout.h:79
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::Kernels::Load
int Load(const QString &ktype)
Load all kernels with one more types.
Definition: Kernels.cpp:364
Isis::PushFrameCameraCcdLayout::getSpiceString
QString getSpiceString(const QString &var, const int index=0) const
Query the loaded kernels for a string valued keyword.
Definition: PushFrameCameraCcdLayout.cpp:199
Isis::PushFrameCameraCcdLayout::ccdSamples
int ccdSamples() const
Return the number of samples in the CCD.
Definition: PushFrameCameraCcdLayout.cpp:73
Isis::PushFrameCameraCcdLayout::ccdLines
int ccdLines() const
Return the number of lines in the CCD.
Definition: PushFrameCameraCcdLayout.cpp:85
Isis::PushFrameCameraCcdLayout::addKernel
bool addKernel(const QString &kernel)
Add a NAIF kernel to the set of kernels that values will be pulled from.
Definition: PushFrameCameraCcdLayout.cpp:56
Isis::PushFrameCameraCcdLayout::FrameletInfo::m_lines
int m_lines
The number of lines in the framelet.
Definition: PushFrameCameraCcdLayout.h:60
Isis::FileName::isVersioned
bool isVersioned() const
Checks to see if a file name is versioned by date or numerically.
Definition: FileName.cpp:281
Isis::FileName::highestVersion
FileName highestVersion() const
Searches the directory specified in the file name for the highest version of the file name.
Definition: FileName.cpp:313
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the USGS Astrogeology Discussion Board
To report a bug, or suggest a feature go to: ISIS Github
File Modified: 07/13/2023 15:17:06