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

#include <ossimObservationSet.h>

Inheritance diagram for ossimObservationSet:
ossimObject ossimReferenced

Public Member Functions

 ossimObservationSet ()
 
 ~ossimObservationSet ()
 
ossim_uint32 numImages () const
 
ossim_uint32 numObs () const
 
ossim_uint32 numAdjPar () const
 
ossim_uint32 numMeas () const
 
ossimRefPtr< ossimPointObservationobserv (const int &i) const
 
ossimImageGeometrygetImageGeom (const int index)
 
void setImageGeom (const int index, ossimImageGeometry *geom)
 
int imIndex (const int &i) const
 
int adjParCount (const int &i) const
 
ossimFilename imageFile (const int index) 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 partial derivatives (numMeas*3 X 2) [3] parPartials: image parameter partial derivatives (numParams X 2) More...
 
bool addObservation (ossimRefPtr< ossimPointObservation > obs)
 operations More...
 
std::ostream & print (std::ostream &os) const
 text output : header + tab separated tie points More...
 
- 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 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 Attributes

int theNumAdjPar
 
int theNumMeas
 
int theNumPartials
 
std::vector< ossimRefPtr< ossimPointObservation > > theObs
 
std::vector< int > theImageIndex
 
std::vector< ossimFilenametheImageFiles
 
std::vector< int > theNumAdjParams
 
std::vector< ossimRefPtr< ossimImageHandler > > theImageHandlers
 

Additional Inherited Members

- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 

Detailed Description

Definition at line 22 of file ossimObservationSet.h.

Constructor & Destructor Documentation

◆ ossimObservationSet()

ossimObservationSet::ossimObservationSet ( )

Definition at line 22 of file ossimObservationSet.cpp.

22  :
23 theNumAdjPar(0),
24 theNumMeas(0),
26 {
27  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG)
28  << "DEBUG: ossimObservationSet(): returning..." << std::endl;
29 }
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ ~ossimObservationSet()

ossimObservationSet::~ossimObservationSet ( )

Definition at line 32 of file ossimObservationSet.cpp.

References theImageHandlers.

33 {
34  for (ossim_uint32 i=0; i<theImageHandlers.size(); ++i)
35  theImageHandlers[i] = 0;
36  // for (int i=0; i<theObs.size(); ++i)
37  // theObs[i] = 0;
38 
39  if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG)
40  << "DEBUG: ~ossimObservationSet(): returning..." << std::endl;
41 }
unsigned int ossim_uint32
std::vector< ossimRefPtr< ossimImageHandler > > theImageHandlers
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

Member Function Documentation

◆ addObservation()

bool ossimObservationSet::addObservation ( ossimRefPtr< ossimPointObservation obs)

operations

Definition at line 45 of file ossimObservationSet.cpp.

46 {
47  if (traceDebug())
48  {
50  <<"\n ossimObservationSet::addObservation: "<<obs->ID()<<endl;
51  }
52 
53  theObs.push_back(obs);
54  theNumMeas += obs->numMeas();
55 
56 
57  // Update image list
58  for (ossim_uint32 i=0; i<obs->numImages(); ++i)
59  {
60  if (traceDebug())
61  {
62  ossimNotify(ossimNotifyLevel_DEBUG)<<" i="<<i<<endl;
63  }
64 
65  bool found = false;
66 
67  // Check for image already in list
68  for (ossim_uint32 j=0; j<theImageFiles.size(); ++j)
69  {
70  if (theImageFiles[j] == obs->imageFile(i))
71  {
72  found = true;
73  theImageIndex.push_back(j);
74  int nAdjPar = obs->numPars(i);
75  theNumPartials += nAdjPar;
76  }
77  }
78 
79  // If not found yet, add to image list
80  if (!found)
81  {
82  theImageFiles.push_back(obs->imageFile(i));
83 
84  // Geometry
87  theImageHandlers.push_back(ih);
88 
89  theImageIndex.push_back( (int)(theImageHandlers.size()-1) );
90 
91  // Handle ossimAdjustableParameterInterface
92  ossimAdjustableParameterInterface* adjParIface =
94  if (!adjParIface)
95  {
96  return false;
97  }
98  else
99  {
100  if (traceDebug())
101  {
102  ossimNotify(ossimNotifyLevel_DEBUG)<<" Found new image... "<<i<<endl;
103  }
104  int nAdjPar = adjParIface->getNumberOfAdjustableParameters();
105  theNumAdjPar += nAdjPar;
106  theNumPartials += nAdjPar;
107  theNumAdjParams.push_back(nAdjPar);
108  }
109  }
110  }
111 
112  if (traceDebug())
113  {
114  ossimNotify(ossimNotifyLevel_DEBUG)<<" theNumAdjPar = "<<theNumAdjPar<<endl;
115  ossimNotify(ossimNotifyLevel_DEBUG)<<" theNumPartials = "<<theNumPartials<<endl;
116  }
117 
118  return true;
119 }
virtual ossimImageHandler * open(const ossimFilename &fileName, bool trySuffixFirst=true, bool openOverview=true) const
open that takes a filename.
std::vector< int > theNumAdjParams
std::vector< ossimRefPtr< ossimPointObservation > > theObs
virtual ossimAdjustableParameterInterface * getAdjustableParameterInterface()
std::vector< int > theImageIndex
unsigned int ossim_uint32
std::vector< ossimRefPtr< ossimImageHandler > > theImageHandlers
int numPars(const int index) const
unsigned int numImages() const
ossimFilename imageFile(const int index) const
unsigned int numMeas() const
static ossimImageHandlerRegistry * instance()
ossimString ID() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::vector< ossimFilename > theImageFiles
ossimImageGeometry * getImageGeom(const int index)

