USGS

Isis 3.0 Application Source Code Reference

Home

SpiceKernel.h

Go to the documentation of this file.
00001 #if !defined(SpiceKernel_h)
00002 #define SpiceKernel_h
00003 /**                                                                       
00004  * @file                                                                  
00005  * $Revision$ 
00006  * $Date$
00007  *                                                                        
00008  *   Unless noted otherwise, the portions of Isis written by the USGS are 
00009  *   public domain. See individual third-party library and package descriptions 
00010  *   for intellectual property information, user agreements, and related  
00011  *   information.                                                         
00012  *                                                                        
00013  *   Although Isis has been used by the USGS, no warranty, expressed or   
00014  *   implied, is made by the USGS as to the accuracy and functioning of such 
00015  *   software and related material nor shall the fact of distribution     
00016  *   constitute any such warranty, and no responsibility is assumed by the
00017  *   USGS in connection therewith.                                        
00018  *                                                                        
00019  *   For additional information, launch                                   
00020  *   $ISISROOT/doc//documents/Disclaimers/Disclaimers.html                
00021  *   in a browser or see the Privacy & Disclaimers page on the Isis website,
00022  *   http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on
00023  *   http://www.usgs.gov/privacy.html.
00024  *  
00025  *   $Id$
00026  */                                                                       
00027 
00028 #include <cmath>
00029 #include <string>
00030 #include <vector>
00031 #include <iostream>
00032 #include <sstream>
00033 
00034 #include "iString.h"
00035 #include "iException.h"
00036 #include "SpiceSegment.h"
00037 
00038 namespace Isis {
00039 
00040 /**
00041  * @brief Container for SPICE kernel creation
00042  * 
00043  * This class serves as a container for ISIS cube files to prep for writing the
00044  * contents to a NAIF SPICE kernel.  Each file added is a CK segment.  When the
00045  * ISIS cube is added, the contents of the Table BLOB (InstrumentRotation for
00046  * CKs, InstrumentPosition for SPKs) are read and transformed to the appropriate
00047  * state intended to be compatible with kernels issued by each mission source.
00048  * 
00049  * It is designed for ease of use.  Here is an example to create the most basic
00050  * of CK kernel from a single ISIS file:
00051  * @code
00052  *   SpiceKernel kernel;
00053  *   kernel.add("mycube.cub");
00054  *   kernel.write("mycube.ck");  // Writes a type 3 CK kernel by default
00055  * @endcode
00056  * 
00057  * Note that processing ISIS cubes is expensive in terms of NAIF kernel
00058  * management.  Lots of NAIF kernel activity is incurred in resolving all the
00059  * necessary requirements to get the SPICE data in a form that satisfies NAIF
00060  * kernel specifications.
00061  * 
00062  * @ingroup Utility
00063  * 
00064  * @author 2010-11-22 Kris Becker
00065  * @internal
00066  * @history 2010-12-09 Kris Becker Add documentation and example
00067  */
00068 class SpiceKernel {
00069   public:
00070     SpiceKernel();
00071     virtual ~SpiceKernel() { }
00072 
00073     /** Returns the number of segments */
00074     int size() const { return (_segments.size()); }
00075     const SpiceSegment &operator[](const int i) const;
00076 
00077     void add(const std::string &fname);
00078     void add(Cube &cube);
00079 
00080     std::string getSummary(const std::string &commfile = "") const;
00081 
00082     void write(const std::string &kname, const std::string &commfile = "",
00083                const int ckType = 3) const;
00084 
00085   private:
00086     typedef std::vector<SpiceSegment> Segments;
00087     Segments  _segments;
00088 
00089     void init();
00090     std::string getCkComment(const std::string &comFile = "") const;
00091 };
00092 
00093 };     // namespace Isis
00094 #endif
00095