diff --git a/include/genericls/UsgsAstroLsISD.h b/include/genericls/UsgsAstroLsISD.h index 6c17d3ef2e4b9d79992f9e9d1f97c15398f3c4a3..f5c75834578b25d4336132e2277638cbdcbf7b9e 100644 --- a/include/genericls/UsgsAstroLsISD.h +++ b/include/genericls/UsgsAstroLsISD.h @@ -1,201 +1,154 @@ -//---------------------------------------------------------------------------- -// -// UNCLASSIFIED -// -// Copyright © 1989-2017 BAE Systems Information and Electronic Systems Integration Inc. -// ALL RIGHTS RESERVED -// Use of this software product is governed by the terms of a license -// agreement. The license agreement is found in the installation directory. -// -// For support, please visit http://www.baesystems.com/gxp -// -// FILENAME: UsgsAstroLsISD.h -// -// DESCRIPTION: -// -// Image Support Data (ISD) to build the Astro Line Scanner sensor model. -// The ISD format is defined by the imagery provider. A few common formats -// include name/value pairs, XML, NITF TREs, and GeoTiff tags. -// -// This ISD is formatted as a list of name/value pairs. The order of the -// list generally does not matter, except that the length of a vector needs -// to be read in before the vector itself. Extra data in the support data -// file will be ignored. -// -// There is data describing the ellipsoid that can optionally be in a -// seperate file. This is to support legacy data, but is not encouraged. -// -// For the Astro LS sensor model there is a close relationship between the -// ISD and the State data. This is not always the case. So, it is best to -// seperate the ISD parsing (done here), the translation of ISD to state -// data (done in the plugin), and the instantiation of the sensor model -// from state data (done in the sensor model). -// -// SOFTWARE HISTORY: -// -// Date Author Comment -// ----------- ---------- ------- -// 16-Oct-2017 BAE Systems Initial Release -// -//############################################################################# -#ifndef __USGS_ASTRO_LINE_SCANNER_ISD_H -#define __USGS_ASTRO_LINE_SCANNER_ISD_H - -#include <vector> -#include <string> - -#include <csm/csm.h> -#include <csm/Isd.h> -#include <csm/SettableEllipsoid.h> - -class UsgsAstroLsISD -{ - public: - - - UsgsAstroLsISD() - { - reset(); - } - - UsgsAstroLsISD( - const std::string& lis_file_name, - const std::string& ell_file_name) - { - reset(); - setISD(lis_file_name, ell_file_name); - } - - virtual ~UsgsAstroLsISD() {} - - // Formats the support data as a string - // This is mainly used to check that the - // support data is read in correctly. - std::string toString() const; - - // Initializes the class from ISD as formatted by the image provider. - // - // Note that if the ellipsoid data is found in the main ISD file, - // the ellipsoid data file is not needed. - void setISD( - const std::string& lis_file_name, - const std::string& ell_file_name); - - - //-------------------------------------------------------------------------- - // Helper Routines - //-------------------------------------------------------------------------- - // Initial check that support data file exists and looks like Astro LS ISD. - static bool checkFileValidity( - const csm::Isd& image_support_data, - std::string& lis_file_name, - std::string& ell_file_name, - std::string& img_rel_name); - - - // ISD elements; - // The support data is defined by USGS. See the documentation at - // http://htmlpreview.github.io/?https://github.com/USGS-Astrogeology/socet_set/blob/master/SS4HiRISE/Tutorials/ISD_keyword_examples/AstroLineScanner_ISD_Keywords.ls.htm - // Even for fields that do not change, it is best to include them in - // the support data rather than hard code values in the sensor model. - // Since this is not always done, some fields are optional. - std::string m_sensor_type; - int m_total_lines; - int m_total_samples; - int m_platform; - int m_aberr; - int m_atmref; - double m_int_time; - double m_starting_ephemeris_time; - double m_center_ephemeris_time; - double m_detector_sample_summing; - double m_starting_sample; - int m_ikcode; - double m_focal; - double m_isis_z_direction; - double m_optical_dist_coef[3]; - double m_itranss[3]; - double m_itransl[3]; - double m_detector_sample_origin; - double m_detector_line_origin; - double m_detector_line_offset; - double m_mounting_angles[3]; - double m_dt_ephem; - double m_t0_ephem; - double m_dt_quat; - double m_t0_quat; - int m_number_of_ephem; - int m_number_of_quaternions; - std::vector<double> m_ephem_pts; - std::vector<double> m_ephem_rates; - std::vector<double> m_quaternions; - std::vector<double> m_tri_parameters; - double m_semi_major_axis; - double m_eccentricity; - - // Optional fields - double m_ref_height; - double m_min_valid_ht; - double m_max_valid_ht; - std::string m_image_id; - std::string m_sensor_id; - std::string m_platform_id; - std::string m_traj_id; - std::string m_coll_id; - std::string m_ref_date_time; - - static const std::string mISD_KEYWORDS[]; - - enum IsdKeywords - { - SENSOR_TYPE, - TOTAL_LINES, - TOTAL_SAMPLES, - PLATFORM, - ABERR, - ATMREF, - INT_TIME, - STARTING_EPHEMERIS_TIME, - CENTER_EPHEMERIS_TIME, - DETECTOR_SAMPLE_SUMMING, - STARTING_SAMPLE, - IKCODE, - FOCAL, - ISIS_Z_DIRECTION, - OPTICAL_DIST_COEF, - ITRANSS, - ITRANSL, - DETECTOR_SAMPLE_ORIGIN, - DETECTOR_LINE_ORIGIN, - DETECTOR_LINE_OFFSET, - MOUNTING_ANGLES, - DT_EPHEM, - T0_EPHEM, - DT_QUAT, - T0_QUAT, - NUMBER_OF_EPHEM, - NUMBER_OF_QUATERNIONS, - EPHEM_PTS, - EPHEM_RATES, - QUATERNIONS, - TRI_PARAMETERS, - SEMI_MAJOR_AXIS, - ECCENTRICITY, - REFERENCE_HEIGHT, - MIN_VALID_HT, - MAX_VALID_HT, - IMAGE_ID, - SENSOR_ID, - PLATFORM_ID, - TRAJ_ID, - COLL_ID, - REF_DATE_TIME, - NUM_ISD_KEYWORDS - }; - - protected: - // Set to default values - void reset(); -}; - +//---------------------------------------------------------------------------- +// +// UNCLASSIFIED +// +// Copyright © 1989-2017 BAE Systems Information and Electronic Systems Integration Inc. +// ALL RIGHTS RESERVED +// Use of this software product is governed by the terms of a license +// agreement. The license agreement is found in the installation directory. +// +// For support, please visit http://www.baesystems.com/gxp +// +// FILENAME: UsgsAstroLsISD.h +// +// DESCRIPTION: +// +// Image Support Data (ISD) to build the Astro Line Scanner sensor model. +// The ISD format is defined by the imagery provider. A few common formats +// include name/value pairs, XML, NITF TREs, and GeoTiff tags. +// +// This ISD is formatted as a list of name/value pairs. The order of the +// list generally does not matter, except that the length of a vector needs +// to be read in before the vector itself. Extra data in the support data +// file will be ignored. +// +// There is data describing the ellipsoid that can optionally be in a +// seperate file. This is to support legacy data, but is not encouraged. +// +// For the Astro LS sensor model there is a close relationship between the +// ISD and the State data. This is not always the case. So, it is best to +// seperate the ISD parsing (done here), the translation of ISD to state +// data (done in the plugin), and the instantiation of the sensor model +// from state data (done in the sensor model). +// +// SOFTWARE HISTORY: +// +// Date Author Comment +// ----------- ---------- ------- +// 16-Oct-2017 BAE Systems Initial Release +// +//############################################################################# +#ifndef __USGS_ASTRO_LINE_SCANNER_ISD_H +#define __USGS_ASTRO_LINE_SCANNER_ISD_H + +#include <vector> +#include <string> + +#include <csm/csm.h> +#include <csm/Isd.h> +#include <csm/SettableEllipsoid.h> + +class UsgsAstroLsISD +{ + public: + + + UsgsAstroLsISD() + { + reset(); + } + + UsgsAstroLsISD( + const std::string& lis_file_name, + const std::string& ell_file_name) + { + reset(); + setISD(lis_file_name, ell_file_name); + } + + virtual ~UsgsAstroLsISD() {} + + // Formats the support data as a string + // This is mainly used to check that the + // support data is read in correctly. + std::string toString() const; + + // Initializes the class from ISD as formatted by the image provider. + // + // Note that if the ellipsoid data is found in the main ISD file, + // the ellipsoid data file is not needed. + void setISD( + const std::string& lis_file_name, + const std::string& ell_file_name); + + + //-------------------------------------------------------------------------- + // Helper Routines + //-------------------------------------------------------------------------- + // Initial check that support data file exists and looks like Astro LS ISD. + static bool checkFileValidity( + const csm::Isd& image_support_data, + std::string& lis_file_name, + std::string& ell_file_name, + std::string& img_rel_name); + + + // ISD elements; + // The support data is defined by USGS. See the documentation at + // http://htmlpreview.github.io/?https://github.com/USGS-Astrogeology/socet_set/blob/master/SS4HiRISE/Tutorials/ISD_keyword_examples/AstroLineScanner_ISD_Keywords.ls.htm + // Even for fields that do not change, it is best to include them in + // the support data rather than hard code values in the sensor model. + // Since this is not always done, some fields are optional. + std::string m_sensor_type; + int m_total_lines; + int m_total_samples; + int m_platform; + int m_aberr; + int m_atmref; + double m_int_time; + double m_starting_ephemeris_time; + double m_center_ephemeris_time; + double m_detector_sample_summing; + double m_starting_sample; + int m_ikcode; + double m_focal; + double m_isis_z_direction; + double m_optical_dist_coef[3]; + double m_itranss[3]; + double m_itransl[3]; + double m_detector_sample_origin; + double m_detector_line_origin; + double m_detector_line_offset; + double m_mounting_angles[3]; + double m_dt_ephem; + double m_t0_ephem; + double m_dt_quat; + double m_t0_quat; + int m_number_of_ephem; + int m_number_of_quaternions; + std::vector<double> m_ephem_pts; + std::vector<double> m_ephem_rates; + std::vector<double> m_quaternions; + std::vector<double> m_tri_parameters; + double m_semi_major_axis; + double m_eccentricity; + + // Optional fields + double m_ref_height; + double m_min_valid_ht; + double m_max_valid_ht; + std::string m_image_id; + std::string m_sensor_id; + std::string m_platform_id; + std::string m_traj_id; + std::string m_coll_id; + std::string m_ref_date_time; + + static const std::string mISD_KEYWORDS[]; + + protected: + // Set to default values + void reset(); +}; + #endif \ No newline at end of file diff --git a/schemas/isd.json b/schemas/isd.json new file mode 100644 index 0000000000000000000000000000000000000000..221916e45ac985658650c5d02a816a2410677d3f --- /dev/null +++ b/schemas/isd.json @@ -0,0 +1,241 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Instrument Specification Definition", + "description": "The Instrument Specification Definition for Astro CSM", + "type": "object", + + "properties": { + "detector_center": { + "description": "Center of the detector in pixel coordinates (line, sample)", + "type": "array", + "items": { + "type": "number", + "description": "The (line, sample) of the center of the detector.", + "minItems": 2, + "maxItems": 2 + } + }, + "center_ephemeris_time": { + "description": "The center ephemeris time of the image", + "type": "number" + }, + "starting_ephemeris_time": { + "description": "The starting ephemeris time of the image", + "type": "number" + }, + "focal_length_model": { + "description": "The static focal length or the information needed to model a variable focal length", + "type": "object", + "properties": { + "key": { + "type": "string", + "description":"A key to get information about time/temp dependent focal length models" + }, + "focal_length": { + "type": "number", + "description":"The focal length in mm" + }, + "focal_epsilon": { + "type": "number", + "description":"The uncertainty of the focal length in mm" + } + }, + "required": ["focal_length"] + }, + "image_lines": { + "description": "The number of lines in the image", + "type": "number" + }, + "image_samples": { + "description": "The the number of samples in the image", + "type": "number" + }, + "radii": { + "description": "The radii of the target.", + "type": "array", + "items": { + "type": "number", + "description": "The (semi-major axis, semi-minor axis) for the target.", + "minItems": 1, + "maxItems": 2 + } + }, + "optical_distortion": { + "description": "Information needed to convert from undistorted to distorted image plane", + "type": "object", + "properties" : { + "coefficients": { + "type": "array", + "items": { + "type": "number" + "description": "Each coefficient used for the distortion equation in order of + increasing degrees." + } + }, + "key" : { + "type": "string", + "description": "Key into LUT to determine equation to use." + } + }, + "required": ["coefficients", "equation_key"] + }, + "starting_detector_sample": { + "description": "The sample on the detector where the data starts", + "type": "number" + }, + "starting_detector_line": { + "description": "The line on the detector where the data starts", + "type": "number" + }, + "focal2pixel_samples": { + "description": "Transformation x coefficients from focal plane (mm) to detector pixel coordinates", + "type": "array", + "items": { + "type": "number" + } + }, + "focal2pixel_lines": { + "description": "Transformation y coefficients from focal plane (mm) to detector pixel coordinates", + "type": "array", + "items": { + "type": "number", + "minItems": 3, + "maxItems": 3 + } + }, + "sensor_location": { + "description": "(X, Y, Z) location of sensor in body-fixed frame.", + "type": "array", + "items": { + "type": "array", + "items" : { + "type": "number", + "minItems": 3, + "maxItems": 3 + } + } + }, + "sensor_velocity" : { + "description": "(v_x, v_y, v_z) velocity of sensor in body-fixed frame.", + "type": "array", + "items": { + "type": "array", + "items" : { + "type": "number", + "minItems": 3, + "maxItems": 3 + } + } + }, + "sun_position" : { + "description": "(x, y,z) of the sun in body-fixed frame.", + "type": "array", + "items": { + "type": "array", + "items" : { + "type": "number", + "minItems": 3, + "maxItems": 3 + } + } + }, + "sun_velocity" : { + "description": "(v_x, v_y, v_z) velocity of sun in body-fixed frame.", + "type": "array", + "items": { + "type": "array", + "items" : { + "type": "number", + "minItems": 3, + "maxItems": 3 + } + } + }, + "sensor_orientation" : { + "description": "Orientation of the sensor provided in quaternions", + "type": "array", + "items": { + "type": "array", + "description": "Each quaternion is of the general form: (scalar, vector component, + vector component, vector component). The specific form used is that + described in the NAIF Quaternions whitepaper under 'SPICE Quaternions' + available at: + ftp://naif.jpl.nasa.gov/pub/naif/misc/Quaternion_White_Paper/Quaternions_White_Paper.pdf" + "items" : { + "type": "number", + "minItems": 4 , + "maxItems": 4 + } + } + }, + "line_scan_rate": { + "description": "The line rates of the detector map with the associated start line and time", + "type": "array", + "items": { + "type": "array", + "items" : { + "type": "number", + "default": "-1", + "description": "The (start_line, line_start_time, exposure_time). The exposure time is + in seconds and any non-provided values will be set to -1." + "minItems": 3, + "maxItems": 3 + } + } + }, + "detector_sample_summing": { + "description": "The summing in the sample-direction. A summing of 1 indicates no summing, + summing of 2 indicates 2 pixel summing, 4 indicates 4 pixel summing, etc", + "type": "number" + }, + "detector_line_summing": { + "description": "The summing in the line-direction", + "type": "number" + }, + "apply_light_time_correction": { + "description": "A flag to indcate whether the light-time correction should be applied", + "type": "bool" + }, + "number_of_ephemerides": { + "description": "The number of emphemeris points", + "type": "number" + }, + "number_of_quaternions": { + "description": "The number of quaternions", + "type": "number" + }, + "dt_ephemeris": { + "description": "The time between each ephemeris point.", + "type": "number" + }, + "t0_ephemeris": { + "description": "First ephemeris time - center image time", + "type": "number" + }, + "dt_quaternion": { + "description": "Time spacing of quaternions.", + "type": "number" + }, + "t0_quaternion": { + "description": "First quaternion time - center image time.", + "type": "number" + }, + "reference_height": { + "description": "Used for determining the intersection of the look vector with the ellipsoid", + "type": "array", + "items": { + "type": "number", + "minItems": 2, + "maxItems": 2 + } + }, + "interpolation_method": { + "description": "The type of interpolation method to use.", + "type": "string", + "enum" : ["lagrange"] + }, + "required": ["focal_length_model", "ephemeris_start_time, "ccd_center","reference_height","sensor_orientation", + "focal2pixel_lines","focal2pixel_samples","radii","image_samples", "image_lines", "starting_detector_sample" + "starting_detector_line" ] + } +}