Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

Isis Developer Reference
ControlNet.h
Go to the documentation of this file.
1#ifndef ControlNet_h
2#define ControlNet_h
3
9
10/* SPDX-License-Identifier: CC0-1.0 */
11
12// This is needed for the QVariant macro
13#include <QMetaType>
14#include <QObject> // parent class
15#include <QSharedPointer>
16#include "SurfacePoint.h"
17#include <QString>
18#include <QMap>
19#include <QVariant>
20#include <QVector>
21#include <QVariant>
22
23
24// Boost includes
25#include <boost/graph/graph_traits.hpp>
26#include <boost/graph/adjacency_list.hpp>
27#include <boost/graph/connected_components.hpp>
28
29#include "ControlMeasure.h"
30#include "ControlPoint.h"
31
32template< typename A, typename B > class QHash;
33template< typename T > class QList;
34template< typename T > class QSet;
35
36class QMutex;
37class QString;
38
39namespace Isis {
40 class Camera;
41 class ControlMeasure;
42 class ControlPoint;
43 class Distance;
44 class Progress;
45 class Pvl;
46 class SerialNumberList;
47
257 class ControlNet : public QObject {
258 Q_OBJECT
259
260 friend class ControlMeasure;
261 friend class ControlPoint;
262
263 public:
264
278
280 ControlNet(const ControlNet &other);
281 ControlNet(const QString &filename, Progress *progress = 0,
283
284 ~ControlNet();
285
286 void clear();
288
289 void ReadControl(const QString &filename, Progress *progress = 0);
290 void Write(const QString &filename, bool pvl = false);
291
292 void AddPoint(ControlPoint *point);
293 int DeletePoint(ControlPoint *point);
294 int DeletePoint(QString pointId);
295 int DeletePoint(int index);
296 bool ContainsPoint(QString pointId) const;
297
299 QString GraphToString() const;
301 int getEdgeCount() const;
302 QList< QString > getAdjacentImages(QString serialNumber) const;
303 QList< ControlMeasure * > GetMeasuresInCube(QString serialNumber);
306 double min,double max);
307
308 void ComputeResiduals();
309 void ComputeApriori();
310
311 const ControlPoint *GetPoint(QString pointId) const;
312 ControlPoint *GetPoint(QString pointId);
313 const ControlPoint *GetPoint(int index) const;
314 ControlPoint *GetPoint(int index);
315
316 double AverageResidual();
317 Isis::Camera *Camera(int index);
318 Isis::Camera *Camera(QString serialNumber);
319 QString CreatedDate() const;
320 QString Description() const;
321 ControlPoint *FindClosest(QString serialNumber,
322 double sample, double line);
323 //bool IsValid() const;
324 double GetMaximumResidual();
325 QString GetNetworkId() const;
329 int GetNumberOfValidMeasuresInImage(const QString &serialNumber);
330 int GetNumberOfJigsawRejectedMeasuresInImage(const QString &serialNumber);
331 void ClearJigsawRejected();
332 void IncrementNumberOfRejectedMeasuresInImage(const QString &serialNumber);
333 void DecrementNumberOfRejectedMeasuresInImage(const QString &serialNumber);
334 int GetNumMeasures() const;
335 int GetNumPoints() const;
337 int GetNumValidPoints();
338 QString GetTarget() const;
339 QString GetUserName() const;
340 QString GetLastModified() const;
344
345 void SetCreatedDate(const QString &date);
346 void SetDescription(const QString &newDescription);
347 void SetImages(const QString &imageListFile);
348 void SetImages(SerialNumberList &list, Progress *progress = 0);
349
350 void SetModifiedDate(const QString &date);
351 void SetMutex(QMutex *mutex);
352 void SetNetworkId(const QString &id);
353 void SetTarget(const QString &target);
354 void SetTarget(Pvl label);
355 void SetTarget(const ControlNet &other);
356 void SetUserName(const QString &name);
358
359 void swap(ControlNet &other);
360 ControlNet &operator=(const ControlNet &other);
361
362 const ControlPoint *operator[](QString id) const;
363 ControlPoint *operator[](QString id);
364 const ControlPoint *operator[](int id) const;
365 ControlPoint *operator[](int id);
366
367
368 signals:
371 void pointModified(ControlPoint *point, ControlPoint::ModType type, QVariant oldValue, QVariant newValue);
372 void measureModified(ControlMeasure *measure, ControlMeasure::ModType type, QVariant oldValue, QVariant newValue);
377
378
379
380 private:
381 void nullify();
382 bool ValidateSerialNumber(QString serialNumber) const;
383 void measureAdded(ControlMeasure *measure);
384 void measureDeleted(ControlMeasure *measure);
385 void measureIgnored(ControlMeasure *measure);
386 void measureUnIgnored(ControlMeasure *measure);
387 void pointIgnored(ControlPoint *point);
388 void pointUnIgnored(ControlPoint *point);
389 void UpdatePointReference(ControlPoint *point, QString oldId);
390 void emitNetworkStructureModified();
391 void emitMeasureModified(ControlMeasure *measure, ControlMeasure::ModType type, QVariant oldValue, QVariant newValue);
392 void emitPointModified(ControlPoint *point, ControlPoint::ModType type, QVariant oldValue, QVariant newValue);
393 void pointAdded(ControlPoint *point);
394 bool addEdge(QString sourceSerial, QString targetSerial);
395 bool removeEdge(QString sourceSerial, QString targetSerial);
396
397 private: // graphing functions
403 class ControlMeasureLessThanFunctor :
404 public std::function<bool(ControlMeasure* const &,
405 ControlMeasure * const &)> {
406 public:
407 ControlMeasureLessThanFunctor(double(ControlMeasure::*accessorMethod)() const) {
408 m_accessor = accessorMethod;
409 }
410 ControlMeasureLessThanFunctor(ControlMeasureLessThanFunctor const &other) {
411 this->m_accessor = other.m_accessor;
412 }
413 ~ControlMeasureLessThanFunctor() {}
414
415 bool operator()(ControlMeasure* const &, ControlMeasure* const &);
416 ControlMeasureLessThanFunctor & operator=(ControlMeasureLessThanFunctor const &other);
417
418 private:
419 double(ControlMeasure::*m_accessor)() const;
420 };
421
422 private: // data
424 QHash< QString, ControlPoint * > * points;
425
427 struct Image {
428 QString serial;
430 QHash< ControlPoint *, ControlMeasure * > measures;
431 };
432
434 struct Connection {
435 Connection() : strength(0) {}
436 int strength;
437 };
438
442 typedef boost::adjacency_list<boost::setS,
443 boost::listS,
444 boost::undirectedS,
445 Image,
446 Connection> Network;
447
448 typedef Network::vertex_descriptor ImageVertex;
449 typedef Network::edge_descriptor ImageConnection;
450
452 typedef std::map<ImageVertex, size_t> VertexIndexMap;
453
455 typedef boost::associative_property_map<VertexIndexMap> VertexIndexMapAdaptor;
456
458 typedef boost::graph_traits<Network>::adjacency_iterator AdjacencyIterator;
459 typedef boost::graph_traits<Network>::vertex_iterator VertexIterator;
460
461 QHash<QString, ImageVertex> m_vertexMap;
462 Network m_controlGraph;
463 QStringList *pointIds;
464 QMutex *m_mutex;
465
466 QString p_targetName;
467 QString p_networkId;
468 QString p_created;
469 QString p_modified;
470 QString p_description;
471 QString p_userName;
472 QMap<QString, Isis::Camera *> p_cameraMap;
473 QMap<QString, int> p_cameraValidMeasuresMap;
474 QMap<QString, int> p_cameraRejectedMeasuresMap;
476 QVector<Isis::Camera *> p_cameraList;
477
478 bool m_ownPoints;
479 SurfacePoint::CoordinateType m_coordType;
480 };
481
485}
486
489
490#endif
Q_DECLARE_METATYPE(Isis::ControlNet *)
This allows ControlNet *'s to be stored in a QVariant.
Definition Camera.h:236
a control measurement
Definition ControlMeasure.h:175
ModType
Control Measure Modification Types.
Definition ControlMeasure.h:232
a control network
Definition ControlNet.h:257
int GetNumEditLockPoints()
Returns the number of edit locked control points.
Definition ControlNet.cpp:1372
int GetNumMeasures() const
Returns the total number of measures for all control points in the network.
Definition ControlNet.cpp:1462
QString Description() const
Return the description of the network.
Definition ControlNet.cpp:1262
void pointModified(ControlPoint *point, ControlPoint::ModType type, QVariant oldValue, QVariant newValue)
int getEdgeCount() const
Definition ControlNet.cpp:999
ControlNet(SurfacePoint::CoordinateType=SurfacePoint::Latitudinal)
Creates an empty ControlNet object.
Definition ControlNet.cpp:58
const ControlPoint * GetPoint(QString pointId) const
Definition ControlNet.cpp:1823
QString GraphToString() const
Used for verifying graph intergrity.
Definition ControlNet.cpp:495
void AddPoint(ControlPoint *point)
Adds a ControlPoint to the ControlNet.
Definition ControlNet.cpp:350
QList< QList< QString > > GetSerialConnections() const
This method searches through all the cube serial numbers in the network.
Definition ControlNet.cpp:963
void measureModified(ControlMeasure *measure, ControlMeasure::ModType type, QVariant oldValue, QVariant newValue)
QString GetLastModified() const
Return the last modified date.
Definition ControlNet.cpp:1526
double GetMaximumResidual()
Determine the maximum error of all points in the network.
Definition ControlNet.cpp:1331
void networkModified(ControlNet::ModType type)
QList< QString > getAdjacentImages(QString serialNumber) const
Get all images connected to a given image by common control points.
Definition ControlNet.cpp:1037
ControlNet & operator=(const ControlNet &other)
Assign other to this.
Definition ControlNet.cpp:1811
QString GetNetworkId() const
Definition ControlNet.cpp:1346
void newPoint(ControlPoint *)
friend class ControlMeasure
Definition ControlNet.h:260
void ReadControl(const QString &filename, Progress *progress=0)
Reads in the control points from the given file.
Definition ControlNet.cpp:269
void SetDescription(const QString &newDescription)
Set the description of the network.
Definition ControlNet.cpp:1564
int GetNumPoints() const
Return the number of control points in the network.
Definition ControlNet.cpp:1473
void ComputeApriori()
Compute aprior values for each point in the network.
Definition ControlNet.cpp:1181
SurfacePoint::CoordinateType GetCoordType()
Get the control point coordinate type (see the available types in SurfacePoint.h).
Definition ControlNet.cpp:1870
QString CreatedDate() const
Return the Created Date.
Definition ControlNet.cpp:1252
void DecrementNumberOfRejectedMeasuresInImage(const QString &serialNumber)
Decrement number of jigsaw rejected measures in image specified by serialNumber.
Definition ControlNet.cpp:1451
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:1129
void SetImages(const QString &imageListFile)
Creates the ControlNet's image cameras based on an input file.
Definition ControlNet.cpp:1574
QString GetUserName() const
Return the user name.
Definition ControlNet.cpp:1521
int GetNumberOfValidMeasuresInImage(const QString &serialNumber)
Return the number of measures in image specified by serialNumber.
Definition ControlNet.cpp:1407
void pointDeleted(ControlPoint *point)
int GetNumberOfJigsawRejectedMeasuresInImage(const QString &serialNumber)
Return the number of jigsaw rejected measures in image specified by serialNumber.
Definition ControlNet.cpp:1421
void Write(const QString &filename, bool pvl=false)
Writes out the control network.
Definition ControlNet.cpp:309
friend class ControlPoint
Definition ControlNet.h:261
void SetCoordType(SurfacePoint::CoordinateType coordType)
Sets the control point coordinate type.
Definition ControlNet.cpp:857
int GetNumValidMeasures()
Return the number of valid (non-ignored) measures for all control points in the network.
Definition ControlNet.cpp:1487
int GetNumValidPoints()
Returns the number of non-ignored control points.
Definition ControlNet.cpp:1503
QList< QString > GetPointIds() const
Return QList of ControlPoint Ids used in hash, in order of addition.
Definition ControlNet.cpp:1544
void SetTarget(const ControlNet &other)
int GetNumIgnoredMeasures()
Return the total number of ignored measures for all control points in the network.
Definition ControlNet.cpp:1389
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:1279
void SetCreatedDate(const QString &date)
Set the creation time.
Definition ControlNet.cpp:1554
const ControlPoint * operator[](QString id) const
Definition ControlNet.cpp:1874
QString GetTarget() const
Return the target name.
Definition ControlNet.cpp:1515
double AverageResidual()
Compute the average error of all points in the network.
Definition ControlNet.cpp:1199
bool ContainsPoint(QString pointId) const
Definition ControlNet.cpp:947
void clear()
Clear the contents of this object.
Definition ControlNet.cpp:178
ModType
Control Point Modification Types.
Definition ControlNet.h:274
@ Swapped
Definition ControlNet.h:275
@ GraphModified
Definition ControlNet.h:276
~ControlNet()
Destructor removes allocated memory.
Definition ControlNet.cpp:131
Isis::Camera * Camera(int index)
Returns the camera list from the given image number.
Definition ControlNet.cpp:1228
QList< ControlMeasure * > GetMeasuresInCube(QString serialNumber)
Get all the measures pertaining to a given cube serial number.
Definition ControlNet.cpp:1061
void SetUserName(const QString &name)
Set the user name of the control network.
Definition ControlNet.cpp:1738
QList< ControlPoint * > GetPoints()
Return QList of all the ControlPoints in the network.
Definition ControlNet.cpp:1532
void ClearJigsawRejected()
Sets jigsaw rejected flag to false for all points and measures.
Definition ControlNet.cpp:1431
void SetMutex(QMutex *mutex)
Set mutex to lock for making Naif calls.
Definition ControlNet.cpp:1674
void ComputeResiduals()
Compute error for each point in the network.
Definition ControlNet.cpp:1165
void networkStructureModified()
int DeletePoint(ControlPoint *point)
Delete a ControlPoint from the network by the point's address.
Definition ControlNet.cpp:875
void swap(ControlNet &other)
Swaps the member data with the given control net.
Definition ControlNet.cpp:1757
QList< QString > GetCubeSerials() const
Use this method to get a complete list of all the cube serial numbers in the network.
Definition ControlNet.cpp:1012
void SetNetworkId(const QString &id)
Set the network id.
Definition ControlNet.cpp:1684
void SetModifiedDate(const QString &date)
Set the last modified date.
Definition ControlNet.cpp:1662
void newMeasure(ControlMeasure *)
void measureRemoved(ControlMeasure *)
QList< ControlMeasure * > GetValidMeasuresInCube(QString serialNumber)
Get all the valid measures pertaining to a given cube serial number.
Definition ControlNet.cpp:1077
void IncrementNumberOfRejectedMeasuresInImage(const QString &serialNumber)
Increment number of jigsaw rejected measures in image specified by serialNumber.
Definition ControlNet.cpp:1442
int GetNumEditLockMeasures()
Return the total number of edit locked measures for all control points in the network.
Definition ControlNet.cpp:1357
void SetTarget(const QString &target)
Sets the target name and target radii, if available.
Definition ControlNet.cpp:1700
QList< ControlPoint * > take()
Transfer ownership of all points to caller.
Definition ControlNet.cpp:224
A single control point.
Definition ControlPoint.h:354
ModType
Control Point Modification Types.
Definition ControlPoint.h:431
Program progress reporter.
Definition Progress.h:42
Serial Number list generator.
Definition SerialNumberList.h:64
CoordinateType
Defines the coordinate typ, units, and coordinate index for some of the output methods.
Definition SurfacePoint.h:139
@ Latitudinal
Planetocentric latitudinal (lat/lon/rad) coordinates.
Definition SurfacePoint.h:140
This is free and unencumbered software released into the public domain.
Definition ControlNet.h:32
This is free and unencumbered software released into the public domain.
Definition BoxcarCachingAlgorithm.h:13
This is free and unencumbered software released into the public domain.
Definition Process.h:16
Definition JigsawWorkOrder.h:28
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
QSharedPointer< ControlNet > ControlNetQsp
Typedef for QSharedPointer to control network. This typedef is for future implementation of target bo...
Definition ControlNet.h:484