SimpleITK
|
Warps an image using an input displacement field. More...
#include <sitkWarpImageFilter.h>
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.
Definition at line 64 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 |
Self & | SetEdgePaddingValue (double EdgePaddingValue) |
Self & | SetInterpolator (InterpolatorEnum Interpolator) |
Self & | SetOutputDirection (std::vector< double > OutputDirection) |
Self & | SetOutputOrigin (std::vector< double > OutputOrigin) |
void | SetOutputParameteresFromImage (const Image &refImage) |
Self & | SetOutputSize (std::vector< uint32_t > OutputSize) |
Self & | 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. 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 *image, const Image *displacementField) |
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) |
Private Attributes | |
std::unique_ptr< detail::DualMemberFunctionFactory< MemberFunctionType > > | m_DualMemberFactory |
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. 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::ProcessObject * | GetActiveProcess () |
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 | |
NonCopyable & | operator= (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::EventObject & | GetITKEventObject (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) |
|
private |
Setup for member function dispatching
Definition at line 158 of file sitkWarpImageFilter.h.
Define the pixels types supported by this filter
Definition at line 76 of file sitkWarpImageFilter.h.
Definition at line 66 of file sitkWarpImageFilter.h.
|
virtual |
Destructor
itk::simple::WarpImageFilter::WarpImageFilter | ( | ) |
Default Constructor that takes no arguments and initializes default parameters
|
private |
|
private |
Image itk::simple::WarpImageFilter::Execute | ( | const Image & | image, |
const Image & | displacementField | ||
) |
Execute the filter on the input image
|
inline |
Get the edge padding value
Definition at line 138 of file sitkWarpImageFilter.h.
|
inline |
Get/Set the interpolator function.
Definition at line 88 of file sitkWarpImageFilter.h.
|
inlinevirtual |
Name of this class
Implements itk::simple::ProcessObject.
Definition at line 141 of file sitkWarpImageFilter.h.
|
inline |
Set/Get the direction (orientation) of the output image
Definition at line 128 of file sitkWarpImageFilter.h.
|
inline |
Get the output image origin.
Definition at line 108 of file sitkWarpImageFilter.h.
|
inline |
Get the size of the output image.
Definition at line 98 of file sitkWarpImageFilter.h.
|
inline |
Get the output image spacing.
Definition at line 118 of file sitkWarpImageFilter.h.
|
inline |
Set the edge padding value
Definition at line 133 of file sitkWarpImageFilter.h.
|
inline |
Get/Set the interpolator function.
Definition at line 83 of file sitkWarpImageFilter.h.
|
inline |
Set/Get the direction (orientation) of the output image
Definition at line 123 of file sitkWarpImageFilter.h.
|
inline |
Set the output image origin.
Definition at line 103 of file sitkWarpImageFilter.h.
void itk::simple::WarpImageFilter::SetOutputParameteresFromImage | ( | const Image & | refImage | ) |
This methods sets the output size, origin, spacing and direction to that of the provided image
|
inline |
Set the size of the output image.
Definition at line 93 of file sitkWarpImageFilter.h.
|
inline |
Set the output image spacing.
Definition at line 113 of file sitkWarpImageFilter.h.
|
virtual |
Print ourselves out
Reimplemented from itk::simple::ProcessObject.
|
friend |
Definition at line 160 of file sitkWarpImageFilter.h.
|
friend |
Definition at line 162 of file sitkWarpImageFilter.h.
|
private |
Definition at line 165 of file sitkWarpImageFilter.h.
|
private |
Definition at line 184 of file sitkWarpImageFilter.h.
|
private |
Definition at line 170 of file sitkWarpImageFilter.h.
|
private |
Definition at line 182 of file sitkWarpImageFilter.h.
|
private |
Definition at line 176 of file sitkWarpImageFilter.h.
|
private |
Definition at line 173 of file sitkWarpImageFilter.h.
|
private |
Definition at line 179 of file sitkWarpImageFilter.h.