VMTK
Loading...
Searching...
No Matches
vtkvmtkFastMarchingDirectionalFreezeImageFilter Class Reference

Wraps itk::FastMarchingDirectionalFreezeImageFilter. More...

#include <vtkvmtkFastMarchingDirectionalFreezeImageFilter.h>

Inheritance diagram for vtkvmtkFastMarchingDirectionalFreezeImageFilter:
[legend]
Collaboration diagram for vtkvmtkFastMarchingDirectionalFreezeImageFilter:
[legend]

Public Types

enum  { ONE_TARGET , ALL_TARGETS }
typedef vtkSimpleImageToImageFilter Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkFastMarchingDirectionalFreezeImageFilter * NewInstance () const
void SetTargetReachedModeToOneTarget ()
void SetTargetReachedModeToAllTargets ()
virtual double GetTargetValue ()
virtual int GetGenerateGradientImage ()
virtual void SetGenerateGradientImage (int)
virtual void GenerateGradientImageOn ()
virtual void GenerateGradientImageOff ()
virtual int GetTargetReachedMode ()
virtual void SetTargetReachedMode (int)
virtual double GetTargetOffset ()
virtual void SetTargetOffset (double)
virtual void SetSeeds (vtkIdList *)
virtual vtkIdList * GetSeeds ()
virtual void SetTargets (vtkIdList *)
virtual vtkIdList * GetTargets ()

Static Public Member Functions

static vtkvmtkFastMarchingDirectionalFreezeImageFilter * New ()
static int IsTypeOf (const char *type)
static vtkvmtkFastMarchingDirectionalFreezeImageFilter * SafeDownCast (vtkObjectBase *o)

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 vtkvmtkFastMarchingDirectionalFreezeImageFilter ()
 ~vtkvmtkFastMarchingDirectionalFreezeImageFilter ()
virtual void SimpleExecute (vtkImageData *input, vtkImageData *output) override

Detailed Description

Wraps itk::FastMarchingDirectionalFreezeImageFilter.

vtkvmtkFastMarchingDirectionalFreezeImageFilter runs a variant of fast marching front propagation (itk::FastMarchingDirectionalFreezeImageFilter, a subclass of itk::FastMarchingUpwindGradientImageFilter) on the (internally float-cast, assumed 3D) input speed image, starting from the point ids listed in Seeds, that additionally freezes points based on the relative direction of the propagating front and the gradient of the speed image – points where the front is moving against the speed gradient are frozen rather than accepted, preventing the front from propagating back into regions it has already effectively passed. As with the base fast marching filter, propagation can be stopped early once one/all of the point ids listed in Targets are reached (TargetReachedMode), and the arrival time at the reached target is retrievable via GetTargetValue after Update().

See also
vtkvmtkFastMarchingUpwindGradientImageFilter

Definition at line 48 of file vtkvmtkFastMarchingDirectionalFreezeImageFilter.h.

Member Typedef Documentation

◆ Superclass

Member Enumeration Documentation

◆ anonymous enum

Constructor & Destructor Documentation

◆ vtkvmtkFastMarchingDirectionalFreezeImageFilter()

vtkvmtkFastMarchingDirectionalFreezeImageFilter::vtkvmtkFastMarchingDirectionalFreezeImageFilter ( )
protected

Definition at line 35 of file vtkvmtkFastMarchingDirectionalFreezeImageFilter.cxx.

36{
37 this->GenerateGradientImage = 0;
38 this->TargetReachedMode = ONE_TARGET;
39 this->TargetValue = 0.0;
40 this->TargetOffset = 0.0;
41 this->Seeds = NULL;
42 this->Targets = NULL;
43}

◆ ~vtkvmtkFastMarchingDirectionalFreezeImageFilter()

vtkvmtkFastMarchingDirectionalFreezeImageFilter::~vtkvmtkFastMarchingDirectionalFreezeImageFilter ( )
protected

Definition at line 45 of file vtkvmtkFastMarchingDirectionalFreezeImageFilter.cxx.

46{
47 if (this->Seeds)
48 {
49 this->Seeds->Delete();
50 this->Seeds = NULL;
51 }
52 if (this->Targets)
53 {
54 this->Targets->Delete();
55 this->Targets = NULL;
56 }
57}

Member Function Documentation

◆ New()

vtkvmtkFastMarchingDirectionalFreezeImageFilter * vtkvmtkFastMarchingDirectionalFreezeImageFilter::New ( )
static

◆ IsTypeOf()

int vtkvmtkFastMarchingDirectionalFreezeImageFilter::IsTypeOf ( const char * type)
static

◆ IsA()

