SimpleITK  
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
itk::simple::FastMarchingImageFilter Class Reference

Solve an Eikonal equation using Fast Marching. More...

#include <sitkFastMarchingImageFilter.h>

+ Inheritance diagram for itk::simple::FastMarchingImageFilter:
+ Collaboration diagram for itk::simple::FastMarchingImageFilter:

Detailed Description

Solve an Eikonal equation using Fast Marching.

Fast marching solves an Eikonal equation where the speed is always non-negative and depends on the position only. Starting from an initial position on the front, fast marching systematically moves the front forward one grid point at a time.

Updates are performed using an entropy satisfy scheme where only "upwind" neighborhoods are used. This implementation of Fast Marching uses a std::priority_queue to locate the next proper grid position to update.

Fast Marching sweeps through N grid points in (N log N) steps to obtain the arrival time value as the front propagates through the grid.

Implementation of this class is based on Chapter 8 of "Level Set Methods and Fast Marching Methods", J.A. Sethian, Cambridge Press, Second edition, 1999.

This class is templated over the level set image type and the speed image type. The initial front is specified by two containers: one containing the known points and one containing the trial points. Alive points are those that are already part of the object, and trial points are considered for inclusion. In order for the filter to evolve, at least some trial points must be specified. These can for instance be specified as the layer of pixels around the alive points.

The speed function can be specified as a speed image or a speed constant. The speed image is set using the method SetInput() . If the speed image is nullptr, a constant speed function is used and is specified using method the SetSpeedConstant() .

If the speed function is constant and of value one, fast marching results in an approximate distance function from the initial alive points. FastMarchingImageFilter is used in the ReinitializeLevelSetImageFilter object to create a signed distance function from the zero level set.

The algorithm can be terminated early by setting an appropriate stopping value. The algorithm terminates when the current arrival time being processed is greater than the stopping value.

There are two ways to specify the output image information ( LargestPossibleRegion, Spacing, Origin): (a) it is copied directly from the input speed image or (b) it is specified by the user. Default values are used if the user does not specify all the information.

The output information is computed as follows. If the speed image is nullptr or if the OverrideOutputInformation is set to true, the output information is set from user specified parameters. These parameters can be specified using methods SetOutputRegion() , SetOutputSpacing() , SetOutputDirection() , and SetOutputOrigin() . Else if the speed image is not nullptr, the output information is copied from the input speed image.

For an alternative implementation, see itk::FastMarchingImageFilter .

Possible Improvements: In the current implementation, std::priority_queue only allows taking nodes out from the front and putting nodes in from the back. To update a value already on the heap, a new node is added to the heap. The defunct old node is left on the heap. When it is removed from the top, it will be recognized as invalid and not used. Future implementations can implement the heap in a different way allowing the values to be updated. This will generally require some sift-up and sift-down functions and an image of back-pointers going from the image to heap in order to locate the node which is to be updated.

See also
FastMarchingImageFilterBase
LevelSetTypeDefault
itk::simple::FastMarching for the procedural interface
itk::FastMarchingImageFilter for the Doxygen on the original ITK class.
Examples
FastMarchingSegmentation/FastMarchingSegmentation.cxx.

Definition at line 68 of file sitkFastMarchingImageFilter.h.

Public Types

using PixelIDTypeList = BasicPixelIDTypeList
 
using Self = FastMarchingImageFilter
 
- Public Types inherited from itk::simple::ImageFilter
using Self = ImageFilter
 
- Public Types inherited from itk::simple::ProcessObject
using Self = ProcessObject
 

Public Member Functions

SelfAddTrialPoint (std::vector< unsigned int > point)
 Add TrialPoints point. More...
 
SelfClearTrialPoints ()
 Remove all TrialPoints points. More...
 
Image Execute (const Image &image1)
 
 FastMarchingImageFilter ()
 
std::vector< double > GetInitialTrialValues () const
 
std::string GetName () const
 
double GetNormalizationFactor () const
 
double GetStoppingValue () const
 
std::vector< std::vector< unsigned int > > GetTrialPoints () const
 
