Skip to content

Commit 5875e83

Browse files
richardbearethewtex
authored andcommitted
Corrected approach to restarting the optimizer.
1 parent 55946a1 commit 5875e83

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

include/itkArrivalFunctionToPathFilter.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@ class ITK_TEMPLATE_EXPORT ArrivalFunctionToPathFilter :
240240
typename OptimizerType::MeasureType m_TerminationValue;
241241
std::vector<PointsContainerType> m_PointList;
242242
unsigned int m_CurrentOutput;
243+
// variable for communicating state of a multisegment path
244+
// Sometimes an optimizer may terminate during one segment of the
245+
// path, and needs to be restarted
246+
bool m_TrackingPath;
243247
};
244248

245249
} // end namespace itk

include/itkArrivalFunctionToPathFilter.hxx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,10 @@ ArrivalFunctionToPathFilter<TInputImage,TOutputPath>
208208
m_Optimizer->SetInitialPosition( end );
209209

210210
// Use optimizer to back propagate from end point
211-
m_Optimizer->StartOptimization( );
211+
m_TrackingPath = false;
212+
do {
213+
m_Optimizer->StartOptimization( );
214+
} while ( m_TrackingPath );
212215
}
213216

214217
// Clean up by removing observer

0 commit comments

Comments
 (0)