Isis 3.0
Back | Home
ControlNet.h
Go to the documentation of this file.
1 #ifndef ControlNet_h
2 #define ControlNet_h
3 
26 // This is needed for the QVariant macro
27 #include <QMetaType>
28 #include <QObject> // parent class
29 #include <QSharedPointer>
30 
31 #include <map>
32 #include <vector>
33 
34 #include "ControlNetFile.h"
35 
36 #include <QString>
37 
38 template< typename A, typename B > class QHash;
39 template< typename T > class QList;
40 template< typename A, typename B > struct QPair;
41 template< typename T > class QSet;
42 class QMutex;
43 class QString;
44 
45 
46 namespace Isis {
47  class Camera;
48  class ControlMeasure;
49  class ControlPoint;
50  class ControlCubeGraphNode;
51  class Distance;
52  class Progress;
53  class SerialNumberList;
54 
207  class ControlNet : public QObject {
208  Q_OBJECT
209 
210  friend class ControlMeasure;
211  friend class ControlPoint;
212 
213  public:
214  ControlNet();
215  ControlNet(const ControlNet &other);
216  ControlNet(const QString &filename, Progress *progress = 0);
217 
218  ~ControlNet();
219 
220  void clear();
222 
223  void ReadControl(const QString &filename, Progress *progress = 0);
224  void Write(const QString &filename, bool pvl = false);
225 
226  void AddPoint(ControlPoint *point);
227  int DeletePoint(ControlPoint *point);
228  int DeletePoint(QString pointId);
229  int DeletePoint(int index);
230  bool ContainsPoint(QString pointId) const;
231 
238  bool lessThan(const ControlMeasure *, const ControlMeasure *)) const;
239  int getEdgeCount() const;
240  QString CubeGraphToString() const;
241  QList< ControlMeasure * > GetMeasuresInCube(QString serialNumber);
243  double min,double max);
244  void DeleteMeasuresWithId(QString serialNumber);
245 
246  void ComputeResiduals();
247  void ComputeApriori();
248 
249  const ControlPoint *GetPoint(QString pointId) const;
250  ControlPoint *GetPoint(QString pointId);
251  const ControlPoint *GetPoint(int index) const;
252  ControlPoint *GetPoint(int index);
253 
254  const ControlCubeGraphNode *getGraphNode(QString serialNumber) const;
255  ControlCubeGraphNode *getGraphNode(QString serialNumber);
256 
257  double AverageResidual();
258  Isis::Camera *Camera(int index);
259  QString CreatedDate() const;
260  QString Description() const;
261  ControlPoint *FindClosest(QString serialNumber,
262  double sample, double line);
263  bool IsValid() const;
264  double GetMaximumResidual();
265  QString GetNetworkId() const;
267  int GetNumEditLockPoints();
268  int GetNumIgnoredMeasures();
269  int GetNumberOfValidMeasuresInImage(const QString &serialNumber);
270  int GetNumberOfJigsawRejectedMeasuresInImage(const QString &serialNumber);
271  void ClearJigsawRejected();
272  void IncrementNumberOfRejectedMeasuresInImage(const QString &serialNumber);
273  void DecrementNumberOfRejectedMeasuresInImage(const QString &serialNumber);
274  int GetNumMeasures() const;
275  int GetNumPoints() const;
276  int GetNumValidMeasures();
277  int GetNumValidPoints();
278  QString GetTarget() const;
279  QString GetUserName() const;
282  std::vector<Distance> GetTargetRadii();
283 
284  void SetCreatedDate(const QString &date);
285  void SetDescription(const QString &newDescription);
286  void SetImages(const QString &imageListFile);
287  void SetImages(SerialNumberList &list, Progress *progress = 0);
288 
289  void SetModifiedDate(const QString &date);
290  void SetMutex(QMutex *mutex);
291  void SetNetworkId(const QString &id);
292  void SetTarget(const QString &target);
293  void SetTarget(Pvl label);
294  void SetTarget(const ControlNet &other);
295  void SetTarget(const QString &target,
296  const QVector<Distance> &radii);
297  void SetUserName(const QString &name);
298 
299  void swap(ControlNet &other);
300  ControlNet &operator=(const ControlNet &other);
301 
302  const ControlPoint *operator[](QString id) const;
303  ControlPoint *operator[](QString id);
304  const ControlPoint *operator[](int id) const;
305  ControlPoint *operator[](int id);
306 
307 
308  signals:
310 
311  private:
312  void nullify();
313  void ValidateSerialNumber(QString serialNumber) const;
314  void measureAdded(ControlMeasure *measure);
315  void measureDeleted(ControlMeasure *measure);
316  void measureIgnored(ControlMeasure *measure);
317  void measureUnIgnored(ControlMeasure *measure);
318  void UpdatePointReference(ControlPoint *point, QString oldId);
319  void emitNetworkStructureModified();
320 
321 
322  private: // graphing functions
324  ControlCubeGraphNode * > list) const;
325  void Shuffle(QList< ControlCubeGraphNode * > & list) const;
326  QPair< int, int > CalcBWAndCE(QList< QString > serials) const;
327 
333  class ControlMeasureLessThanFunctor :
334  public std::binary_function<ControlMeasure* const &,
335  ControlMeasure * const &, bool > {
336  public:
337  ControlMeasureLessThanFunctor(double(ControlMeasure::*accessorMethod)() const) {
338  m_accessor = accessorMethod;
339  }
340  ControlMeasureLessThanFunctor(ControlMeasureLessThanFunctor const &other) {
341  this->m_accessor = other.m_accessor;
342  }
343  ~ControlMeasureLessThanFunctor() {}
344 
345  bool operator()(ControlMeasure* const &, ControlMeasure* const &);
346  ControlMeasureLessThanFunctor & operator=(ControlMeasureLessThanFunctor const &other);
347 
348  private:
349  double(ControlMeasure::*m_accessor)() const;
350  };
351 
352 
363  class ControlVertex {
364  public:
366  ControlVertex(ControlCubeGraphNode *node) {
367  m_node = node;
368  m_point = NULL;
369  m_parent = NULL;
370  }
371 
373  ControlVertex(ControlPoint *point) {
374  m_point = point;
375  m_node = NULL;
376  m_parent = NULL;
377  }
378 
380  ~ControlVertex() {}
381 
383  void setParent(ControlVertex *v) { m_parent = v; }
384 
386  ControlVertex * getRoot() {
387  ControlVertex *current = this;
388  while (current->getParent() != NULL)
389  current = current->getParent();
390  return current;
391  }
392 
394  ControlVertex * getParent() { return m_parent; }
395 
397  ControlCubeGraphNode * getNode() { return m_node; }
398 
400  ControlPoint * getPoint() { return m_point; }
401 
403  static void join(ControlVertex *v1, ControlVertex *v2) {
404  v1->getRoot()->setParent(v2->getRoot());
405  }
406 
407  private:
409  ControlCubeGraphNode *m_node;
410 
412  ControlPoint *m_point;
413 
415  ControlVertex *m_parent;
416  };
417 
418 
419  private: // data
422 
425  QStringList *pointIds;
426  QMutex *m_mutex;
427 
428  QString p_targetName;
429  QString p_networkId;
430  QString p_created;
431  QString p_modified;
432  QString p_description;
433  QString p_userName;
434  std::map<QString, Isis::Camera *> p_cameraMap;
435  std::map<QString, int> p_cameraValidMeasuresMap;
436  std::map<QString, int> p_cameraRejectedMeasuresMap;
437  std::vector<Isis::Camera *> p_cameraList;
439  std::vector<Distance> p_targetRadii;
440 
441  bool p_invalid;
442  bool m_ownPoints;
443  };
444 
446  typedef QSharedPointer<ControlNet> ControlNetQsp;
447 }
448 
451 
452 #endif
Definition: Process.h:32
QString GetTarget() const
Return the target name.
Definition: ControlNet.cpp:1515
QString GetNetworkId() const
Definition: ControlNet.cpp:1350
Serial Number with added functionality for Control Networks.
Definition: ControlCubeGraphNode.h:67
void SetTarget(const QString &target)
Sets the target name and target radii, if available.
Definition: ControlNet.cpp:1695
void ReadControl(const QString &filename, Progress *progress=0)
Reads in the control points from the given file.
Definition: ControlNet.cpp:243
void ClearJigsawRejected()
Sets jigsaw rejected flag to false for all points and measures.
Definition: ControlNet.cpp:1431
std::vector< Distance > GetTargetRadii()
Get the target radii.
Definition: ControlNet.cpp:1954
friend class ControlMeasure
Definition: ControlNet.h:210
void SetMutex(QMutex *mutex)
Set mutex to lock for making Naif calls.
Definition: ControlNet.cpp:1669
QSharedPointer< ControlNet > ControlNetQsp
This typedef is for future implementation of target body.
Definition: ControlNet.h:446
bool ContainsPoint(QString pointId) const
Definition: ControlNet.cpp:781
double GetMaximumResidual()
Determine the maximum error of all points in the network.
Definition: ControlNet.cpp:1335
void ComputeResiduals()
Compute error for each point in the network.
Definition: ControlNet.cpp:1176
int GetNumValidMeasures()
Return the number of valid (non-ignored) measures for all control points in the network.
Definition: ControlNet.cpp:1487
QString Description() const
Return the description of the network.
Definition: ControlNet.cpp:1261
QList< ControlMeasure * > GetMeasuresInCube(QString serialNumber)
Get all the measures pertaining to a given cube serial number.
Definition: ControlNet.cpp:1081
void DecrementNumberOfRejectedMeasuresInImage(const QString &serialNumber)
Decrement number of jigsaw rejected measures in image specified by serialNumber.
Definition: ControlNet.cpp:1451
double AverageResidual()
Compute the average error of all points in the network.
Definition: ControlNet.cpp:1210
int GetNumMeasures() const
Returns the total number of measures for all control points in the network.
Definition: ControlNet.cpp:1462
QList< QList< ControlCubeGraphNode * > > GetNodeConnections() const
This method searches through all the cube serial numbers in the network.
Definition: ControlNet.cpp:821
QSet< ControlMeasure * > MinimumSpanningTree(QList< ControlCubeGraphNode * > &island, bool lessThan(const ControlMeasure *, const ControlMeasure *)) const
This method uses Kruskal&#39;s Algorithm to construct a minimum spanning tree of the given island...
Definition: ControlNet.cpp:887
void swap(ControlNet &other)
Swaps the member data with the given control net.
Definition: ControlNet.cpp:1834
void SetUserName(const QString &name)
Set the user name of the control network.
Definition: ControlNet.cpp:1815
Q_DECLARE_METATYPE(Isis::Cube *)
This allows Cube *&#39;s to be stored in a QVariant.
QList< ControlPoint * > GetPoints()
Return QList of ControlPoints ordered by point ID.
Definition: ControlNet.cpp:1527
int GetNumPoints() const
Return the number of control points in the network.
Definition: ControlNet.cpp:1473
QString GetUserName() const
Return the user name.
Definition: ControlNet.cpp:1521
QList< ControlCubeGraphNode * > GetCubeGraphNodes()
Definition: ControlNet.cpp:1056
Definition: Camera.h:240
const ControlPoint * GetPoint(QString pointId) const
Definition: ControlNet.cpp:1884
const ControlCubeGraphNode * getGraphNode(QString serialNumber) const
Definition: ControlNet.cpp:1926
Program progress reporter.
Definition: Progress.h:58
a control network
Definition: ControlNet.h:207
friend class ControlPoint
Definition: ControlNet.h:211
void clear()
Clear the contents of this object.
Definition: ControlNet.cpp:148
void DeleteMeasuresWithId(QString serialNumber)
Essentially removes a cube from the networkid.
Definition: ControlNet.cpp:1160
void SetNetworkId(const QString &id)
Set the network id.
Definition: ControlNet.cpp:1679
void IncrementNumberOfRejectedMeasuresInImage(const QString &serialNumber)
Increment number of jigsaw rejected measures in image specified by serialNumber.
Definition: ControlNet.cpp:1442
QList< ControlPoint * > take()
Transfer ownership of all points to caller.
Definition: ControlNet.cpp:201
int DeletePoint(ControlPoint *point)
Delete a ControlPoint from the network by the point&#39;s address.
Definition: ControlNet.cpp:692
A single control point.
Definition: ControlPoint.h:339
QList< QList< QString > > GetSerialConnections() const
This method searches through all the cube serial numbers in the network.
Definition: ControlNet.cpp:797
void SetImages(const QString &imageListFile)
Creates the ControlNet&#39;s image cameras based on an input file.
Definition: ControlNet.cpp:1569
Container for cube-like labels.
Definition: Pvl.h:135
int GetNumValidPoints()
Returns the number of non-ignored control points.
Definition: ControlNet.cpp:1503
QList< ControlMeasure * > sortedMeasureList(double(ControlMeasure::*statFunc)() const, double min, double max)
Get a sorted list of all the measures that have values in a given ragen.
Definition: ControlNet.cpp:1124
int GetNumEditLockMeasures()
Return the total number of edit locked measures for all control points in the network.
Definition: ControlNet.cpp:1361
int GetNumIgnoredMeasures()
Return the total number of ignored measures for all control points in the network.
Definition: ControlNet.cpp:1393
Definition: Calculator.h:33
void AddPoint(ControlPoint *point)
Adds a ControlPoint to the ControlNet.
Definition: ControlNet.cpp:339
int getEdgeCount() const
Definition: ControlNet.cpp:1006
void networkStructureModified()
Definition: moc_ControlNet.cpp:124
int GetNumEditLockPoints()
Returns the number of edit locked control points.
Definition: ControlNet.cpp:1376
void SetModifiedDate(const QString &date)
Set the last modified date.
Definition: ControlNet.cpp:1657
Definition: BoxcarCachingAlgorithm.h:29
a control measurement
Definition: ControlMeasure.h:171
QString CubeGraphToString() const
Used for verifying graph intergrity.
Definition: ControlNet.cpp:1021
int GetNumberOfJigsawRejectedMeasuresInImage(const QString &serialNumber)
Return the number of jigsaw rejected measures in image specified by serialNumber. ...
Definition: ControlNet.cpp:1421
Isis::Camera * Camera(int index)
Returns the camera list from the given image number.
Definition: ControlNet.cpp:1239
QString CreatedDate() const
Return the Created Date.
Definition: ControlNet.cpp:1251
void ComputeApriori()
Compute aprior values for each point in the network.
Definition: ControlNet.cpp:1192
void SetCreatedDate(const QString &date)
Set the creation time.
Definition: ControlNet.cpp:1549
void SetDescription(const QString &newDescription)
Set the description of the network.
Definition: ControlNet.cpp:1559
QList< QString > GetPointIds() const
Return QList of ControlPoint Ids used in hash, in order of addition.
Definition: ControlNet.cpp:1539
ControlNet()
Creates an empty ControlNet object.
Definition: ControlNet.cpp:54
ControlNet & operator=(const ControlNet &other)
Assign other to this.
Definition: ControlNet.cpp:1872
Serial Number list generator.
Definition: SerialNumberList.h:78
Definition: CubeIoHandler.h:39
~ControlNet()
Destructor removes allocated memory.
Definition: ControlNet.cpp:128
ControlPoint * FindClosest(QString serialNumber, double sample, double line)
Finds and returns a pointer to the closest ControlPoint to the ControlMeasure with the given serial n...
Definition: ControlNet.cpp:1278
const ControlPoint * operator[](QString id) const
Definition: ControlNet.cpp:1959
void Write(const QString &filename, bool pvl=false)
Writes out the control network.
Definition: ControlNet.cpp:302
QList< QString > GetCubeSerials() const
Use this method to get a complete list of all the cube serial numbers in the network.
Definition: ControlNet.cpp:1048
int GetNumberOfValidMeasuresInImage(const QString &serialNumber)
Return the number of measures in image specified by serialNumber.
Definition: ControlNet.cpp:1411
Definition: ControlCubeGraphNode.h:28
bool IsValid() const
Return if the control point is invalid.
Definition: ControlNet.cpp:1324

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:16:27