go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkAdvancedNormalizedCorrelationImageToImageMetric.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 __itkAdvancedNormalizedCorrelationImageToImageMetric_h
19 #define __itkAdvancedNormalizedCorrelationImageToImageMetric_h
20 
22 
23 namespace itk
24 {
89 template< class TFixedImage, class TMovingImage >
91  public AdvancedImageToImageMetric< TFixedImage, TMovingImage >
92 {
93 public:
94 
98  TFixedImage, TMovingImage > Superclass;
100  typedef SmartPointer< const Self > ConstPointer;
101 
103  itkNewMacro( Self );
104 
107 
109  typedef typename
126  typedef typename Superclass::RealType RealType;
145  typedef typename
149  typedef typename
151  typedef typename
153  typedef typename
157 
159  itkStaticConstMacro( FixedImageDimension, unsigned int,
160  FixedImageType::ImageDimension );
161 
163  itkStaticConstMacro( MovingImageDimension, unsigned int,
164  MovingImageType::ImageDimension );
165 
167  MeasureType GetValue( const TransformParametersType & parameters ) const;
168 
170  void GetDerivative(
171  const TransformParametersType & parameters,
172  DerivativeType & derivative ) const;
173 
176  const TransformParametersType & parameters,
177  MeasureType & value, DerivativeType & derivative ) const;
178 
180  const TransformParametersType & parameters,
181  MeasureType & value, DerivativeType & derivative ) const;
182 
188  itkSetMacro( SubtractMean, bool );
189  itkGetConstReferenceMacro( SubtractMean, bool );
190  itkBooleanMacro( SubtractMean );
191 
192 protected:
193 
196 
197  void PrintSelf( std::ostream & os, Indent indent ) const;
198 
212 
217  const RealType & fixedImageValue,
218  const RealType & movingImageValue,
219  const DerivativeType & imageJacobian,
220  const NonZeroJacobianIndicesType & nzji,
221  DerivativeType & derivativeF,
222  DerivativeType & derivativeM,
223  DerivativeType & differential ) const;
224 
229  virtual void InitializeThreadingParameters( void ) const;
230 
232  inline void ThreadedGetValueAndDerivative( ThreadIdType threadID );
233 
236  MeasureType & value, DerivativeType & derivative ) const;
237 
239  static ITK_THREAD_RETURN_TYPE AccumulateDerivativesThreaderCallback( void * arg );
240 
241 private:
242 
243  AdvancedNormalizedCorrelationImageToImageMetric( const Self & ); // purposely not implemented
244  void operator=( const Self & ); // purposely not implemented
245 
246  mutable bool m_SubtractMean;
247 
248  typedef typename NumericTraits< MeasureType >::AccumulateType AccumulateType;
249 
254  {
256 
257  AccumulateType st_sf_N;
258  AccumulateType st_sm_N;
259  AccumulateType st_sfm_smm;
261  DerivativeValueType * st_DerivativePointer;
262  };
263 
265  {
267  AccumulateType st_Sff;
268  AccumulateType st_Smm;
269  AccumulateType st_Sfm;
270  AccumulateType st_Sf;
271  AccumulateType st_Sm;
272  DerivativeType st_DerivativeF;
273  DerivativeType st_DerivativeM;
274  DerivativeType st_Differential;
275  };
277  PaddedCorrelationGetValueAndDerivativePerThreadStruct );
278  itkAlignedTypedef( ITK_CACHE_LINE_ALIGNMENT, PaddedCorrelationGetValueAndDerivativePerThreadStruct,
279  AlignedCorrelationGetValueAndDerivativePerThreadStruct );
280  mutable AlignedCorrelationGetValueAndDerivativePerThreadStruct * m_CorrelationGetValueAndDerivativePerThreadVariables;
282 
283 };
284 
285 } // end namespace itk
286 
287 #ifndef ITK_MANUAL_INSTANTIATION
288 #include "itkAdvancedNormalizedCorrelationImageToImageMetric.hxx"
289 #endif
290 
291 #endif // end #ifndef __itkAdvancedNormalizedCorrelationImageToImageMetric_h
AdvancedTransformType::NumberOfParametersType NumberOfParametersType
void ThreadedGetValueAndDerivative(ThreadIdType threadID)
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
LimiterFunctionBase< RealType, FixedImageDimension > FixedImageLimiterType
Superclass::CoordinateRepresentationType CoordinateRepresentationType
Superclass::TransformParametersType TransformParametersType
Superclass::FixedImageMaskPointer FixedImageMaskPointer
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics...
Superclass::GradientPixelType GradientPixelType
FixedImageLimiterType::OutputType FixedImageLimiterOutputType
Superclass::FixedImageRegionType FixedImageRegionType
ImageSamplerType::OutputVectorContainerType ImageSampleContainerType
MovingImageType::IndexType MovingImageIndexType
InterpolatorType::ContinuousIndexType MovingImageContinuousIndexType
itkAlignedTypedef(ITK_CACHE_LINE_ALIGNMENT, PaddedCorrelationGetValueAndDerivativePerThreadStruct, AlignedCorrelationGetValueAndDerivativePerThreadStruct)
static ITK_THREAD_RETURN_TYPE AccumulateDerivativesThreaderCallback(void *arg)
TransformType::InputPointType FixedImagePointType
FixedArray< double, Self::MovingImageDimension > MovingImageDerivativeScalesType
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double > BSplineInterpolatorType
ImageSamplerBase< FixedImageType > ImageSamplerType
AdvancedTransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
void GetDerivative(const TransformParametersType &parameters, DerivativeType &derivative) const
void GetValueAndDerivative(const TransformParametersType &parameters, MeasureType &value, DerivativeType &derivative) const
Superclass::InterpolatorPointer InterpolatorPointer
FixedImageIndexType::IndexValueType FixedImageIndexValueType
TransformType::OutputPointType MovingImagePointType
Superclass::MovingImageMaskType MovingImageMaskType
LimiterFunctionBase< RealType, MovingImageDimension > MovingImageLimiterType
void GetValueAndDerivativeSingleThreaded(const TransformParametersType &parameters, MeasureType &value, DerivativeType &derivative) const
Superclass::GradientImageType GradientImageType
Superclass::TransformPointer TransformPointer
void PrintSelf(std::ostream &os, Indent indent) const
Superclass::GradientImageFilterType GradientImageFilterType
MovingImageType::RegionType MovingImageRegionType
AlignedCorrelationGetValueAndDerivativePerThreadStruct * m_CorrelationGetValueAndDerivativePerThreadVariables
Superclass::InterpolatorType InterpolatorType
Superclass::TransformJacobianType TransformJacobianType
Computes normalized correlation between two images, based on AdvancedImageToImageMetric...
Superclass::MovingImagePixelType MovingImagePixelType
GradientImageFilter< MovingImageType, RealType, RealType > CentralDifferenceGradientFilterType
Superclass::MovingImageMaskPointer MovingImageMaskPointer
void AfterThreadedGetValueAndDerivative(MeasureType &value, DerivativeType &derivative) const
MovingImageLimiterType::OutputType MovingImageLimiterOutputType
ThreaderType::ThreadInfoStruct ThreadInfoType
itkPadStruct(ITK_CACHE_LINE_ALIGNMENT, CorrelationGetValueAndDerivativePerThreadStruct, PaddedCorrelationGetValueAndDerivativePerThreadStruct)
ImageSamplerType::OutputVectorContainerPointer ImageSampleContainerPointer
Superclass::FixedImageMaskType FixedImageMaskType
BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
Superclass::FixedImageConstPointer FixedImageConstPointer
Superclass::MovingImageConstPointer MovingImageConstPointer
void UpdateDerivativeTerms(const RealType &fixedImageValue, const RealType &movingImageValue, const DerivativeType &imageJacobian, const NonZeroJacobianIndicesType &nzji, DerivativeType &derivativeF, DerivativeType &derivativeM, DerivativeType &differential) const
MeasureType GetValue(const TransformParametersType &parameters) const
Superclass::GradientImageFilterPointer GradientImageFilterPointer
Superclass::GradientImagePointer GradientImagePointer


Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo