SimpleITK  
itk::simple::WarpImageFilter Class Reference

Warps an image using an input displacement field. More...

#include <sitkWarpImageFilter.h>

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

Detailed Description

Warps an image using an input displacement field.

WarpImageFilter warps an existing image with respect to a given displacement field.

A displacement field is represented as a image whose pixel type is some vector type with at least N elements, where N is the dimension of the input image. The vector type must support element access via operator [].

The output image is produced by inverse mapping: the output pixels are mapped back onto the input image. This scheme avoids the creation of any holes and overlaps in the output image.

Each vector in the displacement field represent the distance between a geometric point in the input space and a point in the output space such that:

\[ p_{in} = p_{out} + d \]

Typically the mapped position does not correspond to an integer pixel position in the input image. Interpolation via an image function is used to compute values at non-integer positions. The default interpolation typed used is the LinearInterpolateImageFunction . The user can specify a particular interpolation function via SetInterpolator() . Note that the input interpolator must derive from base class InterpolateImageFunction .

Position mapped to outside of the input image buffer are assigned a edge padding value.

The LargestPossibleRegion for the output is inherited from the input displacement field. The output image spacing, origin and orientation may be set via SetOutputSpacing, SetOutputOrigin and SetOutputDirection. The default are respectively a vector of 1's, a vector of 0's and an identity matrix.

This class is templated over the type of the input image, the type of the output image and the type of the displacement field.

The input image is set via SetInput. The input displacement field is set via SetDisplacementField.

This filter is implemented as a multithreaded filter.

Warning
This filter assumes that the input type, output type and displacement field type all have the same number of dimensions.
See also
itk::simple::Warp for the procedural interface
itk::WarpImageFilter for the Doxygen on the original ITK class.

Definition at line 76 of file sitkWarpImageFilter.h.

Public Types

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

Public Member Functions

Image Execute (const Image &image, const Image &displacementField)
 
double GetEdgePaddingValue () const
 
InterpolatorEnum GetInterpolator () const
 
std::string GetName () const
 
std::vector< double > GetOutputDirection () const
 
std::vector< double > GetOutputOrigin () const
 
std::vector< uint32_t > GetOutputSize () const
 
std::vector< double > GetOutputSpacing () const
 
void SetEdgePaddingValue (double EdgePaddingValue)
 
void SetInterpolator (InterpolatorEnum Interpolator)
 
void SetOutputDirection (std::vector< double > OutputDirection)
 
void SetOutputOrigin (std::vector< double > OutputOrigin)
 
void SetOutputParameteresFromImage (const Image &refImage)
 
void SetOutputSize (std::vector< uint32_t > OutputSize)
 
void SetOutputSpacing (std::vector< double > OutputSpacing)
 
std::string ToString () const
 
 WarpImageFilter ()
 
virtual ~WarpImageFilter ()
 
- 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.
 
virtual int AddCommand (itk::simple::EventEnum event, itk::simple::Command &cmd)
 Add a Command Object to observer the event.
 
virtual float GetProgress () const
 An Active Measurement of the progress of execution.
 
virtual bool HasCommand (itk::simple::EventEnum event) const
 Query of this object has any registered commands for event.
 
 ProcessObject ()
 
virtual void RemoveAllCommands ()
 Remove all registered commands.
 
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
 

Private Member Functions

template<class TImageType1, class TImageType2>
Image DualExecuteInternal (const Image *image, const Image *displacementField)
 
template<class TImageType1, class TImageType2>
Image DualExecuteInternalVector (const Image *image, const Image *displacementField)
 

Static Private Member Functions

static const detail::DualMemberFunctionFactory< MemberFunctionType > & GetMemberFunctionFactory ()
 

Private Attributes

double m_EdgePaddingValue { 0.0 }
 
InterpolatorEnum m_Interpolator { itk::simple::sitkLinear }
 
std::vector< double > m_OutputDirection { std::vector<double>() }
 
std::vector< double > m_OutputOrigin { std::vector<double>(3, 0.0) }
 
std::vector< uint32_t > m_OutputSize { std::vector<uint32_t>(3, 0) }
 
std::vector< double > m_OutputSpacing { std::vector<double>(3, 1.0) }
 

Friends

struct detail::DualExecuteInternalAddressor< MemberFunctionType >
 
struct detail::DualExecuteInternalVectorAddressor< 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.
 
static void SetGlobalDefaultCoordinateTolerance (double)
 Access the global tolerance to determine congruent spaces.
 
static double GetGlobalDefaultDirectionTolerance ()
 Access the global tolerance to determine congruent spaces.
 
static void SetGlobalDefaultDirectionTolerance (double)
 Access the global tolerance to determine congruent spaces.
 
static bool SetGlobalDefaultThreader (const std::string &threader)
 Set/Get the default threader used for process objects.
 
static std::string GetGlobalDefaultThreader ()
 Set/Get the default threader used for process objects.
 
static void SetGlobalDefaultNumberOfThreads (unsigned int n)
 
static unsigned int GetGlobalDefaultNumberOfThreads ()
 Set/Get the default threader used for process objects.
 
- 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

Initial value:
Image (Self::*)(const Image *
image, const Image *
displacementField)
The Image class for SimpleITK.
Definition sitkImage.h:77

Setup for member function dispatching

Definition at line 189 of file sitkWarpImageFilter.h.

◆ PixelIDTypeList

Define the pixels types supported by this filter

Definition at line 88 of file sitkWarpImageFilter.h.

◆ Self

Constructor & Destructor Documentation

◆ ~WarpImageFilter()

virtual itk::simple::WarpImageFilter::~WarpImageFilter ( )
virtual

Destructor

◆ WarpImageFilter()

itk::simple::WarpImageFilter::WarpImageFilter ( )

Default Constructor that takes no arguments and initializes default parameters

Member Function Documentation

◆ DualExecuteInternal()

template<class TImageType1, class TImageType2>
Image itk::simple::WarpImageFilter::DualExecuteInternal ( const Image * image,
const Image * displacementField )
private

◆ DualExecuteInternalVector()

template<class TImageType1, class TImageType2>
Image itk::simple::WarpImageFilter::DualExecuteInternalVector ( const Image * image,
const Image * displacementField )
private

◆ Execute()

Image itk::simple::WarpImageFilter::Execute ( const Image & image,
const Image & displacementField )

Execute the filter on the input image

◆ GetEdgePaddingValue()

double itk::simple::WarpImageFilter::GetEdgePaddingValue ( ) const
inline

Get the edge padding value

Definition at line 168 of file sitkWarpImageFilter.h.

References m_EdgePaddingValue.

◆ GetInterpolator()

InterpolatorEnum itk::simple::WarpImageFilter::GetInterpolator ( ) const
inline

Get/Set the interpolator function.

Definition at line 103 of file sitkWarpImageFilter.h.

References m_Interpolator.

◆ GetMemberFunctionFactory()

static const detail::DualMemberFunctionFactory< MemberFunctionType > & itk::simple::WarpImageFilter::GetMemberFunctionFactory ( )
staticprivate

◆ GetName()

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

Name of this class

Implements itk::simple::ProcessObject.

Definition at line 172 of file sitkWarpImageFilter.h.

◆ GetOutputDirection()

std::vector< double > itk::simple::WarpImageFilter::GetOutputDirection ( ) const
inline

Set/Get the direction (orientation) of the output image

Definition at line 155 of file sitkWarpImageFilter.h.

References m_OutputDirection.

◆ GetOutputOrigin()

std::vector< double > itk::simple::WarpImageFilter::GetOutputOrigin ( ) const
inline

Get the output image origin.

Definition at line 129 of file sitkWarpImageFilter.h.

References m_OutputOrigin.

◆ GetOutputSize()

std::vector< uint32_t > itk::simple::WarpImageFilter::GetOutputSize ( ) const
inline

Get the size of the output image.

Definition at line 116 of file sitkWarpImageFilter.h.

References m_OutputSize.

◆ GetOutputSpacing()

std::vector< double > itk::simple::WarpImageFilter::GetOutputSpacing ( ) const
inline

Get the output image spacing.

