OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ossimNitfRpcModel Class Reference

#include <ossimNitfRpcModel.h>

Inheritance diagram for ossimNitfRpcModel:
ossimRpcModel ossimSensorModel ossimProjection ossimOptimizableProjection ossimAdjustableParameterInterface ossimObject ossimErrorStatusInterface ossimReferenced

Public Member Functions

 ossimNitfRpcModel ()
 
 ossimNitfRpcModel (const ossimNitfRpcModel &rhs)
 
 ossimNitfRpcModel (const ossimFilename &nitfFile)
 
virtual ossimObjectdup () const
 dup() Returns pointer to a new instance, copy of this. More...
 
virtual void worldToLineSample (const ossimGpt &world_point, ossimDpt &image_point) const
 worldToLineSample() Calls ossimRpcModel::worldToLineSample(), then applies (if needed) decimation. More...
 
virtual void lineSampleHeightToWorld (const ossimDpt &image_point, const double &heightEllipsoid, ossimGpt &worldPoint) const
 lineSampleHeightToWorld() Backs out decimation of image_point (if needed) then calls: ossimRpcModel::lineSampleHeightToWorld This is a temp work around for decimation RPC NITFs. More...
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Saves "decimation". More...
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 Looks for decimation. More...
 
virtual bool parseFile (const ossimFilename &nitfFile, ossim_uint32 entryIndex=0)
 Method to parse an nitf file and initialize model. More...
 
virtual bool parseImageHeader (const ossimNitfImageHeader *ih)
 
- Public Member Functions inherited from ossimRpcModel
 ossimRpcModel ()
 default constructor More...
 
 ossimRpcModel (const ossimRpcModel &copy_this)
 copy construtor More...
 
void setAttributes (ossim_float64 theSampleOffset, ossim_float64 theLineOffset, ossim_float64 theSampleScale, ossim_float64 theLineScale, ossim_float64 theLatOffset, ossim_float64 theLonOffset, ossim_float64 theHeightOffset, ossim_float64 theLatScale, ossim_float64 theLonScale, ossim_float64 theHeightScale, const std::vector< double > &xNumeratorCoeffs, const std::vector< double > &xDenominatorCoeffs, const std::vector< double > &yNumeratorCoeffs, const std::vector< double > &yDenominatorCoeffs, PolynomialType polyType=B, bool computeGsdFlag=true)
 
void setMetersPerPixel (const ossimDpt &metersPerPixel)
 
void setPositionError (const ossim_float64 &biasError, const ossim_float64 &randomError, bool initNominalPostionErrorFlag)
 Sets data member theBiasError, theRandError. More...
 
virtual std::ostream & print (std::ostream &out) const
 print() Extends base-class implementation. More...
 
virtual void lineSampleToWorld (const ossimDpt &image_point, ossimGpt &world_point) const
 
virtual void imagingRay (const ossimDpt &image_point, ossimEcefRay &image_ray) const
 imagingRay() Overrides base class pure virtual. More...
 
virtual void updateModel ()
 
virtual void initAdjustableParameters ()
 
virtual bool useForward () const
 
virtual bool setupOptimizer (const ossimString &init_file)
 uses file path to init model More...
 
virtual ossimDpt getForwardDeriv (int parmIdx, const ossimGpt &gpos, double h)
 Compute partials of samp/line WRT ground point. More...
 
double getBiasError () const
 Returns Error - Bias. More...
 
double getRandError () const
 Returns Error - Random. More...
 
void getRpcParameters (ossimRpcModel::rpcModelStruct &model) const
 Returns RPC parameter set in structure. More...
 
void setImageOffset (const ossimDpt &offset_to_chip_ul)
 Allows setting an offset to a subimage while using the coefficients of a full-image model. More...
 
bool toJSON (std::ostream &json) const
 Serializes RPC to JSON format. More...
 
bool toRPB (std::ostream &out) const
 Serialize to WorldView-style .RPB file to the stream provided. More...
 
- Public Member Functions inherited from ossimSensorModel
 ossimSensorModel ()
 
 ossimSensorModel (const ossimSensorModel &copy_this)
 
 ossimSensorModel (const ossimKeywordlist &geom_kwl)
 
const ossimSensorModeloperator= (const ossimSensorModel &rhs)
 assignment operator More...
 
virtual ossimObjectgetBaseObject ()
 
virtual const ossimObjectgetBaseObject () const
 
virtual ossimGpt origin () const
 
virtual ossimDpt getMetersPerPixel () const
 
virtual const double & getNominalPosError () const
 Returns the estimated Absolute horizontal position error (CE90) of the sensor model. More...
 
virtual const double & getRelativePosError () const
 Returns the estimated RELATIVE horizontal position error (CE90) of the sensor model. More...
 
virtual void setNominalPosError (const double &ce90)
 Assigns the absolute image position error uncertainty (abs CE90) More...
 
virtual void setRelativePosError (const double &ce90)
 Assigns the relative image position error uncertainty (rel CE90) More...
 
void setRefImgPt (const ossimDpt &pt)
 Sets the center line sampe of the image. More...
 
void setRefGndPt (const ossimGpt &pt)
 Sets the center latitude, longitude, height of the image. More...
 
void setImageRect (const ossimDrect &imageRect)
 
void setGroundRect (const ossimGpt &ul, const ossimGpt &ur, const ossimGpt &lr, const ossimGpt &ll)
 
ossimDpt imageSize () const
 
void setImageSize (const ossimDpt &size)
 
virtual void adjustableParametersChanged ()
 
virtual bool insideImage (const ossimDpt &p) const
 
virtual bool operator== (const ossimProjection &proj) const
 
const ossimStringgetImageID () const
 Access methods: More...
 
const ossimDrectgetImageClipRect () const
 
virtual ossim_uint32 degreesOfFreedom () const
 
virtual bool needsInitialState () const
 needsInitialState() More...
 
virtual double optimizeFit (const ossimTieGptSet &tieSet, double *targetVariance=0)
 
virtual ossimGpt getInverseDeriv (int parmIdx, const ossimDpt &ipos, double hdelta=1e-11)
 
virtual ossimSensorModel::CovMatStatus getObsCovMat (const ossimDpt &ipos, NEWMAT::SymmetricMatrix &Cov, const ossim_float64 defPointingSigma=0.5) const
 Gives 2X2 covariance matrix of observations. More...
 
virtual bool isAffectedByElevation () const
 Implementation of pure virtual ossimProjection::isAffectedByElevation method. More...
 
void computeGsd ()
 This method computes the ground sample distance(gsd) and sets class attributes theGSD and theMeanGSD by doing a lineSampleHeightToWorld on four points and calculating the distance from them. More...
 
virtual bool getImageGeometry (const ossimString &, const ossimString &, ossimKeywordlist &) const
 Extracts geometry info from a non-ossim key,value pair to an ossim keyword list. More...
 
- Public Member Functions inherited from ossimProjection
 ossimProjection ()
 
virtual ~ossimProjection ()
 
virtual ossimDpt forward (const ossimGpt &wp) const
 
virtual ossimGpt inverse (const ossimDpt &pp) const
 
virtual void getRoundTripError (const ossimDpt &imagePoint, ossimDpt &errorResult) const
 
virtual void getRoundTripError (const ossimGpt &groundPoint, ossimDpt &errorResult) const
 
virtual void getGroundClipPoints (ossimGeoPolygon &gpts) const
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
virtual bool operator!= (const ossimProjection &projection) const
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getDescription () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual void accept (ossimVisitor &visitor)
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 
- Public Member Functions inherited from ossimOptimizableProjection
 ossimOptimizableProjection ()
 
 ossimOptimizableProjection (const ossimOptimizableProjection &source)
 
virtual ~ossimOptimizableProjection ()
 
virtual ossimOptimizableProjectionoperator= (const ossimOptimizableProjection &source)
 
- Public Member Functions inherited from ossimAdjustableParameterInterface
 ossimAdjustableParameterInterface ()
 
 ossimAdjustableParameterInterface (const ossimAdjustableParameterInterface &rhs)
 
virtual ~ossimAdjustableParameterInterface ()
 
void newAdjustment (ossim_uint32 numberOfParameters=0)
 
void setAdjustmentDescription (const ossimString &description)
 
ossimString getAdjustmentDescription () const
 
ossimString getAdjustmentDescription (ossim_uint32 adjustmentIdx) const
 Returns adjustmentDescription of specific adjustmentInfo. More...
 
void setCurrentAdjustment (ossim_uint32 adjustmentIndex, bool notify=false)
 
bool setCurrentAdjustment (const ossimString &description, bool notify=false)
 Sets the current adjustment to the adjustment with a matching description. More...
 
void eraseAdjustment (bool notify)
 
void eraseAdjustment (ossim_uint32 idx, bool notify)
 
void resetAdjustableParameters (bool notify=false)
 
void copyAdjustment (ossim_uint32 idx, bool notify)
 
void copyAdjustment (bool notify=false)
 
void keepAdjustment (ossim_uint32 idx, bool createCopy)
 
virtual void keepAdjustment (bool createCopy=true)
 
const ossimAdjustableParameterInterfaceoperator= (const ossimAdjustableParameterInterface &rhs)
 
void removeAllAdjustments ()
 
ossim_uint32 getNumberOfAdjustableParameters () const
 
double getAdjustableParameter (ossim_uint32 idx) const
 
virtual void setAdjustableParameter (ossim_uint32 idx, double value, bool notify=false)
 
virtual void setAdjustableParameter (ossim_uint32 idx, double value, double sigma, bool notify=false)
 
double getParameterSigma (ossim_uint32 idx) const
 
