edu.jhu.ece.iacl.jist.pipeline
Class AbstractCalculation

java.lang.Object
  extended by edu.jhu.ece.iacl.jist.pipeline.AbstractCalculation
Direct Known Subclasses:
CESTAsymmetry.AlgorithmWrapper, CFARIEstimation2.CFARIWrapper, CompareVolumes, ComputeMeanB0.TensorEstimationWrapper, ComputeMeanDW.TensorEstimationWrapper, CubicVolumeCropper, DistanceField, DistanceField2D, DtiVecMask, DWIBallStickEstCaminoFileCollection.TensorEstimationWrapper, DWITensorColorEncodedMap.AlgorithmWrapper, DWITensorEstCaminoFileCollection.TensorEstimationWrapper, DWITensorEstLikelihood.TensorEstimationWrapper, DWITensorEstLLMSE.TensorEstimationWrapper, DWIThreeTensorEstCaminoFileCollection.TensorEstimationWrapper, DWITwoTensorEstCaminoFileCollection.TensorEstimationWrapper, EstimateMTR.AlgorithmWrapper, EstimateMTRseries.AlgorithmWrapper, EstimateT1FromDoubleAngle.AlgorithmWrapper, EstimateT2FromDualEcho.AlgorithmWrapper, FastMarchingLabelExtension, FiberTracker, GeodesicActiveContour2D, GradientVectorFlow2D, HistogramGenerator, ImagePair, IsoContourGenerator, IsoSurfaceGenerator, JistMSWASSR.AlgorithmWrapper, MedicAlgorithmConstrainedFLIRT.FlirtWrapper, MedicAlgorithmDemo.MyAlgorithm, MedicAlgorithmEfficientFileCollectionRegistration.FlirtWrapper, MedicAlgorithmExecutableAdapter.ProcessRunner, MedicAlgorithmFLIRT.FlirtWrapper, MedicAlgorithmFLIRTCollection.FlirtWrapper, MedicAlgorithmMipavReorient.reorientWrapper, MedicAlgorithmMultiAtlasSurfaceLabeling.Wrapper, MedicAlgorithmMultiDeformVolume.ExecuteWrapper, MedicAlgorithmTransformVolume.ExecuteWrapper, MedicAlgorithmWildBootTrac.ExecuteWrapper, ObservableCalculation, STAPLE, STAPLEgeneral, STAPLEmulti, STAPLEmulti2, STAPLEsingle, STAPLEsurf, VabraAlgorithm, VabraSolver, VolumeCensorRange.AlgorithmWrapper, WildBootFiberTracker

public abstract class AbstractCalculation
extends java.lang.Object

Observable Calculation allows a calculation to be monitored.

Author:
Blake Lucas

Field Summary
protected  CalculationMonitor monitor
          monitor to track current thread.
 
Constructor Summary
AbstractCalculation()
          Default constructor.
AbstractCalculation(AbstractCalculation parent)
          Constructor with parent calculation.
 
Method Summary
 void add(AbstractCalculation child)
          Add a child calculation to this calculation.
 void addTotalUnits(long extra)
          Add extra computational units to the total computational units.
 void decrementCompletedUnits()
          Decrement the number of completed units.
 void decrementCompletedUnits(int inc)
          Decrement the number of completed units.
 long getCompletedUnits()
          Completed computational units for the calculation.
 java.lang.String getCurrentLabel()
          Get current label of calculation including any child calculations in progress.
 double getCurrentProgress()
          Return normalized progress of deepest child calculation.
 java.lang.String getLabel()
          Label for this computation.
 PerformanceSummary getPerformance()
          Get performance summary.
 double getProgress()
          Return normalized progress of this calculation.
 long getTotalUnits()
          Total computational units for calculation.
 void incrementCompletedUnits()
          Increment the number of completed units.
 void incrementCompletedUnits(int inc)
          Increment the number of completed units.
 boolean isCompleted()
          True if completed units equals total computational units.
 void markCompleted()
          Mark algorithm as completed at the end of calculation It is mandatory that this method be executed at the end of the calculation.
 void reset()
          Reset the completed units for this calculation and all child calculations.
 void setCompletedUnits(double percent)
          Set the percent completed [0,1] Requires that the total number of units is non-zero, (i.e.
 void setCompletedUnits(int units)
          Set the number of units completed.
 void setLabel(java.lang.String str)
          Set label to display in progress bar for this calculation.
 void setMonitor(CalculationMonitor monitor)
          Set monitor that observes this calculation.
 void setTotalUnits(long total)
          Set total computational units for this calculation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

monitor

protected CalculationMonitor monitor
monitor to track current thread.

Constructor Detail

AbstractCalculation

public AbstractCalculation()
Default constructor.


AbstractCalculation

public AbstractCalculation(AbstractCalculation parent)
Constructor with parent calculation.

Parameters:
parent - parent calculation
Method Detail

add

public void add(AbstractCalculation child)
Add a child calculation to this calculation.

Parameters:
child - the child

addTotalUnits

public void addTotalUnits(long extra)
Add extra computational units to the total computational units.

Parameters:
extra - the extra completed units

decrementCompletedUnits

public void decrementCompletedUnits()
Decrement the number of completed units.


decrementCompletedUnits

public void decrementCompletedUnits(int inc)
Decrement the number of completed units.

Parameters:
inc - increment amount

getCompletedUnits

public long getCompletedUnits()
Completed computational units for the calculation.

Returns:
the completed units

getCurrentLabel

public java.lang.String getCurrentLabel()
Get current label of calculation including any child calculations in progress.

Returns:
the current label

getCurrentProgress

public double getCurrentProgress()
Return normalized progress of deepest child calculation.

Returns:
the current progress

getLabel

public java.lang.String getLabel()
Label for this computation.

Returns:
the label

getPerformance

public PerformanceSummary getPerformance()
Get performance summary.

Returns:
the performance

getProgress

public double getProgress()
Return normalized progress of this calculation.

Returns:
the progress

getTotalUnits

public long getTotalUnits()
Total computational units for calculation.

Returns:
the total units

incrementCompletedUnits

public void incrementCompletedUnits()
Increment the number of completed units.


incrementCompletedUnits

public void incrementCompletedUnits(int inc)
Increment the number of completed units.

Parameters:
inc - increment

isCompleted

public boolean isCompleted()
True if completed units equals total computational units.

Returns:
true, if checks if is completed

markCompleted

public void markCompleted()
Mark algorithm as completed at the end of calculation It is mandatory that this method be executed at the end of the calculation.


reset

public void reset()
Reset the completed units for this calculation and all child calculations.


setCompletedUnits

public void setCompletedUnits(double percent)
Set the percent completed [0,1] Requires that the total number of units is non-zero, (i.e. setTotalUnits(100))

Parameters:
percent - the percent

setCompletedUnits

public void setCompletedUnits(int units)
Set the number of units completed.

Parameters:
units - the units

setLabel

public void setLabel(java.lang.String str)
Set label to display in progress bar for this calculation.

Parameters:
str - the string

setMonitor

public void setMonitor(CalculationMonitor monitor)
Set monitor that observes this calculation.

Parameters:
monitor - the monitor

setTotalUnits

public void setTotalUnits(long total)
Set total computational units for this calculation. This method also resets the total completed units.

Parameters:
total - the total