Definition at line 142 of file sitkWarpImageFilter.h.

References m_OutputSpacing.

◆ SetEdgePaddingValue()

void itk::simple::WarpImageFilter::SetEdgePaddingValue ( double EdgePaddingValue)
inline

Set the edge padding value

Definition at line 162 of file sitkWarpImageFilter.h.

References m_EdgePaddingValue.

◆ SetInterpolator()

void itk::simple::WarpImageFilter::SetInterpolator ( InterpolatorEnum Interpolator)
inline

Get/Set the interpolator function.

Definition at line 97 of file sitkWarpImageFilter.h.

References m_Interpolator.

◆ SetOutputDirection()

void itk::simple::WarpImageFilter::SetOutputDirection ( std::vector< double > OutputDirection)
inline

Set/Get the direction (orientation) of the output image

Definition at line 149 of file sitkWarpImageFilter.h.

References m_OutputDirection.

◆ SetOutputOrigin()

void itk::simple::WarpImageFilter::SetOutputOrigin ( std::vector< double > OutputOrigin)
inline

Set the output image origin.

Definition at line 123 of file sitkWarpImageFilter.h.

References m_OutputOrigin.

◆ SetOutputParameteresFromImage()

void itk::simple::WarpImageFilter::SetOutputParameteresFromImage ( const Image & refImage)

This methods sets the output size, origin, spacing and direction to that of the provided image

Referenced by detail::DualExecuteInternalAddressor< MemberFunctionType >.

◆ SetOutputSize()

void itk::simple::WarpImageFilter::SetOutputSize ( std::vector< uint32_t > OutputSize)
inline

Set the size of the output image.

Definition at line 110 of file sitkWarpImageFilter.h.

References m_OutputSize.

◆ SetOutputSpacing()

void itk::simple::WarpImageFilter::SetOutputSpacing ( std::vector< double > OutputSpacing)
inline

Set the output image spacing.

Definition at line 136 of file sitkWarpImageFilter.h.

References m_OutputSpacing.

◆ ToString()

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

Print ourselves out

Reimplemented from itk::simple::ProcessObject.

Friends And Related Symbol Documentation

◆ detail::DualExecuteInternalAddressor< MemberFunctionType >

◆ detail::DualExecuteInternalVectorAddressor< MemberFunctionType >

Definition at line 194 of file sitkWarpImageFilter.h.

References DualExecuteInternal().

Member Data Documentation

◆ m_EdgePaddingValue

double itk::simple::WarpImageFilter::m_EdgePaddingValue { 0.0 }
private

Definition at line 219 of file sitkWarpImageFilter.h.

Referenced by GetEdgePaddingValue(), and SetEdgePaddingValue().

◆ m_Interpolator

InterpolatorEnum itk::simple::WarpImageFilter::m_Interpolator { itk::simple::sitkLinear }
private

Definition at line 208 of file sitkWarpImageFilter.h.

Referenced by GetInterpolator(), and SetInterpolator().

◆ m_OutputDirection

std::vector<double> itk::simple::WarpImageFilter::m_OutputDirection { std::vector<double>() }
private

Definition at line 217 of file sitkWarpImageFilter.h.

Referenced by GetOutputDirection(), and SetOutputDirection().

◆ m_OutputOrigin

std::vector<double> itk::simple::WarpImageFilter::m_OutputOrigin { std::vector<double>(3, 0.0) }
private

Definition at line 212 of file sitkWarpImageFilter.h.

Referenced by GetOutputOrigin(), and SetOutputOrigin().

◆ m_OutputSize

std::vector<uint32_t> itk::simple::WarpImageFilter::m_OutputSize { std::vector<uint32_t>(3, 0) }
private

Definition at line 210 of file sitkWarpImageFilter.h.

Referenced by GetOutputSize(), and SetOutputSize().

◆ m_OutputSpacing

std::vector<double> itk::simple::WarpImageFilter::m_OutputSpacing { std::vector<double>(3, 1.0) }
private

Definition at line 214 of file sitkWarpImageFilter.h.

Referenced by GetOutputSpacing(), and SetOutputSpacing().


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