◆ adjParCount()

int ossimObservationSet::adjParCount ( const int &  i) const
inline

Definition at line 45 of file ossimObservationSet.h.

45 { return theNumAdjParams[i]; }
std::vector< int > theNumAdjParams

◆ evaluate()

bool ossimObservationSet::evaluate ( NEWMAT::Matrix &  measResiduals,
NEWMAT::Matrix &  objPartials,
NEWMAT::Matrix &  parPartials 
)

standard evaluation [1] measResiduals: [x,y] residuals (numMeas X 2) [2] objPartials: object point partial derivatives (numMeas*3 X 2) [3] parPartials: image parameter partial derivatives (numParams X 2)

Definition at line 134 of file ossimObservationSet.cpp.

References numMeas(), numObs(), theNumPartials, and theObs.

137 {
138 
139  // Dimension output matrices
140  measResiduals = NEWMAT::Matrix(numMeas(), 2);
141  objPartials = NEWMAT::Matrix(numMeas()*3, 2);
142  parPartials = NEWMAT::Matrix(theNumPartials, 2);
143 
144  int img = 1;
145  int cParIndex = 1;
146  int cObjIndex = 1;
147  for (ossim_uint32 cObs=0; cObs<numObs(); ++cObs)
148  {
149  int numMeasPerObs = theObs[cObs]->numMeas();
150  if (traceDebug())
151  {
152  ossimNotify(ossimNotifyLevel_DEBUG)<<"\n cObs= "<<cObs;
153  }
154 
155  for (int cImg=0; cImg<numMeasPerObs; ++cImg)
156  {
157  NEWMAT::Matrix cResid(1, 2);
158  theObs[cObs]->getResiduals(cImg, cResid);
159  if (traceDebug())
160  {
162  <<"\n cImg, img, cObjIndex, cParIndex, cResid: "
163  <<cImg<<" "<<img<<" "<<cObjIndex<<" "<<cParIndex<<" "<<cResid;
164  }
165  measResiduals.Row(img) = cResid;
166  img++;
167 
168  NEWMAT::Matrix cObjPar(3, 2);
169  theObs[cObs]->getObjSpacePartials(cImg, cObjPar);
170  objPartials.SubMatrix(cObjIndex,cObjIndex+2,1,2) << cObjPar;
171  cObjIndex += 3;
172 
173  int numPar = theObs[cObs]->numPars(cImg);
174  NEWMAT::Matrix cParamPar(numPar, 2);
175  theObs[cObs]->getParameterPartials(cImg, cParamPar);
176  parPartials.SubMatrix(cParIndex,cParIndex+numPar-1,1,2) << cParamPar;
177  cParIndex += numPar;
178  }
179  }
180 
181  return true;
182 }
ossim_uint32 numObs() const
ossim_uint32 numMeas() const
std::vector< ossimRefPtr< ossimPointObservation > > theObs
unsigned int ossim_uint32
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ getImageGeom()

ossimImageGeometry * ossimObservationSet::getImageGeom ( const int  index)

Definition at line 122 of file ossimObservationSet.cpp.

References theImageHandlers.

Referenced by ossimAutRegUtil::saveAdjustment(), and ossimAdjustmentExecutive::updateParameters().

123 {
124  return theImageHandlers[index]->getImageGeometry().get();
125 }
std::vector< ossimRefPtr< ossimImageHandler > > theImageHandlers

◆ imageFile()

ossimFilename ossimObservationSet::imageFile ( const int  index) const
inline

Definition at line 48 of file ossimObservationSet.h.

Referenced by ossimAutRegUtil::saveAdjustment(), and ossimAdjustmentExecutive::updateParameters().

48 { return theImageFiles[index]; }
std::vector< ossimFilename > theImageFiles

◆ imIndex()

int ossimObservationSet::imIndex ( const int &  i) const
inline

Definition at line 42 of file ossimObservationSet.h.

Referenced by ossimAdjustmentExecutive::printResidualSummary().

42 { return theImageIndex[i]; }
std::vector< int > theImageIndex

◆ numAdjPar()

ossim_uint32 ossimObservationSet::numAdjPar ( ) const
inline

Definition at line 31 of file ossimObservationSet.h.

31 { return (ossim_uint32)theNumAdjPar; }
unsigned int ossim_uint32

◆ numImages()

ossim_uint32 ossimObservationSet::numImages ( ) const
inline

Definition at line 29 of file ossimObservationSet.h.

Referenced by print(), and ossimAutRegUtil::saveAdjustment().

