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

#include <ossimAdjustmentExecutive.h>

Inheritance diagram for ossimAdjustmentExecutive:
ossimObject ossimReferenced

Public Member Functions

 ossimAdjustmentExecutive (std::ostream &report)
 constructor More...
 
 ossimAdjustmentExecutive (ossimObservationSet &obsSet, std::ostream &report)
 ossimObservationSet constructor More...
 
 ~ossimAdjustmentExecutive ()
 destructor More...
 
bool initializeSolution (ossimObservationSet &obsSet)
 initialize adjustment solution More...
 
bool runSolution ()
 run adjustment solution More...
 
void summarizeSolution () const
 summarize solution More...
 
bool computeResidualStatistics (NEWMAT::Matrix &res)
 compute mean and RMS error of residuals More...
 
double computeSEUW ()
 compute SEUW More...
 
std::ostream & printParameterCorrectionSummary (std::ostream &out) const
 Print parameter correction method. More...
 
std::ostream & printObservationCorrectionSummary (std::ostream &out) const
 Print observation correction method. More...
 
std::ostream & printResidualSummary (std::ostream &out) const
 Print residuals method. More...
 
bool isValid () const
 
void setMaxIter (const int maxIter)
 
void setConvCriteria (const int convCriteria)
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
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 bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 
virtual std::ostream & print (std::ostream &out) const
 Generic print method. More...
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) 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
 

Protected Member Functions

bool updateParameters ()
 Update adjustable parameters. More...
 
bool updateObservations ()
 Update observatin. More...
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 

Protected Attributes

bool theExecValid
 
ossimObservationSettheObsSet
 
ossimWLSBundleSolutiontheSol
 
ossimAdjSolutionAttributestheSolAttributes
 
double theConvCriteria
 
int theMaxIter
 
bool theMaxIterExceeded
 
bool theSolDiverged
 
bool theSolConverged
 
int theNumObsInSet
 
int theNumImages
 
int theNumParams
 
int theNumMeasurements
 
int theRankN
 
NEWMAT::Matrix theMeasResiduals
 
NEWMAT::Matrix theObjPartials
 
NEWMAT::Matrix theParPartials
 
double theXrms
 
double theYrms
 
double theXmean
 
double theYmean
 
std::vector< double > theSEUW
 
std::vector< double > theParInitialValues
 
std::vector< double > theParInitialStdDev
 
std::vector< ossimStringtheParDesc
 
std::vector< int > theImgs
 
std::vector< double > theObsInitialValues
 
std::vector< double > theObsInitialStdDev
 
std::ostream & theRep
 

Detailed Description

Definition at line 30 of file ossimAdjustmentExecutive.h.

Constructor & Destructor Documentation

◆ ossimAdjustmentExecutive() [1/2]

ossimAdjustmentExecutive::ossimAdjustmentExecutive ( std::ostream &  report)

constructor

Definition at line 31 of file ossimAdjustmentExecutive.cpp.

32  :
33  theExecValid(false),
34  theSol(0),
36  theConvCriteria(5.0),
37  theMaxIter(7),
38  theMaxIterExceeded(false),
39  theSolDiverged(false),
40  theSolConverged(false),
41  theNumObsInSet(0),
42  theNumImages(0),
43  theNumParams(0),
45  theRankN(0),
49  theXrms(0.0),
50  theYrms(0.0),
51  theXmean(0.0),
52  theYmean(0.0),
53  theSEUW(0),
56  theParDesc(0),
59  theRep(report)
60 {
61  if (traceDebug())
62  {
64  << "\nossimAdjustmentExecutive::ossimAdjustmentExecutive 1 DEBUG:" << std::endl;
65  }
66 }
std::vector< ossimString > theParDesc
std::vector< double > theParInitialStdDev
std::vector< double > theObsInitialStdDev
std::vector< double > theParInitialValues
ossimAdjSolutionAttributes * theSolAttributes
ossimWLSBundleSolution * theSol
std::vector< double > theObsInitialValues
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ ossimAdjustmentExecutive() [2/2]

ossimAdjustmentExecutive::ossimAdjustmentExecutive ( ossimObservationSet obsSet,
std::ostream &  report 
)

ossimObservationSet constructor

Parameters
obsSettiepoint observation set.

Definition at line 76 of file ossimAdjustmentExecutive.cpp.

77  :
78  theExecValid(false),
79  theSol(0),
81  theConvCriteria(5.0),
82  theMaxIter(7),
83  theMaxIterExceeded(false),
84  theSolDiverged(false),
85  theSolConverged(false),
86  theNumObsInSet(0),
87  theNumImages(0),
88  theNumParams(0),
90  theRankN(0),
94  theXrms(0.0),
95  theYrms(0.0),
96  theXmean(0.0),
97  theYmean(0.0),
98  theSEUW(0),
101  theParDesc(0),
104  theRep(report)
105 {
106  if (traceDebug())
107  {
109  << "\nossimAdjustmentExecutive::ossimAdjustmentExecutive 2 DEBUG:" << std::endl;
110  }
111 
113 }
std::vector< ossimString > theParDesc
std::vector< double > theParInitialStdDev
std::vector< double > theObsInitialStdDev
bool initializeSolution(ossimObservationSet &obsSet)
initialize adjustment solution
std::vector< double > theParInitialValues
ossimAdjSolutionAttributes * theSolAttributes
ossimWLSBundleSolution * theSol
std::vector< double > theObsInitialValues
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ ~ossimAdjustmentExecutive()