SelfSetInitialTrialValues (std::vector< double > InitialTrialValues)
 Set the initial seed values for corresponding trial points. More...
 
SelfSetNormalizationFactor (double NormalizationFactor)
 
SelfSetStoppingValue (double StoppingValue)
 
SelfSetTrialPoints (std::vector< std::vector< unsigned int > > TrialPoints)
 
std::string ToString () const
 
virtual ~FastMarchingImageFilter ()
 
- Public Member Functions inherited from itk::simple::ImageFilter
 ImageFilter ()
 
virtual ~ImageFilter ()=0
 
- Public Member Functions inherited from itk::simple::ProcessObject
virtual void Abort ()
 
virtual int AddCommand (itk::simple::EventEnum event, const std::function< void()> &func)
 Directly add a callback to observe an event. More...
 
virtual int AddCommand (itk::simple::EventEnum event, itk::simple::Command &cmd)
 Add a Command Object to observer the event. More...
 
virtual float GetProgress () const
 An Active Measurement of the progress of execution. More...
 
virtual bool HasCommand (itk::simple::EventEnum event) const
 Query of this object has any registered commands for event. More...
 
 ProcessObject ()
 
virtual void RemoveAllCommands ()
 Remove all registered commands. More...
 
virtual ~ProcessObject ()
 
virtual void DebugOn ()
 
virtual void DebugOff ()
 
virtual bool GetDebug () const
 
virtual void SetDebug (bool debugFlag)
 
virtual void SetNumberOfThreads (unsigned int n)
 
virtual unsigned int GetNumberOfThreads () const
 
virtual void SetNumberOfWorkUnits (unsigned int n)
 
virtual unsigned int GetNumberOfWorkUnits () const
 

Private Types

using MemberFunctionType = Image(Self::*)(const Image &image1)
 

Private Member Functions

template<class TImageType >
Image ExecuteInternal (const Image &image1)
 

Private Attributes

std::vector< double > m_InitialTrialValues {std::vector<double>()}
 
std::unique_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
 
double m_NormalizationFactor {1.0}
 
double m_StoppingValue {std::numeric_limits<double>::max()/2.0}
 
std::vector< std::vector< unsigned int > > m_TrialPoints {std::vector< std::vector<unsigned int > >()}
 

Friends

struct detail::MemberFunctionAddressor< MemberFunctionType >
 

Additional Inherited Members

- Static Public Member Functions inherited from itk::simple::ProcessObject
static bool GetGlobalDefaultDebug ()
 
static void GlobalDefaultDebugOff ()
 
static void GlobalDefaultDebugOn ()
 
static void SetGlobalDefaultDebug (bool debugFlag)
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static void SetGlobalWarningDisplay (bool flag)
 
static bool GetGlobalWarningDisplay ()
 
static double GetGlobalDefaultCoordinateTolerance ()
 Access the global tolerance to determine congruent spaces. More...
 
static void SetGlobalDefaultCoordinateTolerance (double)
 Access the global tolerance to determine congruent spaces. More...
 
static double GetGlobalDefaultDirectionTolerance ()
 Access the global tolerance to determine congruent spaces. More...
 
static void SetGlobalDefaultDirectionTolerance (double)
 Access the global tolerance to determine congruent spaces. More...
 
static bool SetGlobalDefaultThreader (const std::string &threader)
 Set/Get the default threader used for process objects. More...
 
static std::string GetGlobalDefaultThreader ()
 Set/Get the default threader used for process objects. More...
 
static void SetGlobalDefaultNumberOfThreads (unsigned int n)
 
static unsigned int GetGlobalDefaultNumberOfThreads ()
 Set/Get the default threader used for process objects. More...
 
- Protected Member Functions inherited from itk::simple::ImageFilter
void CheckImageMatchingDimension (const Image &image1, const Image &image2, const std::string &image2Name)
 
void CheckImageMatchingPixelType (const Image &image1, const Image &image2, const std::string &image2Name)
 
void CheckImageMatchingSize (const Image &image1, const Image &image2, const std::string &image2Name)
 
