Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Friends

cmtk::GroupwiseRegistrationFunctionalBase Class Reference
[cmtkRegistration Library]

Base class for groupwise registration functionals. More...

#include <cmtkGroupwiseRegistrationFunctionalBase.h>

Inheritance diagram for cmtk::GroupwiseRegistrationFunctionalBase:
Inheritance graph
[legend]
Collaboration diagram for cmtk::GroupwiseRegistrationFunctionalBase:
Collaboration graph
[legend]

List of all members.

Classes

class  BadXform
 Exception for "bad transformation". More...

Public Types

typedef Functional Superclass
 Type of parent class.
typedef
GroupwiseRegistrationFunctionalBase 
Self
 Type of this class.
typedef SmartPointer< SelfSmartPtr
 Smart pointer.

Public Member Functions

 GroupwiseRegistrationFunctionalBase ()
 Constructor.
virtual ~GroupwiseRegistrationFunctionalBase ()
 Destructor.
virtual void SetFreeAndRereadImages (const bool flag=true)
 Set flag for freeing and rereading images.
virtual void SetRepeatIntensityHistogramMatching (const bool flag=true)
 Set flag for repeated histogram-based intensity matching.
virtual void CreateTemplateGridFromTargets (const std::vector< UniformVolume::SmartPtr > &targets, const int downsample=0)
 Create template grid based on target images.
virtual void CreateTemplateGrid (const DataGrid::IndexType &dims, const UniformVolume::CoordinateVectorType &deltas)
 Create template grid based on geometry.
virtual void SetTemplateGrid (UniformVolume::SmartPtr &templateGrid, const int downsample=1, const bool useTemplateData=false)
 Set template grid.
virtual UniformVolume::SmartPtrGetTemplateGrid ()
 Retrieve the template grid.
virtual const UniformVolumeGetTemplateGrid () const
 Retrieve the template grid.
virtual void SetTargetImages (std::vector< UniformVolume::SmartPtr > &tImages)
 Set target images.
virtual void GetOriginalTargetImages (std::vector< UniformVolume::SmartPtr > &tImages)
 Get the original target images.
virtual std::vector
< UniformVolume::SmartPtr > & 
GetOriginalTargetImages ()
 Get the original target images.
virtual size_t GetNumberOfTargetImages () const
 Get number of target images.
virtual UniformVolume::SmartPtr GetOriginalTargetImage (const size_t imageIdx)
 Get a smart pointer to one original target image.
virtual const UniformVolumeGetOriginalTargetImage (const size_t imageIdx) const
 Get a constant pointer to one original target image.
virtual void SetGaussianSmoothImagesSigma (const Types::Coordinate gaussianSmoothImagesSigma)
 Set Gaussian smoothing kernel width for target images.
virtual void SetUserBackgroundValue (const byte value=0)
 Set user-defined image background value to be substituted outside the field of view.
virtual void UnsetUserBackgroundValue ()
 Unset user-defined image background value.
virtual void SetForceZeroSum (const bool forceZeroSum=true)
 Set flag for zero-sum updates.
virtual void SetForceZeroSumFirstN (const size_t forceZeroSumFirstN)
 Set count for restricted zero-sum updates.
virtual void SetActiveImagesFromTo (const size_t from, const size_t to)
 Set range of currently active images.
virtual void SetActiveXformsFromTo (const size_t from, const size_t to)
 Set range of currently active transformations.
virtual void SetProbabilisticSampleDensity (const float density)
 Set probabilistic sampling density.
virtual void SetProbabilisticSampleUpdatesAfter (const int iterations)
 Set number of iterations after which probabilistic samples are updated.
void SetXforms (const std::vector< Xform::SmartPtr > &xformVector)
 Set transformations.
virtual const XformGetGenericXformByIndex (const size_t idx) const
 Get coordinate transformation for one image in the group.
virtual Xform::SmartPtr GetGenericXformByIndex (const size_t idx)
 Get coordinate transformation for one image in the group.
virtual const XformGetGenericActiveXformByIndex (const size_t idx) const
 Get coordinate transformation for one active image in the group.
