Commit 299e0694 authored by Ken Edmundson's avatar Ken Edmundson
Browse files

lots of stuff related to Bundle Lidar

parent 356b3e05
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -32,6 +32,10 @@ ui_*.h
# ignore all files created by squish coco
*csmes

# ignore all files created by qtcreator
*.pro
*.pro.user

print.prt

*/3rdParty/*
+79 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
#include <QTextStream>

#include "Angle.h"
#include "CameraFactory.h"
#include "Distance.h"
#include "FileName.h"
#include "IException.h"
@@ -21,6 +22,8 @@
#include "Latitude.h"
#include "LidarControlPoint.h"
#include "Longitude.h"
#include "Progress.h"
#include "SerialNumberList.h"
#include "SurfacePoint.h"


@@ -54,6 +57,82 @@ namespace Isis {
    return m_points.values();
  }

  /**
   * Creates the ControlNet's image camera's based on the list of Serial Numbers
   *
   * @param list The list of Serial Numbers
   * @param progress A pointer to the progress of creating the cameras
   * @throws Isis::iException::System - "Unable to create camera
   *        for cube file"
   * @throws Isis::iException::User - "Control point measure does
   *        not have a cube with a matching serial number"
   * @internal
   *   @history 2009-01-06 Jeannie Walldren - Fixed typo in
   *            exception output.
   *   @history 2016-10-13 Ian Humphrey - Added initial check to see if cameras have already been
   *                           set, and immediately return if yes. References #4293.
   */
  void LidarData::SetImages(SerialNumberList &list, Progress *progress) {
    // First check if cameras have already been setup via another SetImages call
    if (p_cameraList.size() > 0) {
      return;
    }
    // Prep for reporting progress
    if (progress != NULL) {
      progress->SetText("Setting input images...");
      progress->SetMaximumSteps(list.size());
      progress->CheckStatus();
    }
    // Open the camera for all the images in the serial number list
    for (int i = 0; i < list.size(); i++) {
      QString serialNumber = list.serialNumber(i);
      QString filename = list.fileName(i);
      Cube cube(filename, "r");

      try {
        Isis::Camera *cam = CameraFactory::Create(cube);
        p_cameraMap[serialNumber] = cam;
        p_cameraValidMeasuresMap[serialNumber] = 0;
        p_cameraRejectedMeasuresMap[serialNumber] = 0;
        p_cameraList.push_back(cam);
      }
      catch (IException &e) {
        QString msg = "Unable to create camera for cube file ";
        msg += filename;
        throw IException(e, IException::Unknown, msg, _FILEINFO_);
      }

      if (progress != NULL)
        progress->CheckStatus();
    }

    // Loop through all measures and set the camera
    QHashIterator< QString, QSharedPointer<LidarControlPoint> > p(m_points);
    while (p.hasNext()) {
      p.next();
      LidarControlPointQsp curPoint = p.value();

      QList< QString > serialNums = curPoint->getCubeSerialNumbers();
      for (int m = 0; m < serialNums.size(); m++) {
        ControlMeasure *curMeasure = (*curPoint)[serialNums[m]];

        QString serialNumber = curMeasure->GetCubeSerialNumber();
        if (list.hasSerialNumber(serialNumber)) {
          curMeasure->SetCamera(p_cameraMap[serialNumber]);

          // increment number of measures for this image (camera)
          if (!curMeasure->IsIgnored()) p_cameraValidMeasuresMap[serialNumber]++;
        }
        else {
          IString msg = "Control point [" + curPoint->GetId() +
              "], measure [" + curMeasure->GetCubeSerialNumber() +
              "] does not have a cube with a matching serial number";
          throw IException(IException::User, msg, _FILEINFO_);
        }
      }
    }
  }


  /**
   * @brief Unserialize LidarData.
+12 −1
Original line number Diff line number Diff line
@@ -3,15 +3,19 @@

#include <QHash>
#include <QList>
#include <QMap>
#include <QPointer>
#include <QString>
#include <QVector>

class QJsonObject;

namespace Isis {

  class Camera;
  class FileName;
  class LidarControlPoint;
  class Progress;
  class SerialNumberList;

  /**
   * LidarData class.
@@ -42,6 +46,8 @@ namespace Isis {
      void insert(QSharedPointer<LidarControlPoint> point);
      QList< QSharedPointer<LidarControlPoint> > points() const;

      void SetImages(SerialNumberList &list, Progress *progress = 0);

      // Serialization methods or LidarData
      void read(FileName);
      void write(FileName, Format);
@@ -50,6 +56,11 @@ namespace Isis {
      /** Hash of the LidarControlPoints this class contains. */
      QHash<QString, QSharedPointer <LidarControlPoint> > m_points;

      QMap<QString, Isis::Camera *> p_cameraMap; //!< A map from serialnumber to camera
      QMap<QString, int> p_cameraValidMeasuresMap; //!< A map from serialnumber to #measures
      QMap<QString, int> p_cameraRejectedMeasuresMap; //!< A map from serialnumber to
      //!  #rejected measures
      QVector<Isis::Camera *> p_cameraList; //!< Vector of image number to camera
  };

};
+63 −0
Original line number Diff line number Diff line
# Ignore all
*

# Unignore all with extensions
!*.*

# Unignore all dirs
!*/

# Unignore Makefiles, and TestPreferences
!Makefile
!TestPreferences
!*/3rdParty/Makefile

*.cub
*.o
*.so
*.so.*
*.a
moc_*
*.pb.*
*.lbl
*.img
*.kate-swp
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
*.moc
ui_*.h
*.html

# ignore all files created by squish coco
*csmes

# ignore all files created by qtcreator
*.pro
*.pro.user

print.prt

*/3rdParty/*
*/inc/*
*/bin/*
*/lib/*
*/tsts/*/input/*
*/tsts/*/truth/*
*/tsts/*/output/*

# ignore symbolic links in this directory
BundleAdjust.cpp
BundleAdjust.h
BundleControlPoint.cpp
BundleControlPoint.h
BundleLidarControlPoint.cpp
BundleLidarControlPoint.h
ControlMeasure.cpp
ControlMeasure.h
ControlPoint.cpp
ControlPoint.h
LidarControlPoint.cpp
LidarControlPoint.h
LidarData.cpp
LidarData.h
+1 −0
Original line number Diff line number Diff line
../../objs/BundleConstraint/BundleLidarRangeConstraint.cpp
 No newline at end of file
Loading