- Protected Member Functions inherited from itk::simple::ProcessObject
virtual unsigned long AddITKObserver (const itk::EventObject &, itk::Command *)
 
virtual itk::ProcessObjectGetActiveProcess ()
 
virtual void OnActiveProcessDelete ()
 
virtual void onCommandDelete (const itk::simple::Command *cmd) noexcept
 
virtual void PreUpdate (itk::ProcessObject *p)
 
virtual void RemoveITKObserver (EventCommand &e)
 
- Protected Member Functions inherited from itk::simple::NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
- Static Protected Member Functions inherited from itk::simple::ImageFilter
template<class TImageType >
static void FixNonZeroIndex (TImageType *img)
 
- Static Protected Member Functions inherited from itk::simple::ProcessObject
template<class TImageType >
static TImageType::ConstPointer CastImageToITK (const Image &img)
 
template<class TPixelType , unsigned int VImageDimension, unsigned int VLength, template< typename, unsigned int > class TVector>
static Image CastITKToImage (itk::Image< TVector< TPixelType, VLength >, VImageDimension > *img)
 
template<unsigned int VImageDimension, unsigned int VLength, template< unsigned int > class TVector>
static Image CastITKToImage (itk::Image< TVector< VLength >, VImageDimension > *img)
 
template<class TImageType >
static Image CastITKToImage (TImageType *img)
 
static const itk::EventObjectGetITKEventObject (EventEnum e)
 
template<typename T >
static std::ostream & ToStringHelper (std::ostream &os, const T &v)
 
static std::ostream & ToStringHelper (std::ostream &os, const char &v)
 
static std::ostream & ToStringHelper (std::ostream &os, const signed char &v)
 
static std::ostream & ToStringHelper (std::ostream &os, const unsigned char &v)
 

Member Typedef Documentation

◆ MemberFunctionType

using itk::simple::FastMarchingImageFilter::MemberFunctionType = Image (Self::*)( const Image& image1 )
private

Setup for member function dispatching

Definition at line 142 of file sitkFastMarchingImageFilter.h.

◆ PixelIDTypeList

Define the pixels types supported by this filter

Definition at line 80 of file sitkFastMarchingImageFilter.h.

◆ Self

Definition at line 70 of file sitkFastMarchingImageFilter.h.

Constructor & Destructor Documentation

◆ ~FastMarchingImageFilter()

virtual itk::simple::FastMarchingImageFilter::~FastMarchingImageFilter ( )
virtual

Destructor

◆ FastMarchingImageFilter()

itk::simple::FastMarchingImageFilter::FastMarchingImageFilter ( )

Default Constructor that takes no arguments and initializes default parameters

Member Function Documentation

◆ AddTrialPoint()

Self& itk::simple::FastMarchingImageFilter::AddTrialPoint ( std::vector< unsigned int >  point)
inline

Add TrialPoints point.

Examples
FastMarchingSegmentation/FastMarchingSegmentation.cxx.

Definition at line 93 of file sitkFastMarchingImageFilter.h.

References itk::point().

◆ ClearTrialPoints()

Self& itk::simple::FastMarchingImageFilter::ClearTrialPoints ( )
inline

Remove all TrialPoints points.

Definition at line 95 of file sitkFastMarchingImageFilter.h.

◆ Execute()

Image itk::simple::FastMarchingImageFilter::Execute ( const Image image1)

Execute the filter on the input image

Examples
FastMarchingSegmentation/FastMarchingSegmentation.cxx.

◆ ExecuteInternal()

template<class TImageType >
Image itk::simple::FastMarchingImageFilter::ExecuteInternal ( const Image image1)
private

◆ GetInitialTrialValues()

std::vector<double> itk::simple::FastMarchingImageFilter::GetInitialTrialValues ( ) const
inline

Definition at line 125 of file sitkFastMarchingImageFilter.h.

◆ GetName()

std::string itk::simple::FastMarchingImageFilter::GetName ( ) const
inlinevirtual

Name of this class

Implements itk::simple::ProcessObject.