virtual Xform::SmartPtr GetGenericActiveXformByIndex (const size_t idx)
 Get coordinate transformation for one active image in the group.
virtual Types::Coordinate GetParamStep (const size_t idx, const Types::Coordinate mmStep=1) const
 Get parameter stepping in milimeters.
virtual size_t ParamVectorDim () const
 Return the functional's parameter vector dimension.
virtual size_t VariableParamVectorDim () const
 Return the number of variable parameters of the transformation.
virtual void GetParamVector (CoordinateVector &v)
 Get parameter vector.
virtual void SetParamVector (CoordinateVector &v)
 Set parameter vector.
virtual void SetParamVector (CoordinateVector &v, const size_t xformIdx)
 Set parameter vector for a given transformation.
virtual void SetParameter (const size_t param, const Types::Coordinate value)
 Set single parameter value.
virtual void SetParameter (const size_t xform, const size_t param, const Types::Coordinate value)
 Set single parameter value with separate xform and parameter index.
virtual Self::ReturnType EvaluateAt (CoordinateVector &v)
 Evaluate functional with given parameter vector.
virtual Self::ReturnType EvaluateWithGradient (CoordinateVector &v, CoordinateVector &g, const Types::Coordinate step=1)
 Compute functional value and gradient.
virtual void AllocateStorage ()
 Allocate storage for reformatted images etc.
void DebugWriteImages ()
 Write all images for debug purposes.

Protected Member Functions

virtual void ForceZeroSumGradient (CoordinateVector &g) const
 Enforce gradient to be zero-sum over all images.
virtual void UpdateProbabilisticSamples ()
 Update probablistic samples.
virtual void InterpolateAllImages ()
 Interpolate all moving images.
virtual void InterpolateImage (const size_t idx, byte *const destination)
 Interpolate given moving image to template.
virtual bool Wiggle ()
 Update probabilistic sample table..
virtual UniformVolume::SmartPtr PrepareSingleImage (UniformVolume::SmartPtr &image)
 Prepare data for one image.
virtual void PrepareTargetImages ()
 Smooth and pre-scale target images.
virtual const
UniformVolume::SmartPtr 
GetReformattedImage (const UniformVolume::SmartPtr &targetGrid, const size_t idx) const
 Reformat one image to a given target grid.

Protected Attributes

size_t m_NumberOfThreads
 Number of threads in thread pool (for allocation of temporary thread memory).
size_t m_NumberOfTasks
 Number of tasks for thread pool (for allocation of task arguments and results).
bool m_FreeAndRereadImages
 Flag for freeing and re-reading original images if using smoothed data.
bool m_ForceZeroSum
 Flag for enforcing zero-sum parameter changes.
size_t m_ForceZeroSumFirstN
 Restrict zero-sum computation to first N images.
size_t m_ActiveImagesFrom
 Currently active images from index.
size_t m_ActiveImagesTo
 Currently active images to index (plus 1).
size_t m_ActiveXformsFrom
 Currently active transformations from index.
size_t m_ActiveXformsTo
 Currently active transformations to index (plus 1).
size_t m_TemplateNumberOfPixels
 Number of pixels in template.
size_t m_TemplateNumberOfSamples
 Number of samples drawn from the pixels in template.
UniformVolume::SmartPtr m_TemplateGrid
 Template grid (not pixel data).
bool m_UseTemplateData
 Flag for use of template pixel data in registration.
std::vector< bytem_TemplateData
 Prepared (smoothed, scaled etc.) data of the template image if used in registration.
std::vector
< UniformVolume::SmartPtr
m_ImageVector
 Vector of image volumes with pre-scaled pixel values.
std::vector
< UniformVolume::SmartPtr
m_OriginalImageVector
 Vector of original image volumes.
std::vector< Xform::SmartPtrm_XformVector
 Vector of transformations.
float m_ProbabilisticSampleDensity
 Probabilistic sample count.
std::vector< size_t > m_ProbabilisticSamples
 Pixel indices of probabilistic samples.
