Unverified Commit 14736ae0 authored by kledmundson's avatar kledmundson Committed by GitHub
Browse files

Merge pull request #90 from dcookastro/LroLidar_Infrastructure

Measure type was added to lro lola ingestion and lidar serialization
parents 4ae97e05 05c9158d
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ namespace Isis {
   * @brief Unserialize LidarData.
   *
   * This method unserializes LidarData from a JSON or binary (QByteArray) file. It will
   * automatically determine if it is JSON or binary formatted date.
   * automatically determine if it is JSON or binary formatted data.
   *
   * @param FileName lidarFile Name of the serialized LidarData file to read.
   * @throws IException::User Throws User exception if it cannot open the file passed.
@@ -237,9 +237,17 @@ namespace Isis {
              serialNumber = measureObject["serialNumber"].toString();
            }

            QString type;
            if (measureObject.contains("type") && measureObject["type"].isString()) {
              type = measureObject["type"].toString();
            }

            ControlMeasure *measure = new ControlMeasure();
            measure->SetCoordinate(sample, line);
            measure->SetCubeSerialNumber(serialNumber);
            measure->SetType(measure->StringToMeasureType(type));
            // std::cout << "InLidarData read type was set to " <<
            //   measure->StringToMeasureType(type) << std::endl;
            lcp->Add(measure);
          }
        }
@@ -301,6 +309,9 @@ namespace Isis {
        measureObject["line"] = measure->GetLine();
        measureObject["sample"] = measure->GetSample();
        measureObject["serialNumber"] = measure->GetCubeSerialNumber();
        measureObject["type"] = measure->GetMeasureTypeString();
        // std::cout << "InLidarData output measure type was set to "
        //           << measure->GetMeasureTypeString() << std::endl;
        measureArray.append(measureObject);

      }
+6 −0
Original line number Diff line number Diff line
@@ -942,6 +942,8 @@ namespace Isis {
      measureType = ControlMeasure::RegisteredPixel;
    else if (str == "registeredsubpixel")
      measureType = ControlMeasure::RegisteredSubPixel;
    else if (str == "lidar")
      measureType = ControlMeasure::Lidar;
    else
      throw IException(IException::Programmer, err, _FILEINFO_);

@@ -979,6 +981,10 @@ namespace Isis {
      case ControlMeasure::RegisteredSubPixel:
        sPrintable = "RegisteredSubPixel";
        break;

      case ControlMeasure::Lidar:
        sPrintable = "Lidar";
        break;
    }

    if (sPrintable == "") {
+3 −0
Original line number Diff line number Diff line
@@ -175,6 +175,7 @@ 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-02-14 Debbie A. Cook - Added Lidar measure type.
   */
  class ControlMeasure : public QObject {

@@ -217,6 +218,8 @@ namespace Isis {
        RegisteredPixel,
        //! Registered to sub-pixel (e.g., pointreg)
        RegisteredSubPixel,
        //! Backprojected from Lidar point to simultaneous image
        Lidar,
      };

      enum Status {
+35 −0
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ void IsisMain() {
              ControlMeasure *measure = new ControlMeasure;
              measure->SetCoordinate(camera->Sample(), camera->Line()); 
              measure->SetCubeSerialNumber(images[j].sn);
              measure->SetType(ControlMeasure::MeasureType::Lidar);
          
              lidarPoint->Add(measure);
            }
@@ -112,6 +113,40 @@ void IsisMain() {
        }
        
      }
      // End Lidar point section
      else {
        // Attempt to back project the point into the image to get other measures
        // Can this be rearranged to avoid duplicating so much code? Maybe just reset
        // the measure type each pass through the loop to Candidate.  If time overlaps,
        // change it to Lidar.
        Cube *cube = cubeMgr.OpenCube(images[j].name.expanded());
        
        if (cube != NULL) {
          
          Camera *camera = cube->camera();
          
          if (camera != NULL) {
            if (camera->SetGround(lat, lon)) {
        
              ControlMeasure *measure = new ControlMeasure;
              measure->SetCoordinate(camera->Sample(), camera->Line()); 
              measure->SetCubeSerialNumber(images[j].sn);
          
              lidarPoint->Add(measure);
            }
          }
          else {
            QString msg = "Unable to create a camera from " + images[j].name.expanded();
            throw IException(IException::Unknown, msg, _FILEINFO_);
          }
        }
        else {
          QString msg = "Unable to open a cube from " + images[j].name.expanded();
          throw IException(IException::Unknown, msg, _FILEINFO_);
        }
      }
      // End Lidar point nonLidar measure section (not simultaneous)
        
    }
    
    if (lidarPoint->GetNumMeasures() <= 0) {