void setParameterSigma (ossim_uint32 idx, double value, bool notify=false)
 
ossimUnitType getParameterUnit (ossim_uint32 idx) const
 
void setParameterUnit (ossim_uint32 idx, ossimUnitType unit)
 
void setParameterUnit (ossim_uint32 idx, const ossimString &unit)
 
void setParameterCenter (ossim_uint32 idx, double center, bool notify=false)
 
double getParameterCenter (ossim_uint32 idx) const
 
double computeParameterOffset (ossim_uint32 idx) const
 
void setParameterOffset (ossim_uint32 idx, ossim_float64 value, bool notify=false)
 
ossimString getParameterDescription (ossim_uint32 idx) const
 
void setParameterDescription (ossim_uint32 idx, const ossimString &descrption)
 
ossim_int32 findParameterIdxGivenDescription (ossim_uint32 adjustmentIdx, const ossimString &name) const
 
ossim_int32 findParameterIdxContainingDescription (ossim_uint32 adjustmentIdx, const ossimString &name) const
 
bool isParameterLocked (ossim_uint32 idx) const
 
void setParameterLockFlag (ossim_uint32 idxParam, bool flag)
 
bool getParameterLockFlag (ossim_uint32 idx) const
 
void lockAllParametersCurrentAdjustment ()
 
void unlockAllParametersCurrentAdjustment ()
 
void lockAllParameters (ossim_uint32 idxAdjustment)
 
void unlockAllParameters (ossim_uint32 idxAdjustment)
 
void resizeAdjustableParameterArray (ossim_uint32 numberOfParameters)
 
void setAdjustment (const ossimAdjustmentInfo &adj, bool notify=false)
 
void setAdjustment (ossim_uint32 idx, const ossimAdjustmentInfo &adj, bool notify=false)
 
void addAdjustment (const ossimAdjustmentInfo &adj, bool notify)
 
void getAdjustment (ossimAdjustmentInfo &adj) const
 
void getAdjustment (ossim_uint32 idx, ossimAdjustmentInfo &adj) const
 
ossim_uint32 getNumberOfAdjustments () const
 
ossim_uint32 getCurrentAdjustmentIdx () const
 
void setDirtyFlag (bool flag=true)
 
void setAllDirtyFlag (bool flag=true)
 
bool hasDirtyAdjustments () const
 
virtual void saveCurrentAdjustmentOnly (ossimKeywordlist &kwl, const ossimString &prefix=ossimString(""))
 Saves the current active adjustment to the KWL file. More...
 
bool saveAdjustments (ossimKeywordlist &kwl, const ossimString &prefix=ossimString("")) const
 Save all adjustments to the KWL file. More...
 
bool loadAdjustments (const ossimKeywordlist &kwl, const ossimString &prefix=ossimString(""))
 
std::ostream & print (std::ostream &out) const
 Dumps the currently active adjustment to ostream. More...
 

Private Member Functions

void getGsd (const ossimNitfImageHeader *ih)
 Attempts to get gsd from nitf tags and initialize ossimSensorModel::theGsd. More...
 
void getSensorID (const ossimNitfImageHeader *ih)
 Attempts to get sensor ID from nitf tags and initialize ossimSensorModel::theSensorID. More...
 
bool getRpcData (const ossimNitfImageHeader *ih)
 Get model information from either the RPC00A or RPC00B tag. More...
 

Private Attributes

ossim_float64 theDecimation
 Stored from header field "IMAG". More...
 

Additional Inherited Members

- Public Types inherited from ossimRpcModel
enum  PolynomialType { A ='A', B ='B' }
 
- Public Types inherited from ossimSensorModel
enum  CovMatStatus { COV_INVALID = 0, COV_PARTIAL = 1, COV_FULL = 2 }
 
enum  DeriveMode {
  OBS_INIT =-99, EVALUATE =-98, P_WRT_X = -1, P_WRT_Y = -2,
  P_WRT_Z = -3
}
 
- Static Public Member Functions inherited from ossimRpcModel
static void writeGeomTemplate (ostream &os)
 STATIC METHOD: writeGeomTemplate(ostream) Writes a template of geom keywords processed by loadState and saveState to output stream. More...
 
- Static Public Member Functions inherited from ossimSensorModel
static void writeGeomTemplate (ostream &os)
 
- Protected Types inherited from ossimRpcModel
enum  AdjustParamIndex {
  INTRACK_OFFSET = 0, CRTRACK_OFFSET, INTRACK_SCALE, CRTRACK_SCALE,
  MAP_ROTATION, NUM_ADJUSTABLE_PARAMS
}
 
- Protected Member Functions inherited from ossimRpcModel
virtual ~ossimRpcModel ()
 virtual destructor More...
 
double polynomial (const double &nlat, const double &nlon, const double &nhgt, const double *coeffs) const
 
double dPoly_dLat (const double &nlat, const double &nlon, const double &nhgt, const double *coeffs) const
 