virtual int vtkvmtkFastMarchingDirectionalFreezeImageFilter::IsA ( const char * type)
virtual

◆ SafeDownCast()

vtkvmtkFastMarchingDirectionalFreezeImageFilter * vtkvmtkFastMarchingDirectionalFreezeImageFilter::SafeDownCast ( vtkObjectBase * o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkFastMarchingDirectionalFreezeImageFilter::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkFastMarchingDirectionalFreezeImageFilter * vtkvmtkFastMarchingDirectionalFreezeImageFilter::NewInstance ( ) const

◆ GetGenerateGradientImage()

virtual int vtkvmtkFastMarchingDirectionalFreezeImageFilter::GetGenerateGradientImage ( )
virtual

Toggle computation of the gradient of the arrival time image, in addition to the arrival time image itself. Default: off.

◆ SetGenerateGradientImage()

virtual void vtkvmtkFastMarchingDirectionalFreezeImageFilter::SetGenerateGradientImage ( int )
virtual

Toggle computation of the gradient of the arrival time image, in addition to the arrival time image itself. Default: off.

◆ GenerateGradientImageOn()

virtual void vtkvmtkFastMarchingDirectionalFreezeImageFilter::GenerateGradientImageOn ( )
virtual

Toggle computation of the gradient of the arrival time image, in addition to the arrival time image itself. Default: off.

◆ GenerateGradientImageOff()

virtual void vtkvmtkFastMarchingDirectionalFreezeImageFilter::GenerateGradientImageOff ( )
virtual

Toggle computation of the gradient of the arrival time image, in addition to the arrival time image itself. Default: off.

◆ GetTargetReachedMode()

virtual int vtkvmtkFastMarchingDirectionalFreezeImageFilter::GetTargetReachedMode ( )
virtual

Set/get the criterion used to decide when front propagation towards Targets should stop: either ONE_TARGET (stop as soon as any target is reached) or ALL_TARGETS (stop only once every target has been reached). Use SetTargetReachedModeToOneTarget/ToAllTargets for the equivalent named setters. Default: ONE_TARGET.

◆ SetTargetReachedMode()

virtual void vtkvmtkFastMarchingDirectionalFreezeImageFilter::SetTargetReachedMode ( int )
virtual

Set/get the criterion used to decide when front propagation towards Targets should stop: either ONE_TARGET (stop as soon as any target is reached) or ALL_TARGETS (stop only once every target has been reached). Use SetTargetReachedModeToOneTarget/ToAllTargets for the equivalent named setters. Default: ONE_TARGET.

◆ SetTargetReachedModeToOneTarget()

void vtkvmtkFastMarchingDirectionalFreezeImageFilter::SetTargetReachedModeToOneTarget ( )
inline

Set TargetReachedMode to ONE_TARGET: propagation stops as soon as any one of the Targets is reached.

Definition at line 79 of file vtkvmtkFastMarchingDirectionalFreezeImageFilter.h.

◆ SetTargetReachedModeToAllTargets()

void vtkvmtkFastMarchingDirectionalFreezeImageFilter::SetTargetReachedModeToAllTargets ( )
inline

Set TargetReachedMode to ALL_TARGETS: propagation stops only once every point in Targets has been reached.

Definition at line 88 of file vtkvmtkFastMarchingDirectionalFreezeImageFilter.h.

89 {
91 }

◆ GetTargetValue()

virtual double vtkvmtkFastMarchingDirectionalFreezeImageFilter::GetTargetValue ( )
virtual

Get the front arrival time at the target reached according to TargetReachedMode. Valid only after Update() has been called.

◆ GetTargetOffset()

virtual double vtkvmtkFastMarchingDirectionalFreezeImageFilter::GetTargetOffset ( )
virtual

Set/get an offset added to (subtracted from, per ITK's convention) the stopping value used when checking whether Targets have been reached, allowing the front to overshoot the target slightly. Default: 0.0.

◆ SetTargetOffset()

virtual void vtkvmtkFastMarchingDirectionalFreezeImageFilter::SetTargetOffset ( double )
virtual

Set/get an offset added to (subtracted from, per ITK's convention) the stopping value used when checking whether Targets have been reached, allowing the front to overshoot the target slightly. Default: 0.0.

◆ SetSeeds()

virtual void vtkvmtkFastMarchingDirectionalFreezeImageFilter::SetSeeds ( vtkIdList * )
virtual

Set/get the point ids (into the input image's points) of the seeds from which the front starts propagating (fast marching trial points).

◆ GetSeeds()

virtual vtkIdList * vtkvmtkFastMarchingDirectionalFreezeImageFilter::GetSeeds ( )
virtual

Set/get the point ids (into the input image's points) of the seeds from which the front starts propagating (fast marching trial points).

◆ SetTargets()

virtual void vtkvmtkFastMarchingDirectionalFreezeImageFilter::SetTargets ( vtkIdList * )
virtual

Set/get the point ids (into the input image's points) of the target points used, together with TargetReachedMode, to decide when front propagation stops.

◆ GetTargets()

virtual vtkIdList * vtkvmtkFastMarchingDirectionalFreezeImageFilter::GetTargets ( )
virtual

Set/get the point ids (into the input image's points) of the target points used, together with TargetReachedMode, to decide when front propagation stops.

◆ SimpleExecute()

void vtkvmtkFastMarchingDirectionalFreezeImageFilter::SimpleExecute ( vtkImageData * input,
vtkImageData * output )
overrideprotectedvirtual

Definition at line 59 of file vtkvmtkFastMarchingDirectionalFreezeImageFilter.cxx.

60{
61 typedef itk::Image<float,3> ImageType;
62
63 ImageType::Pointer inImage = ImageType::New();
64
66
67 typedef itk::FastMarchingDirectionalFreezeImageFilter<ImageType,ImageType> FastMarchingFilterType;
68
69 FastMarchingFilterType::Pointer fastMarchingFilter = FastMarchingFilterType::New();
70 fastMarchingFilter->SetInput(inImage);
71 fastMarchingFilter->SetGenerateGradientImage(this->GenerateGradientImage);
72 fastMarchingFilter->SetTargetOffset(this->TargetOffset);
73 if (this->TargetReachedMode == ONE_TARGET)
74 {
75 fastMarchingFilter->SetTargetReachedMode(FastMarchingFilterType::OneTarget);
76 }
77 else
78 {
79 fastMarchingFilter->SetTargetReachedMode(FastMarchingFilterType::AllTargets);
80 }
81
82 FastMarchingFilterType::NodeContainerPointer seeds = FastMarchingFilterType::NodeContainer::New();
83 int i;
84 for (i=0; i<this->Seeds->GetNumberOfIds(); i++)
85 {
86 // TODO: here we get the point. We should get the cell center instead.
87 ImageType::PointType seedPoint(input->GetPoint(this->Seeds->GetId(i)));
88#if (ITK_VERSION_MAJOR >= 5)
89 FastMarchingFilterType::NodeType::IndexType seedIndex = inImage->TransformPhysicalPointToIndex(seedPoint);
90#else
91 FastMarchingFilterType::NodeType::IndexType seedIndex;
92 inImage->TransformPhysicalPointToIndex(seedPoint,seedIndex);
93#endif
94 FastMarchingFilterType::PixelType seedValue = itk::NumericTraits<FastMarchingFilterType::PixelType>::Zero;
95 FastMarchingFilterType::NodeType seed;
96 seed.SetValue(seedValue);
97 seed.SetIndex(seedIndex);
98 seeds->InsertElement(i,seed);
99 }
100 fastMarchingFilter->SetTrialPoints(seeds);
101
102 FastMarchingFilterType::NodeContainerPointer targets = FastMarchingFilterType::NodeContainer::New();
103 for (i=0; i<this->Targets->GetNumberOfIds(); i++)
104 {
105 // TODO: here we get the point. We should get the cell center instead.
106 ImageType::PointType seedPoint(input->GetPoint(this->Targets->GetId(i)));
107#if (ITK_VERSION_MAJOR >= 5)
108 FastMarchingFilterType::NodeType::IndexType seedIndex = inImage->TransformPhysicalPointToIndex(seedPoint);
109#else
110 FastMarchingFilterType::NodeType::IndexType seedIndex;
111 inImage->TransformPhysicalPointToIndex(seedPoint,seedIndex);
112#endif
113 FastMarchingFilterType::PixelType seedValue = itk::NumericTraits<FastMarchingFilterType::PixelType>::Zero;
114 FastMarchingFilterType::NodeType seed;
115 seed.SetValue(seedValue);
116 seed.SetIndex(seedIndex);
117 targets->InsertElement(i,seed);
118 }
119 fastMarchingFilter->SetTargetPoints(targets);
120 fastMarchingFilter->Update();
121
122 this->TargetValue = fastMarchingFilter->GetTargetValue();
123
124 vtkvmtkITKFilterUtilities::ITKToVTKImage<ImageType>(fastMarchingFilter->GetOutput(),output);
125}
static void ITKToVTKImage(typename TImage::Pointer input, vtkImageData *output)
static void VTKToITKImage(vtkImageData *input, typename TImage::Pointer output)

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