SimpleITK  1.0.1
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
itk::simple::ResampleImageFilter Class Reference

Resample an image via a coordinate transform. More...

#include <sitkResampleImageFilter.h>

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

Public Types

typedef BasicPixelIDTypeList PixelIDTypeList
 
typedef ResampleImageFilter Self
 
- Public Types inherited from itk::simple::ImageFilter< 1 >
typedef ImageFilter Self
 
- Public Types inherited from itk::simple::ProcessObject
typedef ProcessObject Self
 

Public Member Functions

Image Execute (const Image &image1)
 
Image Execute (const Image &image1, const std::vector< uint32_t > &size, Transform transform, InterpolatorEnum interpolator, const std::vector< double > &outputOrigin, const std::vector< double > &outputSpacing, std::vector< double > outputDirection, double defaultPixelValue, PixelIDValueEnum outputPixelType)
 
double GetDefaultPixelValue () const
 
InterpolatorEnum GetInterpolator () const
 
std::string GetName () const
 
std::vector< double > GetOutputDirection () const
 
std::vector< double > GetOutputOrigin () const
 
PixelIDValueEnum GetOutputPixelType () const
 Get the ouput pixel type. More...
 
std::vector< double > GetOutputSpacing () const
 
std::vector< uint32_tGetSize () const
 
Transform GetTransform () const
 
 ResampleImageFilter ()
 
SelfSetDefaultPixelValue (double DefaultPixelValue)
 
SelfSetInterpolator (InterpolatorEnum Interpolator)
 
SelfSetOutputDirection (std::vector< double > OutputDirection)
 
SelfSetOutputOrigin (const std::vector< double > &OutputOrigin)
 
SelfSetOutputPixelType (PixelIDValueEnum OutputPixelType)
 Set the output pixel type, if sitkUnknown then the input type is used. More...
 
SelfSetOutputSpacing (const std::vector< double > &OutputSpacing)
 
void SetReferenceImage (const Image &refImage)
 
SelfSetSize (const std::vector< uint32_t > &Size)
 
SelfSetTransform (Transform Transform)
 
std::string ToString () const
 
 ~ResampleImageFilter ()
 
- Public Member Functions inherited from itk::simple::ImageFilter< 1 >
 ImageFilter ()
 
virtual ~ImageFilter ()=0
 
- Public Member Functions inherited from itk::simple::ProcessObject
virtual void Abort ()
 
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
 

Private Types

typedef Image(Self::* MemberFunctionType) (const Image &image1)
 

Private Member Functions

template<class TImageType1 , class TImageType2 >
Image DualExecuteInternal (const Image &image1)
 
template<class TImageType1 , class TImageType2 >
Image DualExecuteInternalVector (const Image &image1)
 

Private Attributes

double m_DefaultPixelValue
 
nsstd::auto_ptr< detail::DualMemberFunctionFactory< MemberFunctionType > > m_DualMemberFactory
 
InterpolatorEnum m_Interpolator
 
std::vector< double > m_OutputDirection
 
std::vector< double > m_OutputOrigin
 
PixelIDValueEnum m_OutputPixelType
 
std::vector< double > m_OutputSpacing
 
std::vector< uint32_tm_Size
 
Transform m_Transform
 

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 void SetGlobalDefaultNumberOfThreads (unsigned int n)
 
static unsigned int GetGlobalDefaultNumberOfThreads ()
 
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...
 
- 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) throw ()
 
virtual void PreUpdate (itk::ProcessObject *p)
 
virtual void RemoveITKObserver (EventCommand &e)
 
- Protected Member Functions inherited from itk::simple::NonCopyable
 NonCopyable ()
 
- Static Protected Member Functions inherited from itk::simple::ImageFilter< 1 >
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 TImageType >
static Image CastITKToImage (TImageType *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)
 
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)
 

Detailed Description

Resample an image via a coordinate transform.

ResampleImageFilter resamples an existing image through some coordinate transform, interpolating via some image function. The class is templated over the types of the input and output images.

Note that the choice of interpolator function can be important. This function is set via SetInterpolator() . The default is LinearInterpolateImageFunction <InputImageType, TInterpolatorPrecisionType>, which is reasonable for ordinary medical images. However, some synthetic images have pixels drawn from a finite prescribed set. An example would be a mask indicating the segmentation of a brain into a small number of tissue types. For such an image, one does not want to interpolate between different pixel values, and so NearestNeighborInterpolateImageFunction < InputImageType, TCoordRep > would be a better choice.

