diff --git a/isis/src/base/objs/Camera/Camera.cpp b/isis/src/base/objs/Camera/Camera.cpp index bdb6295d3ceb14fc01b3cdac273777d3e5f28ab1..c864cf3566e1c24d807a990585c85359d9627b0b 100644 --- a/isis/src/base/objs/Camera/Camera.cpp +++ b/isis/src/base/objs/Camera/Camera.cpp @@ -22,11 +22,10 @@ */ #include "Camera.h" - -#include #include #include #include +#include #include #include @@ -62,10 +61,10 @@ using namespace std; namespace Isis { - /** - * @brief Constructs the Camera object. - * @param cube The Pvl label from the cube is used to create the Camera object. + * Constructs the Camera object + * + * @param lab Pvl label used to create the Camera object */ Camera::Camera(Cube &cube) : Sensor(cube) { m_instrumentNameLong = "Unknown"; @@ -154,13 +153,15 @@ namespace Isis { } } + /** - * @brief Sets the sample/line values of the image to get the lat/lon values. + * Sets the sample/line values of the image to get the lat/lon values + * + * @param sample Sample coordinate of the cube + * @param line Line coordinate of the cube * - * @param sample Sample coordinate of the cube. - * @param line Line coordinate of the cube. - * @return @b bool Returns True if the image was set successfully and Talse if it - * was not. + * @return @b bool Returns true if the image was set successfully and false if it + * was not */ bool Camera::SetImage(const double sample, const double line) { p_childSample = sample; @@ -274,6 +275,7 @@ namespace Isis { return false; } + /** * Sets the lat/lon values to get the sample/line values * @@ -414,10 +416,9 @@ namespace Isis { } } else { // ring plane - // UniversalLongitude should return azimuth (ring longitude) in this case - // TODO: - // when we make the change to real azimuths this value may need to be adjusted or - // code changed in the shapemodel or surfacepoint class. + // UniversalLongitude should return azimuth (ring longitude) in this case TODO: when we make the change + // to real azimuths this value may need to be adjusted or code changed in the shapemodel or + // surfacepoint class. if (p_projection->SetUniversalGround(LocalRadius().meters(), UniversalLongitude())) { p_childSample = p_projection->WorldX(); p_childLine = p_projection->WorldY(); @@ -437,14 +438,14 @@ namespace Isis { /** - * @brief Sets the lat/lon/radius values to get the sample/line values + * Sets the lat/lon/radius values to get the sample/line values * * @param latitude Latitude coordinate of the cube * @param longitude Longitude coordinate of the cube * @param radius Radius coordinate of the cube * - * @return @b bool Returns True if the Universal Ground was set successfully - * and False if it was not + * @return @b bool Returns true if the Universal Ground was set successfully + * and false if it was not */ bool Camera::SetUniversalGround(const double latitude, const double longitude, const double radius) { @@ -459,114 +460,8 @@ namespace Isis { return false; } - - /** - * @description This function provides an improved estimate of the detector resolution (in meters) - * when the target is near the limb. It does this by calculating the determinant of an affine - * transformation. The area element of one pixel projected onto the surface at Nadir looks - * like a square with sides of length = Detector Resolution. The detector resolution is the - * value returned by the original function. An affine projective transformation of this - * area element as one would see if it was on the limb instead of looking straight down, appears - * like a skewed parallelogram. - * - * The determinant of the transformation matrix taking the Nadir-area element into - * some parallelogram near the limb of a planet measures the change in area for the - * transformation when we are off-Nadir. The sqare-root of the area of this parallelogram - * gives us the resolution. - * - *The calculation is straightforward. Any affine transformation with a strictly positive - *determinant that is not a similarity transformation has a unique decomposition - *(See Theorem 2.1 in Reference #1): - * - * - * - * - * @f{eqnarray*} - * - * A = \[\left[\begin{array}{cc} a & b \\ - * c & d \end{array} \right]\] = - * - * H_{\lambda}R_1(\psi)T_tR_2(\phi) = \lambda - * \[ \left[\begin{array}{cc} cos(\psi) & -sin(\psi) \\ - * sin(\psi) & cos(\psi) \end{array} \right]\] - * \[ \left[\begin{array}{cc} t & 0 \\ - * 0 & 1 \end{array} \right]\] - * \[ \left[\begin{array}{cc} cos(\phi) & -sin(\phi) \\ - * sin(\phi) & cos(\phi) \end{array} \right]\] - * - * @f} - * - * Where: - * - * @f$ t = \frac{1}{cos(\theta)}},\;\;\theta = \text{Emmission\;\; Angle}@f$ - * and @f$\lambda = \text{zoom\;\;factor} = 1@f$ - * - * The determinant of A is: - * - * @f[ |A| = \lambda t = \frac{\lambda}{cos(\theta)} = \frac{1}{\cos(\theta)} @f] - * - * This is because the two rotation matrices in this decomposition have determinants equal to 1. - * - * Let @f$ n = \text{Detector\;\;Resolution} @f$ - * - * Then: - * - * @f[ Area = n^2 |A| =\frac{n^2}{cos(\theta)}@f] - * - * And: - * - * @f[ \text{Local\;\;Detector\;\; Resolution} = \frac{n}{\sqrt{cos(\theta)}} @f] - * - * - * This method returns the Local Detector Resolution if the Look Vector intersects the target - * and if @f$ 0 \leq \theta < \frac{\pi}{2} @f$ and -1.0 otherwise. - * - * - * - * - * Reference 1: J-M Morel and G. Yu, "Asift: A new framework for fully affine - * invariant image comparison," SIAM Journal on Imaging Sciences - * 2(2), pp. 438-469, 2009 - * - * - * @return @b double - */ - double Camera::ObliqueDetectorResolution(){ - - - if(HasSurfaceIntersection()){ - - - double thetaRad; - double sB[3]; - instrumentPosition(sB); - double pB[3]; - Coordinate(pB); - double a = sB[0] - pB[0]; - double b = sB[1] - pB[1]; - double c = sB[2] - pB[2]; - double rho = sqrt(a * a + b * b + c * c) * 1000.0; - - thetaRad = EmissionAngle()*DEG2RAD; - - if (thetaRad < HALFPI) { - - double nadirResolution = rho/(p_focalLength/p_pixelPitch); - return nadirResolution/sqrt(cos(thetaRad)); - - } - return Isis::Null; - - } - - return Isis::Null; - - } - - - /** - * @brief Returns the detector resolution at the current position in meters. + * Returns the detector resolution at the current position * * @return @b double The detector resolution */ @@ -585,31 +480,17 @@ namespace Isis { return Isis::Null; } - /** - * @brief Returns the sample resolution at the current position in meters. + * Returns the sample resolution at the current position * * @return @b double The sample resolution */ double Camera::SampleResolution() { - return DetectorResolution() * p_detectorMap->SampleScaleFactor(); } /** - * @brief Returns the oblique sample resolution at the current position in m. This gives - * a more accurate estimate of the sample resolution at oblique angles. - * - * @return @b double The sample resolution - */ - double Camera::ObliqueSampleResolution() { - - return ObliqueDetectorResolution() * p_detectorMap->SampleScaleFactor(); - } - - - /** - * @brief Returns the line resolution at the current position in meters. + * Returns the line resolution at the current position * * @return @b double The line resolution */ @@ -617,22 +498,9 @@ namespace Isis { return DetectorResolution() * p_detectorMap->LineScaleFactor(); } - /** - * @brief Returns the oblique line resolution at the current position in meters. This - * provides a more accurate estimate of the line resolution at oblique - * angles. + * Returns the pixel resolution at the current position in m/pix * - * @return @b double The line resolution - */ - double Camera::ObliqueLineResolution() { - - return ObliqueDetectorResolution() * p_detectorMap->LineScaleFactor(); - } - - - /** - * @brief Returns the pixel resolution at the current position in meters/pixel. * @return @b double The pixel resolution */ double Camera::PixelResolution() { @@ -643,24 +511,8 @@ namespace Isis { return (lineRes + sampRes) / 2.0; } - - /** - * @brief Returns the oblique pixel resolution at the current position in meters/pixel. This - * provides a more accurate estimate of the pixel resolution at oblique angles. - * - * @return @b double The pixel resolution - */ - double Camera::ObliquePixelResolution() { - double lineRes = ObliqueLineResolution(); - double sampRes = ObliqueSampleResolution(); - if (lineRes < 0.0) return Isis::Null; - if (sampRes < 0.0) return Isis::Null; - return (lineRes + sampRes) / 2.0; - } - - /** - * @brief Returns the lowest/worst resolution in the entire image + * Returns the lowest/worst resolution in the entire image * * @return @b double The lowest/worst resolution in the image */ @@ -669,9 +521,8 @@ namespace Isis { return p_maxres; } - /** - * @brief Returns the highest/best resolution in the entire image + * Returns the highest/best resolution in the entire image * * @return @b double The highest/best resolution in the entire image */ @@ -680,31 +531,8 @@ namespace Isis { return p_minres; } - - /** - * @brief Returns the lowest/worst oblique resolution in the entire image - * - * @return @b double The lowest/worst oblique resolution in the image - */ - double Camera::LowestObliqueImageResolution() { - GroundRangeResolution(); - return p_minobliqueres; - } - - /** - * @brief Returns the highest/best oblique resolution in the entire image - * - * @return @b double The highest/best oblique resolution in the entire image - */ - double Camera::HighestObliqueImageResolution() { - GroundRangeResolution(); - return p_maxobliqueres; - } - - - /** - * @brief Computes the ground range and min/max resolution + * Computes the ground range and min/max resolution */ void Camera::GroundRangeResolution() { // Software adjustment is needed if we get here -- call RingRangeResolution instead @@ -732,8 +560,6 @@ namespace Isis { p_maxlon180 = -DBL_MAX; p_minres = DBL_MAX; p_maxres = -DBL_MAX; - p_minobliqueres = DBL_MAX; - p_maxobliqueres = -DBL_MAX; // See if we have band dependence and loop for the appropriate number of bands int eband = p_bands; @@ -765,13 +591,6 @@ namespace Isis { if (res < p_minres) p_minres = res; if (res > p_maxres) p_maxres = res; } - // Determine min/max oblique resolution - double obliqueres = ObliquePixelResolution(); - if (obliqueres > 0.0) { - if (obliqueres < p_minobliqueres) p_minobliqueres = obliqueres; - if (obliqueres > p_maxobliqueres) p_maxobliqueres = obliqueres; - - } if ((line != 1) && (line != p_lines + 1)) break; } } // end loop through samples @@ -800,14 +619,6 @@ namespace Isis { if (res < p_minres) p_minres = res; if (res > p_maxres) p_maxres = res; } - - // Determine min/max oblique resolution - double obliqueres = ObliquePixelResolution(); - if (obliqueres > 0.0) { - if (obliqueres < p_minobliqueres) p_minobliqueres = obliqueres; - if (obliqueres > p_maxobliqueres) p_maxobliqueres = obliqueres; - - } break; } } @@ -837,13 +648,6 @@ namespace Isis { if (res < p_minres) p_minres = res; if (res > p_maxres) p_maxres = res; } - - double obliqueres = ObliquePixelResolution(); - if (obliqueres > 0.0) { - if (obliqueres < p_minobliqueres) p_minobliqueres = obliqueres; - if (obliqueres > p_maxobliqueres) p_maxobliqueres = obliqueres; - - } } } } // end valid local (subspacecraft) radius @@ -934,9 +738,7 @@ namespace Isis { // Checks for invalid lat/lon ranges -// if(p_minlon == DBL_MAX || p_minlat == DBL_MAX || p_maxlon == -DBL_MAX -// || p_maxlat == -DBL_MAX) -// { +// if(p_minlon == DBL_MAX || p_minlat == DBL_MAX || p_maxlon == -DBL_MAX || p_maxlat == -DBL_MAX) { // string message = "Camera missed planet or SPICE data off."; // throw IException(IException::Unknown, message, _FILEINFO_); // } @@ -944,7 +746,7 @@ namespace Isis { /** - * @brief Analogous to above GroundRangeResolution method. Computes the ring range + * Analogous to above GroundRangeResolution method. Computes the ring range * and min/max resolution */ void Camera::ringRangeResolution() { @@ -1114,8 +916,7 @@ namespace Isis { } // Checks for invalid radius/lon ranges - if (p_minRingRadius == DBL_MAX || p_minRingRadius == DBL_MAX - || p_minRingLongitude == DBL_MAX || p_maxRingLongitude == -DBL_MAX) { + if (p_minRingRadius == DBL_MAX || p_minRingRadius == DBL_MAX || p_minRingLongitude == DBL_MAX || p_maxRingLongitude == -DBL_MAX) { string message = "RingPlane ShapeModel - Camera missed plane or SPICE data off."; throw IException(IException::Unknown, message, _FILEINFO_); } @@ -1351,8 +1152,7 @@ namespace Isis { * @param pvl Pvl to write mapping group to */ void Camera::basicRingMapping(Pvl &pvl) { - if (target()->shape()->name() != "Plane") { - // If we get here and we don't have a plane, throw an error + if (target()->shape()->name() != "Plane") { // If we get here and we don't have a plane, throw an error IString msg = "A ring plane projection has been requested on an image whose shape is not a ring plane. "; msg += "Rerun spiceinit with shape=RINGPLANE. "; throw IException(IException::User, msg, _FILEINFO_); @@ -1389,8 +1189,6 @@ namespace Isis { SetPixelPitch(Spice::getDouble(key)); } - - /** * Sets the right ascension declination * @@ -1658,8 +1456,6 @@ namespace Isis { // angle (in radians) incidence = Angle(vsep_c(unitizedSurfSunVect, normal), Angle::Radians); - - } @@ -1670,13 +1466,12 @@ namespace Isis { * @param maxra Maximum right ascension value * @param mindec Minimum declination value * @param maxdec Maximum declination value + * * @return @b bool Returns true if the range computation was successful and false * if it was not */ bool Camera::RaDecRange(double &minra, double &maxra, double &mindec, double &maxdec) { - - bool computed = p_pointComputed; double originalSample = Sample(); double originalLine = Line(); @@ -1816,7 +1611,6 @@ namespace Isis { * @return @b double The resutant RaDec resolution */ double Camera::RaDecResolution() { - bool computed = p_pointComputed; double originalSample = Sample(); double originalLine = Line(); @@ -1893,6 +1687,7 @@ namespace Isis { return ComputeAzimuth(LocalRadius(lat, lon), lat, lon); } + /** * Return the Spacecraft Azimuth * @@ -1906,6 +1701,7 @@ namespace Isis { return ComputeAzimuth(LocalRadius(lat, lon), lat, lon); } + /** * Computes the image azimuth value from your current position (origin) to a point of interest * specified by the lat/lon input to this method. (NOTE: This azimuth is different from a Ground @@ -2156,6 +1952,7 @@ namespace Isis { return azimuth; } + /** * Return the off nadir angle in degrees. * @@ -2181,6 +1978,7 @@ namespace Isis { return c; } + /** * Computes and returns the ground azimuth between the ground point and * another point of interest, such as the subspacecraft point or the @@ -2308,6 +2106,7 @@ namespace Isis { p_distortionMap = map; } + /** * Sets the Focal Plane Map. This object will take ownership of the focal plane * map pointer. @@ -2322,6 +2121,7 @@ namespace Isis { p_focalPlaneMap = map; } + /** * Sets the Detector Map. This object will take ownership of the detector map * pointer. @@ -2336,6 +2136,7 @@ namespace Isis { p_detectorMap = map; } + /** * Sets the Ground Map. This object will take ownership of the ground map * pointer. @@ -2350,6 +2151,7 @@ namespace Isis { p_groundMap = map; } + /** * Sets the Sky Map. This object will take ownership of the sky map pointer. * @@ -2363,6 +2165,7 @@ namespace Isis { p_skyMap = map; } + /** * This loads the spice cache big enough for this image. The default cache size * is the number of lines in the cube if the ephemeris time changes in the @@ -2458,6 +2261,7 @@ namespace Isis { return ephemerisTimes; } + /** * This method calculates the spice cache size. This method finds the number * of lines in the beta cube and adds 1, since we need at least 2 points for @@ -2542,6 +2346,7 @@ namespace Isis { p_geometricTilingEndSize = endSize; } + /** * This will get the geometric tiling hint; these values are typically used for * ProcessRubberSheet::SetTiling(...). @@ -2575,6 +2380,7 @@ namespace Isis { return true; } + /** * Checks to see if the camera object has a projection * @@ -2583,7 +2389,8 @@ namespace Isis { */ bool Camera::HasProjection() { return p_projection != 0; - } + } + /** * Virtual method that checks if the band is independent @@ -2595,6 +2402,7 @@ namespace Isis { return true; } + /** * Returns the reference band * @@ -2604,6 +2412,7 @@ namespace Isis { return p_referenceBand; } + /** * Checks to see if the Camera object has a reference band * @@ -2614,6 +2423,7 @@ namespace Isis { return p_referenceBand != 0; } + /** * Virtual method that sets the band number * @@ -2623,6 +2433,7 @@ namespace Isis { p_childBand = band; } + /** * Returns the current sample number * @@ -2632,6 +2443,7 @@ namespace Isis { return p_childSample; } + /** * Returns the current band * @@ -2641,6 +2453,7 @@ namespace Isis { return p_childBand; } + /** * Returns the current line number * @@ -2649,6 +2462,8 @@ namespace Isis { double Camera::Line() { return p_childLine; } + + /** * Returns the resolution of the camera * @@ -2659,8 +2474,6 @@ namespace Isis { } - - /** * Returns the focal length * @@ -2670,6 +2483,7 @@ namespace Isis { return p_focalLength; } + /** * Returns the pixel pitch * @@ -2679,6 +2493,7 @@ namespace Isis { return p_pixelPitch; } + /** * Returns the pixel ifov offsets from center of pixel, which defaults to the * (pixel pitch * summing mode ) / 2. If an instrument has a non-square ifov, it must implement @@ -2710,6 +2525,7 @@ namespace Isis { return p_samples; } + /** * Returns the number of lines in the image * @@ -2719,6 +2535,7 @@ namespace Isis { return p_lines; } + /** * Returns the number of bands in the image * @@ -2728,6 +2545,7 @@ namespace Isis { return p_bands; } + /** * Returns the number of lines in the parent alphacube * @@ -2737,6 +2555,7 @@ namespace Isis { return p_alphaCube->AlphaLines(); } + /** * Returns the number of samples in the parent alphacube * @@ -2745,6 +2564,8 @@ namespace Isis { int Camera::ParentSamples() const { return p_alphaCube->AlphaSamples(); } + + /** * Returns a pointer to the CameraDistortionMap object * @@ -2754,6 +2575,7 @@ namespace Isis { return p_distortionMap; } + /** * Returns a pointer to the CameraFocalPlaneMap object * @@ -2763,6 +2585,7 @@ namespace Isis { return p_focalPlaneMap; } + /** * Returns a pointer to the CameraDetectorMap object * @@ -2772,6 +2595,7 @@ namespace Isis { return p_detectorMap; } + /** * Returns a pointer to the CameraGroundMap object * @@ -2781,6 +2605,7 @@ namespace Isis { return p_groundMap; } + /** * Returns a pointer to the CameraSkyMap object * @@ -2969,4 +2794,3 @@ namespace Isis { // end namespace isis } - diff --git a/isis/src/base/objs/Camera/Camera.h b/isis/src/base/objs/Camera/Camera.h index 1dcdff93ea3b2237d562f01f3764719c98d2b2c5..2af5607c1344fab5ce0e5293feb273f0d2401a92 100644 --- a/isis/src/base/objs/Camera/Camera.h +++ b/isis/src/base/objs/Camera/Camera.h @@ -68,7 +68,7 @@ namespace Isis { * @history 2008-02-15 Stacy Alley - In the GroundRangeResolution () method we had to subtract * 0.5 when looking at the far left of pixels and add 0.5 to ensure we * are seeing the far right of pixels. - * @history 2008-05-21 Steven Lambright - Fixed boundary condition in the + * @history 2008-05-21 Steven Lambright - Fixed boundary condition in the * GroundRangeResolution() method. * @history 2008-06-18 Christopher Austin - Fixed documentation errors * @history 2008-07-15 Steven Lambright - Added NaifStatus calls @@ -132,7 +132,7 @@ namespace Isis { * method to report if the angles could successfully be calculated. * @history 2011-01-14 Travis Addair - Added new CK/SPK accessor methods, pure virtual in * Camera, implemented in mission specific cameras. - * @history 2011-01-14 Kris Becker - Added the (pure) virtual methods CkFrameId(), + * @history 2011-01-14 Kris Becker - Added the (pure) virtual methods CkFrameId(), * CkReferenceId(), SpkTargetId(), SpkCenterId() and SpkReferenceId(). * Camera model developers must provide, at a minimum, implementations * for CkFrameId(), CkReferenceId() and SpkReferenceId(). @@ -179,7 +179,7 @@ namespace Isis { * pole, then the azimuth is adjusted to be relative to the North pole. * @history 2012-06-04 Janet Barrett - Got rid of redundant calls to Sample(), Line(), and * SetImage() in the ComputeAzimuth method. - * @history 2012-07-06 Debbie A. Cook - Updated Spice members to be more compliant with Isis + * @history 2012-07-06 Debbie A. Cook - Updated Spice members to be more compliant with Isis * coding standards. References #972. * @history 2012-10-12 Debbie A. Cook - Updated to use new Target and ShapeModel classes. * References Mantis ticket #775 and #1114. @@ -208,20 +208,20 @@ namespace Isis { * check-in. Fixes #2243. * @history 2015-05-15 Kris Becker - Set ShapeModel state in SetImage() to reflect no * intersection before attempting to map to surface. Fixes #2252. + * @history 2015-09-01 Ian Humphrey and Makayla Shepherd - Modified unit test to override + * Sensor's pure virtual methods. + * @history 2015-10-16 Ian Humphrey - Added protected members for spacecraft and instrument + * names as well as public member getters. Updated unit test. + * References #2335. * @history 2015-09-01 Ian Humphrey and Makayla Shepherd - Modified unit test to override * Sensor's pure virtual methods. - * @history 2015-10-16 Ian Humphrey - Added protected members for spacecraft and instrument + * @history 2015-10-16 Ian Humphrey - Added protected members for spacecraft and instrument * names as well as public member getters. Updated unit test. * References #2335. * @history 2016-06-27 Kelvin Rodriguez - Added member function to compute celestial north * clock angle. References #2365 * @history 2016-08-01 Curtis Rose - Changed return values of resolutions from -1 to Isis::Null. * Fixes #2065. - * @history 2016-08-16 Tyler Wilson - Added ObliqueDectectorResolution,ObliqueLineResolution, - * ObliqueSampleResolution, and ObliquePixelResolution functions - * which give greatly improved approximations compared to their - * non-oblique counterpart functions when the Look vector is pointing - * off nadir and near the limb. Fixes #476. References #4100. */ class Camera : public Sensor { @@ -233,7 +233,7 @@ namespace Isis { //! Destroys the Camera Object virtual ~Camera(); - // Methods + // Methods bool SetImage(const double sample, const double line); bool SetUniversalGround(const double latitude, const double longitude); bool SetUniversalGround(const double latitude, const double longitude, @@ -258,7 +258,7 @@ namespace Isis { bool GroundRange(double &minlat, double &maxlat, double &minlon, double &maxlon, Pvl &pvl); - bool ringRange(double &minRingRadius, double &maxRingRadius, + bool ringRange(double &minRingRadius, double &maxRingRadius, double &minRingLongitude, double &maxRingLongitude, Pvl &pvl); bool IntersectsLongitudeDomain(Pvl &pvl); @@ -267,17 +267,9 @@ namespace Isis { double SampleResolution(); double DetectorResolution(); - double ObliqueDetectorResolution(); - double ObliqueSampleResolution(); - double ObliqueLineResolution(); - double ObliquePixelResolution(); - - - virtual double resolution(); + virtual double resolution(); double LowestImageResolution(); double HighestImageResolution(); - double LowestObliqueImageResolution(); - double HighestObliqueImageResolution(); void BasicMapping(Pvl &map); void basicRingMapping(Pvl &map); @@ -296,6 +288,7 @@ namespace Isis { bool RaDecRange(double &minra, double &maxra, double &mindec, double &maxdec); + double RaDecResolution(); CameraDistortionMap *DistortionMap(); @@ -303,7 +296,7 @@ namespace Isis { CameraDetectorMap *DetectorMap(); CameraGroundMap *GroundMap(); CameraSkyMap *SkyMap(); - + QString instrumentNameLong() const; QString instrumentNameShort() const; QString spacecraftNameLong() const; @@ -346,9 +339,9 @@ namespace Isis { }; /** - * Returns the type of camera that was created. This is a pure virtual method, so all child - * classes must define and identify themselves as one of the enumerated camera types defined - * in this class. + * Returns the type of camera that was created. This is a pure virtual method, so all child + * classes must define and identify themselves as one of the enumerated camera types defined + * in this class. * * @return @b CameraType Type of camera that was created. */ @@ -356,18 +349,18 @@ namespace Isis { /** * @brief Provides the NAIF frame code for an instruments CK kernel - * - * This pure virtual method must be implemented in each camera model providing the reference + * + * This pure virtual method must be implemented in each camera model providing the reference * frame NAIF ID code found in the mission CK kernel. - * - * This value can be easily determined by using the NAIF @b spacit application that sumarizes - * binary CK kernels a particular instrument on a spacecraft. @b spacit will additionally - * require a spacecraft clock kernel (SCLK) and a leap seconds kernel (LSK). For example, - * the output of the MESSENGER camera CK supporting the MDIS camera below indicates it is the - * MESSENGER spacecraft. - * - * - * @code + * + * This value can be easily determined by using the NAIF @b spacit application that sumarizes + * binary CK kernels a particular instrument on a spacecraft. @b spacit will additionally + * require a spacecraft clock kernel (SCLK) and a leap seconds kernel (LSK). For example, + * the output of the MESSENGER camera CK supporting the MDIS camera below indicates it is the + * MESSENGER spacecraft. + * + * + * @code * Segment ID : MSGR_SPACECRAFT * Instrument Code: -236000 * Spacecraft : Body -236, MESSENGER @@ -379,28 +372,28 @@ namespace Isis { * UTC Stop Time : 2010 JUL 23 12:35:22.814 * SCLK Start Time: 1/000818300:000000 * SCLK Stop Time : 1/188375996:000000 - * @endcode - * - * The CkFrameId value is found in the "Instrument Code" entry (-236000). - * + * @endcode + * + * The CkFrameId value is found in the "Instrument Code" entry (-236000). + * * @return @b int NAIF code for CK frame for an instrument */ virtual int CkFrameId() const = 0; /** * @brief Provides the NAIF reference code for an instruments CK kernel - * - * This virtual method must be implemented in each camera model providing the reference frame - * NAIF ID code found in the mission CK kernel. - * - * This value can be easily determined by using the NAIF @b spacit application that sumarizes - * binary CK kernels a particular instrument on a spacecraft. @b spacit will additionally - * require a spacecraft clock kernel (SCLK) and a leap seconds kernel (LSK).For example, - * the output of the MESSENGER camera CK supporting the MDIS camera below indicates it is the - * MESSENGER spacecraft. - * - * - * @code + * + * This virtual method must be implemented in each camera model providing the reference frame + * NAIF ID code found in the mission CK kernel. + * + * This value can be easily determined by using the NAIF @b spacit application that sumarizes + * binary CK kernels a particular instrument on a spacecraft. @b spacit will additionally + * require a spacecraft clock kernel (SCLK) and a leap seconds kernel (LSK).For example, + * the output of the MESSENGER camera CK supporting the MDIS camera below indicates it is the + * MESSENGER spacecraft. + * + * + * @code * Segment ID : MSGR_SPACECRAFT * Instrument Code: -236000 * Spacecraft : Body -236, MESSENGER @@ -412,28 +405,28 @@ namespace Isis { * UTC Stop Time : 2010 JUL 23 12:35:22.814 * SCLK Start Time: 1/000818300:000000 * SCLK Stop Time : 1/188375996:000000 - * @endcode - * - * The CkReferenced value is found in the "Reference Frame" entry (1). - * + * @endcode + * + * The CkReferenced value is found in the "Reference Frame" entry (1). + * * @return @b int NAIF code for CK reference for an instrument */ virtual int CkReferenceId() const = 0; /** - * @brief Provides reference frame for instruments SPK NAIF kernel - * - * This pure virtual method must be implemented in each camera model providing the reference - * frame NAIF ID code found in the mission SPK kernel. This is typically J2000, but may be - * relative to other frames. - * - * This value can be easily determined by using the NAIF @b spacit application that sumarizes - * binary kernels on the SPK kernel used for a particular instrument on a spacecraft. - * @b spacit will additionally require a leap seconds kernel (LSK). For example, the output - * of the MESSENGER SPK camera supporting the MDIS camera below indicates it is indeed the - * J2000 reference frame: - * - * @code + * @brief Provides reference frame for instruments SPK NAIF kernel + * + * This pure virtual method must be implemented in each camera model providing the reference + * frame NAIF ID code found in the mission SPK kernel. This is typically J2000, but may be + * relative to other frames. + * + * This value can be easily determined by using the NAIF @b spacit application that sumarizes + * binary kernels on the SPK kernel used for a particular instrument on a spacecraft. + * @b spacit will additionally require a leap seconds kernel (LSK). For example, the output + * of the MESSENGER SPK camera supporting the MDIS camera below indicates it is indeed the + * J2000 reference frame: + * + * @code * Segment ID : msgr_20050903_20061125_recon002.nio * Target Body : Body -236, MESSENGER * Center Body : Body 2, VENUS BARYCENTER @@ -444,10 +437,10 @@ namespace Isis { * UTC Stop Time : 2006 OCT 31 22:14:24.040 * ET Start Time : 2006 OCT 16 19:26:46.293 * ET Stop time : 2006 OCT 31 22:15:29.222 - * @endcode - * + * @endcode + * * The SpkReferenceId value is found in the "Reference frame" entry (1). - * + * * @return @b int NAIF code for SPK reference frame for an instrument */ virtual int SpkReferenceId() const = 0; @@ -456,7 +449,7 @@ namespace Isis { protected: - + QString m_instrumentNameLong; //!< Full instrument name QString m_instrumentNameShort; //!< Shortened instrument name QString m_spacecraftNameLong; //!< Full spacecraft name @@ -476,8 +469,8 @@ namespace Isis { // slant range changes. friend class RadarGroundMap; friend class RadarSlantRangeMap; - - + + private: double p_focalLength; //!< The focal length, in units of millimeters double p_pixelPitch; //!< The pixel pitch, in millimeters per pixel @@ -490,8 +483,6 @@ namespace Isis { double p_maxlon; //!< The maximum longitude double p_minres; //!< The minimum resolution double p_maxres; //!< The maximum resolution - double p_minobliqueres; //!< The minimum oblique resolution - double p_maxobliqueres; //!< The maximum oblique resolution double p_minlon180; //!< The minimum longitude in the 180 domain double p_maxlon180; //!< The maximum longitude in the 180 domain bool p_groundRangeComputed; /**!< Flag showing if ground range @@ -529,7 +520,7 @@ namespace Isis { AlphaCube *p_alphaCube; //!< A pointer to the AlphaCube double p_childSample; //!< Sample value for child double p_childLine; //!< Line value for child - int p_childBand; //!< Band value for child + int p_childBand; //!< Band value for child. Should be the virtual band not original band. CameraDistortionMap *p_distortionMap; //!< A pointer to the DistortionMap CameraFocalPlaneMap *p_focalPlaneMap; //!< A pointer to the FocalPlaneMap CameraDetectorMap *p_detectorMap; //!< A pointer to the DetectorMap @@ -549,4 +540,3 @@ namespace Isis { }; #endif - diff --git a/isis/src/base/objs/Camera/Camera.truth b/isis/src/base/objs/Camera/Camera.truth index b16d59eb45570fdd7ac01600d91c7349151efdfb..e680927f06eb983b4eca184b4205946b6c01aa56 100644 --- a/isis/src/base/objs/Camera/Camera.truth +++ b/isis/src/base/objs/Camera/Camera.truth @@ -47,13 +47,9 @@ Line: 962 GroundRange: 0 IntersectsLongitudeDomain: 0 PixelResolution: 628 -ObliquePixelResolution: 685 LineResolution: 628 -ObliqueLineResolution: 685 SampleResolution: 628 -ObliqueSampleResolution: 685 DetectorResolution: 157 -ObliqueDetectorResolution: 171 LowestImageResolution: 2047 HighestImageResolution: 430 Calling BasicMapping (pvl)... diff --git a/isis/src/base/objs/Camera/unitTest.cpp b/isis/src/base/objs/Camera/unitTest.cpp index 53cfa610563d45085cc71ad1655f032abe3aefeb..cbfe7d5c623875cf1d7621f7f0db37e1ea391c27 100644 --- a/isis/src/base/objs/Camera/unitTest.cpp +++ b/isis/src/base/objs/Camera/unitTest.cpp @@ -162,15 +162,9 @@ int main() { } cout << "PixelResolution: " << c->PixelResolution() << endl; - cout << "ObliquePixelResolution: " << c->ObliquePixelResolution() << endl; cout << "LineResolution: " << c->LineResolution() << endl; - cout << "ObliqueLineResolution: " << c->ObliqueLineResolution() << endl; cout << "SampleResolution: " << c->SampleResolution() << endl; - cout << "ObliqueSampleResolution: " << c->ObliqueSampleResolution() << endl; cout << "DetectorResolution: " << c->DetectorResolution() << endl; - cout << "ObliqueDetectorResolution: " << c->ObliqueDetectorResolution() << endl; - - cout << "LowestImageResolution: " << setprecision(4) << c->LowestImageResolution() << endl; cout << "HighestImageResolution: " << setprecision(3) diff --git a/isis/src/base/objs/CameraPointInfo/CameraPointInfo.cpp b/isis/src/base/objs/CameraPointInfo/CameraPointInfo.cpp index 9278b553b58847def905d617c0263f34f977bcf3..6190b70f7838b24e2a8a88784f49022cf8ad3142 100644 --- a/isis/src/base/objs/CameraPointInfo/CameraPointInfo.cpp +++ b/isis/src/base/objs/CameraPointInfo/CameraPointInfo.cpp @@ -55,14 +55,8 @@ namespace Isis { m_usedCubes->SetNumOpenCubes(50); m_currentCube = NULL; m_camera = NULL; - m_csvOutput = false; } - void CameraPointInfo::SetCSVOutput(bool csvOutput) { - - m_csvOutput = csvOutput; - - } /** * Destructor, deletes CubeManager object used. @@ -237,117 +231,52 @@ namespace Isis { */ PvlGroup *CameraPointInfo::GetPointInfo(bool passed, bool allowOutside, bool allowErrors) { PvlGroup *gp = new PvlGroup("GroundPoint"); - - //Outputting in PVL format - if(!m_csvOutput) { - gp->addKeyword(PvlKeyword("Filename")); - gp->addKeyword(PvlKeyword("Sample")); - gp->addKeyword(PvlKeyword("Line")); - gp->addKeyword(PvlKeyword("PixelValue")); - gp->addKeyword(PvlKeyword("RightAscension")); - gp->addKeyword(PvlKeyword("Declination")); - gp->addKeyword(PvlKeyword("PlanetocentricLatitude")); - gp->addKeyword(PvlKeyword("PlanetographicLatitude")); - gp->addKeyword(PvlKeyword("PositiveEast360Longitude")); - gp->addKeyword(PvlKeyword("PositiveEast180Longitude")); - gp->addKeyword(PvlKeyword("PositiveWest360Longitude")); - gp->addKeyword(PvlKeyword("PositiveWest180Longitude")); - gp->addKeyword(PvlKeyword("BodyFixedCoordinate")); - gp->addKeyword(PvlKeyword("LocalRadius")); - gp->addKeyword(PvlKeyword("SampleResolution")); - gp->addKeyword(PvlKeyword("LineResolution")); - gp->addKeyword(PvlKeyword("ObliqueDetectorResolution")); - gp->addKeyword(PvlKeyword("ObliquePixelResolution")); - gp->addKeyword(PvlKeyword("ObliqueLineResolution")); - gp->addKeyword(PvlKeyword("ObliqueSampleResolution")); - gp->addKeyword(PvlKeyword("SpacecraftPosition")); - gp->addKeyword(PvlKeyword("SpacecraftAzimuth")); - gp->addKeyword(PvlKeyword("SlantDistance")); - gp->addKeyword(PvlKeyword("TargetCenterDistance")); - gp->addKeyword(PvlKeyword("SubSpacecraftLatitude")); - gp->addKeyword(PvlKeyword("SubSpacecraftLongitude")); - gp->addKeyword(PvlKeyword("SpacecraftAltitude")); - gp->addKeyword(PvlKeyword("OffNadirAngle")); - gp->addKeyword(PvlKeyword("SubSpacecraftGroundAzimuth")); - gp->addKeyword(PvlKeyword("SunPosition")); - gp->addKeyword(PvlKeyword("SubSolarAzimuth")); - gp->addKeyword(PvlKeyword("SolarDistance")); - gp->addKeyword(PvlKeyword("SubSolarLatitude")); - gp->addKeyword(PvlKeyword("SubSolarLongitude")); - gp->addKeyword(PvlKeyword("SubSolarGroundAzimuth")); - gp->addKeyword(PvlKeyword("Phase")); - gp->addKeyword(PvlKeyword("Incidence")); - gp->addKeyword(PvlKeyword("Emission")); - gp->addKeyword(PvlKeyword("NorthAzimuth")); - gp->addKeyword(PvlKeyword("EphemerisTime")); - gp->addKeyword(PvlKeyword("UTC")); - gp->addKeyword(PvlKeyword("LocalSolarTime")); - gp->addKeyword(PvlKeyword("SolarLongitude")); - gp->addKeyword(PvlKeyword("LookDirectionBodyFixed")); - gp->addKeyword(PvlKeyword("LookDirectionJ2000")); - gp->addKeyword(PvlKeyword("LookDirectionCamera")); - - if (allowErrors) gp->addKeyword(PvlKeyword("Error")); + gp->addKeyword(PvlKeyword("Filename")); + gp->addKeyword(PvlKeyword("Sample")); + gp->addKeyword(PvlKeyword("Line")); + gp->addKeyword(PvlKeyword("PixelValue")); + gp->addKeyword(PvlKeyword("RightAscension")); + gp->addKeyword(PvlKeyword("Declination")); + gp->addKeyword(PvlKeyword("PlanetocentricLatitude")); + gp->addKeyword(PvlKeyword("PlanetographicLatitude")); + gp->addKeyword(PvlKeyword("PositiveEast360Longitude")); + gp->addKeyword(PvlKeyword("PositiveEast180Longitude")); + gp->addKeyword(PvlKeyword("PositiveWest360Longitude")); + gp->addKeyword(PvlKeyword("PositiveWest180Longitude")); + gp->addKeyword(PvlKeyword("BodyFixedCoordinate")); + gp->addKeyword(PvlKeyword("LocalRadius")); + gp->addKeyword(PvlKeyword("SampleResolution")); + gp->addKeyword(PvlKeyword("LineResolution")); + gp->addKeyword(PvlKeyword("SpacecraftPosition")); + gp->addKeyword(PvlKeyword("SpacecraftAzimuth")); + gp->addKeyword(PvlKeyword("SlantDistance")); + gp->addKeyword(PvlKeyword("TargetCenterDistance")); + gp->addKeyword(PvlKeyword("SubSpacecraftLatitude")); + gp->addKeyword(PvlKeyword("SubSpacecraftLongitude")); + gp->addKeyword(PvlKeyword("SpacecraftAltitude")); + gp->addKeyword(PvlKeyword("OffNadirAngle")); + gp->addKeyword(PvlKeyword("SubSpacecraftGroundAzimuth")); + gp->addKeyword(PvlKeyword("SunPosition")); + gp->addKeyword(PvlKeyword("SubSolarAzimuth")); + gp->addKeyword(PvlKeyword("SolarDistance")); + gp->addKeyword(PvlKeyword("SubSolarLatitude")); + gp->addKeyword(PvlKeyword("SubSolarLongitude")); + gp->addKeyword(PvlKeyword("SubSolarGroundAzimuth")); + gp->addKeyword(PvlKeyword("Phase")); + gp->addKeyword(PvlKeyword("Incidence")); + gp->addKeyword(PvlKeyword("Emission")); + gp->addKeyword(PvlKeyword("NorthAzimuth")); + gp->addKeyword(PvlKeyword("EphemerisTime")); + gp->addKeyword(PvlKeyword("UTC")); + gp->addKeyword(PvlKeyword("LocalSolarTime")); + gp->addKeyword(PvlKeyword("SolarLongitude")); + gp->addKeyword(PvlKeyword("LookDirectionBodyFixed")); + gp->addKeyword(PvlKeyword("LookDirectionJ2000")); + gp->addKeyword(PvlKeyword("LookDirectionCamera")); + if (allowErrors) gp->addKeyword(PvlKeyword("Error")); } - else { - - gp->addKeyword(PvlKeyword("Filename")); - gp->addKeyword(PvlKeyword("Sample")); - gp->addKeyword(PvlKeyword("Line")); - gp->addKeyword(PvlKeyword("PixelValue")); - gp->addKeyword(PvlKeyword("RightAscension")); - gp->addKeyword(PvlKeyword("Declination")); - gp->addKeyword(PvlKeyword("PlanetocentricLatitude")); - gp->addKeyword(PvlKeyword("PlanetographicLatitude")); - gp->addKeyword(PvlKeyword("PositiveEast360Longitude")); - gp->addKeyword(PvlKeyword("PositiveEast180Longitude")); - gp->addKeyword(PvlKeyword("PositiveWest360Longitude")); - gp->addKeyword(PvlKeyword("PositiveWest180Longitude")); - gp->addKeyword(PvlKeyword("BodyFixedCoordinate")); - gp->addKeyword(PvlKeyword("LocalRadius")); - gp->addKeyword(PvlKeyword("SampleResolution")); - gp->addKeyword(PvlKeyword("LineResolution")); - gp->addKeyword(PvlKeyword("SpacecraftPosition")); - gp->addKeyword(PvlKeyword("SpacecraftAzimuth")); - gp->addKeyword(PvlKeyword("SlantDistance")); - gp->addKeyword(PvlKeyword("TargetCenterDistance")); - gp->addKeyword(PvlKeyword("SubSpacecraftLatitude")); - gp->addKeyword(PvlKeyword("SubSpacecraftLongitude")); - gp->addKeyword(PvlKeyword("SpacecraftAltitude")); - gp->addKeyword(PvlKeyword("OffNadirAngle")); - gp->addKeyword(PvlKeyword("SubSpacecraftGroundAzimuth")); - gp->addKeyword(PvlKeyword("SunPosition")); - gp->addKeyword(PvlKeyword("SubSolarAzimuth")); - gp->addKeyword(PvlKeyword("SolarDistance")); - gp->addKeyword(PvlKeyword("SubSolarLatitude")); - gp->addKeyword(PvlKeyword("SubSolarLongitude")); - gp->addKeyword(PvlKeyword("SubSolarGroundAzimuth")); - gp->addKeyword(PvlKeyword("Phase")); - gp->addKeyword(PvlKeyword("Incidence")); - gp->addKeyword(PvlKeyword("Emission")); - gp->addKeyword(PvlKeyword("NorthAzimuth")); - gp->addKeyword(PvlKeyword("EphemerisTime")); - gp->addKeyword(PvlKeyword("UTC")); - gp->addKeyword(PvlKeyword("LocalSolarTime")); - gp->addKeyword(PvlKeyword("SolarLongitude")); - gp->addKeyword(PvlKeyword("LookDirectionBodyFixed")); - gp->addKeyword(PvlKeyword("LookDirectionJ2000")); - gp->addKeyword(PvlKeyword("LookDirectionCamera")); - gp->addKeyword(PvlKeyword("ObliqueDetectorResolution")); - gp->addKeyword(PvlKeyword("ObliquePixelResolution")); - gp->addKeyword(PvlKeyword("ObliqueLineResolution")); - gp->addKeyword(PvlKeyword("ObliqueSampleResolution")); - if (allowErrors) gp->addKeyword(PvlKeyword("Error")); - - - - - } - - - bool noErrors = passed; QString error = ""; if (!m_camera->HasSurfaceIntersection()) { @@ -417,14 +346,14 @@ namespace Isis { // Convert lat to planetographic Distance radii[3]; m_camera->radii(radii); - ographicLat = TProjection::ToPlanetographic(ocentricLat, - radii[0].kilometers(), + ographicLat = TProjection::ToPlanetographic(ocentricLat, + radii[0].kilometers(), radii[2].kilometers()); gp->findKeyword("PlanetographicLatitude").setValue(toString(ographicLat), "DEGREE"); - + pe360Lon = m_camera->UniversalLongitude(); gp->findKeyword("PositiveEast360Longitude").setValue(toString(pe360Lon), "DEGREE"); - + //Convert lon to -180 - 180 range gp->findKeyword("PositiveEast180Longitude").setValue(toString( TProjection::To180Domain(pe360Lon)), "DEGREE"); @@ -436,7 +365,7 @@ namespace Isis { //Convert pwlon to -180 - 180 range gp->findKeyword("PositiveWest180Longitude").setValue( toString( TProjection::To180Domain(pw360Lon)), "DEGREE"); - + m_camera->Coordinate(pB); gp->findKeyword("BodyFixedCoordinate").addValue(toString(pB[0]), "km"); gp->findKeyword("BodyFixedCoordinate").addValue(toString(pB[1]), "km"); @@ -444,28 +373,19 @@ namespace Isis { gp->findKeyword("LocalRadius").setValue(toString( m_camera->LocalRadius().meters()), "meters"); + gp->findKeyword("SampleResolution").setValue(toString( m_camera->SampleResolution()), "meters/pixel"); gp->findKeyword("LineResolution").setValue(toString( m_camera->LineResolution()), "meters/pixel"); - gp->findKeyword("ObliqueDetectorResolution").setValue( - toString(m_camera->ObliqueDetectorResolution()),"meters"); - gp->findKeyword("ObliqueLineResolution").setValue( - toString(m_camera->ObliqueLineResolution()),"meters"); - gp->findKeyword("ObliqueSampleResolution").setValue( - toString(m_camera->ObliqueSampleResolution()),"meters"); - gp->findKeyword("ObliquePixelResolution").setValue( - toString(m_camera->ObliquePixelResolution()), "meters/pix"); - - //body fixed m_camera->instrumentPosition(spB); gp->findKeyword("SpacecraftPosition").addValue(toString(spB[0]), "km"); gp->findKeyword("SpacecraftPosition").addValue(toString(spB[1]), "km"); gp->findKeyword("SpacecraftPosition").addValue(toString(spB[2]), "km"); gp->findKeyword("SpacecraftPosition").addComment("Spacecraft Information"); - + double spacecraftAzi = m_camera->SpacecraftAzimuth(); if (Isis::IsValidPixel(spacecraftAzi)) { gp->findKeyword("SpacecraftAzimuth").setValue(toString(spacecraftAzi), "DEGREE"); @@ -485,7 +405,7 @@ namespace Isis { m_camera->SpacecraftAltitude()), "km"); gp->findKeyword("OffNadirAngle").setValue(toString( m_camera->OffNadirAngle()), "DEGREE"); - double subspcgrdaz = m_camera->GroundAzimuth(m_camera->UniversalLatitude(), + double subspcgrdaz = m_camera->GroundAzimuth(m_camera->UniversalLatitude(), m_camera->UniversalLongitude(), ssplat, ssplon); gp->findKeyword("SubSpacecraftGroundAzimuth").setValue( @@ -496,7 +416,7 @@ namespace Isis { gp->findKeyword("SunPosition").addValue(toString(sB[1]), "km"); gp->findKeyword("SunPosition").addValue(toString(sB[2]), "km"); gp->findKeyword("SunPosition").addComment("Sun Information"); - + double sunAzi = m_camera->SunAzimuth(); if (Isis::IsValidPixel(sunAzi)) { gp->findKeyword("SubSolarAzimuth").setValue(toString(sunAzi), "DEGREE"); @@ -510,7 +430,7 @@ namespace Isis { m_camera->subSolarPoint(sslat, sslon); gp->findKeyword("SubSolarLatitude").setValue(toString(sslat), "DEGREE"); gp->findKeyword("SubSolarLongitude").setValue(toString(sslon), "DEGREE"); - double subsolgrdaz = m_camera->GroundAzimuth(m_camera->UniversalLatitude(), + double subsolgrdaz = m_camera->GroundAzimuth(m_camera->UniversalLatitude(), m_camera->UniversalLongitude(), sslat, sslon); gp->findKeyword("SubSolarGroundAzimuth").setValue( @@ -522,7 +442,7 @@ namespace Isis { m_camera->IncidenceAngle()), "DEGREE"); gp->findKeyword("Emission").setValue(toString( m_camera->EmissionAngle()), "DEGREE"); - + double northAzi = m_camera->NorthAzimuth(); if (Isis::IsValidPixel(northAzi)) { gp->findKeyword("NorthAzimuth").setValue(toString(northAzi), "DEGREE"); diff --git a/isis/src/base/objs/CameraPointInfo/CameraPointInfo.h b/isis/src/base/objs/CameraPointInfo/CameraPointInfo.h index fefb5acbba300d9f4431067a0a1dff0cf4f3ed4b..a9df9a9eaf27ab1f5795460e08ad74471cd965c1 100644 --- a/isis/src/base/objs/CameraPointInfo/CameraPointInfo.h +++ b/isis/src/base/objs/CameraPointInfo/CameraPointInfo.h @@ -75,20 +75,9 @@ namespace Isis { * "NULL" to be consistent with caminfo's CamTools.cpp. Replaced local * variable names with more descriptive names. References #1659. * @history 2015-10-01 Jeannie Backer - Made improvements to documentation and brought code - * closer to ISIS coding standards. References #1438 + * closer to ISIS coding standards. References #1438 * @history 2016-07-11 Curtis Rose - Added units to a few of the outputs. References #3979. - * @history 2016-08-16 Tyler Wilson - Modified the GetPointInfo function to allow - * developers to specify which order CameraPointInfo fields - * are output for different file formats (PVL or CSV). - * This is managed by setting the m_csvOutput flag via - * the public member function SetCSVOutput. PVL is the - * default output format, as m_csvOuput is set to false in - * the constructor. The reason for this is to not to break any - * scripts processors might be running when outputting files in - * csv format. Column order is important in this case. - * References #476,#4100. - * - **/ + */ class CameraPointInfo { public: @@ -96,7 +85,6 @@ namespace Isis { virtual ~CameraPointInfo(); void SetCube(const QString &cubeFileName); - void SetCSVOutput(bool csvOutput); PvlGroup *SetImage(const double sample, const double line, const bool outside = false, const bool error = false); PvlGroup *SetCenter(const bool outside = false, const bool error = false); @@ -117,7 +105,6 @@ namespace Isis { CubeManager *m_usedCubes; Cube *m_currentCube; Camera *m_camera; - bool m_csvOutput; }; }; diff --git a/isis/src/base/objs/CameraPointInfo/CameraPointInfo.truth b/isis/src/base/objs/CameraPointInfo/CameraPointInfo.truth index 11c5dfed9067881b2cbda0515cc86bcc6b2eb5f6..21b2839b51ad72269ecdae0a7a45df2c5a9f0889 100644 --- a/isis/src/base/objs/CameraPointInfo/CameraPointInfo.truth +++ b/isis/src/base/objs/CameraPointInfo/CameraPointInfo.truth @@ -15,10 +15,6 @@ Group = GroundPoint LocalRadius = 1737400.0 SampleResolution = 187.48511798825 LineResolution = 187.48511798825 - ObliqueDetectorResolution = 187.48933248321 - ObliquePixelResolution = 187.48933248321 - ObliqueLineResolution = 187.48933248321 - ObliqueSampleResolution = 187.48933248321 # Spacecraft Information SpacecraftPosition = (216.76438021037, 54.256829538645, @@ -77,10 +73,6 @@ Group = GroundPoint LocalRadius = 1737400.0 SampleResolution = 187.50339379912 LineResolution = 187.50339379912 - ObliqueDetectorResolution = 187.52061363579 - ObliquePixelResolution = 187.52061363579 - ObliqueLineResolution = 187.52061363579 - ObliqueSampleResolution = 187.52061363579 # Spacecraft Information SpacecraftPosition = (216.76438021037, 54.256829538645, diff --git a/isis/src/base/objs/CameraStatistics/CameraStatistics.cpp b/isis/src/base/objs/CameraStatistics/CameraStatistics.cpp index e2402a977b2cbae52895ff4e4a38ec66174608ef..dfc288eccf25406c9bda4fef3da978d572ebca27 100644 --- a/isis/src/base/objs/CameraStatistics/CameraStatistics.cpp +++ b/isis/src/base/objs/CameraStatistics/CameraStatistics.cpp @@ -93,13 +93,6 @@ namespace Isis { m_latStat = new Statistics(); m_lonStat = new Statistics(); m_resStat = new Statistics(); - - - m_obliqueResStat = new Statistics(); - m_obliqueSampleResStat = new Statistics(); - m_obliqueLineResStat = new Statistics(); - - m_sampleResStat = new Statistics(); m_lineResStat = new Statistics(); m_aspectRatioStat = new Statistics(); @@ -164,28 +157,6 @@ namespace Isis { delete m_resStat; m_resStat = NULL; } - - - if (m_obliqueLineResStat != NULL) { - delete m_obliqueLineResStat; - m_obliqueLineResStat = NULL; - - } - - if (m_obliqueSampleResStat != NULL) { - delete m_obliqueSampleResStat; - m_obliqueSampleResStat = NULL; - - } - - if (m_obliqueResStat != NULL) { - delete m_obliqueResStat; - m_obliqueResStat = NULL; - } - - - - if (m_sampleResStat != NULL) { delete m_sampleResStat; m_sampleResStat = NULL; @@ -238,14 +209,6 @@ namespace Isis { if(cam->HasSurfaceIntersection()) { m_latStat->AddData(cam->UniversalLatitude()); m_lonStat->AddData(cam->UniversalLongitude()); - - - m_obliqueResStat->AddData(cam->ObliquePixelResolution()); - m_obliqueSampleResStat->AddData(cam->ObliqueSampleResolution()); - m_obliqueLineResStat->AddData(cam->ObliqueLineResolution()); - - - m_resStat->AddData(cam->PixelResolution()); m_sampleResStat->AddData(cam->SampleResolution()); m_lineResStat->AddData(cam->LineResolution()); @@ -381,56 +344,6 @@ namespace Isis { pLon += constructKeyword("LongitudeAverage", m_lonStat->Average()); pLon += constructKeyword("LongitudeStandardDeviation", m_lonStat->StandardDeviation()); - - - - - - - - PvlGroup pObliqueSampleRes("ObliqueSampleResolution"); - pObliqueSampleRes += constructKeyword("ObliqueSampleResolutionMinimum", - m_obliqueSampleResStat->Minimum(), "meters/pixel"); - pObliqueSampleRes += constructKeyword("ObliqueSampleResolutionMaximum", - m_obliqueSampleResStat->Maximum(),"meters/pixel"); - pObliqueSampleRes += constructKeyword("ObliqueSampleResolutionAverage", - m_obliqueSampleResStat->Average(),"meters/pixel"); - pObliqueSampleRes += constructKeyword("ObliqueSampleResolutionStandardDeviation", - m_obliqueSampleResStat->StandardDeviation(), "meters/pixel"); - - PvlGroup pObliqueLineRes("ObliqueLineResolution"); - pObliqueLineRes += constructKeyword("ObliqueLineResolutionMinimum", m_obliqueLineResStat->Minimum(), - "meters/pixel"); - pObliqueLineRes += constructKeyword("ObliqueLineResolutionMaximum", m_obliqueLineResStat->Maximum(), - "meters/pixel"); - pObliqueLineRes += constructKeyword("ObliqueLineResolutionAverage", m_obliqueLineResStat->Average(), - "meters/pixel"); - pObliqueLineRes += constructKeyword("ObliqueLineResolutionStandardDeviation", - m_obliqueLineResStat->StandardDeviation(), "meters/pixel"); - - PvlGroup pObliqueResolution("ObliqueResolution"); - pObliqueResolution += constructKeyword("ObliqueResolutionMinimum", m_obliqueResStat->Minimum(), - "meters/pixel"); - pObliqueResolution += constructKeyword("ObliqueResolutionMaximum", m_obliqueResStat->Maximum(), - "meters/pixel"); - pObliqueResolution += constructKeyword("ObliqueResolutionAverage", m_obliqueResStat->Average(), - "meters/pixel"); - pObliqueResolution += constructKeyword("ObliqueResolutionStandardDeviation", - m_obliqueResStat->StandardDeviation(), "meters/pixel"); - - - - - - - - - - - - - - PvlGroup pSampleRes("SampleResolution"); pSampleRes += constructKeyword("SampleResolutionMinimum", m_sampleResStat->Minimum(), "meters/pixel"); @@ -461,18 +374,6 @@ namespace Isis { pResolution += constructKeyword("ResolutionStandardDeviation", m_resStat->StandardDeviation(), "meters/pixel"); - - - - - - - - - - - - PvlGroup pAspectRatio("AspectRatio"); pAspectRatio += constructKeyword("AspectRatioMinimum", m_aspectRatioStat->Minimum()); pAspectRatio += constructKeyword("AspectRatioMaximun", m_aspectRatioStat->Maximum()); @@ -532,14 +433,6 @@ namespace Isis { returnPvl.addGroup(pSampleRes); returnPvl.addGroup(pLineRes); returnPvl.addGroup(pResolution); - - returnPvl.addGroup(pObliqueSampleRes); - returnPvl.addGroup(pObliqueLineRes); - returnPvl.addGroup(pObliqueResolution); - - - - returnPvl.addGroup(pAspectRatio); returnPvl.addGroup(pPhase); returnPvl.addGroup(pEmission); diff --git a/isis/src/base/objs/CameraStatistics/CameraStatistics.h b/isis/src/base/objs/CameraStatistics/CameraStatistics.h index 2cbc47048c4b79d9a134f09bac275967f4c78a9f..fb540d2d1aa76655202b1e6d72a95bb827c5fe9c 100644 --- a/isis/src/base/objs/CameraStatistics/CameraStatistics.h +++ b/isis/src/base/objs/CameraStatistics/CameraStatistics.h @@ -49,10 +49,7 @@ namespace Isis { * * @internal * @history 2011-06-14 Travis Addair - Extracted logic from "camstats" - * application to create this class. - * @history 2016-08-17 Tyler Wilson - Added Statistics objects for - * ObliquePixelResolution,ObliqueSampleResolution, and - * ObliqueLineResolution. References #476, #4100. + * application to create this class. */ class CameraStatistics { @@ -90,7 +87,6 @@ namespace Isis { }; - /** * Accessor method for inspecting the statistics gathered on the * Pixel Resolutions of the input Camera. @@ -102,41 +98,6 @@ namespace Isis { }; - - /** - * Accessor method for inspecting the statistics gathered on the - * oblique pixel resolutions of the input Camera. - * - * @return Statistics * Constant pointer to oblique pixel resolution statistics - */ - const Statistics * getObliqueResStat() const { - return m_obliqueResStat; - }; - - /** - * Accessor method for inspecting the statistics gathered on the - * oblique sample resolutions of the input Camera. - * - * @return Statistics * Constant pointer to oblique sample resolution statistics - */ - const Statistics * getObliqueSampleResStat() const { - return m_obliqueSampleResStat; - }; - - - - /** - * Accessor method for inspecting the statistics gathered on the - * oblique line resolution of the input Camera. - * - * @return Statistics * Constant pointer to oblique line resolution statistics - */ - const Statistics * getObliqueLineResStat() const { - return m_obliqueLineResStat; - }; - - - /** * Accessor method for inspecting the statistics gathered on the * Sample Resolutions of the input Camera. @@ -245,13 +206,6 @@ namespace Isis { Statistics *m_latStat; //!< Universal latitude statistics. Statistics *m_lonStat; //!< Universal longitude statistics. - - - - Statistics *m_obliqueResStat; //!< Oblique pixel resolution statistics. - Statistics *m_obliqueSampleResStat; //!< Oblique sample resolution statistics. - Statistics *m_obliqueLineResStat; //!< Oblique line resolution statistics. - Statistics *m_resStat; //!< Pixel resolution statistics. Statistics *m_sampleResStat; //!< Sample resolution statistics. Statistics *m_lineResStat; //!< Line resolution statistics. diff --git a/isis/src/base/objs/CameraStatistics/CameraStatistics.truth b/isis/src/base/objs/CameraStatistics/CameraStatistics.truth index 413624756888abfbca8b5e9e06cce57a2e1113a5..ac0d219fcab6b0cefc30dbf31c51d63f6b300b7d 100644 --- a/isis/src/base/objs/CameraStatistics/CameraStatistics.truth +++ b/isis/src/base/objs/CameraStatistics/CameraStatistics.truth @@ -36,24 +36,6 @@ Resolution: ResolutionAverage = 245.015 ResolutionStandardDeviation = 0.181039 -ObliqueSampleResolution: - ObliqueSampleResolutionMinimum = 244.735 - ObliqueSampleResolutionMaximum = 246.319 - ObliqueSampleResolutionAverage = 245.205 - ObliqueSampleResolutionStandardDeviation = 0.304432 - -ObliqueLineResolution: - ObliqueLineResolutionMinimum = 244.735 - ObliqueLineResolutionMaximum = 246.319 - ObliqueLineResolutionAverage = 245.205 - ObliqueLineResolutionStandardDeviation = 0.304432 - -ObliqueResolution: - ObliqueResolutionMinimum = 244.735 - ObliqueResolutionMaximum = 246.319 - ObliqueResolutionAverage = 245.205 - ObliqueResolutionStandardDeviation = 0.304432 - AspectRatio: AspectRatioMinimum = 1 AspectRatioMaximun = 1 diff --git a/isis/src/docsys/documents/Glossary/Glossary.xml b/isis/src/docsys/documents/Glossary/Glossary.xml index b4423e5d667db2dbe03f568899f3db59959a5254..91f7967b2826433e0cfc388b545472cf3395fc6e 100644 --- a/isis/src/docsys/documents/Glossary/Glossary.xml +++ b/isis/src/docsys/documents/Glossary/Glossary.xml @@ -310,7 +310,7 @@

