go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkPCAMetric_F_multithreaded.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_F_multithreaded_H__
19 #define __itkPCAMetric_F_multithreaded_H__
20 
22 
23 #include "itkSmoothingRecursiveGaussianImageFilter.h"
25 #include "itkNearestNeighborInterpolateImageFunction.h"
26 #include "itkExtractImageFilter.h"
27 
28 namespace itk
29 {
30 template< class TFixedImage, class TMovingImage >
31 class PCAMetric :
32  public AdvancedImageToImageMetric< TFixedImage, TMovingImage >
33 {
34 public:
35 
37  typedef PCAMetric Self;
39  TFixedImage, TMovingImage > Superclass;
40  typedef SmartPointer< Self > Pointer;
41  typedef SmartPointer< const Self > ConstPointer;
42 
44  typedef typename FixedImageRegionType::SizeType FixedImageSizeType;
45 
47  itkNewMacro( Self );
48 
51 
53  itkSetMacro( SubtractMean, bool );
54  itkSetMacro( GridSize, FixedImageSizeType );
55  itkSetMacro( TransformIsStackTransform, bool );
56  itkSetMacro( NumEigenValues, unsigned int );
57 
59  typedef typename
74  typedef typename Superclass::RealType RealType;
92  typedef typename
96  typedef typename
98  typedef typename
100  typedef typename
102  typedef typename DerivativeType::ValueType DerivativeValueType;
105 
108 
109 // typedef vnl_matrix< double > MatrixType;
110 // typedef vnl_matrix< double > DerivativeMatrixType;
111 
113  itkStaticConstMacro( FixedImageDimension, unsigned int,
114  FixedImageType::ImageDimension );
115 
117  itkStaticConstMacro( MovingImageDimension, unsigned int,
118  MovingImageType::ImageDimension );
119 
121  MeasureType GetValue( const TransformParametersType & parameters ) const override;
122 
124  void GetDerivative( const TransformParametersType & parameters,
125  DerivativeType & derivative ) const override;
126 
129  MeasureType & Value, DerivativeType & Derivative ) const;
130 
132  MeasureType & Value, DerivativeType & Derivative ) const override;
133 
138  void Initialize( void ) override;
139 
140 protected:
141 
143  ~PCAMetric() override;
144  void PrintSelf( std::ostream & os, Indent indent ) const override;
145 
153  typedef typename itk::ContinuousIndex< CoordinateRepresentationType, FixedImageDimension >
161 
166  const TransformJacobianType & jacobian,
167  const MovingImageDerivativeType & movingImageDerivative,
168  DerivativeType & imageJacobian ) const override;
169 
171  {
173  };
174 
176 
178  {
181  std::vector< FixedImagePointType > st_ApprovedSamples;
183  };
184 
186  PaddedPCAMetricGetSamplesPerThreadStruct );
187 
188  itkAlignedTypedef( ITK_CACHE_LINE_ALIGNMENT,
189  PaddedPCAMetricGetSamplesPerThreadStruct,
190  AlignedPCAMetricGetSamplesPerThreadStruct );
191 
192  mutable AlignedPCAMetricGetSamplesPerThreadStruct * m_PCAMetricGetSamplesPerThreadVariables;
194 
196  inline void ThreadedGetSamples( ThreadIdType threadID );
197 
198  inline void ThreadedComputeDerivative( ThreadIdType threadID );
199 
201  inline void AfterThreadedGetSamples( MeasureType & value ) const;
202 
203  inline void AfterThreadedComputeDerivative( DerivativeType & derivative ) const;
204 
206  static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION GetSamplesThreaderCallback( void * arg );
207 
208  static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION ComputeDerivativeThreaderCallback( void * arg );
209 
212 
214 
216  void InitializeThreadingParameters( void ) const override;
217 
218 private:
219 
220  PCAMetric( const Self & ); // purposely not implemented
221  void operator=( const Self & ); // purposely not implemented
222 
223  unsigned int m_G;
224  unsigned int m_LastDimIndex;
225 
227  bool m_SubtractMean;
228 
231 
234 
236  unsigned int m_NumEigenValues;
237 
239  mutable std::vector< unsigned int > m_PixelStartIndex;
245 
246 };
247 
248 } // end namespace itk
249 
250 #ifndef ITK_MANUAL_INSTANTIATION
251 #include "itkPCAMetric_F_multithreaded.hxx"
252 #endif
253 
254 #endif // end #ifndef __itkPCAMetric_F_multithreaded_H__
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics.
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double > BSplineInterpolatorType
Superclass::FixedImageConstPointer FixedImageConstPointer
Superclass::TransformParametersType TransformParametersType
Superclass::MovingImageConstPointer MovingImageConstPointer
Superclass::FixedImageMaskPointer FixedImageMaskPointer
InterpolatorType::ContinuousIndexType MovingImageContinuousIndexType
Superclass::GradientImageFilterPointer GradientImageFilterPointer
Superclass::GradientImageFilterType GradientImageFilterType
Superclass::TransformJacobianType TransformJacobianType
FixedArray< double, Self::MovingImageDimension > MovingImageDerivativeScalesType
Superclass::GradientImagePointer GradientImagePointer
Superclass::TransformPointer TransformPointer
ImageSamplerType::OutputVectorContainerPointer ImageSampleContainerPointer
AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
ImageSamplerBase< FixedImageType > ImageSamplerType
Superclass::CoordinateRepresentationType CoordinateRepresentationType
ImageSamplerType::OutputVectorContainerType ImageSampleContainerType
Superclass::InterpolatorPointer InterpolatorPointer
Superclass::MovingImageMaskPointer MovingImageMaskPointer
TransformType::InputPointType FixedImagePointType
Superclass::MovingImageMaskType MovingImageMaskType
Superclass::GradientPixelType GradientPixelType
MovingImageType::IndexType MovingImageIndexType
MovingImageType::RegionType MovingImageRegionType
FixedImageLimiterType::OutputType FixedImageLimiterOutputType
FixedImageIndexType::IndexValueType FixedImageIndexValueType
Superclass::MovingImagePixelType MovingImagePixelType
MovingImageLimiterType::OutputType MovingImageLimiterOutputType
GradientImageFilter< MovingImageType, RealType, RealType > CentralDifferenceGradientFilterType
LimiterFunctionBase< RealType, MovingImageDimension > MovingImageLimiterType
BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
Superclass::FixedImageMaskType FixedImageMaskType
Superclass::GradientImageType GradientImageType
Superclass::InterpolatorType InterpolatorType
TransformType::OutputPointType MovingImagePointType
LimiterFunctionBase< RealType, FixedImageDimension > FixedImageLimiterType
Superclass::FixedImageRegionType FixedImageRegionType
Superclass::TransformPointer TransformPointer
Superclass::FixedImageLimiterType FixedImageLimiterType
void Initialize(void) override
Superclass::MovingImagePointType MovingImagePointType
unsigned int m_NumEigenValues
Definition: itkPCAMetric.h:210
void GetValueAndDerivativeSingleThreaded(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const
Superclass::InterpolatorPointer InterpolatorPointer
void AfterThreadedGetSamples(MeasureType &value) const
void PrintSelf(std::ostream &os, Indent indent) const override
Superclass::DerivativeType DerivativeType
std::vector< unsigned int > m_PixelStartIndex
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
Superclass::MovingImageLimiterOutputType MovingImageLimiterOutputType
Superclass::ImageSamplerType ImageSamplerType
PCAMetricMultiThreaderParameterType m_PCAMetricThreaderParameters
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedPCAMetricGetSamplesPerThreadStruct, AlignedPCAMetricGetSamplesPerThreadStruct)
Superclass::MovingImageContinuousIndexType MovingImageContinuousIndexType
Superclass::GradientImagePointer GradientImagePointer
void LaunchGetSamplesThreaderCallback(void) const
Superclass::GradientImageFilterPointer GradientImageFilterPointer
void GetValueAndDerivative(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const override
Superclass::ImageSamplerPointer ImageSamplerPointer
MeasureType GetValue(const TransformParametersType &parameters) const override
void EvaluateTransformJacobianInnerProduct(const TransformJacobianType &jacobian, const MovingImageDerivativeType &movingImageDerivative, DerivativeType &imageJacobian) const override
itk::ContinuousIndex< CoordinateRepresentationType, FixedImageDimension > FixedImageContinuousIndexType
DerivativeMatrixType m_Sv
Superclass::MovingImageType MovingImageType
Superclass::MovingImagePixelType MovingImagePixelType
AlignedPCAMetricGetSamplesPerThreadStruct * m_PCAMetricGetSamplesPerThreadVariables
ThreadIdType m_PCAMetricGetSamplesPerThreadVariablesSize
Superclass::FixedImageConstPointer FixedImageConstPointer
Superclass::CentralDifferenceGradientFilterType CentralDifferenceGradientFilterType
FixedImageSizeType m_GridSize
Definition: itkPCAMetric.h:204
Superclass::MovingImageIndexType MovingImageIndexType
Superclass::OutputPointType OutputPointType
void InitializeThreadingParameters(void) const override
Superclass::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
Superclass::MeasureType MeasureType
Superclass::InputPointType InputPointType
Superclass::FixedImageMaskPointer FixedImageMaskPointer
Superclass::MovingImageMaskType MovingImageMaskType
bool m_TransformIsStackTransform
Definition: itkPCAMetric.h:207
Superclass::ImageSampleContainerType ImageSampleContainerType
Superclass::MovingImageRegionType MovingImageRegionType
DerivativeMatrixType m_vSAtmm
Superclass::GradientPixelType GradientPixelType
void operator=(const Self &)
Superclass::TransformJacobianType TransformJacobianType
Superclass::BSplineInterpolatorType BSplineInterpolatorType
Superclass::ThreadInfoType ThreadInfoType
Superclass::MovingImageDerivativeType MovingImageDerivativeType
Superclass::RealType RealType
AdvancedImageToImageMetric< TFixedImage, TMovingImage > Superclass
Superclass::MovingImageDerivativeScalesType MovingImageDerivativeScalesType
Superclass::MovingImageConstPointer MovingImageConstPointer
Superclass::CoordinateRepresentationType CoordinateRepresentationType
DerivativeMatrixType m_CSv
void LaunchComputeDerivativeThreaderCallback(void) const
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
Superclass::FixedImageLimiterOutputType FixedImageLimiterOutputType
Superclass::GradientImageType GradientImageType
Superclass::InterpolatorType InterpolatorType
Superclass::ParametersType ParametersType
Superclass::FixedImageRegionType FixedImageRegionType
void ThreadedComputeDerivative(ThreadIdType threadID)
PCAMetric(const Self &)
Superclass::GradientImageFilterType GradientImageFilterType
Superclass::FixedImagePointType FixedImagePointType
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION GetSamplesThreaderCallback(void *arg)
SmartPointer< Self > Pointer
void AfterThreadedComputeDerivative(DerivativeType &derivative) const
vnl_matrix< DerivativeValueType > DerivativeMatrixType
Superclass::MovingImageLimiterType MovingImageLimiterType
Superclass::FixedImagePixelType FixedImagePixelType
Superclass::MovingImageMaskPointer MovingImageMaskPointer
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION ComputeDerivativeThreaderCallback(void *arg)
Superclass::FixedImageIndexType FixedImageIndexType
Superclass::FixedImageMaskType FixedImageMaskType
Superclass::ImageSampleContainerPointer ImageSampleContainerPointer
FixedImageRegionType::SizeType FixedImageSizeType
void ThreadedGetSamples(ThreadIdType threadID)
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, PCAMetricGetSamplesPerThreadStruct, PaddedPCAMetricGetSamplesPerThreadStruct)
Superclass::TransformParametersType TransformParametersType
DerivativeMatrixType m_vdSdmu_part1
DerivativeType::ValueType DerivativeValueType
Superclass::FixedImageIndexValueType FixedImageIndexValueType
Superclass::ThreaderType ThreaderType
SmartPointer< const Self > ConstPointer
Superclass::TransformType TransformType
void GetDerivative(const TransformParametersType &parameters, DerivativeType &derivative) const override
vnl_matrix< RealType > MatrixType
Superclass::FixedImageType FixedImageType
~PCAMetric() override


Generated on OURCE_DATE_EPOCH for elastix by doxygen 1.9.1 elastix logo