Commit d677cefe authored by Tyler Wilson's avatar Tyler Wilson
Browse files

Updated mosrange to use updated Camera/CameraPointInfo classes. References #476.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@7071 41f8697f-d340-4b68-9986-7bafba869bb8
parent f5fcf309
Loading
Loading
Loading
Loading
+77 −10
Original line number Diff line number Diff line
@@ -97,6 +97,10 @@ void IsisMain() {
  prog.CheckStatus();

  Statistics scaleStat;

  
  Statistics obliqueScaleStat;

  Statistics longitudeStat;
  Statistics latitudeStat;
  Statistics equiRadStat;
@@ -147,15 +151,51 @@ void IsisMain() {
      // Get resolution
      double lowres = cam->LowestImageResolution();
      double hires = cam->HighestImageResolution();
      scaleStat.AddData(&lowres, 1);

      
      double lowObliqueRes = cam->LowestObliqueImageResolution();


      
      double hiObliqueRes= cam->HighestObliqueImageResolution();


      scaleStat.AddData(&hires, 1);
      scaleStat.AddData(&lowres, 1);

      
      obliqueScaleStat.AddData(&hiObliqueRes,1);
      obliqueScaleStat.AddData(&lowObliqueRes,1);


      double pixres = (lowres + hires) / 2.0;

      
      //double obliquePixRes = (lowObliqueRes+hiObliqueRes)/2.0;

      double scale = Scale(pixres, poleRad, eqRad);

      
      //double obliqueScale = Scale(obliquePixRes,poleRad,eqRad);


      mapgrp.addKeyword(PvlKeyword("PixelResolution", toString(pixres)), Pvl::Replace);

      
      //mapgrp.addKeyword(PvlKeyword("ObliquePixelResolution", toString(obliquePixRes)),
      //                  Pvl::Replace);

      mapgrp.addKeyword(PvlKeyword("Scale", toString(scale), "pixels/degree"), Pvl::Replace);
      mapgrp += PvlKeyword("MinPixelResolution", toString(lowres), "meters");
      mapgrp += PvlKeyword("MaxPixelResolution", toString(hires), "meters");

      
      //mapgrp.addKeyword(PvlKeyword("ObliqueScale", toString(obliqueScale), "pixels/degree"),
      //                  Pvl::Replace);
      mapgrp += PvlKeyword("MinPixelResolution", toString(lowres), "meters/pixel");
      mapgrp += PvlKeyword("MaxPixelResolution", toString(hires), "meters/pixel");

      
      mapgrp += PvlKeyword("MinObliquePixelResolution", toString(lowObliqueRes), "meters/pixel");
      mapgrp += PvlKeyword("MaxObliquePixelResolution", toString(hiObliqueRes), "meters/pixel");

      // Get the universal ground range
      double minlat, maxlat, minlon, maxlon;
@@ -186,11 +226,16 @@ void IsisMain() {
//  Construct the output mapping group with statistics
  PvlGroup mapping("Mapping");
  double avgPixRes( (scaleStat.Minimum() + scaleStat.Maximum() ) / 2.0);

  
  //double avgObliquePixRes( (obliqueScaleStat.Minimum() + obliqueScaleStat.Maximum() ) / 2.0);

  double avgLat((latitudeStat.Minimum() + latitudeStat.Maximum()) / 2.0);
  double avgLon((longitudeStat.Minimum() + longitudeStat.Maximum()) / 2.0);
  double avgEqRad((equiRadStat.Minimum() + equiRadStat.Maximum()) / 2.0);
  double avgPoleRad((poleRadStat.Minimum() + poleRadStat.Maximum()) / 2.0);
  double scale  = Scale(avgPixRes, avgPoleRad, avgEqRad);
  //double obliqueScale = Scale(avgObliquePixRes,avgPoleRad,avgEqRad);

  mapping += PvlKeyword("ProjectionName", projection);
  mapping += PvlKeyword("TargetName", target);
@@ -200,15 +245,37 @@ void IsisMain() {
  mapping += PvlKeyword("LongitudeDirection", londir);
  mapping += PvlKeyword("LongitudeDomain", londom);
  mapping += PvlKeyword("PixelResolution", toString(SetRound(avgPixRes, digits)), "meters/pixel");

  
  //mapping += PvlKeyword("ObliquePixelResolution", toString(SetRound(avgObliquePixRes, digits)),
  //                      "meters/pixel");


  mapping += PvlKeyword("Scale", toString(SetRound(scale, digits)), "pixels/degree");
  mapping += PvlKeyword("MinPixelResolution", toString(scaleStat.Minimum()), "meters");
  mapping += PvlKeyword("MaxPixelResolution", toString(scaleStat.Maximum()), "meters");

  
  //mapping += PvlKeyword("ObliqueScale", toString(SetRound(obliqueScale, digits)), "pixels/degree");


  mapping += PvlKeyword("MinPixelResolution", toString(scaleStat.Minimum()), "meters/pixel");
  mapping += PvlKeyword("MaxPixelResolution", toString(scaleStat.Maximum()), "meters/pixel");

  
  mapping += PvlKeyword("MinObliquePixelResolution", toString(obliqueScaleStat.Minimum()),
                        "meters/pixel");
  mapping += PvlKeyword("MaxObliquePixelResolution", toString(obliqueScaleStat.Maximum()),
                        "meters/pixel");

  mapping += PvlKeyword("CenterLongitude", toString(SetRound(avgLon, digits)));
  mapping += PvlKeyword("CenterLatitude",  toString(SetRound(avgLat, digits)));
  mapping += PvlKeyword("MinimumLatitude", toString(MAX(SetFloor(latitudeStat.Minimum(), digits), -90.0)));
  mapping += PvlKeyword("MaximumLatitude", toString(MIN(SetCeil(latitudeStat.Maximum(), digits), 90.0)));
  mapping += PvlKeyword("MinimumLongitude", toString(MAX(SetFloor(longitudeStat.Minimum(), digits), -180.0)));
  mapping += PvlKeyword("MaximumLongitude", toString(MIN(SetCeil(longitudeStat.Maximum(), digits), 360.0)));
  mapping += PvlKeyword("MinimumLatitude", toString(MAX(SetFloor(latitudeStat.Minimum(),
                                                                 digits), -90.0)));
  mapping += PvlKeyword("MaximumLatitude", toString(MIN(SetCeil(latitudeStat.Maximum(),
                                                                 digits), 90.0)));
  mapping += PvlKeyword("MinimumLongitude", toString(MAX(SetFloor(longitudeStat.Minimum(),
                                                                  digits), -180.0)));
  mapping += PvlKeyword("MaximumLongitude", toString(MIN(SetCeil(longitudeStat.Maximum(),
                                                                 digits), 360.0)));

  PvlKeyword clat("PreciseCenterLongitude", toString(avgLon));
  clat.addComment("Actual Parameters without precision applied");
+11 −2
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>

<application name="mosrange" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://isis.astrogeology.usgs.gov/Schemas/Application/application.xsd">
<application name="mosrange" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"http://isis.astrogeology.usgs.gov/Schemas/Application/application.xsd">
  <brief>
    Compute the lat/lon range of a set camera images for mosaicking
  </brief>
@@ -10,7 +12,8 @@
      This program computes and outputs the 
      <def link="Latitude">latitude</def>/<def link="Longitude">longitude</def>
      range of a set of images in camera space, as well as the <def link="Pixel Resolution">
      pixel resolution</def>.  It creates a <i>cam2map</i> ready map file with 
      pixel resolution</def> and the <def link="Oblique Pixel Resolution"> 
      oblique pixel resolution.</def>.  It creates a <i>cam2map</i> ready map file with 
      the extents of the latitude/longitude ranges of the image set.  
    </p>

@@ -47,6 +50,7 @@ Group = Mapping
  <def link="Longitude Direction">LongitudeDirection</def>      = <def link="Positive East Longitude">PositiveEast</def>
  <def link="Longitude Domain">LongitudeDomain</def>         = 360
  <def link="Pixel Resolution">PixelResolution</def>         = 505.3668 &lt;meters/pixel&gt; 
  <def link="Oblique Pixel Resolution">ObliquePixelResolution</def> = 791.251 &lt;meters/pixel&gt;
  <def>Scale</def>                   = 84.2676 &lt;pixels/degree&gt;
  MinPixelResolution      = 483.45317995544 &lt;meters&gt;
  MaxPixelResolution      = 527.28051834369 &lt;meters&gt;
@@ -106,6 +110,11 @@ End
    <change name="Debbie A. Cook" date="2012-10-11">
       Updated to use new Target class. References Mantis tickets #775 and #1114.
    </change>
    <change name="Tyler Wilson" date="2016-08-25">
       Updated to use upated Camera/CameraPointInfo classes which include improved approximations
       to Pixel/Detector/Line/Sample resolutions, as well as providing the ability for developers
       to order the fields in CSV/Pvl output.  References #476"
    </change>
</history>

  <groups>