ossimAdjustmentExecutive::~ossimAdjustmentExecutive ( )

destructor

Definition at line 120 of file ossimAdjustmentExecutive.cpp.

References theSol, and theSolAttributes.

121 {
122  delete theSolAttributes;
123  delete theSol;
124 
125  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG)
126  << "DEBUG: ~ossimAdjustmentExecutive(): returning..." << std::endl;
127 }
ossimAdjSolutionAttributes * theSolAttributes
ossimWLSBundleSolution * theSol
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

Member Function Documentation

◆ computeResidualStatistics()

bool ossimAdjustmentExecutive::computeResidualStatistics ( NEWMAT::Matrix &  res)

compute mean and RMS error of residuals

Parameters
resimage residual matrix.
Returns
true on success, false on error.

Definition at line 592 of file ossimAdjustmentExecutive.cpp.

References n, theNumMeasurements, theRep, theXmean, theXrms, theYmean, and theYrms.

593 {
594  theXmean = 0.0;
595  theYmean = 0.0;
596  theXrms = 0.0;
597  theYrms = 0.0;
598  for (int n=1; n<=res.Nrows();++n)
599  {
600  theXmean += res(n,1);
601  theYmean += res(n,2);
602  theXrms += res(n,1)*res(n,1);
603  theYrms += res(n,2)*res(n,2);
604  }
605 
610 
611  theRep<<"\n";
612  theRep<<" ______________Mean:";
613  theRep<<setprecision(1)<<setw(8)<<theXmean;
614  theRep<<setprecision(1)<<setw(8)<<theYmean;
615  theRep<<" RMS:";
616  theRep<<setprecision(1)<<setw(8)<<theXrms;
617  theRep<<setprecision(1)<<setw(8)<<theYrms;
618  theRep<<endl;
619 
620  return true;
621 }
os2<< "> n<< " > nendobj n

◆ computeSEUW()

double ossimAdjustmentExecutive::computeSEUW ( )

compute SEUW

Returns
standard error of unit weight.

Definition at line 630 of file ossimAdjustmentExecutive.cpp.

References ossimObservationSet::observ(), ossimAdjSolutionAttributes::theImagePtCov, ossimAdjSolutionAttributes::theMeasResiduals, theNumMeasurements, theNumObsInSet, theNumParams, ossimAdjSolutionAttributes::theObjectPtCov, theObsSet, theParInitialStdDev, theRankN, theSolAttributes, and ossimAdjSolutionAttributes::theTotalCorrections.

631 {
632  double vuw = 0.0;
633 
634  // Observation contributions
635  int cMeas = 1;
636  for (int obs=0; obs<theNumObsInSet; ++obs)
637  {
638  NEWMAT::ColumnVector tc(3);
639  NEWMAT::Matrix cov(3,3);
640  int idx = theNumParams + 3*obs + 1;
641  tc = theSolAttributes->theTotalCorrections.Rows(idx, idx+2);
642  idx -= theNumParams;
643  cov = theSolAttributes->theObjectPtCov.SubMatrix(idx,idx+2,1,3);
644  for (int i=1; i<=3; ++i)
645  {
646  vuw += tc(i)*tc(i)/cov(i,i);
647  }
648  for (ossim_uint32 meas=0; meas<theObsSet->observ(obs)->numMeas(); ++meas)
649  {
650  NEWMAT::RowVector res(2);
651  NEWMAT::Matrix cov(2,2);
652  res = theSolAttributes->theMeasResiduals.Row(cMeas);
653  int start = (cMeas-1)*2 + 1;
654  cov = theSolAttributes->theImagePtCov.SubMatrix(start,start+1,1,2);
655  for (int i=1; i<=2; ++i)
656  {
657  vuw += res(i)*res(i)/cov(i,i);
658  }
659  cMeas++;
660  }
661  }
662 
663  // Parameter contributions
664  NEWMAT::ColumnVector tc(theNumParams);
666  for (int par=0; par<theNumParams; ++par)
667  {
668  vuw += tc(par+1)*tc(par+1)/(theParInitialStdDev[par]*theParInitialStdDev[par]);
669  }
670 
671  // DF
672  double df = theNumMeasurements*2 - theRankN;
673  if (df<=0.0)
674  df = 1.0;
675 
676  // SEUW
677  double seuw = sqrt(vuw/df);
678 
679  return seuw;
680 }
std::vector< double > theParInitialStdDev
unsigned int ossim_uint32
ossimAdjSolutionAttributes * theSolAttributes
NEWMAT::ColumnVector theTotalCorrections
ossimRefPtr< ossimPointObservation > observ(const int &i) const

