Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions

itk::BSplineDeformableTransformInitializer< TTransform, TImage > Class Template Reference

BSplineDeformableTransformInitializer is a helper class intended to initialize the grid parameters of a BSplineDeformableTransform based on the parameters of an image. More...

#include <itkBSplineDeformableTransformInitializer.h>

List of all members.

Public Types

typedef
BSplineDeformableTransformInitializer 
Self
typedef Object Superclass
typedef SmartPointer< SelfPointer
typedef SmartPointer< const SelfConstPointer
typedef TTransform TransformType
typedef TransformType::Pointer TransformPointer
typedef TransformType::RegionType TransformRegionType
typedef
TransformRegionType::SizeType 
TransformSizeType
typedef TImage ImageType
typedef ImageType::ConstPointer ImagePointer

Public Member Functions

virtual const char * GetClassName () const
 itkStaticConstMacro (SpaceDimension, unsigned int, TransformType::InputSpaceDimension)
virtual void SetTransform (TransformType *_arg)
virtual void SetImage (const ImageType *_arg)
virtual void SetGridSizeInsideTheImage (TransformSizeType _arg)
void SetNumberOfGridNodesInsideTheImage (unsigned int numberOfNodes)
virtual void InitializeTransform () const

Static Public Member Functions

static Pointer New ()

Protected Member Functions

 BSplineDeformableTransformInitializer ()
 ~BSplineDeformableTransformInitializer ()
void PrintSelf (std::ostream &os, Indent indent) const

Detailed Description

template<class TTransform, class TImage>
class itk::BSplineDeformableTransformInitializer< TTransform, TImage >

BSplineDeformableTransformInitializer is a helper class intended to initialize the grid parameters of a BSplineDeformableTransform based on the parameters of an image.

In the context of image registration, the image to be used are reference will be the fixed image. The BSpline grid will use the fixed image as a base for computing the grid spacing, orientation and origin, among other things.

Definition at line 42 of file itkBSplineDeformableTransformInitializer.h.


Member Typedef Documentation

template<class TTransform , class TImage >
typedef SmartPointer<const Self> itk::BSplineDeformableTransformInitializer< TTransform, TImage >::ConstPointer

Definition at line 49 of file itkBSplineDeformableTransformInitializer.h.

template<class TTransform , class TImage >
typedef ImageType::ConstPointer itk::BSplineDeformableTransformInitializer< TTransform, TImage >::ImagePointer

Definition at line 72 of file itkBSplineDeformableTransformInitializer.h.

template<class TTransform , class TImage >
typedef TImage itk::BSplineDeformableTransformInitializer< TTransform, TImage >::ImageType

Image Types to use in the initialization of the transform

Definition at line 71 of file itkBSplineDeformableTransformInitializer.h.

template<class TTransform , class TImage >
typedef SmartPointer<Self> itk::BSplineDeformableTransformInitializer< TTransform, TImage >::Pointer

Definition at line 48 of file itkBSplineDeformableTransformInitializer.h.

template<class TTransform , class TImage >
typedef BSplineDeformableTransformInitializer itk::BSplineDeformableTransformInitializer< TTransform, TImage >::Self

Standard class typedefs.

Definition at line 46 of file itkBSplineDeformableTransformInitializer.h.

template<class TTransform , class TImage >
typedef Object itk::BSplineDeformableTransformInitializer< TTransform, TImage >::Superclass

Definition at line 47 of file itkBSplineDeformableTransformInitializer.h.

template<class TTransform , class TImage >
typedef TransformType::Pointer itk::BSplineDeformableTransformInitializer< TTransform, TImage >::TransformPointer

Types defined from transform traits

Definition at line 61 of file itkBSplineDeformableTransformInitializer.h.

template<class TTransform , class TImage >
typedef TransformType::RegionType itk::BSplineDeformableTransformInitializer< TTransform, TImage >::TransformRegionType

Definition at line 62 of file itkBSplineDeformableTransformInitializer.h.

template<class TTransform , class TImage >
typedef TransformRegionType::SizeType itk::BSplineDeformableTransformInitializer< TTransform, TImage >::TransformSizeType

Definition at line 63 of file itkBSplineDeformableTransformInitializer.h.

template<class TTransform , class TImage >
typedef TTransform itk::BSplineDeformableTransformInitializer< TTransform, TImage >::TransformType

Type of the transform to initialize

Definition at line 55 of file itkBSplineDeformableTransformInitializer.h.


Constructor & Destructor Documentation

template<class TTransform , class TImage >
itk::BSplineDeformableTransformInitializer< TTransform, TImage >::BSplineDeformableTransformInitializer (  ) [protected]

Definition at line 29 of file itkBSplineDeformableTransformInitializer.txx.

{
  this->m_GridSizeInsideTheImage.Fill( 5 );
}
template<class TTransform , class TImage >
itk::BSplineDeformableTransformInitializer< TTransform, TImage >::~BSplineDeformableTransformInitializer (  ) [inline, protected]

Definition at line 103 of file itkBSplineDeformableTransformInitializer.h.

{};

Member Function Documentation

template<class TTransform , class TImage >
virtual const char* itk::BSplineDeformableTransformInitializer< TTransform, TImage >::GetClassName (  ) const [virtual]

Run-time type information (and related methods).

template<class TTransform , class TImage >
void itk::BSplineDeformableTransformInitializer< TTransform, TImage >::InitializeTransform (  ) const [virtual]

Initialize the transform using data from the images

Definition at line 38 of file itkBSplineDeformableTransformInitializer.txx.