Definition at line 128 of file sitkFastMarchingImageFilter.h.

◆ GetNormalizationFactor()

double itk::simple::FastMarchingImageFilter::GetNormalizationFactor ( ) const
inline

Set/Get the Normalization Factor for the Speed Image . The values in the Speed Image is divided by this factor. This allows the use of images with integer pixel types to represent the speed.

Definition at line 106 of file sitkFastMarchingImageFilter.h.

◆ GetStoppingValue()

double itk::simple::FastMarchingImageFilter::GetStoppingValue ( ) const
inline

Get the Fast Marching algorithm Stopping Value.

Definition at line 116 of file sitkFastMarchingImageFilter.h.

◆ GetTrialPoints()

std::vector< std::vector< unsigned int > > itk::simple::FastMarchingImageFilter::GetTrialPoints ( ) const
inline

Get the container of Trial Points representing the initial front.

Definition at line 91 of file sitkFastMarchingImageFilter.h.

◆ SetInitialTrialValues()

Self& itk::simple::FastMarchingImageFilter::SetInitialTrialValues ( std::vector< double >  InitialTrialValues)
inline

Set the initial seed values for corresponding trial points.

Definition at line 121 of file sitkFastMarchingImageFilter.h.

◆ SetNormalizationFactor()

Self& itk::simple::FastMarchingImageFilter::SetNormalizationFactor ( double  NormalizationFactor)
inline

Set/Get the Normalization Factor for the Speed Image . The values in the Speed Image is divided by this factor. This allows the use of images with integer pixel types to represent the speed.

Definition at line 101 of file sitkFastMarchingImageFilter.h.

◆ SetStoppingValue()

Self& itk::simple::FastMarchingImageFilter::SetStoppingValue ( double  StoppingValue)
inline

Set the Fast Marching algorithm Stopping Value. The Fast Marching algorithm is terminated when the value of the smallest trial point is greater than the stopping value.

Examples
FastMarchingSegmentation/FastMarchingSegmentation.cxx.

Definition at line 111 of file sitkFastMarchingImageFilter.h.

◆ SetTrialPoints()

Self& itk::simple::FastMarchingImageFilter::SetTrialPoints ( std::vector< std::vector< unsigned int > >  TrialPoints)
inline

Set the container of Trial Points representing the initial front. Trial points are represented as a VectorContainer of LevelSetNodes.

Definition at line 86 of file sitkFastMarchingImageFilter.h.

◆ ToString()

std::string itk::simple::FastMarchingImageFilter::ToString ( ) const
virtual

Print ourselves out

Reimplemented from itk::simple::ProcessObject.

Friends And Related Function Documentation

◆ detail::MemberFunctionAddressor< MemberFunctionType >

Definition at line 146 of file sitkFastMarchingImageFilter.h.

Member Data Documentation

◆ m_InitialTrialValues

std::vector<double> itk::simple::FastMarchingImageFilter::m_InitialTrialValues {std::vector<double>()}
private

Definition at line 157 of file sitkFastMarchingImageFilter.h.

◆ m_MemberFactory

std::unique_ptr<detail::MemberFunctionFactory<MemberFunctionType> > itk::simple::FastMarchingImageFilter::m_MemberFactory
private

Definition at line 148 of file sitkFastMarchingImageFilter.h.

◆ m_NormalizationFactor

double itk::simple::FastMarchingImageFilter::m_NormalizationFactor {1.0}
private

Definition at line 153 of file sitkFastMarchingImageFilter.h.

◆ m_StoppingValue

double itk::simple::FastMarchingImageFilter::m_StoppingValue {std::numeric_limits<double>::max()/2.0}
private

Definition at line 155 of file sitkFastMarchingImageFilter.h.

◆ m_TrialPoints

std::vector< std::vector<unsigned int> > itk::simple::FastMarchingImageFilter::m_TrialPoints {std::vector< std::vector<unsigned int > >()}
private

Definition at line 151 of file sitkFastMarchingImageFilter.h.


The documentation for this class was generated from the following file: