bool rspfNitfRpcModel::parseImageHeader(const rspfNitfImageHeader* ih)
{
   if (getRpcData(ih) == false)
   {
      if (traceDebug())
      {
         rspfNotify(rspfNotifyLevel_DEBUG)
         << "rspfNitfRpcModel::parseFile DEBUG:"
         << "\nError parsing rpc tags.  Aborting with error."
         << std::endl;
      }
      setErrorStatus();
      return false;
   }
   
   
   rspfString os = ih->getImageMagnification();
   if ( os.contains("/") )
   {
      os = os.after("/");
      rspf_float64 d = os.toFloat64();
      if (d)
      {
         theDecimation = 1.0 / d;
      }
   }
   
   theImageID = ih->getImageId();
   
   rspfIrect imageRect = ih->getImageRect();
   
   theImageSize.line =
   static_cast<rspf_int32>(imageRect.height() / theDecimation);
   theImageSize.samp =
   static_cast<rspf_int32>(imageRect.width() / theDecimation);
   
   getSensorID(ih);
   
   theRefImgPt.line = theImageSize.line/2.0;
   theRefImgPt.samp = theImageSize.samp/2.0;
   theRefGndPt.lat  = theLatOffset;
   theRefGndPt.lon  = theLonOffset;
   theRefGndPt.hgt  = theHgtOffset;
   
   theImageClipRect = rspfDrect(0.0, 0.0,
                                 theImageSize.samp-1, theImageSize.line-1);
   
   rspfGpt v0, v1, v2, v3;
   rspfDpt ip0 (0.0, 0.0);
   rspfRpcModel::lineSampleHeightToWorld(ip0, theHgtOffset, v0);
   rspfDpt ip1 (theImageSize.samp-1.0, 0.0);
   rspfRpcModel::lineSampleHeightToWorld(ip1, theHgtOffset, v1);
   rspfDpt ip2 (theImageSize.samp-1.0, theImageSize.line-1.0);
   rspfRpcModel::lineSampleHeightToWorld(ip2, theHgtOffset, v2);
   rspfDpt ip3 (0.0, theImageSize.line-1.0);
   rspfRpcModel::lineSampleHeightToWorld(ip3, theHgtOffset, v3);
   
   theBoundGndPolygon
   = rspfPolygon (rspfDpt(v0), rspfDpt(v1), rspfDpt(v2), rspfDpt(v3));
   
   updateModel();
   
   rspfRpcModel::lineSampleHeightToWorld(theRefImgPt,
                                          theHgtOffset,
                                          theRefGndPt);
   if ( theRefGndPt.isLatNan() || theRefGndPt.isLonNan() )
   {
      if (traceDebug())
      {
         rspfNotify(rspfNotifyLevel_DEBUG)
         << "rspfNitfRpcModel::rspfNitfRpcModel DEBUG:"
         << "\nGround Reference Point not valid." 
         << " Aborting with error..."
         << std::endl;
      }
      setErrorStatus();
      return false;
   }
   
   try
   {
      computeGsd();
   }
   catch (const rspfException& e)
   {
      if (traceDebug())
      {
         rspfNotify(rspfNotifyLevel_DEBUG)
         << "rspfNitfRpcModel::rspfNitfRpcModel DEBUG:\n"
         << e.what() << std::endl;
      }
   }
   
   if (traceExec())
   {
      rspfNotify(rspfNotifyLevel_DEBUG)
      << "DEBUG rspfNitfRpcModel::parseFile: returning..."
      << std::endl;
   }
   
   return true;
}
bool ossimNitfRpcModel::parseImageHeader(const ossimNitfImageHeader* ih)
{
   // Do this first so we don't waste time if not rpc image.
   if (getRpcData(ih) == false)
   {
      if (traceDebug())
      {
         ossimNotify(ossimNotifyLevel_DEBUG)
         << "ossimNitfRpcModel::parseFile DEBUG:"
         << "\nError parsing rpc tags.  Aborting with error."
         << std::endl;
      }
      setErrorStatus();
      return false;
   }
   
   
   //---
   // Get the decimation if any from the header "IMAG" field.
   // 
   // Look for string like:
   // "/2" = 1/2
   // "/4  = 1/4
   // ...
   // "/16 = 1/16
   // If it is full resolution it should be "1.0"
   //---
   ossimString os = ih->getImageMagnification();
   if ( os.contains("/") )
   {
      os = os.after("/");
      ossim_float64 d = os.toFloat64();
      if (d)
      {
         theDecimation = 1.0 / d;
      }
   }
   
   //***
   // Fetch Image ID:
   //***
   theImageID = ih->getImageId();
   
   ossimIrect imageRect = ih->getImageRect();
   
   //---
   // Fetch Image Size:
   //---
   theImageSize.line =
   static_cast<ossim_int32>(imageRect.height() / theDecimation);
   theImageSize.samp =
   static_cast<ossim_int32>(imageRect.width() / theDecimation);
   
   // Search for the STDID Tag to fetch mission (satellite) name:
   getSensorID(ih);
   
   //***
   // Assign other data members:
   //***
   theRefImgPt.line = theImageSize.line/2.0;
   theRefImgPt.samp = theImageSize.samp/2.0;
   theRefGndPt.lat  = theLatOffset;
   theRefGndPt.lon  = theLonOffset;
   theRefGndPt.hgt  = theHgtOffset;
   
   //***
   // Assign the bounding image space rectangle:
   //***
   theImageClipRect = ossimDrect(0.0, 0.0,
                                 theImageSize.samp-1, theImageSize.line-1);
   
   //---
   // Assign the bounding ground polygon:
   //
   // NOTE:  We will use the base ossimRpcModel for transformation since all
   // of our calls are in full image space (not decimated).
   //---
   ossimGpt v0, v1, v2, v3;
   ossimDpt ip0 (0.0, 0.0);
   ossimRpcModel::lineSampleHeightToWorld(ip0, theHgtOffset, v0);
   ossimDpt ip1 (theImageSize.samp-1.0, 0.0);
   ossimRpcModel::lineSampleHeightToWorld(ip1, theHgtOffset, v1);
   ossimDpt ip2 (theImageSize.samp-1.0, theImageSize.line-1.0);
   ossimRpcModel::lineSampleHeightToWorld(ip2, theHgtOffset, v2);
   ossimDpt ip3 (0.0, theImageSize.line-1.0);
   ossimRpcModel::lineSampleHeightToWorld(ip3, theHgtOffset, v3);
   
   theBoundGndPolygon
   = ossimPolygon (ossimDpt(v0), ossimDpt(v1), ossimDpt(v2), ossimDpt(v3));
   
   updateModel();
   
   // Set the ground reference point.
   ossimRpcModel::lineSampleHeightToWorld(theRefImgPt,
                                          theHgtOffset,
                                          theRefGndPt);
   if ( theRefGndPt.isLatNan() || theRefGndPt.isLonNan() )
   {
      if (traceDebug())
      {
         ossimNotify(ossimNotifyLevel_DEBUG)
         << "ossimNitfRpcModel::ossimNitfRpcModel DEBUG:"
         << "\nGround Reference Point not valid." 
         << " Aborting with error..."
         << std::endl;
      }
      setErrorStatus();
      return false;
   }
   
   //---
   // This will set theGSD and theMeanGSD.  This model doesn't need these but
   // others do.
   //---
   try
   {
      computeGsd();
   }
   catch (const ossimException& e)
   {
      if (traceDebug())
      {
         ossimNotify(ossimNotifyLevel_DEBUG)
         << "ossimNitfRpcModel::ossimNitfRpcModel DEBUG:\n"
         << e.what() << std::endl;
      }
   }
   
   if (traceExec())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
      << "DEBUG ossimNitfRpcModel::parseFile: returning..."
      << std::endl;
   }
   
   return true;
}