Commit 0764662d authored by Kelvin Rodriguez's avatar Kelvin Rodriguez Committed by Jesse Mapel
Browse files

ISD object without Rotation and State support. (#315)

* version tick

* added headers

* added isd

* updated cmakelists

* added header

* removed print from cmakelists

* changed rotation case

* moved isd test to single module

* added in line isd

* Added failure tests. Commented out distortion tests.

* added more tests to increase coverage

* changed header file naming convention

* updated source files and CMakeLists.txt

* renamed isd_tests.cpp -> IsdTests.cpp

* Updated tests based on comments.

* Capitalized enum values.

* added a few more asserts to check array size
parent 52003c59
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -21,13 +21,17 @@ find_package(Python REQUIRED COMPONENTS Development)
find_package(nlohmann_json REQUIRED)

# Library setup
set(ALE_BUILD_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/")
set(ALE_INSTALL_INCLUDE_DIR "include/ale")
add_library(ale SHARED
            ${CMAKE_CURRENT_SOURCE_DIR}/src/ale.cpp
            ${CMAKE_CURRENT_SOURCE_DIR}/src/Rotation.cpp)
set(ALE_BUILD_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/")
            ${CMAKE_CURRENT_SOURCE_DIR}/src/Rotation.cpp
            ${CMAKE_CURRENT_SOURCE_DIR}/src/Isd.cpp
            ${CMAKE_CURRENT_SOURCE_DIR}/src/Util.cpp)
set(ALE_HEADERS "${ALE_BUILD_INCLUDE_DIR}/ale.h"
                "${ALE_BUILD_INCLUDE_DIR}/Rotation.h")
set(ALE_INSTALL_INCLUDE_DIR "include/ale")
                "${ALE_BUILD_INCLUDE_DIR}/Rotation.h"
                "${ALE_BUILD_INCLUDE_DIR}/Isd.h"
                "${ALE_BUILD_INCLUDE_DIR}/Util.h")
set_target_properties(ale PROPERTIES
                      VERSION   ${PROJECT_VERSION}
                      SOVERSION 0)

include/Distortion.h

0 → 100644
+14 −0
Original line number Diff line number Diff line
#ifndef ALE_DISTORTION_H
#define ALE_DISTORTION_H

namespace ale {
  enum DistortionType {
    TRANSVERSE,
    RADIAL,
    KAGUYALISM,
    DAWNFC,
    LROLROCNAC
  };
}

#endif

include/Isd.h

0 → 100644
+78 −0
Original line number Diff line number Diff line
#ifndef ALE_ISD_H
#define ALE_ISD_H

#include <string>
#include <vector>
#include <map>

#include "Util.h"
#include "Distortion.h"

//#include "Rotation.h"
//#include "State.h"

namespace ale {

  using json = nlohmann::json;

  class Isd {
    public:

    Isd(std::string);

    std::string usgscsm_name_model;
    std::string name_platform;
    std::string image_id;
    std::string name_sensor;

    double semi_major;
    double semi_minor;

    double detector_sample_summing;
    double detector_line_summing;

    double focal_length;
    double focal_uncertainty;

    double detector_center_line;
    double detector_center_sample;

    // should probably be ints
    double starting_detector_line;
    double starting_detector_sample;

    std::vector<double> focal2pixel_line;
    std::vector<double> focal2pixel_sample;

    // maybe change
    DistortionType distortion_model;
    std::vector<double> distortion_coefficients;

    unsigned int image_lines;
    unsigned int image_samples;

    double max_reference_height;
    double min_reference_height;

    std::vector<std::vector<double>> line_scan_rate;

    double starting_ephemeris_time;
    double center_ephemeris_time;

    double t0_ephemeris_time;
    double dt_ephemeris_time;

    double t0_quaternions;
    double dt_quaternions;

    json naif_keywords;

    //Positions sensor_pos;
    //Positions sun_pos;

    //Rotation sensor_orientation;
    //Rotation body_orientaion;
  };
}

#endif

include/Util.h

0 → 100644
+46 −0
Original line number Diff line number Diff line
#ifndef ALE_UTIL_H
#define ALE_UTIL_H

#include <string>
#include <nlohmann/json.hpp>

#include "Isd.h"
#include "Distortion.h"

namespace ale {
  using json = nlohmann::json;

  double getMinHeight(nlohmann::json isd);
  std::string getSensorModelName(json isd);
  std::string getImageId(json isd);
  std::string getSensorName(json isd);
  std::string getPlatformName(json isd);
  std::string getLogFile(nlohmann::json isd);
  int getTotalLines(json isd);
  int getTotalSamples(json isd);
  double getStartingTime(json isd);
  double getCenterTime(json isd);
  std::vector<std::vector<double>> getLineScanRate(json isd);
  int getSampleSumming(json isd);
  int getLineSumming(json isd);
  double getFocalLength(json isd);
  double getFocalLengthUncertainty(json isd);
  std::vector<double> getFocal2PixelLines(json isd);
  std::vector<double> getFocal2PixelSamples(json isd);
  double getDetectorCenterLine(json isd);
  double getDetectorCenterSample(json isd);
  double getDetectorStartingLine(json isd);
  double getDetectorStartingSample(json isd);
  double getMinHeight(json isd);
  double getMaxHeight(json isd);
  double getSemiMajorRadius(json isd);
  double getSemiMinorRadius(json isd);
  DistortionType getDistortionModel(json isd);
  std::vector<double> getDistortionCoeffs(json isd);
  std::vector<double> getSunPositions(json isd);
  std::vector<double> getSensorPositions(json isd);
  std::vector<double> getSensorVelocities(json isd);
  std::vector<double> getSensorOrientations(json isd);
}

#endif
+2 −3
Original line number Diff line number Diff line
#ifndef ALE_INCLUDE_ALE_H
#define ALE_INCLUDE_ALE_H

#include <nlohmann/json.hpp>
#include <string>
#include <vector>

@@ -15,9 +14,9 @@ namespace ale {
  /// Interpolation enum for defining different methods of interpolation
  enum interpolation {
    /// Interpolate using linear interpolation
    linear,
    LINEAR,
    /// Interpolate using spline interpolation
    spline
    SPLINE
  };

  /**
Loading