{
  // Sanity check
  if( ! this->m_Image )
    {
    itkExceptionMacro( "Reference Image has not been set" );
    return;
    }

  if( ! this->m_Transform )
    {
    itkExceptionMacro( "Transform has not been set" );
    return;
    }

  // If the image come from a filter, then update that filter.
  if( this->m_Image->GetSource() )
    { 
    this->m_Image->GetSource()->Update();
    }

  typedef typename TransformType::RegionType RegionType;

  typename RegionType::SizeType   numberOfGridNodesOutsideTheImageSupport;
  typename RegionType::SizeType   totalGridSize;

  numberOfGridNodesOutsideTheImageSupport.Fill( TransformType::SplineOrder );

  totalGridSize = this->m_GridSizeInsideTheImage;
  totalGridSize += numberOfGridNodesOutsideTheImageSupport;

  RegionType gridRegion;
  gridRegion.SetSize( totalGridSize );

  typedef typename TransformType::SpacingType SpacingType;
  const SpacingType & imageSpacing = this->m_Image->GetSpacing();

  typedef typename TransformType::OriginType OriginType;
  const OriginType & imageOrigin = this->m_Image->GetOrigin();;

  const typename TransformType::RegionType & imageRegion = 
    this->m_Image->GetLargestPossibleRegion();

  typename ImageType::SizeType fixedImageSize = imageRegion.GetSize();

  SpacingType gridSpacing;
  SpacingType gridOriginShift;

  const unsigned int orderShift = TransformType::SplineOrder / 2;

  for( unsigned int r = 0; r < SpaceDimension; r++ )
    {
    const unsigned int numberOfGridCells = this->m_GridSizeInsideTheImage[r] - 1;
    const unsigned int numberOfImagePixels = fixedImageSize[r];

    gridSpacing[r] = imageSpacing[r] * 
      static_cast<double>(numberOfImagePixels)  / 
      static_cast<double>(numberOfGridCells);

    // Shift half image pixel to cover the image support
    const double imageSupportShift = - imageSpacing[r] / 2.0;

    // Shift by the number of extra grid cells required by
    // the BSpline order.
    const double gridSupportShift =  -1.0 * gridSpacing[r] * orderShift;

    // Combine both shifts. They are both aligned with the coordinate
    // system of the grid. Direction has not been considered so far.
    gridOriginShift[r] = gridSupportShift + imageSupportShift;
    }

  typename ImageType::DirectionType gridDirection = this->m_Image->GetDirection();
  SpacingType gridOriginOffset = gridDirection * gridOriginShift;

  OriginType gridOrigin = imageOrigin + gridOriginOffset; 

  this->m_Transform->SetGridRegion( gridRegion );
  this->m_Transform->SetGridOrigin( gridOrigin );
  this->m_Transform->SetGridSpacing( gridSpacing );
  this->m_Transform->SetGridDirection( gridDirection );
}
template<class TTransform , class TImage >
itk::BSplineDeformableTransformInitializer< TTransform, TImage >::itkStaticConstMacro ( SpaceDimension  ,
unsigned  int,
TransformType::InputSpaceDimension   
)

Dimension of parameters.

template<class TTransform , class TImage >
static Pointer itk::BSplineDeformableTransformInitializer< TTransform, TImage >::New (  ) [static]

New macro for creation of through a Smart Pointer.

template<class TTransform , class TImage >
void itk::BSplineDeformableTransformInitializer< TTransform, TImage >::PrintSelf ( std::ostream &  os,
Indent  indent 
) const [protected]

Definition at line 124 of file itkBSplineDeformableTransformInitializer.txx.

{
  Superclass::PrintSelf(os,indent);
     
  os << indent << "Transform   = " << std::endl;
  if( this->m_Transform )
    { 
    os << indent << this->m_Transform  << std::endl;
    }
  else
    {
    os << indent << "None" << std::endl;
    }

  os << indent << "Image   = " << std::endl;
  if( this->m_Image )
    { 
    os << indent << this->m_Image  << std::endl;
    }
  else
    {
    os << indent << "None" << std::endl;
    }

}
template<class TTransform , class TImage >
virtual void itk::BSplineDeformableTransformInitializer< TTransform, TImage >::SetGridSizeInsideTheImage ( TransformSizeType  _arg ) [virtual]

Set the number of grid nodes that we want to place inside the image. This method will override the settings of any previous call to SetNumberOfGridNodesInsideTheImage().

template<class TTransform , class TImage >
virtual void itk::BSplineDeformableTransformInitializer< TTransform, TImage >::SetImage ( const ImageType _arg ) [virtual]

Set the fixed image used in the registration process

template<class TTransform , class TImage >
void itk::BSplineDeformableTransformInitializer< TTransform, TImage >::SetNumberOfGridNodesInsideTheImage ( unsigned int  numberOfNodes ) [inline]

Set the number of grid nodes that we want to place inside the image. This number of node is used along one dimension of the image. Therefore, if you pass the number 5 as argument of this method, in a 3D space, then the total number of grid nodes inside the image will be $ 5 x 5 x 5 $ . This method will override the settings of any previous call to SetGridSizeInsideTheImage().

Definition at line 92 of file itkBSplineDeformableTransformInitializer.h.

    {
    this->m_GridSizeInsideTheImage.Fill( numberOfNodes );
    this->Modified();
    }
template<class TTransform , class TImage >
virtual void itk::BSplineDeformableTransformInitializer< TTransform, TImage >::SetTransform ( TransformType _arg ) [virtual]

Set the transform to be initialized


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines