18 #ifndef __itkMultiphaseFiniteDifferenceImageFilter_h
19 #define __itkMultiphaseFiniteDifferenceImageFilter_h
23 #include "vnl/vnl_vector.h"
160 template<
class TInputImage,
163 class TFiniteDifferenceFunction = FiniteDifferenceFunction< TOutputImage >,
164 typename TIdCell =
unsigned int >
180 itkStaticConstMacro(ImageDimension,
unsigned int, TOutputImage::ImageDimension);
221 typedef typename FiniteDifferenceFunctionType::TimeStepType
TimeStepType;
223 typedef typename FiniteDifferenceFunctionType::RadiusType
RadiusType;
240 if ( functionIndex < m_FunctionCount )
242 return ( this->m_DifferenceFunctions[functionIndex] );
255 virtual void SetDifferenceFunction(
const IdCellType & functionIndex,
258 if ( functionIndex < m_FunctionCount )
260 this->m_DifferenceFunctions[functionIndex] =
function;
266 itkSetMacro(NumberOfIterations,
unsigned int);
267 itkGetConstReferenceMacro(NumberOfIterations,
unsigned int);
272 itkSetMacro(UseImageSpacing,
bool);
273 itkBooleanMacro(UseImageSpacing);
274 itkGetConstReferenceMacro(UseImageSpacing,
bool);
279 itkSetMacro(MaximumRMSError,
double);
280 itkGetConstReferenceMacro(MaximumRMSError,
double);
285 itkSetMacro(RMSChange,
double);
286 itkGetConstReferenceMacro(RMSChange,
double);
290 itkSetMacro(InitializedState,
bool);
291 itkGetConstReferenceMacro(InitializedState,
bool);
292 itkBooleanMacro(InitializedState);
297 itkSetMacro(ManualReinitialization,
bool);
298 itkGetConstReferenceMacro(ManualReinitialization,
bool);
299 itkBooleanMacro(ManualReinitialization);
303 itkSetMacro(ElapsedIterations,
unsigned int);
306 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() )
333 if ( i >= m_FunctionCount )
335 itkExceptionMacro(
"Request for level set #" << i
336 <<
" but there are only " << m_FunctionCount);
340 return m_LevelSet[i];
346 this->m_Lookup = lookup;
351 this->m_KdTree = kdtree;
358 m_DifferenceFunctions.resize(m_FunctionCount, 0);
363 for (
unsigned int i = 0; i < this->m_FunctionCount; i++ )
365 this->m_DifferenceFunctions[i] = FiniteDifferenceFunctionType::New();
366 this->m_DifferenceFunctions[i]->Initialize(radius);
370 m_LevelSet.resize(m_FunctionCount, 0);
373 this->m_Lookup.resize(m_FunctionCount);
377 typedef typename std::vector< IdCellType >::iterator VectorIteratorType;
379 VectorIteratorType it = this->m_Lookup.begin();
381 while ( it != this->m_Lookup.end() )
393 this->m_ElapsedIterations = 0;
394 this->m_MaximumRMSError = vnl_math::eps;
396 this->m_UseImageSpacing =
true;
397 this->m_ManualReinitialization =
false;
398 this->m_InitializedState =
false;
400 this->m_FunctionCount = 0;
423 void PrintSelf(std::ostream & os,
Indent indent)
const;
426 virtual void AllocateUpdateBuffer() = 0;
443 virtual void CopyInputToOutput() = 0;
448 virtual void GenerateData();
461 virtual void GenerateInputRequestedRegion();
476 virtual bool ThreadedHalt(
void *itkNotUsed(threadInfo) )
494 virtual void InitializeIteration()
496 for (
IdCellType i = 0; i < this->m_FunctionCount; i++ )
498 this->m_DifferenceFunctions[i]->InitializeIteration();
515 inline TimeStepType ResolveTimeStep(
const TimeStepVectorType & timeStepList,
516 const std::vector< bool > & valid);
525 void operator=(
const Self &);
536 #ifndef ITK_MANUAL_INSTANTIATION
537 #include "itkMultiphaseFiniteDifferenceImageFilter.hxx"