int m_ProbabilisticSampleUpdatesAfter
 Number of iterations (calls to Evaluate()) after which probabilistic samples are updated.
int m_ProbabilisticSampleUpdatesSince
 Current number of iterations since last update of probabilistic samples.
std::vector< byte * > m_Data
 Vector of reformatted and rescaled image data.
std::vector< bytem_TempData
 Temporary data allocated at correct size of template grid.
Types::Coordinate m_GaussianSmoothImagesSigma
 Kernel width in [mm] for Gaussian smoothing of target images.
byte m_UserBackgroundValue
 User-defined value to fill regions outside FOV.
bool m_UserBackgroundFlag
 Flag for user-defined background value.
size_t m_ParametersPerXform
 Number of parameters per transformation..
bool m_RepeatIntensityHistogramMatching
 Repeat histogram-based intensity matching after each stage.

Static Protected Attributes

static const byte m_PaddingValue = 255
 Value used to mark regions outside the FOV.

Private Member Functions

void CopyTemplateData ()
 Copy template data from TypedArray to byte vector.

Friends

class GroupwiseRegistrationFunctionalAffineInitializer
 Initializer class shall be our friend.

Detailed Description

Base class for groupwise registration functionals.

This class provides the lowest-level components of groupwise image registration, such as image IO, preprocessing, generic access to transformation and image vectors, and parameters common to all algorithms such as zero-sum optimization.

Definition at line 63 of file cmtkGroupwiseRegistrationFunctionalBase.h.


Member Typedef Documentation


Member Function Documentation

virtual const Xform* cmtk::GroupwiseRegistrationFunctionalBase::GetGenericActiveXformByIndex ( const size_t  idx ) const [inline, virtual]

Get coordinate transformation for one active image in the group.

Parameters:
idxIndex of the volume/transformation.
Returns:
Transformation for the selected volume.

Definition at line 282 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual Xform::SmartPtr cmtk::GroupwiseRegistrationFunctionalBase::GetGenericActiveXformByIndex ( const size_t  idx ) [inline, virtual]

Get coordinate transformation for one active image in the group.

Parameters:
idxIndex of the volume/transformation.
Returns:
Transformation for the selected volume.

Definition at line 291 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual const Xform* cmtk::GroupwiseRegistrationFunctionalBase::GetGenericXformByIndex ( const size_t  idx ) const [inline, virtual]

Get coordinate transformation for one image in the group.

Parameters:
idxIndex of the volume/transformation.
Returns:
Transformation for the selected volume.

Definition at line 264 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual Xform::SmartPtr cmtk::GroupwiseRegistrationFunctionalBase::GetGenericXformByIndex ( const size_t  idx ) [inline, virtual]

Get coordinate transformation for one image in the group.

Parameters:
idxIndex of the volume/transformation.
Returns:
Transformation for the selected volume.

Definition at line 273 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual size_t cmtk::GroupwiseRegistrationFunctionalBase::GetNumberOfTargetImages (  ) const [inline, virtual]

Get number of target images.

Definition at line 161 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual UniformVolume::SmartPtr cmtk::GroupwiseRegistrationFunctionalBase::GetOriginalTargetImage ( const size_t  imageIdx ) [inline, virtual]

Get a smart pointer to one original target image.

Definition at line 168 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual const UniformVolume* cmtk::GroupwiseRegistrationFunctionalBase::GetOriginalTargetImage ( const size_t  imageIdx ) const [inline, virtual]

Get a constant pointer to one original target image.

Definition at line 175 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual void cmtk::GroupwiseRegistrationFunctionalBase::GetOriginalTargetImages ( std::vector< UniformVolume::SmartPtr > &  tImages ) [inline, virtual]

Get the original target images.

Definition at line 147 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual std::vector<UniformVolume::SmartPtr>& cmtk::GroupwiseRegistrationFunctionalBase::GetOriginalTargetImages (  ) [inline, virtual]

Get the original target images.

Definition at line 154 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual Types::Coordinate cmtk::GroupwiseRegistrationFunctionalBase::GetParamStep ( const size_t  idx,
const Types::Coordinate  mmStep = 1 
) const [inline, virtual]

Get parameter stepping in milimeters.

Parameters:
idxParameter index.
mmStepDesired step length. This is typically used as a scalar factor for the default (1mm) step size.
Returns:
Step of given parameter that corresponds to 1 mm effective motion.

Reimplemented from cmtk::Functional.

Definition at line 301 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual UniformVolume::SmartPtr& cmtk::GroupwiseRegistrationFunctionalBase::GetTemplateGrid (  ) [inline, virtual]

Retrieve the template grid.

Definition at line 128 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual const UniformVolume* cmtk::GroupwiseRegistrationFunctionalBase::GetTemplateGrid (  ) const [inline, virtual]

Retrieve the template grid.

Definition at line 135 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual void cmtk::GroupwiseRegistrationFunctionalBase::InterpolateImage ( const size_t  idx,
byte *const   destination 
) [inline, protected, virtual]

Interpolate given moving image to template.

Parameters:
idxIndex of of to reformat to template. This also determines which transformation is used.
destinationThe reformatted pixel data is stored in this array. Sufficient memory (for as many pixels as there are in the template grid) must be allocated there.

Reimplemented in cmtk::GroupwiseRegistrationFunctionalXformTemplate< TXform >, cmtk::GroupwiseRegistrationFunctionalXformTemplate< AffineXform >, and cmtk::GroupwiseRegistrationFunctionalXformTemplate< SplineWarpXform >.

Definition at line 471 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual size_t cmtk::GroupwiseRegistrationFunctionalBase::ParamVectorDim (  ) const [inline, virtual]

Return the functional's parameter vector dimension.

We assume that all transformations have the same number of parameters. This is true for affine transformations.

Implements cmtk::Functional.

Definition at line 318 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual void cmtk::GroupwiseRegistrationFunctionalBase::SetActiveImagesFromTo ( const size_t  from,
const size_t  to 
) [inline, virtual]

Set range of currently active images.

The "to" parameter is the index of the last active image plus one, so it can be used directly as the upper bound in a "for" loop.

Definition at line 218 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual void cmtk::GroupwiseRegistrationFunctionalBase::SetActiveXformsFromTo ( const size_t  from,
const size_t  to 
) [inline, virtual]

Set range of currently active transformations.

The "to" parameter is the index of the last active transformation plus one, so it can be used directly as the upper bound in a "for" loop.

Reimplemented in cmtk::GroupwiseRegistrationFunctionalXformTemplate< SplineWarpXform >.

Definition at line 228 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual void cmtk::GroupwiseRegistrationFunctionalBase::SetForceZeroSum ( const bool  forceZeroSum = true ) [inline, virtual]

Set flag for zero-sum updates.

Definition at line 202 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual void cmtk::GroupwiseRegistrationFunctionalBase::SetForceZeroSumFirstN ( const size_t  forceZeroSumFirstN ) [inline, virtual]

Set count for restricted zero-sum updates.

Definition at line 208 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual void cmtk::GroupwiseRegistrationFunctionalBase::SetFreeAndRereadImages ( const bool  flag = true ) [inline, virtual]

Set flag for freeing and rereading images.

If registration uses smoothed images, the original data can be freed after smoothing and reread from the file system if needed again. This saves roughly 1/2 of memory allocation.

Definition at line 91 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual void cmtk::GroupwiseRegistrationFunctionalBase::SetGaussianSmoothImagesSigma ( const Types::Coordinate  gaussianSmoothImagesSigma ) [inline, virtual]

Set Gaussian smoothing kernel width for target images.

Non-positive values turn off smoothing.

Definition at line 183 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual void cmtk::GroupwiseRegistrationFunctionalBase::SetProbabilisticSampleDensity ( const float  density ) [inline, virtual]

Set probabilistic sampling density.

Definition at line 236 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual void cmtk::GroupwiseRegistrationFunctionalBase::SetProbabilisticSampleUpdatesAfter ( const int  iterations ) [inline, virtual]

Set number of iterations after which probabilistic samples are updated.

Definition at line 243 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual void cmtk::GroupwiseRegistrationFunctionalBase::SetRepeatIntensityHistogramMatching ( const bool  flag = true ) [inline, virtual]

Set flag for repeated histogram-based intensity matching.

Definition at line 97 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual void cmtk::GroupwiseRegistrationFunctionalBase::SetUserBackgroundValue ( const byte  value = 0 ) [inline, virtual]

Set user-defined image background value to be substituted outside the field of view.

Definition at line 189 of file cmtkGroupwiseRegistrationFunctionalBase.h.

void cmtk::GroupwiseRegistrationFunctionalBase::SetXforms ( const std::vector< Xform::SmartPtr > &  xformVector ) [inline]

Set transformations.

Definition at line 251 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual void cmtk::GroupwiseRegistrationFunctionalBase::UnsetUserBackgroundValue (  ) [inline, virtual]

Unset user-defined image background value.

Definition at line 196 of file cmtkGroupwiseRegistrationFunctionalBase.h.

virtual size_t cmtk::GroupwiseRegistrationFunctionalBase::VariableParamVectorDim (  ) const [inline, virtual]

Return the number of variable parameters of the transformation.

Returns:
This function returns the same value as ParamVectorDim(). Non-varying parameters (e.g., rotation centers) are handled via parameter step values.

Reimplemented from cmtk::Functional.

Definition at line 328 of file cmtkGroupwiseRegistrationFunctionalBase.h.


Friends And Related Function Documentation

Initializer class shall be our friend.

Definition at line 522 of file cmtkGroupwiseRegistrationFunctionalBase.h.


Member Data Documentation

Currently active images from index.

Definition at line 397 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Currently active images to index (plus 1).

Definition at line 400 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Currently active transformations from index.

Definition at line 403 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Currently active transformations to index (plus 1).

Definition at line 406 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Vector of reformatted and rescaled image data.

Definition at line 474 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Flag for enforcing zero-sum parameter changes.

Definition at line 391 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Restrict zero-sum computation to first N images.

Definition at line 394 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Flag for freeing and re-reading original images if using smoothed data.

Definition at line 388 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Kernel width in [mm] for Gaussian smoothing of target images.

Definition at line 480 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Vector of image volumes with pre-scaled pixel values.

Definition at line 427 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Referenced by cmtk::GroupwiseRegistrationFunctionalAffineInitializer::InitializeXforms().

Number of tasks for thread pool (for allocation of task arguments and results).

Definition at line 385 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Number of threads in thread pool (for allocation of temporary thread memory).

Definition at line 382 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Vector of original image volumes.

Definition at line 430 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Value used to mark regions outside the FOV.

Definition at line 483 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Number of parameters per transformation..

Definition at line 492 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Probabilistic sample count.

Definition at line 436 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Pixel indices of probabilistic samples.

Definition at line 439 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Number of iterations (calls to Evaluate()) after which probabilistic samples are updated.

Definition at line 444 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Current number of iterations since last update of probabilistic samples.

Definition at line 448 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Repeat histogram-based intensity matching after each stage.

Definition at line 495 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Temporary data allocated at correct size of template grid.

Definition at line 477 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Prepared (smoothed, scaled etc.) data of the template image if used in registration.

Definition at line 424 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Template grid (not pixel data).

Definition at line 418 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Referenced by cmtk::GroupwiseRegistrationFunctionalAffineInitializer::InitializeXforms().

Number of pixels in template.

Definition at line 412 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Number of samples drawn from the pixels in template.

Definition at line 415 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Flag for user-defined background value.

Definition at line 489 of file cmtkGroupwiseRegistrationFunctionalBase.h.

User-defined value to fill regions outside FOV.

Definition at line 486 of file cmtkGroupwiseRegistrationFunctionalBase.h.

Flag for use of template pixel data in registration.

Definition at line 421 of file cmtkGroupwiseRegistrationFunctionalBase.h.


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