If an sample is taken from outside the image domain, the default behavior is to use a default pixel value. If different behavior is desired, an extrapolator function can be set with SetExtrapolator() .

Output information (spacing, size and direction) for the output image should be set. This information has the normal defaults of unit spacing, zero origin and identity direction. Optionally, the output information can be obtained from a reference image. If the reference image is provided and UseReferenceImage is On, then the spacing, origin and direction of the reference image will be used.

Since this filter produces an image which is a different size than its input, it needs to override several of the methods defined in ProcessObject in order to properly manage the pipeline execution model. In particular, this filter overrides ProcessObject::GenerateInputRequestedRegion() and ProcessObject::GenerateOutputInformation() .

This filter is implemented as a multithreaded filter. It provides a ThreadedGenerateData() method for its implementation.

Warning
For multithreading, the TransformPoint method of the user-designated coordinate transform must be threadsafe.
Wiki Examples:
See also
itk::ResampleImageFilter for the Doxygen on the original ITK class.

Definition at line 63 of file sitkResampleImageFilter.h.

Member Typedef Documentation

typedef Image(Self::* itk::simple::ResampleImageFilter::MemberFunctionType) (const Image &image1)
private

Setup for member function dispatching

Definition at line 179 of file sitkResampleImageFilter.h.

Define the pixels types supported by this filter

Definition at line 75 of file sitkResampleImageFilter.h.

Definition at line 65 of file sitkResampleImageFilter.h.

Constructor & Destructor Documentation

itk::simple::ResampleImageFilter::ResampleImageFilter ( )

Default Constructor that takes no arguments and initializes default parameters

itk::simple::ResampleImageFilter::~ResampleImageFilter ( )

Destructor

Member Function Documentation

template<class TImageType1 , class TImageType2 >
Image itk::simple::ResampleImageFilter::DualExecuteInternal ( const Image image1)
private
template<class TImageType1 , class TImageType2 >
Image itk::simple::ResampleImageFilter::DualExecuteInternalVector ( const Image image1)
private
Image itk::simple::ResampleImageFilter::Execute ( const Image image1)

Execute the filter on the input image

Image itk::simple::ResampleImageFilter::Execute ( const Image image1,
const std::vector< uint32_t > &  size,
Transform  transform,
InterpolatorEnum  interpolator,
const std::vector< double > &  outputOrigin,
const std::vector< double > &  outputSpacing,
std::vector< double >  outputDirection,
double  defaultPixelValue,
PixelIDValueEnum  outputPixelType 
)

Execute the filter on the input image with the given parameters

double itk::simple::ResampleImageFilter::GetDefaultPixelValue ( ) const
inline

Get/Set the pixel value when a transformed pixel is outside of the image. The default default pixel value is 0.

Definition at line 147 of file sitkResampleImageFilter.h.

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

Get/Set the interpolator function. The default is LinearInterpolateImageFunction <InputImageType, TInterpolatorPrecisionType>. Some other options are NearestNeighborInterpolateImageFunction (useful for binary masks and other images with a small number of possible pixel values), and BSplineInterpolateImageFunction (which provides a higher order of interpolation).

Definition at line 107 of file sitkResampleImageFilter.h.

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

Name of this class

Implements itk::simple::ProcessObject.

Definition at line 159 of file sitkResampleImageFilter.h.

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

Set the output direciton cosine matrix.

Definition at line 137 of file sitkResampleImageFilter.h.

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

Get the output image origin.

Definition at line 117 of file sitkResampleImageFilter.h.

PixelIDValueEnum itk::simple::ResampleImageFilter::GetOutputPixelType ( ) const
inline

Get the ouput pixel type.

Definition at line 157 of file sitkResampleImageFilter.h.

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

Get the output image spacing.

Definition at line 127 of file sitkResampleImageFilter.h.

std::vector<uint32_t> itk::simple::ResampleImageFilter::GetSize ( ) const
inline

Get/Set the size of the output image.

Definition at line 87 of file sitkResampleImageFilter.h.

Transform itk::simple::ResampleImageFilter::GetTransform ( ) const
inline

