go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkPCAMetric.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright UMC Utrecht and contributors
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkPCAMetric_h
19 #define __itkPCAMetric_h
20 
22 
23 #include "itkSmoothingRecursiveGaussianImageFilter.h"
25 #include "itkNearestNeighborInterpolateImageFunction.h"
26 #include "itkExtractImageFilter.h"
27 
28 using namespace std;
29 
30 namespace itk
31 {
32 template< class TFixedImage, class TMovingImage >
33 class PCAMetric :
34  public AdvancedImageToImageMetric< TFixedImage, TMovingImage >
35 {
36 public:
37 
39  typedef PCAMetric Self;
41  TFixedImage, TMovingImage > Superclass;
43  typedef SmartPointer< const Self > ConstPointer;
44 
45  typedef typename Superclass::FixedImageRegionType FixedImageRegionType;
46  typedef typename FixedImageRegionType::SizeType FixedImageSizeType;
47 
49  itkNewMacro( Self );
50 
53 
55  itkSetMacro( SampleLastDimensionRandomly, bool );
56  itkSetMacro( NumSamplesLastDimension, unsigned int );
57  itkSetMacro( NumAdditionalSamplesFixed, unsigned int );
58  itkSetMacro( ReducedDimensionIndex, unsigned int );
59  itkSetMacro( SubtractMean, bool );
60  itkSetMacro( GridSize, FixedImageSizeType );
61  itkSetMacro( TransformIsStackTransform, bool );
62  itkSetMacro( NumEigenValues, unsigned int );
63  itkSetMacro( UseDerivativeOfMean, bool );
64  itkSetMacro( DeNoise, bool );
65  itkSetMacro( VarNoise, double );
66 
68  itkGetConstMacro( SampleLastDimensionRandomly, bool );
69  itkGetConstMacro( NumSamplesLastDimension, int );
70 
72  typedef typename
73  Superclass::CoordinateRepresentationType CoordinateRepresentationType;
74  typedef typename Superclass::MovingImageType MovingImageType;
75  typedef typename Superclass::MovingImagePixelType MovingImagePixelType;
76  typedef typename Superclass::MovingImageConstPointer MovingImageConstPointer;
77  typedef typename Superclass::FixedImageType FixedImageType;
78  typedef typename Superclass::FixedImageConstPointer FixedImageConstPointer;
79  typedef typename Superclass::TransformType TransformType;
80  typedef typename Superclass::TransformPointer TransformPointer;
81  typedef typename Superclass::InputPointType InputPointType;
82  typedef typename Superclass::OutputPointType OutputPointType;
83  typedef typename Superclass::TransformParametersType TransformParametersType;
84  typedef typename Superclass::TransformJacobianType TransformJacobianType;
85  typedef typename Superclass::InterpolatorType InterpolatorType;
86  typedef typename Superclass::InterpolatorPointer InterpolatorPointer;
87  typedef typename Superclass::RealType RealType;
88  typedef typename Superclass::GradientPixelType GradientPixelType;
89  typedef typename Superclass::GradientImageType GradientImageType;
90  typedef typename Superclass::GradientImagePointer GradientImagePointer;
91  typedef typename Superclass::GradientImageFilterType GradientImageFilterType;
92  typedef typename Superclass::GradientImageFilterPointer GradientImageFilterPointer;
93  typedef typename Superclass::FixedImageMaskType FixedImageMaskType;
94  typedef typename Superclass::FixedImageMaskPointer FixedImageMaskPointer;
95  typedef typename Superclass::MovingImageMaskType MovingImageMaskType;
96  typedef typename Superclass::MovingImageMaskPointer MovingImageMaskPointer;
97  typedef typename Superclass::MeasureType MeasureType;
98  typedef typename Superclass::DerivativeType DerivativeType;
99  typedef typename Superclass::ParametersType ParametersType;
100  typedef typename Superclass::FixedImagePixelType FixedImagePixelType;
101  typedef typename Superclass::MovingImageRegionType MovingImageRegionType;
102  typedef typename Superclass::ImageSamplerType ImageSamplerType;
103  typedef typename Superclass::ImageSamplerPointer ImageSamplerPointer;
104  typedef typename Superclass::ImageSampleContainerType ImageSampleContainerType;
105  typedef typename
106  Superclass::ImageSampleContainerPointer ImageSampleContainerPointer;
107  typedef typename Superclass::FixedImageLimiterType FixedImageLimiterType;
108  typedef typename Superclass::MovingImageLimiterType MovingImageLimiterType;
109  typedef typename
110  Superclass::FixedImageLimiterOutputType FixedImageLimiterOutputType;
111  typedef typename
112  Superclass::MovingImageLimiterOutputType MovingImageLimiterOutputType;
113  typedef typename
114  Superclass::MovingImageDerivativeScalesType MovingImageDerivativeScalesType;
115 
117  itkStaticConstMacro( FixedImageDimension, unsigned int,
118  FixedImageType::ImageDimension );
119 
121  itkStaticConstMacro( MovingImageDimension, unsigned int,
122  MovingImageType::ImageDimension );
123 
125  virtual MeasureType GetValue( const TransformParametersType & parameters ) const;
126 
128  virtual void GetDerivative( const TransformParametersType & parameters,
129  DerivativeType & derivative ) const;
130 
132  virtual void GetValueAndDerivative( const TransformParametersType & parameters,
133  MeasureType & Value, DerivativeType & Derivative ) const;
134 
139  virtual void Initialize( void ) throw ( ExceptionObject );
140 
141 protected:
142 
144  virtual ~PCAMetric() {}
145  void PrintSelf( std::ostream & os, Indent indent ) const;
146 
150  typedef typename Superclass::FixedImageIndexType FixedImageIndexType;
151  typedef typename Superclass::FixedImageIndexValueType FixedImageIndexValueType;
152  typedef typename Superclass::MovingImageIndexType MovingImageIndexType;
153  typedef typename Superclass::FixedImagePointType FixedImagePointType;
154  typedef typename itk::ContinuousIndex< CoordinateRepresentationType, FixedImageDimension >
156  typedef typename Superclass::MovingImagePointType MovingImagePointType;
157  typedef typename Superclass::MovingImageContinuousIndexType MovingImageContinuousIndexType;
158  typedef typename Superclass::BSplineInterpolatorType BSplineInterpolatorType;
159  typedef typename Superclass::CentralDifferenceGradientFilterType CentralDifferenceGradientFilterType;
160  typedef typename Superclass::MovingImageDerivativeType MovingImageDerivativeType;
161  typedef typename Superclass::NonZeroJacobianIndicesType NonZeroJacobianIndicesType;
162 
167  const TransformJacobianType & jacobian,
168  const MovingImageDerivativeType & movingImageDerivative,
169  DerivativeType & imageJacobian ) const;
170 
180  mutable int m_NumberOfSamples;
181 
182 private:
183 
184  PCAMetric( const Self & ); // purposely not implemented
185  void operator=( const Self & ); // purposely not implemented
186 
188  void SampleRandom( const int n, const int m, std::vector< int > & numbers ) const;
189 
195 
196  bool m_DeNoise;
197 
198  double m_VarNoise;
199 
202 
205 
208 
210  unsigned int m_NumEigenValues;
211 
213 
214 };
215 
216 } // end namespace itk
217 
218 #ifndef ITK_MANUAL_INSTANTIATION
219 #include "itkPCAMetric.hxx"
220 #endif
221 
222 #endif // end #ifndef __itkPCAMetric_h
itk::AdvancedImageToImageMetric< MetricBase< TElastix >::FixedImageType, MetricBase< TElastix >::MovingImageType >::TransformParametersType
Superclass::TransformParametersType TransformParametersType
Definition: itkAdvancedImageToImageMetric.h:113
itk::PCAMetric::m_GridSize
FixedImageSizeType m_GridSize
Definition: itkPCAMetric.h:204
itk::PCAMetric::GradientPixelType
Superclass::GradientPixelType GradientPixelType
Definition: itkPCAMetric.h:88
itk::PCAMetric::MovingImagePixelType
Superclass::MovingImagePixelType MovingImagePixelType
Definition: itkPCAMetric.h:75
itk::PCAMetric::FixedImageIndexType
Superclass::FixedImageIndexType FixedImageIndexType
Definition: itkPCAMetric.h:150
itk::PCAMetric::TransformJacobianType
Superclass::TransformJacobianType TransformJacobianType
Definition: itkPCAMetric.h:84
SmartPointer< Self >
itk::AdvancedImageToImageMetric
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics.
Definition: itkAdvancedImageToImageMetric.h:81
itk::PCAMetric::GetDerivative
virtual void GetDerivative(const TransformParametersType &parameters, DerivativeType &derivative) const
itk::PCAMetric::SampleRandom
void SampleRandom(const int n, const int m, std::vector< int > &numbers) const
itk::PCAMetric::NonZeroJacobianIndicesType
Superclass::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
Definition: itkPCAMetric.h:161
itk::AdvancedImageToImageMetric< MetricBase< TElastix >::FixedImageType, MetricBase< TElastix >::MovingImageType >::DerivativeType
Superclass::DerivativeType DerivativeType
Definition: itkAdvancedImageToImageMetric.h:128
itkImageRandomCoordinateSampler.h
itk::PCAMetric::OutputPointType
Superclass::OutputPointType OutputPointType
Definition: itkPCAMetric.h:82
itk::PCAMetric::MovingImageDerivativeType
Superclass::MovingImageDerivativeType MovingImageDerivativeType
Definition: itkPCAMetric.h:160
itk::PCAMetric::itkStaticConstMacro
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
itk::PCAMetric::InterpolatorType
Superclass::InterpolatorType InterpolatorType
Definition: itkPCAMetric.h:85
itk::PCAMetric::m_secondEigenVector
vnl_vector< double > m_secondEigenVector
Definition: itkPCAMetric.h:172
itk::PCAMetric::ImageSamplerPointer
Superclass::ImageSamplerPointer ImageSamplerPointer
Definition: itkPCAMetric.h:103
itk::PCAMetric::FixedImageSizeType
FixedImageRegionType::SizeType FixedImageSizeType
Definition: itkPCAMetric.h:46
itk::PCAMetric::m_ReducedDimensionIndex
unsigned int m_ReducedDimensionIndex
Definition: itkPCAMetric.h:194
itk::AdvancedImageToImageMetric< MetricBase< TElastix >::FixedImageType, MetricBase< TElastix >::MovingImageType >::MovingImageDerivativeType
BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
Definition: itkAdvancedImageToImageMetric.h:323
itk::PCAMetric::PCAMetric
PCAMetric(const Self &)
itk::PCAMetric::GradientImagePointer
Superclass::GradientImagePointer GradientImagePointer
Definition: itkPCAMetric.h:90
itk::PCAMetric::MovingImageLimiterOutputType
Superclass::MovingImageLimiterOutputType MovingImageLimiterOutputType
Definition: itkPCAMetric.h:112
itk::PCAMetric::FixedImageType
Superclass::FixedImageType FixedImageType
Definition: itkPCAMetric.h:77
itk::PCAMetric::RealType
Superclass::RealType RealType
Definition: itkPCAMetric.h:87
itk::PCAMetric::BSplineInterpolatorType
Superclass::BSplineInterpolatorType BSplineInterpolatorType
Definition: itkPCAMetric.h:158
itk::PCAMetric::ImageSampleContainerPointer
Superclass::ImageSampleContainerPointer ImageSampleContainerPointer
Definition: itkPCAMetric.h:106
itk::PCAMetric::MovingImageContinuousIndexType
Superclass::MovingImageContinuousIndexType MovingImageContinuousIndexType
Definition: itkPCAMetric.h:157
itk::PCAMetric
Definition: itkPCAMetric.h:35
itk::PCAMetric::MovingImageMaskType
Superclass::MovingImageMaskType MovingImageMaskType
Definition: itkPCAMetric.h:95
itk::PCAMetric::ImageSampleContainerType
Superclass::ImageSampleContainerType ImageSampleContainerType
Definition: itkPCAMetric.h:104
itk::PCAMetric::MovingImageIndexType
Superclass::MovingImageIndexType MovingImageIndexType
Definition: itkPCAMetric.h:152
itk::AdvancedImageToImageMetric< MetricBase< TElastix >::FixedImageType, MetricBase< TElastix >::MovingImageType >::TransformJacobianType
Superclass::TransformJacobianType TransformJacobianType
Definition: itkAdvancedImageToImageMetric.h:114
itk::PCAMetric::m_DeNoise
bool m_DeNoise
Definition: itkPCAMetric.h:196
itk::PCAMetric::itkStaticConstMacro
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
itk::PCAMetric::FixedImageConstPointer
Superclass::FixedImageConstPointer FixedImageConstPointer
Definition: itkPCAMetric.h:78
itk::PCAMetric::CoordinateRepresentationType
Superclass::CoordinateRepresentationType CoordinateRepresentationType
Definition: itkPCAMetric.h:69
itk::PCAMetric::PCAMetric
PCAMetric()
itk::PCAMetric::operator=
void operator=(const Self &)
itk::PCAMetric::GetValue
virtual MeasureType GetValue(const TransformParametersType &parameters) const
itk::PCAMetric::MovingImageConstPointer
Superclass::MovingImageConstPointer MovingImageConstPointer
Definition: itkPCAMetric.h:76
itk::PCAMetric::ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkPCAMetric.h:43
itk::PCAMetric::MovingImageDerivativeScalesType
Superclass::MovingImageDerivativeScalesType MovingImageDerivativeScalesType
Definition: itkPCAMetric.h:114
itk::PCAMetric::m_UseDerivativeOfMean
bool m_UseDerivativeOfMean
Definition: itkPCAMetric.h:212
itk::PCAMetric::FixedImageIndexValueType
Superclass::FixedImageIndexValueType FixedImageIndexValueType
Definition: itkPCAMetric.h:151
itk::PCAMetric::m_thirdEigenVector
vnl_vector< double > m_thirdEigenVector
Definition: itkPCAMetric.h:173
itk::PCAMetric::FixedImageLimiterOutputType
Superclass::FixedImageLimiterOutputType FixedImageLimiterOutputType
Definition: itkPCAMetric.h:110
itk::PCAMetric::FixedImageMaskType
Superclass::FixedImageMaskType FixedImageMaskType
Definition: itkPCAMetric.h:93
itk::PCAMetric::FixedImageContinuousIndexType
itk::ContinuousIndex< CoordinateRepresentationType, FixedImageDimension > FixedImageContinuousIndexType
Definition: itkPCAMetric.h:155
itk::PCAMetric::MovingImageMaskPointer
Superclass::MovingImageMaskPointer MovingImageMaskPointer
Definition: itkPCAMetric.h:96
itk::PCAMetric::m_seventhEigenVector
vnl_vector< double > m_seventhEigenVector
Definition: itkPCAMetric.h:177
itk::PCAMetric::CentralDifferenceGradientFilterType
Superclass::CentralDifferenceGradientFilterType CentralDifferenceGradientFilterType
Definition: itkPCAMetric.h:159
itk::PCAMetric::FixedImagePixelType
Superclass::FixedImagePixelType FixedImagePixelType
Definition: itkPCAMetric.h:100
itk::PCAMetric::m_sixthEigenVector
vnl_vector< double > m_sixthEigenVector
Definition: itkPCAMetric.h:176
itk::PCAMetric::m_normdCdmu
vnl_vector< double > m_normdCdmu
Definition: itkPCAMetric.h:179
itk::PCAMetric::DerivativeType
Superclass::DerivativeType DerivativeType
Definition: itkPCAMetric.h:98
itk::PCAMetric::Self
PCAMetric Self
Definition: itkPCAMetric.h:39
itk::PCAMetric::TransformType
Superclass::TransformType TransformType
Definition: itkPCAMetric.h:79
itk::PCAMetric::m_TransformIsStackTransform
bool m_TransformIsStackTransform
Definition: itkPCAMetric.h:207
itk::PCAMetric::MovingImagePointType
Superclass::MovingImagePointType MovingImagePointType
Definition: itkPCAMetric.h:156
itk::PCAMetric::MeasureType
Superclass::MeasureType MeasureType
Definition: itkPCAMetric.h:97
itk::PCAMetric::GetValueAndDerivative
virtual void GetValueAndDerivative(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const
itk::PCAMetric::FixedImageLimiterType
Superclass::FixedImageLimiterType FixedImageLimiterType
Definition: itkPCAMetric.h:107
itk::PCAMetric::m_firstEigenVector
vnl_vector< double > m_firstEigenVector
Definition: itkPCAMetric.h:171
itk::PCAMetric::~PCAMetric
virtual ~PCAMetric()
Definition: itkPCAMetric.h:144
itk::PCAMetric::Superclass
AdvancedImageToImageMetric< TFixedImage, TMovingImage > Superclass
Definition: itkPCAMetric.h:41
itk::PCAMetric::PrintSelf
void PrintSelf(std::ostream &os, Indent indent) const
itk::PCAMetric::InterpolatorPointer
Superclass::InterpolatorPointer InterpolatorPointer
Definition: itkPCAMetric.h:86
itk::PCAMetric::m_NumAdditionalSamplesFixed
unsigned int m_NumAdditionalSamplesFixed
Definition: itkPCAMetric.h:193
itk::PCAMetric::ParametersType
Superclass::ParametersType ParametersType
Definition: itkPCAMetric.h:99
itk::PCAMetric::FixedImagePointType
Superclass::FixedImagePointType FixedImagePointType
Definition: itkPCAMetric.h:153
itk::AdvancedImageToImageMetric< MetricBase< TElastix >::FixedImageType, MetricBase< TElastix >::MovingImageType >::MeasureType
Superclass::MeasureType MeasureType
Definition: itkAdvancedImageToImageMetric.h:127
itk::PCAMetric::m_NumEigenValues
unsigned int m_NumEigenValues
Definition: itkPCAMetric.h:210
itk::PCAMetric::m_eigenValues
vnl_vector< double > m_eigenValues
Definition: itkPCAMetric.h:178
itk::PCAMetric::m_SampleLastDimensionRandomly
bool m_SampleLastDimensionRandomly
Definition: itkPCAMetric.h:191
itk::PCAMetric::GradientImageType
Superclass::GradientImageType GradientImageType
Definition: itkPCAMetric.h:89
itk
Definition: itkAdvancedImageToImageMetric.h:40
itk::PCAMetric::MovingImageRegionType
Superclass::MovingImageRegionType MovingImageRegionType
Definition: itkPCAMetric.h:101
itk::PCAMetric::m_NumSamplesLastDimension
unsigned int m_NumSamplesLastDimension
Definition: itkPCAMetric.h:192
itk::PCAMetric::GradientImageFilterType
Superclass::GradientImageFilterType GradientImageFilterType
Definition: itkPCAMetric.h:91
itk::PCAMetric::ImageSamplerType
Superclass::ImageSamplerType ImageSamplerType
Definition: itkPCAMetric.h:102
itk::PCAMetric::GradientImageFilterPointer
Superclass::GradientImageFilterPointer GradientImageFilterPointer
Definition: itkPCAMetric.h:92
itk::PCAMetric::Pointer
SmartPointer< Self > Pointer
Definition: itkPCAMetric.h:42
itk::PCAMetric::m_fifthEigenVector
vnl_vector< double > m_fifthEigenVector
Definition: itkPCAMetric.h:175
itk::PCAMetric::FixedImageMaskPointer
Superclass::FixedImageMaskPointer FixedImageMaskPointer
Definition: itkPCAMetric.h:94
itk::PCAMetric::Initialize
virtual void Initialize(void)
itk::PCAMetric::m_SubtractMean
bool m_SubtractMean
Definition: itkPCAMetric.h:201
itk::PCAMetric::TransformPointer
Superclass::TransformPointer TransformPointer
Definition: itkPCAMetric.h:80
itk::PCAMetric::InputPointType
Superclass::InputPointType InputPointType
Definition: itkPCAMetric.h:81
itk::PCAMetric::TransformParametersType
Superclass::TransformParametersType TransformParametersType
Definition: itkPCAMetric.h:83
itk::PCAMetric::m_VarNoise
double m_VarNoise
Definition: itkPCAMetric.h:198
itk::PCAMetric::FixedImageRegionType
Superclass::FixedImageRegionType FixedImageRegionType
Definition: itkPCAMetric.h:45
vnl_vector< double >
itk::PCAMetric::m_fourthEigenVector
vnl_vector< double > m_fourthEigenVector
Definition: itkPCAMetric.h:174
itkAdvancedImageToImageMetric.h
itk::PCAMetric::MovingImageType
Superclass::MovingImageType MovingImageType
Definition: itkPCAMetric.h:74
itk::PCAMetric::MovingImageLimiterType
Superclass::MovingImageLimiterType MovingImageLimiterType
Definition: itkPCAMetric.h:108
itk::PCAMetric::m_NumberOfSamples
int m_NumberOfSamples
Definition: itkPCAMetric.h:180
itk::PCAMetric::EvaluateTransformJacobianInnerProduct
void EvaluateTransformJacobianInnerProduct(const TransformJacobianType &jacobian, const MovingImageDerivativeType &movingImageDerivative, DerivativeType &imageJacobian) const


Generated on OURCE_DATE_EPOCH for elastix by doxygen 1.8.18 elastix logo