29 { return (ossim_uint32)theImageHandlers.size(); }
unsigned int ossim_uint32
std::vector< ossimRefPtr< ossimImageHandler > > theImageHandlers

◆ numMeas()

ossim_uint32 ossimObservationSet::numMeas ( ) const
inline

Definition at line 32 of file ossimObservationSet.h.

Referenced by evaluate().

32 { return (ossim_uint32)theNumMeas; }
unsigned int ossim_uint32

◆ numObs()

ossim_uint32 ossimObservationSet::numObs ( ) const
inline

Definition at line 30 of file ossimObservationSet.h.

Referenced by evaluate(), and print().

30 { return (ossim_uint32)theObs.size(); }
std::vector< ossimRefPtr< ossimPointObservation > > theObs
unsigned int ossim_uint32

◆ observ()

ossimRefPtr<ossimPointObservation> ossimObservationSet::observ ( const int &  i) const
inline

◆ print()

std::ostream & ossimObservationSet::print ( std::ostream &  os) const
virtual

text output : header + tab separated tie points

Reimplemented from ossimObject.

Definition at line 185 of file ossimObservationSet.cpp.

References ossim::isnan(), numImages(), numObs(), size, theImageFiles, theImageIndex, theNumAdjParams, and theObs.

186 {
187  int idx = 0;
188 
189  os<<"\nImages:\n";
190  ossim_uint32 spaces = 0;
191  for (ossim_uint32 i=0; i<numImages(); ++i)
192  {
193  if (theImageFiles[i].size() > spaces)
194  spaces = (ossim_uint32)theImageFiles[i].size();
195  }
196  for (ossim_uint32 i=0; i<numImages(); ++i)
197  {
198  int nAdj = theNumAdjParams[i];
199  os << " "<<i+1<<": " << setw(spaces) << theImageFiles[i] << " nPar: "<< setw(2) << nAdj <<endl;
200  }
201 
202  os<<"\nObservations:";
203  for (ossim_uint32 cObs=0; cObs<numObs(); ++cObs)
204  {
205  os << "\n " << theObs[cObs]->ID();
206  if (ossim::isnan(theObs[cObs]->getScore()) == false)
207  {
208  os << std::setiosflags(std::ios::fixed) << std::setprecision(2);
209  os << "\t" << theObs[cObs]->getScore();
210  }
211  else
212  {
213  os << "\t" << "nan";
214  }
215  os << "\t";
216  theObs[cObs]->getGroundPoint().print(os);
217 
218  int numMeasPerObs = theObs[cObs]->numMeas();
219  for (int cImg=0; cImg<numMeasPerObs; ++cImg)
220  {
221  os << "\n\t\t" << theImageIndex[idx]+1;
222  os << "\t";
223  theObs[cObs]->getMeasurement(cImg).print(os,1);
224  idx++;
225  }
226  }
227  return os;
228 }
ossim_uint32 numImages() const
ossim_uint32 numObs() const
std::vector< int > theNumAdjParams
std::vector< ossimRefPtr< ossimPointObservation > > theObs
std::vector< int > theImageIndex
yy_size_t size
unsigned int ossim_uint32
std::vector< ossimFilename > theImageFiles
bool isnan(const float &v)
isnan Test for floating point Not A Number (NAN) value.
Definition: ossimCommon.h:91

◆ setImageGeom()

void ossimObservationSet::setImageGeom ( const int  index,
ossimImageGeometry geom 
)

Definition at line 128 of file ossimObservationSet.cpp.

References theImageHandlers.

129 {
130  theImageHandlers[index]->setImageGeometry(geom);
131 }
std::vector< ossimRefPtr< ossimImageHandler > > theImageHandlers

Member Data Documentation

◆ theImageFiles

std::vector<ossimFilename> ossimObservationSet::theImageFiles
protected

Definition at line 82 of file ossimObservationSet.h.

Referenced by print().

◆ theImageHandlers

std::vector< ossimRefPtr<ossimImageHandler> > ossimObservationSet::theImageHandlers
protected

Definition at line 87 of file ossimObservationSet.h.

Referenced by getImageGeom(), setImageGeom(), and ~ossimObservationSet().

◆ theImageIndex

std::vector<int> ossimObservationSet::theImageIndex
protected

Definition at line 79 of file ossimObservationSet.h.

Referenced by print().

◆ theNumAdjPar

int ossimObservationSet::theNumAdjPar
protected

Definition at line 71 of file ossimObservationSet.h.

◆ theNumAdjParams

std::vector<int> ossimObservationSet::theNumAdjParams
protected

Definition at line 85 of file ossimObservationSet.h.

Referenced by print().

◆ theNumMeas

int ossimObservationSet::theNumMeas
protected

Definition at line 72 of file ossimObservationSet.h.

◆ theNumPartials

int ossimObservationSet::theNumPartials
protected

Definition at line 73 of file ossimObservationSet.h.

Referenced by evaluate().

◆ theObs

std::vector< ossimRefPtr<ossimPointObservation> > ossimObservationSet::theObs
protected

Definition at line 76 of file ossimObservationSet.h.

Referenced by evaluate(), and print().


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