Get/Set the coordinate transformation. Set the coordinate transform to use for resampling. Note that this must be in physical coordinates and it is the output-to-input transform, NOT the input-to-output transform that you might naively expect. By default the filter uses an Identity transform. You must provide a different transform here, before attempting to run the filter, if you do not want to use the default Identity transform.

Definition at line 97 of file sitkResampleImageFilter.h.

Self& itk::simple::ResampleImageFilter::SetDefaultPixelValue ( double  DefaultPixelValue)
inline

Get/Set the pixel value when a transformed pixel is outside of the image. The default default pixel value is 0.

Definition at line 142 of file sitkResampleImageFilter.h.

Self& itk::simple::ResampleImageFilter::SetInterpolator ( InterpolatorEnum  Interpolator)
inline

Get/Set the interpolator function. The default is LinearInterpolateImageFunction <InputImageType, TInterpolatorPrecisionType>. Some other options are NearestNeighborInterpolateImageFunction (useful for binary masks and other images with a small number of possible pixel values), and BSplineInterpolateImageFunction (which provides a higher order of interpolation).

Definition at line 102 of file sitkResampleImageFilter.h.

Self& itk::simple::ResampleImageFilter::SetOutputDirection ( std::vector< double >  OutputDirection)
inline

Set the output direciton cosine matrix.

Definition at line 132 of file sitkResampleImageFilter.h.

Self& itk::simple::ResampleImageFilter::SetOutputOrigin ( const std::vector< double > &  OutputOrigin)
inline

Set the output image origin.

Definition at line 112 of file sitkResampleImageFilter.h.

Self& itk::simple::ResampleImageFilter::SetOutputPixelType ( PixelIDValueEnum  OutputPixelType)
inline

Set the output pixel type, if sitkUnknown then the input type is used.

Definition at line 152 of file sitkResampleImageFilter.h.

Self& itk::simple::ResampleImageFilter::SetOutputSpacing ( const std::vector< double > &  OutputSpacing)
inline

Set the output image spacing.

Definition at line 122 of file sitkResampleImageFilter.h.

void itk::simple::ResampleImageFilter::SetReferenceImage ( const Image refImage)

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

Self& itk::simple::ResampleImageFilter::SetSize ( const std::vector< uint32_t > &  Size)
inline

Get/Set the size of the output image.

Definition at line 82 of file sitkResampleImageFilter.h.

Self& itk::simple::ResampleImageFilter::SetTransform ( Transform  Transform)
inline

Get/Set the coordinate transformation. Set the coordinate transform to use for resampling. Note that this must be in physical coordinates and it is the output-to-input transform, NOT the input-to-output transform that you might naively expect. By default the filter uses an Identity transform. You must provide a different transform here, before attempting to run the filter, if you do not want to use the default Identity transform.

Definition at line 92 of file sitkResampleImageFilter.h.

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

Print ourselves out

Reimplemented from itk::simple::ProcessObject.

Friends And Related Function Documentation

Definition at line 181 of file sitkResampleImageFilter.h.

Definition at line 183 of file sitkResampleImageFilter.h.

Member Data Documentation

double itk::simple::ResampleImageFilter::m_DefaultPixelValue
private

Definition at line 201 of file sitkResampleImageFilter.h.

nsstd::auto_ptr<detail::DualMemberFunctionFactory<MemberFunctionType> > itk::simple::ResampleImageFilter::m_DualMemberFactory
private

Definition at line 186 of file sitkResampleImageFilter.h.

InterpolatorEnum itk::simple::ResampleImageFilter::m_Interpolator
private

Definition at line 194 of file sitkResampleImageFilter.h.

std::vector<double> itk::simple::ResampleImageFilter::m_OutputDirection
private

Definition at line 200 of file sitkResampleImageFilter.h.

std::vector<double> itk::simple::ResampleImageFilter::m_OutputOrigin
private

Definition at line 196 of file sitkResampleImageFilter.h.

PixelIDValueEnum itk::simple::ResampleImageFilter::m_OutputPixelType
private

Definition at line 202 of file sitkResampleImageFilter.h.

std::vector<double> itk::simple::ResampleImageFilter::m_OutputSpacing
private

Definition at line 198 of file sitkResampleImageFilter.h.

std::vector<uint32_t> itk::simple::ResampleImageFilter::m_Size
private

Definition at line 191 of file sitkResampleImageFilter.h.

Transform itk::simple::ResampleImageFilter::m_Transform
private

Definition at line 192 of file sitkResampleImageFilter.h.


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