◆ initializeSolution()

bool ossimAdjustmentExecutive::initializeSolution ( ossimObservationSet obsSet)

initialize adjustment solution

Parameters
obsSettiepoint observation set.
Returns
true on success, false on error.

Definition at line 136 of file ossimAdjustmentExecutive.cpp.

137 {
138  if (traceDebug())
139  {
141  << "\nossimAdjustmentExecutive::initializeSolution DEBUG:" << std::endl;
142  }
143  ossimString ts;
144  ossim::getFormattedTime("%a %m.%d.%y %H:%M:%S", false, ts);
145 
146  theObsSet = &obsSet;
147 
148  // Initial report output
149  theRep << "\nossimAdjustmentExecutive Report ";
150  theRep << ts;
151  theRep << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
152  theRep << endl;
154  theRep << endl;
155 
156  theExecValid = false;
157 
158  // Adjustment traits
160  if (theNumObsInSet == 0)
161  return theExecValid;
162 
166 
168 
169 
170  if (traceDebug())
171  {
173  <<"\n theNumObsInSet = "<<theNumObsInSet
174  <<"\n theNumImages = "<<theNumImages
175  <<"\n theNumParams = "<<theNumParams
176  <<"\n theNumMeasurements = "<<theNumMeasurements
177  <<"\n theRankN = "<<theRankN
178  <<std::endl;
179  }
180 
181 
182  // Instantiate solution attributes
185 
186 
187  if (traceDebug())
188  {
190  <<"\n\nInitial Parameter Setup....";
191 
192  for (int i=0; i<theNumImages; i++)
193  {
196  int np = iface->getNumberOfAdjustableParameters();
197  for (int cp=0; cp<np; ++cp)
198  {
200  <<"\n "<<cp<<" "<<iface->getParameterDescription(cp)
201  // <<"= "<<iface->getAdjustableParameter(cp)
202  <<"= "<<iface->getParameterCenter(cp)
203  <<", units= "<<iface->getParameterUnit(cp)
204  <<", sigma= "<<iface->getParameterSigma(cp);
205  }
206  }
208  }
209 
210  // Save parameter initial values and variances
211  int start = 1;
213  for (int i=0; i<theNumImages; i++)
214  {
217  int np = iface->getNumberOfAdjustableParameters();
218  NEWMAT::Matrix parCov(np,np);
219  parCov = 0.0;
220  for (int cp=0; cp<np; ++cp)
221  {
222  // Get the a priori value
223  // theParInitialValues.push_back(iface->getAdjustableParameter(cp));
224  theParInitialValues.push_back(iface->getParameterCenter(cp));
225  theImgs.push_back(i);
226 
227  theParDesc.push_back(iface->getParameterDescription(cp));
228  double sig = iface->getParameterSigma(cp);
229 
230  // If parameter is locked, tighten down the sigma
231  // TODO: Eventually need better handling of this
232  if (iface->isParameterLocked(cp))
233  sig /= 1000;
234 
235  theParInitialStdDev.push_back(sig);
236  parCov(cp+1,cp+1) = sig*sig;
237  }
239  theAdjParCov.SubMatrix(start,start+np-1,start,start+np-1) = parCov;
240  start += np;
241  }
242 
243  // Ensure initial estimates for observations
244  // TODO: Currently uses mean of single-ray point drops; should
245  // eventually use multi-ray intersection, which is only
246  // available via the ossimSensorModelTuple class.
247  for (int obs=0; obs<theNumObsInSet; obs++)
248  {
249  // If ground position not set, initialize it
250  if (theObsSet->observ(obs)->hasNans())
251  {
252  double latMean = 0.0;
253  double lonMean = 0.0;
254  double hgtMean = 0.0;
255  ossimGpt gpt;
256  ossimDpt ipt;
257  for (ossim_uint32 meas=0; meas<theObsSet->observ(obs)->numMeas(); ++meas)
258  {
259  ipt = theObsSet->observ(obs)->getMeasurement(meas);
260  theObsSet->observ(obs)->getImageGeom(meas)->localToWorld(ipt, gpt);
261  latMean += gpt.latr();
262  lonMean += gpt.lonr();
263  hgtMean += gpt.height();
264  }
265  latMean /= theObsSet->observ(obs)->numMeas();
266  lonMean /= theObsSet->observ(obs)->numMeas();
267  hgtMean /= theObsSet->observ(obs)->numMeas();
268  theObsSet->observ(obs)->Gpt().latr(latMean);
269  theObsSet->observ(obs)->Gpt().lonr(lonMean);
270  theObsSet->observ(obs)->Gpt().height(hgtMean);
271  }
272  }
273 
274 
275  // Save observation intial values
276  for (int obs=0; obs<theNumObsInSet; obs++)
277  {
278  theObsInitialValues.push_back(theObsSet->observ(obs)->Gpt().latr());
279  theObsInitialValues.push_back(theObsSet->observ(obs)->Gpt().lonr());
280  theObsInitialValues.push_back(theObsSet->observ(obs)->Gpt().height());
281  }
282 
283 
284  // Load obj/image covariance data
285  int cMeas = 1;
288 
289  for (int obs=0; obs<theNumObsInSet; ++obs)
290  {
291  NEWMAT::Matrix ocov;
292  theObsSet->observ(obs)->getObsCov(ocov);
293  int idx = obs*3+1;
294  theSolAttributes->theObjectPtCov.Rows(idx,idx+2) = ocov;
295  for (int i=1; i<=3; ++i)
296  theObsInitialStdDev.push_back(sqrt(ocov(i,i)));
297  for (ossim_uint32 meas=0; meas<theObsSet->observ(obs)->numMeas(); ++meas)
298  {
299  NEWMAT::Matrix mcov;
300  theObsSet->observ(obs)->getMeasCov((int)meas, mcov);
301  int start = (cMeas-1)*2 + 1;
302  theSolAttributes->theImagePtCov.Rows(start,start+1) = mcov;
303  cMeas++;
304  }
305  }
306 
307 
308  // Load obj/image xref map
309  for (int obs=0; obs<theNumObsInSet; ++obs)
310  {
311  for (ossim_uint32 meas=0; meas<theObsSet->observ(obs)->numMeas(); ++meas)
312  {
313  int img = theObsSet->imIndex(meas);
314  theSolAttributes->theObjImgXref.insert(pair<int, int>(obs, img));
315  }
316  }
317 
318  // Load image/numpar xref map
319  for (int img=0; img<theNumImages; ++img)
320  {
321  int numpar = theObsSet->adjParCount(img);
322  theSolAttributes->theImgNumparXref.insert(pair<int, int>(img, numpar));
323  }
324 
325  if (traceDebug())
326  {
328  <<"\ntheObjImgXref multimap Obs/Img ....\n";
330  it!=theSolAttributes->theObjImgXref.end(); ++it)
331  {
333  <<" "<<it->first<<" "<<it->second<<endl;
334  }
336  <<"\ntheImgNumparXref map Img/Numpar ....\n";
338  it!=theSolAttributes->theImgNumparXref.end(); ++it)
339  {
341  <<" "<<it->first<<" "<<it->second<<endl;
342  }
343  }
344 
345 
346  theRep << "\n Iteration 0...";
347 
349 
350  // Perform initial (0th iteration) observation evaluation
352 
353  if (traceDebug())
354  {
356  <<"\n theObjPartials\n"
357  <<theObjPartials;
358  }
359 
360  // Report residual summary
362 
363  // Residual statistics
365 
366  // Load partials
369 
370  // Load residuals
372 
373  // Initial standard error of unit weight
374  theSEUW.push_back(computeSEUW());
375 
376  // Instantiate solution object
378 
379  theExecValid = true;
380 
381  return theExecValid;
382 }
std::ostream & print(std::ostream &os) const
text output : header + tab separated tie points
bool computeResidualStatistics(NEWMAT::Matrix &res)
compute mean and RMS error of residuals
int imIndex(const int &i) const
int adjParCount(const int &i) const
std::vector< ossimString > theParDesc
std::vector< double > theParInitialStdDev
ossimImageGeometry * getImageGeom(const int index)
ossim_uint32 numImages() const
ossim_uint32 numObs() const
std::vector< double > theObsInitialStdDev
ossim_uint32 numMeas() const
ossimString getParameterDescription(ossim_uint32 idx) const
virtual ossimAdjustableParameterInterface * getAdjustableParameterInterface()
ossimUnitType getParameterUnit(ossim_uint32 idx) const
OSSIM_DLL void getFormattedTime(const std::string &format, bool gmtFlag, std::string &result)
Gets the current time.
double lonr() const
Returns the longitude in radian measure.
Definition: ossimGpt.h:76
unsigned int ossim_uint32
double height() const
Definition: ossimGpt.h:107
ImgNumparMap_t::iterator ImgNumparMapIter_t
ossim_uint32 numAdjPar() const
std::vector< double > theParInitialValues
ossimAdjSolutionAttributes * theSolAttributes
ossimWLSBundleSolution * theSol
bool updateParameters()
Update adjustable parameters.
double latr() const
latr().
Definition: ossimGpt.h:66
ObjImgMap_t::iterator ObjImgMapIter_t
std::vector< double > theObsInitialValues
std::ostream & printResidualSummary(std::ostream &out) const
Print residuals method.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossimRefPtr< ossimPointObservation > observ(const int &i) const
bool evaluate(NEWMAT::Matrix &measResiduals, NEWMAT::Matrix &objPartials, NEWMAT::Matrix &parPartials)
standard evaluation [1] measResiduals: [x,y] residuals (numMeas X 2) [2] objPartials: object point pa...