double dPoly_dLon (const double &nlat, const double &nlon, const double &nhgt, const double *coeffs) const
 
double dPoly_dHgt (const double &nlat, const double &nlon, const double &nhgt, const double *coeffs) const
 
- Protected Member Functions inherited from ossimSensorModel
virtual ~ossimSensorModel ()
 
virtual ossimDpt extrapolate (const ossimGpt &gp) const
 
virtual ossimGpt extrapolate (const ossimDpt &ip, const double &height=ossim::nan()) const
 
void buildNormalEquation (const ossimTieGptSet &tieSet, NEWMAT::SymmetricMatrix &A, NEWMAT::ColumnVector &residue, NEWMAT::ColumnVector &projResidue, double pstep_scale)
 
NEWMAT::ColumnVector getResidue (const ossimTieGptSet &tieSet)
 
NEWMAT::ColumnVector solveLeastSquares (NEWMAT::SymmetricMatrix &A, NEWMAT::ColumnVector &r) const
 
NEWMAT::Matrix invert (const NEWMAT::Matrix &m) const
 stable invert stolen from ossimRpcSolver More...
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimAdjustableParameterInterface
bool paramChanged (ossim_uint32 param_idx) const
 Returns true if specified parameter has been modified since last setAllChangeFlag(false) call. More...
 
void setAllChangeFlags (bool areChanged)
 Sets all the change flags to the boolean indicated to indicate parameters are changed (TRUE) or not (FALSE). More...
 
void initChangeFlags ()
 Initializes the change flags to TRUE. More...
 
- Protected Attributes inherited from ossimRpcModel
PolynomialType thePolyType
 
double theLineScale
 
double theSampScale
 
double theLatScale
 
double theLonScale
 
double theHgtScale
 
double theLineOffset
 
double theSampOffset
 
double theLatOffset
 
double theLonOffset
 
double theHgtOffset
 
double theIntrackOffset
 
double theCrtrackOffset
 
double theIntrackScale
 
double theCrtrackScale
 
double theCosMapRot
 
double theSinMapRot
 
double theBiasError
 error More...
 
double theRandError
 
double theLineNumCoef [20]
 
double theLineDenCoef [20]
 
double theSampNumCoef [20]
 
double theSampDenCoef [20]
 
- Protected Attributes inherited from ossimSensorModel
ossimIpt theImageSize
 
ossimDpt theSubImageOffset
 
ossimString theImageID
 
ossimString theSensorID
 
ossimDpt theGSD
 
ossim_float64 theMeanGSD
 
ossimGpt theRefGndPt
 
ossimDpt theRefImgPt
 
ossimPolygon theBoundGndPolygon
 
ossimDrect theImageClipRect
 
ossim_float64 theRelPosError
 
ossim_float64 theNominalPosError
 
ossimDpt theParWRTx
 Partials for current point. More...
 
ossimDpt theParWRTy
 
ossimDpt theParWRTz
 
ossimDpt theObs
 Observations & residuals for current point. More...
 
ossimDpt theResid
 
ossimRefPtr< ossimProjectiontheSeedFunction
 Used as an initial guess for iterative solutions and a guess for points outside the support bounds. More...
 
bool theExtrapolateImageFlag
 
bool theExtrapolateGroundFlag
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 

Detailed Description


CLASS: ossimNitfRpcModel

Definition at line 33 of file ossimNitfRpcModel.h.

Constructor & Destructor Documentation

◆ ossimNitfRpcModel() [1/3]

ossimNitfRpcModel::ossimNitfRpcModel ( )

Definition at line 47 of file ossimNitfRpcModel.cpp.

Referenced by dup().

48  :
49  ossimRpcModel(),
50  theDecimation(1.0)
51 {
52 }
ossimRpcModel()
default constructor
ossim_float64 theDecimation
Stored from header field "IMAG".

◆ ossimNitfRpcModel() [2/3]

ossimNitfRpcModel::ossimNitfRpcModel ( const ossimNitfRpcModel rhs)

Definition at line 54 of file ossimNitfRpcModel.cpp.

55  :
56  ossimRpcModel(rhs),
57  theDecimation(1.0)
58 {
59 }
ossimRpcModel()
default constructor
ossim_float64 theDecimation
Stored from header field "IMAG".

◆ ossimNitfRpcModel() [3/3]

ossimNitfRpcModel::ossimNitfRpcModel ( const ossimFilename nitfFile)

Definition at line 67 of file ossimNitfRpcModel.cpp.