- + The emission angle (EMA) is the angle between the spacecraft and a vector drawn perpendicular to the planet's surface (surface normal). Using SPICE, ISIS applications compute this angle from the ellipsoid. @@ -344,112 +344,24 @@

- + The ground distance in meters from the left edge to the right edge of a pixel. - - The ground distance (in meters) from the left edge to the right edge - of a pixel. This value is based on the oblique detector resolution - estimate, rather than the detector resolution and is more accurate - (particularly for off-nadir images). + + The ground distance in meters from the top edge to the bottom edge + of a pixel. - - - - The ground distance (in meters) from the top edge to the bottom edge + + The ground distance in meters from the left edge to the right edge of a pixel. - - The ground distance (in meters) from the top edge to the bottom edge - of a pixel. This value is based on the oblique detector resolution - estimate, rather than the detector resolution and is more - accurate (particularly for off-nadir images). - - - - - - - The ground distance (in meters) from the left edge to the right edge - of a pixel. - - - - The ground distance (in meters) from the left edge to the right edge - of a pixel. This value is based on the oblique detector resolution - estimate, rather than the detector resolution and is more - accurate (particularly for off-nadir images). - - - - - - The ground distance in meters from the left edge to the right edge of a detector. If the - lines and samples are not being summed and averaged, this value is equal to the pixel resolution. - The formula for estimating this value works well if the image is taken near nadir, but - the accuracy falls off rapidly the farther off-nadir the image is taken. For an estimate that - handles off-nadir images with higher accuracy, one should use oblique detector resolution. - - - - This provides an improved estimate to the standard detector resolution when the image is taken at an oblique - angle. It returns the square-root of the area of the projection of the detector onto the body of the target (in units of meters). - If the image is taken at nadir, this is the ground distance between the left and right edge of the detector, because the - detector's projection is a square. For off-nadir images, the projection has a trapezoidal shape. - In Figure 1A below, an image of the Dufay X crater that was taken near nadir is displayed. Figure 1B is a - color map showing the relative difference between the oblique detector resolution, and the original detector resolution as a function - of the emission angle. For small emission angles (near nadir) the relative difference between the two estimates - is very small. For larger emission angles (off-nadir), the relative difference between the - two estimates increases rapidly. Figure 2A is an image of the Carlini crater group taken at an oblique angle. Figure 2B is a color plot - of the relative difference between the two estimates showing a minimum value of approximately 50% between the two when the - emission angles off-nadir are in the range 65-75 degrees. - - - - - - - - - - - -
-
- -
Fig 1A: A cropped view of Apollo image AS16-M-0025 centered on the Dufay X crater. The spacecraft - was very close to nadir when the image was taken.
-
- -
-
-
- -
Fig 2A: A cropped view of Apollo image AS15-M-1556 centered on the Carlini crater group. - This photo was taken at an oblique angle.
-
- -
-
-
- -
Fig 1B: Relative percentage difference between resolution estimates for
-
a nadir image (see Fig. 1A).
- -
-
-
- -
Fig 2B: Relative percentage difference between resolution estimates for
-
an oblique image (see Fig. 2A).
- -
-
-
+ + The size of the detector on the focal plane for each pixel. + Irradiance/SolarFlux. Unit of DN values for a reference distance of diff --git a/isis/src/docsys/documents/Glossary/assets/carlini_craters.png b/isis/src/docsys/documents/Glossary/assets/carlini_craters.png deleted file mode 100644 index 8fd94695029a4d91689de32cbd9eeaac60774529..0000000000000000000000000000000000000000 Binary files a/isis/src/docsys/documents/Glossary/assets/carlini_craters.png and /dev/null differ diff --git a/isis/src/docsys/documents/Glossary/assets/dufayx.png b/isis/src/docsys/documents/Glossary/assets/dufayx.png deleted file mode 100644 index fab269193f2a20803d09432a9b7104c05644406a..0000000000000000000000000000000000000000 Binary files a/isis/src/docsys/documents/Glossary/assets/dufayx.png and /dev/null differ diff --git a/isis/src/docsys/documents/Glossary/assets/nadir.png b/isis/src/docsys/documents/Glossary/assets/nadir.png deleted file mode 100644 index 5f84f7bc9c63b42ffad0f57fdb3f2f4dd2f4f14d..0000000000000000000000000000000000000000 Binary files a/isis/src/docsys/documents/Glossary/assets/nadir.png and /dev/null differ diff --git a/isis/src/docsys/documents/Glossary/assets/nadir40pct.png b/isis/src/docsys/documents/Glossary/assets/nadir40pct.png deleted file mode 100644 index 0c488dc856772ec5cb6c1826f298bcf4a8441aca..0000000000000000000000000000000000000000 Binary files a/isis/src/docsys/documents/Glossary/assets/nadir40pct.png and /dev/null differ diff --git a/isis/src/docsys/documents/Glossary/assets/oblique.png b/isis/src/docsys/documents/Glossary/assets/oblique.png deleted file mode 100644 index d34d8f497c8cdff962449ce16aff6816cea1403e..0000000000000000000000000000000000000000 Binary files a/isis/src/docsys/documents/Glossary/assets/oblique.png and /dev/null differ diff --git a/isis/src/docsys/documents/Glossary/assets/oblique40pct.png b/isis/src/docsys/documents/Glossary/assets/oblique40pct.png deleted file mode 100644 index cad5f4dcb24f38d42310fcbf85ae260f1c79c212..0000000000000000000000000000000000000000 Binary files a/isis/src/docsys/documents/Glossary/assets/oblique40pct.png and /dev/null differ diff --git a/isis/src/hayabusa/apps/amicacal/AmicaCalUtils.h b/isis/src/hayabusa/apps/amicacal/AmicaCalUtils.h index c3284ef396af39fa1c9ab4474262ff368dd11875..7676077b3fd6d559467fd6034d9a28c116c98b54 100644 --- a/isis/src/hayabusa/apps/amicacal/AmicaCalUtils.h +++ b/isis/src/hayabusa/apps/amicacal/AmicaCalUtils.h @@ -1,6 +1,7 @@ #ifndef AmicaCalUtils_h #define AmicaCalUtils_h + #include #include #include @@ -8,26 +9,36 @@ #include "CSVReader.h" #include "IException.h" -#include "IString.h" #include "FileName.h" #include "LineManager.h" #include "NaifStatus.h" +#include "IString.h" #include "Pvl.h" #include "PvlGroup.h" + #include "Spice.h" + + +// OpenCV stuff + + #include /** - * @author 2016-07-10 Tyler Wilson - * @internal - * @history + * @author 2016-04-04 Tyler Wilson + * + * */ - using namespace cv; using namespace std; + + + + + namespace Isis { @@ -37,10 +48,11 @@ namespace Isis { * planetary body ephemerides to support time and relative positions of planet * bodies. */ + static void loadNaifTiming() { static bool naifLoaded = false; if (!naifLoaded) { - //Load the NAIF kernels to determine timing data +// Load the NAIF kernels to determine timing data Isis::FileName leapseconds("$base/kernels/lsk/naif????.tls"); leapseconds = leapseconds.highestVersion(); @@ -51,7 +63,7 @@ static void loadNaifTiming() { Isis::FileName pck3("$hayabusa/kernels/spk/hay_jaxa_050916_051119_v1n.bsp"); Isis::FileName pck4("$hayabusa/kernels/spk/hay_osbj_050911_051118_v1n.bsp"); - //Load the kernels +// Load the kernels QString leapsecondsName(leapseconds.expanded()); QString sclkName(sclk.expanded()); @@ -70,7 +82,7 @@ static void loadNaifTiming() { furnsh_c(pckName4.toAscii().data()); - //Ensure it is loaded only once +// Ensure it is loaded only once naifLoaded = true; } return; @@ -83,6 +95,7 @@ static void loadNaifTiming() { * provides instrument time support, leap seconds and planet body ephemeris. * @return @b double Distance in AU between Sun and observed body. */ + static bool sunDistanceAU(const QString &scStartTime, const QString &target, double &sunDist) { @@ -124,10 +137,14 @@ static bool sunDistanceAU(const QString &scStartTime, /** * @brief Translates a 1-banded Isis::Cube to an OpenMat object + * * @author 2016-04-19 Tyler Wilson + * * @param icube A pointer to the input cube + * * @return @b Mat A pointer to the OpenMat object */ + Mat * isis2mat(Cube *icube) { int nlines = icube->lineCount(); @@ -145,6 +162,7 @@ Mat * isis2mat(Cube *icube) { } } + return matrix; } @@ -152,11 +170,15 @@ return matrix; /** * @brief Translates an OpenMat object to an ISIS::Cube with one band + * * @author 2016-04-19 Tyler Wilson + * * @param matrix A pointer to the OpenMat object + * * @param cubeName The name of the Isis::Cube that is being created. * */ + void mat2isis(Mat *matrix, QString cubeName) { int nlines = matrix->rows; @@ -172,10 +194,14 @@ void mat2isis(Mat *matrix, QString cubeName) { for (int line =0; line < nlines; line++) { linewriter.SetLine(line+1); + for ( int samp=0; sampat(linewriter.Line()-1,samp); + } ocube.write(linewriter); + } } @@ -183,10 +209,15 @@ void mat2isis(Mat *matrix, QString cubeName) { /** * @brief Translates/scales a cube using Bilinear Interpolation + * * @author 2016-04-19 Tyler Wilson + * * @param matrix A pointer to the OpenMat object + * * @param cubeName The name of the ISIS::Cube that is being created. + * */ + void translate(Cube *flatField, int *transform, QString fname) { Mat * originalMat = isis2mat(flatField); @@ -199,11 +230,17 @@ void translate(Cube *flatField, int *transform, QString fname) { int width = (lastsample-startsample); int height = (lastline-startline); + Size sz(flatField->lineCount()/scale,flatField->sampleCount()/scale); + Mat * resizedMatrix = new Mat(); + Mat temp = *originalMat; + + Mat originalCropped = temp(Rect(startsample,startline,width+1,height+1)); + if (scale ==1) { mat2isis(&originalCropped,fname); } @@ -235,6 +272,7 @@ void translate(Cube *flatField, int *transform, QString fname) { * at pixel with coordinates (x,y) relative to the central pixel (with coordinates (0,0) ). * */ + static double f_focused(double alpha,int binning,double x,double y) { double X = x*binning; @@ -267,17 +305,23 @@ static double f_focused(double alpha,int binning,double x,double y) { * central pixel (at coordinates (0,0) ). * */ + static double f_unfocused(double * A,double * sigma, int N,int binning,double x,double y) { + double X = binning*x; double Y = binning*y; + double r = sqrt(X*X+Y*Y); + + double sum = 0; for (int i = 0; i < N; i ++) { sum += (A[i]/(sigma[i]*sqrt(2.0*pi_c() ) ) )*exp(-(r*r)/(2*sigma[i]*sigma[i]) ); } + return sum; } @@ -301,22 +345,33 @@ static double f_unfocused(double * A,double * sigma, int N,int binning,double x, * @param binning * @return @b double * A pointer to a [size x size] matrix of light distribution values. */ + double * setPSFFilter(int size, double *A,double *sigma, double alpha,int N,int binning) { + double * psfVals = new double[size*size]; + int i = 0; for(double y = -(size / 2) ; y <= (size / 2) ; y++) { for(double x = -(size / 2) ; x <= (size / 2) ; x++) { if (x == 0 && y ==0) { + + psfVals[i] = 0; i++; + } else { + psfVals[i]=f_unfocused(A,sigma,N,binning,x,y) +f_focused(alpha,binning,x,y); + //psfVals[i] = f_focused(alpha,binning,x,y); + i++; - } + + } + //i++; } } diff --git a/isis/src/hayabusa/apps/amicacal/amicacal.cpp b/isis/src/hayabusa/apps/amicacal/amicacal.cpp index 463db7f8de78bb11e9483cc2fb19ef2f09d7da44..bf6c591b85c29592a8a92e845fd2e406336cffe8 100644 --- a/isis/src/hayabusa/apps/amicacal/amicacal.cpp +++ b/isis/src/hayabusa/apps/amicacal/amicacal.cpp @@ -1,16 +1,15 @@ // $Id: amicacal.cpp 6045 2015-02-07 02:06:59Z moses@GS.DOI.NET $ #include "Isis.h" - +#include #include #include #include #include -#include #include -#include #include +#include #include #include @@ -22,10 +21,10 @@ #include "iTime.h" #include "LineManager.h" #include "Pixel.h" -#include "ProcessByBoxcar.h" -#include "ProcessByBrick.h" #include "ProcessByLine.h" #include "ProcessBySample.h" +#include "ProcessByBrick.h" +#include "ProcessByBoxcar.h" #include "ProgramLauncher.h" #include "Pvl.h" #include "PvlGroup.h" @@ -62,6 +61,7 @@ struct TemporaryCubeDeleter { //For subimage and binning mapping static AlphaCube *alpha(0); + QString g_filter = ""; static QString g_target =""; static int g_HayabusaNaifCode = -130; @@ -85,6 +85,8 @@ static double g_d1(0); static double g_temp(0); static double g_darkCurrent(0); + + //Smear calculation variables static double g_Tvct(0); //!< Vertical charge-transfer period (in seconds). static double g_texp(1); //!< Exposure time. @@ -99,8 +101,8 @@ static double g_L1(0); // Calibration parameters static int nsubImages(0); //!< Number of sub images static int binning(1); //!< The number of samples/lines which are binned -static bool g_nullPolarizedPixels = true; /**< Flag which tells us if the Polarized pixels are to - to be set to ISIS::Null */ +static bool g_nullPolarizedPixels = true; /**< Flag which tells us if the Polarized pixels are to + to be set to ISIS::Null */ static bool g_iofCorrection = true; //!< Is I/F correction to be applied? @@ -119,7 +121,7 @@ static QVector hotPixelVector; //!< A pixel vector that contains the Hot //PSF variables static int ns,nl,nb; //!< Number of samples, lines, bands of the input cube -//static int g_size(23); //!< The size of the Boxcar used for calculating the light diffusion model. +//static int g_size(23); //!< The size of the Boxcar used for calculating the light diffusion model. static const int g_N = 6; static double g_alpha(0.0); @@ -144,6 +146,9 @@ void IsisMain() { Cube *icube = p.SetInputCube("FROM"); + + + // Basic assurances... if (icube->bandCount() != 1) { throw IException(IException::User, @@ -183,19 +188,29 @@ void IsisMain() { } + try { g_temp = inst["CcdTemperature"] ; } catch(IException &e) { + QString msg = "Unable to read [CcdTemperature] keyword in the Instrument group " "from input file [" + icube->fileName() + "]"; throw IException(e, IException::Io,msg, _FILEINFO_); + } + + +//tjw QString startTime = inst["SpacecraftClockStartCount"]; + + + + g_startTime = startTime; binning = inst["Binning"]; @@ -204,29 +219,43 @@ void IsisMain() { int lastline = inst["LastLine"]; int lastsample = inst["LastSample"]; - nsubImages = archive["SubImageCount"]; /**< If > 1, on-board smear-correction has been - performed. */ + + nsubImages = archive["SubImageCount"]; // If > 1, some correction is + // not needed/performed + + + + + // I/F values QString target = inst["TargetName"]; g_target = target; + if ( sunDistanceAU(startTime,target,g_solarDist) ) { + g_iof = pi_c()*(g_solarDist*g_solarDist)*(g_v_standard*g_iofScale); + } + + // Determine if we need to subsample the flat field should pixel binning // occurred QScopedPointer flatcube; FileName flatfile= DetermineFlatFieldFile(g_filter,g_nullPolarizedPixels); + QString reducedFlat(flatfile.expanded()); //Image is not cropped if (startline ==0 && startsample == 0){ + if (binning > 1) { QString scale(toString(binning)); FileName newflat = FileName::createTempFile("$TEMPORARY/" + flatfile.baseName() + "_reduced.cub"); + reducedFlat = newflat.expanded(); QString parameters = "FROM=" + flatfile.expanded() + " TO=" + newflat.expanded() + @@ -253,7 +282,8 @@ if (startline ==0 && startsample == 0){ else { - //Image is cropped so we have to deal with it + + //Image is cropped so we have to deal with it FileName transFlat = FileName::createTempFile("$TEMPORARY/" + flatfile.baseName() + "_translated.cub"); @@ -282,8 +312,12 @@ else { nl = icube->lineCount(); nb = icube->bandCount(); + loadCalibrationVariables(); + g_timeRatio = g_Tvct/(g_texp+g_Tvct); + + g_darkCurrent = g_d0*exp(g_d1*g_temp); // Calibrate! @@ -305,12 +339,19 @@ else { ProcessByBoxcar pDiffusionModel; QScopedPointer diffusionModel; + QString kernel_sz = QString::number(g_size); + + //QTemporaryFile psfModel("$TEMPORARY/psfModel.cub"); + + QFile psfModel("psfModel"+QString::number(g_size)+".cub"); + //QFile("psfModel.cub"); //psfModel.setAutoRemove(false); + pDiffusionModel.SetInputCube(fname,attInput); pDiffusionModel.SetOutputCube(psfModel.fileName(),attOutput,ns,nl,nb); @@ -318,16 +359,22 @@ else { g_psfFilter = setPSFFilter(g_size, g_A,g_sigma, g_alpha,g_N,binning); try { + pDiffusionModel.StartProcess(psfCorrectionBoxcar); //Determine the diffusion model. + } + catch(IException &ie){ + throw IException(ie, IException::Programmer, "Calculating the diffusion model failed!", _FILEINFO_); + } + pDiffusionModel.EndProcess(); - //Apply the PSF correction + //Apply the PSF correction ProcessByLine pPSFCorrection; //The diffusion model @@ -347,12 +394,14 @@ else { throw IException(ie, IException::Programmer, "Applying the PSF correction failed!", _FILEINFO_); + + } + pPSFCorrection.EndProcess(); #endif - // Log calibration activity PvlGroup calibrationLog("RadiometricCalibration"); calibrationLog.addKeyword(PvlKeyword("SoftwareName", amicacal_program)); @@ -373,24 +422,31 @@ else { /** * @brief Determine name of flat field file to apply + * * @author 2016-03-30 Kris Becker + * * @param filter Name of AMICA filter + * * @return FileName Path and name of flat file file */ FileName DetermineFlatFieldFile(const QString &filter, const bool nullPolarPix) { QString fileName = "$hayabusa/calibration/flatfield/"; + // FileName consists of binned/notbinned, camera, and filter if (nullPolarPix) { fileName += "flat_" + filter.toLower() + "np.cub"; } else { + fileName += "flat_" + filter.toLower() + ".cub"; + } FileName final(fileName); + //tjw: So was this part //final = final.highestVersion(); return final; } @@ -403,16 +459,28 @@ FileName DetermineFlatFieldFile(const QString &filter, const bool nullPolarPix) * @param result The light diffusion estimate at the central pixel of the boxcar of all the * surrounding pixels. */ + void psfCorrectionBoxcar(Buffer &in, double &result) { result = 0; + Statistics stats; + for (int i = 0; i < in.size(); i++) { + + if(!IsSpecial(in[i])) { - stats.AddData(in[i]*g_psfFilter[i]); + + stats.AddData(in[i]*g_psfFilter[i]); + //result += in[i]*g_psfFilter[i]; } + } + result = stats.Sum(); + + + } @@ -422,12 +490,15 @@ void psfCorrectionBoxcar(Buffer &in, double &result) { * @parm in[1] The radiometrically corrected cube (without PSF correction). * @param out The radiometrically corrected cube after PSF correction has been applied. */ + void psfCorrection(vector &in, vector &out) { + Buffer& nopsf = *in[1]; Buffer& psfVals = *in[0]; Buffer& imageOut = *out[0]; + for (int i = 0; i < nopsf.size(); i++) { if (!IsSpecial(psfVals[i])) { @@ -477,9 +548,11 @@ void loadCalibrationVariables() { int samp(hotPixels[i][0].toInt()); int line (hotPixels[i][1].toInt()); + hotPixelVector.append( Pixel(alpha->BetaSample(samp),alpha->BetaLine(line),1,0)); } + //Load linearity variables g_Gamma = Linearity["Gamma"]; g_Gamma = 1.0-g_Gamma; @@ -490,6 +563,8 @@ void loadCalibrationVariables() { //Load Smear Removal Variables g_Tvct = Smear["Tvct"]; + + //Load DarkCurrent variables g_d0 = DarkCurrent["D"][0].toDouble(); g_d1 = DarkCurrent["D"][1].toDouble(); @@ -560,6 +635,7 @@ void loadCalibrationVariables() { * @param in Raw image and flat field * @param out Radometrically corrected image */ + void Calibrate(vector& in, vector& out) { Buffer& imageIn = *in[0]; @@ -572,12 +648,16 @@ void Calibrate(vector& in, vector& out) { int alphaSample = alpha->AlphaSample(currentSample); if ( (alphaSample <= pixelsToNull) || (alphaSample >= (1024 - pixelsToNull ))) { + for (int i = 0; i < imageIn.size(); i++ ) { imageOut[i] = Isis::Null; } return; + } + + //Compute smear component here as its a constant for the entire sample double t1 = g_timeRatio/imageIn.size(); @@ -595,11 +675,14 @@ void Calibrate(vector& in, vector& out) { } + //iterate over the line space for (int i = 0; i < imageIn.size(); i++) { + imageOut[i] = imageIn[i]; + // Check for special pixel in input image and pass through if (Isis::IsSpecial(imageOut[i])) { imageOut[i] = imageIn[i]; @@ -618,12 +701,14 @@ void Calibrate(vector& in, vector& out) { } } + // 2) LINEARITY Correction - always done if (imageOut[i] != Isis::Null) { imageOut[i] = pow(imageOut[i],g_Gamma) +g_L0*imageOut[i]*exp(g_L1*imageOut[i]); } + // 3) DARK Current - Currently negligible and removed #if 0 @@ -632,32 +717,43 @@ void Calibrate(vector& in, vector& out) { #endif + // 4) HOT Pixel Removal bool hot = false; for (int j=0; j < hotPixelVector.size(); j++) { + if ((hotPixelVector[j].sample() == currentSample) && (hotPixelVector[j].line() == i)) { + imageOut[i] = Isis::Null; hot = true; + } } if (hot == true) continue; + + // 5) READOUT Smear Removal - Not needed if on-board corrected. Binning is // accounted for in computation of c1 before loop. + + if ( imageOut[i] != Isis::Null && nsubImages <= 1 ) { imageOut[i] = c1*(imageOut[i] - smear); + } + // 6) FLATFIELD correction // Check for any special pixels in the flat field (unlikely) + if (Isis::IsSpecial(flatField[i])) { imageOut[i] = Isis::Null; continue; @@ -667,8 +763,10 @@ void Calibrate(vector& in, vector& out) { imageOut[i] /= flatField[i]; } + // 7) I/F Conversion + if (imageOut[i] != Isis::Null && g_iofCorrection == true) { imageOut[i] *= g_iof; }