ISIS Application Documentation
    Convert camera image to a skymap projection
  
            Description
              Categories
              Groups
              History
          Description
        
    This program converts a cube in camera coordinates to a map projection.  It differs from the application "cam2map" in that it maps camera
    ra/dec (right acsension/declination) to map projection longitude/latitude.  The program is useful for inflight geometric and optical distortion
    calibration of a camera when star images are collected.  The input cube labels must have an Instrument Group and
    Kernels Group.  That is, the program "spiceinit" should be run on the input cube prior to "skymap".  
    
    This program will pick appropriate defaults for most parameters.   In particular for the MAP parameter, it will generate the following:
    
    
  Group = Mapping
    TargetName             = "Sky"
    EquatorialRadius       = 1.0
    PolarRadius            = 1.0
    LatitudeType           = Planetocentric
    LongitudeDirection     = PositiveEast
    LongitudeDomain        = 360
    MinimumLatitude        = Computed from the input camera cube or map file
    MaximumLatitude        = Computed from the input camera cube or map file
    MinimumLongitude       = Computed from the input camera cube or map file
    MaximumLongitude       = Computed from the input camera cube or map file
    ProjectionName         = Projection name in the map file
    Scale                 = Computed from the input camera cube or map file
  EndGroup
    
    Note that although the map projection group reflects latitude/longitude, those values are synomous with declination/right ascension.
  
  Note that an important concept here is a Mapping group can come from any PVL file.   You can use an existing map projected cube
  as input for the MAP user parameter.  Because the cube has PVL labels and contains the Mapping group, you will essentially force
  the input camera cube to have the same mapping parameters or match the existing cube.  Information about map projections and
  the Mapping group can be found in the Isis user documentation.
  
  
    Finally, the user has the option to override the pixel resolution and the ground range (latitude/longitude).  These changes can be
    facilitied through the parameters SCALE, SRA, ERA, SDEC, and EDEC.
  
   
          Categories
        
                Parameter Groups
            
Files
| 
                    Name
                     | 
                    Description
                     | 
| FROM | 
          Input cube to project
         | 
| MAP | 
          File containing mapping parameters
         | 
| TO | 
          Newly mapped cube
         | 
Output Map Scale
| 
                    Name
                     | 
                    Description
                     | 
| DEFAULTSCALE | Defines how the scale in the output map file is obtained | 
| SCALE | Scale in pixels per degree | 
Output Map Sky Range
| 
                    Name
                     | 
                    Description
                     | 
| DEFAULTRANGE | Defines how the default sky range is determined | 
| SRA | Starting right ascension | 
| ERA | Ending right ascension | 
| SDEC | Starting declination | 
| EDEC | Ending declination | 
| TRIM | 
          Trim pixels outside sky range
         | 
Options
| 
                    Name
                     | 
                    Description
                     | 
| INTERP | Type of interpolation | 
Files:
                        FROM
                         Description
                       
          The specification of the input cube to be projected.  The cube must
          contain a valid Instrument and Kernel group in the labels.
        
| 
                             Type
                            | cube | 
| 
                               File Mode
                              | input | 
| 
                               Filter
                              | 
          *.cub
         | 
 
Files:
                        MAP
                         Description
                       
          A file containing the desired output mapping parameters in PVL form.  This
          file can be a simple hand produced label file.  It can also be an existing cube label
          which contains a Mapping group.
        
| 
                             Type
                            | filename | 
| 
                               File Mode
                              | input | 
| 
                               Default Path
                              | $ISISROOT/appdata/templates/maps | 
| 
                               Default
                              | $ISISROOT/appdata/templates/maps/simplecylindrical.map | 
| 
                               Filter
                              | 
          *.map *.cub
         | 
 
Files:
                        TO
                         Description
                       
          This file will contain the sky as a map projected image.
        
| 
                             Type
                            | cube | 
| 
                               File Mode
                              | output | 
| 
                               Filter
                              | 
          *.cub
         | 
 
Output Map Scale:
                        DEFAULTSCALE
                         Description
                       
          This parameter is used to specify how the scale is obtained for the output map
          projected cube. 
        
| 
                             Type
                            | string | 
| 
                               Default
                              | CAMERA | 
| 
                               Option List:
                              | 
| 
                                   Option | 
                                   Brief | 
                                   Description | 
 
| CAMERA | Compute resolution from input cube | 
                This option will automatically determine the scale from the input  cube specified using the FROM parameter.
              Exclusions
 | 
 
| MAP | Read scale from input map file | 
                This option will use the Scale (pixels/degree) in the map file.
              Exclusions
 | 
 
| USER |  Get scale from user | 
                This option allows the user to specify the resolution using the SCALE parameter.  The scale
                should be entered in pixels/degree.
              Inclusions
 | 
 
 
 | 
 
Output Map Scale:
                        SCALE
                         Description
                       
            The number of pixels per degrees (RA/DEC).  By default, 
            the program attempts to compute this value as 1 / IFOV of the camera. 
            Note you will typically need to convert
            IFOV in milli-or-micro radians to degrees.
            Alternatively, you can entered the scale in the MAP file in
            pixels per degrees (1 / IFOV).  That is,
            
              Group = Mapping
                ...
                Scale = 17000.0
              End_Group
              End_Group
            
        
| 
                             Type
                            | double | 
| 
                               Minimum
                              | 0.0
                                   (exclusive)
                                  | 
 
Output Map Sky Range:
                        DEFAULTRANGE
                         Description
                       
          This parameter is used to specify how the default ra/dec ground range for the output map projected image
          is obtained.  Note the user can overide the default using the SRA, ERA, SDEC, EDEC parameters.
        
