Skip to content

Commit bd2a20d

Browse files
richardbearethewtex
authored andcommitted
Corrected approach to restarting the optimizer.
1 parent 7240524 commit bd2a20d

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
@@ -238,6 +238,10 @@ class ITK_EXPORT ArrivalFunctionToPathFilter :
238238
typename OptimizerType::MeasureType m_TerminationValue;
239239
std::vector<PointsContainerType> m_PointList;
240240
unsigned int m_CurrentOutput;
241+
// variable for communicating state of a multisegment path
242+
// Sometimes an optimizer may terminate during one segment of the
243+
// path, and needs to be restarted
244+
bool m_TrackingPath;
241245
};
242246

243247
} // end namespace itk

include/itkArrivalFunctionToPathFilter.hxx

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

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

213216
// Clean up by removing observer

0 commit comments

Comments
 (0)