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 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] );
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, ITK_NULLPTR);
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, ITK_NULLPTR);
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() )
392 this->m_KdTree = ITK_NULLPTR;
393 this->m_ElapsedIterations = 0;
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 ITK_OVERRIDE;
426 virtual void AllocateUpdateBuffer() = 0;
443 virtual void CopyInputToOutput() = 0;
448 virtual void GenerateData() ITK_OVERRIDE;
461 virtual
void GenerateInputRequestedRegion() ITK_OVERRIDE;
476 virtual
bool ThreadedHalt(
void *itkNotUsed(threadInfo) )
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);
534 #ifndef ITK_MANUAL_INSTANTIATION
535 #include "itkMultiphaseFiniteDifferenceImageFilter.hxx"
FeatureImageType::SpacingType FeatureSpacingType
InputImageType::IndexType InputIndexType
KdTreeGeneratorType::Pointer KdTreeGeneratorPointer
MultiphaseFiniteDifferenceImageFilter Self
bool m_ManualReinitialization
InputImagePointer GetLevelSet(const IdCellType &i)
signed long OffsetValueType
void SetLookup(VectorIdCellType lookup)
TOutputImage OutputImageType
FiniteDifferenceFunctionType::RadiusType RadiusType
std::vector< TimeStepType > TimeStepVectorType
SmartPointer< Self > Pointer
std::vector< IdCellType > VectorIdCellType
InputImageType::Pointer InputImagePointer
TInputImage InputImageType
FiniteDifferenceFunctionType::Pointer FiniteDifferenceFunctionPointer
OutputImageType::RegionType OutputRegionType
signed long IndexValueType
FeatureImageType::Pointer FeatureImagePointer
InputPointType::CoordRepType InputCoordRepType
OutputImageType::Pointer OutputImagePointer
InPlaceImageFilter< TFeatureImage, TOutputImage > Superclass
InputImageType::PixelType InputPixelType
FiniteDifferenceFunctionType::TimeStepType TimeStepType
unsigned long SizeValueType
virtual const FiniteDifferenceFunctionPointer GetDifferenceFunction(const IdCellType &functionIndex) const
OutputImageType::PixelType OutputPixelType
InputImageType::OffsetValueType InputOffsetValueType
MultiphaseFiniteDifferenceImageFilter()
unsigned int m_ElapsedIterations
Statistics::KdTreeGenerator< SampleType > KdTreeGeneratorType
unsigned int m_NumberOfIterations
SmartPointer< const Self > ConstPointer
static ITK_CONSTEXPR_FUNC T max(const T &)
FeatureImageType::PointType FeaturePointType
InputImageType::RegionType InputRegionType
TFiniteDifferenceFunction FiniteDifferenceFunctionType
Statistics::ListSample< CentroidVectorType > SampleType
InputImageType::Pointer InputImagePointer
A templated class holding a n-Dimensional vector.
void SetFunctionCount(const IdCellType &n)
OutputImageType::SizeValueType OutputSizeValueType
ImageBaseType::PointType PointType
std::vector< InputImagePointer > m_LevelSet
A multi-dimensional iterator templated over image type that walks a region of pixels.
TFeatureImage InputImageType
InputImageType::SizeType InputSizeType
virtual void PostProcessOutput()
virtual void Initialize()
This class generates a KdTree object without centroid information.
InputSizeType::SizeValueType InputSizeValueType
IdCellType m_FunctionCount
Vector< float, itkGetStaticConstMacro(ImageDimension) > CentroidVectorType
KdTreeGeneratorType::KdTreeType KdTreeType
~MultiphaseFiniteDifferenceImageFilter()
OutputImageType::IndexValueType OutputIndexValueType
FeatureImageType::RegionType FeatureRegionType
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.
KdTreeType::Pointer KdTreePointer
InputIndexType::IndexValueType InputIndexValueType
Control indentation during Print() invocation.
FeatureImageType::PixelType FeaturePixelType
virtual void SetDifferenceFunction(const IdCellType &functionIndex, FiniteDifferenceFunctionPointer function)
ImageBaseType::SizeType SizeType
OutputImageType::SizeType OutputSizeType
OutputImageType::IndexType OutputIndexType
void SetKdTree(KdTreeType *kdtree)
Base class for filters that take an image as input and overwrite that image as the output...
static ITK_CONSTEXPR_VAR double eps
TFeatureImage FeatureImageType
std::vector< FiniteDifferenceFunctionPointer > m_DifferenceFunctions
This class provides methods for k-nearest neighbor search and related data structures for a k-d tree...
InputImageType::PointType InputPointType
A multi-dimensional iterator templated over image type that walks a region of pixels.
InputImageType::SpacingType InputSpacingType
ImageBaseType::IndexType IndexType
FeatureImageType::SizeType FeatureSizeType
virtual void InitializeIteration()