Unverified Commit a5d1041e authored by dcookastro's avatar dcookastro Committed by GitHub
Browse files

Merge pull request #236 from kledmundson/LroLidar_Infrastructure

removed ComputeResidualsMillimeters method and moved computation of f…
parents c435ddea 9bd344fc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -159,8 +159,8 @@ namespace Isis {
   * class value for m_lookJ is set by this method.
   *
   * @param point Surface point (ground position) 
   * @param cudx [out] Pointer to computed undistored x focal plane coordinate
   * @param cudy [out] Pointer to computed undistored y focal plane coordinate
   * @param cudx [out] Pointer to computed undistorted x focal plane coordinate
   * @param cudy [out] Pointer to computed undistorted y focal plane coordinate
   *
   * @return @b bool If conversion was successful
   */
+6 −2
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ namespace Isis {
   *                           apriori variance/covariance matrix, adjusted point coordinates,
   *                           and adjusted variance/covariance matrix to the read and
   *                           write methods. Ref #5343.
   *   @history 2018-06-14 Ken Edmundson - Added typedef for QSharedPointer to LidarData object.
   *
   */
  class LidarData {
@@ -71,5 +72,8 @@ namespace Isis {
      QVector<Isis::Camera *> p_cameraList; //!< Vector of image number to camera
  };

};
  // typedefs
  //! Definition for a shared pointer to a LidarData object.
  typedef QSharedPointer<LidarData> LidarDataQsp;
}
#endif
+26 −67
Original line number Diff line number Diff line
@@ -1001,6 +1001,9 @@ namespace Isis {
   * @history 2012-01-18 Debbie A. Cook, Revised to call
   *                            ComputeResidualsMillimeters() to avoid
   *                            duplication of code
   * @history 2018-06-13 Debbie A. Cook, Ken Edmundson, Removed method ComputeResidualsMillimeters()
   *                            and the call to it that was in this method. Added computation of
   *                            focal plane computedx and computedy here.
   */
  ControlPoint::Status ControlPoint::ComputeResiduals() {
    if (IsIgnored()) {
@@ -1033,7 +1036,26 @@ namespace Isis {
      // measurement sample/line to get the computed sample/line.  This must be
      // done manually because the camera will compute a new time for line scanners,
      // instead of using the measured time.
      ComputeResiduals_Millimeters();
//      ComputeResiduals_Millimeters();
      double cudx = 0.0;
      double cudy = 0.0;

      // Map the lat/lon/radius of the control point through the Spice of the
      // measurement sample/line to get the computed undistorted focal plane
      // coordinates (mm if not radar).  This works for radar too because in
      // the undistorted focal plane, y has not been set to 0 (set to 0 when
      // going to distorted focal plane or ground range in this case), so we
      // can hold the Spice to calculate residuals in undistorted focal plane
      // coordinates.
      if (cam->GetCameraType() != 0) {  // no need to call setimage for framing camera
        cam->SetImage(m->GetSample(), m->GetLine());
      }

      cam->GroundMap()->GetXY(GetAdjustedSurfacePoint(), &cudx, &cudy);
      // double mudx = m->GetFocalPlaneMeasuredX();
      // double mudy = m->GetFocalPlaneMeasuredY();

      m->SetFocalPlaneComputed(cudx, cudy);

      if (cam->GetCameraType()  !=  Isis::Camera::Radar) {

@@ -1041,7 +1063,7 @@ namespace Isis {
        // but some of the camera maps could fail.  One that won't is the
        // FocalPlaneMap which takes x/y to detector s/l.  We will bypass the
        // distortion map and have residuals in undistorted pixels.
        if (!fpmap->SetFocalPlane(m->GetFocalPlaneComputedX(), m->GetFocalPlaneComputedY())) {
        if (!fpmap->SetFocalPlane(cudx, cudy)) {
          QString msg = "Sanity check #1 for ControlPoint [" + GetId() +
              "], ControlMeasure [" + m->GetCubeSerialNumber() + "]";
          throw IException(IException::Programmer, msg, _FILEINFO_);
@@ -1142,71 +1164,6 @@ namespace Isis {
    return Success;
  }

  /**
   * This method computes the residuals for a point.
   *
   * @history 2008-07-17  Tracie Sucharski -  Added ptid and measure serial
   *                            number to the unable to map to surface error.
   * @history 2010-12-06  Tracie Sucharski - Renamed from ComputeErrors
   * @history 2011-03-19  Debbie A. Cook - Changed to use the Camera classes
   *                            like ComputeResiduals and get the correct
   *                            calculations for each camera type.
   * @history 2011-03-24 Debbie A. Cook - Removed IsMeasured check since it
   *                            was really checking for Candidate measures.
   * @history 2012-01-18 Debbie A. Cook - Made radar case the same as
   *                            other instruments and removed incorrect
   *                            call to SetResidual, which was setting
   *                            focal plane residuals in x and y instead
   *                            of image residuals in sample and line.
   */

  ControlPoint::Status ControlPoint::ComputeResiduals_Millimeters() {
    if (IsIgnored()) {
      return Failure;
    }

    PointModified();

    // Loop for each measure to compute the error
    QList<QString> keys = measures->keys();

    for (int j = 0; j < keys.size(); j++) {
      ControlMeasure *m = (*measures)[keys[j]];
      if (m->IsIgnored()) {
        continue;
      }
      // The following lines actually check for Candidate measures
      // Commented out on 2011-03-24 by DAC
//       if (!m->IsMeasured()) {
//         continue;

      // TODO:  Should we use crater diameter?
      Camera *cam = m->Camera();
      double cudx, cudy;

      // Map the lat/lon/radius of the control point through the Spice of the
      // measurement sample/line to get the computed undistorted focal plane
      // coordinates (mm if not radar).  This works for radar too because in
      // the undistorted focal plane, y has not been set to 0 (set to 0 when
      // going to distorted focal plane or ground range in this case), so we
      // can hold the Spice to calculate residuals in undistorted focal plane
      // coordinates.
      if (cam->GetCameraType() != 0) {  // no need to call setimage for framing camera
        cam->SetImage(m->GetSample(), m->GetLine());
      }

      cam->GroundMap()->GetXY(GetAdjustedSurfacePoint(), &cudx, &cudy);
      // double mudx = m->GetFocalPlaneMeasuredX();
      // double mudy = m->GetFocalPlaneMeasuredY();

      m->SetFocalPlaneComputed(cudx, cudy);

      // This is wrong.  The stored residual is in pixels (sample,line), not x and y
      // m->SetResidual(mudx - cudx, mudy - cudy);
    }

    return Success;
  }

  QString ControlPoint::GetChooserName() const {
    if (chooserName != "") {
@@ -1217,11 +1174,13 @@ namespace Isis {
    }
  }


  //! Returns true if the choosername is not empty.
  bool ControlPoint::HasChooserName() const {
    return !chooserName.isEmpty();
  }


  //! Returns true if the datetime is not empty.
  bool ControlPoint::HasDateTime() const {
    return !dateTime.isEmpty();
+3 −1
Original line number Diff line number Diff line
@@ -343,6 +343,9 @@ namespace Isis {
   *   @history 2018-01-05 Adam Goins - Added HasDateTime() and HasChooserName() methods to allow
   *                           to allow the value of these variables to be read without being
   *                           overriden if they're empty. (Getters override if they're empty).
   *   @history 2018-06-13 Debbie A. Cook, Ken Edmundson, Removed method
   *                           ComputeResidualsMillimeters() and added computation of focal plane
   *                           computedx and computedy to ComputeResiduals method.
   */
  class ControlPoint : public QObject {

@@ -492,7 +495,6 @@ namespace Isis {

      Status ComputeApriori();
      Status ComputeResiduals();
      Status ComputeResiduals_Millimeters();

      SurfacePoint GetAdjustedSurfacePoint() const;

+0 −1
Original line number Diff line number Diff line
@@ -61,7 +61,6 @@ namespace Isis {
    double range();
    double sigmaRange();
    iTime time();
//    QList < QString > snSimultaneous() const;
    QStringList snSimultaneous() const;
    bool isSimultaneous(QString serialNumber);