Isis 3 Programmer Reference
ControlNetFilter.cpp
1 #include "ControlNetFilter.h"
2 
3 #include <QVector>
4 
5 #include "Angle.h"
6 #include "Camera.h"
7 #include "CameraFactory.h"
8 #include "ControlMeasure.h"
10 #include "ControlNet.h"
11 #include "ControlPoint.h"
12 #include "FileName.h"
13 #include "IString.h"
14 #include "Latitude.h"
15 #include "Longitude.h"
16 #include "PvlGroup.h"
17 #include "SerialNumberList.h"
18 #include "Statistics.h"
19 
20 // for double precision
21 #include <limits>
22 typedef std::numeric_limits< double > dbl;
23 
24 using namespace std;
25 
26 #define UNDEFINED_STATUS 2
27 
28 namespace Isis {
29 
31  extern QString sPointType[];
32 
34  extern QString sBoolean[];
35 
45  ControlNetFilter::ControlNetFilter(ControlNet *pCNet, QString &psSerialNumFile, Progress *pProgress) :
46  ControlNetStatistics(pCNet, psSerialNumFile, pProgress) {
47  mSerialNumFilter = SerialNumberList(psSerialNumFile);
48  }
49 
58  void ControlNetFilter::SetOutputFile(QString psPrintFile) {
59  Isis::FileName outFile(psPrintFile);
60  QString outName(outFile.expanded());
61  mOstm.open(outName.toLatin1().data(), std::ios::out);
62  mOstm.precision(dbl::digits10);
63  }
64 
71  mOstm.close();
72  }
73 
74 
84  if ( mCNet->GetPoint(pindex)->IsEditLocked() ) {
85  mCNet->GetPoint(pindex)->SetEditLock(false);
86  }
87  mCNet->DeletePoint(pindex);
88  }
89 
101  QList< ControlMeasure * > measures = mCNet->GetMeasuresInCube(serialNum);
102 
103  foreach(ControlMeasure * measure, measures) {
104  bool pointEditFlag = false;
105  QString ptId(measure->Parent()->GetId());
106  ControlPoint * point = mCNet->GetPoint(ptId);
107  if (point->IsEditLocked()) {
108  point->SetEditLock(false);
109  pointEditFlag = true;
110  }
111  ControlMeasure *msr = point->GetMeasure(serialNum);
112  msr->SetEditLock(false);
113  point->Delete(serialNum);
114  if (pointEditFlag) {
115  point->SetEditLock(true);
116  }
117  }
118  }
119 
126  mOstm << "PointID, PointType, PointIgnored, PointEditLocked, TotalMeasures, MeasuresIgnored, MeasuresEditLocked, ";
127  }
128 
137  mOstm << pcPoint.GetId() << ", " << sPointType[(int)pcPoint.GetType()]
138  << ", " << sBoolean[(int)pcPoint.IsIgnored()] << ", "
139  << sBoolean[(int)pcPoint.IsEditLocked()] << ", "
140  << pcPoint.GetNumMeasures() << ", "
141  << pcPoint.GetNumMeasures() - pcPoint.GetNumValidMeasures() << ", "
142  << pcPoint.GetNumLockedMeasures() << ", ";
143  }
144 
153  mOstm << mSerialNumList.fileName(pcMeasure.GetCubeSerialNumber()) << ", ";
154  mOstm << pcMeasure.GetCubeSerialNumber();
155  }
156 
163  mOstm << "FileName, SerialNumber, ImageTotalPoints, ImagePointsIgnored, ImagePointsEditLocked, ImagePointsFixed, ImagePointsConstrained, ImagePointsFree, ImageConvexHullRatio,";
164  }
165 
174  void ControlNetFilter::PointPixelShiftFilter(const PvlGroup &pvlGrp, bool pbLastFilter){
175  double dLesser = Isis::ValidMaximum;
176  double dGreater = 0;
177 
178  if (pvlGrp.hasKeyword("LessThan")) {
179  dLesser = fabs((double)pvlGrp["LessThan"]);
180  }
181 
182  if (pvlGrp.hasKeyword("GreaterThan")) {
183  dGreater = fabs((double)pvlGrp["GreaterThan"]);
184  }
185 
186  if (dLesser < 0 || dGreater < 0 || dLesser <= dGreater) {
187  string sErrMsg = "Invalid Deffile - Check Point_PixelShift Group\n";
188  throw IException(IException::User, sErrMsg, _FILEINFO_);
189  return;
190  }
191 
192  if (pbLastFilter) {
193  mOstm << "PointID, PointType, PointIgnored, PointEditLocked, FileName, SerialNumber, PixelShift, MeasureType, MeasureIgnored, MeasureEditLocked, Reference, ";
194  mOstm << endl;
195  }
196 
197  int iNumPoints = mCNet->GetNumPoints();
198  for (int i = (iNumPoints - 1); i >= 0; i--) {
199  ControlPoint *cPoint = mCNet->GetPoint(i);
200  int iNumMeasures = cPoint->GetNumMeasures();
201  bool bFilter = true;
202  for (int j = 0; j < iNumMeasures; j++){
203  const ControlMeasure *measure = cPoint->GetMeasure(j);
204  double dPixelShift = measure->GetPixelShift();
205  if (dPixelShift <= dLesser && dPixelShift >= dGreater) {
206  bFilter = false;
207  break;
208  }
209  }
210  if (bFilter) {
211  FilterOutPoint(i);
212  continue;
213  }
214 
215  // Print into output, if it is the last Filter
216  if (pbLastFilter) {
217  for (int j = 0; j < iNumMeasures; j++) {
218  mOstm << cPoint->GetId() << ", " << sPointType[cPoint->GetType()] << ", "
219  << sBoolean[cPoint->IsIgnored()] << ", "
220  << sBoolean[cPoint->IsEditLocked()] << ", ";
221 
222  const ControlMeasure *measure = cPoint->GetMeasure(j);
223  PrintCubeFileSerialNum(*measure);
224  double dPixelShift = measure->GetPixelShift();
225  mOstm << ", " << (dPixelShift == Null ? "Null" : toString(dPixelShift)) << ", "
226  << measure->GetMeasureTypeString() << ", "
227  << sBoolean[measure->IsIgnored()] << ", "
228  << sBoolean[measure->IsEditLocked()] << ", "
229  << sBoolean[cPoint->GetRefMeasure() == measure]
230  << endl;
231  }
232  }
233  }
234 
235  // update the image stats with the changes
237  }
238 
249  void ControlNetFilter::PointNumMeasuresEditLockFilter(const PvlGroup &pvlGrp, bool pbLastFilter){
250  int iLesser = VALID_MAX2;
251  int iGreater = 0;
252 
253  if (pvlGrp.hasKeyword("LessThan")) {
254  iLesser = toInt(pvlGrp["LessThan"][0]);
255  }
256 
257  if (pvlGrp.hasKeyword("GreaterThan")) {
258  iGreater = toInt(pvlGrp["GreaterThan"][0]);
259  }
260 
261  if (iLesser < 0 || iGreater < 0 || iLesser < iGreater) {
262  string sErrMsg = "Invalid Deffile - Check Point_MeasureEditLock Group\n";
263  throw IException(IException::User, sErrMsg, _FILEINFO_);
264  return;
265  }
266 
267  if (pbLastFilter) {
269  mOstm << "FileName, SerialNumber, MeasureType, MeasureIgnored, MeasureEditLocked, Reference" << endl;
270  }
271 
272  int iNumPoints = mCNet->GetNumPoints();
273  for (int i = (iNumPoints - 1); i >= 0; i--) {
274  ControlPoint *cPoint = mCNet->GetPoint(i);
275  int iNumLockedMsr = cPoint->GetNumLockedMeasures();
276  //cerr << cPoint->GetId() << " NumMsrs=" << iNumLockedMsr << endl;
277  if (iNumLockedMsr > iLesser || iNumLockedMsr < iGreater) {
278  FilterOutPoint(i);
279  continue;
280  }
281 
282  int iNumMeasures = cPoint->GetNumMeasures();
283  if (pbLastFilter) {
284  for (int j = 0; j < iNumMeasures; j++) {
285  const ControlMeasure *cm = cPoint->GetMeasure(j);
286  PointStats(*cPoint);
288  mOstm << ", " << cm->GetMeasureTypeString() << ", "
289  << sBoolean[cm->IsIgnored()] << ", "
290  << sBoolean[cm->IsEditLocked()] << ", "
291  << sBoolean[cm == cPoint->GetRefMeasure()]
292  << endl;
293  }
294  }
295  }
296 
297  // update the image stats with the changes
299  }
300 
311  void ControlNetFilter::PointEditLockFilter(const PvlGroup &pvlGrp, bool pbLastFilter){
312  bool editLock = false;
313 
314  if (pvlGrp.hasKeyword("EditLock")) {
315  if(pvlGrp["EditLock"][0] == "1" || IString(pvlGrp["EditLock"][0]).DownCase() == "true")
316  editLock = true;
317  }
318 
319  if (pbLastFilter) {
321  mOstm << endl;
322  }
323 
324  int iNumPoints = mCNet->GetNumPoints();
325  for (int i = (iNumPoints - 1); i >= 0; i--) {
326  ControlPoint *cPoint = mCNet->GetPoint(i);
327  if (cPoint->IsEditLocked() != editLock) {
328  FilterOutPoint(i);
329  continue;
330  }
331 
332  if (pbLastFilter) {
333  int iNumMeasures = cPoint->GetNumMeasures();
334  mOstm << cPoint->GetId() << ", " << sPointType[cPoint->GetType()] << ", "
335  << sBoolean[cPoint->IsIgnored()] << ", "
336  << sBoolean[cPoint->IsEditLocked()] << ", "
337  << iNumMeasures << ", "
338  << (iNumMeasures - cPoint->GetNumValidMeasures()) << ", "
339  << cPoint->GetNumLockedMeasures() << endl;
340  }
341  }
342 
343  // update the image stats with the changes
345  }
346 
358  void ControlNetFilter::PointResMagnitudeFilter(const PvlGroup &pvlGrp, bool pbLastFilter) {
359  double dLesser = Isis::ValidMaximum;
360  double dGreater = 0;
361 
362  if (pvlGrp.hasKeyword("LessThan")) {
363  if (pvlGrp["LessThan"][0] != "") {
364  dLesser = fabs((double)pvlGrp["LessThan"]);
365  }
366  }
367 
368  if (pvlGrp.hasKeyword("GreaterThan")) {
369  if (pvlGrp["GreaterThan"][0] != "") {
370  dGreater = fabs((double)pvlGrp["GreaterThan"]);
371  }
372  }
373 
374  if (dLesser < 0 || dGreater < 0 || dLesser < dGreater) {
375  string sErrMsg = "Invalid Deffile - Check Point_ResidualMagnitude Group\n";
376  throw IException(IException::User, sErrMsg, _FILEINFO_);
377  return;
378  }
379 
380  if (pbLastFilter) {
381  mOstm << "PointID, PointType, PointIgnored, PointEditLocked, FileName, SerialNumber, ResidualMagnitude, MeasureType, MeasureIgnored, MeasureEditLocked, Reference, ";
382  mOstm << endl;
383  }
384 
385  int iNumPoints = mCNet->GetNumPoints();
386  for (int i = (iNumPoints - 1); i >= 0; i--) {
387  bool bFilter = true;
388  ControlPoint *cPoint = mCNet->GetPoint(i);
389  int iNumMeasures = cPoint->GetNumMeasures();
390  for (int j = 0; j < iNumMeasures; j++) {
391  const ControlMeasure *measure = cPoint->GetMeasure(j);
392  double dResMag = measure->GetResidualMagnitude();
393  if (dResMag <= dLesser && dResMag >= dGreater) {
394  bFilter = false;
395  break;
396  }
397  }
398 
399  if (bFilter) {
400  FilterOutPoint(i);
401  continue;
402  }
403  // Print into output, if it is the last Filter
404  else if (pbLastFilter) {
405 
406  for (int j = 0; j < iNumMeasures; j++) {
407  mOstm << cPoint->GetId() << ", " << sPointType[cPoint->GetType()] << ", "
408  << sBoolean[cPoint->IsIgnored()] << ", "
409  << sBoolean[cPoint->IsEditLocked()] << ", ";
410 
411  const ControlMeasure *measure = cPoint->GetMeasure(j);
412  PrintCubeFileSerialNum(*measure);
413  double dResMag = measure->GetResidualMagnitude();
414  mOstm << ", " << (dResMag == Null ? "Null" : IString(dResMag) ) << ", "
415  << measure->GetMeasureTypeString() << ", "
416  << sBoolean[measure->IsIgnored()] << ", "
417  << sBoolean[measure->IsEditLocked()] << ", "
418  << sBoolean[cPoint->GetRefMeasure() == measure]
419  << endl;
420  }
421  }
422  }
423 
424  // update the image stats with the changes
426  }
427 
437  void ControlNetFilter::PointIDFilter(const PvlGroup &pvlGrp, bool pbLastFilter) {
438  QString sPointIDExpr = pvlGrp["Expression"][0];
439  QString sSeparator("*");
440  QStringList strTokens = sPointIDExpr.split(sSeparator, QString::SkipEmptyParts);
441 
442  int iTokenSize = (int)strTokens.size();
443  int iNumPoints = mCNet->GetNumPoints();
444 #ifdef _DEBUG_
445  odb << "Net Size=" << iNumPoints << endl;
446 #endif
447 
448  if (pbLastFilter) {
450  mOstm << endl;
451  }
452 
453  for (int i = (iNumPoints - 1); i >= 0; i--) {
454  const ControlPoint *cPoint = mCNet->GetPoint(i);
455  QString sPointID = cPoint->GetId();
456  int iPosition = 0;
457  for (int j = (iTokenSize - 1); j >= 0; j--) {
458  int iLen = strTokens[j].length();
459  if (iLen > 0) {
460  int found = sPointID.indexOf(strTokens[j], iPosition);
461  if (found != -1) {
462  iPosition = found + iLen;
463  // End of the expression
464  if (pbLastFilter && j == (iTokenSize - 1)) {
465  // Log into the output file
466  PointStats(*cPoint);
467  mOstm << endl;
468  }
469  }
470  else {
471  FilterOutPoint(i);
472  break;
473  }
474  }
475  }
476  }
477 
478  // update the image stats with the changes
480  }
481 
491  void ControlNetFilter::PointMeasuresFilter(const PvlGroup &pvlGrp, bool pbLastFilter) {
492  int iLesser = VALID_MAX2, iGreater = 0;
493 
494  if (pvlGrp.hasKeyword("LessThan")) {
495  if (pvlGrp["LessThan"][0] != "") {
496  iLesser = toInt(pvlGrp["LessThan"][0]);
497  }
498  }
499 
500  if (pvlGrp.hasKeyword("GreaterThan")) {
501  if (pvlGrp["GreaterThan"][0] != "") {
502  iGreater = toInt(pvlGrp["GreaterThan"][0]);
503  }
504  }
505 
506  if (iLesser < 0 || iGreater < 0 || iLesser < iGreater) {
507  string sErrMsg = "Invalid Deffile - Check Point_NumMeasures Group\n";
508  throw IException(IException::User, sErrMsg, _FILEINFO_);
509  return;
510  }
511 
512  if (pbLastFilter) {
514  mOstm << "FileName, SerialNum, MeasureType, MeasureIgnore, MeasureEditLock, Reference" << endl;
515  }
516 
517  int iNumPoints = mCNet->GetNumPoints();
518 
519  for (int i = (iNumPoints - 1); i >= 0; i--) {
520  const ControlPoint *cPoint = mCNet->GetPoint(i);
521  int iNumMeasures = cPoint->GetNumMeasures();
522  if (iNumMeasures > iLesser || iNumMeasures < iGreater) {
523  FilterOutPoint(i);
524  continue;
525  }
526  if (pbLastFilter) {
527  for (int j = 0; j < iNumMeasures; j++) {
528  const ControlMeasure *cm = cPoint->GetMeasure(j);
529  PointStats(*cPoint);
531  mOstm << ", " << cm->GetMeasureTypeString() << ", "
532  << sBoolean[cm->IsIgnored()] << ", "
533  << sBoolean[cm->IsEditLocked()] << ", "
534  << sBoolean[cm == cPoint->GetRefMeasure()]
535  << endl;
536  }
537  }
538  }
539 
540  // update the image stats with the changes
542  }
543 
553  void ControlNetFilter::PointPropertiesFilter(const PvlGroup &pvlGrp, bool pbLastFilter) {
554  bool bIgnoredFlag = false;
555  int iSetIgnoreFlag = 0;
556  IString sType = "";
557  IString sTemp = "";
558 
559  if (pvlGrp.hasKeyword("PointType")) {
560  if (pvlGrp["PointType"][0] != "") {
561  sType = pvlGrp["PointType"][0];
562  sType = sType.DownCase(sType);
563  }
564  }
565 
566  if (pvlGrp.hasKeyword("Ignore")) {
567  iSetIgnoreFlag = 1;
568  sTemp = pvlGrp["Ignore"][0];
569  if (sTemp == "1" || sTemp.DownCase() == "true") {
570  bIgnoredFlag = true;
571  }
572  }
573 
574  if (pbLastFilter) {
576  mOstm << endl;
577  }
578 
579  int iNumPoints = mCNet->GetNumPoints();
580 
581  for (int i = (iNumPoints - 1); i >= 0; i--) {
582  const ControlPoint *cPoint = mCNet->GetPoint(i);
583  bool bPointFound = false;
584  bool bIgnored = cPoint->IsIgnored();
585  bool bFixed = (cPoint->GetType() == ControlPoint::Fixed ? true : false);
586  bool bConstrained = (cPoint->GetType() == ControlPoint::Constrained ? true : false);
587  bool bFree = (cPoint->GetType() == ControlPoint::Free ? true : false);
588 
589  if (!iSetIgnoreFlag || bIgnoredFlag == bIgnored) {
590  if (sType == "all" || sType=="") {
591  bPointFound = true;
592  }
593  else if (sType == "fixed" && bFixed) {
594  bPointFound = true;
595  }
596  else if (sType == "constrained" && bConstrained) {
597  bPointFound = true;
598  }
599  else if (sType == "free" && bFree) {
600  bPointFound = true;
601  }
602  }
603 
604  if(!bPointFound) {
605  FilterOutPoint(i);
606  continue;
607  }
608 
609  // Output the Point Stats
610  if (pbLastFilter) {
611  PointStats(*cPoint);
612  mOstm << endl;
613  }
614  }
615 
616  // update the image stats with the changes
618  }
619 
629  void ControlNetFilter::PointLatLonFilter(const PvlGroup &pvlGrp, bool pbLastFilter) {
630  double dMinLat = Isis::ValidMinimum, dMaxLat = Isis::ValidMaximum;
631  double dMinLon = Isis::ValidMinimum, dMaxLon = Isis::ValidMaximum;
632 
633  if (pvlGrp.hasKeyword("MinLat")) {
634  if (pvlGrp["MinLat"][0] != "") {
635  dMinLat = pvlGrp["MinLat"];
636  }
637  }
638 
639  if (pvlGrp.hasKeyword("MaxLat")) {
640  if (pvlGrp["MaxLat"][0] != "") {
641  dMaxLat = pvlGrp["MaxLat"];
642  }
643  }
644 
645  if (pvlGrp.hasKeyword("MinLon")) {
646  if (pvlGrp["MinLon"][0] != "") {
647  dMinLon = pvlGrp["MinLon"];
648  }
649  }
650 
651  if (pvlGrp.hasKeyword("MaxLon")) {
652  if (pvlGrp["MaxLon"][0] != "") {
653  dMaxLon = pvlGrp["MaxLon"];
654  }
655  }
656 
657  if (dMinLat > dMaxLat || dMinLon > dMaxLon) {
658  string sErrMsg = "Invalid Deffile - Check Point_LatLon Group\n";
659  throw IException(IException::User, sErrMsg, _FILEINFO_);
660  return;
661  }
662 
663  if (pbLastFilter) {
665  mOstm << "Latitude, Longitude, Radius" << endl;
666  }
667 
668  int iNumPoints = mCNet->GetNumPoints();
669 
670  for (int i = (iNumPoints - 1); i >= 0; i--) {
671  const ControlPoint *cPoint = mCNet->GetPoint(i);
672  SurfacePoint cPointSurfPt = cPoint->GetAdjustedSurfacePoint();
673 
674  if (!cPointSurfPt.Valid()) {
675  const ControlMeasure *cm = cPoint->GetRefMeasure();
676 
677  QString sn = cm->GetCubeSerialNumber();
678  QString filename = mSerialNumList.fileName(sn);
679  Cube cube(filename, "r");
680 
681  Camera *camera = CameraFactory::Create(cube);
682  if (camera->SetImage(cm->GetSample(), cm->GetLine())) {
683  cPointSurfPt.SetSpherical(
686  Distance(camera->LocalRadius()));
687  }
688  delete camera;
689  camera = NULL;
690  }
691  double latitude = cPointSurfPt.GetLatitude().degrees();
692  double longitude = cPointSurfPt.GetLongitude().degrees();
693 
694  if ((latitude < dMinLat || latitude > dMaxLat) ||
695  (longitude < dMinLon ||longitude > dMaxLon)) {
696  FilterOutPoint(i);
697  continue;
698  }
699 
700  if (pbLastFilter) {
701  PointStats(*cPoint);
702  mOstm << latitude << ", " << longitude << ", " <<
703  cPointSurfPt.GetLocalRadius().meters() << endl;
704  }
705  }
706 
707  // update the image stats with the changes
709  }
710 
720  void ControlNetFilter::PointDistanceFilter(const PvlGroup &pvlGrp, bool pbLastFilter) {
721  double dMaxDistance = 0;
722  QString sUnits = "pixels";
723 
724  if (pvlGrp.hasKeyword("MaxDistance")) {
725  if (pvlGrp["MaxDistance"][0] != "") {
726  dMaxDistance = pvlGrp["MaxDistance"];
727  }
728  }
729 
730  if (pvlGrp.hasKeyword("Units")) {
731  sUnits = pvlGrp["Units"][0];
732  }
733 
734  if (pbLastFilter) {
736  mOstm << "Point#Distance >>, " << endl;
737  }
738 
739  bool bMinDistance = false;
740  int iNumPoints = mCNet->GetNumPoints();
741  for (int i = (iNumPoints - 1); i >= 0; i--) {
742  const ControlPoint *cp1 = mCNet->GetPoint(i);
743  const ControlMeasure *cp1RefMeasure = cp1->GetRefMeasure();
744  SurfacePoint surfacePt1;
745  Camera *cam1;
746 
747  double dSample1 = Isis::Null, dLine1 = Isis::Null;
748 
749  if (sUnits == "meters") {
750  surfacePt1 = cp1->GetAdjustedSurfacePoint();
751 
752  if (!surfacePt1.Valid()) {
753  QString sn1 = cp1RefMeasure->GetCubeSerialNumber();
754  QString filename1 = mSerialNumList.fileName(sn1);
755  Cube cube1(filename1, "r");
756  cam1 = CameraFactory::Create(cube1);
757  if (cam1->SetImage(cp1RefMeasure->GetSample(),
758  cp1RefMeasure->GetLine())) {
759  surfacePt1.SetSpherical(
762  Distance(cam1->LocalRadius())
763  );
764  }
765  delete cam1;
766  cam1 = NULL;
767  }
768  }
769  else
770  // pixels
771  {
772  dSample1 = cp1RefMeasure->GetSample();
773  dLine1 = cp1RefMeasure->GetLine();
774  }
775 
776  for (int j = (mCNet->GetNumPoints() - 1); j >= 0; j--) {
777  if (i == j) {
778  continue;
779  }
780  const ControlPoint *cp2 = mCNet->GetPoint(j);
781  const ControlMeasure *cp2RefMeasure = cp2->GetRefMeasure();
782 
783  SurfacePoint surfacePt2;
784  Camera *cam2;
785  double dDist = 0;
786 
787  double dSample2 = Isis::Null, dLine2 = Isis::Null;
788 
789  if (sUnits == "meters") {
790  surfacePt2 = cp2->GetAdjustedSurfacePoint();
791 
792  if (!surfacePt2.Valid()) {
793  QString sn2 = cp2RefMeasure->GetCubeSerialNumber();
794  QString filename2 = mSerialNumList.fileName(sn2);
795  Cube cube2(filename2, "r");
796  cam2 = CameraFactory::Create(cube2);
797 
798  if (cam2->SetImage(cp2RefMeasure->GetSample(),
799  cp2RefMeasure->GetLine())) {
800  surfacePt2.SetSpherical(
803  Distance(cam2->LocalRadius())
804  );
805  }
806  delete cam2;
807  cam2 = NULL;
808  }
809 
810  dDist = surfacePt1.GetDistanceToPoint(surfacePt2,
811  surfacePt1.GetLocalRadius()).meters();
812  }
813  else
814  // pixels
815  {
816  dSample2 = cp2RefMeasure->GetSample();
817  dLine2 = cp2RefMeasure->GetLine();
818 
819  double dDeltaSamp = dSample1 - dSample2;
820  double dDeltaLine = dLine1 - dLine2;
821  // use the distance formula for cartesian coordinates
822  dDist = sqrt((dDeltaSamp * dDeltaSamp) + (dDeltaLine * dDeltaLine));
823  }
824 
825  if (dDist <= dMaxDistance) {
826  if (pbLastFilter) {
827  if (!bMinDistance) {
828  PointStats(*cp1);
829  }
830  mOstm << cp2->GetId() << "#" << dDist << ", ";
831  }
832  bMinDistance = true;
833  }
834  else
835  continue;
836  }
837  if (!bMinDistance) {
838  FilterOutPoint(i);
839  }
840  if (pbLastFilter && bMinDistance) {
841  mOstm << endl;
842  }
843  bMinDistance = false;
844  }
845 
846  // update the image stats with the changes
848  }
849 
863  void ControlNetFilter::PointGoodnessOfFitFilter(const PvlGroup & pvlGrp, bool pbLastFilter){
864  double dLesser=Isis::ValidMaximum, dGreater=0;
865 
866  if (pvlGrp.hasKeyword("LessThan")){
867  if (pvlGrp["LessThan"][0] != "") {
868  dLesser = fabs((double)(pvlGrp["LessThan"]));
869  }
870  }
871 
872  if (pvlGrp.hasKeyword("GreaterThan")){
873  if (pvlGrp["GreaterThan"][0] != "") {
874  dGreater = fabs((double)pvlGrp["GreaterThan"]);
875  }
876  }
877 
878  if (pbLastFilter) {
880  mOstm << "FileName, SerialNumber, GoodnessOfFit, MeasureType, MeasureIgnored, MeasureEditLocked, Reference" << endl;
881  }
882 
883  int iNumPoints = mCNet->GetNumPoints();
884  for (int i=(iNumPoints-1); i>=0; i--) {
885  ControlPoint *cPoint = mCNet->GetPoint(i);
886  int iNumMeasures = cPoint->GetNumMeasures();
887  bool bMatchFlag=false;
888 
889  for (int j=0; j<iNumMeasures; j++) {
890  const ControlMeasure *measure = cPoint->GetMeasure(j);
891  double dMsrGFit= measure->GetLogData(ControlMeasureLogData::GoodnessOfFit).GetNumericalValue();
892  if (dMsrGFit >= dGreater && dMsrGFit <= dLesser) {
893  bMatchFlag = true;
894  break;
895  }
896  }
897 
898  if (!bMatchFlag) {
899  FilterOutPoint(i);
900  }
901  else {
902  // Print into output, if it is the last Filter
903  if (pbLastFilter) {
904  int iNumMeasures = cPoint->GetNumMeasures();
905  int iNumMsIgnored = iNumMeasures - cPoint->GetNumValidMeasures();
906  for (int j = 0; j < iNumMeasures; j++) {
907  const ControlMeasure *measure = cPoint->GetMeasure(j);
908  double dMsrGFit= measure->GetLogData(ControlMeasureLogData::GoodnessOfFit).GetNumericalValue();
909 
910  mOstm << cPoint->GetId() << ", " << sPointType[cPoint->GetType()] << ", "
911  << sBoolean[cPoint->IsIgnored()] << ", " << sBoolean[cPoint->IsEditLocked()] << ", "
912  << iNumMeasures << ", " << iNumMsIgnored << ", " << cPoint->GetNumLockedMeasures() << ", ";
913  PrintCubeFileSerialNum(*measure);
914  mOstm << ", " << (dMsrGFit == Null ? "NA" : IString(dMsrGFit)) << ", "
915  << measure->GetMeasureTypeString() << ", "
916  << sBoolean[measure->IsIgnored()] << ", "
917  << sBoolean[measure->IsEditLocked()] << ", "
918  << sBoolean[cPoint->GetRefMeasure() == measure]
919  << endl;
920  }
921  }
922  }
923  }
924 
925  // update the image stats with the changes
927  }
937  void ControlNetFilter::PointMeasurePropertiesFilter(const PvlGroup &pvlGrp, bool pbLastFilter) {
938  int iIgnoredFlag = -1;
939  string sType = "";
940  IString isType;
941 
942  if (pvlGrp.hasKeyword("Ignore")) {
943  iIgnoredFlag = 0;
944  if (IString(pvlGrp["Ignore"][0]).DownCase() == "true")
945  iIgnoredFlag = 1;
946  }
947 
948  if (pvlGrp.hasKeyword("MeasureType")) {
949  sType = IString(pvlGrp["MeasureType"][0]).DownCase();
950  }
951 
952  if (pbLastFilter) {
954  mOstm << "FileName, SerialNumber, MeasureIgnored, MeasureType, MeasureEditLocked, Reference," << endl;
955  }
956 
957  int iNumPoints = mCNet->GetNumPoints();
958  for (int i = (iNumPoints - 1); i >= 0; i--) {
959  const ControlPoint *cPoint = mCNet->GetPoint(i);
960 
961  int iNumMeasures = cPoint->GetNumMeasures();
962  int iNotMeasureType = 0;
963  for (int j = 0; j < iNumMeasures; j++) {
964  const ControlMeasure *cMeasure = cPoint->GetMeasure(j);
965  bool bMeasureIgnored = cMeasure->IsIgnored();
966  bool bMeasureFound = false;
967 
968  if (iIgnoredFlag == -1 || bMeasureIgnored == iIgnoredFlag) {
969  if (sType == "all" || sType == "") {
970  bMeasureFound = true;
971  }
972  else if (sType == "candidate" && cMeasure->GetType() == ControlMeasure::Candidate) {
973  bMeasureFound = true;
974  }
975  else if (sType == "manual" && cMeasure->GetType() == ControlMeasure::Manual) {
976  bMeasureFound = true;
977  }
978  else if (sType == "registeredpixel" && cMeasure->GetType() == ControlMeasure::RegisteredPixel) {
979  bMeasureFound = true;
980  }
981  else if (sType == "registeredsubpixel" && cMeasure->GetType() == ControlMeasure::RegisteredSubPixel) {
982  bMeasureFound = true;
983  }
984  }
985  if (bMeasureFound) {
986  if (pbLastFilter) {
987  PointStats(*cPoint);
988  QString sn = cMeasure->GetCubeSerialNumber();
989  mOstm << mSerialNumList.fileName(sn) << ", " << sn << ","
990  << sBoolean[(int) cMeasure->IsIgnored()] << ", "
991  << cMeasure->GetMeasureTypeString() << ", "
992  << sBoolean[cMeasure->IsEditLocked()] << ", "
993  << sBoolean[cPoint->GetRefMeasure() == cMeasure]
994  << endl;
995  }
996  }
997  else
998  iNotMeasureType++;
999  }
1000  //cerr << cPoint->GetId() << " NumMeasures=" << iNumMeasures << " NotFound=" << iNotMeasureType << endl;
1001  if (iNotMeasureType == iNumMeasures) {
1002  FilterOutPoint(i);
1003  continue;
1004  }
1005  }
1006 
1007  // update the image stats with the changes
1009  }
1010 
1019  void ControlNetFilter::PointCubeNamesFilter(const PvlGroup &pvlGrp, bool pbLastFilter) {
1020  QVector<QString> sCubeNames;
1021 
1022  // Store the Cubenames from the PvlGroup
1023  for (int i = 0; i < pvlGrp.keywords(); i++) {
1024  sCubeNames.push_back(pvlGrp[i][0]);
1025  }
1026 
1027  int size = sCubeNames.size();
1028 
1029  if (pbLastFilter) {
1030  PointStatsHeader();
1031  CubeStatsHeader();
1032  mOstm << "ImageMeasureIgnored, ImageMeasureEditLocked, ";
1033  mOstm << endl;
1034  }
1035 
1036  int iNumPoints = mCNet->GetNumPoints();
1037  for (int i = (iNumPoints - 1); i >= 0; i--) {
1038  const ControlPoint *cPoint = mCNet->GetPoint(i);
1039  int iNumMeasures = cPoint->GetNumMeasures();
1040  int iNumNoMatch = 0;
1041  bool bMatch = false;
1042  for (int j = 0; j < iNumMeasures; j++) {
1043  const ControlMeasure *cMeasure = cPoint->GetMeasure(j);
1044  for (int k = 0; k < size; k++) {
1045  if (cMeasure->GetCubeSerialNumber() == sCubeNames[k]) {
1046  bMatch = true;
1047  break;
1048  }
1049  }
1050  if (!bMatch) {
1051  iNumNoMatch++;
1052  }
1053  }
1054  if (iNumNoMatch == iNumMeasures) {
1055  FilterOutPoint(i);
1056  }
1057  } //end point loop
1058 
1059  // update the image stats with the changes
1061 
1062  // If Last filter print to the output file in the required format
1063  if (pbLastFilter) {
1064  iNumPoints = mCNet->GetNumPoints();
1065  for (int i = 0; i < iNumPoints; i++) {
1066  const ControlPoint *cPoint = mCNet->GetPoint(i);
1067  int iNumMeasures = cPoint->GetNumMeasures();
1068  for (int j = 0; j < iNumMeasures; j++) {
1069  const ControlMeasure *cMeasure = cPoint->GetMeasure(j);
1070 
1071  // Point Details
1072  mOstm << cPoint->GetId() << ", " << sPointType[cPoint->GetType()] << ", "
1073  << sBoolean[cPoint->IsIgnored()] << ", "
1074  << sBoolean[cPoint->IsEditLocked()] << ", "
1075  << iNumMeasures << ", "
1076  << iNumMeasures - cPoint->GetNumValidMeasures() << ", "
1077  << cPoint->GetNumLockedMeasures() << ", ";
1078 
1079  // Image Details
1080  QString sn = cMeasure->GetCubeSerialNumber();
1082  mOstm << mSerialNumList.fileName(sn) << ", " << sn << ", "
1083  << imgStats[imgTotalPoints] << ", " << imgStats[imgIgnoredPoints] << ", "
1084  << imgStats[imgLockedPoints] << ", " << imgStats[imgFixedPoints] << ", "
1085  << imgStats[imgConstrainedPoints] << ", " << imgStats[imgFreePoints] << ", "
1086  << imgStats[imgConvexHullRatio] << ", "
1087  << sBoolean[cMeasure->IsIgnored()] << ", " << sBoolean[cMeasure->IsEditLocked()] << endl;
1088  }
1089  }
1090  }
1091  }
1092 
1107  void ControlNetFilter::CubeConvexHullFilter(const PvlGroup &pvlGrp, bool pbLastFilter){
1108  double dLesser = Isis::ValidMaximum;
1109  double dGreater = 0;
1110 
1111  if (pvlGrp.hasKeyword("LessThan")) {
1112  if (pvlGrp["LessThan"][0] != "") {
1113  dLesser = fabs((double)pvlGrp["LessThan"]);
1114  }
1115  }
1116 
1117  if (pvlGrp.hasKeyword("GreaterThan")) {
1118  if (pvlGrp["GreaterThan"][0] != "") {
1119  dGreater = fabs((double)pvlGrp["GreaterThan"]);
1120  }
1121  }
1122 
1123  if (dLesser < 0 || dGreater < 0 || dLesser <= dGreater) {
1124  string sErrMsg = "Invalid Deffile - Check Cube_ConvexHullRatio Group\n";
1125  throw IException(IException::User, sErrMsg, _FILEINFO_);
1126  return;
1127  }
1128 
1129  if (pbLastFilter) {
1130  CubeStatsHeader();
1131  mOstm << endl;
1132  }
1133 
1134  int iNumCubes = mSerialNumFilter.size();
1135 
1136  for (int sn = (iNumCubes - 1); sn >= 0; sn--) {
1137  QString sSerialNum = mSerialNumFilter.serialNumber(sn);
1138  QVector<double> imgStats = GetImageStatsBySerialNum(sSerialNum);
1139  double convexHullRatio = imgStats[imgConvexHullRatio];
1140  if (convexHullRatio < dGreater || convexHullRatio > dLesser){
1141  FilterOutMeasuresBySerialNum(sSerialNum);
1142  mSerialNumFilter.remove(sSerialNum);
1143  }
1144  else if (pbLastFilter) {
1145  mOstm << mSerialNumFilter.fileName(sSerialNum) << ", " << sSerialNum << ", "
1146  << imgStats[imgTotalPoints] << ", " << imgStats[imgIgnoredPoints] << ", " << imgStats[imgLockedPoints] << ", "
1147  << imgStats[imgFixedPoints] << ", " << imgStats[imgConstrainedPoints] << ", " << imgStats[imgFreePoints] << ", "
1148  << imgStats[imgConvexHullRatio]<< endl;
1149  }
1150  }
1151 
1152  // update the image stats with the changes
1154  }
1155 
1165  void ControlNetFilter::CubeNameExpressionFilter(const PvlGroup &pvlGrp, bool pbLastFilter) {
1166  QString sCubeExpr("");
1167  if (pvlGrp.hasKeyword("Expression")) {
1168  sCubeExpr = QString(pvlGrp["Expression"][0]);
1169  }
1170 
1171  QString sSeparator("*");
1172  QStringList strTokens = sCubeExpr.split(sSeparator, QString::SkipEmptyParts);
1173 
1174  int iTokenSize = (int)strTokens.size();
1175  int iNumCubes = mSerialNumFilter.size();
1176 
1177  if (pbLastFilter) {
1178  CubeStatsHeader();
1179  mOstm << endl;
1180  }
1181 
1182  for (int i = (iNumCubes - 1); i >= 0; i--) {
1183  QString sCubeName = mSerialNumFilter.fileName(i);
1184  QString sSerialNum = mSerialNumFilter.serialNumber(i);
1185  int iPosition = 0;
1186  for (int j = (iTokenSize - 1); j >= 0; j--) {
1187  int iLen = strTokens[j].length();
1188  if (iLen > 0) {
1189  int found = sSerialNum.indexOf(strTokens[j], iPosition);
1190  if (found != -1) {
1191  iPosition = found + iLen;
1192  // End of the expression - Found
1193  if (j == (iTokenSize - 1)) {
1194  break;
1195  }
1196  }
1197  else {
1198  FilterOutMeasuresBySerialNum(sSerialNum);
1199  mSerialNumFilter.remove(sSerialNum);
1200  break;
1201  }
1202  }
1203  }
1204  }
1205 
1206  // update the image stats with the changes
1208 
1209  if (pbLastFilter) {
1210  iNumCubes = mSerialNumFilter.size();
1211  for (int i = 0; i < iNumCubes; i++) {
1212  QString sSerialNum = mSerialNumFilter.serialNumber(i);
1213 
1214  mOstm << mSerialNumFilter.fileName(i) << ", " << sSerialNum << ", ";
1215  QVector<double> imgStats = GetImageStatsBySerialNum(sSerialNum);
1216  mOstm << mSerialNumFilter.fileName(sSerialNum) << ", " << sSerialNum << ", "
1217  << imgStats[imgTotalPoints] << ", " << imgStats[imgIgnoredPoints] << ", " << imgStats[imgLockedPoints] << ", "
1218  << imgStats[imgFixedPoints] << ", " << imgStats[imgConstrainedPoints] << ", " << imgStats[imgFreePoints] << ", "
1219  << imgStats[imgConvexHullRatio]<< endl;
1220  }
1221  }
1222  }
1223 
1233  void ControlNetFilter::CubeNumPointsFilter(const PvlGroup &pvlGrp, bool pbLastFilter) {
1234  int iLessPoints = VALID_MAX2, iGreaterPoints = 0;
1235  if (pvlGrp.hasKeyword("LessThan")) {
1236  if (pvlGrp["LessThan"][0] != "") {
1237  iLessPoints = toInt(pvlGrp["LessThan"][0]);
1238  }
1239  }
1240  if (pvlGrp.hasKeyword("GreaterThan")) {
1241  if (pvlGrp["GreaterThan"][0] != "") {
1242  iGreaterPoints = toInt(pvlGrp["GreaterThan"][0]);
1243  }
1244  }
1245 
1246  if (iLessPoints < 0 || iGreaterPoints < 0 || iLessPoints < iGreaterPoints) {
1247  QString sErrMsg = "Invalid Deffile - Check Cube_NumPoints Group\n";
1248  throw IException(IException::User, sErrMsg, _FILEINFO_);
1249  }
1250 
1251  if (pbLastFilter) {
1252  CubeStatsHeader();
1253  mOstm << endl;
1254  }
1255 
1256  int iNumCubes = mSerialNumFilter.size();
1257 
1258  for (int sn = (iNumCubes - 1); sn >= 0; sn--) {
1259  QString sSerialNum = mSerialNumFilter.serialNumber(sn);
1260  QVector<double> imgStats = GetImageStatsBySerialNum(sSerialNum);
1261  double numPoints = imgStats[imgTotalPoints];
1262  if (numPoints < iGreaterPoints || numPoints > iLessPoints){
1263  FilterOutMeasuresBySerialNum(sSerialNum);
1264  mSerialNumFilter.remove(sSerialNum);
1265  }
1266  else if (pbLastFilter) {
1267  mOstm << mSerialNumFilter.fileName(sSerialNum) << ", " << sSerialNum << ", "
1268  << imgStats[imgTotalPoints] << ", " << imgStats[imgIgnoredPoints] << ", " << imgStats[imgLockedPoints] << ", "
1269  << imgStats[imgFixedPoints] << ", " << imgStats[imgConstrainedPoints] << ", " << imgStats[imgFreePoints] << ", "
1270  << imgStats[imgConvexHullRatio] << endl;
1271  }
1272  }
1273 
1274  // update the image stats with the changes
1276  }
1277 
1287  void ControlNetFilter::CubeDistanceFilter(const PvlGroup &pvlGrp, bool pbLastFilter) {
1288  double dDistance = 0;
1289  QString sUnits = "pixels";
1290 
1291  if (pvlGrp.hasKeyword("MaxDistance")) {
1292  if (pvlGrp["MaxDistance"][0] != "") {
1293  dDistance = pvlGrp["MaxDistance"];
1294  }
1295  }
1296 
1297  if (pvlGrp.hasKeyword("Units")) {
1298  sUnits = pvlGrp["Units"][0];
1299  }
1300 
1301  if (dDistance <= 0) {
1302  string sErrMsg = "Invalid Deffile - Check Cube_Distance Group\n";
1303  throw IException(IException::User, sErrMsg, _FILEINFO_);
1304  return;
1305  }
1306 
1307  if (pbLastFilter) {
1308  CubeStatsHeader();
1309  mOstm << "Distance_PointIDs >>, " << endl;
1310  }
1311 
1312  int iNumCubes = mSerialNumFilter.size();
1313  for (int sn = (iNumCubes - 1); sn >= 0; sn--) {
1314  QString sSerialNum = mSerialNumFilter.serialNumber(sn);
1315  Cube cube(mSerialNumList.fileName(sSerialNum), "r");
1316  Camera *cam = CameraFactory::Create(cube);
1317  double dDist = 0;
1318  bool bMatchDistance = false;
1319 
1320  QVector<int> sPointIndex1;
1321  QVector<int> sPointIndex2;
1322  QVector<double> dPointDistance;
1323 
1324  // Point stats
1325  int iPointsTotal = 0;
1326  int iPointsIgnored = 0;
1327  int iPointsFixed = 0;
1328  int iPointsConstrained = 0;
1329  int iPointsFree = 0;
1330  int iPointsLocked = 0;
1331 
1332  // Reset the vectors
1333  sPointIndex1.clear();
1334  sPointIndex2.clear();
1335  dPointDistance.clear();
1336 
1337  int iNumPoints = mCNet->GetNumPoints();
1338  for (int i = 0; i < iNumPoints; i++) {
1339  const ControlPoint *cPoint1 = mCNet->GetPoint(i);
1340  const ControlMeasure *cMeasure1;
1341  bool bImageFound = false;
1342  int iNumMeasures1 = cPoint1->GetNumMeasures();
1343  for (int j = 0; j < iNumMeasures1; j++) {
1344  cMeasure1 = cPoint1->GetMeasure(j);
1345  if (cMeasure1->GetCubeSerialNumber() == sSerialNum) {
1346  iPointsTotal++;
1347  if (cPoint1->IsIgnored()) {
1348  iPointsIgnored++;
1349  }
1350  if (cPoint1->GetType() == ControlPoint::Fixed) {
1351  iPointsFixed++;
1352  }
1353  if (cPoint1->GetType() == ControlPoint::Constrained) {
1354  iPointsConstrained++;
1355  }
1356  if (cPoint1->GetType() == ControlPoint::Free) {
1357  iPointsFree++;
1358  }
1359  if (cPoint1->IsEditLocked()) {
1360  iPointsLocked++;
1361  }
1362  bImageFound = true;
1363  break;
1364  }
1365  }
1366  if (!bImageFound) {
1367  continue;
1368  }
1369 
1370  //if(cMeasure1.Sample()==0 && cMeasure1.Line()==0) continue;
1371 
1372  // if the user chooses distance in meters, create camera to find lat/lon for this measure
1373  double dRadius = 0, dLat1 = 0, dLon1 = 0;
1374  if (sUnits == "meters") {
1375  // try to set image using sample/line values
1376  if (cam->SetImage(cMeasure1->GetSample(), cMeasure1->GetLine())) {
1377  dRadius = cam->LocalRadius().meters();
1378  dLat1 = cam->UniversalLatitude();
1379  dLon1 = cam->UniversalLongitude();
1380  }
1381  else
1382  continue;
1383  }
1384 
1385  for (int k = (i + 1); k < iNumPoints; k++) {
1386  const ControlPoint *cPoint2 = mCNet->GetPoint(k);
1387  int iNumMeasures2 = cPoint2->GetNumMeasures();
1388  const ControlMeasure *cMeasure2;
1389  bool bImageFound2 = false;
1390 
1391  for (int j = 0; j < iNumMeasures2; j++) {
1392  if (cPoint2->GetMeasure(j)->GetCubeSerialNumber() == sSerialNum) {
1393  cMeasure2 = cPoint2->GetMeasure(j);
1394  bImageFound2 = true;
1395  break;
1396  }
1397  }
1398  if (!bImageFound2 ||
1399  (cMeasure2->GetSample() == 0 && cMeasure2->GetLine() == 0))
1400  continue;
1401 
1402  if (sUnits == "pixels") {
1403  double dDeltaSamp = cMeasure1->GetSample() - cMeasure2->GetSample();
1404  double dDeltaLine = cMeasure1->GetLine() - cMeasure2->GetLine();
1405  // use the distance formula for cartesian coordinates
1406  dDist = sqrt((dDeltaSamp * dDeltaSamp) + (dDeltaLine * dDeltaLine));
1407  }
1408  else
1409  // calculate distance in meters
1410  {
1411  double dLat2 = 0, dLon2 = 0;
1412  if (cam->SetImage(cMeasure2->GetSample(), cMeasure2->GetLine())) {
1413  dLat2 = cam->UniversalLatitude();
1414  dLon2 = cam->UniversalLongitude();
1415  }
1416  else
1417  continue;
1418 
1419  // Calculate the distance between the two points
1420  Latitude lat1(dLat1, Angle::Degrees);
1421  Longitude lon1(dLon1, Angle::Degrees);
1422  Latitude lat2(dLat2, Angle::Degrees);
1423  Longitude lon2(dLon2, Angle::Degrees);
1424  Distance radius(dRadius, Distance::Meters);
1425 
1426  SurfacePoint point1(lat1, lon1, radius);
1427  SurfacePoint point2(lat2, lon2, radius);
1428 
1429  dDist = point1.GetDistanceToPoint(point1, radius).meters();
1430  }
1431  if (!dDist || dDist >= dDistance) {
1432  continue;
1433  }
1434  else {
1435  bMatchDistance = true;
1436  sPointIndex1.push_back(i);
1437  sPointIndex2.push_back(k);
1438  dPointDistance.push_back(dDist);
1439  //break;
1440  }
1441  }// end Loop Point2
1442  //if (bMatchDistance) {
1443  // break;
1444  //}
1445  } //end Loop Point1
1446  if (!bMatchDistance) {
1447  FilterOutMeasuresBySerialNum(sSerialNum);
1448  mSerialNumFilter.remove(sSerialNum);
1449  }
1450  else if (pbLastFilter) {
1451  QVector<double> imgStats = GetImageStatsBySerialNum((sSerialNum));
1452  mOstm << mSerialNumList.fileName(sSerialNum) << ", " << sSerialNum << ", "
1453  << iPointsTotal << ", " << iPointsIgnored << ", " << iPointsLocked << ", "
1454  << iPointsFixed << ", " << iPointsConstrained << ", " << iPointsFree << ", "
1455  << imgStats[ imgConvexHullRatio] << ", ";
1456  for (int j = 0; j < (int)sPointIndex1.size(); j++) {
1457  QString sPointIDDist = toString(dPointDistance[j]);
1458  sPointIDDist += "#";
1459  sPointIDDist += (*mCNet)[sPointIndex1[j]]->GetId();
1460  sPointIDDist += "#";
1461  sPointIDDist += (*mCNet)[sPointIndex2[j]]->GetId();
1462 
1463  mOstm << sPointIDDist << ",";
1464  }
1465  mOstm << endl;
1466  }
1467  delete(cam);
1468  } // end cube loop
1469 
1470  // update the image stats with the changes
1472  }
1473 }
This class defines a body-fixed surface point.
Definition: SurfacePoint.h:148
std::ofstream mOstm
output stream for printing to output file
int keywords() const
Returns the number of keywords contained in the PvlContainer.
Definition: PvlContainer.h:100
double meters() const
Get the distance in meters.
Definition: Distance.cpp:97
void CubeNumPointsFilter(const PvlGroup &pvlGrp, bool pbLastFilter)
Filter Cubes by number of points in the cube.
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
void GenerateImageStats()
Generate stats like Total, Ignored, Fixed Points in an Image.
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:110
void SetSpherical(const Latitude &lat, const Longitude &lon, const Distance &radius, const Angle &latSigma=Angle(), const Angle &lonSigma=Angle(), const Distance &radiusSigma=Distance())
Set surface point and covariance matrix in planetocentric coordinates and convert to rectangular (Lat...
void PointStatsHeader(void)
Standard Point stats Header.
(e.g., autoseed, interest) AKA predicted, unmeasured, unverified
A Constrained point is a Control Point whose lat/lon/radius is somewhat established and should not be...
Definition: ControlPoint.h:391
const double ValidMinimum
The minimum valid double value for Isis pixels.
Definition: SpecialPixel.h:102
A Fixed point is a Control Point whose lat/lon is well established and should not be changed...
Definition: ControlPoint.h:386
File name manipulation and expansion.
Definition: FileName.h:116
void CubeDistanceFilter(const PvlGroup &pvlGrp, bool pbLastFilter)
Filter Cubes by Distance between points in a Cube.
double UniversalLatitude() const
Returns the planetocentric latitude, in degrees, at the surface intersection point in the body fixed ...
Definition: Sensor.cpp:225
void SetOutputFile(QString psPrintFile)
Set the output print file.
void PointPropertiesFilter(const PvlGroup &pvlGrp, bool pbLastFilter)
Filter Points by properties.
ControlNet * mCNet
Control Network.
Distance GetDistanceToPoint(const SurfacePoint &other) const
Computes and returns the distance between two surface points.
const ControlMeasure * GetMeasure(QString serialNumber) const
Get a control measure based on its cube&#39;s serial number.
void CubeStatsHeader(void)
Print the standard cube stats Header.
QString serialNumber(const QString &filename)
Return a serial number given a filename.
void PointGoodnessOfFitFilter(const PvlGroup &pvlGrp, bool pbLastFilter)
Filter Points by GoodnessOfFit.
double GetResidualMagnitude() const
Return Residual magnitude.
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition: IString.cpp:108
Namespace for the standard library.
void PointLatLonFilter(const PvlGroup &pvlGrp, bool pbLastFilter)
Filter Points by Lat Lon Range.
QString sPointType[]
String names for Point Type.
This class is designed to encapsulate the concept of a Latitude.
Definition: Latitude.h:63
void FilterOutMeasuresBySerialNum(QString serialNum)
Delete the network for an Image given Serial Number for all the Points in the network.If the Measure is locked, then it is unlocked in preparation for deleting.
void PointNumMeasuresEditLockFilter(const PvlGroup &pvlGrp, bool pbLastFilter)
Filter Points by Measure Edit Lock number.
void PointPixelShiftFilter(const PvlGroup &pvlGrp, bool pbLastFilter)
Filter Points by Pixel Shift.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
Registered to whole pixel (e.g.,pointreg)
QVector< double > GetImageStatsBySerialNum(QString psSerialNum) const
Returns the Image Stats by Serial Number.
Registered to sub-pixel (e.g., pointreg)
Status SetEditLock(bool editLock)
Set the EditLock state.
int GetNumValidMeasures() const
Distance measurement, usually in meters.
Definition: Distance.h:47
Latitude GetLatitude() const
Return the body-fixed latitude for the surface point.
double degrees() const
Get the angle in units of Degrees.
Definition: Angle.h:249
A Free point is a Control Point that identifies common measurements between two or more cubes...
Definition: ControlPoint.h:399
QString GetMeasureTypeString() const
Obtain a string representation of the MeasureType.
QString fileName(const QString &sn)
Return a filename given a serial number.
Distance LocalRadius() const
Returns the local radius at the intersection point.
Definition: Sensor.cpp:282
bool SetImage(const double sample, const double line)
Sets the sample/line values of the image to get the lat/lon values.
Definition: Camera.cpp:170
int GetNumPoints() const
Return the number of control points in the network.
This class is designed to encapsulate the concept of a Longitude.
Definition: Longitude.h:52
void FilterOutPoint(int pindex)
Check the filtered point to be editlocked before removing from the current control network...
Program progress reporter.
Definition: Progress.h:58
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
Definition: Angle.h:73
a control network
Definition: ControlNet.h:271
Hand Measured (e.g., qnet)
int GetNumLockedMeasures() const
Returns the number of locked control measures.
QString GetId() const
Return the Id of the control point.
void PointIDFilter(const PvlGroup &pvlGrp, bool pbLastFilter)
Filter Points by Point ID Expression.
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
A type of error that could only have occurred due to a mistake on the user&#39;s part (e...
Definition: IException.h:142
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:212
void PointEditLockFilter(const PvlGroup &pvlGrp, bool pbLastFilter)
Filter Points by Edit Lock.
int DeletePoint(ControlPoint *point)
Delete a ControlPoint from the network by the point&#39;s address.
Definition: ControlNet.cpp:871
A single control point.
Definition: ControlPoint.h:369
SerialNumberList mSerialNumList
Serial Number List.
static Camera * Create(Cube &cube)
Creates a Camera object using Pvl Specifications.
QString sBoolean[]
String values for Boolean.
void remove(const QString &sn)
Remove the specified serial number from the list.
double UniversalLongitude() const
Returns the positive east, 0-360 domain longitude, in degrees, at the surface intersection point in t...
Definition: Sensor.cpp:248
SerialNumberList mSerialNumFilter
Serial Number List file.
int size() const
How many serial number / filename combos are in the list.
void PointStats(const ControlPoint &pcPoint)
Standard Point Stats.
const ControlMeasure * GetRefMeasure() const
Get the reference control measure.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
IString DownCase()
Converts all upper case letters in the object IString into lower case characters. ...
Definition: IString.cpp:659
GoodnessOfFit is pointreg information for reference measures.
Longitude GetLongitude() const
Return the body-fixed longitude for the surface point.
const double ValidMaximum
The maximum valid double value for Isis pixels.
Definition: SpecialPixel.h:137
QList< ControlMeasure *> GetMeasuresInCube(QString serialNumber)
Get all the measures pertaining to a given cube serial number.
void CubeNameExpressionFilter(const PvlGroup &pvlGrp, bool pbLastFilter)
Filter Cubes by Cube name expression.
Isis exception class.
Definition: IException.h:107
void PrintCubeFileSerialNum(const ControlMeasure &pcMeasure)
Print Cube&#39;s File and Serial Number into the Output File.
Adds specific functionality to C++ strings.
Definition: IString.h:181
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
bool IsEditLocked() const
Return value for p_editLock or implicit lock on reference measure.
a control measurement
The distance is being specified in meters.
Definition: Distance.h:56
void CubeConvexHullFilter(const PvlGroup &pvlGrp, bool pbLastFilter)
Filter Cubes by its ConvexHull Ratio.
double GetNumericalValue() const
Get the value associated with this log data.
void PointResMagnitudeFilter(const PvlGroup &pvlGrp, bool pbLastFilter)
Filter Points by Residual Magnitude.
void PointCubeNamesFilter(const PvlGroup &pvlGrp, bool pbLastFilter)
Filter Points by Cube names.
~ControlNetFilter()
Destructor.
PointType GetType() const
void PointMeasurePropertiesFilter(const PvlGroup &pvlGrp, bool pbLastFilter)
Filter Points by Measure properties.
Serial Number list generator.
Distance GetLocalRadius() const
Return the radius of the surface point.
void PointDistanceFilter(const PvlGroup &pvlGrp, bool pbLastFilter)
Filter Points by distance between points.
QString GetCubeSerialNumber() const
Return the serial number of the cube containing the coordinate.
Control Network Stats.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
void PointMeasuresFilter(const PvlGroup &pvlGrp, bool pbLastFilter)
Filter Points by Number of measures.
IO Handler for Isis Cubes.
Definition: Cube.h:170