◆ isValid()

bool ossimAdjustmentExecutive::isValid ( ) const
inline

Definition at line 104 of file ossimAdjustmentExecutive.h.

◆ printObservationCorrectionSummary()

std::ostream & ossimAdjustmentExecutive::printObservationCorrectionSummary ( std::ostream &  out) const

Print observation correction method.

Definition at line 716 of file ossimAdjustmentExecutive.cpp.

References DEG_PER_RAD, ossimObservationSet::observ(), ossimAdjSolutionAttributes::theFullCovMatrix, ossimAdjSolutionAttributes::theLastCorrections, theNumObsInSet, theNumParams, theObsInitialStdDev, theObsInitialValues, theObsSet, theSolAttributes, and ossimAdjSolutionAttributes::theTotalCorrections.

717 {
718  out<<"\nObservation Corrections...";
719  out<<"\n n observation a_priori total_corr last_corr initial_std prop_std";
720  for (int obs=0; obs<theNumObsInSet; ++obs)
721  {
722  out<<"\n "<<setprecision(5)<<setw(2)<<obs+1;
723  out<<" "<<setw(19)<<theObsSet->observ(obs)->ID();
724  double mPerRadp = theObsSet->observ(obs)->Gpt().metersPerDegree().y*DEG_PER_RAD;
725  double mPerRadl = theObsSet->observ(obs)->Gpt().metersPerDegree().x*DEG_PER_RAD;
726  // ossim_uint32 iobs = obs*3+1;
727 
728  for (int k=0; k<3; ++k)
729  {
730  int idx = theNumParams + obs*3 + k + 1;
731  if (k<2)
732  out<<setw(12)<<theObsInitialValues[obs*3+k]*DEG_PER_RAD;
733  else
734  out<<setw(12)<<theObsInitialValues[obs*3+k];
735  double factor;
736  if (k==0)
737  factor = mPerRadp;
738  else if (k==1)
739  factor = mPerRadl;
740  else
741  factor = 1.0;
742  out<<setw(12)<<theSolAttributes->theTotalCorrections(idx)*factor;
743  out<<setw(12)<<theSolAttributes->theLastCorrections(idx)*factor;
744  out<<setw(12)<<theObsInitialStdDev[obs*3+k]*factor;
745  out<<setw(12)<<sqrt(theSolAttributes->theFullCovMatrix(idx,idx))*factor;
746  out<<endl<<" ";
747  }
748  }
749  out<<endl;
750 
751  return out;
752 }
NEWMAT::UpperTriangularMatrix theFullCovMatrix
#define DEG_PER_RAD
std::vector< double > theObsInitialStdDev
ossimAdjSolutionAttributes * theSolAttributes
std::vector< double > theObsInitialValues
NEWMAT::ColumnVector theTotalCorrections
ossimRefPtr< ossimPointObservation > observ(const int &i) const

