Loading isis/scripts/isis3Startup.csh +5 −19 Original line number Diff line number Diff line Loading @@ -22,19 +22,11 @@ # MAR 12 2009 - Christopher Austin - Changed the way ISIS3TESTDATE is set # to prevent its setting for outside groups and default # to "/usgs/cpkgs/isis3/testData" # SEP 08 2017 - Christopher Combs - Removed setting of QT_PLUGIN_PATH as # an environment variable. Fixes #4617 #_VER $Id: isis3Startup.csh,v 1.5 2010/03/16 19:40:22 ehyer Exp $ #_END ################################################################################ # Check parameters set QTPLUGINPATH = "true" foreach arg ($argv) if ( "$arg" == "-noqtpluginpath" ) then set QTPLUGINPATH = "false" else echo "Uknown argument $arg" exit 1 endif end # Establish a platform switch variable set Platform = `uname -s` Loading Loading @@ -69,14 +61,8 @@ else endif endif # Create QT_PLUGIN_PATH env variable if ($QTPLUGINPATH == "true") then setenv QT_PLUGIN_PATH "$ISISROOT/3rdParty/plugins" endif unset Platform if ( -f $ISISROOT/scripts/tabcomplete.csh ) then source $ISISROOT/scripts/tabcomplete.csh; endif isis/scripts/isis3Startup.py +1 −3 Original line number Diff line number Diff line Loading @@ -36,7 +36,5 @@ def setisis(): else: os.environ['PATH'] = "%s:%s/bin" % (os.environ['PATH'], ISISROOT) os.environ['QT_PLUGIN_PATH'] = "%s/3rdParty/plugins" % (ISISROOT) if __name__ == "__main__": setisis() isis/src/base/objs/PushFrameCameraCcdLayout/PushFrameCameraCcdLayout.h +5 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ namespace Isis { * @internal * @history 2017-08-11 Kris Becker - Original Version * @history 2017-08-21 Jesse Mapel - Added documentation * @history 2017-09-15 Jesse Mapel - Added constructor from field values */ struct FrameletInfo { FrameletInfo() : m_frameId(-1), m_filterName(), Loading @@ -63,6 +64,10 @@ namespace Isis { FrameletInfo(const int frameid) : m_frameId(frameid), m_filterName(), m_startSample(0), m_startLine(0), m_samples(0), m_lines(0) { } FrameletInfo(const int frameid, QString filterName, int startSample, int startLine, int samples, int lines) : m_frameId(frameid), m_filterName(filterName), m_startSample(startSample), m_startLine(startLine), m_samples(samples), m_lines(lines) { } 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. Loading isis/src/docsys/documents/Credits/Credits.xml +39 −41 Original line number Diff line number Diff line Loading @@ -20,58 +20,54 @@ <tr> <td>Brent Archinal</td> <td>Jeannie Walldren-Backer</td> <td>Kris Becker</td> <td>Tammy Becker</td> <td>Kristin Berry</td> </tr> <tr> <td>Kristin Berry</td> <td>Christopher Ryan Combs</td> <td>Debbie Cook</td> <td>Kenneth Edmundson</td> <td>Robin Fergason</td> </tr> <tr> <td>Robin Fergason</td> <td>Lisa Gaddis</td> <td>Paul Geissler</td> <td>Adam Goins</td> <td>Trent Hare</td> </tr> <tr> <td>Marjorie Hahn</td> <td>Trent Hare</td> <td>Ken Herkenhoff</td> <td>Ian Humphrey</td> </tr> <tr> <td>Chris Isbell</td> <td>Laszlo Keszthelyi</td> <td>Randy Kirk</td> <td>Jesse Mapel</td> </tr> <tr> <td>Randy Kirk</td> <td>Jesse Mapel</td> <td>Moses Milazzo</td> <td>Cole Neubauer</td> <td>Adam Paquette</td> <td>Bonnie Redding</td> </tr> <tr> <td>Adam Paquette</td> <td>Bonnie Redding</td> <td>Janet Richie</td> <td>Kelvin Rodriguez</td> <td>Makayla Shepherd</td> <td>Jac Shinaman</td> </tr> <tr> <td>Makayla Shepherd</td> <td>Jac Shinaman</td> <td>Stuart Sides</td> <td>Larry Soderblom</td> <td>Summer Stapleton</td> <td>Robert Sucharski</td> </tr> <tr> <td>Summer Stapleton</td> <td>Robert Sucharski</td> <td>Tracie Sucharski</td> <td>Tim Titus</td> <td>Lynn Weller</td> <td>Kaj Williams</td> </tr> <tr> <td>Lynn Weller</td> <td>Kaj Williams</td> <td>Tyler Wilson</td> </tr> </table> Loading @@ -94,89 +90,91 @@ </tr> <tr> <td>Joni Bauers</td> <td>Kris Becker</td> <td>Glenn Bennett</td> <td>John Bonn</td> <td>MacKenzie Boyd</td> </tr> <tr> <td>MacKenzie Boyd</td> <td>Sasha Brownsberger</td> <td>Pat Chavez</td> <td>Way Christensen</td> <td>Jim Crawforth</td> </tr> <tr> <td>Jim Crawforth</td> <td>Sean Crosby</td> <td>Norm Cushing</td> <td>Leah Dahmer</td> <td>Jacob Danton</td> </tr> <tr> <td>Jacob Danton</td> <td>Drew Davidson</td> <td>Phil Davis</td> <td>Kay Edwards</td> <td>Mathew Eis</td> </tr> <tr> <td>Mathew Eis</td> <td>Eric Eliason</td> <td>Patrica Eliason</td> <td>Brendan George</td> <td>Verna Gregg</td> </tr> <tr> <td>Verna Gregg</td> <td>Marjorie Hahn</td> <td>Rae Harvey</td> <td>Noah Hilt</td> <td>Annie Howington-Kraus</td> <td>Eric Hyer</td> </tr> <tr> <td>Annie Howington-Kraus</td> <td>Eric Hyer</td> <td>Jeff Johnson</td> <td>Tom Kelleher</td> <td>Hugh Kieffer</td> <td>Steven Koechle</td> </tr> <tr> <td>Hugh Kieffer</td> <td>Steven Koechle</td> <td>Steven Lambright</td> <td>Ella Lee</td> <td>Brian Lipkowitz</td> <td>Mike Martin</td> </tr> <tr> <td>Brian Lipkowitz</td> <td>Mike Martin</td> <td>Phillip Martinez</td> <td>Jim Mathews</td> <td>Jason Mawhinney</td> <td>Alfred McEwen</td> </tr> <tr> <td>Jason Mawhinney</td> <td>Alfred McEwen</td> <td>Dennis McMacken</td> <td>David Miller</td> <td>Elizabeth Miller-Ribelin</td> <td>Kimberly Oyama</td> </tr> <tr> <td>Elizabeth Miller-Ribelin</td> <td>Kimberly Oyama</td> <td>Wendy Parker</td> <td>Sharmila Prasad</td> <td>Jai Rideout</td> <td>Mark Robinson</td> </tr> <tr> <td>Jai Rideout</td> <td>Mark Robinson</td> <td>Curtis Rose</td> <td>Ra'ad Saleh</td> <td>Bill Scott</td> <td>Kim Sides</td> </tr> <tr> <td>Bill Scott</td> <td>Kim Sides</td> <td>Deborah Lee Soltesz</td> <td>Jim Stapleton</td> <td>Andrew Stebenne</td> <td>Driss Takir</td> </tr> <tr> <td>Andrew Stebenne</td> <td>Driss Takir</td> <td>Orrin Thomas</td> <td>Teal Thompson</td> <td>Jim Torson</td> <td>Robert Wallace</td> </tr> <tr> <td>Jim Torson</td> <td>Robert Wallace</td> <td>Aaron Young</td> </tr> </table> Loading Loading @@ -257,7 +255,7 @@ <history> <change date="2003-03-25" name="Jeff Anderson">Original document</change> <change date="2013-12-11" name="Ella Mae Lee">Updated document</change> <change date="2017-08-14" name="Summer Stapleton">Updated document</change> <change date="2017-09-18" name="Summer Stapleton">Updated document</change> </history> Loading isis/src/osirisrex/objs/OsirisRexOcamsCamera/OsirisRexDistortionMap.cpp 0 → 100644 +263 −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 <QDebug> #include <QtGlobal> #include <QtMath> #include "NaifStatus.h" #include "OsirisRexDistortionMap.h" #include "CameraFocalPlaneMap.h" namespace Isis { /** * OSIRIS REx Camera distortion map constructor * * Create a camera distortion map for OSIRIS REx's. * * This class maps between distorted and undistorted * focal plane x/y's. The default mapping is the identity, that is, * the focal plane x/y and undistorted focal plane x/y will be * identical. * * @param parent the parent camera that will use this distortion map * @param zDirection the direction of the focal plane Z-axis * (either 1 or -1) * */ OsirisRexDistortionMap::OsirisRexDistortionMap(Camera *parent, double zDirection) : CameraDistortionMap(parent, zDirection) { m_detectorOriginSample = p_camera->FocalPlaneMap()->DetectorSampleOrigin(); m_detectorOriginLine = p_camera->FocalPlaneMap()->DetectorLineOrigin(); m_pixelPitch = p_camera->PixelPitch(); } /** * Default Destructor */ OsirisRexDistortionMap::~OsirisRexDistortionMap() { } /** * Load distortion coefficients and center-of-distortion for OCAMS * * This method loads the distortion coefficients from the instrument * kernel. OCAMS's coefficients in the NAIF instrument kernel are * expected to be in one of the following forms: * * @code * INS-64361_OD_K_FILTER = (2.21E-05, 1.71E-04, 5.96E-05, 0.00E+00, 0.00E+00) * INS-64361_OD_CENTER_FILTER = (486.2, 450.3) * @endcode * * Or if the distortion is not filter-dependent: * * @code * INS-64361_OD_K = (2.21E-05, 1.71E-04, 5.96E-05, 0.00E+00, 0.00E+00) * INS-64361_OD_CENTER = (486.2, 450.3) * @endcode * * * @param naifIkCode Code to search for in instrument kernel */ void OsirisRexDistortionMap::SetDistortion(int naifIkCode, QString filter="UNKNOWN") { // Load distortion coefficients, including filter if we have it. QString odkkey; if (filter.toUpper().compare("UNKNOWN") == 0) { odkkey = "INS" + toString(naifIkCode) + "_OD_K"; } else { odkkey = "INS" + toString(naifIkCode) + "_OD_K_" + filter.toUpper(); } try { for (int i = 0; i < 5; ++i) { p_odk.push_back(p_camera->Spice::getDouble(odkkey, i)); } } catch (IException &e) { // This means that this is an older image without a filter provided // don't update p_odk, we will not apply the distortion in this case m_distortionOriginSample = -1; m_distortionOriginLine = -1; return; } // Load center-of-distortion coordinates, including filter if we have it QString odcenterkey; if (filter.toUpper().compare("UNKNOWN") == 0) { odcenterkey = "INS" + toString(naifIkCode) + "_OD_CENTER"; } else { odcenterkey = "INS" + toString(naifIkCode) + "_OD_CENTER_" + filter.toUpper(); } m_distortionOriginSample = p_camera->Spice::getDouble(odcenterkey, 0); m_distortionOriginLine = p_camera->Spice::getDouble(odcenterkey, 1); } /** * Compute undistorted focal plane x/y * * Compute undistorted focal plane x/y given a distorted focal plane x/y. * After calling this method, you can obtain the undistorted * x/y via the UndistortedFocalPlaneX and UndistortedFocalPlaneY methods * * @param dx distorted focal plane x in millimeters * @param dy distorted focal plane y in millimeters * * @return if the conversion was successful */ bool OsirisRexDistortionMap::SetFocalPlane(double dx, double dy) { p_focalPlaneX = dx; p_focalPlaneY = dy; // Only apply the distortion if we have the correct number of coefficients if ((p_odk.size() < 2)) { p_undistortedFocalPlaneX = dx; p_undistortedFocalPlaneY = dy; return false; } double x0 = (m_distortionOriginLine - m_detectorOriginSample) * m_pixelPitch; double y0 = (m_distortionOriginSample - m_detectorOriginLine) * m_pixelPitch; double xt = dx; double yt = dy; double xx, yy, r, rr, rrr, rrrr; double xdistortion, ydistortion; double xdistorted, ydistorted; double xprevious, yprevious; double drOverR; xprevious = 1000000.0; yprevious = 1000000.0; double tolerance = 0.000001; bool bConverged = false; // Iterating to introduce distortion... // We stop when the difference between distorted coordinates // in successive iterations is at or below the given tolerance. for(int i = 0; i < 50; i++) { xx = (xt-x0) * (xt-x0); yy = (yt-y0) * (yt-y0); rr = xx + yy; r = qSqrt(rr); rrr = rr * r; rrrr = rr * rr; drOverR = p_odk[0] + p_odk[1]*r + p_odk[2]*rr + p_odk[3]*rrr + p_odk[4]*rrrr; // distortion at the current point location xdistortion = drOverR * (xt-x0); ydistortion = drOverR * (yt-y0); // updated image coordinates xt = dx - xdistortion; yt = dy - ydistortion; xdistorted = xt; ydistorted = yt; // check for convergence if((fabs(xt - xprevious) <= tolerance) && (fabs(yt - yprevious) <= tolerance)) { bConverged = true; break; } xprevious = xt; yprevious = yt; } if(bConverged) { p_undistortedFocalPlaneX = xdistorted; p_undistortedFocalPlaneY = ydistorted; } return bConverged; } /** * Compute distorted focal plane x/y * * Compute distorted focal plane x/y given an undistorted focal plane x/y. * * After calling this method, you can obtain the distorted x/y via the * FocalPlaneX and FocalPlaneY methods * * @param ux undistorted focal plane x in millimeters * @param uy undistorted focal plane y in millimeters * * @return if the conversion was successful * @see SetDistortion */ bool OsirisRexDistortionMap::SetUndistortedFocalPlane(const double ux, const double uy) { p_undistortedFocalPlaneX = ux; p_undistortedFocalPlaneY = uy; // Only apply the distortion if we have the correct number of coefficients. if ((p_odk.size() < 2)) { p_focalPlaneX = ux; p_focalPlaneY = uy; return false; } double x0 = (m_distortionOriginLine - m_detectorOriginSample) * m_pixelPitch; double y0 = (m_distortionOriginSample - m_detectorOriginLine) * m_pixelPitch; // Compute the distance from the focal plane center. If we are // close to the center then no distortion is required double x = ux; double y = uy; double r = qSqrt(((x-x0) * (x-x0)) + ((y - y0) * (y-y0))); if (r <= 1.0E-6) { p_focalPlaneX = ux; p_focalPlaneY = uy; return true; } double r2 = r*r; double r3 = r2*r; double r4 = r2*r2; double drOverR = p_odk[0] + p_odk[1]*r + p_odk[2]*r2 + p_odk[3]*r3 + p_odk[4]*r4; p_focalPlaneX = x + drOverR * (x-x0); p_focalPlaneY = y + drOverR * (y-y0); return true; } } Loading
isis/scripts/isis3Startup.csh +5 −19 Original line number Diff line number Diff line Loading @@ -22,19 +22,11 @@ # MAR 12 2009 - Christopher Austin - Changed the way ISIS3TESTDATE is set # to prevent its setting for outside groups and default # to "/usgs/cpkgs/isis3/testData" # SEP 08 2017 - Christopher Combs - Removed setting of QT_PLUGIN_PATH as # an environment variable. Fixes #4617 #_VER $Id: isis3Startup.csh,v 1.5 2010/03/16 19:40:22 ehyer Exp $ #_END ################################################################################ # Check parameters set QTPLUGINPATH = "true" foreach arg ($argv) if ( "$arg" == "-noqtpluginpath" ) then set QTPLUGINPATH = "false" else echo "Uknown argument $arg" exit 1 endif end # Establish a platform switch variable set Platform = `uname -s` Loading Loading @@ -69,14 +61,8 @@ else endif endif # Create QT_PLUGIN_PATH env variable if ($QTPLUGINPATH == "true") then setenv QT_PLUGIN_PATH "$ISISROOT/3rdParty/plugins" endif unset Platform if ( -f $ISISROOT/scripts/tabcomplete.csh ) then source $ISISROOT/scripts/tabcomplete.csh; endif
isis/scripts/isis3Startup.py +1 −3 Original line number Diff line number Diff line Loading @@ -36,7 +36,5 @@ def setisis(): else: os.environ['PATH'] = "%s:%s/bin" % (os.environ['PATH'], ISISROOT) os.environ['QT_PLUGIN_PATH'] = "%s/3rdParty/plugins" % (ISISROOT) if __name__ == "__main__": setisis()
isis/src/base/objs/PushFrameCameraCcdLayout/PushFrameCameraCcdLayout.h +5 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ namespace Isis { * @internal * @history 2017-08-11 Kris Becker - Original Version * @history 2017-08-21 Jesse Mapel - Added documentation * @history 2017-09-15 Jesse Mapel - Added constructor from field values */ struct FrameletInfo { FrameletInfo() : m_frameId(-1), m_filterName(), Loading @@ -63,6 +64,10 @@ namespace Isis { FrameletInfo(const int frameid) : m_frameId(frameid), m_filterName(), m_startSample(0), m_startLine(0), m_samples(0), m_lines(0) { } FrameletInfo(const int frameid, QString filterName, int startSample, int startLine, int samples, int lines) : m_frameId(frameid), m_filterName(filterName), m_startSample(startSample), m_startLine(startLine), m_samples(samples), m_lines(lines) { } 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. Loading
isis/src/docsys/documents/Credits/Credits.xml +39 −41 Original line number Diff line number Diff line Loading @@ -20,58 +20,54 @@ <tr> <td>Brent Archinal</td> <td>Jeannie Walldren-Backer</td> <td>Kris Becker</td> <td>Tammy Becker</td> <td>Kristin Berry</td> </tr> <tr> <td>Kristin Berry</td> <td>Christopher Ryan Combs</td> <td>Debbie Cook</td> <td>Kenneth Edmundson</td> <td>Robin Fergason</td> </tr> <tr> <td>Robin Fergason</td> <td>Lisa Gaddis</td> <td>Paul Geissler</td> <td>Adam Goins</td> <td>Trent Hare</td> </tr> <tr> <td>Marjorie Hahn</td> <td>Trent Hare</td> <td>Ken Herkenhoff</td> <td>Ian Humphrey</td> </tr> <tr> <td>Chris Isbell</td> <td>Laszlo Keszthelyi</td> <td>Randy Kirk</td> <td>Jesse Mapel</td> </tr> <tr> <td>Randy Kirk</td> <td>Jesse Mapel</td> <td>Moses Milazzo</td> <td>Cole Neubauer</td> <td>Adam Paquette</td> <td>Bonnie Redding</td> </tr> <tr> <td>Adam Paquette</td> <td>Bonnie Redding</td> <td>Janet Richie</td> <td>Kelvin Rodriguez</td> <td>Makayla Shepherd</td> <td>Jac Shinaman</td> </tr> <tr> <td>Makayla Shepherd</td> <td>Jac Shinaman</td> <td>Stuart Sides</td> <td>Larry Soderblom</td> <td>Summer Stapleton</td> <td>Robert Sucharski</td> </tr> <tr> <td>Summer Stapleton</td> <td>Robert Sucharski</td> <td>Tracie Sucharski</td> <td>Tim Titus</td> <td>Lynn Weller</td> <td>Kaj Williams</td> </tr> <tr> <td>Lynn Weller</td> <td>Kaj Williams</td> <td>Tyler Wilson</td> </tr> </table> Loading @@ -94,89 +90,91 @@ </tr> <tr> <td>Joni Bauers</td> <td>Kris Becker</td> <td>Glenn Bennett</td> <td>John Bonn</td> <td>MacKenzie Boyd</td> </tr> <tr> <td>MacKenzie Boyd</td> <td>Sasha Brownsberger</td> <td>Pat Chavez</td> <td>Way Christensen</td> <td>Jim Crawforth</td> </tr> <tr> <td>Jim Crawforth</td> <td>Sean Crosby</td> <td>Norm Cushing</td> <td>Leah Dahmer</td> <td>Jacob Danton</td> </tr> <tr> <td>Jacob Danton</td> <td>Drew Davidson</td> <td>Phil Davis</td> <td>Kay Edwards</td> <td>Mathew Eis</td> </tr> <tr> <td>Mathew Eis</td> <td>Eric Eliason</td> <td>Patrica Eliason</td> <td>Brendan George</td> <td>Verna Gregg</td> </tr> <tr> <td>Verna Gregg</td> <td>Marjorie Hahn</td> <td>Rae Harvey</td> <td>Noah Hilt</td> <td>Annie Howington-Kraus</td> <td>Eric Hyer</td> </tr> <tr> <td>Annie Howington-Kraus</td> <td>Eric Hyer</td> <td>Jeff Johnson</td> <td>Tom Kelleher</td> <td>Hugh Kieffer</td> <td>Steven Koechle</td> </tr> <tr> <td>Hugh Kieffer</td> <td>Steven Koechle</td> <td>Steven Lambright</td> <td>Ella Lee</td> <td>Brian Lipkowitz</td> <td>Mike Martin</td> </tr> <tr> <td>Brian Lipkowitz</td> <td>Mike Martin</td> <td>Phillip Martinez</td> <td>Jim Mathews</td> <td>Jason Mawhinney</td> <td>Alfred McEwen</td> </tr> <tr> <td>Jason Mawhinney</td> <td>Alfred McEwen</td> <td>Dennis McMacken</td> <td>David Miller</td> <td>Elizabeth Miller-Ribelin</td> <td>Kimberly Oyama</td> </tr> <tr> <td>Elizabeth Miller-Ribelin</td> <td>Kimberly Oyama</td> <td>Wendy Parker</td> <td>Sharmila Prasad</td> <td>Jai Rideout</td> <td>Mark Robinson</td> </tr> <tr> <td>Jai Rideout</td> <td>Mark Robinson</td> <td>Curtis Rose</td> <td>Ra'ad Saleh</td> <td>Bill Scott</td> <td>Kim Sides</td> </tr> <tr> <td>Bill Scott</td> <td>Kim Sides</td> <td>Deborah Lee Soltesz</td> <td>Jim Stapleton</td> <td>Andrew Stebenne</td> <td>Driss Takir</td> </tr> <tr> <td>Andrew Stebenne</td> <td>Driss Takir</td> <td>Orrin Thomas</td> <td>Teal Thompson</td> <td>Jim Torson</td> <td>Robert Wallace</td> </tr> <tr> <td>Jim Torson</td> <td>Robert Wallace</td> <td>Aaron Young</td> </tr> </table> Loading Loading @@ -257,7 +255,7 @@ <history> <change date="2003-03-25" name="Jeff Anderson">Original document</change> <change date="2013-12-11" name="Ella Mae Lee">Updated document</change> <change date="2017-08-14" name="Summer Stapleton">Updated document</change> <change date="2017-09-18" name="Summer Stapleton">Updated document</change> </history> Loading
isis/src/osirisrex/objs/OsirisRexOcamsCamera/OsirisRexDistortionMap.cpp 0 → 100644 +263 −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 <QDebug> #include <QtGlobal> #include <QtMath> #include "NaifStatus.h" #include "OsirisRexDistortionMap.h" #include "CameraFocalPlaneMap.h" namespace Isis { /** * OSIRIS REx Camera distortion map constructor * * Create a camera distortion map for OSIRIS REx's. * * This class maps between distorted and undistorted * focal plane x/y's. The default mapping is the identity, that is, * the focal plane x/y and undistorted focal plane x/y will be * identical. * * @param parent the parent camera that will use this distortion map * @param zDirection the direction of the focal plane Z-axis * (either 1 or -1) * */ OsirisRexDistortionMap::OsirisRexDistortionMap(Camera *parent, double zDirection) : CameraDistortionMap(parent, zDirection) { m_detectorOriginSample = p_camera->FocalPlaneMap()->DetectorSampleOrigin(); m_detectorOriginLine = p_camera->FocalPlaneMap()->DetectorLineOrigin(); m_pixelPitch = p_camera->PixelPitch(); } /** * Default Destructor */ OsirisRexDistortionMap::~OsirisRexDistortionMap() { } /** * Load distortion coefficients and center-of-distortion for OCAMS * * This method loads the distortion coefficients from the instrument * kernel. OCAMS's coefficients in the NAIF instrument kernel are * expected to be in one of the following forms: * * @code * INS-64361_OD_K_FILTER = (2.21E-05, 1.71E-04, 5.96E-05, 0.00E+00, 0.00E+00) * INS-64361_OD_CENTER_FILTER = (486.2, 450.3) * @endcode * * Or if the distortion is not filter-dependent: * * @code * INS-64361_OD_K = (2.21E-05, 1.71E-04, 5.96E-05, 0.00E+00, 0.00E+00) * INS-64361_OD_CENTER = (486.2, 450.3) * @endcode * * * @param naifIkCode Code to search for in instrument kernel */ void OsirisRexDistortionMap::SetDistortion(int naifIkCode, QString filter="UNKNOWN") { // Load distortion coefficients, including filter if we have it. QString odkkey; if (filter.toUpper().compare("UNKNOWN") == 0) { odkkey = "INS" + toString(naifIkCode) + "_OD_K"; } else { odkkey = "INS" + toString(naifIkCode) + "_OD_K_" + filter.toUpper(); } try { for (int i = 0; i < 5; ++i) { p_odk.push_back(p_camera->Spice::getDouble(odkkey, i)); } } catch (IException &e) { // This means that this is an older image without a filter provided // don't update p_odk, we will not apply the distortion in this case m_distortionOriginSample = -1; m_distortionOriginLine = -1; return; } // Load center-of-distortion coordinates, including filter if we have it QString odcenterkey; if (filter.toUpper().compare("UNKNOWN") == 0) { odcenterkey = "INS" + toString(naifIkCode) + "_OD_CENTER"; } else { odcenterkey = "INS" + toString(naifIkCode) + "_OD_CENTER_" + filter.toUpper(); } m_distortionOriginSample = p_camera->Spice::getDouble(odcenterkey, 0); m_distortionOriginLine = p_camera->Spice::getDouble(odcenterkey, 1); } /** * Compute undistorted focal plane x/y * * Compute undistorted focal plane x/y given a distorted focal plane x/y. * After calling this method, you can obtain the undistorted * x/y via the UndistortedFocalPlaneX and UndistortedFocalPlaneY methods * * @param dx distorted focal plane x in millimeters * @param dy distorted focal plane y in millimeters * * @return if the conversion was successful */ bool OsirisRexDistortionMap::SetFocalPlane(double dx, double dy) { p_focalPlaneX = dx; p_focalPlaneY = dy; // Only apply the distortion if we have the correct number of coefficients if ((p_odk.size() < 2)) { p_undistortedFocalPlaneX = dx; p_undistortedFocalPlaneY = dy; return false; } double x0 = (m_distortionOriginLine - m_detectorOriginSample) * m_pixelPitch; double y0 = (m_distortionOriginSample - m_detectorOriginLine) * m_pixelPitch; double xt = dx; double yt = dy; double xx, yy, r, rr, rrr, rrrr; double xdistortion, ydistortion; double xdistorted, ydistorted; double xprevious, yprevious; double drOverR; xprevious = 1000000.0; yprevious = 1000000.0; double tolerance = 0.000001; bool bConverged = false; // Iterating to introduce distortion... // We stop when the difference between distorted coordinates // in successive iterations is at or below the given tolerance. for(int i = 0; i < 50; i++) { xx = (xt-x0) * (xt-x0); yy = (yt-y0) * (yt-y0); rr = xx + yy; r = qSqrt(rr); rrr = rr * r; rrrr = rr * rr; drOverR = p_odk[0] + p_odk[1]*r + p_odk[2]*rr + p_odk[3]*rrr + p_odk[4]*rrrr; // distortion at the current point location xdistortion = drOverR * (xt-x0); ydistortion = drOverR * (yt-y0); // updated image coordinates xt = dx - xdistortion; yt = dy - ydistortion; xdistorted = xt; ydistorted = yt; // check for convergence if((fabs(xt - xprevious) <= tolerance) && (fabs(yt - yprevious) <= tolerance)) { bConverged = true; break; } xprevious = xt; yprevious = yt; } if(bConverged) { p_undistortedFocalPlaneX = xdistorted; p_undistortedFocalPlaneY = ydistorted; } return bConverged; } /** * Compute distorted focal plane x/y * * Compute distorted focal plane x/y given an undistorted focal plane x/y. * * After calling this method, you can obtain the distorted x/y via the * FocalPlaneX and FocalPlaneY methods * * @param ux undistorted focal plane x in millimeters * @param uy undistorted focal plane y in millimeters * * @return if the conversion was successful * @see SetDistortion */ bool OsirisRexDistortionMap::SetUndistortedFocalPlane(const double ux, const double uy) { p_undistortedFocalPlaneX = ux; p_undistortedFocalPlaneY = uy; // Only apply the distortion if we have the correct number of coefficients. if ((p_odk.size() < 2)) { p_focalPlaneX = ux; p_focalPlaneY = uy; return false; } double x0 = (m_distortionOriginLine - m_detectorOriginSample) * m_pixelPitch; double y0 = (m_distortionOriginSample - m_detectorOriginLine) * m_pixelPitch; // Compute the distance from the focal plane center. If we are // close to the center then no distortion is required double x = ux; double y = uy; double r = qSqrt(((x-x0) * (x-x0)) + ((y - y0) * (y-y0))); if (r <= 1.0E-6) { p_focalPlaneX = ux; p_focalPlaneY = uy; return true; } double r2 = r*r; double r3 = r2*r; double r4 = r2*r2; double drOverR = p_odk[0] + p_odk[1]*r + p_odk[2]*r2 + p_odk[3]*r3 + p_odk[4]*r4; p_focalPlaneX = x + drOverR * (x-x0); p_focalPlaneY = y + drOverR * (y-y0); return true; } }