gov.nih.mipav.model.structures
Class DijkstraCostItem

java.lang.Object
  extended by gov.nih.mipav.model.structures.DijkstraCostItem
All Implemented Interfaces:
Comparable

public class DijkstraCostItem
extends Object
implements Comparable

Contains information for a point used in the the Dijkstra minimum cost path algorithm. This class implements the Comparable interface which is required of any node to be inserted in any SortedSet implementation which is required for finding a minimum cost path.


Field Summary
static int KEY_UNDEFINED
          Identifies an undefined key value.
 
Constructor Summary
DijkstraCostItem(int iKey)
          Setup to associate this instance with a particular sample in the volume.
 
Method Summary
 int compareTo(Object kObject)
          Implementation required by the Comparable interface.
 float getCost()
          Get the current accumulated cost.
 float getDistance()
          Get the current accumulated distance.
 int getKey()
          Get the unique key identifier associated with this point.
 int getKeyPrev()
          Get the unique key value for the point which is used to get to this point along the minimum cost path.
 int getNumPrev()
          Get the number of samples along the current minimum cost path that preceed this sample in the volume.
 boolean isFinalized()
          Test whether or not the sample has had its cost finalized.
 void markFinalized()
          Mark the sample as having its cost finalized, meaning that it can no longer be updated.
 void markStart()
          Mark this sample as the beginning of the minimum cost path.
 void update(float fCost, float fDistance, int iKeyPrev, int iNumPrev)
          Mark this node as being visited along the minimum cost path if not already done so, but only if the point has not been marked as having its distance finalized.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_UNDEFINED

public static final int KEY_UNDEFINED
Identifies an undefined key value.

See Also:
Constant Field Values
Constructor Detail

DijkstraCostItem

public DijkstraCostItem(int iKey)
Setup to associate this instance with a particular sample in the volume. Initially the sample is marked as having the maximum possible distance but that its distance has not be finalized.

Parameters:
iKey - Value uniquely identifying this point.
Method Detail

compareTo

public int compareTo(Object kObject)
Implementation required by the Comparable interface. Compares this object with the specified object for order.

Specified by:
compareTo in interface Comparable
Parameters:
kObject - the object to be compared
Returns:
a negative (positive) integer if this object is ordered before (after) the specified object, or zero if the two objects are considered have equal ordering

getCost

public float getCost()
Get the current accumulated cost.

Returns:
current accumulated cost

getDistance

public float getDistance()
Get the current accumulated distance.

Returns:
current accumulated distance

getKey

public int getKey()
Get the unique key identifier associated with this point.

Returns:
int Non-negative unique key identifier

getKeyPrev

public int getKeyPrev()
Get the unique key value for the point which is used to get to this point along the minimum cost path.

Returns:
Unique key value for this previous point, or KEY_UNDEFINED if point is not connected yet along the minimum cost path.

getNumPrev

public int getNumPrev()
Get the number of samples along the current minimum cost path that preceed this sample in the volume.

Returns:
non-negative integer for number of preceeding path samples along path. Should be zero for the starting point along the path.

isFinalized

public boolean isFinalized()
Test whether or not the sample has had its cost finalized.

Returns:
true if the cost for this sample has been finalized

markFinalized

public void markFinalized()
Mark the sample as having its cost finalized, meaning that it can no longer be updated.


markStart

public void markStart()
Mark this sample as the beginning of the minimum cost path.


update

public void update(float fCost,
                   float fDistance,
                   int iKeyPrev,
                   int iNumPrev)
Mark this node as being visited along the minimum cost path if not already done so, but only if the point has not been marked as having its distance finalized. Update the accumulated distance for this sample including an indication of the point from which to get to this sample along the current minimum cost path.

Parameters:
fCost - accumulated cost to update for this sample; must not be negative
fDistance - accumulated distance to update for this sample; must not be negative.
iKeyPrev - Unique key value for the point which is used to get to this point along the minimum cost path.
iNumPrev - number of samples along the minimum cost path leading up to this sample. Should be one more than the same field value for the point having key value iKeyPrev, if there is such a previous point.