18 #ifndef itkMultiphaseFiniteDifferenceImageFilter_h
19 #define itkMultiphaseFiniteDifferenceImageFilter_h
23 #include "vnl/vnl_vector.h"
160 template <
typename TInputImage,
161 typename TFeatureImage,
162 typename TOutputImage,
163 typename TFiniteDifferenceFunction = FiniteDifferenceFunction<TOutputImage>,
164 typename TIdCell =
unsigned int>
180 static constexpr
unsigned int ImageDimension = TOutputImage::ImageDimension;
221 using TimeStepType =
typename FiniteDifferenceFunctionType::TimeStepType;
223 using RadiusType =
typename FiniteDifferenceFunctionType::RadiusType;
239 if (functionIndex < m_FunctionCount)
241 return (this->m_DifferenceFunctions[functionIndex]);
257 if (functionIndex < m_FunctionCount)
259 this->m_DifferenceFunctions[functionIndex] =
function;
265 itkSetMacro(NumberOfIterations,
unsigned int);
266 itkGetConstReferenceMacro(NumberOfIterations,
unsigned int);
271 itkSetMacro(UseImageSpacing,
bool);
272 itkBooleanMacro(UseImageSpacing);
273 itkGetConstReferenceMacro(UseImageSpacing,
bool);
278 itkSetMacro(MaximumRMSError,
double);
279 itkGetConstReferenceMacro(MaximumRMSError,
double);
284 itkSetMacro(RMSChange,
double);
285 itkGetConstReferenceMacro(RMSChange,
double);
289 itkSetMacro(InitializedState,
bool);
290 itkGetConstReferenceMacro(InitializedState,
bool);
291 itkBooleanMacro(InitializedState);
296 itkSetMacro(ManualReinitialization,
bool);
297 itkGetConstReferenceMacro(ManualReinitialization,
bool);
298 itkBooleanMacro(ManualReinitialization);
302 itkSetMacro(ElapsedIterations,
unsigned int);
305 itkGetConstReferenceMacro(ElapsedIterations,
unsigned int);
310 m_LevelSet[i] = InputImageType::New();
311 m_LevelSet[i]->SetRequestedRegion(levelSet->GetRequestedRegion());
312 m_LevelSet[i]->SetBufferedRegion(levelSet->GetBufferedRegion());
313 m_LevelSet[i]->SetLargestPossibleRegion(levelSet->GetLargestPossibleRegion());
314 m_LevelSet[i]->Allocate();
315 m_LevelSet[i]->CopyInformation(levelSet);
323 while (!in.IsAtEnd())
334 if (i >= m_FunctionCount)
336 itkExceptionMacro(
"Request for level set #" << i <<
" but there are only " << m_FunctionCount);
340 return m_LevelSet[i];
347 this->m_Lookup = lookup;
353 this->m_KdTree = kdtree;
361 m_DifferenceFunctions.resize(m_FunctionCount,
nullptr);
366 for (
unsigned int i = 0; i < this->m_FunctionCount; i++)
368 this->m_DifferenceFunctions[i] = FiniteDifferenceFunctionType::New();
369 this->m_DifferenceFunctions[i]->Initialize(radius);
373 m_LevelSet.resize(m_FunctionCount,
nullptr);
376 this->m_Lookup.resize(m_FunctionCount);
381 auto it = this->m_Lookup.begin();
382 auto _end = this->m_Lookup.end();
395 this->m_KdTree =
nullptr;
396 this->m_ElapsedIterations = 0;
399 this->m_UseImageSpacing =
true;
400 this->m_ManualReinitialization =
false;
401 this->m_InitializedState =
false;
403 this->m_FunctionCount = 0;
427 PrintSelf(std::ostream & os,
Indent indent)
const override;
431 AllocateUpdateBuffer() = 0;
445 CalculateChange() = 0;
451 CopyInputToOutput() = 0;
457 GenerateData()
override;
471 GenerateInputRequestedRegion()
override;
511 for (
IdCellType i = 0; i < this->m_FunctionCount; i++)
513 this->m_DifferenceFunctions[i]->InitializeIteration();
531 ResolveTimeStep(
const TimeStepVectorType & timeStepList,
const std::vector<bool> & valid);
549 #ifndef ITK_MANUAL_INSTANTIATION
550 # include "itkMultiphaseFiniteDifferenceImageFilter.hxx"