68  :
69  ossimRpcModel(),
70  theDecimation(1.0)
71 {
72  if (traceExec())
73  {
75  << "DEBUG ossimNitfRpcModel::ossimNitfRpcModel(nitfFile): entering..."
76  << std::endl;
77  }
78  if(!parseFile(nitfFile))
79  {
80  if (traceExec())
81  {
83  << "DEBUG ossimNitfRpcModel::ossimNitfRpcModel(nitfFile): Unable to parse file " << nitfFile
84  << std::endl;
85  }
87  }
88 
89  if (traceExec())
90  {
92  << "DEBUG ossimNitfRpcModel::ossimNitfRpcModel(nitfFile): returning..."
93  << std::endl;
94  }
95 }
ossimRpcModel()
default constructor
virtual bool parseFile(const ossimFilename &nitfFile, ossim_uint32 entryIndex=0)
Method to parse an nitf file and initialize model.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_float64 theDecimation
Stored from header field "IMAG".

Member Function Documentation

◆ dup()

ossimObject * ossimNitfRpcModel::dup ( ) const
virtual

dup() Returns pointer to a new instance, copy of this.

Reimplemented from ossimRpcModel.

Definition at line 97 of file ossimNitfRpcModel.cpp.

References ossimNitfRpcModel().

98 {
99  return new ossimNitfRpcModel(*this);
100 }

◆ getGsd()

void ossimNitfRpcModel::getGsd ( const ossimNitfImageHeader ih)
private

Attempts to get gsd from nitf tags and initialize ossimSensorModel::theGsd.

If unsuccessful theGsd will be initialized to OSSIM_DBL_NAN.

Definition at line 316 of file ossimNitfRpcModel.cpp.

References ossimNitfImageHeader::getTagData(), ossimDpt::line, ossim::nan(), ossimDpt::samp, and ossimSensorModel::theGSD.

317 {
318  theGSD.line = ossim::nan();
319  theGSD.samp = ossim::nan();
320 
321  if (!ih)
322  {
323  return;
324  }
325 
327  tag = ih->getTagData(PIAIMC_TAG);
328  if (tag.valid())
329  {
331  if (p)
332  {
335  return;
336  }
337  }
338 
339  tag = ih->getTagData(USE00A_TAG);
340  if (tag.valid())
341  {
343  if (p)
344  {
347  }
348  }
349 }
bool valid() const
Definition: ossimRefPtr.h:75
double samp
Definition: ossimDpt.h:164
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
double line
Definition: ossimDpt.h:165
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
ossimRefPtr< ossimNitfRegisteredTag > getTagData(const ossimString &tagName)
ossim_float64 getMeanGsdInMeters() const
ossim_float64 getMeanGsdInMeters() const

◆ getRpcData()

bool ossimNitfRpcModel::getRpcData ( const ossimNitfImageHeader ih)
private

Get model information from either the RPC00A or RPC00B tag.

Returns
true on success, false on error.

Definition at line 380 of file ossimNitfRpcModel.cpp.

References ossimNitfImageHeader::getTagData().

Referenced by parseImageHeader().

