Isis 3 Programmer Reference
ControlNet.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "ControlNet.h"
10
11#include <iostream>
12#include <cmath>
13#include <sstream>
14
15#include <QDebug>
16#include <QMutex>
17#include <QMutexLocker>
18#include <QPair>
19#include <QScopedPointer>
20#include <QSet>
21#include <QStringList>
22#include <QTime>
23#include <QVariant>
24#include <QVector>
25
26#include <boost/numeric/ublas/symmetric.hpp>
27#include <boost/numeric/ublas/io.hpp>
28
29#include "Application.h"
30#include "CameraFactory.h"
31#include "ControlMeasure.h"
32#include "ControlNetVersioner.h"
33#include "ControlPoint.h"
34#include "Distance.h"
35#include "FileName.h"
36#include "IException.h"
37#include "iTime.h"
38#include "Progress.h"
39#include "SerialNumberList.h"
40#include "SpecialPixel.h"
41#include "Statistics.h"
42#include "Target.h"
43
44using namespace std;
45using namespace boost::numeric::ublas;
46
47
48namespace Isis {
49
50 void ControlNet::nullify() {
51
52 points = NULL;
53 pointIds = NULL;
54 m_mutex = NULL;
55 }
56
59
61 // ControlNet::ControlNet() {
62 nullify();
63
64 points = new QHash< QString, ControlPoint * >;
66
67 m_ownPoints = true;
70 m_coordType = coordType;
71 }
72
74
75 nullify();
76
77 points = new QHash< QString, ControlPoint * >;
79
80 for (int cpIndex = 0; cpIndex < other.GetNumPoints(); cpIndex++) {
81 ControlPoint *newPoint = new ControlPoint(*other.GetPoint(cpIndex));
82 AddPoint(newPoint);
83 }
84
85 m_ownPoints = true;
86
87 p_targetName = other.p_targetName;
88 p_networkId = other.p_networkId;
89 p_created = other.p_created;
90 p_modified = other.p_modified;
91 p_description = other.p_description;
92 p_userName = other.p_userName;
93 p_cameraMap = other.p_cameraMap;
94 p_cameraList = other.p_cameraList;
95 m_coordType = other.m_coordType;
96 }
97
98
105 ControlNet::ControlNet(const QString &ptfile, Progress *progress,
107
108 nullify();
109
110 points = new QHash< QString, ControlPoint * >;
111 pointIds = new QStringList;
112
113 m_ownPoints = true;
114 m_coordType = coordType;
115
116 try {
117 ReadControl(ptfile, progress);
118 }
119 catch (IException &e) {
120 QString msg = "Invalid control network [" + ptfile + "]";
121 throw IException(e, IException::Io, msg, _FILEINFO_);
122 }
123 }
124
125
132
133 clear();
134
135 delete points;
136 delete pointIds;
137
138 nullify();
139 }
140
141
151 void ControlNet::emitMeasureModified(ControlMeasure *measure, ControlMeasure::ModType type, QVariant oldValue, QVariant newValue) {
152 emit measureModified(measure, type, oldValue, newValue);
153 }
154
155
165 void ControlNet::emitPointModified(ControlPoint *point, ControlPoint::ModType type, QVariant oldValue, QVariant newValue) {
166 emit pointModified(point, type, oldValue, newValue);
167 }
168
169
179
180 // Now must also own points to delete them.
181 if (points) {
182 if (GetNumPoints() > 0) {
183 if (m_ownPoints) {
184 QHashIterator<QString, ControlPoint*> i(*points);
185 while (i.hasNext()) {
186 i.next();
187 delete(*points)[i.key()];
188 (*points)[i.key()] = NULL;
189 }
190 }
191 }
192 points->clear();
193 }
194
195 m_vertexMap.clear();
196 m_controlGraph.clear();
197
198 if (pointIds) {
199 pointIds->clear();
200 }
201
202 return;
203 }
204
205
224 QList< ControlPoint * > ControlNet::take() {
225
226 // First check to see if someone else has taken ownership
227 if (!m_ownPoints) {
228 throw IException(IException::Programmer, "Ownership has already been taken",
229 _FILEINFO_);
230 }
231
232 QList<ControlPoint *> points = GetPoints();
233 m_ownPoints = false;
234 clear();
235
236 // Disconnect the parent network reference
237 for (int i = 0; i < points.size(); i++) {
238 points[i]->parentNetwork = NULL;
239 }
240 return (points);
241 }
242
243
269 void ControlNet::ReadControl(const QString &filename, Progress *progress) {
270
271 FileName cnetFileName(filename);
272 ControlNetVersioner versionedReader(cnetFileName, progress);
273 SetTarget( versionedReader.targetName() );
274 p_networkId = versionedReader.netId();
275 p_userName = versionedReader.userName();
276 p_created = versionedReader.creationDate();
277 p_modified = versionedReader.lastModificationDate();
278 p_description = versionedReader.description();
279
280 int numPoints = versionedReader.numPoints();
281
282 if (progress) {
283 progress->SetText("Adding Control Points to Network...");
284 progress->SetMaximumSteps(numPoints);
285 progress->CheckStatus();
286 }
287
288 for (int i = 0; i < numPoints; i++) {
289 AddPoint( versionedReader.takeFirstPoint() );
290 if (progress) {
291 progress->CheckStatus();
292 }
293 }
294 }
295
296
309 void ControlNet::Write(const QString &ptfile, bool pvl) {
310 ControlNetVersioner versionedWriter(this);
311
312 if (pvl) {
313 Pvl network;
314 try {
315 network = versionedWriter.toPvl();
316 }
317 catch (IException &e) {
318 QString msg = "Failed to convert control network to Pvl format.";
319 throw IException(e, IException::Programmer, msg, _FILEINFO_);
320 }
321
322 try {
323 network.write(ptfile);
324 }
325 catch (IException &e) {
326 QString msg = "Failed writing control network to file [" + ptfile + "]";
327 throw IException(e, IException::Io, msg, _FILEINFO_);
328 }
329 }
330 else {
331 try {
332 versionedWriter.write(FileName(ptfile));
333 }
334 catch (IException &e) {
335 QString msg = "Failed writing control network to file [" + ptfile + "]";
336 throw IException(e, IException::Io, msg, _FILEINFO_);
337 }
338 }
339 }
340
341
351 if (!point) {
352 IString msg = "Null pointer passed to ControlNet::AddPoint!";
353 throw IException(IException::Programmer, msg, _FILEINFO_);
354 }
355
356 if (ContainsPoint(point->GetId())) {
357 IString msg = "ControlPoint must have unique Id";
358 throw IException(IException::Programmer, msg, _FILEINFO_);
359 }
360
361 QString pointId = point->GetId();
362 points->insert(pointId, point);
363 pointIds->append(pointId);
364
365 point->parentNetwork = this;
366
367 // notify control network of new point
368 pointAdded(point);
369
370 emit networkStructureModified();
371 }
372
373
383 if (!point) {
384 IString msg = "NULL point passed to "
385 "ControlNet::pointAdded!";
386 throw IException(IException::Programmer, msg, _FILEINFO_);
387 }
388
389 if (!ContainsPoint(point->GetId())) {
390 QString msg = "ControlNet does not contain the point [";
391 msg += point->GetId() + "]";
392 throw IException(IException::Programmer, msg, _FILEINFO_);
393 }
394
395 // Make sure there is a node for every measure
396 for (int i = 0; i < point->GetNumMeasures(); i++) {
397 QString sn = point->GetMeasure(i)->GetCubeSerialNumber();
398 // If the graph doesn't have the sn, add a node for it
399 if (!m_vertexMap.contains(sn)) {
400 Image newImage;
401 newImage.serial = sn;
402 ImageVertex newVertex = boost::add_vertex(newImage, m_controlGraph);
403 m_vertexMap.insert(sn, newVertex);
404 emit networkModified(GraphModified);
405 }
406 }
407
408 QList< ControlMeasure * > measures = point->getMeasures();
409 for(int i = 0; i < measures.size(); i++) {
410 ControlMeasure* measure = measures[i];
411 // Add the measure to the corresponding node
412 QString serial = measure->GetCubeSerialNumber();
413 m_controlGraph[m_vertexMap[serial]].measures[measure->Parent()] = measure;
414
415 // In this measure's node add connections to the other nodes reachable from
416 // its point
417 if (!point->IsIgnored() && !measure->IsIgnored()) {
418 for (int j = i + 1; j < measures.size(); j++) {
419 ControlMeasure *cm = measures[j];
420 if (!cm->IsIgnored()) {
421 QString sn = cm->GetCubeSerialNumber();
422 addEdge(serial, sn);
423 }
424 }
425 }
426 }
427 emit newPoint(point);
428 }
429
430
440 bool ControlNet::addEdge(QString sourceSerial, QString targetSerial) {
441 // If the edge doesn't already exist, this adds and returns the edge.
442 // If the edge already exists, this just returns it. (The use of a set
443 // forces the edges to be unique.)
444 ImageConnection connection;
445 bool edgeAdded;
446
447 boost::tie(connection, edgeAdded) = boost::add_edge(m_vertexMap[sourceSerial],
448 m_vertexMap[targetSerial],
450 m_controlGraph[connection].strength++;
451 if (edgeAdded) {
452 emit networkModified(GraphModified);
453 }
454 return edgeAdded;
455 }
456
457
469 bool ControlNet::removeEdge(QString sourceSerial, QString targetSerial) {
470 ImageConnection connection;
471 bool edgeExists;
472 boost::tie(connection, edgeExists) = boost::edge(m_vertexMap[sourceSerial],
473 m_vertexMap[targetSerial],
475 if (edgeExists) {
476 m_controlGraph[connection].strength--;
477 if (m_controlGraph[connection].strength <= 0) {
478 boost::remove_edge(m_vertexMap[sourceSerial],
479 m_vertexMap[targetSerial],
481 emit networkModified(GraphModified);
482
483 return true;
484 }
485 }
486 return false;
487 }
488
489
496 QString graphString;
497
498 QStringList images = GetCubeSerials();
499 images.sort();
500
501 QHash<QString, QStringList> imagePointIds;
502
503 foreach(QString imageSerial, images) {
504 QList<ControlPoint *> imagePoints = m_controlGraph[m_vertexMap[imageSerial]].measures.keys();
506 foreach(ControlPoint *point, imagePoints) {
507 if (!point->IsIgnored()) {
508 pointIds.append(point->GetId());
509 }
510 }
511 pointIds.sort();
512 imagePointIds.insert(imageSerial, pointIds);
513 }
514
515 foreach(QString imageSerial, images) {
516 QStringList adjacentImages = getAdjacentImages(imageSerial);
517 adjacentImages.sort();
518 foreach(QString adjacentSerial, adjacentImages) {
519 if (QString::compare(adjacentSerial, imageSerial) < 0) {
520 continue;
521 }
522
523 QStringList commonPoints;
524 QList<QString>::const_iterator imageIt = imagePointIds[imageSerial].cbegin();
525 QList<QString>::const_iterator adjacentIt = imagePointIds[adjacentSerial].cbegin();
526 while (imageIt != imagePointIds[imageSerial].cend() &&
527 adjacentIt != imagePointIds[adjacentSerial].cend()) {
528 int stringDiff = QString::compare(*imageIt, *adjacentIt);
529 if (stringDiff < 0) {
530 imageIt++;
531 }
532 else if(stringDiff == 0) {
533 commonPoints.append(*imageIt);
534 imageIt++;
535 adjacentIt++;
536 }
537 else {
538 adjacentIt++;
539 }
540 }
541
542 std::pair<ImageConnection, bool> result = boost::edge(m_vertexMap[imageSerial],
543 m_vertexMap[adjacentSerial],
545 QString edgeStrength = "UNKNOWN";
546 if (result.second) {
547 edgeStrength = toString(m_controlGraph[result.first].strength);
548 }
549
550 graphString.append(imageSerial);
551 graphString.append(" ----(");
552 graphString.append(edgeStrength);
553 graphString.append(") [");
554 graphString.append(commonPoints.join(","));
555 graphString.append("]---- ");
556 graphString.append(adjacentSerial);
557 graphString.append("\n");
558 }
559 }
560
561 return graphString;
562 }
563
564
579 if (!measure) {
580 IString msg = "NULL measure passed to "
581 "ControlNet::measureAdded!";
582 throw IException(IException::Programmer, msg, _FILEINFO_);
583 }
584
585 ControlPoint *point = measure->Parent();
586 if (!point) {
587 IString msg = "Control measure with NULL parent passed to "
588 "ControlNet::measureAdded!";
589 throw IException(IException::Programmer, msg, _FILEINFO_);
590 }
591
592 if (!ContainsPoint(point->GetId())) {
593 QString msg = "ControlNet does not contain the point [";
594 msg += point->GetId() + "]";
595 throw IException(IException::Programmer, msg, _FILEINFO_);
596 }
597 // Add the measure to the corresponding node
598 QString serial = measure->GetCubeSerialNumber();
599
600 // If the graph doesn't have the sn, add a node for it
601 if (!m_vertexMap.contains(serial)) {
602 Image newImage;
603 newImage.serial = serial;
604 ImageVertex newVertex = boost::add_vertex(newImage, m_controlGraph);
605 m_vertexMap.insert(serial, newVertex);
606 emit networkModified(GraphModified);
607 }
608
609 m_controlGraph[m_vertexMap[serial]].measures[measure->Parent()] = measure;
610
611 // in this measure's node add connections to the other nodes reachable from
612 // its point
613 if (!point->IsIgnored() && !measure->IsIgnored()) {
614 for (int i = 0; i < point->GetNumMeasures(); i++) {
615 ControlMeasure *cm = point->GetMeasure(i);
616 if (!cm->IsIgnored()) {
617 QString sn = cm->GetCubeSerialNumber();
618
619
620 if (QString::compare(sn, serial) != 0) {
621 addEdge(serial, sn);
622 }
623 }
624 }
625 }
626 emit newMeasure(measure);
627 }
628
629
636 if (!point) {
637 IString msg = "NULL point passed to "
638 "ControlNet::pointUnIgnored!";
639 throw IException(IException::Programmer, msg, _FILEINFO_);
640 }
641
642 QList< ControlMeasure * > validMeasures = point->getMeasures(true);
643
644 for (int i = 0; i < validMeasures.size(); i++) {
645 ControlMeasure *sourceMeasure = validMeasures[i];
646 QString sourceSerial = sourceMeasure->GetCubeSerialNumber();
647
648 if (!ValidateSerialNumber(sourceSerial)) {
649 QString msg = "Node does not exist for [";
650 msg += sourceSerial + "]";
651 throw IException(IException::Programmer, msg, _FILEINFO_);
652 }
653
654 for(int j = i+1; j < validMeasures.size(); j++) {
655 ControlMeasure *targetMeasure = validMeasures[j];
656 QString targetSerial = targetMeasure->GetCubeSerialNumber();
657
658 if (!ValidateSerialNumber(targetSerial)) {
659 QString msg = "Node does not exist for [";
660 msg += targetSerial + "]";
661 throw IException(IException::Programmer, msg, _FILEINFO_);
662 }
663 addEdge(sourceSerial, targetSerial);
664 }
665 }
666 }
667
668
682 if (!measure) {
683 IString msg = "NULL measure passed to "
684 "ControlNet::measureUnIgnored!";
685 throw IException(IException::Programmer, msg, _FILEINFO_);
686 }
687
688 ControlPoint *point = measure->Parent();
689 if (!point) {
690 IString msg = "Control measure with NULL parent passed to "
691 "ControlNet::measureUnIgnored!";
692 throw IException(IException::Programmer, msg, _FILEINFO_);
693 }
694
695 if (!ContainsPoint(point->GetId())) {
696 QString msg = "ControlNet does not contain the point [";
697 msg += point->GetId() + "]";
698 throw IException(IException::Programmer, msg, _FILEINFO_);
699 }
700
701 // Make sure there is a node for every measure in this measure's parent
702 for (int i = 0; i < point->GetNumMeasures(); i++) {
703 ControlMeasure *adjacentMeasure = point->GetMeasure(i);
704 QString sn = adjacentMeasure->GetCubeSerialNumber();
705 if (!adjacentMeasure->IsIgnored() && !m_vertexMap.contains(sn)) {
706 QString msg = "Node does not exist for [";
707 msg += measure->GetCubeSerialNumber() + "]";
708 throw IException(IException::Programmer, msg, _FILEINFO_);
709 }
710 }
711
712 if (!point->IsIgnored()) {
713 QString serial = measure->GetCubeSerialNumber();
714
715 // In this measure's node add connections to the other nodes reachable
716 // from its point
717 for (int i = 0; i < point->GetNumMeasures(); i++) {
718 ControlMeasure *cm = point->GetMeasure(i);
719 if (!cm->IsIgnored()) {
720 QString sn = cm->GetCubeSerialNumber();
721
722 if (QString::compare(sn, serial) != 0) {
723 addEdge(serial, sn);
724 }
725 }
726 }
727 }
728 }
729
730
739 void ControlNet::UpdatePointReference(ControlPoint *point, QString oldId) {
740 points->remove(oldId);
741 (*points)[point->GetId()] = point;
742 (*pointIds)[pointIds->indexOf((QString) oldId)] = (QString)point->GetId();
743 }
744
745
753 QString serial = measure->GetCubeSerialNumber();
754
755 emit measureRemoved(measure);
756
757 // Remove connections to and from this node
758 if (!measure->IsIgnored() && !measure->Parent()->IsIgnored()) {
759 // Break connections
760 measureIgnored(measure);
761 }
762
763 // Remove the measure from the associated node.
764 // Conceptually, I think this belongs in measureIgnored, but it isn't done
765 // for the old graph.
766 m_controlGraph[m_vertexMap[serial]].measures.remove(measure->Parent());
767 }
768
769
776 if (!point) {
777 IString msg = "NULL point passed to "
778 "ControlNet::pointIgnored!";
779 throw IException(IException::Programmer, msg, _FILEINFO_);
780 }
781
782 QList< ControlMeasure * > validMeasures = point->getMeasures(true);
783
784 for (int i = 0; i < validMeasures.size(); i++) {
785 ControlMeasure *sourceMeasure = validMeasures[i];
786 QString sourceSerial = sourceMeasure->GetCubeSerialNumber();
787
788 if (!ValidateSerialNumber(sourceSerial)) {
789 QString msg = "Node does not exist for [";
790 msg += sourceSerial + "]";
791 throw IException(IException::Programmer, msg, _FILEINFO_);
792 }
793
794 for(int j = i+1; j < validMeasures.size(); j++) {
795 ControlMeasure *targetMeasure = validMeasures[j];
796 QString targetSerial = targetMeasure->GetCubeSerialNumber();
797
798 if (!ValidateSerialNumber(targetSerial)) {
799 QString msg = "Node does not exist for [";
800 msg += targetSerial + "]";
801 throw IException(IException::Programmer, msg, _FILEINFO_);
802 }
803 removeEdge(sourceSerial, targetSerial);
804 }
805 }
806 }
807
808
809
818 if (!measure) {
819 IString msg = "NULL measure passed to "
820 "ControlNet::measureIgnored!";
821 throw IException(IException::Programmer, msg, _FILEINFO_);
822 }
823
824 ControlPoint *point = measure->Parent();
825 if (!point) {
826 IString msg = "Control measure with NULL parent passed to "
827 "ControlNet::measureIgnored!";
828 throw IException(IException::Programmer, msg, _FILEINFO_);
829 }
830
831 QString serial = measure->GetCubeSerialNumber();
832 if (!ValidateSerialNumber(serial)) {
833 QString msg = "Node does not exist for [";
834 msg += serial + "]";
835 throw IException(IException::Programmer, msg, _FILEINFO_);
836 }
837
838 // Decrement the edge strength for edges from this node
839 // Remove edge if the strength becomes 0.
840 for (int i = 0; i < point->GetNumMeasures(); i++) {
841 ControlMeasure *adjacentMeasure = point->GetMeasure(i);
842 QString sn = adjacentMeasure->GetCubeSerialNumber();
843 if (!adjacentMeasure->IsIgnored() && m_vertexMap.contains(sn)) {
844 if (QString::compare(serial, sn) !=0) {
845 removeEdge(serial, sn);
846 }
847 }
848 }
849 }
850
851
858 m_coordType = coordType;
859 }
860
861
866 emit networkStructureModified();
867 }
868
869
876 if (points->values().contains(point)) {
877 return DeletePoint(point->GetId());
878 }
879 else {
880 IString msg = "point [";
881 msg += (long) point;
882 msg += "] does not exist in the network";
883 throw IException(IException::User, msg, _FILEINFO_);
884 }
885 }
886
887
895 int ControlNet::DeletePoint(QString pointId) {
896 if (!points->contains(pointId)) {
897 IString msg = "point Id [" + pointId + "] does not exist in the network";
898 throw IException(IException::User, msg, _FILEINFO_);
899 }
900
901 ControlPoint *point = (*points)[pointId];
902
903 if (point->IsEditLocked())
905
906 bool wasIgnored = point->IsIgnored();
907
908 // notify CubeSerialNumbers of the loss of this point
909 foreach(ControlMeasure * measure, point->getMeasures()) {
910 point->Delete(measure);
911 }
912
913 emit pointDeleted(point);
914
915 // delete point
916 points->remove(pointId);
917 pointIds->removeAt(pointIds->indexOf(pointId));
918 delete point;
919 point = NULL;
920
921 if (!wasIgnored)
922 emit networkStructureModified();
924 }
925
926
932 int ControlNet::DeletePoint(int index) {
933 if (index < 0 || index >= pointIds->size()) {
934 IString msg = "Index [" + IString(index) + "] out of range";
935 throw IException(IException::Programmer, msg, _FILEINFO_);
936 }
937
938 return DeletePoint(pointIds->at(index));
939 }
940
941
947 bool ControlNet::ContainsPoint(QString pointId) const {
948 return points->contains(pointId);
949 }
950
951
963 QList< QList< QString > > ControlNet::GetSerialConnections() const {
964
965 VertexIndexMap indexMap;
966 VertexIndexMapAdaptor indexMapAdaptor(indexMap);
967
968 // Needed to use connected_componenets
969 QList< QString> serials = m_vertexMap.keys();
970 for (int i = 0; i < serials.size(); i++) {
971 boost::put(indexMapAdaptor, m_vertexMap[serials[i]], i);
972 }
973
974 VertexIndexMap componentMap;
975 VertexIndexMapAdaptor componentAdaptor(componentMap);
976 int numComponents = boost::connected_components(m_controlGraph, componentAdaptor,
977 boost::vertex_index_map(indexMapAdaptor));
978
979 QList< QList< QString > > islandStrings;
980 for (int i = 0; i < numComponents; i++) {
981 QList<QString> tempList;
982 islandStrings.append(tempList);
983 }
984 std::map<ImageVertex, size_t>::iterator it = componentMap.begin();
985 while(it != componentMap.end())
986 {
987 QString serial = m_controlGraph[it->first].serial;
988 int group = (int) it->second;
989 islandStrings[group].append(serial);
990 ++it;
991 }
992 return islandStrings;
993 }
994
995
1000 return boost::num_edges(m_controlGraph);
1001 }
1002
1003
1013 return m_vertexMap.keys();
1014 }
1015
1016
1025 bool ControlNet::ValidateSerialNumber(QString serialNumber) const {
1026 return m_vertexMap.contains(serialNumber);
1027 }
1028
1029
1038 if (!ValidateSerialNumber(serialNumber)) {
1039 QString msg = "Cube Serial Number [" + serialNumber + "] not found in "
1040 "the network";
1041 throw IException(IException::Programmer, msg, _FILEINFO_);
1042 }
1043
1044 QList< QString > adjacentSerials;
1045
1046 AdjacencyIterator adjIt, adjEnd;
1047 boost::tie(adjIt, adjEnd) = boost::adjacent_vertices(m_vertexMap[serialNumber], m_controlGraph);
1048 for( ; adjIt != adjEnd; adjIt++) {
1049 adjacentSerials.append(m_controlGraph[*adjIt].serial);
1050 }
1051
1052 return adjacentSerials;
1053 }
1054
1055
1061 QList< ControlMeasure * > ControlNet::GetMeasuresInCube(QString serialNumber) {
1062 if( !ValidateSerialNumber(serialNumber) ) {
1063 IString msg = "Cube Serial Number [" + serialNumber + "] not found in "
1064 "the network";
1065 throw IException(IException::Programmer, msg, _FILEINFO_);
1066
1067 }
1068 return m_controlGraph[m_vertexMap[serialNumber]].measures.values();
1069 }
1070
1071
1077 QList< ControlMeasure * > ControlNet::GetValidMeasuresInCube(QString serialNumber) {
1078 QList< ControlMeasure * > validMeasures;
1079
1080 // Get measures in cube will validate this for us, so we don't need to re-check
1081 QList< ControlMeasure * > measureList = GetMeasuresInCube(serialNumber);
1082
1083 foreach(ControlMeasure * measure, measureList) {
1084 if (!measure->IsIgnored())
1085 validMeasures.append(measure);
1086 }
1087
1088 return validMeasures;
1089 }
1090
1091
1099
1100 if (this != &other) {
1101 this->m_accessor = other.m_accessor;
1102 }
1103
1104 return *this;
1105 }
1106
1107
1114 bool ControlNet::ControlMeasureLessThanFunctor::operator()
1115 (ControlMeasure* const &a, ControlMeasure* const &b) {
1116
1117 return (a->*this->m_accessor)() < (b->*this->m_accessor)();
1118
1119 }
1120
1121
1129 QList< ControlMeasure * > ControlNet::sortedMeasureList(double(ControlMeasure::*statFunc)() const,
1130 double min,double max) {
1131
1132 QList< ControlMeasure * >measures;
1133
1134 //build a list of all the pointers to the relevant measures
1135 //get the number of object points
1136 int nObjPts = this->GetNumPoints();
1137 for (int i=0;i<nObjPts;i++) { //for each Object point
1138 ControlPoint *point = this->GetPoint(i);
1139 if (point->IsIgnored()) continue; //if the point is ignored then continue
1140
1141 // Get the number of measures
1142 int nObs = point->GetNumMeasures();
1143 for (int j=0;j<nObs;j++) { //for every measure
1144 ControlMeasure *measure = point->GetMeasure(j);
1145 if (measure->IsIgnored()) continue;
1146 double temp = (measure->*statFunc)();
1147 if (temp > min)
1148 if (min <= temp && temp <= max) measures.push_back(measure);
1149 }
1150 }
1151
1152 // Sort the measures
1153 ControlMeasureLessThanFunctor lessThan(statFunc);
1154 qSort(measures.begin(),measures.end(),lessThan);
1155
1156 return measures;
1157 }
1158
1159
1166 // TODO: Make sure the cameras have been initialized
1167
1168 QHashIterator< QString, ControlPoint * > i(*points);
1169 while (i.hasNext()) {
1170 i.next();
1171 i.value()->ComputeResiduals();
1172 }
1173 }
1174
1175
1182 // TODO: Make sure the cameras have been initialized
1183 QHashIterator< QString, ControlPoint * > i(*points);
1184 while (i.hasNext()) {
1185 i.next();
1186 ControlPoint *point = i.value();
1187 if ( !point->IsIgnored() )
1188 point->ComputeApriori();
1189 }
1190 }
1191
1192
1200 // TODO: Make sure the cameras have been initialized
1201 double avgResidual = 0.0;
1202 int count = 0;
1203 QHashIterator< QString, ControlPoint * > i(*points);
1204 while (i.hasNext()) {
1205 i.next();
1206 ControlPoint *point = i.value();
1207 if (!point->IsIgnored()) {
1208 avgResidual += point->GetStatistic(
1210 count++;
1211 }
1212 }
1213
1214 if (count != 0)
1215 avgResidual /= count;
1216
1217 return avgResidual;
1218 }
1219
1220
1229 return p_cameraList[index];
1230 }
1231
1232
1240 Isis::Camera *ControlNet::Camera(QString serialNumber) {
1241 return p_cameraMap[serialNumber];
1242 }
1243
1244
1252 QString ControlNet::CreatedDate() const {
1253 return p_created;
1254 }
1255
1256
1262 QString ControlNet::Description() const {
1263 return p_description;
1264 }
1265
1266
1280 double sample, double line) {
1281
1282 if (!ValidateSerialNumber(serialNumber)) {
1283 QString msg = "serialNumber [";
1284 msg += serialNumber;
1285 msg += "] not found in ControlNet";
1286 throw IException(IException::Programmer, msg, _FILEINFO_);
1287 }
1288
1289 const double SEARCH_DISTANCE = 99999999.0;
1290 double minDist = SEARCH_DISTANCE;
1291 ControlPoint *closestPoint = NULL;
1292
1293 QList < ControlMeasure * > measures = m_controlGraph[m_vertexMap[serialNumber]].measures.values();
1294
1295 for (int i = 0; i < measures.size(); i++) {
1296 ControlMeasure *measureToCheck = measures[i];
1297
1298 // Find closest line sample & return that controlpoint
1299 double dx = fabs(sample - measureToCheck->GetSample());
1300 double dy = fabs(line - measureToCheck->GetLine());
1301
1302 double dist = sqrt((dx * dx) + (dy * dy));
1303
1304 if (dist < minDist) {
1305 minDist = dist;
1306 closestPoint = measureToCheck->Parent();
1307 }
1308 }
1309
1310 if (!closestPoint) {
1311 IString msg = "No point found within ";
1312 msg += IString(SEARCH_DISTANCE);
1313 msg += "pixels of sample/line [";
1314 msg += IString(sample);
1315 msg += ", ";
1316 msg += IString(line);
1317 msg += "]";
1318 throw IException(IException::Programmer, msg, _FILEINFO_);
1319 }
1320
1321 return closestPoint;
1322 }
1323
1324
1332 // TODO: Make sure the cameras have been initialized
1333
1334 double maxResidual = 0.0;
1335 foreach(ControlPoint * p, *points) {
1336 double residual = p->GetStatistic(
1338 if (residual > maxResidual)
1339 maxResidual = residual;
1340 }
1341
1342 return maxResidual;
1343 }
1344
1345
1346 QString ControlNet::GetNetworkId() const {
1347 return p_networkId;
1348 }
1349
1350
1358 int numLockedMeasures = 0;
1359 foreach(ControlPoint * p, *points) {
1360 numLockedMeasures += p->GetNumLockedMeasures();
1361 }
1362
1363 return numLockedMeasures;
1364 }
1365
1366
1373 int editLockPoints = 0;
1374 foreach(ControlPoint * p, *points) {
1375 if (p->IsEditLocked())
1376 editLockPoints++;
1377 }
1378
1379 return editLockPoints;
1380 }
1381
1382
1390 int numIgnoredMeasures = 0;
1391 foreach(ControlPoint * p, *points) {
1392 numIgnoredMeasures += p->GetNumMeasures() - p->GetNumValidMeasures();
1393 }
1394
1395 return numIgnoredMeasures;
1396 }
1397
1398
1407 int ControlNet::GetNumberOfValidMeasuresInImage(const QString &serialNumber) {
1408 // If SetImage was called, use the map that has been populated with valid measures
1409 if (p_cameraList.size() > 0) {
1410 return p_cameraValidMeasuresMap[serialNumber];
1411 }
1412 return GetValidMeasuresInCube(serialNumber).size();
1413 }
1414
1415
1422 return p_cameraRejectedMeasuresMap[serialNumber];
1423 }
1424
1425
1432 foreach(ControlPoint * p, *points) {
1433 p->ClearJigsawRejected();
1434 }
1435 }
1436
1437
1443 p_cameraRejectedMeasuresMap[serialNumber]++;
1444 }
1445
1446
1452 if (p_cameraRejectedMeasuresMap[serialNumber] > 0)
1453 p_cameraRejectedMeasuresMap[serialNumber]--;
1454 }
1455
1456
1463 int numMeasures = 0;
1464 foreach(ControlPoint * p, *points) {
1465 numMeasures += p->GetNumMeasures();
1466 }
1467
1468 return numMeasures;
1469 }
1470
1471
1474 return points->size();
1475 }
1476
1477
1488 int numValidMeasures = 0;
1489 foreach(ControlPoint * p, *points) {
1490 if (!p->IsIgnored())
1491 numValidMeasures += p->GetNumValidMeasures();
1492 }
1493
1494 return numValidMeasures;
1495 }
1496
1497
1504 int validPoints = 0;
1505 foreach(ControlPoint * p, *points) {
1506 if (!p->IsIgnored())
1507 validPoints++;
1508 }
1509
1510 return validPoints;
1511 }
1512
1513
1515 QString ControlNet::GetTarget() const {
1516 return p_targetName;
1517 }
1518
1519
1521 QString ControlNet::GetUserName() const {
1522 return p_userName;
1523 }
1524
1527 return p_modified;
1528 }
1529
1530
1532 QList< ControlPoint * > ControlNet::GetPoints() {
1533 QList< ControlPoint * > pointsList;
1534
1535 for (int i = 0; i < pointIds->size(); i++) {
1536 pointsList.append(GetPoint(i));
1537 }
1538
1539 return pointsList;
1540 }
1541
1542
1545 return *pointIds;
1546 }
1547
1548
1554 void ControlNet::SetCreatedDate(const QString &date) {
1555 p_created = date;
1556 }
1557
1558
1564 void ControlNet::SetDescription(const QString &newDescription) {
1565 p_description = newDescription;
1566 }
1567
1568
1574 void ControlNet::SetImages(const QString &imageListFile) {
1575 SerialNumberList list(imageListFile);
1576 SetImages(list);
1577 }
1578
1579
1596 // First check if cameras have already been setup via another SetImages call
1597 if (p_cameraList.size() > 0) {
1598 return;
1599 }
1600 // Prep for reporting progress
1601 if (progress != NULL) {
1602 progress->SetText("Setting input images...");
1603 progress->SetMaximumSteps(list.size());
1604 progress->CheckStatus();
1605 }
1606 // Open the camera for all the images in the serial number list
1607 for (int i = 0; i < list.size(); i++) {
1608 QString serialNumber = list.serialNumber(i);
1609 QString filename = list.fileName(i);
1610 Cube cube(filename, "r");
1611
1612 try {
1614 p_cameraMap[serialNumber] = cam;
1615 p_cameraValidMeasuresMap[serialNumber] = 0;
1616 p_cameraRejectedMeasuresMap[serialNumber] = 0;
1617 p_cameraList.push_back(cam);
1618 }
1619 catch (IException &e) {
1620 QString msg = "Unable to create camera for cube file ";
1621 msg += filename;
1622 throw IException(e, IException::Unknown, msg, _FILEINFO_);
1623 }
1624
1625 if (progress != NULL)
1626 progress->CheckStatus();
1627 }
1628
1629 // Loop through all measures and set the camera
1630 QHashIterator< QString, ControlPoint * > p(*points);
1631 while (p.hasNext()) {
1632 p.next();
1633 ControlPoint *curPoint = p.value();
1634
1635 QList< QString > serialNums = curPoint->getCubeSerialNumbers();
1636 for (int m = 0; m < serialNums.size(); m++) {
1637 ControlMeasure *curMeasure = (*curPoint)[serialNums[m]];
1638
1639 QString serialNumber = curMeasure->GetCubeSerialNumber();
1640 if (list.hasSerialNumber(serialNumber)) {
1641 curMeasure->SetCamera(p_cameraMap[serialNumber]);
1642
1643 // increment number of measures for this image (camera)
1644 if (!curMeasure->IsIgnored()) p_cameraValidMeasuresMap[serialNumber]++;
1645 }
1646 else {
1647 IString msg = "Control point [" + curPoint->GetId() +
1648 "], measure [" + curMeasure->GetCubeSerialNumber() +
1649 "] does not have a cube with a matching serial number";
1650 throw IException(IException::User, msg, _FILEINFO_);
1651 }
1652 }
1653 }
1654 }
1655
1656
1662 void ControlNet::SetModifiedDate(const QString &date) {
1663 p_modified = date;
1664 }
1665
1666
1674 void ControlNet::SetMutex(QMutex *mutex) {
1675 m_mutex = mutex;
1676 }
1677
1678
1684 void ControlNet::SetNetworkId(const QString &id) {
1685 p_networkId = id;
1686 }
1687
1688
1700 void ControlNet::SetTarget(const QString &target) {
1701 p_targetName = target;
1702 }
1703
1704
1713 PvlGroup mapping;
1714 if ( (label.hasObject("IsisCube") && label.findObject("IsisCube").hasGroup("Mapping"))
1715 || label.hasGroup("Mapping") ) {
1716 mapping = label.findGroup("Mapping", Pvl::Traverse);
1717 }
1718
1719 if (mapping.hasKeyword("TargetName")) {
1720 p_targetName = mapping["TargetName"][0];
1721 }
1722 else if (label.hasObject("IsisCube")
1723 && label.findObject("IsisCube").hasGroup("Instrument")
1724 && label.findObject("IsisCube").findGroup("Instrument").hasKeyword("TargetName")) {
1725 p_targetName = label.findObject("IsisCube").findGroup("Instrument").findKeyword("TargetName")[0];
1726 }
1727 else {
1728 p_targetName = "";
1729 }
1730 }
1731
1732
1738 void ControlNet::SetUserName(const QString &name) {
1739 p_userName = name;
1740 }
1741
1742
1758 std::swap(points, other.points);
1759 std::swap(pointIds, other.pointIds);
1760 m_controlGraph.swap(other.m_controlGraph);
1761 std::swap(m_mutex, other.m_mutex);
1762 std::swap(p_targetName, other.p_targetName);
1763 std::swap(p_networkId, other.p_networkId);
1764 std::swap(p_created, other.p_created);
1765 std::swap(p_modified, other.p_modified);
1766 std::swap(p_description, other.p_description);
1767 std::swap(p_userName, other.p_userName);
1768 std::swap(p_cameraMap, other.p_cameraMap);
1769 std::swap(p_cameraValidMeasuresMap, other.p_cameraValidMeasuresMap);
1770 std::swap(p_cameraRejectedMeasuresMap, other.p_cameraRejectedMeasuresMap);
1771 std::swap(p_cameraList, other.p_cameraList);
1772
1773 // points have parent pointers that need to be updated too...
1774 QHashIterator< QString, ControlPoint * > i(*points);
1775 while (i.hasNext()) {
1776 i.next().value()->parentNetwork = this;
1777 }
1778
1779 QHashIterator< QString, ControlPoint * > i2(*other.points);
1780 while (i2.hasNext()) {
1781 i2.next().value()->parentNetwork = &other;
1782 }
1783
1784 m_vertexMap.clear();
1785 VertexIterator v, vend;
1786 for (boost::tie(v, vend) = vertices(m_controlGraph); v != vend; ++v) {
1787 ImageVertex imVertex = *v;
1788 QString serialNum = m_controlGraph[*v].serial;
1789 m_vertexMap[serialNum] = imVertex;
1790 }
1791
1792 other.m_vertexMap.clear();
1793 VertexIterator v2, vend2;
1794 for (boost::tie(v2, vend2) = vertices(other.m_controlGraph); v2 != vend2; ++v2) {
1795 ImageVertex imVertex = *v2;
1796 QString serialNum = other.m_controlGraph[*v2].serial;
1797 other.m_vertexMap[serialNum] = imVertex;
1798 }
1799
1800 emit networkModified(ControlNet::Swapped);
1801 }
1802
1803
1812 // Optimization: if this == other do nothing.
1813 if (this != &other) {
1814 // copy & swap
1815 ControlNet copy(other);
1816 swap(copy);
1817 }
1818
1819 return *this;
1820 }
1821
1822
1823 const ControlPoint *ControlNet::GetPoint(QString id) const {
1824 if (!points->contains(id)) {
1825 IString msg = "The control network has no control points with an ID "
1826 "equal to [" + id + "]";
1827 throw IException(IException::Programmer, msg, _FILEINFO_);
1828 }
1829
1830 return points->value(id);
1831 }
1832
1833
1834 ControlPoint *ControlNet::GetPoint(QString id) {
1835 if (!points->contains(id)) {
1836 IString msg = "The control network has no control points with an ID "
1837 "equal to [" + id + "]";
1838 throw IException(IException::Programmer, msg, _FILEINFO_);
1839 }
1840
1841 return (*points)[id];
1842 }
1843
1844
1845 const ControlPoint *ControlNet::GetPoint(int index) const {
1846 if (index < 0 || index >= pointIds->size()) {
1847 IString msg = "Index [" + IString(index) + "] out of range";
1848 throw IException(IException::Programmer, msg, _FILEINFO_);
1849 }
1850
1851 return GetPoint(pointIds->at(index));
1852 }
1853
1854
1855 ControlPoint *ControlNet::GetPoint(int index) {
1856 if (index < 0 || index >= pointIds->size()) {
1857 IString msg = "Index [" + IString(index) + "] out of range";
1858 throw IException(IException::Programmer, msg, _FILEINFO_);
1859 }
1860
1861 return GetPoint(pointIds->at(index));
1862 }
1863
1864
1873
1874 const ControlPoint *ControlNet::operator[](QString id) const {
1875 return GetPoint(id);
1876 }
1877
1878
1879 ControlPoint *ControlNet::operator[](QString id) {
1880 return GetPoint(id);
1881 }
1882
1883
1884 const ControlPoint *ControlNet::operator[](int index) const {
1885 return GetPoint(index);
1886 }
1887
1888
1889 ControlPoint *ControlNet::operator[](int index) {
1890 return GetPoint(index);
1891 }
1892}
static QString DateTime(time_t *curtime=0)
Returns the date and time as a QString.
static Camera * Create(Cube &cube)
Creates a Camera object using Pvl Specifications.
a control measurement
QString GetCubeSerialNumber() const
Return the serial number of the cube containing the coordinate.
ModType
Control Measure Modification Types.
double GetResidualMagnitude() const
Return Residual magnitude.
ControlMeasureLessThanFunctor & operator=(ControlMeasureLessThanFunctor const &other)
Copies the content of the a ControlMeasureLessThanFunctor.
a control network
Definition ControlNet.h:258
int GetNumEditLockPoints()
Returns the number of edit locked control points.
int GetNumMeasures() const
Returns the total number of measures for all control points in the network.
QString Description() const
Return the description of the network.
void pointIgnored(ControlPoint *point)
Update the ControlNet's internal structure when a ControlPoint is ignored.
int getEdgeCount() const
ControlNet(SurfacePoint::CoordinateType=SurfacePoint::Latitudinal)
Creates an empty ControlNet object.
QString GraphToString() const
Used for verifying graph intergrity.
void AddPoint(ControlPoint *point)
Adds a ControlPoint to the ControlNet.
QList< QList< QString > > GetSerialConnections() const
This method searches through all the cube serial numbers in the network.
QString GetLastModified() const
Return the last modified date.
double GetMaximumResidual()
Determine the maximum error of all points in the network.
QList< QString > getAdjacentImages(QString serialNumber) const
Get all images connected to a given image by common control points.
ControlNet & operator=(const ControlNet &other)
Assign other to this.
void ReadControl(const QString &filename, Progress *progress=0)
Reads in the control points from the given file.
void SetDescription(const QString &newDescription)
Set the description of the network.
SurfacePoint::CoordinateType m_coordType
The coordinate type of the control points.
Definition ControlNet.h:480
int GetNumPoints() const
Return the number of control points in the network.
QString p_targetName
Name of the target.
Definition ControlNet.h:467
QString p_description
Textual Description of network.
Definition ControlNet.h:471
QMap< QString, int > p_cameraRejectedMeasuresMap
A map from serialnumber to #rejected measures.
Definition ControlNet.h:475
QStringList * pointIds
The ControlNet graph.
Definition ControlNet.h:464
QString p_modified
Date Last Modified.
Definition ControlNet.h:470
void ComputeApriori()
Compute aprior values for each point in the network.
SurfacePoint::CoordinateType GetCoordType()
Get the control point coordinate type (see the available types in SurfacePoint.h).
QString CreatedDate() const
Return the Created Date.
void emitPointModified(ControlPoint *point, ControlPoint::ModType type, QVariant oldValue, QVariant newValue)
This method is a wrapper to emit the pointModified() signal and is called whenever a change is made t...
void DecrementNumberOfRejectedMeasuresInImage(const QString &serialNumber)
Decrement number of jigsaw rejected measures in image specified by serialNumber.
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.
void measureUnIgnored(ControlMeasure *measure)
Updates the connections for the ControlNet graph associated with the measure's serial number to refle...
QHash< QString, ControlPoint * > * points
hash ControlPoints by ControlPoint Id
Definition ControlNet.h:425
void SetImages(const QString &imageListFile)
Creates the ControlNet's image cameras based on an input file.
QString GetUserName() const
Return the user name.
QMap< QString, int > p_cameraValidMeasuresMap
A map from serialnumber to #measures.
Definition ControlNet.h:474
int GetNumberOfValidMeasuresInImage(const QString &serialNumber)
Return the number of measures in image specified by serialNumber.
Network m_controlGraph
The serial number -> vertex hash used by the graph.
Definition ControlNet.h:463
int GetNumberOfJigsawRejectedMeasuresInImage(const QString &serialNumber)
Return the number of jigsaw rejected measures in image specified by serialNumber.
void Write(const QString &filename, bool pvl=false)
Writes out the control network.
void SetCoordType(SurfacePoint::CoordinateType coordType)
Sets the control point coordinate type.
void emitNetworkStructureModified()
This method is a wrapper to emit the networkStructureModified() signal.
int GetNumValidMeasures()
Return the number of valid (non-ignored) measures for all control points in the network.
std::map< ImageVertex, size_t > VertexIndexMap
Represents the edges of the graph.
Definition ControlNet.h:453
int GetNumValidPoints()
Returns the number of non-ignored control points.
Network::edge_descriptor ImageConnection
Reprents the verticies of the graph.
Definition ControlNet.h:450
void pointAdded(ControlPoint *point)
Adds a whole point to the control net graph.
void measureAdded(ControlMeasure *measure)
Updates the ControlNet graph for the measure's serial number to reflect the addition.
QVector< Isis::Camera * > p_cameraList
Vector of image number to camera.
Definition ControlNet.h:477
QList< QString > GetPointIds() const
Return QList of ControlPoint Ids used in hash, in order of addition.
int GetNumIgnoredMeasures()
Return the total number of ignored measures for all control points in the network.
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...
void SetCreatedDate(const QString &date)
Set the creation time.
QString GetTarget() const
Return the target name.
double AverageResidual()
Compute the average error of all points in the network.
QMap< QString, Isis::Camera * > p_cameraMap
A map from serialnumber to camera.
Definition ControlNet.h:473
bool ContainsPoint(QString pointId) const
void clear()
Clear the contents of this object.
QString p_created
Creation Date.
Definition ControlNet.h:469
boost::associative_property_map< VertexIndexMap > VertexIndexMapAdaptor
Converts VertexIndexMap into the appropriate form to be used by boost.
Definition ControlNet.h:456
~ControlNet()
Destructor removes allocated memory.
Isis::Camera * Camera(int index)
Returns the camera list from the given image number.
bool m_ownPoints
Specifies ownership of point list. True if owned by this object.
Definition ControlNet.h:479
QList< ControlMeasure * > GetMeasuresInCube(QString serialNumber)
Get all the measures pertaining to a given cube serial number.
void SetUserName(const QString &name)
Set the user name of the control network.
QString p_networkId
The Network Id.
Definition ControlNet.h:468
QList< ControlPoint * > GetPoints()
Return QList of all the ControlPoints in the network.
void ClearJigsawRejected()
Sets jigsaw rejected flag to false for all points and measures.
void SetMutex(QMutex *mutex)
Set mutex to lock for making Naif calls.
void UpdatePointReference(ControlPoint *point, QString oldId)
Updates the key reference (poind Id) from the old one to what the point id was changet to.
void measureDeleted(ControlMeasure *measure)
Updates the node for this measure's serial number to reflect the deletion.
boost::graph_traits< Network >::adjacency_iterator AdjacencyIterator
Iterates over adjacent verticies.
Definition ControlNet.h:459
void emitMeasureModified(ControlMeasure *measure, ControlMeasure::ModType type, QVariant oldValue, QVariant newValue)
This method is a wrapper to emit the measureModified() signal and is called whenever a change is made...
void ComputeResiduals()
Compute error for each point in the network.
bool removeEdge(QString sourceSerial, QString targetSerial)
In the ControlNet graph, decrements the strength on the edge between the two serial numbers.
int DeletePoint(ControlPoint *point)
Delete a ControlPoint from the network by the point's address.
void pointUnIgnored(ControlPoint *point)
Update the ControlNet's internal structure when a ControlPoint is un-ignored.
void swap(ControlNet &other)
Swaps the member data with the given control net.
bool addEdge(QString sourceSerial, QString targetSerial)
In the ControlNet graph: adds an edge between the verticies associated with the two serial numbers pr...
QList< QString > GetCubeSerials() const
Use this method to get a complete list of all the cube serial numbers in the network.
void SetNetworkId(const QString &id)
Set the network id.
QString p_userName
The user who created the network.
Definition ControlNet.h:472
void SetModifiedDate(const QString &date)
Set the last modified date.
QList< ControlMeasure * > GetValidMeasuresInCube(QString serialNumber)
Get all the valid measures pertaining to a given cube serial number.
void IncrementNumberOfRejectedMeasuresInImage(const QString &serialNumber)
Increment number of jigsaw rejected measures in image specified by serialNumber.
int GetNumEditLockMeasures()
Return the total number of edit locked measures for all control points in the network.
void SetTarget(const QString &target)
Sets the target name and target radii, if available.
void measureIgnored(ControlMeasure *measure)
Updates the edges in the ControlNet graph to reflect the ignored measure.
QList< ControlPoint * > take()
Transfer ownership of all points to caller.
bool ValidateSerialNumber(QString serialNumber) const
Does a check to ensure that the given serial number is contained within the network.
Handle various control network file format versions.
A single control point.
@ PointLocked
This is returned when the operation requires Edit Lock to be false but it is currently true.
@ Success
This is returned when the operation successfully took effect.
ModType
Control Point Modification Types.
int Delete(ControlMeasure *measure)
Remove a measurement from the control point, deleting reference measure is allowed.
const ControlMeasure * GetMeasure(QString serialNumber) const
Get a control measure based on its cube's serial number.
Statistics GetStatistic(double(ControlMeasure::*statFunc)() const) const
This function will call a given method on every control measure that this point has.
QString GetId() const
Return the Id of the control point.
QList< ControlMeasure * > getMeasures(bool excludeIgnored=false) const
Status ComputeApriori()
Computes a priori lat/lon/radius point coordinates by determining the average lat/lon/radius of all m...
IO Handler for Isis Cubes.
Definition Cube.h:168
File name manipulation and expansion.
Definition FileName.h:100
Isis exception class.
Definition IException.h:91
@ Unknown
A type of error that cannot be classified as any of the other error types.
Definition IException.h:118
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Definition IException.h:126
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition IException.h:146
@ Io
A type of error that occurred when performing an actual I/O operation.
Definition IException.h:155
Adds specific functionality to C++ strings.
Definition IString.h:165
Program progress reporter.
Definition Progress.h:42
void SetMaximumSteps(const int steps)
This sets the maximum number of steps in the process.
Definition Progress.cpp:85
void SetText(const QString &text)
Changes the value of the text string reported just before 0% processed.
Definition Progress.cpp:61
void CheckStatus()
Checks and updates the status.
Definition Progress.cpp:105
Contains multiple PvlContainers.
Definition PvlGroup.h:41
Container for cube-like labels.
Definition Pvl.h:119
bool hasObject(const QString &name) const
Returns a boolean value based on whether the object exists in the current PvlObject or not.
Definition PvlObject.h:325
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
Definition PvlObject.h:276
bool hasGroup(const QString &name) const
Returns a boolean value based on whether the object has the specified group or not.
Definition PvlObject.h:212
@ Traverse
Search child objects.
Definition PvlObject.h:158
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition PvlObject.h:129
Serial Number list generator.
bool hasSerialNumber(QString sn)
Determines whether or not the requested serial number exists in the list.
QString serialNumber(const QString &filename)
Return a serial number given a filename.
int size() const
How many serial number / filename combos are in the list.
QString fileName(const QString &sn)
Return a filename given a serial number.
double Average() const
Computes and returns the average.
CoordinateType
Defines the coordinate typ, units, and coordinate index for some of the output methods.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition IString.cpp:211
Namespace for the standard library.
Used to define the verticies of the graph.
Definition ControlNet.h:428