Unverified Commit da0d3267 authored by AgoinsUSGS's avatar AgoinsUSGS Committed by GitHub
Browse files

Merge pull request #318 from jessemapel/ipceCnetHealth

Merged IPCE into ipceCnetHealth
parents 7a8b0b8f 7e806bd8
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -311,7 +311,6 @@ void IsisMain() {
        measFlag[j] = true;  //test passed
    }


    //for now it is necessary to set measures to ignor before testing to see if they would split the network
      //this will change when the expected ControlNet::isCriticalMeasure(...) method is written
    for (int j=0; j<measGroup.size(); j++) {
@@ -319,8 +318,12 @@ void IsisMain() {
    }

    //if the number of islands has increased the network has split
    if (net.GetSerialConnections().size() > numInitialIslands) islandFlag = false; //test failed
    else islandFlag = true; //test passed
    if (net.GetSerialConnections().size() > numInitialIslands) {
      islandFlag = false; //test failed
    }
    else {
      islandFlag = true; //test passed
    }

    //again we will temporarily be setting the measure back to unignored
      //this will change when the expected ControlNet::isCriticalMeasure(...) method is written
@@ -376,7 +379,6 @@ void IsisMain() {
  fclose(guiltyFile);
  fclose(ignoredReport);


  //save out the winnowed ControlNet
  net.Write(ui.GetFileName("ONET"));
}
+4 −3
Original line number Diff line number Diff line
@@ -1675,7 +1675,8 @@ namespace Isis {
      SparseBlockColumnMatrix *normalsColumn = m_sparseNormals[columnIndex];

      if ( !normalsColumn ) {
        QString status = "\nSparseBlockColumnMatrix retrieval failure at column " + columnIndex;
        QString status = "\nSparseBlockColumnMatrix retrieval failure at column " + 
                         QString::number(columnIndex);
        outputBundleStatus(status);
        return false;
      }
@@ -1700,9 +1701,9 @@ namespace Isis {
          status.append(", row ");
          status.append(rowIndex);
          outputBundleStatus(status);
          status = "Total # of block columns: " + numBlockcolumns;
          status = "Total # of block columns: " + QString::number(numBlockcolumns);
          outputBundleStatus(status);
          status = "Total # of blocks: " + m_sparseNormals.numberOfBlocks();
          status = "Total # of blocks: " + QString::number(m_sparseNormals.numberOfBlocks());
          outputBundleStatus(status);
          return false;
        }
+35 −11
Original line number Diff line number Diff line
@@ -422,10 +422,16 @@ namespace Isis {
            // If the edge doesn't already exist, this adds and returns the edge.
            // If the edge already exists, this just returns it. (The use of a set
            // forces the edges to be unique.)
            ImageConnection connection = boost::add_edge(m_vertexMap[serial],
            ImageConnection connection;
            bool edgeAdded;
            boost::tie(connection, edgeAdded) = boost::add_edge(m_vertexMap[serial],
                                                       m_vertexMap[sn],
                                                         m_controlGraph).first;
                                                       m_controlGraph);
            m_controlGraph[connection].strength++;

            if (edgeAdded) {
              emit networkModified(GraphModified);
            }
          }
        }
      }
@@ -486,8 +492,18 @@ namespace Isis {
          }
        }

        std::pair<ImageConnection, bool> result = boost::edge(m_vertexMap[imageSerial],
                                                              m_vertexMap[adjacentSerial],
                                                              m_controlGraph);
        QString edgeStrength = "UNKNOWN";
        if (result.second) {
          edgeStrength = toString(m_controlGraph[result.first].strength);
        }

        graphString.append(imageSerial);
        graphString.append(" ----[");
        graphString.append(" ----(");
        graphString.append(edgeStrength);
        graphString.append(") [");
        graphString.append(commonPoints.join(","));
        graphString.append("]---- ");
        graphString.append(adjacentSerial);
@@ -612,10 +628,16 @@ namespace Isis {
        // If the edge doesn't already exist, this adds and returns the edge.
        // If the edge already exists, this just returns it. (The use of a set
        // forces the edges to be unique.)
        ImageConnection connection = boost::add_edge(m_vertexMap[sourceSerial],
        ImageConnection connection;
        bool edgeAdded;
        boost::tie(connection, edgeAdded) = boost::add_edge(m_vertexMap[sourceSerial],
                                                   m_vertexMap[targetSerial],
                                                   m_controlGraph).first;
                                                   m_controlGraph);
        m_controlGraph[connection].strength++;

        if (edgeAdded) {
          emit networkModified(GraphModified);
        }
      }
    }
  }