◆ printParameterCorrectionSummary()

std::ostream & ossimAdjustmentExecutive::printParameterCorrectionSummary ( std::ostream &  out) const

Print parameter correction method.

Definition at line 690 of file ossimAdjustmentExecutive.cpp.

References ossimAdjSolutionAttributes::theFullCovMatrix, theImgs, ossimAdjSolutionAttributes::theLastCorrections, theNumParams, theParDesc, theParInitialStdDev, theParInitialValues, theSolAttributes, and ossimAdjSolutionAttributes::theTotalCorrections.

691 {
692  out<<"\nParameter Corrections...";
693  out<<"\n n im parameter a_priori total_corr last_corr initial_std prop_std";
694  for (int pc=1; pc<=theNumParams; ++pc)
695  {
696  out<<"\n "<<setprecision(5)<<setw(2)<<pc;
697  out<<setw(3)<<theImgs[pc-1]+1;
698  out<<setw(17)<<theParDesc[pc-1];
699  out<<setw(12)<<theParInitialValues[pc-1];
700  out<<setw(12)<<theSolAttributes->theTotalCorrections(pc);
701  out<<setw(12)<<theSolAttributes->theLastCorrections(pc);
702  out<<setw(12)<<theParInitialStdDev[pc-1];
703  out<<setw(12)<<sqrt(theSolAttributes->theFullCovMatrix(pc,pc));
704  }
705  out<<endl;
706 
707  return out;
708 }
NEWMAT::UpperTriangularMatrix theFullCovMatrix
std::vector< ossimString > theParDesc
std::vector< double > theParInitialStdDev
std::vector< double > theParInitialValues
ossimAdjSolutionAttributes * theSolAttributes
NEWMAT::ColumnVector theTotalCorrections

◆ printResidualSummary()

std::ostream & ossimAdjustmentExecutive::printResidualSummary ( std::ostream &  out) const

Print residuals method.

Definition at line 760 of file ossimAdjustmentExecutive.cpp.

References ossimObservationSet::imIndex(), ossimObservationSet::observ(), theMeasResiduals, theNumObsInSet, and theObsSet.

761 {
762  out<<"\nMeasurement Residuals...";
763  out<<"\n observation image samp line initial_meas";
764  int j = 0;
765  for (int obs=0; obs<theNumObsInSet; obs++)
766  {
767  int numMeasPerObs = theObsSet->observ(obs)->numMeas();
768  for (int meas=0; meas<numMeasPerObs; ++meas)
769  {
770  int imIdx = theObsSet->imIndex(j);
771  ++j;
772  out<<"\n";
773  out<<setw(12)<<theObsSet->observ(obs)->ID();
774  out<<setw(8)<<imIdx+1;
775  out<<setprecision(1)<<setw(8)<<theMeasResiduals(j,1);
776  out<<setprecision(1)<<setw(8)<<theMeasResiduals(j,2);
777  out<<" ";
778  theObsSet->observ(obs)->getMeasurement(meas).print(out,1);
779  }
780  out<<endl;
781  }
782 
783  return out;
784 }
int imIndex(const int &i) const
ossimRefPtr< ossimPointObservation > observ(const int &i) const

◆ runSolution()

bool ossimAdjustmentExecutive::runSolution ( )

run adjustment solution

Returns
true on success, false on error.

Definition at line 391 of file ossimAdjustmentExecutive.cpp.

392 {
393  if (traceDebug())
394  {
396  << "\nossimAdjustmentExecutive::runSolution DEBUG:" << std::endl;
397  }
398 
399 
400  // Iterative loop
401  int iter = 0;
402 
403  while (iter < theMaxIter &&
404  !theSolConverged &&
405  !theSolDiverged &&
406  theExecValid)
407  {
408  iter++;
409 
410  theRep << "\n Iteration "<<iter<<"...";
411 
412  // Execute solution
414 
415 
416  if (theExecValid)
417  {
418  // Report corrections
421 
422  // Update adjustable parameters
424 
425  // Update ground points
427 
428  // Perform observation evaluation
430 
431  // Load partials
434 
435  // Load residuals
437 
438  // Report residual summary
440 
441  // Residual statistics
443 
444  // Compute SEUW for current iteration
445  theSEUW.push_back(computeSEUW());
446 
447  // Check convergence
448  double percChange =
449  fabs((theSEUW[iter]-theSEUW[iter-1])/theSEUW[iter-1])*100.0;
450 
451  if ((percChange <= theConvCriteria) && iter>1)
452  theSolConverged = true;
453  else if (iter == theMaxIter)
454  theMaxIterExceeded = true;
455  else if (iter >= 3)
456  {
457  if (theSEUW[iter] > theSEUW[iter-1] &&
458  theSEUW[iter-1] > theSEUW[iter-2] &&
459  theSEUW[iter-2] > theSEUW[iter-3])
460  theSolDiverged = true;
461  }
462  else
463  theSolConverged = false;
464  }
465  }
466 
467  return theExecValid;
468 }
bool computeResidualStatistics(NEWMAT::Matrix &res)
compute mean and RMS error of residuals
std::ostream & printParameterCorrectionSummary(std::ostream &out) const
Print parameter correction method.
std::ostream & printObservationCorrectionSummary(std::ostream &out) const
Print observation correction method.
bool run(ossimAdjSolutionAttributes *solAttributes)
Run solution.
ossimAdjSolutionAttributes * theSolAttributes
ossimWLSBundleSolution * theSol
bool updateParameters()
Update adjustable parameters.
std::ostream & printResidualSummary(std::ostream &out) const
Print residuals method.
bool updateObservations()
Update observatin.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
bool evaluate(NEWMAT::Matrix &measResiduals, NEWMAT::Matrix &objPartials, NEWMAT::Matrix &parPartials)
standard evaluation [1] measResiduals: [x,y] residuals (numMeas X 2) [2] objPartials: object point pa...

◆ setConvCriteria()

void ossimAdjustmentExecutive::setConvCriteria ( const int  convCriteria)
inline

Definition at line 108 of file ossimAdjustmentExecutive.h.

108 { theConvCriteria = convCriteria; }

◆ setMaxIter()

void ossimAdjustmentExecutive::setMaxIter ( const int  maxIter)
inline

Definition at line 106 of file ossimAdjustmentExecutive.h.

◆ summarizeSolution()

void ossimAdjustmentExecutive::summarizeSolution ( ) const

summarize solution

Definition at line 556 of file ossimAdjustmentExecutive.cpp.

References ossim::getFormattedTime(), theConvCriteria, theExecValid, theMaxIter, theMaxIterExceeded, theNumImages, theNumMeasurements, theNumObsInSet, theNumParams, theRep, theSEUW, theSolConverged, and theSolDiverged.

557 {
558  theRep << "\nossimAdjustmentExecutive Summary..."<<std::endl;
559  theRep << " Valid Exec: "<<(theExecValid?"true":"false")<<std::endl;
560  theRep << " Nbr Ground Pts: "<<theNumObsInSet<<std::endl;
561  theRep << " Nbr Image Points: "<<theNumMeasurements<<std::endl;
562  theRep << " Nbr Images: "<<theNumImages<<std::endl;
563  theRep << " Nbr Parameters: "<<theNumParams<<std::endl;
564  theRep << " -------------------------"<<std::endl;
565  theRep << " Solution Converged: "<<(theSolConverged?"true":"false")<<std::endl;
566  theRep << " Solution Diverged: "<<(theSolDiverged?"true":"false")<<std::endl;
567  theRep << " Max Iter Exceeded: "<<(theMaxIterExceeded?"true":"false")<<std::endl;
568  theRep << " Max Iterations: "<<theMaxIter<<std::endl;
569  theRep << " Convergence Crit: "<<theConvCriteria<<"%"<<std::endl;
570 
571  // SEUW history
572  theRep << "\n SEUW Trace...";
573  theRep << "\n Iter SEUW";
574  for (ossim_uint32 iter=0; iter<theSEUW.size(); ++iter)
575  theRep << "\n"<<setw(7)<<iter<<setw(12)<<setprecision(3)<<theSEUW[iter];
576 
577  ossimString ts;
578  ossim::getFormattedTime("%a %m.%d.%y %H:%M:%S", false, ts);
579  theRep << "\n";
580  theRep << "\n" << ts;
581  theRep << "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
582  theRep << endl;
583 }
OSSIM_DLL void getFormattedTime(const std::string &format, bool gmtFlag, std::string &result)
Gets the current time.
unsigned int ossim_uint32

◆ updateObservations()

bool ossimAdjustmentExecutive::updateObservations ( )
protected

Update observatin.

Definition at line 527 of file ossimAdjustmentExecutive.cpp.

References ossimObservationSet::observ(), ossimAdjSolutionAttributes::theLastCorrections, theNumObsInSet, theNumParams, theObsSet, and theSolAttributes.

528 {
529  int currPar = theNumParams + 1;
530  for (int obs=0; obs<theNumObsInSet; ++obs)
531  {
532  double lat = theObsSet->observ(obs)->Gpt().latr();
533  lat += theSolAttributes->theLastCorrections(currPar);
534  currPar++;
535  double lon = theObsSet->observ(obs)->Gpt().lonr();
536  lon += theSolAttributes->theLastCorrections(currPar);
537  currPar++;
538  double hgt = theObsSet->observ(obs)->Gpt().height();
539  hgt += theSolAttributes->theLastCorrections(currPar);
540  currPar++;
541  theObsSet->observ(obs)->Gpt().latr(lat);
542  theObsSet->observ(obs)->Gpt().lonr(lon);
543  theObsSet->observ(obs)->Gpt().height(hgt);
544  }
545 
546  return true;
547 }
ossimAdjSolutionAttributes * theSolAttributes
ossimRefPtr< ossimPointObservation > observ(const int &i) const

◆ updateParameters()

bool ossimAdjustmentExecutive::updateParameters ( )
protected

Update adjustable parameters.

Definition at line 477 of file ossimAdjustmentExecutive.cpp.

References ossimImageGeometry::getAdjustableParameterInterface(), ossimObservationSet::getImageGeom(), ossimAdjustableParameterInterface::getParameterCenter(), ossimObservationSet::imageFile(), ossimObservationSet::observ(), ossimAdjustableParameterInterface::setParameterCenter(), ossimAdjSolutionAttributes::theImgNumparXref, ossimAdjSolutionAttributes::theLastCorrections, theNumImages, theNumObsInSet, theObsSet, and theSolAttributes.

478 {
479  // Update local geometries
480  int currPar = 1;
481  for (int img=0; img<theNumImages; ++img)
482  {
485 
486  for (int par=0; par<theSolAttributes->theImgNumparXref[img]; ++par)
487  {
488  // double middle = iface->getAdjustableParameter(par);
489  // middle += theSolAttributes->theLastCorrections(currPar);
490  // iface->setAdjustableParameter(par, middle, true);
491 
492  double middle = iface->getParameterCenter(par);
493  middle += theSolAttributes->theLastCorrections(currPar);
494  iface->setParameterCenter(par, middle, true);
495 
496  currPar++;
497  }
498  }
499 
500  // Copy updated local geometries to observation geometries
501  for (int img=0; img<theNumImages; ++img)
502  {
503  for (int obs=0; obs<theNumObsInSet; ++obs)
504  {
505  for (ossim_uint32 imgInObs=0; imgInObs<theObsSet->observ(obs)->numImages(); ++imgInObs)
506  {
507  if (theObsSet->observ(obs)->imageFile(imgInObs) ==
508  theObsSet->imageFile(img))
509  {
510  theObsSet->observ(obs)->setImageGeom
511  (imgInObs, theObsSet->getImageGeom(img));
512  }
513  }
514  }
515  }
516 
517  return true;
518 }
ossimImageGeometry * getImageGeom(const int index)
virtual ossimAdjustableParameterInterface * getAdjustableParameterInterface()
unsigned int ossim_uint32
ossimAdjSolutionAttributes * theSolAttributes
ossimFilename imageFile(const int index) const
void setParameterCenter(ossim_uint32 idx, double center, bool notify=false)
ossimRefPtr< ossimPointObservation > observ(const int &i) const

Member Data Documentation

◆ theConvCriteria

double ossimAdjustmentExecutive::theConvCriteria
protected

Definition at line 123 of file ossimAdjustmentExecutive.h.

Referenced by summarizeSolution().

◆ theExecValid

bool ossimAdjustmentExecutive::theExecValid
protected

Definition at line 111 of file ossimAdjustmentExecutive.h.

Referenced by summarizeSolution().

◆ theImgs

std::vector<int> ossimAdjustmentExecutive::theImgs
protected

Definition at line 152 of file ossimAdjustmentExecutive.h.

Referenced by printParameterCorrectionSummary().

◆ theMaxIter

int ossimAdjustmentExecutive::theMaxIter
protected

Definition at line 124 of file ossimAdjustmentExecutive.h.

Referenced by summarizeSolution().

◆ theMaxIterExceeded

bool ossimAdjustmentExecutive::theMaxIterExceeded
protected

Definition at line 125 of file ossimAdjustmentExecutive.h.

Referenced by summarizeSolution().

◆ theMeasResiduals

NEWMAT::Matrix ossimAdjustmentExecutive::theMeasResiduals
protected

Definition at line 137 of file ossimAdjustmentExecutive.h.

Referenced by printResidualSummary().

◆ theNumImages

int ossimAdjustmentExecutive::theNumImages
protected

Definition at line 131 of file ossimAdjustmentExecutive.h.

Referenced by summarizeSolution(), and updateParameters().

◆ theNumMeasurements

int ossimAdjustmentExecutive::theNumMeasurements
protected

◆ theNumObsInSet

int ossimAdjustmentExecutive::theNumObsInSet
protected

◆ theNumParams

int ossimAdjustmentExecutive::theNumParams
protected

◆ theObjPartials

NEWMAT::Matrix ossimAdjustmentExecutive::theObjPartials
protected

Definition at line 138 of file ossimAdjustmentExecutive.h.

◆ theObsInitialStdDev

std::vector<double> ossimAdjustmentExecutive::theObsInitialStdDev
protected

Definition at line 156 of file ossimAdjustmentExecutive.h.

Referenced by printObservationCorrectionSummary().

◆ theObsInitialValues

std::vector<double> ossimAdjustmentExecutive::theObsInitialValues
protected

Definition at line 155 of file ossimAdjustmentExecutive.h.

Referenced by printObservationCorrectionSummary().

◆ theObsSet

ossimObservationSet* ossimAdjustmentExecutive::theObsSet
protected

◆ theParDesc

std::vector<ossimString> ossimAdjustmentExecutive::theParDesc
protected

Definition at line 151 of file ossimAdjustmentExecutive.h.

Referenced by printParameterCorrectionSummary().

◆ theParInitialStdDev

std::vector<double> ossimAdjustmentExecutive::theParInitialStdDev
protected

Definition at line 150 of file ossimAdjustmentExecutive.h.

Referenced by computeSEUW(), and printParameterCorrectionSummary().

◆ theParInitialValues

std::vector<double> ossimAdjustmentExecutive::theParInitialValues
protected

Definition at line 149 of file ossimAdjustmentExecutive.h.

Referenced by printParameterCorrectionSummary().

◆ theParPartials

NEWMAT::Matrix ossimAdjustmentExecutive::theParPartials
protected

Definition at line 139 of file ossimAdjustmentExecutive.h.

◆ theRankN

int ossimAdjustmentExecutive::theRankN
protected

Definition at line 134 of file ossimAdjustmentExecutive.h.

Referenced by computeSEUW().

◆ theRep

std::ostream& ossimAdjustmentExecutive::theRep
protected

Definition at line 158 of file ossimAdjustmentExecutive.h.

Referenced by computeResidualStatistics(), and summarizeSolution().

◆ theSEUW

std::vector<double> ossimAdjustmentExecutive::theSEUW
protected

Definition at line 146 of file ossimAdjustmentExecutive.h.

Referenced by summarizeSolution().

◆ theSol

ossimWLSBundleSolution* ossimAdjustmentExecutive::theSol
protected

Definition at line 117 of file ossimAdjustmentExecutive.h.

Referenced by ~ossimAdjustmentExecutive().

◆ theSolAttributes

ossimAdjSolutionAttributes* ossimAdjustmentExecutive::theSolAttributes
protected

◆ theSolConverged

bool ossimAdjustmentExecutive::theSolConverged
protected

Definition at line 127 of file ossimAdjustmentExecutive.h.

Referenced by summarizeSolution().

◆ theSolDiverged

bool ossimAdjustmentExecutive::theSolDiverged
protected

Definition at line 126 of file ossimAdjustmentExecutive.h.

Referenced by summarizeSolution().

◆ theXmean

double ossimAdjustmentExecutive::theXmean
protected

Definition at line 144 of file ossimAdjustmentExecutive.h.

Referenced by computeResidualStatistics().

◆ theXrms

double ossimAdjustmentExecutive::theXrms
protected

Definition at line 142 of file ossimAdjustmentExecutive.h.

Referenced by computeResidualStatistics().

◆ theYmean

double ossimAdjustmentExecutive::theYmean
protected

Definition at line 145 of file ossimAdjustmentExecutive.h.

Referenced by computeResidualStatistics().

◆ theYrms

double ossimAdjustmentExecutive::theYrms
protected

Definition at line 143 of file ossimAdjustmentExecutive.h.

Referenced by computeResidualStatistics().


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