/// <summary> /// Will solve the fastmarching problem, i.e, assign a value to each node in the graph. /// The method needs a graph as input that consists of IMarchingNodes. /// </summary> /// <param name="initialNodes"> /// The initially accepted nodes of the fastmarching graph. /// </param> public void march(IMarchingNode[] initialNodes) { //Initialize lists initializeAccepted(initialNodes); initializeConsidered(initialNodes); while (consideredQueue.number() != 0) { //update accepted nodes IMarchingNode node = consideredQueue.extractMinimum(); node.Accept(); accepted.Add(node); //update considered nodes if (consideredQueue.number() != 0) { updateConsidered(node); } } }
void updateConsidered(IMarchingNode node) { //add neighbours that are not in accepted to considered //Todo? : Speed up by only going through neighbors that have not been accepted by handling the neighborslist foreach (IMarchingNode neighbor in node.Neighbors) { if (!accepted.Contains(neighbor)) { neighbor.CalculateValue(); if (considered.Contains(neighbor)) { consideredQueue.changeKey(neighbor.QueueID, neighbor); } else { neighbor.QueueID = consideredQueue.insert(neighbor); considered.Add(neighbor); } } } }
public WrapperINode(IMarchingNode Node) { node = Node; value = Node.Value; }