/usr/include/InsightToolkit/Common/itkLandmarkBasedTransformInitializer.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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | /*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: itkLandmarkBasedTransformInitializer.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 __itkLandmarkBasedTransformInitializer_h
#define __itkLandmarkBasedTransformInitializer_h
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkVersorRigid3DTransform.h"
#include "itkRigid2DTransform.h"
#include <vector>
#include <iostream>
namespace itk
{
/** \class LandmarkBasedTransformInitializer
* \brief LandmarkBasedTransformInitializer is a helper class intended to
* The class computes the transform that aligns the fixed and moving images
* given a set of landmarks. The class is templated over the Transform type.
* The transform computed gives the best fit transform that maps the fixed
* and moving images in a least squares sense. The indices are taken to
* correspond, so point 1 in the first set will get mapped close to point
* 1 in the second set, etc. An equal number of fixed and moving landmarks
* need to be specified using SetFixedLandmarks() SetMovingLandmarks().
* Any number of landmarks may be specified.
* Call InitializeTransform() to initialize the transform.
*
* Currently, the following transforms are supported by the class:
* VersorRigid3DTransform
* Rigid2DTansform
*
* The class is based in part on Hybrid/vtkLandmarkTransform originally
* implemented in python by David G. Gobbi.
*
* The solution is based on
* Berthold K. P. Horn (1987), "Closed-form solution of absolute orientation
* using unit quaternions,"
* http://people.csail.mit.edu/bkph/papers/Absolute_Orientation.pdf
*
*
* \ingroup Transforms
*/
template < class TTransform,
class TFixedImage,
class TMovingImage >
class ITK_EXPORT LandmarkBasedTransformInitializer :
public Object
{
public:
/** Standard class typedefs. */
typedef LandmarkBasedTransformInitializer 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( LandmarkBasedTransformInitializer, 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);
/** Set the transform to be initialized */
itkSetObjectMacro( Transform, TransformType );
/** 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;
/** \deprecated
* Set the fixed image.
* The method really doesn't do anything. The goal of this class is to compute
* the optimal transform, for the templated TransformType between the fixed
* and moving image grid, given a set of landmarks. Nothing is done with the
* images themselves. The method will therefore be deprecated and removed */
void SetFixedImage( const FixedImageType * image )
{
this->m_FixedImage = image;
itkLegacyBodyMacro( SetFixedImage, 2.2 );
}
/** \deprecated
* Set the moving image.
* The method really doesn't do anything. The goal of this class is to compute
* the optimal transform, for the templated TransformType between the fixed
* and moving image grid, given a set of landmarks. Nothing is done with the
* images themselves. The method will therefore be deprecated and removed. */
void SetMovingImage( const MovingImageType * image )
{
this->m_MovingImage = image;
itkLegacyBodyMacro( SetMovingImage, 2.2 );
}
/** Determine the image dimension. */
itkStaticConstMacro(ImageDimension, unsigned int, FixedImageType::ImageDimension );
/** Convenience typedefs */
typedef typename TransformType::InputPointType InputPointType;
typedef typename TransformType::OutputVectorType OutputVectorType;
typedef Point< double, itkGetStaticConstMacro(ImageDimension) > LandmarkPointType;
typedef std::vector< LandmarkPointType > LandmarkPointContainer;
typedef typename
LandmarkPointContainer::const_iterator PointsContainerConstIterator;
typedef typename TransformType::ParametersType ParametersType;
typedef typename ParametersType::ValueType ParameterValueType;
/** Set the Fixed landmark point containers */
void SetFixedLandmarks(const LandmarkPointContainer & fixedLandmarks)
{
this->m_FixedLandmarks = fixedLandmarks;
}
/** Set the Moving landmark point containers */
void SetMovingLandmarks(const LandmarkPointContainer & movingLandmarks)
{
this->m_MovingLandmarks = movingLandmarks;
}
/** Supported Transform typedefs */
typedef VersorRigid3DTransform< ParameterValueType >
VersorRigid3DTransformType;
typedef Rigid2DTransform< ParameterValueType > Rigid2DTransformType;
/** Initialize the transform from the landmarks */
virtual void InitializeTransform();
protected:
LandmarkBasedTransformInitializer();
~LandmarkBasedTransformInitializer(){};
void PrintSelf(std::ostream &os, Indent indent) const;
// Supported Transform types
typedef enum{
VersorRigid3Dtransform=1,
Rigid2Dtransfrom,
Else
}InputTransformType;
private:
LandmarkBasedTransformInitializer(const Self&); //purposely not implemented
void operator=(const Self&); //purposely not implemented
FixedImagePointer m_FixedImage;
MovingImagePointer m_MovingImage;
LandmarkPointContainer m_FixedLandmarks;
LandmarkPointContainer m_MovingLandmarks;
TransformPointer m_Transform;
}; //class LandmarkBasedTransformInitializer
} // namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkLandmarkBasedTransformInitializer.txx"
#endif
#endif /* __itkLandmarkBasedTransformInitializer_h */
|