| 
                             Type
                            | string | 
| 
                               Default
                              | CAMERA | 
| 
                               Option List:
                              | 
| 
                                   Option | 
                                   Brief | 
                                   Description | 
 
| CAMERA |  Compute default range from input cube | 
                This option will automatically determine the mininum/maximum ra/dec from the input camera model cube specified
                using the FROM parameter.
               | 
 
| MAP |  Read default range from map file | 
                This option will read the mininum/maximum ra/dec from the input map file.  All four values are expected to be defined.
               | 
 
 
 | 
 
Output Map Sky Range:
                        SRA
                         Description
                       
          The starting right ascension of the sky map.   If not entered it will be read computed from the CAMERA or read from the MAP file, depending 
          on the option chosen for DEFAULTRANGE.  If this value is entered, it will override the default value.   
        
| 
                             Type
                            | double | 
| 
                               Internal Default
                              | Use default range | 
| 
                               Minimum
                              | 0.0
                                   (inclusive)
                                  | 
| 
                               Maximum
                              | 360.0
                                   (inclusive)
                                  | 
 
Output Map Sky Range:
                        ERA
                         Description
                       
          The ending right ascension of the sky map.   If not entered it will be read computed from the CAMERA or read from the MAP file, depending 
          on the option chosen for DEFAULTRANGE.  If this value is entered, it will override the default value.   
        
| 
                             Type
                            | double | 
| 
                               Internal Default
                              | Use default range | 
| 
                               Minimum
                              | 0.0
                                   (inclusive)
                                  | 
| 
                               Maximum
                              | 360.0
                                   (inclusive)
                                  | 
| 
                               Greater Than
                              | 
 | 
 
Output Map Sky Range:
                        SDEC
                         Description
                       
          The starting declination of the sky map.  If not entered it will be read computed from the CAMERA or read from the MAP file, depending 
          on the option chosen for DEFAULTRANGE.  If this value is entered, it will override the default value.    
        
| 
                             Type
                            | double | 
| 
                               Internal Default
                              | Use default range | 
| 
                               Minimum
                              | -90.0
                                   (inclusive)
                                  | 
| 
                               Maximum
                              | 90.0
                                   (inclusive)
                                  | 
 
Output Map Sky Range:
                        EDEC
                         Description
                       
          The ending declination of the sky map.   If not entered it will be read computed from the CAMERA or read from the MAP file, depending 
          on the option chosen for DEFAULTRANGE.  If this value is entered, it will override the default value.    
        
| 
                             Type
                            | double | 
| 
                               Internal Default
                              | Use default range | 
| 
                               Minimum
                              | -90.0
                                   (inclusive)
                                  | 
| 
                               Maximum
                              | 90.0
                                   (inclusive)
                                  | 
| 
                               Greater Than
                              | 
 | 
 
Output Map Sky Range:
                        TRIM
                         Description
                       
          If this option is selected, pixels outside the ra/dec
          range be trimmed or set to null.
          This is useful for certain projections whose lines of latitude and
          longitude are not parallel to image lines and sample columns.
        
| 
                             Type
                            | boolean | 
| 
                               Default
                              | FALSE | 
 
Options:
                        INTERP
                         Description
                       
          This is the type of interpolation to be performed on the input.
        
| 
                             Type
                            | string | 
| 
                               Default
                              | 
          CUBICCONVOLUTION
         | 
| 
                               Option List:
                              | 
| 
                                   Option | 
                                   Brief | 
                                   Description | 
 
| NEARESTNEIGHBOR | Nearest Neighbor | 
              Each output pixel will be set to the pixel nearest the
              calculated input pixel.
             | 
 
| BILINEAR | Bi-Linear interpolation | 
              Each output pixel will be set to the value calculated by
              a bi-linear interpolation of the calculated input pixel.
             | 
 
| CUBICCONVOLUTION | Cubic Convolution interpolation | 
              Each output pixel will be set to the value calculated by
              a cubic convolution interpolation of the calculated input pixel.
             | 
 
 
 | 
 
              History
          
| Jeff Anderson | 2004-12-14 | 
      Original version
     | 
| Jeff Anderson | 2005-09-21 | 
      Fixed bug with program not using all keywords in
      the user MAP file
     | 
| Jeff Anderson | 2005-10-13 | 
      Fixed bug with garbage pixels being produced
      at extremities of the projected image edges.
     | 
| Jeff Anderson | 2005-10-17 | 
      Fixed bug, full mapping group was not written to
      cube labels.  Also, updated documentation to correctly
      state that the RESOLUTION parameter is the IFOV of
      the camera .
     | 
| Brendan George | 2005-11-08 | 
      Added application test
     | 
| Tracie Sucharski | 2006-04-11 | 
        Check to see if center of input image projects, if it does, force the  tile containing center
        to be processed in ProcessRubberSheet.
      | 
| Elizabeth Miller | 2006-05-03 | 
        Redid UI to match cam2map 
       | 
| Elizabeth Miller | 2006-05-18 | 
        Depricated CubeProjection and ProjectionManager to ProjectionFactory
       | 
| Elizabeth Miller | 2006-05-30 | 
        Moved helper buttons and refined helper error checking 
       | 
| Steven Lambright | 2007-06-22 | 
        Fixed typo in user documentation
       | 
| Steven Lambright | 2008-05-13 | 
        Removed references to CubeInfo 
       | 
| Travis Addair | 2009-08-10 | 
        Mapping group parameters are now placed into the print file.
       | 
| Debbie A. Cook | 2012-12-10 | 
        Changed to use TProjection instead of Projection.  References #775
       |