381 {
382  if (!ih)
383  {
384  return false;
385  }
386 
387  // Get the the RPC tag:
388  ossimNitfRpcBase* rpcTag = 0;
389 
390  // Look for the RPC00B tag first.
391  ossimRefPtr<ossimNitfRegisteredTag> tag = ih->getTagData(RPC00B_TAG);
392  if (tag.valid())
393  {
394  rpcTag = PTR_CAST(ossimNitfRpcBase, tag.get());
395  }
396 
397  if (!rpcTag)
398  {
399  // Look for RPC00A tag.
400  tag = ih->getTagData(RPC00A_TAG);
401  if (tag.valid())
402  {
403  rpcTag = PTR_CAST(ossimNitfRpcBase, tag.get());
404  }
405  }
406 
407  if (!rpcTag)
408  {
409  if (traceDebug())
410  {
412  << "ossimNitfRpcModel::getRpcData DEBUG:"
413  << "\nCould not find neither RPC tags <" << RPC00A_TAG
414  << "> nor <" << RPC00B_TAG
415  << "\nAborting with error..."
416  << std::endl;
417  }
418  return false;
419  }
420 
421  if ( rpcTag->getSuccess() == false )
422  {
423  if (traceDebug())
424  {
426  << "ossimNitfRpcModel::getRpcData DEBUG:"
427  << "\nSuccess flag set to false."
428  << "\nAborting with error..."
429  << std::endl;
430  }
431  return false;
432  }
433 
434  // Set the polynomial type.
435  if (rpcTag->getRegisterTagName() == "RPC00B")
436  {
437  thePolyType = B;
438  }
439  else
440  {
441  thePolyType = A;
442  }
443 
444  // Now parse the tag block for pertinent data:
445  theBiasError = rpcTag->getErrorBias().toFloat64();
446  theRandError = rpcTag->getErrorRand().toFloat64();
447  theLineOffset = rpcTag->getLineOffset().toFloat64();
452  theLineScale = rpcTag->getLineScale().toFloat64();
453  theSampScale = rpcTag->getSampleScale().toFloat64();
457 
458  // OBC has some data with negative height offsets that blows up the ray intersection with elevation model. The bilinear model seems more accurate than trying to work around this.
459  if (ih->getImageSource().trim() == "OBC" && theHgtOffset < 0)
460  {
461  if (traceDebug())
462  {
464  << "ossimNitfRpcModel::getRpcData DEBUG:"
465  << "\nHeight Offset will force invalid ellipsoid intersection."
466  << "\nAborting with error..."
467  << std::endl;
468  }
469  return false;
470  }
471 
472  // Parse coefficients:
473  ossim_uint32 i;
474 
475  for (i=0; i<20; ++i)
476  {
481  }
482 
483  // Assign other data members to default values:
485  theRandError*theRandError); // meters
486 
487  return true;
488 }
double theSampOffset
PolynomialType thePolyType
ossimString getLineScale() const
double theSampNumCoef[20]
ossimString getGeodeticHeightScale() const
ossimString getLineDenominatorCoeff(ossim_uint32 idx) const
bool valid() const
Definition: ossimRefPtr.h:75
bool getSuccess() const
virtual std::string getRegisterTagName() const
This will return the name of the registered tag for this user defined header.
virtual ossimString getImageSource() const =0
ossimString getSampleOffset() const
double theLonScale
double theLineScale
ossimString getSampleDenominatorCoeff(ossim_uint32 idx) const
double theSampDenCoef[20]
ossimString getLineOffset() const
double theLineNumCoef[20]
double theLatOffset
double theHgtOffset
double theLonOffset
ossimString getGeodeticHeightOffset() const
double theRandError
ossim_float64 theNominalPosError
double theLatScale
unsigned int ossim_uint32
ossimString trim(const ossimString &valueToTrim=ossimString(" \\)) const
this will strip lead and trailing character passed in.
ossim_float64 toFloat64() const
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
ossimString getErrorBias() const
ossimString getLineNumeratorCoeff(ossim_uint32 idx) const
ossimString getSampleNumeratorCoeff(ossim_uint32 idx) const
ossimString getGeodeticLatScale() const
ossimRefPtr< ossimNitfRegisteredTag > getTagData(const ossimString &tagName)
ossimString getErrorRand() const
double theSampScale
ossimString getGeodeticLonOffset() const
ossimString getSampleScale() const
double theLineDenCoef[20]
ossimString getGeodeticLatOffset() const
double theLineOffset
double theHgtScale
double theBiasError
error
ossimString getGeodeticLonScale() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ getSensorID()

void ossimNitfRpcModel::getSensorID ( const ossimNitfImageHeader ih)
private

Attempts to get sensor ID from nitf tags and initialize ossimSensorModel::theSensorID.

If unsuccessful theGsd will be initialized to UNKNOWN.

Definition at line 351 of file ossimNitfRpcModel.cpp.

References ossimNitfImageHeader::getTagData(), and ossimSensorModel::theSensorID.

352 {
353  theSensorID = "UNKNOWN";
354 
355  if (!ih)
356  {
357  return;
358  }
359 
361  tag = ih->getTagData(STDIDC_TAG);
362  if (tag.valid())
363  {
365  if (p)
366  {
367  theSensorID = p->getMission();
368  return;
369  }
370  }
371 
372  if (traceDebug())
373  {
375  << "ossimNitfRpcModel::getSensorID DEBUG:"
376  << "\ntheSensorID set to: " << theSensorID << endl;
377  }
378 }
ossimString theSensorID
ossimString getMission() const
bool valid() const
Definition: ossimRefPtr.h:75
#define PTR_CAST(T, p)
Definition: ossimRtti.h:321
ossimRefPtr< ossimNitfRegisteredTag > getTagData(const ossimString &tagName)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ lineSampleHeightToWorld()

void ossimNitfRpcModel::lineSampleHeightToWorld ( const ossimDpt image_point,
const double &  heightEllipsoid,
ossimGpt worldPoint 
) const
virtual

lineSampleHeightToWorld() Backs out decimation of image_point (if needed) then calls: ossimRpcModel::lineSampleHeightToWorld This is a temp work around for decimation RPC NITFs.

Reimplemented from ossimRpcModel.

Definition at line 273 of file ossimNitfRpcModel.cpp.

References ossimRpcModel::lineSampleHeightToWorld(), theDecimation, ossimDpt::x, and ossimDpt::y.

277 {
278  // Convert image point to full res (not decimated) point.
279  ossimDpt pt;
280  pt.x = image_point.x / theDecimation;
281  pt.y = image_point.y / theDecimation;
282 
283  // Call base...
284  ossimRpcModel::lineSampleHeightToWorld(pt, heightEllipsoid, worldPoint);
285 }
double y
Definition: ossimDpt.h:165
virtual void lineSampleHeightToWorld(const ossimDpt &image_point, const double &heightEllipsoid, ossimGpt &worldPoint) const
double x
Definition: ossimDpt.h:164
ossim_float64 theDecimation
Stored from header field "IMAG".

◆ loadState()

bool ossimNitfRpcModel::loadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)
virtual

Looks for decimation.

Then calls ossimRpcModel::loadState.

Reimplemented from ossimRpcModel.

Definition at line 297 of file ossimNitfRpcModel.cpp.

References ossimKeywordlist::find(), ossimRpcModel::loadState(), theDecimation, and ossimString::toFloat64().

299 {
300  // Lookup decimation.
301  const char* value = kwl.find(prefix, "decimation");
302  if (value)
303  {
305  if (theDecimation <= 0.0)
306  {
307  // Do not allow negative or "0.0"(divide by zero).
308  theDecimation = 1.0;
309  }
310  }
311 
312  // Call base.
313  return ossimRpcModel::loadState(kwl, prefix);
314 }
const char * find(const char *key) const
ossim_float64 toFloat64() const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
loadState Fulfills ossimObject base-class pure virtuals.
ossim_float64 theDecimation
Stored from header field "IMAG".

◆ parseFile()

bool ossimNitfRpcModel::parseFile ( const ossimFilename nitfFile,
ossim_uint32  entryIndex = 0 
)
virtual

Method to parse an nitf file and initialize model.

Parameters
entryIndexThe entry to get model for. Note the nitf's can have multiple entries; each with a different projection.
Returns
true on success, false on error.

Definition at line 102 of file ossimNitfRpcModel.cpp.

References ossimRefPtr< T >::get(), ossimNitfFile::getNewImageHeader(), ossimNitfFile::parseFile(), parseImageHeader(), and ossimErrorStatusInterface::setErrorStatus().

104 {
106 
107  if(!file->parseFile(nitfFile))
108  {
109  setErrorStatus();
110  return false;
111  }
112 
114  if(!ih)
115  {
116  setErrorStatus();
117  return false;
118  }
119 
120  return parseImageHeader(ih.get());
121 
122 }
ossimNitfImageHeader * getNewImageHeader(ossim_uint32 imageNumber) const
virtual bool parseImageHeader(const ossimNitfImageHeader *ih)
bool parseFile(const ossimFilename &file)

◆ parseImageHeader()

bool ossimNitfRpcModel::parseImageHeader ( const ossimNitfImageHeader ih)
virtual

Definition at line 124 of file ossimNitfRpcModel.cpp.

References getRpcData().

Referenced by parseFile().

125 {
126  // Do this first so we don't waste time if not rpc image.
127  if (getRpcData(ih) == false)
128  {
129  if (traceDebug())
130  {
132  << "ossimNitfRpcModel::parseFile DEBUG:"
133  << "\nError parsing rpc tags. Aborting with error."
134  << std::endl;
135  }
136  setErrorStatus();
137  return false;
138  }
139 
140 
141  //---
142  // Get the decimation if any from the header "IMAG" field.
143  //
144  // Look for string like:
145  // "/2" = 1/2
146  // "/4 = 1/4
147  // ...
148  // "/16 = 1/16
149  // If it is full resolution it should be "1.0"
150  //---
152  if ( os.contains("/") )
153  {
154  os = os.after("/");
155  ossim_float64 d = os.toFloat64();
156  if (d)
157  {
158  theDecimation = 1.0 / d;
159  }
160  }
161 
162  //***
163  // Fetch Image ID:
164  //***
165  theImageID = ih->getImageId();
166 
167  ossimIrect imageRect = ih->getImageRect();
168 
169  //---
170  // Fetch Image Size:
171  //---
173  static_cast<ossim_int32>(imageRect.height() / theDecimation);
175  static_cast<ossim_int32>(imageRect.width() / theDecimation);
176 
177  // Search for the STDID Tag to fetch mission (satellite) name:
178  getSensorID(ih);
179 
180  //***
181  // Assign other data members:
182  //***
188 
189  //***
190  // Assign the bounding image space rectangle:
191  //***
192  theImageClipRect = ossimDrect(0.0, 0.0,
194 
195  //---
196  // Assign the bounding ground polygon:
197  //
198  // NOTE: We will use the base ossimRpcModel for transformation since all
199  // of our calls are in full image space (not decimated).
200  //---
201  ossimGpt v0, v1, v2, v3;
202  ossimDpt ip0 (0.0, 0.0);
204  ossimDpt ip1 (theImageSize.samp-1.0, 0.0);
206  ossimDpt ip2 (theImageSize.samp-1.0, theImageSize.line-1.0);
208  ossimDpt ip3 (0.0, theImageSize.line-1.0);
210 
212  = ossimPolygon (ossimDpt(v0), ossimDpt(v1), ossimDpt(v2), ossimDpt(v3));
213 
214  updateModel();
215 
216  // Set the ground reference point.
218  theHgtOffset,
219  theRefGndPt);
221  {
222  if (traceDebug())
223  {
225  << "ossimNitfRpcModel::ossimNitfRpcModel DEBUG:"
226  << "\nGround Reference Point not valid."
227  << " Aborting with error..."
228  << std::endl;
229  }
230  setErrorStatus();
231  return false;
232  }
233 
234  //---
235  // This will set theGSD and theMeanGSD. This model doesn't need these but
236  // others do.
237  //---
238  try
239  {
240  computeGsd();
241  }
242  catch (const ossimException& e)
243  {
244  if (traceDebug())
245  {
247  << "ossimNitfRpcModel::ossimNitfRpcModel DEBUG:\n"
248  << e.what() << std::endl;
249  }
250  }
251 
252  if (traceExec())
253  {
255  << "DEBUG ossimNitfRpcModel::parseFile: returning..."
256  << std::endl;
257  }
258 
259  return true;
260 }
bool isLonNan() const
Definition: ossimGpt.h:140
ossimString theImageID
double samp
Definition: ossimDpt.h:164
ossim_uint32 height() const
Definition: ossimIrect.h:487
bool contains(char aChar) const
Definition: ossimString.h:58
void getSensorID(const ossimNitfImageHeader *ih)
Attempts to get sensor ID from nitf tags and initialize ossimSensorModel::theSensorID.
virtual ossimString getImageMagnification() const =0
virtual void updateModel()
ossim_float64 hgt
Height in meters above the ellipsiod.
Definition: ossimGpt.h:274
bool isLatNan() const
Definition: ossimGpt.h:139
double theLatOffset
double ossim_float64
double theHgtOffset
double theLonOffset
void computeGsd()
This method computes the ground sample distance(gsd) and sets class attributes theGSD and theMeanGSD ...
double line
Definition: ossimDpt.h:165
ossim_float64 lon
Definition: ossimGpt.h:266
virtual const char * what() const
Returns the error message.
virtual ossimIrect getImageRect() const =0
ossimPolygon theBoundGndPolygon
virtual ossimString getImageId() const =0
ossim_float64 toFloat64() const
virtual void lineSampleHeightToWorld(const ossimDpt &image_point, const double &heightEllipsoid, ossimGpt &worldPoint) const
ossim_uint32 width() const
Definition: ossimIrect.h:500
bool getRpcData(const ossimNitfImageHeader *ih)
Get model information from either the RPC00A or RPC00B tag.
ossimDrect theImageClipRect
ossim_int32 samp
Definition: ossimIpt.h:141
ossim_int32 line
Definition: ossimIpt.h:142
ossim_float64 lat
Definition: ossimGpt.h:265
ossimString after(const ossimString &str, std::string::size_type pos=0) const
METHOD: after(str, pos) Returns string immediately after the token str.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_float64 theDecimation
Stored from header field "IMAG".
int ossim_int32

◆ saveState()

bool ossimNitfRpcModel::saveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const
virtual

Saves "decimation".

Then calls ossimRpcModel::saveState.

Reimplemented from ossimRpcModel.

Definition at line 287 of file ossimNitfRpcModel.cpp.

References ossimKeywordlist::add(), ossimRpcModel::saveState(), and theDecimation.

289 {
290  // Save the decimation.
291  kwl.add(prefix, "decimation", theDecimation);
292 
293  // Call base.
294  return ossimRpcModel::saveState(kwl, prefix);
295 }
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
saveState Fulfills ossimObject base-class pure virtuals.
ossim_float64 theDecimation
Stored from header field "IMAG".

◆ worldToLineSample()

void ossimNitfRpcModel::worldToLineSample ( const ossimGpt world_point,
ossimDpt image_point 
) const
virtual

worldToLineSample() Calls ossimRpcModel::worldToLineSample(), then applies (if needed) decimation.

This is a temp work around for decimation RPC NITFs.

Reimplemented from ossimRpcModel.

Definition at line 262 of file ossimNitfRpcModel.cpp.

References theDecimation, ossimRpcModel::worldToLineSample(), ossimDpt::x, and ossimDpt::y.

264 {
265  // Get the full res (not decimated) point.
266  ossimRpcModel::worldToLineSample(world_point, image_point);
267 
268  // Apply decimation.
269  image_point.x = image_point.x * theDecimation;
270  image_point.y = image_point.y * theDecimation;
271 }
virtual void worldToLineSample(const ossimGpt &world_point, ossimDpt &image_point) const
worldToLineSample() Overrides base class implementation.
double y
Definition: ossimDpt.h:165
double x
Definition: ossimDpt.h:164
ossim_float64 theDecimation
Stored from header field "IMAG".

Member Data Documentation

◆ theDecimation

ossim_float64 ossimNitfRpcModel::theDecimation
private

Stored from header field "IMAG".

This is a temp work around to handle decimated rpc nitf's.

Definition at line 110 of file ossimNitfRpcModel.h.

Referenced by lineSampleHeightToWorld(), loadState(), saveState(), and worldToLineSample().


The documentation for this class was generated from the following files: