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

Apply a sigmoid function to every voxel of an image. More...

#include <vtkvmtkLevelSetSigmoidFilter.h>

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

Public Types

typedef vtkSimpleImageToImageFilter Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkLevelSetSigmoidFilter * NewInstance () const
void PrintSelf (std::ostream &os, vtkIndent indent) override
virtual void SetLevelSetsImage (vtkImageData *)
virtual vtkImageData * GetLevelSetsImage ()
virtual void SetSigma (double)
virtual double GetSigma ()
virtual void SetScaleValue (double)
virtual double GetScaleValue ()
virtual void SetComputeScaleValueFromInput (int)
virtual int GetComputeScaleValueFromInput ()
virtual void ComputeScaleValueFromInputOn ()
virtual void ComputeScaleValueFromInputOff ()

Static Public Member Functions

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

Protected Member Functions

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

Protected Attributes

vtkImageData * LevelSetsImage
double Sigma
double ScaleValue
int ComputeScaleValueFromInput

Detailed Description

Apply a sigmoid function to every voxel of an image.

For every voxel whose value in LevelSetsImage (typically a signed distance / level set image computed from a preliminary segmentation) is below a small fixed window (4 voxel-spacing units), this filter adds a sigmoid-shaped correction to the corresponding input feature image value; the correction is centered on the LevelSetsImage zero level set with width controlled by Sigma (in voxel units) and height controlled by ScaleValue (or, if ComputeScaleValueFromInput is on, by the mean of the input image). Voxels farther from the level set are left unchanged.

This is primarily used in feature image correction (see http://vmtk.github.io/tutorials/ImageFeatureCorrection.html for details), where it locally boosts the speed/feature image near a preliminary level set front so that a subsequent level set evolution is encouraged to settle more precisely on the true boundary.

Definition at line 41 of file vtkvmtkLevelSetSigmoidFilter.h.

Member Typedef Documentation

◆ Superclass

typedef vtkSimpleImageToImageFilter vtkvmtkLevelSetSigmoidFilter::Superclass

Definition at line 44 of file vtkvmtkLevelSetSigmoidFilter.h.

Constructor & Destructor Documentation

◆ vtkvmtkLevelSetSigmoidFilter()

vtkvmtkLevelSetSigmoidFilter::vtkvmtkLevelSetSigmoidFilter ( )
protected

◆ ~vtkvmtkLevelSetSigmoidFilter()

vtkvmtkLevelSetSigmoidFilter::~vtkvmtkLevelSetSigmoidFilter ( )
protected

Definition at line 43 of file vtkvmtkLevelSetSigmoidFilter.cxx.

44{
45 if (this->LevelSetsImage)
46 {
47 this->LevelSetsImage->Delete();
48 this->LevelSetsImage = NULL;
49 }
50}

Member Function Documentation

◆ IsTypeOf()

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

◆ IsA()

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

◆ SafeDownCast()

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

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkLevelSetSigmoidFilter::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkLevelSetSigmoidFilter * vtkvmtkLevelSetSigmoidFilter::NewInstance ( ) const

◆ PrintSelf()

void vtkvmtkLevelSetSigmoidFilter::PrintSelf ( std::ostream & os,
vtkIndent indent )
override

Definition at line 109 of file vtkvmtkLevelSetSigmoidFilter.cxx.

110{
111 this->Superclass::PrintSelf(os,indent);
112}

◆ New()

vtkvmtkLevelSetSigmoidFilter * vtkvmtkLevelSetSigmoidFilter::New ( )
static

◆ SetLevelSetsImage()

virtual void vtkvmtkLevelSetSigmoidFilter::SetLevelSetsImage ( vtkImageData * )
virtual

Set/Get the level set (signed distance) image whose zero level set defines the front around which the sigmoid correction is applied to the input feature image. Required before SimpleExecute is called.

◆ GetLevelSetsImage()

virtual vtkImageData * vtkvmtkLevelSetSigmoidFilter::GetLevelSetsImage ( )
virtual

Set/Get the level set (signed distance) image whose zero level set defines the front around which the sigmoid correction is applied to the input feature image. Required before SimpleExecute is called.

◆ SetSigma()

virtual void vtkvmtkLevelSetSigmoidFilter::SetSigma ( double )
virtual

Set/Get the sigma value of the sigmoid function. Sigma determines the width of the sigmoid function. The value is given in pixel (voxel spacing) units. Default: 1.0.

◆ GetSigma()

virtual double vtkvmtkLevelSetSigmoidFilter::GetSigma ( )
virtual

Set/Get the sigma value of the sigmoid function. Sigma determines the width of the sigmoid function. The value is given in pixel (voxel spacing) units. Default: 1.0.

◆ SetScaleValue()

virtual void vtkvmtkLevelSetSigmoidFilter::SetScaleValue ( double )
virtual

Set/Get the Scalevalue of the sigmoind function. This determines the height of the sigmoid.

◆ GetScaleValue()

virtual double vtkvmtkLevelSetSigmoidFilter::GetScaleValue ( )
virtual

Set/Get the Scalevalue of the sigmoind function. This determines the height of the sigmoid.

◆ SetComputeScaleValueFromInput()

virtual void vtkvmtkLevelSetSigmoidFilter::SetComputeScaleValueFromInput ( int )
virtual

Set/Get The the ComputeScaleValueFromInput option. When enabled, vmtkimagefeaturecorrection computes the mean value from the featureimage and uses this value to set the height of the sigmoid function instead of the value given to the option scalevalue.

◆ GetComputeScaleValueFromInput()

virtual int vtkvmtkLevelSetSigmoidFilter::GetComputeScaleValueFromInput ( )
virtual

Set/Get The the ComputeScaleValueFromInput option. When enabled, vmtkimagefeaturecorrection computes the mean value from the featureimage and uses this value to set the height of the sigmoid function instead of the value given to the option scalevalue.

◆ ComputeScaleValueFromInputOn()

virtual void vtkvmtkLevelSetSigmoidFilter::ComputeScaleValueFromInputOn ( )
virtual

Set/Get The the ComputeScaleValueFromInput option. When enabled, vmtkimagefeaturecorrection computes the mean value from the featureimage and uses this value to set the height of the sigmoid function instead of the value given to the option scalevalue.

◆ ComputeScaleValueFromInputOff()

virtual void vtkvmtkLevelSetSigmoidFilter::ComputeScaleValueFromInputOff ( )
virtual

Set/Get The the ComputeScaleValueFromInput option. When enabled, vmtkimagefeaturecorrection computes the mean value from the featureimage and uses this value to set the height of the sigmoid function instead of the value given to the option scalevalue.

◆ SimpleExecute()

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

Definition at line 52 of file vtkvmtkLevelSetSigmoidFilter.cxx.

53{
54 if (!this->LevelSetsImage)
55 {
56 vtkErrorMacro(<<"Error: no LevelSetsImage has been set!");
57 return;
58 }
59
60 vtkDataArray* inputScalars = input->GetPointData()->GetScalars();
61 vtkDataArray* levelSetsScalars = this->LevelSetsImage->GetPointData()->GetScalars();
62 vtkDataArray* outputScalars = output->GetPointData()->GetScalars();
63
64 double spacing[3];
65 input->GetSpacing(spacing);
66
67 double minSpacing = spacing[0];
68 if (spacing[1] < minSpacing)
69 {
70 minSpacing = spacing[1];
71 }
72 if (spacing[2] < minSpacing)
73 {
74 minSpacing = spacing[2];
75 }
76
77 double windowValue = 4.0;
78 double windowValueReal = windowValue * minSpacing;
79 double sigmaReal = this->Sigma * minSpacing;
80
81 double scaleValue = this->ScaleValue;
82
83 int numberOfPoints = input->GetNumberOfPoints();
84
85 int i;
87 {
88 scaleValue = 0.0;
89 for (i=0; i<numberOfPoints; i++)
90 {
91 scaleValue += inputScalars->GetComponent(i,0);
92 }
93 scaleValue /= numberOfPoints;
94 }
95
96 for (i=0; i<numberOfPoints; i++)
97 {
98 double featureValue = inputScalars->GetComponent(i,0);
99 double levelSetsValue = levelSetsScalars->GetComponent(i,0);
100 if (levelSetsValue < windowValueReal)
101 {
102 double sigmoidValue = scaleValue * 1.0 / (1.0 + std::exp((levelSetsValue-sigmaReal)/(0.5*sigmaReal)));
103 featureValue += sigmoidValue;
104 }
105 outputScalars->SetComponent(i,0,featureValue);
106 }
107}

Member Data Documentation

◆ LevelSetsImage

vtkImageData* vtkvmtkLevelSetSigmoidFilter::LevelSetsImage
protected

Definition at line 93 of file vtkvmtkLevelSetSigmoidFilter.h.

◆ Sigma

double vtkvmtkLevelSetSigmoidFilter::Sigma
protected

Definition at line 95 of file vtkvmtkLevelSetSigmoidFilter.h.

◆ ScaleValue

double vtkvmtkLevelSetSigmoidFilter::ScaleValue
protected

Definition at line 96 of file vtkvmtkLevelSetSigmoidFilter.h.

◆ ComputeScaleValueFromInput

int vtkvmtkLevelSetSigmoidFilter::ComputeScaleValueFromInput
protected

Definition at line 97 of file vtkvmtkLevelSetSigmoidFilter.h.


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