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

Wraps itk::FastMarchingUpwindGradientImageFilter. More...

#include <vtkvmtkFastMarchingUpwindGradientImageFilter.h>

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

Public Types

enum  { ONE_TARGET , ALL_TARGETS , NO_TARGETS }
typedef vtkSimpleImageToImageFilter Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkFastMarchingUpwindGradientImageFilter * NewInstance () const
void SetTargetReachedModeToOneTarget ()
void SetTargetReachedModeToAllTargets ()
void SetTargetReachedModeToNoTargets ()
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 vtkvmtkFastMarchingUpwindGradientImageFilter * New ()
static int IsTypeOf (const char *type)
static vtkvmtkFastMarchingUpwindGradientImageFilter * SafeDownCast (vtkObjectBase *o)

Protected Member Functions

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

Detailed Description

Wraps itk::FastMarchingUpwindGradientImageFilter.

vtkvmtkFastMarchingUpwindGradientImageFilter runs a fast marching front propagation, on the (internally float-cast, assumed 3D) input speed image, starting from the point ids listed in Seeds and outputs the front arrival time at every voxel (and, if GenerateGradientImage is on, the gradient of the arrival time field). Front propagation can be stopped early once one/all of the point ids listed in Targets are reached, according to TargetReachedMode; after Update(), the arrival time at the (first reached) target is available via GetTargetValue. This is used by the vmtkimageinitialization pype script's fast-marching-based initialization method to build an initial level set: the arrival time image, shifted by (minus) the target value, has its zero level set passing through the target, giving a front that has grown outward from the seeds to reach it.

See also
vtkvmtkFastMarchingDirectionalFreezeImageFilter, vtkvmtkCollidingFrontsImageFilter

Definition at line 47 of file vtkvmtkFastMarchingUpwindGradientImageFilter.h.

Member Typedef Documentation

◆ Superclass

Member Enumeration Documentation

◆ anonymous enum

Constructor & Destructor Documentation

◆ vtkvmtkFastMarchingUpwindGradientImageFilter()

vtkvmtkFastMarchingUpwindGradientImageFilter::vtkvmtkFastMarchingUpwindGradientImageFilter ( )
protected

Definition at line 35 of file vtkvmtkFastMarchingUpwindGradientImageFilter.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}

◆ ~vtkvmtkFastMarchingUpwindGradientImageFilter()

vtkvmtkFastMarchingUpwindGradientImageFilter::~vtkvmtkFastMarchingUpwindGradientImageFilter ( )
protected

Definition at line 45 of file vtkvmtkFastMarchingUpwindGradientImageFilter.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()

vtkvmtkFastMarchingUpwindGradientImageFilter * vtkvmtkFastMarchingUpwindGradientImageFilter::New ( )
static

◆ IsTypeOf()

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

◆ IsA()

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

◆ SafeDownCast()

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

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkFastMarchingUpwindGradientImageFilter::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkFastMarchingUpwindGradientImageFilter * vtkvmtkFastMarchingUpwindGradientImageFilter::NewInstance ( ) const

◆ GetGenerateGradientImage()

virtual int vtkvmtkFastMarchingUpwindGradientImageFilter::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 vtkvmtkFastMarchingUpwindGradientImageFilter::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 vtkvmtkFastMarchingUpwindGradientImageFilter::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 vtkvmtkFastMarchingUpwindGradientImageFilter::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 vtkvmtkFastMarchingUpwindGradientImageFilter::GetTargetReachedMode ( )
virtual

Set/get the criterion used to decide when front propagation towards Targets should stop: one of ONE_TARGET (stop as soon as any target is reached), ALL_TARGETS (stop only once every target has been reached), or NO_TARGETS (ignore Targets and propagate over the whole image). Use SetTargetReachedModeToOneTarget/ToAllTargets/ToNoTargets for the equivalent named setters. Default: ONE_TARGET.

◆ SetTargetReachedMode()

virtual void vtkvmtkFastMarchingUpwindGradientImageFilter::SetTargetReachedMode ( int )
virtual

Set/get the criterion used to decide when front propagation towards Targets should stop: one of ONE_TARGET (stop as soon as any target is reached), ALL_TARGETS (stop only once every target has been reached), or NO_TARGETS (ignore Targets and propagate over the whole image). Use SetTargetReachedModeToOneTarget/ToAllTargets/ToNoTargets for the equivalent named setters. Default: ONE_TARGET.

◆ SetTargetReachedModeToOneTarget()

void vtkvmtkFastMarchingUpwindGradientImageFilter::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 vtkvmtkFastMarchingUpwindGradientImageFilter.h.

◆ SetTargetReachedModeToAllTargets()

void vtkvmtkFastMarchingUpwindGradientImageFilter::SetTargetReachedModeToAllTargets ( )
inline

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

Definition at line 88 of file vtkvmtkFastMarchingUpwindGradientImageFilter.h.

89 {
91 }

◆ SetTargetReachedModeToNoTargets()

void vtkvmtkFastMarchingUpwindGradientImageFilter::SetTargetReachedModeToNoTargets ( )
inline

Set TargetReachedMode to NO_TARGETS: Targets is ignored and the front propagates over the whole image.

Definition at line 97 of file vtkvmtkFastMarchingUpwindGradientImageFilter.h.

98 {
100 }

◆ GetTargetValue()

virtual double vtkvmtkFastMarchingUpwindGradientImageFilter::GetTargetValue ( )
virtual

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

◆ GetTargetOffset()

virtual double vtkvmtkFastMarchingUpwindGradientImageFilter::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 vtkvmtkFastMarchingUpwindGradientImageFilter::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 vtkvmtkFastMarchingUpwindGradientImageFilter::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 * vtkvmtkFastMarchingUpwindGradientImageFilter::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 vtkvmtkFastMarchingUpwindGradientImageFilter::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 * vtkvmtkFastMarchingUpwindGradientImageFilter::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 vtkvmtkFastMarchingUpwindGradientImageFilter::SimpleExecute ( vtkImageData * input,
vtkImageData * output )
overrideprotectedvirtual

Definition at line 59 of file vtkvmtkFastMarchingUpwindGradientImageFilter.cxx.

60{
61 typedef itk::Image<float,3> ImageType;
62
63 ImageType::Pointer inImage = ImageType::New();
64
66
67 typedef itk::FastMarchingUpwindGradientImageFilter<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: