Loading isis/src/base/objs/PushFrameCameraCcdLayout/Makefile 0 → 100644 +7 −0 Original line number Diff line number Diff line ifeq ($(ISISROOT), $(BLANK)) .SILENT: error: echo "Please set ISISROOT"; else include $(ISISROOT)/make/isismake.objs endif No newline at end of file isis/src/base/objs/PushFrameCameraCcdLayout/PushFrameCameraCcdLayout.cpp 0 → 100644 +233 −0 Original line number Diff line number Diff line /** * @file * $Revision: 1.4 $ * $Date: 2008/02/21 16:04:33 $ * * Unless noted otherwise, the portions of Isis written by the USGS are * public domain. See individual third-party library and package descriptions * for intellectual property information, user agreements, and related * information. * * Although Isis has been used by the USGS, no warranty, expressed or * implied, is made by the USGS as to the accuracy and functioning of such * software and related material nor shall the fact of distribution * constitute any such warranty, and no responsibility is assumed by the * USGS in connection therewith. * * For additional information, launch * $ISISROOT/doc//documents/Disclaimers/Disclaimers.html * in a browser or see the Privacy & Disclaimers page on the Isis website, * http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on * http://www.usgs.gov/privacy.html. */ #include <iostream> #include <sstream> #include <SpiceUsr.h> #include <SpiceZfc.h> #include <SpiceZmc.h> #include "FileName.h" #include "IString.h" #include "PushFrameCameraCcdLayout.h" #include "NaifStatus.h" namespace Isis { /** * Push frame full CCD layout class * */ PushFrameCameraCcdLayout::PushFrameCameraCcdLayout() { m_ccdId = 1; } /** * Push frame full CCD layout class for specific Id * * @param ccId The NAIF ID of the CCD */ PushFrameCameraCcdLayout::PushFrameCameraCcdLayout(const int ccdId) { m_ccdId = ccdId; } /** * Destructor */ PushFrameCameraCcdLayout::~PushFrameCameraCcdLayout() { } /** * Add a NAIF kernel to the set of kernels that values will be pulled from. * * @param kernel The path to the kernel file to load. The kernel name can * contain a series of ?? characters to indicate version * numbers. In this case the highest version numbered file will * be added. * * @return @b bool If the kernel was successfully loaded. */ bool PushFrameCameraCcdLayout::addKernel(const QString &kernel) { FileName kern(kernel); if ( kern.isVersioned()) { kern = kern.highestVersion(); } m_kernels.Add(kern.expanded()); int nloaded = m_kernels.Load(); return (nloaded > 0); } /** * Return the number of samples in the CCD. Queries the NAIF keyword * INS(CCD NAIF ID)_FILTER_SAMPLES from the loaded kernels. * * @return @b int The number of samples in the CCD. */ int PushFrameCameraCcdLayout::ccdSamples() const { QString var = "INS" + toString(m_ccdId) + "_FILTER_SAMPLES"; return (getSpiceInt(var)); } /** * Return the number of lines in the CCD. Queries the NAIF keyword * INS(CCD NAIF ID)_FILTER_LINES from the loaded kernels. * * @return @b int The number of lines in the CCD. */ int PushFrameCameraCcdLayout::ccdLines() const { QString var = "INS" + toString(m_ccdId) + "_FILTER_LINES"; return (getSpiceInt(var)); } /** * Get the layout information for a framelet. * * @param frameId The NAIF ID of the framelet. * @param name The name of the framelet. If empty, the loaded kernels will be * queried for the name associated with the NAIF ID. * * @return @b FrameletInfo The location and size of the framelet on the CCD. */ PushFrameCameraCcdLayout::FrameletInfo PushFrameCameraCcdLayout::getFrameInfo( const int &frameId, const QString &name) const { FrameletInfo finfo(frameId); finfo.m_filterName = name; QString base = "INS" + toString(frameId); try { finfo.m_samples = getSpiceInt(base + "_FILTER_SAMPLES"); finfo.m_lines = getSpiceInt(base + "_FILTER_LINES"); finfo.m_startLine = getSpiceInt(base + "_FILTER_OFFSET"); } catch (IException &e) { QString msg = "Could not find layout information for framelet [" + toString(frameId) + "]."; throw IException(e, IException::Io, msg, _FILEINFO_); } finfo.m_startSample = 1; if ( finfo.m_filterName.isEmpty()) { try { finfo.m_filterName = getSpiceString(base + "_FILTER_NAME"); } catch (IException &ie) { // noop - leave name empty } } return (finfo); } /** * Query the loaded kernels for an integer valued keyword. * * @param var The keyword to find. * @param index The index of the value to take from the keyword. * * @return @b int The keyword value * * @see gipool_c */ int PushFrameCameraCcdLayout::getSpiceInt(const QString &var, const int index) const { SpiceBoolean found = false; SpiceInt numValuesRead; SpiceInt kernelValue; gipool_c(var.toLatin1().data(), (SpiceInt) index, 1, &numValuesRead, &kernelValue, &found); // Gotta throw an error here if not found if (!found) { NaifStatus::CheckErrors(); QString msg = "Can not find [" + var + "] in text kernels"; throw IException(IException::Io, msg, _FILEINFO_); } return ( (int) kernelValue ); } /** * Query the loaded kernels for a double valued keyword. * * @param var The keyword to find. * @param index The index of the value to take from the keyword. * * @return @b double The keyword value * * @see gdpool_c */ double PushFrameCameraCcdLayout::getSpiceDouble(const QString &var, const int index) const { SpiceBoolean found = false; SpiceInt numValuesRead; SpiceDouble kernelValue; gdpool_c(var.toLatin1().data(), (SpiceInt) index, 1, &numValuesRead, &kernelValue, &found); // Gotta throw an error here if not found if (!found) { NaifStatus::CheckErrors(); QString msg = "Can not find [" + var + "] in text kernels"; throw IException(IException::Io, msg, _FILEINFO_); } return ( (double) kernelValue ); } /** * Query the loaded kernels for a string valued keyword. * * @param var The keyword to find. * @param index The index of the value to take from the keyword. * * @return @b QString The keyword value * * @see gcpool_c */ QString PushFrameCameraCcdLayout::getSpiceString(const QString &var, const int index) const { SpiceBoolean found = false; SpiceInt numValuesRead; char kernelValue[512]; gcpool_c(var.toLatin1().data(), (SpiceInt) index, 1, sizeof(kernelValue), &numValuesRead, kernelValue, &found); // Gotta throw an error here if not found if (!found) { NaifStatus::CheckErrors(); QString msg = "Can not find [" + var + "] in text kernels"; throw IException(IException::Io, msg, _FILEINFO_); } return ( QString(kernelValue) ); } }; isis/src/base/objs/PushFrameCameraCcdLayout/PushFrameCameraCcdLayout.h 0 → 100644 +99 −0 Original line number Diff line number Diff line #ifndef PushFrameCameraCcdLayout_h #define PushFrameCameraCcdLayout_h /** * @file * $Revision: 1.6 $ * $Date: 2009/10/21 18:37:02 $ * * Unless noted otherwise, the portions of Isis written by the USGS are * public domain. See individual third-party library and package descriptions * for intellectual property information, user agreements, and related * information. * * Although Isis has been used by the USGS, no warranty, expressed or * implied, is made by the USGS as to the accuracy and functioning of such * software and related material nor shall the fact of distribution * constitute any such warranty, and no responsibility is assumed by the * USGS in connection therewith. * * For additional information, launch * $ISISROOT/doc//documents/Disclaimers/Disclaimers.html * in a browser or see the Privacy & Disclaimers page on the Isis website, * http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on * http://www.usgs.gov/privacy.html. */ #include <QString> #include "Kernels.h" namespace Isis { /** * Provide image coordinates that map to the push frame detector. * * @ingroup Camera * * @see Camera * * @author 2017-08-11 Kris Becker * * @internal * @history 2017-08-11 Kris Becker - Original Version * @history 2017-08-21 Jesse Mapel - Improved documentation. */ class PushFrameCameraCcdLayout { public: /** * Container for the layout of a specific framelet on the detector. * * @ingroup Camera * * @see Camera * * @author 2017-08-11 Kris Becker * * @internal * @history 2017-08-11 Kris Becker - Original Version * @history 2017-08-21 Jesse Mapel - Added documentation */ struct FrameletInfo { FrameletInfo() : m_frameId(-1), m_filterName(), m_startSample(0), m_startLine(0), m_samples(0), m_lines(0) { } FrameletInfo(const int frameid) : m_frameId(frameid), m_filterName(), m_startSample(0), m_startLine(0), m_samples(0), m_lines(0) { } int m_frameId; //!< The NAIF ID of the framelet. QString m_filterName; //!< The name of the framelet. int m_startSample; //!< The first sample of the framelet on the detector. int m_startLine; //!< The first line of the framelet on the detector. int m_samples; //!< The number of samples in the framelet. int m_lines; //!< The number of lines in the framelet. }; public: PushFrameCameraCcdLayout( ); PushFrameCameraCcdLayout( const int ccdId ); virtual ~PushFrameCameraCcdLayout(); bool addKernel(const QString &kernel); int ccdSamples() const; int ccdLines() const; FrameletInfo getFrameInfo(const int &frameId, const QString &name = "") const; private: int m_ccdId; //!< NAIF ID of the CCD Kernels m_kernels; //!< NAIF kernel manager int getSpiceInt(const QString &var, const int index = 0) const; double getSpiceDouble(const QString &var, const int index = 0) const; QString getSpiceString(const QString &var, const int index = 0) const; }; }; #endif isis/src/base/objs/PushFrameCameraCcdLayout/PushFrameCameraCcdLayout.truth 0 → 100644 +48 −0 Original line number Diff line number Diff line Unit Test for PushFrameCameraCcdLayout::FrameletInfo... Create a default FrameletInfo object framelet ID: -1 framelet name: "" framelet start sample: 0 framelet start line: 0 framelet samples: 0 framelet lines: 0 Create a FrameletInfo object for a specific ID framelet ID: 42 framelet name: "" framelet start sample: 0 framelet start line: 0 framelet samples: 0 framelet lines: 0 Unit Test for PushFrameCameraCcdLayout... Create a default PushFrameCameraCcdLayout Try adding a kernel that does not exist Kernel file loaded? false Create the JunoCam layout Load the JunoCam kernels JunoCam CCD samples: 1648 JunoCam CCD lines: 1200 Get the METHANE filter layout METHANE filter ID: -61504 METHANE filter name: "METHANE" METHANE filter start sample: 1 METHANE filter start line: 291 METHANE filter samples: 1648 METHANE filter lines: 128 Get the METHANE filter layout but give it a different name METHANE filter ID: -61504 METHANE filter name: "methane" METHANE filter start sample: 1 METHANE filter start line: 291 METHANE filter samples: 1648 METHANE filter lines: 128 Attempt to get the layout for a filter that doesn't exist **I/O ERROR** Could not find layout information for framelet [-61509]. **I/O ERROR** Can not find [INS-61509_FILTER_SAMPLES] in text kernels. isis/src/base/objs/PushFrameCameraCcdLayout/unitTest.cpp 0 → 100644 +113 −0 Original line number Diff line number Diff line /** * @file * * Unless noted otherwise, the portions of Isis written by the USGS are public * domain. See individual third-party library and package descriptions for * intellectual property information,user agreements, and related information. * * Although Isis has been used by the USGS, no warranty, expressed or implied, * is made by the USGS as to the accuracy and functioning of such software * and related material nor shall the fact of distribution constitute any such * warranty, and no responsibility is assumed by the USGS in connection * therewith. * * For additional information, launch * $ISISROOT/doc//documents/Disclaimers/Disclaimers.html in a browser or see * the Privacy & Disclaimers page on the Isis website, * http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on * http://www.usgs.gov/privacy.html. */ #include <QDebug> #include "IException.h" #include "Preference.h" #include "PushFrameCameraCcdLayout.h" using namespace std; using namespace Isis; int main(void) { Preference::Preferences(true); qDebug() << "Unit Test for PushFrameCameraCcdLayout::FrameletInfo..."; qDebug() << ""; try { qDebug() << "Create a default FrameletInfo object"; PushFrameCameraCcdLayout::FrameletInfo defaultInfo; qDebug() << "framelet ID:" << defaultInfo.m_frameId; qDebug() << "framelet name:" << defaultInfo.m_filterName; qDebug() << "framelet start sample:" << defaultInfo.m_startSample; qDebug() << "framelet start line:" << defaultInfo.m_startLine; qDebug() << "framelet samples:" << defaultInfo.m_samples; qDebug() << "framelet lines:" << defaultInfo.m_lines; qDebug() << ""; qDebug() << "Create a FrameletInfo object for a specific ID"; PushFrameCameraCcdLayout::FrameletInfo numberedInfo(42); qDebug() << "framelet ID:" << numberedInfo.m_frameId; qDebug() << "framelet name:" << numberedInfo.m_filterName; qDebug() << "framelet start sample:" << numberedInfo.m_startSample; qDebug() << "framelet start line:" << numberedInfo.m_startLine; qDebug() << "framelet samples:" << numberedInfo.m_samples; qDebug() << "framelet lines:" << numberedInfo.m_lines; qDebug() << ""; } catch(IException &e) { e.print(); } qDebug() << "Unit Test for PushFrameCameraCcdLayout..."; qDebug() << ""; try { qDebug() << "Create a default PushFrameCameraCcdLayout"; PushFrameCameraCcdLayout defaultLayout; qDebug() << "Try adding a kernel that does not exist"; bool loaded = defaultLayout.addKernel("not_a_kernel_file"); qDebug() << "Kernel file loaded?" << loaded; qDebug() << ""; qDebug() << "Create the JunoCam layout"; PushFrameCameraCcdLayout junoLayout(-61500); qDebug() << "Load the JunoCam kernels"; if (!junoLayout.addKernel("$juno/kernels/ik/juno_junocam_v??.ti")) { QString msg = "Failed to load the JunoCam Instrument Kernel."; throw IException(IException::Io, msg, _FILEINFO_); } if (!junoLayout.addKernel("$juno/kernels/iak/junoAddendum???.ti")) { QString msg = "Failed to load the JunoCam Instrument Addendum."; throw IException(IException::Io, msg, _FILEINFO_); } qDebug() << "JunoCam CCD samples:" << junoLayout.ccdSamples(); qDebug() << "JunoCam CCD lines:" << junoLayout.ccdLines(); qDebug() << ""; qDebug() << "Get the METHANE filter layout"; PushFrameCameraCcdLayout::FrameletInfo methane_info = junoLayout.getFrameInfo(-61504); qDebug() << "METHANE filter ID:" << methane_info.m_frameId; qDebug() << "METHANE filter name:" << methane_info.m_filterName; qDebug() << "METHANE filter start sample:" << methane_info.m_startSample; qDebug() << "METHANE filter start line:" << methane_info.m_startLine; qDebug() << "METHANE filter samples:" << methane_info.m_samples; qDebug() << "METHANE filter lines:" << methane_info.m_lines; qDebug() << ""; qDebug() << "Get the METHANE filter layout but give it a different name"; PushFrameCameraCcdLayout::FrameletInfo named_info = junoLayout.getFrameInfo(-61504, "methane"); qDebug() << "METHANE filter ID:" << named_info.m_frameId; qDebug() << "METHANE filter name:" << named_info.m_filterName; qDebug() << "METHANE filter start sample:" << named_info.m_startSample; qDebug() << "METHANE filter start line:" << named_info.m_startLine; qDebug() << "METHANE filter samples:" << named_info.m_samples; qDebug() << "METHANE filter lines:" << named_info.m_lines; qDebug() << ""; qDebug() << "Attempt to get the layout for a filter that doesn't exist"; try { junoLayout.getFrameInfo(-61509); } catch(IException &e) { e.print(); } } catch(IException &e) { e.print(); } } Loading
isis/src/base/objs/PushFrameCameraCcdLayout/Makefile 0 → 100644 +7 −0 Original line number Diff line number Diff line ifeq ($(ISISROOT), $(BLANK)) .SILENT: error: echo "Please set ISISROOT"; else include $(ISISROOT)/make/isismake.objs endif No newline at end of file
isis/src/base/objs/PushFrameCameraCcdLayout/PushFrameCameraCcdLayout.cpp 0 → 100644 +233 −0 Original line number Diff line number Diff line /** * @file * $Revision: 1.4 $ * $Date: 2008/02/21 16:04:33 $ * * Unless noted otherwise, the portions of Isis written by the USGS are * public domain. See individual third-party library and package descriptions * for intellectual property information, user agreements, and related * information. * * Although Isis has been used by the USGS, no warranty, expressed or * implied, is made by the USGS as to the accuracy and functioning of such * software and related material nor shall the fact of distribution * constitute any such warranty, and no responsibility is assumed by the * USGS in connection therewith. * * For additional information, launch * $ISISROOT/doc//documents/Disclaimers/Disclaimers.html * in a browser or see the Privacy & Disclaimers page on the Isis website, * http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on * http://www.usgs.gov/privacy.html. */ #include <iostream> #include <sstream> #include <SpiceUsr.h> #include <SpiceZfc.h> #include <SpiceZmc.h> #include "FileName.h" #include "IString.h" #include "PushFrameCameraCcdLayout.h" #include "NaifStatus.h" namespace Isis { /** * Push frame full CCD layout class * */ PushFrameCameraCcdLayout::PushFrameCameraCcdLayout() { m_ccdId = 1; } /** * Push frame full CCD layout class for specific Id * * @param ccId The NAIF ID of the CCD */ PushFrameCameraCcdLayout::PushFrameCameraCcdLayout(const int ccdId) { m_ccdId = ccdId; } /** * Destructor */ PushFrameCameraCcdLayout::~PushFrameCameraCcdLayout() { } /** * Add a NAIF kernel to the set of kernels that values will be pulled from. * * @param kernel The path to the kernel file to load. The kernel name can * contain a series of ?? characters to indicate version * numbers. In this case the highest version numbered file will * be added. * * @return @b bool If the kernel was successfully loaded. */ bool PushFrameCameraCcdLayout::addKernel(const QString &kernel) { FileName kern(kernel); if ( kern.isVersioned()) { kern = kern.highestVersion(); } m_kernels.Add(kern.expanded()); int nloaded = m_kernels.Load(); return (nloaded > 0); } /** * Return the number of samples in the CCD. Queries the NAIF keyword * INS(CCD NAIF ID)_FILTER_SAMPLES from the loaded kernels. * * @return @b int The number of samples in the CCD. */ int PushFrameCameraCcdLayout::ccdSamples() const { QString var = "INS" + toString(m_ccdId) + "_FILTER_SAMPLES"; return (getSpiceInt(var)); } /** * Return the number of lines in the CCD. Queries the NAIF keyword * INS(CCD NAIF ID)_FILTER_LINES from the loaded kernels. * * @return @b int The number of lines in the CCD. */ int PushFrameCameraCcdLayout::ccdLines() const { QString var = "INS" + toString(m_ccdId) + "_FILTER_LINES"; return (getSpiceInt(var)); } /** * Get the layout information for a framelet. * * @param frameId The NAIF ID of the framelet. * @param name The name of the framelet. If empty, the loaded kernels will be * queried for the name associated with the NAIF ID. * * @return @b FrameletInfo The location and size of the framelet on the CCD. */ PushFrameCameraCcdLayout::FrameletInfo PushFrameCameraCcdLayout::getFrameInfo( const int &frameId, const QString &name) const { FrameletInfo finfo(frameId); finfo.m_filterName = name; QString base = "INS" + toString(frameId); try { finfo.m_samples = getSpiceInt(base + "_FILTER_SAMPLES"); finfo.m_lines = getSpiceInt(base + "_FILTER_LINES"); finfo.m_startLine = getSpiceInt(base + "_FILTER_OFFSET"); } catch (IException &e) { QString msg = "Could not find layout information for framelet [" + toString(frameId) + "]."; throw IException(e, IException::Io, msg, _FILEINFO_); } finfo.m_startSample = 1; if ( finfo.m_filterName.isEmpty()) { try { finfo.m_filterName = getSpiceString(base + "_FILTER_NAME"); } catch (IException &ie) { // noop - leave name empty } } return (finfo); } /** * Query the loaded kernels for an integer valued keyword. * * @param var The keyword to find. * @param index The index of the value to take from the keyword. * * @return @b int The keyword value * * @see gipool_c */ int PushFrameCameraCcdLayout::getSpiceInt(const QString &var, const int index) const { SpiceBoolean found = false; SpiceInt numValuesRead; SpiceInt kernelValue; gipool_c(var.toLatin1().data(), (SpiceInt) index, 1, &numValuesRead, &kernelValue, &found); // Gotta throw an error here if not found if (!found) { NaifStatus::CheckErrors(); QString msg = "Can not find [" + var + "] in text kernels"; throw IException(IException::Io, msg, _FILEINFO_); } return ( (int) kernelValue ); } /** * Query the loaded kernels for a double valued keyword. * * @param var The keyword to find. * @param index The index of the value to take from the keyword. * * @return @b double The keyword value * * @see gdpool_c */ double PushFrameCameraCcdLayout::getSpiceDouble(const QString &var, const int index) const { SpiceBoolean found = false; SpiceInt numValuesRead; SpiceDouble kernelValue; gdpool_c(var.toLatin1().data(), (SpiceInt) index, 1, &numValuesRead, &kernelValue, &found); // Gotta throw an error here if not found if (!found) { NaifStatus::CheckErrors(); QString msg = "Can not find [" + var + "] in text kernels"; throw IException(IException::Io, msg, _FILEINFO_); } return ( (double) kernelValue ); } /** * Query the loaded kernels for a string valued keyword. * * @param var The keyword to find. * @param index The index of the value to take from the keyword. * * @return @b QString The keyword value * * @see gcpool_c */ QString PushFrameCameraCcdLayout::getSpiceString(const QString &var, const int index) const { SpiceBoolean found = false; SpiceInt numValuesRead; char kernelValue[512]; gcpool_c(var.toLatin1().data(), (SpiceInt) index, 1, sizeof(kernelValue), &numValuesRead, kernelValue, &found); // Gotta throw an error here if not found if (!found) { NaifStatus::CheckErrors(); QString msg = "Can not find [" + var + "] in text kernels"; throw IException(IException::Io, msg, _FILEINFO_); } return ( QString(kernelValue) ); } };
isis/src/base/objs/PushFrameCameraCcdLayout/PushFrameCameraCcdLayout.h 0 → 100644 +99 −0 Original line number Diff line number Diff line #ifndef PushFrameCameraCcdLayout_h #define PushFrameCameraCcdLayout_h /** * @file * $Revision: 1.6 $ * $Date: 2009/10/21 18:37:02 $ * * Unless noted otherwise, the portions of Isis written by the USGS are * public domain. See individual third-party library and package descriptions * for intellectual property information, user agreements, and related * information. * * Although Isis has been used by the USGS, no warranty, expressed or * implied, is made by the USGS as to the accuracy and functioning of such * software and related material nor shall the fact of distribution * constitute any such warranty, and no responsibility is assumed by the * USGS in connection therewith. * * For additional information, launch * $ISISROOT/doc//documents/Disclaimers/Disclaimers.html * in a browser or see the Privacy & Disclaimers page on the Isis website, * http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on * http://www.usgs.gov/privacy.html. */ #include <QString> #include "Kernels.h" namespace Isis { /** * Provide image coordinates that map to the push frame detector. * * @ingroup Camera * * @see Camera * * @author 2017-08-11 Kris Becker * * @internal * @history 2017-08-11 Kris Becker - Original Version * @history 2017-08-21 Jesse Mapel - Improved documentation. */ class PushFrameCameraCcdLayout { public: /** * Container for the layout of a specific framelet on the detector. * * @ingroup Camera * * @see Camera * * @author 2017-08-11 Kris Becker * * @internal * @history 2017-08-11 Kris Becker - Original Version * @history 2017-08-21 Jesse Mapel - Added documentation */ struct FrameletInfo { FrameletInfo() : m_frameId(-1), m_filterName(), m_startSample(0), m_startLine(0), m_samples(0), m_lines(0) { } FrameletInfo(const int frameid) : m_frameId(frameid), m_filterName(), m_startSample(0), m_startLine(0), m_samples(0), m_lines(0) { } int m_frameId; //!< The NAIF ID of the framelet. QString m_filterName; //!< The name of the framelet. int m_startSample; //!< The first sample of the framelet on the detector. int m_startLine; //!< The first line of the framelet on the detector. int m_samples; //!< The number of samples in the framelet. int m_lines; //!< The number of lines in the framelet. }; public: PushFrameCameraCcdLayout( ); PushFrameCameraCcdLayout( const int ccdId ); virtual ~PushFrameCameraCcdLayout(); bool addKernel(const QString &kernel); int ccdSamples() const; int ccdLines() const; FrameletInfo getFrameInfo(const int &frameId, const QString &name = "") const; private: int m_ccdId; //!< NAIF ID of the CCD Kernels m_kernels; //!< NAIF kernel manager int getSpiceInt(const QString &var, const int index = 0) const; double getSpiceDouble(const QString &var, const int index = 0) const; QString getSpiceString(const QString &var, const int index = 0) const; }; }; #endif
isis/src/base/objs/PushFrameCameraCcdLayout/PushFrameCameraCcdLayout.truth 0 → 100644 +48 −0 Original line number Diff line number Diff line Unit Test for PushFrameCameraCcdLayout::FrameletInfo... Create a default FrameletInfo object framelet ID: -1 framelet name: "" framelet start sample: 0 framelet start line: 0 framelet samples: 0 framelet lines: 0 Create a FrameletInfo object for a specific ID framelet ID: 42 framelet name: "" framelet start sample: 0 framelet start line: 0 framelet samples: 0 framelet lines: 0 Unit Test for PushFrameCameraCcdLayout... Create a default PushFrameCameraCcdLayout Try adding a kernel that does not exist Kernel file loaded? false Create the JunoCam layout Load the JunoCam kernels JunoCam CCD samples: 1648 JunoCam CCD lines: 1200 Get the METHANE filter layout METHANE filter ID: -61504 METHANE filter name: "METHANE" METHANE filter start sample: 1 METHANE filter start line: 291 METHANE filter samples: 1648 METHANE filter lines: 128 Get the METHANE filter layout but give it a different name METHANE filter ID: -61504 METHANE filter name: "methane" METHANE filter start sample: 1 METHANE filter start line: 291 METHANE filter samples: 1648 METHANE filter lines: 128 Attempt to get the layout for a filter that doesn't exist **I/O ERROR** Could not find layout information for framelet [-61509]. **I/O ERROR** Can not find [INS-61509_FILTER_SAMPLES] in text kernels.
isis/src/base/objs/PushFrameCameraCcdLayout/unitTest.cpp 0 → 100644 +113 −0 Original line number Diff line number Diff line /** * @file * * Unless noted otherwise, the portions of Isis written by the USGS are public * domain. See individual third-party library and package descriptions for * intellectual property information,user agreements, and related information. * * Although Isis has been used by the USGS, no warranty, expressed or implied, * is made by the USGS as to the accuracy and functioning of such software * and related material nor shall the fact of distribution constitute any such * warranty, and no responsibility is assumed by the USGS in connection * therewith. * * For additional information, launch * $ISISROOT/doc//documents/Disclaimers/Disclaimers.html in a browser or see * the Privacy & Disclaimers page on the Isis website, * http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on * http://www.usgs.gov/privacy.html. */ #include <QDebug> #include "IException.h" #include "Preference.h" #include "PushFrameCameraCcdLayout.h" using namespace std; using namespace Isis; int main(void) { Preference::Preferences(true); qDebug() << "Unit Test for PushFrameCameraCcdLayout::FrameletInfo..."; qDebug() << ""; try { qDebug() << "Create a default FrameletInfo object"; PushFrameCameraCcdLayout::FrameletInfo defaultInfo; qDebug() << "framelet ID:" << defaultInfo.m_frameId; qDebug() << "framelet name:" << defaultInfo.m_filterName; qDebug() << "framelet start sample:" << defaultInfo.m_startSample; qDebug() << "framelet start line:" << defaultInfo.m_startLine; qDebug() << "framelet samples:" << defaultInfo.m_samples; qDebug() << "framelet lines:" << defaultInfo.m_lines; qDebug() << ""; qDebug() << "Create a FrameletInfo object for a specific ID"; PushFrameCameraCcdLayout::FrameletInfo numberedInfo(42); qDebug() << "framelet ID:" << numberedInfo.m_frameId; qDebug() << "framelet name:" << numberedInfo.m_filterName; qDebug() << "framelet start sample:" << numberedInfo.m_startSample; qDebug() << "framelet start line:" << numberedInfo.m_startLine; qDebug() << "framelet samples:" << numberedInfo.m_samples; qDebug() << "framelet lines:" << numberedInfo.m_lines; qDebug() << ""; } catch(IException &e) { e.print(); } qDebug() << "Unit Test for PushFrameCameraCcdLayout..."; qDebug() << ""; try { qDebug() << "Create a default PushFrameCameraCcdLayout"; PushFrameCameraCcdLayout defaultLayout; qDebug() << "Try adding a kernel that does not exist"; bool loaded = defaultLayout.addKernel("not_a_kernel_file"); qDebug() << "Kernel file loaded?" << loaded; qDebug() << ""; qDebug() << "Create the JunoCam layout"; PushFrameCameraCcdLayout junoLayout(-61500); qDebug() << "Load the JunoCam kernels"; if (!junoLayout.addKernel("$juno/kernels/ik/juno_junocam_v??.ti")) { QString msg = "Failed to load the JunoCam Instrument Kernel."; throw IException(IException::Io, msg, _FILEINFO_); } if (!junoLayout.addKernel("$juno/kernels/iak/junoAddendum???.ti")) { QString msg = "Failed to load the JunoCam Instrument Addendum."; throw IException(IException::Io, msg, _FILEINFO_); } qDebug() << "JunoCam CCD samples:" << junoLayout.ccdSamples(); qDebug() << "JunoCam CCD lines:" << junoLayout.ccdLines(); qDebug() << ""; qDebug() << "Get the METHANE filter layout"; PushFrameCameraCcdLayout::FrameletInfo methane_info = junoLayout.getFrameInfo(-61504); qDebug() << "METHANE filter ID:" << methane_info.m_frameId; qDebug() << "METHANE filter name:" << methane_info.m_filterName; qDebug() << "METHANE filter start sample:" << methane_info.m_startSample; qDebug() << "METHANE filter start line:" << methane_info.m_startLine; qDebug() << "METHANE filter samples:" << methane_info.m_samples; qDebug() << "METHANE filter lines:" << methane_info.m_lines; qDebug() << ""; qDebug() << "Get the METHANE filter layout but give it a different name"; PushFrameCameraCcdLayout::FrameletInfo named_info = junoLayout.getFrameInfo(-61504, "methane"); qDebug() << "METHANE filter ID:" << named_info.m_frameId; qDebug() << "METHANE filter name:" << named_info.m_filterName; qDebug() << "METHANE filter start sample:" << named_info.m_startSample; qDebug() << "METHANE filter start line:" << named_info.m_startLine; qDebug() << "METHANE filter samples:" << named_info.m_samples; qDebug() << "METHANE filter lines:" << named_info.m_lines; qDebug() << ""; qDebug() << "Attempt to get the layout for a filter that doesn't exist"; try { junoLayout.getFrameInfo(-61509); } catch(IException &e) { e.print(); } } catch(IException &e) { e.print(); } }