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 >
181 static constexpr
unsigned int ImageDimension = TOutputImage::ImageDimension;
222 using TimeStepType =
typename FiniteDifferenceFunctionType::TimeStepType;
224 using RadiusType =
typename FiniteDifferenceFunctionType::RadiusType;
241 if ( functionIndex < m_FunctionCount )
243 return ( this->m_DifferenceFunctions[functionIndex] );
259 if ( functionIndex < m_FunctionCount )
261 this->m_DifferenceFunctions[functionIndex] =
function;
267 itkSetMacro(NumberOfIterations,
unsigned int);
268 itkGetConstReferenceMacro(NumberOfIterations,
unsigned int);
273 itkSetMacro(UseImageSpacing,
bool);
274 itkBooleanMacro(UseImageSpacing);
275 itkGetConstReferenceMacro(UseImageSpacing,
bool);
280 itkSetMacro(MaximumRMSError,
double);
281 itkGetConstReferenceMacro(MaximumRMSError,
double);
286 itkSetMacro(RMSChange,
double);
287 itkGetConstReferenceMacro(RMSChange,
double);
291 itkSetMacro(InitializedState,
bool);
292 itkGetConstReferenceMacro(InitializedState,
bool);
293 itkBooleanMacro(InitializedState);
298 itkSetMacro(ManualReinitialization,
bool);
299 itkGetConstReferenceMacro(ManualReinitialization,
bool);
300 itkBooleanMacro(ManualReinitialization);
304 itkSetMacro(ElapsedIterations,
unsigned int);
307 itkGetConstReferenceMacro(ElapsedIterations,
unsigned int);
311 m_LevelSet[i] = InputImageType::New();
312 m_LevelSet[i]->SetRequestedRegion( levelSet->GetRequestedRegion() );
313 m_LevelSet[i]->SetBufferedRegion( levelSet->GetBufferedRegion() );
314 m_LevelSet[i]->SetLargestPossibleRegion( levelSet->GetLargestPossibleRegion() );
315 m_LevelSet[i]->Allocate();
316 m_LevelSet[i]->CopyInformation(levelSet);
324 while ( !in.IsAtEnd() )
334 if ( i >= m_FunctionCount )
336 itkExceptionMacro(
"Request for level set #" << i
337 <<
" but there are only " << m_FunctionCount);
341 return m_LevelSet[i];
347 this->m_Lookup = lookup;
352 this->m_KdTree = kdtree;
359 m_DifferenceFunctions.resize(m_FunctionCount,
nullptr);
364 for (
unsigned int i = 0; i < this->m_FunctionCount; i++ )
366 this->m_DifferenceFunctions[i] = FiniteDifferenceFunctionType::New();
367 this->m_DifferenceFunctions[i]->Initialize(radius);
371 m_LevelSet.resize(m_FunctionCount,
nullptr);
374 this->m_Lookup.resize(m_FunctionCount);
379 auto it = this->m_Lookup.begin();
380 auto _end = this->m_Lookup.end();
393 this->m_KdTree =
nullptr;
394 this->m_ElapsedIterations = 0;
397 this->m_UseImageSpacing =
true;
398 this->m_ManualReinitialization =
false;
399 this->m_InitializedState =
false;
401 this->m_FunctionCount = 0;
424 void PrintSelf(std::ostream & os,
Indent indent)
const override;
427 virtual void AllocateUpdateBuffer() = 0;
444 virtual void CopyInputToOutput() = 0;
449 void GenerateData()
override;
462 void GenerateInputRequestedRegion()
override;
497 for (
IdCellType i = 0; i < this->m_FunctionCount; i++ )
499 this->m_DifferenceFunctions[i]->InitializeIteration();
516 inline TimeStepType ResolveTimeStep(
const TimeStepVectorType & timeStepList,
517 const std::vector< bool > & valid);
533 #ifndef ITK_MANUAL_INSTANTIATION
534 #include "itkMultiphaseFiniteDifferenceImageFilter.hxx"
typename FiniteDifferenceFunctionType::Pointer FiniteDifferenceFunctionPointer
typename InputImageType::SpacingType InputSpacingType
typename OutputImageType::Pointer OutputImagePointer
bool m_ManualReinitialization
typename OutputImageType::SizeValueType OutputSizeValueType
typename FeatureImageType::RegionType FeatureRegionType
typename InputImageType::OffsetValueType InputOffsetValueType
virtual bool ThreadedHalt(void *)
InputImagePointer GetLevelSet(const IdCellType &i)
typename FeatureImageType::Pointer FeatureImagePointer
Define numeric traits for std::vector.
void SetLookup(VectorIdCellType lookup)
typename OutputImageType::SizeType OutputSizeType
unsigned long SizeValueType
typename FiniteDifferenceFunctionType::TimeStepType TimeStepType
typename OutputImageType::IndexValueType OutputIndexValueType
typename KdTreeGeneratorType::KdTreeType KdTreeType
typename FeatureImageType::PointType FeaturePointType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
typename InputImageType::RegionType InputRegionType
typename OutputImageType::RegionType OutputRegionType
TFeatureImage FeatureImageType
virtual const FiniteDifferenceFunctionPointer GetDifferenceFunction(const IdCellType &functionIndex) const
MultiphaseFiniteDifferenceImageFilter()
unsigned int m_ElapsedIterations
TFeatureImage InputImageType
typename KdTreeGeneratorType::Pointer KdTreeGeneratorPointer
unsigned int m_NumberOfIterations
typename std::vector< TimeStepType > TimeStepVectorType
typename OutputImageType::IndexType OutputIndexType
typename FeatureImageType::SizeType FeatureSizeType
typename InputImageType::Pointer InputImagePointer
A templated class holding a n-Dimensional vector.
ImageBaseType::SizeType SizeType
void SetFunctionCount(const IdCellType &n)
std::vector< InputImagePointer > m_LevelSet
ImageBaseType::IndexType IndexType
A multi-dimensional iterator templated over image type that walks a region of pixels.
typename InputImageType::PixelType InputPixelType
TOutputImage OutputImageType
signed long IndexValueType
virtual void PostProcessOutput()
typename FeatureImageType::SpacingType FeatureSpacingType
typename InputIndexType::IndexValueType InputIndexValueType
virtual void Initialize()
This class generates a KdTree object without centroid information.
static constexpr double eps
TFunction FiniteDifferenceFunctionType
IdCellType m_FunctionCount
typename InputPointType::CoordRepType InputCoordRepType
typename KdTreeType::Pointer KdTreePointer
typename FiniteDifferenceFunctionType::RadiusType RadiusType
std::vector< IdCellType > VectorIdCellType
void SetLevelSet(const IdCellType &i, const InputImageType *levelSet)
VectorIdCellType m_Lookup
This class is the native implementation of the a Sample with an STL container.
Control indentation during Print() invocation.
ImageBaseType::PointType PointType
typename OutputImageType::PixelType OutputPixelType
virtual void SetDifferenceFunction(const IdCellType &functionIndex, FiniteDifferenceFunctionPointer function)
typename InputSizeType::SizeValueType InputSizeValueType
~MultiphaseFiniteDifferenceImageFilter() override
typename InputImageType::PointType InputPointType
void SetKdTree(KdTreeType *kdtree)
typename FeatureImageType::PixelType FeaturePixelType
Base class for filters that take an image as input and overwrite that image as the output...
ImageBaseType::RegionType RegionType
std::vector< FiniteDifferenceFunctionPointer > m_DifferenceFunctions
This class provides methods for k-nearest neighbor search and related data structures for a k-d tree...
signed long OffsetValueType
typename InputImageType::IndexType InputIndexType
A multi-dimensional iterator templated over image type that walks a region of pixels.
typename InputImageType::SizeType InputSizeType
virtual void InitializeIteration()