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;
41  typedef SmartPointer< const Self > ConstPointer;
42 
44  typedef typename FixedImageRegionType::SizeType FixedImageSizeType;
45 
47  itkNewMacro( Self );
48 
50  itkTypeMacro( PCAMetric, AdvancedImageToImageMetric );
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  virtual MeasureType GetValue( const TransformParametersType & parameters ) const;
122 
124  virtual void GetDerivative( const TransformParametersType & parameters,
125  DerivativeType & derivative ) const;
126 
128  void GetValueAndDerivativeSingleThreaded( const TransformParametersType & parameters,
129  MeasureType & Value, DerivativeType & Derivative ) const;
130 
131  virtual void GetValueAndDerivative( const TransformParametersType & parameters,
132  MeasureType & Value, DerivativeType & Derivative ) const;
133 
138  virtual void Initialize( void ) throw ( ExceptionObject );
139 
140 protected:
141 
142  PCAMetric();
143  virtual ~PCAMetric();
144  void PrintSelf( std::ostream & os, Indent indent ) const;
145 
153  typedef typename itk::ContinuousIndex< CoordinateRepresentationType, FixedImageDimension >
161 
166  const TransformJacobianType & jacobian,
167  const MovingImageDerivativeType & movingImageDerivative,
168  DerivativeType & imageJacobian ) const;
169 
171  {
172  Self * m_Metric;
173  };
174 
175  PCAMetricMultiThreaderParameterType m_PCAMetricThreaderParameters;
176 
178  {
180  MatrixType st_DataBlock;
181  std::vector< FixedImagePointType > st_ApprovedSamples;
182  DerivativeType st_Derivative;
183  };
184 
185  itkPadStruct( ITK_CACHE_LINE_ALIGNMENT, PCAMetricGetSamplesPerThreadStruct,
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_TYPE GetSamplesThreaderCallback( void * arg );
207 
208  static ITK_THREAD_RETURN_TYPE ComputeDerivativeThreaderCallback( void * arg );
209 
211  void LaunchGetSamplesThreaderCallback( void ) const;
212 
213  void LaunchComputeDerivativeThreaderCallback( void ) const;
214 
216  virtual void InitializeThreadingParameters( void ) const;
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 
230  FixedImageSizeType m_GridSize;
231 
234 
236  unsigned int m_NumEigenValues;
237 
239  mutable std::vector< unsigned int > m_PixelStartIndex;
240  mutable MatrixType m_Atmm;
241  mutable DerivativeMatrixType m_vSAtmm;
242  mutable DerivativeMatrixType m_CSv;
243  mutable DerivativeMatrixType m_Sv;
244  mutable DerivativeMatrixType m_vdSdmu_part1;
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__
bool m_TransformIsStackTransform
Definition: itkPCAMetric.h:207
Superclass::FixedImageConstPointer FixedImageConstPointer
void operator=(const Self &)
Superclass::InterpolatorPointer InterpolatorPointer
Superclass::CoordinateRepresentationType CoordinateRepresentationType
void ThreadedGetSamples(ThreadIdType threadID)
virtual ~PCAMetric()
Definition: itkPCAMetric.h:144
Superclass::MovingImageRegionType MovingImageRegionType
DerivativeMatrixType m_vdSdmu_part1
ThreadIdType m_PCAMetricGetSamplesPerThreadVariablesSize
unsigned int m_NumEigenValues
Definition: itkPCAMetric.h:210
Superclass::GradientImageFilterType GradientImageFilterType
Superclass::TransformType TransformType
LimiterFunctionBase< RealType, FixedImageDimension > FixedImageLimiterType
Superclass::CoordinateRepresentationType CoordinateRepresentationType
virtual MeasureType GetValue(const TransformParametersType &parameters) const
Superclass::TransformParametersType TransformParametersType
Superclass::InputPointType InputPointType
Superclass::FixedImageIndexValueType FixedImageIndexValueType
Superclass::MovingImageConstPointer MovingImageConstPointer
Superclass::DerivativeType DerivativeType
Superclass::FixedImagePointType FixedImagePointType
Superclass::MeasureType MeasureType
vnl_matrix< DerivativeValueType > DerivativeMatrixType
Superclass::FixedImageMaskPointer FixedImageMaskPointer
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics...
void AfterThreadedComputeDerivative(DerivativeType &derivative) const
void AfterThreadedGetSamples(MeasureType &value) const
DerivativeMatrixType m_vSAtmm
SmartPointer< const Self > ConstPointer
Superclass::GradientPixelType GradientPixelType
virtual void Initialize(void)
FixedImageLimiterType::OutputType FixedImageLimiterOutputType
Superclass::FixedImageLimiterType FixedImageLimiterType
AlignedPCAMetricGetSamplesPerThreadStruct * m_PCAMetricGetSamplesPerThreadVariables
Superclass::FixedImageRegionType FixedImageRegionType
static ITK_THREAD_RETURN_TYPE ComputeDerivativeThreaderCallback(void *arg)
AdvancedImageToImageMetric< TFixedImage, TMovingImage > Superclass
virtual void GetValueAndDerivative(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const
ImageSamplerType::OutputVectorContainerType ImageSampleContainerType
Superclass::TransformPointer TransformPointer
MovingImageType::IndexType MovingImageIndexType
Superclass::MovingImagePointType MovingImagePointType
InterpolatorType::ContinuousIndexType MovingImageContinuousIndexType
void PrintSelf(std::ostream &os, Indent indent) const
Superclass::GradientImageFilterPointer GradientImageFilterPointer
TransformType::InputPointType FixedImagePointType
Superclass::GradientPixelType GradientPixelType
static ITK_THREAD_RETURN_TYPE GetSamplesThreaderCallback(void *arg)
FixedArray< double, Self::MovingImageDimension > MovingImageDerivativeScalesType
Superclass::MovingImageType MovingImageType
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double > BSplineInterpolatorType
ImageSamplerBase< FixedImageType > ImageSamplerType
Superclass::GradientImageType GradientImageType
Superclass::MovingImageLimiterType MovingImageLimiterType
AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
Superclass::FixedImageIndexType FixedImageIndexType
Superclass::FixedImageRegionType FixedImageRegionType
Superclass::ImageSamplerType ImageSamplerType
Superclass::ParametersType ParametersType
void EvaluateTransformJacobianInnerProduct(const TransformJacobianType &jacobian, const MovingImageDerivativeType &movingImageDerivative, DerivativeType &imageJacobian) const
SmartPointer< Self > Pointer
Superclass::InterpolatorPointer InterpolatorPointer
DerivativeMatrixType m_Sv
Superclass::FixedImageMaskPointer FixedImageMaskPointer
Superclass::TransformJacobianType TransformJacobianType
void LaunchGetSamplesThreaderCallback(void) const
virtual void GetDerivative(const TransformParametersType &parameters, DerivativeType &derivative) const
Superclass::ThreaderType ThreaderType
Superclass::TransformParametersType TransformParametersType
void LaunchComputeDerivativeThreaderCallback(void) const
FixedImageIndexType::IndexValueType FixedImageIndexValueType
TransformType::OutputPointType MovingImagePointType
FixedImageSizeType m_GridSize
Definition: itkPCAMetric.h:204
Superclass::MovingImagePixelType MovingImagePixelType
Superclass::MovingImageMaskType MovingImageMaskType
LimiterFunctionBase< RealType, MovingImageDimension > MovingImageLimiterType
Superclass::GradientImageType GradientImageType
Superclass::TransformPointer TransformPointer
void GetValueAndDerivativeSingleThreaded(const TransformParametersType &parameters, MeasureType &Value, DerivativeType &Derivative) const
Superclass::ThreadInfoType ThreadInfoType
FixedImageRegionType::SizeType FixedImageSizeType
Superclass::ImageSamplerPointer ImageSamplerPointer
Superclass::GradientImageFilterType GradientImageFilterType
MovingImageType::RegionType MovingImageRegionType
Superclass::GradientImagePointer GradientImagePointer
Superclass::InterpolatorType InterpolatorType
Superclass::MovingImageIndexType MovingImageIndexType
Superclass::InterpolatorType InterpolatorType
Superclass::BSplineInterpolatorType BSplineInterpolatorType
Superclass::TransformJacobianType TransformJacobianType
vnl_matrix< RealType > MatrixType
PCAMetricMultiThreaderParameterType m_PCAMetricThreaderParameters
Superclass::MovingImageLimiterOutputType MovingImageLimiterOutputType
Superclass::RealType RealType
Superclass::ImageSampleContainerType ImageSampleContainerType
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
Superclass::MovingImagePixelType MovingImagePixelType
GradientImageFilter< MovingImageType, RealType, RealType > CentralDifferenceGradientFilterType
Superclass::OutputPointType OutputPointType
Superclass::MovingImageDerivativeType MovingImageDerivativeType
std::vector< unsigned int > m_PixelStartIndex
void ThreadedComputeDerivative(ThreadIdType threadID)
virtual void InitializeThreadingParameters(void) const
Superclass::MovingImageMaskPointer MovingImageMaskPointer
Superclass::FixedImageLimiterOutputType FixedImageLimiterOutputType
MovingImageLimiterType::OutputType MovingImageLimiterOutputType
DerivativeMatrixType m_CSv
ThreaderType::ThreadInfoStruct ThreadInfoType
Superclass::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
Superclass::FixedImageMaskType FixedImageMaskType
Superclass::ImageSampleContainerPointer ImageSampleContainerPointer
Superclass::MovingImageDerivativeScalesType MovingImageDerivativeScalesType
Superclass::MovingImageContinuousIndexType MovingImageContinuousIndexType
ImageSamplerType::OutputVectorContainerPointer ImageSampleContainerPointer
Superclass::FixedImageMaskType FixedImageMaskType
Superclass::FixedImageType FixedImageType
DerivativeType::ValueType DerivativeValueType
Superclass::MovingImageMaskPointer MovingImageMaskPointer
Superclass::CentralDifferenceGradientFilterType CentralDifferenceGradientFilterType
BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
Superclass::FixedImageConstPointer FixedImageConstPointer
Superclass::MovingImageConstPointer MovingImageConstPointer
Superclass::MovingImageMaskType MovingImageMaskType
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, PCAMetricGetSamplesPerThreadStruct, PaddedPCAMetricGetSamplesPerThreadStruct)
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedPCAMetricGetSamplesPerThreadStruct, AlignedPCAMetricGetSamplesPerThreadStruct)
Superclass::FixedImagePixelType FixedImagePixelType
itk::ContinuousIndex< CoordinateRepresentationType, FixedImageDimension > FixedImageContinuousIndexType
Superclass::GradientImageFilterPointer GradientImageFilterPointer
Superclass::GradientImagePointer GradientImagePointer


Generated on OURCE_DATE_EPOCH for elastix by doxygen 1.8.13 elastix logo