Skip to content

Commit 3b5346b

Browse files
richardbeareromangrothausmann
authored andcommitted
Corrected approach to restarting the optimizer.
1 parent eb35aa5 commit 3b5346b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

include/itkArrivalFunctionToPathFilter.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ class ITK_TEMPLATE_EXPORT ArrivalFunctionToPathFilter : public ImageToPathFilter
250250
typename OptimizerType::MeasureType m_TerminationValue;
251251
std::vector<PointsContainerType> m_PointList;
252252
unsigned int m_CurrentOutput;
253+
254+
// variable for communicating state of a multisegment path
255+
// Sometimes an optimizer may terminate during one segment of the
256+
// path, and needs to be restarted
257+
bool m_TrackingPath;
253258
};
254259

255260
} // end namespace itk

include/itkArrivalFunctionToPathFilter.hxx

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

197197
// Use optimizer to back propagate from end point
198-
m_Optimizer->StartOptimization();
198+
m_TrackingPath = false;
199+
do {
200+
m_Optimizer->StartOptimization();
201+
} while(m_TrackingPath);
199202
}
200203

201204
// Clean up by removing observer

0 commit comments

Comments
 (0)