Loading include/usgscsm/UsgsAstroProjectedLsSensorModel.h +3 −63 Original line number Diff line number Diff line Loading @@ -70,61 +70,8 @@ class UsgsAstroProjectedLsSensorModel : public UsgsAstroLsSensorModel { csm::WarningList* list); // State data elements; std::string m_imageIdentifier; std::string m_sensorName; int m_nLines; int m_nSamples; int m_platformFlag; std::vector<double> m_intTimeLines; std::vector<double> m_intTimeStartTimes; std::vector<double> m_intTimes; double m_startingEphemerisTime; double m_centerEphemerisTime; double m_detectorSampleSumming; double m_detectorLineSumming; double m_startingDetectorSample; double m_startingDetectorLine; int m_ikCode; double m_focalLength; double m_zDirection; DistortionType m_distortionType; std::vector<double> m_opticalDistCoeffs; double m_iTransS[3]; double m_iTransL[3]; double m_detectorSampleOrigin; double m_detectorLineOrigin; double m_mountingMatrix[9]; double m_majorAxis; double m_minorAxis; std::string m_referenceDateAndTime; std::string m_platformIdentifier; std::string m_sensorIdentifier; std::string m_trajectoryIdentifier; std::string m_collectionIdentifier; double m_refElevation; double m_minElevation; double m_maxElevation; double m_dtEphem; double m_t0Ephem; double m_dtQuat; double m_t0Quat; int m_numPositions; int m_numQuaternions; std::vector<double> m_positions; std::vector<double> m_velocities; std::vector<double> m_quaternions; std::vector<double> m_currentParameterValue; std::vector<csm::param::Type> m_parameterType; csm::EcefCoord m_referencePointXyz; double m_gsd; double m_flyingHeight; double m_halfSwath; double m_halfTime; std::vector<double> m_covariance; int m_imageFlipFlag; std::vector<double> m_sunPosition; std::vector<double> m_sunVelocity; std::vector<double> m_geoTransform; std::string m_projString; // Define logging pointer and file content std::shared_ptr<spdlog::logger> m_logger = spdlog::get("usgscsm_logger"); Loading Loading @@ -720,13 +667,6 @@ class UsgsAstroProjectedLsSensorModel : public UsgsAstroLsSensorModel { const std::vector<double>& adj, double attCorr[9]) const; virtual csm::EcefVector getSunPosition(const double imageTime) const; //> This method returns the position of the sun at the time the image point // was recorded. If multiple sun positions are available, the method uses // lagrange interpolation. If one sun position and at least one sun velocity // are available, then the position is calculated using linear extrapolation. // If only one sun position is available, then that value is returned. private: // Some state data values not found in the support data require a Loading Loading @@ -790,4 +730,4 @@ class UsgsAstroProjectedLsSensorModel : public UsgsAstroLsSensorModel { bool m_useApproxInitTrans; }; #endif // INCLUDE_USGSCSM_UsgsAstroProjectedLsSensorModel_H_ #endif // INCLUDE_USGSCSM_USGSASTROPROJECTEDLSSENSORMODEL_H_ include/usgscsm/Utilities.h +8 −0 Original line number Diff line number Diff line Loading @@ -199,4 +199,12 @@ void applyRotationTranslationToXyzVec(ale::Rotation const& r, ale::Vec3d const& // to a calendar time string, such as 2000-01-01T00:16:40Z. std::string ephemTimeToCalendarTime(double ephemTime); std::vector<double> getGeoTransform(nlohmann::json isd); std::string getProjectionString(nlohmann::json isd); std::vector<double> pixelToMeter(double line, double sample, std::vector<double> geoTransform); std::vector<double> meterToPixel(double meter_x, double meter_y, std::vector<double> geoTransform); #endif // INCLUDE_USGSCSM_UTILITIES_H_ src/UsgsAstroLsSensorModel.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -2735,7 +2735,7 @@ std::string UsgsAstroLsSensorModel::constructStateFromIsd( } throw csm::Error(csm::Error::SENSOR_MODEL_NOT_CONSTRUCTIBLE, "ISD is invalid for creating the sensor model.", "UsgsAstroFrameSensorModel::constructStateFromIsd"); "UsgsAstroLsSensorModel::constructStateFromIsd"); } // The state data will still be updated when a sensor model is created since Loading src/UsgsAstroProjectedLsSensorModel.cpp +133 −687 File changed.Preview size limit exceeded, changes collapsed. Show changes src/Utilities.cpp +42 −0 Original line number Diff line number Diff line Loading @@ -1528,3 +1528,45 @@ std::string ephemTimeToCalendarTime(double ephemTime) { buffer[21] = '\0'; return buffer; } std::vector<double> getGeoTransform(json isd) { std::vector<double> transform = {}; try { transform = isd.at("geo_transform").get<std::vector<double>>(); } catch (std::exception &e) { std::string originalError = e.what(); std::string msg = "Could not parse the geo_transform. ERROR: " + originalError + isd.dump(); throw std::runtime_error(msg); } return transform; } std::string getProjectionString(json isd) { std::string projection_string = ""; try { projection_string = isd.at("proj_string"); } catch (...) { throw std::runtime_error("Could not parse the projection string."); } return projection_string; } std::vector<double> pixelToMeter(double line, double sample, std::vector<double> geoTransform) { double meter_x = (sample * geoTransform[1]) + geoTransform[0]; double meter_y = (line * geoTransform[5]) + geoTransform[3]; meter_x += geoTransform[1] * 0.5; meter_y += geoTransform[5] * 0.5; return {meter_y, meter_x}; } std::vector<double> meterToPixel(double meter_x, double meter_y, std::vector<double> geoTransform) { meter_x -= geoTransform[1] * 0.5; meter_y -= geoTransform[5] * 0.5; double sample = (meter_x - geoTransform[0]) / geoTransform[1]; double line = (meter_y - geoTransform[3]) / geoTransform[5]; return {line, sample}; } No newline at end of file Loading
include/usgscsm/UsgsAstroProjectedLsSensorModel.h +3 −63 Original line number Diff line number Diff line Loading @@ -70,61 +70,8 @@ class UsgsAstroProjectedLsSensorModel : public UsgsAstroLsSensorModel { csm::WarningList* list); // State data elements; std::string m_imageIdentifier; std::string m_sensorName; int m_nLines; int m_nSamples; int m_platformFlag; std::vector<double> m_intTimeLines; std::vector<double> m_intTimeStartTimes; std::vector<double> m_intTimes; double m_startingEphemerisTime; double m_centerEphemerisTime; double m_detectorSampleSumming; double m_detectorLineSumming; double m_startingDetectorSample; double m_startingDetectorLine; int m_ikCode; double m_focalLength; double m_zDirection; DistortionType m_distortionType; std::vector<double> m_opticalDistCoeffs; double m_iTransS[3]; double m_iTransL[3]; double m_detectorSampleOrigin; double m_detectorLineOrigin; double m_mountingMatrix[9]; double m_majorAxis; double m_minorAxis; std::string m_referenceDateAndTime; std::string m_platformIdentifier; std::string m_sensorIdentifier; std::string m_trajectoryIdentifier; std::string m_collectionIdentifier; double m_refElevation; double m_minElevation; double m_maxElevation; double m_dtEphem; double m_t0Ephem; double m_dtQuat; double m_t0Quat; int m_numPositions; int m_numQuaternions; std::vector<double> m_positions; std::vector<double> m_velocities; std::vector<double> m_quaternions; std::vector<double> m_currentParameterValue; std::vector<csm::param::Type> m_parameterType; csm::EcefCoord m_referencePointXyz; double m_gsd; double m_flyingHeight; double m_halfSwath; double m_halfTime; std::vector<double> m_covariance; int m_imageFlipFlag; std::vector<double> m_sunPosition; std::vector<double> m_sunVelocity; std::vector<double> m_geoTransform; std::string m_projString; // Define logging pointer and file content std::shared_ptr<spdlog::logger> m_logger = spdlog::get("usgscsm_logger"); Loading Loading @@ -720,13 +667,6 @@ class UsgsAstroProjectedLsSensorModel : public UsgsAstroLsSensorModel { const std::vector<double>& adj, double attCorr[9]) const; virtual csm::EcefVector getSunPosition(const double imageTime) const; //> This method returns the position of the sun at the time the image point // was recorded. If multiple sun positions are available, the method uses // lagrange interpolation. If one sun position and at least one sun velocity // are available, then the position is calculated using linear extrapolation. // If only one sun position is available, then that value is returned. private: // Some state data values not found in the support data require a Loading Loading @@ -790,4 +730,4 @@ class UsgsAstroProjectedLsSensorModel : public UsgsAstroLsSensorModel { bool m_useApproxInitTrans; }; #endif // INCLUDE_USGSCSM_UsgsAstroProjectedLsSensorModel_H_ #endif // INCLUDE_USGSCSM_USGSASTROPROJECTEDLSSENSORMODEL_H_
include/usgscsm/Utilities.h +8 −0 Original line number Diff line number Diff line Loading @@ -199,4 +199,12 @@ void applyRotationTranslationToXyzVec(ale::Rotation const& r, ale::Vec3d const& // to a calendar time string, such as 2000-01-01T00:16:40Z. std::string ephemTimeToCalendarTime(double ephemTime); std::vector<double> getGeoTransform(nlohmann::json isd); std::string getProjectionString(nlohmann::json isd); std::vector<double> pixelToMeter(double line, double sample, std::vector<double> geoTransform); std::vector<double> meterToPixel(double meter_x, double meter_y, std::vector<double> geoTransform); #endif // INCLUDE_USGSCSM_UTILITIES_H_
src/UsgsAstroLsSensorModel.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -2735,7 +2735,7 @@ std::string UsgsAstroLsSensorModel::constructStateFromIsd( } throw csm::Error(csm::Error::SENSOR_MODEL_NOT_CONSTRUCTIBLE, "ISD is invalid for creating the sensor model.", "UsgsAstroFrameSensorModel::constructStateFromIsd"); "UsgsAstroLsSensorModel::constructStateFromIsd"); } // The state data will still be updated when a sensor model is created since Loading
src/UsgsAstroProjectedLsSensorModel.cpp +133 −687 File changed.Preview size limit exceeded, changes collapsed. Show changes
src/Utilities.cpp +42 −0 Original line number Diff line number Diff line Loading @@ -1528,3 +1528,45 @@ std::string ephemTimeToCalendarTime(double ephemTime) { buffer[21] = '\0'; return buffer; } std::vector<double> getGeoTransform(json isd) { std::vector<double> transform = {}; try { transform = isd.at("geo_transform").get<std::vector<double>>(); } catch (std::exception &e) { std::string originalError = e.what(); std::string msg = "Could not parse the geo_transform. ERROR: " + originalError + isd.dump(); throw std::runtime_error(msg); } return transform; } std::string getProjectionString(json isd) { std::string projection_string = ""; try { projection_string = isd.at("proj_string"); } catch (...) { throw std::runtime_error("Could not parse the projection string."); } return projection_string; } std::vector<double> pixelToMeter(double line, double sample, std::vector<double> geoTransform) { double meter_x = (sample * geoTransform[1]) + geoTransform[0]; double meter_y = (line * geoTransform[5]) + geoTransform[3]; meter_x += geoTransform[1] * 0.5; meter_y += geoTransform[5] * 0.5; return {meter_y, meter_x}; } std::vector<double> meterToPixel(double meter_x, double meter_y, std::vector<double> geoTransform) { meter_x -= geoTransform[1] * 0.5; meter_y -= geoTransform[5] * 0.5; double sample = (meter_x - geoTransform[0]) / geoTransform[1]; double line = (meter_y - geoTransform[3]) / geoTransform[5]; return {line, sample}; } No newline at end of file