ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkCorrelationImageToImageMetricv4.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkCorrelationImageToImageMetricv4_h
00019 #define __itkCorrelationImageToImageMetricv4_h
00020 
00021 #include "itkImageToImageMetricv4.h"
00022 
00023 #include "itkCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h"
00024 #include "itkCorrelationImageToImageMetricv4HelperThreader.h"
00025 
00026 namespace itk
00027 {
00028 
00072 template <class TFixedImage, class TMovingImage, class TVirtualImage = TFixedImage >
00073 class ITK_EXPORT CorrelationImageToImageMetricv4 :
00074 public ImageToImageMetricv4<TFixedImage, TMovingImage, TVirtualImage>
00075 {
00076 public:
00078   typedef CorrelationImageToImageMetricv4                                     Self;
00079   typedef ImageToImageMetricv4<TFixedImage, TMovingImage, TVirtualImage> Superclass;
00080   typedef SmartPointer<Self>                                             Pointer;
00081   typedef SmartPointer<const Self>                                       ConstPointer;
00082 
00084   itkNewMacro(Self);
00085 
00087   itkTypeMacro(CorrelationImageToImageMetricv4, ImageToImageMetricv4);
00088 
00090   typedef typename Superclass::MeasureType             MeasureType;
00091   typedef typename Superclass::DerivativeType          DerivativeType;
00092 
00093   typedef typename Superclass::FixedImagePointType     FixedImagePointType;
00094   typedef typename Superclass::FixedImagePixelType     FixedImagePixelType;
00095   typedef typename Superclass::FixedImageGradientType  FixedImageGradientType;
00096 
00097   typedef typename Superclass::MovingImagePointType    MovingImagePointType;
00098   typedef typename Superclass::MovingImagePixelType    MovingImagePixelType;
00099   typedef typename Superclass::MovingImageGradientType MovingImageGradientType;
00100 
00101   typedef typename Superclass::MovingTransformType        MovingTransformType;
00102   typedef typename Superclass::JacobianType               JacobianType;
00103   typedef typename Superclass::VirtualImageType           VirtualImageType;
00104   typedef typename Superclass::VirtualIndexType           VirtualIndexType;
00105   typedef typename Superclass::VirtualPointType           VirtualPointType;
00106   typedef typename Superclass::VirtualSampledPointSetType VirtualSampledPointSetType;
00107 
00108   /* Image dimension accessors */
00109   itkStaticConstMacro(VirtualImageDimension, ImageDimensionType,
00110       ::itk::GetImageDimension<TVirtualImage>::ImageDimension);
00111   itkStaticConstMacro(FixedImageDimension, ImageDimensionType,
00112       ::itk::GetImageDimension<TFixedImage>::ImageDimension);
00113   itkStaticConstMacro(MovingImageDimension, ImageDimensionType,
00114       ::itk::GetImageDimension<TMovingImage>::ImageDimension);
00115 
00116 
00117 protected:
00118   CorrelationImageToImageMetricv4();
00119   virtual ~CorrelationImageToImageMetricv4();
00120 
00125   virtual void InitializeForIteration() const;
00126 
00127   friend class ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedImageRegionPartitioner< Superclass::VirtualImageDimension >, Self >;
00128   friend class ImageToImageMetricv4GetValueAndDerivativeThreaderBase< ThreadedIndexedContainerPartitioner, Self >;
00129   friend class ImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedImageRegionPartitioner< Superclass::VirtualImageDimension >, Self >;
00130   friend class ImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedIndexedContainerPartitioner, Self >;
00131 
00132   friend class CorrelationImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedImageRegionPartitioner< Superclass::VirtualImageDimension >, Superclass, Self >;
00133   friend class CorrelationImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedIndexedContainerPartitioner, Superclass, Self >;
00134   typedef CorrelationImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedImageRegionPartitioner< Superclass::VirtualImageDimension >, Superclass, Self >
00135     CorrelationDenseGetValueAndDerivativeThreaderType;
00136   typedef CorrelationImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedIndexedContainerPartitioner, Superclass, Self >
00137     CorrelationSparseGetValueAndDerivativeThreaderType;
00138 
00139   friend class CorrelationImageToImageMetricv4HelperThreader< ThreadedImageRegionPartitioner< Superclass::VirtualImageDimension >, Superclass, Self >;
00140   friend class CorrelationImageToImageMetricv4HelperThreader< ThreadedIndexedContainerPartitioner, Superclass, Self >;
00141 
00142   typedef CorrelationImageToImageMetricv4HelperThreader< ThreadedImageRegionPartitioner< Superclass::VirtualImageDimension >, Superclass, Self >
00143     CorrelationHelperDenseThreaderType;
00144   typedef CorrelationImageToImageMetricv4HelperThreader< ThreadedIndexedContainerPartitioner, Superclass, Self >
00145     CorrelationHelperSparseThreaderType;
00146 
00147   typename CorrelationHelperDenseThreaderType::Pointer  m_HelperDenseThreader;
00148   typename CorrelationHelperSparseThreaderType::Pointer m_HelperSparseThreader;
00149 
00150   /* These values are computed during InitializeForIteration(),
00151    * using the helper class
00152    * */
00153   mutable MeasureType m_AverageFix;
00154   mutable MeasureType m_AverageMov;
00155 
00156   void PrintSelf(std::ostream& os, Indent indent) const;
00157 
00158 private:
00159   CorrelationImageToImageMetricv4(const Self &); //purposely not implemented
00160   void operator = (const Self &); //purposely not implemented
00161 };
00162 
00163 } // end namespace itk
00164 
00165 #ifndef ITK_MANUAL_INSTANTIATION
00166 #include "itkCorrelationImageToImageMetricv4.hxx"
00167 #endif
00168 
00169 #endif
00170