Isis 3.0 Programmer Reference
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:
309  void networkStructureModified();
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;
327 
334  public std::binary_function<ControlMeasure* const &,
335  ControlMeasure * const &, bool > {
336  public:
337  ControlMeasureLessThanFunctor(double(ControlMeasure::*accessorMethod)() const) {
338  m_accessor = accessorMethod;
339  }
341  this->m_accessor = other.m_accessor;
342  }
344 
345  bool operator()(ControlMeasure* const &, ControlMeasure* const &);
347 
348  private:
349  double(ControlMeasure::*m_accessor)() const;
350  };
351 
352 
364  public:
367  m_node = node;
368  m_point = NULL;
369  m_parent = NULL;
370  }
371 
374  m_point = point;
375  m_node = NULL;
376  m_parent = NULL;
377  }
378 
381 
383  void setParent(ControlVertex *v) { m_parent = v; }
384 
387  ControlVertex *current = this;
388  while (current->getParent() != NULL)
389  current = current->getParent();
390  return current;
391  }
392 
395 
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:
410 
413 
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
~ControlVertex()
Does not own any of its private data.
Definition: ControlNet.h:380
bool p_invalid
If the Control Network is currently invalid.
Definition: ControlNet.h:441
Definition: Process.h:32
QString GetTarget() const
Return the target name.
void UpdatePointReference(ControlPoint *point, QString oldId)
Updates the key reference (poind Id) from the old one to what the point id was changet to...
Definition: ControlNet.cpp:500
Serial Number with added functionality for Control Networks.
void SetTarget(const QString &target)
Sets the target name and target radii, if available.
void ReadControl(const QString &filename, Progress *progress=0)
Reads in the control points from the given file.
Definition: ControlNet.cpp:243
Encapsulation of a vertex in a minimum spanning tree.
Definition: ControlNet.h:363
void ClearJigsawRejected()
Sets jigsaw rejected flag to false for all points and measures.
std::vector< Distance > GetTargetRadii()
Get the target radii.
QString p_targetName
Name of the target.
Definition: ControlNet.h:428
void SetMutex(QMutex *mutex)
Set mutex to lock for making Naif calls.
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.
void ComputeResiduals()
Compute error for each point in the network.
std::vector< Distance > p_targetRadii
Radii of target body.
Definition: ControlNet.h:439
int GetNumValidMeasures()
Return the number of valid (non-ignored) measures for all control points in the network.
QString Description() const
Return the description of the network.
QString p_description
Textual Description of network.
Definition: ControlNet.h:432
static void join(ControlVertex *v1, ControlVertex *v2)
Join two nodes by setting one root to be the other&#39;s parent.
Definition: ControlNet.h:403
QList< ControlMeasure * > GetMeasuresInCube(QString serialNumber)
Get all the measures pertaining to a given cube serial number.
void DecrementNumberOfRejectedMeasuresInImage(const QString &serialNumber)
Decrement number of jigsaw rejected measures in image specified by serialNumber.
double AverageResidual()
Compute the average error of all points in the network.
int GetNumMeasures() const
Returns the total number of measures for all control points in the network.
QList< QList< ControlCubeGraphNode * > > GetNodeConnections() const
This method searches through all the cube serial numbers in the network.
Definition: ControlNet.cpp:821
ControlPoint * getPoint()
Get the point representation of this vertex.
Definition: ControlNet.h:400
bool m_ownPoints
Specifies ownership of point list. True if owned by this object.
Definition: ControlNet.h:442
std::vector< Isis::Camera * > p_cameraList
Vector of image number to camera.
Definition: ControlNet.h:438
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.
QString p_networkId
The Network Id.
Definition: ControlNet.h:429
void SetUserName(const QString &name)
Set the user name of the control network.
void setParent(ControlVertex *v)
Set the parent vertex, removing the root node status.
Definition: ControlNet.h:383
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.
int GetNumPoints() const
Return the number of control points in the network.
QString GetUserName() const
Return the user name.
ControlVertex * m_parent
The possibly non-existant parent vertex.
Definition: ControlNet.h:415
QList< ControlCubeGraphNode * > GetCubeGraphNodes()
void measureDeleted(ControlMeasure *measure)
Updates the ControlCubeGraphNode for this measure&#39;s serial number to reflect the deletion.
Definition: ControlNet.cpp:514
QString p_created
Creation Date.
Definition: ControlNet.h:430
QList< ControlCubeGraphNode * > RandomBFS(QList< ControlCubeGraphNode * > list) const
Random breadth-first search.
Definition: ControlNet.cpp:590
void measureAdded(ControlMeasure *measure)
Updates the ControlCubeGraphNode for the measure&#39;s serial number to reflect the addition.
Definition: ControlNet.cpp:377
void ValidateSerialNumber(QString serialNumber) const
Does a check to ensure that the given serial number is contained within the network.
Program progress reporter.
Definition: Progress.h:58
QString p_userName
The user who created the network.
Definition: ControlNet.h:433
a control network
Definition: ControlNet.h:207
ControlCubeGraphNode * getNode()
Get the node representation of this vertex.
Definition: ControlNet.h:397
ControlVertex(ControlPoint *point)
Construct a vertex from a Control Point.
Definition: ControlNet.h:373
std::map< QString, int > p_cameraValidMeasuresMap
A map from serialnumber to #measures.
Definition: ControlNet.h:435
void clear()
Clear the contents of this object.
Definition: ControlNet.cpp:148
void DeleteMeasuresWithId(QString serialNumber)
Essentially removes a cube from the networkid.
void SetNetworkId(const QString &id)
Set the network id.
void IncrementNumberOfRejectedMeasuresInImage(const QString &serialNumber)
Increment number of jigsaw rejected measures in image specified by serialNumber.
QList< ControlPoint * > take()
Transfer ownership of all points to caller.
Definition: ControlNet.cpp:201
std::map< QString, int > p_cameraRejectedMeasuresMap
A map from serialnumber to #rejected measures ...
Definition: ControlNet.h:436
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
ControlVertex(ControlCubeGraphNode *node)
Construct a vertex from a Graph Node.
Definition: ControlNet.h:366
QList< QList< QString > > GetSerialConnections() const
This method searches through all the cube serial numbers in the network.
Definition: ControlNet.cpp:797
ControlVertex * getRoot()
Get the root node, or greatest ancestor.
Definition: ControlNet.h:386
ControlVertex * getParent()
Get the parent node. A root node has no parent.
Definition: ControlNet.h:394
void SetImages(const QString &imageListFile)
Creates the ControlNet&#39;s image cameras based on an input file.
Container for cube-like labels.
Definition: Pvl.h:135
QHash< QString, ControlPoint * > * points
hash ControlPoints by ControlPoint Id
Definition: ControlNet.h:421
int GetNumValidPoints()
Returns the number of non-ignored control points.
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.
int GetNumEditLockMeasures()
Return the total number of edit locked measures for all control points in the network.
int GetNumIgnoredMeasures()
Return the total number of ignored measures for all control points in the network.
void AddPoint(ControlPoint *point)
Adds a ControlPoint to the ControlNet.
Definition: ControlNet.cpp:339
int getEdgeCount() const
int GetNumEditLockPoints()
Returns the number of edit locked control points.
void SetModifiedDate(const QString &date)
Set the last modified date.
bool operator()(ControlMeasure *const &, ControlMeasure *const &)
The () operator for the Control Measure less than functor.
ControlPoint * m_point
The possibly non-existant control point.
Definition: ControlNet.h:412
a control measurement
ControlCubeGraphNode * m_node
The possibly non-existant graph node.
Definition: ControlNet.h:409
QString CubeGraphToString() const
Used for verifying graph intergrity.
int GetNumberOfJigsawRejectedMeasuresInImage(const QString &serialNumber)
Return the number of jigsaw rejected measures in image specified by serialNumber. ...
Isis::Camera * Camera(int index)
Returns the camera list from the given image number.
QString CreatedDate() const
Return the Created Date.
void ComputeApriori()
Compute aprior values for each point in the network.
ControlMeasureLessThanFunctor & operator=(ControlMeasureLessThanFunctor const &other)
Copies the content of the a ControlMeasureLessThanFunctor.
void SetCreatedDate(const QString &date)
Set the creation time.
void SetDescription(const QString &newDescription)
Set the description of the network.
void Shuffle(QList< ControlCubeGraphNode * > &list) const
Shuffles the QStrings in a QList&lt; QString &gt;
Definition: ControlNet.cpp:629
QList< QString > GetPointIds() const
Return QList of ControlPoint Ids used in hash, in order of addition.
ControlNet()
Creates an empty ControlNet object.
Definition: ControlNet.cpp:54
ControlNet & operator=(const ControlNet &other)
Assign other to this.
QString p_modified
Date Last Modified.
Definition: ControlNet.h:431
Serial Number list generator.
~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...
std::map< QString, Isis::Camera * > p_cameraMap
A map from serialnumber to camera.
Definition: ControlNet.h:434
void measureUnIgnored(ControlMeasure *measure)
Updates the connections for the ControlCubeGraphNode associated with the measure&#39;s serial number to r...
Definition: ControlNet.cpp:441
QHash< QString, ControlCubeGraphNode * > * cubeGraphNodes
hash ControlCubeGraphNodes by CubeSerialNumber
Definition: ControlNet.h:424
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.
QPair< int, int > CalcBWAndCE(QList< QString > serials) const
Calculate the band width and critical edges needed by the adjacency matrix that could store cube conn...
Definition: ControlNet.cpp:653
int GetNumberOfValidMeasuresInImage(const QString &serialNumber)
Return the number of measures in image specified by serialNumber.
bool IsValid() const
Return if the control point is invalid.

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