Commit 4a874334 authored by acpaquette's avatar acpaquette
Browse files

Removed a bunch of child class redundent functions

parent dd83af45
Loading
Loading
Loading
Loading
+2 −408
Original line number Diff line number Diff line
@@ -25,23 +25,21 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef INCLUDE_USGSCSM_USGSASTROPROJECTEDLSSENSORMODEL_H_
#define INCLUDE_USGSCSM_USGSASTROPROJECTEDLSSENSORMODEL_H_

#include <CorrelationModel.h>
#include <RasterGM.h>
#include <SettableEllipsoid.h>
#include "Distortion.h"
#include "UsgsAstroLsSensorModel.h"

#include<utility>
#include<memory>
#include<string>
#include<vector>

#include "ale/Distortion.h"
#include "ale/Orientations.h"
#include "ale/States.h"

#include "spdlog/spdlog.h"

#include "UsgsAstroLsSensorModel.h"

class UsgsAstroProjectedLsSensorModel : public UsgsAstroLsSensorModel {
 public:
  // Initializes the class from state data as formatted
@@ -80,11 +78,6 @@ class UsgsAstroProjectedLsSensorModel : public UsgsAstroLsSensorModel {
  static const std::string _SENSOR_MODEL_NAME;  // state date element 0

  static const std::string _STATE_KEYWORD[];
  static const int NUM_PARAM_TYPES;
  static const std::string PARAM_STRING_ALL[];
  static const csm::param::Type PARAM_CHAR_ALL[];
  static const int NUM_PARAMETERS;
  static const std::string PARAMETER_NAME[];

  // Set to default values
  void reset();
@@ -247,272 +240,9 @@ class UsgsAstroProjectedLsSensorModel : public UsgsAstroLsSensorModel {
  //  possible.
  //<

  //---
  // Monoscopic Mensuration
  //---
  virtual csm::ImageCoord getImageStart() const;
  //> This method returns the starting coordinate (line, sample in full
  //  image space pixels) for the imaging operation.  Typically (0,0).
  //<

  virtual csm::ImageVector getImageSize() const;
  //> This method returns the number of lines and samples in full image
  //  space pixels for the imaging operation.
  //
  //  Note that the model might not be valid over the entire imaging
  //  operation.  Use getValidImageRange() to get the valid range of image
  //  coordinates.
  //<

  virtual std::pair<csm::ImageCoord, csm::ImageCoord> getValidImageRange()
      const;
  //> This method returns the minimum and maximum image coordinates
  //  (line, sample in full image space pixels), respectively, over which
  //  the current model is valid.  The image coordinates define opposite
  //  corners of a rectangle whose sides are parallel to the line and
  //  sample axes.
  //
  //  The valid image range does not always match the full image
  //  coverage as returned by the getImageStart and getImageSize methods.
  //
  //  Used in conjunction with the getValidHeightRange method, it is
  //  possible to determine the full range of ground coordinates over which
  //  the model is valid.
  //<

  virtual std::pair<double, double> getValidHeightRange() const;
  //> This method returns the minimum and maximum heights (in meters
  //  relative to WGS-84 ellipsoid), respectively, over which the model is
  //  valid.  For example, a model for an airborne platform might not be
  //  designed to return valid coordinates for heights above the aircraft.
  //
  //  If there are no limits defined for the model, (-99999.0,99999.0)
  //  will be returned.
  //<

  //---
  // Time and Trajectory
  //---

  virtual const csm::CorrelationModel& getCorrelationModel() const;
  //> This method returns a reference to a CorrelationModel.
  //  The CorrelationModel is used to determine the correlation between
  //  the model parameters of different models of the same type.
  //  These correlations are used to establish the "a priori" cross-covariance
  //  between images. While some applications (such as generation of a
  //  replacement sensor model) may wish to call this method directly,
  //  it is reccommended that the inherited method
  //  GeometricModel::getCrossCovarianceMatrix() be called instead.
  //<

  virtual std::vector<double> getUnmodeledCrossCovariance(
      const csm::ImageCoord& pt1, const csm::ImageCoord& pt2) const;
  //> This method returns the 2x2 line and sample cross covariance
  //  (in pixels squared) between the given imagePt1 and imagePt2 for any
  //  model error not accounted for by the model parameters.  The error is
  //  reported as the four terms of a 2x2 matrix, returned as a 4 element
  //  vector.
  //<

  virtual csm::EcefCoord getReferencePoint() const;
  //> This method returns the ground point indicating the general
  //  location of the image.
  //<

  virtual void setReferencePoint(const csm::EcefCoord& groundPt);
  //> This method sets the ground point indicating the general location
  //  of the image.
  //<

  //---
  // Sensor Model Parameters
  //---
  virtual int getNumParameters() const;
  //> This method returns the number of adjustable parameters.
  //<

  virtual std::string getParameterName(int index) const;
  //> This method returns the name for the adjustable parameter
  //  indicated by the given index.
  //
  //  If the index is out of range, a csm::Error may be thrown.
  //<

  virtual std::string getParameterUnits(int index) const;
  //> This method returns the units for the adjustable parameter
  //  indicated by the given index.  This string is intended for human
  //  consumption, not automated analysis.  Preferred unit names are:
  //
  //-    meters                "m"
  //-    centimeters           "cm"
  //-    millimeters           "mm"
  //-    micrometers           "um"
  //-    nanometers            "nm"
  //-    kilometers            "km"
  //-    inches-US             "inch"
  //-    feet-US               "ft"
  //-    statute miles         "mi"
  //-    nautical miles        "nmi"
  //-
  //-    radians               "rad"
  //-    microradians          "urad"
  //-    decimal degrees       "deg"
  //-    arc seconds           "arcsec"
  //-    arc minutes           "arcmin"
  //-
  //-    seconds               "sec"
  //-    minutes               "min"
  //-    hours                 "hr"
  //-
  //-    steradian             "sterad"
  //-
  //-    none                  "unitless"
  //-
  //-    lines per second      "lines/sec"
  //-    samples per second    "samples/sec"
  //-    frames per second     "frames/sec"
  //-
  //-    watts                 "watt"
  //-
  //-    degrees Kelvin        "K"
  //-
  //-    gram                  "g"
  //-    kilogram              "kg"
  //-    pound - US            "lb"
  //-
  //-    hertz                 "hz"
  //-    megahertz             "mhz"
  //-    gigahertz             "ghz"
  //
  //  Units may be combined with "/" or "." to indicate division or
  //  multiplication.  The caret symbol "^" can be used to indicate
  //  exponentiation.  Thus "m.m" and "m^2" are the same and indicate
  //  square meters.  The return "m/sec^2" indicates an acceleration in
  //  meters per second per second.
  //
  //  Derived classes may choose to return additional unit names, as
  //  required.
  //<

  virtual bool hasShareableParameters() const;
  //> This method returns true if there exists at least one adjustable
  //  parameter on the model that is shareable.  See the
  //  isParameterShareable() method.  This method should return false if
  //  all calls to isParameterShareable() return false.
  //<

  virtual bool isParameterShareable(int index) const;
  //> This method returns a flag to indicate whether or not the adjustable
  //  parameter referenced by index is shareable across models.
  //<

  virtual csm::SharingCriteria getParameterSharingCriteria(int index) const;
  //> This method returns characteristics to indicate how the adjustable
  //  parameter referenced by index is shareable across models.
  //<

  virtual double getParameterValue(int index) const;
  //> This method returns the value of the adjustable parameter
  //  referenced by the given index.
  //<

  virtual void setParameterValue(int index, double value);
  //> This method sets the value for the adjustable parameter referenced by
  //  the given index.
  //<

  virtual csm::param::Type getParameterType(int index) const;
  //> This method returns the type of the adjustable parameter
  //  referenced by the given index.
  //<

  virtual void setParameterType(int index, csm::param::Type pType);
  //> This method sets the type of the adjustable parameter
  //  reference by the given index.
  //<

  virtual std::shared_ptr<spdlog::logger> getLogger();
  virtual void setLogger(std::string logName);

  //---
  // Uncertainty Propagation
  //---
  virtual double getParameterCovariance(int index1, int index2) const;
  //> This method returns the covariance between the parameters
  //  referenced by index1 and index2.  Variance of a single parameter
  //  is indicated by specifying the samve value for index1 and index2.
  //<

  virtual void setParameterCovariance(int index1, int index2,
                                      double covariance);
  //> This method is used to set the covariance between the parameters
  //  referenced by index1 and index2.  Variance of a single parameter
  //  is indicated by specifying the samve value for index1 and index2.
  //<

  //---
  // Error Correction
  //---
  virtual int getNumGeometricCorrectionSwitches() const;
  //> This method returns the number of geometric correction switches
  //  implemented for the current model.
  //<

  virtual std::string getGeometricCorrectionName(int index) const;
  //> This method returns the name for the geometric correction switch
  //  referenced by the given index.
  //<

  virtual void setGeometricCorrectionSwitch(int index, bool value,
                                            csm::param::Type pType);
  //> This method is used to enable/disable the geometric correction switch
  //  referenced by the given index.
  //<

  virtual bool getGeometricCorrectionSwitch(int index) const;
  //> This method returns the value of the geometric correction switch
  //  referenced by the given index.
  //<

  virtual std::vector<double> getCrossCovarianceMatrix(
      const csm::GeometricModel& comparisonModel,
      csm::param::Set pSet = csm::param::VALID,
      const csm::GeometricModel::GeometricModelList& otherModels =
          csm::GeometricModel::GeometricModelList()) const;
  //> This method returns a matrix containing the elements of the error
  //  cross covariance between this model and a given second model
  //  (comparisonModel).  The set of cross covariance elements returned is
  //  indicated by pSet, which, by default, is all VALID parameters.
  //
  //  If comparisonModel is the same as this model, the covariance for
  //  this model will be returned.  It is equivalent to calling
  //  getParameterCovariance() for the same set of elements.  Note that
  //  even if the cross covariance for a particular model type is always
  //  zero, the covariance for this model must still be supported.
  //
  //  The otherModels list contains all of the models in the current
  //  photogrammetric process; some cross-covariance implementations are
  //  influenced by other models.  It can be omitted if it is not needed
  //  by any models being used.
  //
  //  The returned vector will logically be a two-dimensional matrix of
  //  covariances, though for simplicity it is stored in a one-dimensional
  //  vector (STL has no two-dimensional structure).  The height (number of
  //  rows) of this matrix is the number of parameters on the current model,
  //  and the width (number of columns) is the number of parameters on
  //  the comparison model.  Thus, the covariance between p1 on this model
  //  and p2 on the comparison model is found in index (N*p1 + p2)
  //  in the returned vector.  N is the size of the vector returned by
  //  getParameterSetIndices() on the comparison model for the given pSet).
  //
  //  Note that cross covariance is often zero.  Non-zero cross covariance
  //  can occur for models created from the same sensor (or different
  //  sensors on the same platform).  While cross covariances can result
  //  from a bundle adjustment involving multiple models, no mechanism
  //  currently exists within csm to "set" the cross covariance between
  //  models.  It should thus be assumed that the returned cross covariance
  //  reflects the "un-adjusted" state of the models.
  //<

  virtual csm::Version getVersion() const;
  //> This method returns the version of the model code.  The Version
@@ -531,142 +261,6 @@ class UsgsAstroProjectedLsSensorModel : public UsgsAstroLsSensorModel {
  //  model created from the same sensor's support data would produce
  //  different pedigrees for each case.
  //<

  //---
  // Basic collection information
  //---
  virtual std::string getImageIdentifier() const;
  //> This method returns an identifier to uniquely indicate the imaging
  //  operation associated with this model.
  //  This is the primary identifier of the model.
  //
  //  This method may return an empty string if the ID is unknown.
  //<

  virtual void setImageIdentifier(const std::string& imageId,
                                  csm::WarningList* warnings = NULL);
  //> This method sets an identifier to uniquely indicate the imaging
  //  operation associated with this model.  Typically used for models
  //  whose initialization does not produce an adequate identifier.
  //
  //  If a non-NULL warnings argument is received, it will be populated
  //  as applicable.
  //<

  virtual std::string getSensorIdentifier() const;
  //> This method returns an identifier to indicate the specific sensor
  //  that was used to acquire the image.  This ID must be unique among
  //  sensors for a given model name.  It is used to determine parameter
  //  correlation and sharing.  Equivalent to camera or mission ID.
  //
  //  This method may return an empty string if the sensor ID is unknown.
  //<

  virtual std::string getPlatformIdentifier() const;
  //> This method returns an identifier to indicate the specific platform
  //  that was used to acquire the image.  This ID must unique among
  //  platforms for a given model name.  It is used to determine parameter
  //  correlation sharing.  Equivalent to vehicle or aircraft tail number.
  //
  //  This method may return an empty string if the platform ID is unknown.
  //<

  virtual std::string getCollectionIdentifier() const;
  //> This method returns an identifer to indicate a collection activity
  //  common to a set of images.  This ID must be unique among collection
  //  activities for a given model name.  It is used to determine parameter
  //  correlation and sharing.
  //<

  virtual std::string getTrajectoryIdentifier() const;
  //> This method returns an identifier to indicate a trajectory common
  //  to a set of images.  This ID must be unique among trajectories
  //  for a given model name.  It is used to determine parameter
  //  correlation and sharing.
  //<

  virtual std::string getSensorType() const;
  //> This method returns a description of the sensor type (EO, IR, SAR,
  //  etc).  See csm.h for a list of common types.  Should return
  //  CSM_SENSOR_TYPE_UNKNOWN if the sensor type is unknown.
  //<

  virtual std::string getSensorMode() const;
  //> This method returns a description of the sensor mode (FRAME,
  //  PUSHBROOM, SPOT, SCAN, etc).  See csm.h for a list of common modes.
  //  Should return CSM_SENSOR_MODE_UNKNOWN if the sensor mode is unknown.
  //<

  virtual std::string getReferenceDateAndTime() const;
  //> This method returns an approximate date and time at which the
  //  image was taken.  The returned string follows the ISO 8601 standard.
  //
  //-    Precision   Format           Example
  //-    year        yyyy             "1961"
  //-    month       yyyymm           "196104"
  //-    day         yyyymmdd         "19610420"
  //-    hour        yyyymmddThh      "19610420T20"
  //-    minute      yyyymmddThhmm    "19610420T2000"
  //-    second      yyyymmddThhmmss  "19610420T200000"
  //<

  //---
  // Sensor Model State
  //---
  // virtual std::string setModelState(std::string stateString) const;
  //> This method returns a string containing the data to exactly recreate
  //  the current model.  It can be used to restore this model to a
  //  previous state with the replaceModelState method or create a new
  //  model object that is identical to this model.
  //  The string could potentially be saved to a file for later use.
  //  An empty string is returned if it is not possible to save the
  //  current state.
  //<

 private:

  // Some state data values not found in the support data require a
  // sensor model in order to be set.
  void updateState();

  // This method returns the value of the specified adjustable parameter
  // with the associated adjustment added in.
  double getValue(int index, const std::vector<double>& adjustments) const;

  void reconstructSensorDistortion(double& focalX, double& focalY,
                                   const double& desiredPrecision) const;

  // Computes the LOS correction due to light aberration
  void lightAberrationCorr(const double& vx, const double& vy, const double& vz,
                           const double& xl, const double& yl, const double& zl,
                           double& dxl, double& dyl, double& dzl) const;

  // Intersects a LOS at a specified height above the ellipsoid.
  void losEllipsoidIntersect(const double& height, const double& xc,
                             const double& yc, const double& zc,
                             const double& xl, const double& yl,
                             const double& zl, double& x, double& y, double& z,
                             double& achieved_precision,
                             const double& desired_precision,
                             csm::WarningList* warnings = NULL) const;

  // Computes the imaging locus that would view a ground point at a specific
  // time. Computationally, this is the opposite of losToEcf.
  std::vector<double> computeDetectorView(
      const double& time,                 // The time to use the EO at
      const csm::EcefCoord& groundPoint,  // The ground coordinate
      const std::vector<double>& adj)      // Parameter Adjustments for partials
      const;

  csm::NoCorrelationModel _no_corr_model;  // A way to report no correlation
                                           // between images is supported
  std::vector<double> _no_adjustment;  // A vector of zeros indicating no internal adjustment

  // Store here the projective approximation of the sensor model
  std::vector<double> m_projTransCoeffs;

  // Flag indicating if an initial approximation is used
  bool m_useApproxInitTrans;
};

#endif  // INCLUDE_USGSCSM_USGSASTROPROJECTEDLSSENSORMODEL_H_
+5 −404

File changed.

Preview size limit exceeded, changes collapsed.