/usr/include/InsightToolkit/Common/itkCenteredTransformInitializer.h is in libinsighttoolkit3-dev 3.20.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | /*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: itkCenteredTransformInitializer.h
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __itkCenteredTransformInitializer_h
#define __itkCenteredTransformInitializer_h
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkImageMomentsCalculator.h"
#include <iostream>
namespace itk
{
/** \class CenteredTransformInitializer
* \brief CenteredTransformInitializer is a helper class intended to
* initialize the center of rotation and the translation of Transforms having
* the center of rotation among their parameters.
*
* This class is connected to the fixed image, moving image and transform
* involved in the registration. Two modes of operation are possible:
*
* - Geometrical,
* - Center of mass
*
* In the first mode, the geometrical center of the moving image is passed as
* initial center of rotation to the transform and the vector from the center
* of the fixed image to the center of the moving image is passed as the
* initial translation. This mode basically assumes that the anatomical objects
* to be registered are centered in their respective images. Hence the best
* initial guess for the registration is the one that superimposes those two
* centers.
*
* In the second mode, the moments of gray level values are computed
* for both images. The center of mass of the moving image is then
* used as center of rotation. The vector between the two centers of
* mass is passes as the initial translation to the transform. This
* second approach assumes that the moments of the anatomical objects
* are similar for both images and hence the best initial guess for
* registration is to superimpose both mass centers. Note that this
* assumption will probably not hold in multi-modality registration.
*
* \ingroup Transforms
*/
template < class TTransform,
class TFixedImage,
class TMovingImage >
class ITK_EXPORT CenteredTransformInitializer : public Object
{
public:
/** Standard class typedefs. */
typedef CenteredTransformInitializer Self;
typedef Object Superclass;
typedef SmartPointer<Self> Pointer;
typedef SmartPointer<const Self> ConstPointer;
/** New macro for creation of through a Smart Pointer. */
itkNewMacro( Self );
/** Run-time type information (and related methods). */
itkTypeMacro( CenteredTransformInitializer, Object );
/** Type of the transform to initialize */
typedef TTransform TransformType;
typedef typename TransformType::Pointer TransformPointer;
/** Dimension of parameters. */
itkStaticConstMacro(InputSpaceDimension, unsigned int,
TransformType::InputSpaceDimension);
itkStaticConstMacro(OutputSpaceDimension, unsigned int,
TransformType::OutputSpaceDimension);
/** Image Types to use in the initialization of the transform */
typedef TFixedImage FixedImageType;
typedef TMovingImage MovingImageType;
typedef typename FixedImageType::ConstPointer FixedImagePointer;
typedef typename MovingImageType::ConstPointer MovingImagePointer;
/** Moment calculators */
typedef ImageMomentsCalculator< FixedImageType > FixedImageCalculatorType;
typedef ImageMomentsCalculator< MovingImageType > MovingImageCalculatorType;
typedef typename FixedImageCalculatorType::Pointer
FixedImageCalculatorPointer;
typedef typename MovingImageCalculatorType::Pointer
MovingImageCalculatorPointer;
/** Offset type. */
typedef typename TransformType::OffsetType OffsetType;
/** Point type. */
typedef typename TransformType::InputPointType InputPointType;
/** Vector type. */
typedef typename TransformType::OutputVectorType OutputVectorType;
/** Set the transform to be initialized */
itkSetObjectMacro( Transform, TransformType );
/** Set the fixed image used in the registration process */
itkSetConstObjectMacro( FixedImage, FixedImageType );
/** Set the moving image used in the registration process */
itkSetConstObjectMacro( MovingImage, MovingImageType );
/** Initialize the transform using data from the images */
virtual void InitializeTransform();
/** Select between using the geometrical center of the images or
using the center of mass given by the image intensities. */
void GeometryOn() { m_UseMoments = false; }
void MomentsOn() { m_UseMoments = true; }
/** Get() access to the moments calculators */
itkGetConstObjectMacro( FixedCalculator, FixedImageCalculatorType );
itkGetConstObjectMacro( MovingCalculator, MovingImageCalculatorType );
protected:
CenteredTransformInitializer();
~CenteredTransformInitializer(){};
void PrintSelf(std::ostream &os, Indent indent) const;
itkGetObjectMacro( Transform, TransformType );
private:
CenteredTransformInitializer(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
TransformPointer m_Transform;
FixedImagePointer m_FixedImage;
MovingImagePointer m_MovingImage;
bool m_UseMoments;
FixedImageCalculatorPointer m_FixedCalculator;
MovingImageCalculatorPointer m_MovingCalculator;
}; //class CenteredTransformInitializer
} // namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkCenteredTransformInitializer.txx"
#endif
#endif /* __itkCenteredTransformInitializer_h */
|