@@ -655,8 +677,9 @@ namespace Isis {

    // Make sure there is a node for every measure in this measure's parent
    for (int i = 0; i < point->GetNumMeasures(); i++) {
      QString sn = point->GetMeasure(i)->GetCubeSerialNumber();
      if (!m_vertexMap.contains(sn)) {
      ControlMeasure *adjacentMeasure = point->GetMeasure(i);
      QString sn = adjacentMeasure->GetCubeSerialNumber();
      if (!adjacentMeasure->IsIgnored() && !m_vertexMap.contains(sn)) {
        QString msg = "Node does not exist for [";
        msg += measure->GetCubeSerialNumber() + "]";
        throw IException(IException::Programmer, msg, _FILEINFO_);
@@ -780,6 +803,7 @@ namespace Isis {
            boost::remove_edge(m_vertexMap[sourceSerial],
                               m_vertexMap[targetSerial],
                               m_controlGraph);
            emit networkModified(GraphModified);
          }
        }
      }
@@ -818,10 +842,10 @@ namespace Isis {
    // Decrement the edge strength for edges from this node
    // Remove edge if the strength becomes 0.
    for (int i = 0; i < point->GetNumMeasures(); i++) {
      QString sn = point->GetMeasure(i)->GetCubeSerialNumber();
      if (m_vertexMap.contains(sn)) {
      ControlMeasure *adjacentMeasure = point->GetMeasure(i);
      QString sn = adjacentMeasure->GetCubeSerialNumber();
      if (!adjacentMeasure->IsIgnored() && m_vertexMap.contains(sn)) {
        if (QString::compare(serial, sn) !=0) {
//          std::cout << point->GetId() << ":" << serial << " --- " << sn << std::endl;

          // We need to check if the edge still exists.
          // boost doesn't add separate edges for A -> B and B -> A like the old graph.
+4 −1
Original line number Diff line number Diff line
@@ -250,6 +250,8 @@ namespace Isis {
   *                           the p_cameraValidMeasuresMap.
   *   @history 2018-06-25 Jesse Mapel - Fixed the incorrect signal being called when adding and
   *                           removing measures. References #5435.
   *   @history 2018-06-25 Jesse Mapel - Fixed ignoring measures with ignored adjacent measures
   *                           incorrectly modifying the edge between the two image vertices.
   */
  class ControlNet : public QObject {
      Q_OBJECT
@@ -425,7 +427,8 @@ namespace Isis {
      };

      struct Connection {
        int strength = 0;
        int strength;
        Connection() : strength(0) {}
      };

      typedef boost::adjacency_list<boost::setS,
+20 −20
Original line number Diff line number Diff line
@@ -3,43 +3,43 @@ UnitTest for ControlNet ....
******* test cube connection graph ************
testing ignoring measures..............................
starting graph
ALPHA ----[p0]---- BRAVO
ALPHA ----(1) [p0]---- BRAVO

ignore a measure

un-ignore a measure
ALPHA ----[p0]---- BRAVO
ALPHA ----(1) [p0]---- BRAVO

testing measure addition to point already in network...
add point with only 1 measure
ALPHA ----[p0]---- BRAVO
ALPHA ----(1) [p0]---- BRAVO

add a measure
ALPHA ----[p0,p1]---- BRAVO
ALPHA ----(2) [p0,p1]---- BRAVO

add another measure
ALPHA ----[p0,p1]---- BRAVO
ALPHA ----[p1]---- CHARLIE
BRAVO ----[p1]---- CHARLIE
ALPHA ----(2) [p0,p1]---- BRAVO
ALPHA ----(1) [p1]---- CHARLIE
BRAVO ----(1) [p1]---- CHARLIE

testing setting point to ignored.......................
ignore p1
ALPHA ----[p0]---- BRAVO
ALPHA ----(1) [p0]---- BRAVO

un-ignore p1
ALPHA ----[p0,p1]---- BRAVO
ALPHA ----[p1]---- CHARLIE
BRAVO ----[p1]---- CHARLIE
ALPHA ----(2) [p0,p1]---- BRAVO
ALPHA ----(1) [p1]---- CHARLIE
BRAVO ----(1) [p1]---- CHARLIE

testing measure deletion & addition....................
ALPHA ----[p1]---- BRAVO
ALPHA ----[p1]---- CHARLIE
BRAVO ----[p1]---- CHARLIE
ALPHA ----(1) [p1]---- BRAVO
ALPHA ----(1) [p1]---- CHARLIE
BRAVO ----(1) [p1]---- CHARLIE

ALPHA ----[p1]---- BRAVO
ALPHA ----[p1]---- CHARLIE
ALPHA ----[p0]---- DELTA
BRAVO ----[p1]---- CHARLIE
ALPHA ----(1) [p1]---- BRAVO
ALPHA ----(1) [p1]---- CHARLIE
ALPHA ----(1) [p0]---- DELTA
BRAVO ----(1) [p1]---- CHARLIE

testing FindClosest....................
Closest Point ID: p1
@@ -51,7 +51,7 @@ Adjacent Images:
  DELTA

testing point deletion.................................
ALPHA ----[p0]---- DELTA
ALPHA ----(1) [p0]---- DELTA

******* Done testing cube graph ***************

@@ -349,7 +349,7 @@ Read/Write of binary files OK.
    BRAVO
    CHARLIE
    DELTA
ALPHA ----[p0]---- DELTA
ALPHA ----(1) [p0]---- DELTA


Testing getEdgeCount: 1
Loading