ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader.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 __itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader_h
00019 #define __itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader_h
00020 
00021 #include "itkImageToImageMetricv4GetValueAndDerivativeThreader.h"
00022 
00023 namespace itk
00024 {
00025 
00032 template < class TDomainPartitioner, class TImageToImageMetric, class TMattesMutualInformationMetric >
00033 class MattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader
00034   : public ImageToImageMetricv4GetValueAndDerivativeThreader< TDomainPartitioner, TImageToImageMetric >
00035 {
00036 public:
00038   typedef MattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader                                      Self;
00039   typedef ImageToImageMetricv4GetValueAndDerivativeThreader< TDomainPartitioner, TImageToImageMetric > Superclass;
00040   typedef SmartPointer< Self >                                                                         Pointer;
00041   typedef SmartPointer< const Self >                                                                   ConstPointer;
00042 
00043   itkTypeMacro( MattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader, ImageToImageMetricv4GetValueAndDerivativeThreader );
00044 
00045   itkNewMacro( Self );
00046 
00047   typedef typename Superclass::DomainType               DomainType;
00048   typedef typename Superclass::AssociateType            AssociateType;
00049 
00050   typedef typename Superclass::ImageToImageMetricv4Type ImageToImageMetricv4Type;
00051   typedef typename Superclass::VirtualPointType         VirtualPointType;
00052   typedef typename Superclass::VirtualIndexType         VirtualIndexType;
00053   typedef typename Superclass::FixedImagePointType      FixedImagePointType;
00054   typedef typename Superclass::FixedImageIndexType      FixedImageIndexType;
00055   typedef typename Superclass::FixedImagePixelType      FixedImagePixelType;
00056   typedef typename Superclass::FixedImageGradientType   FixedImageGradientType;
00057   typedef typename Superclass::MovingImagePointType     MovingImagePointType;
00058   typedef typename Superclass::MovingImagePixelType     MovingImagePixelType;
00059   typedef typename Superclass::MovingImageGradientType  MovingImageGradientType;
00060   typedef typename Superclass::MeasureType              MeasureType;
00061   typedef typename Superclass::DerivativeType           DerivativeType;
00062   typedef typename Superclass::DerivativeValueType      DerivativeValueType;
00063   typedef typename Superclass::NumberOfParametersType   NumberOfParametersType;
00064 
00065   typedef typename TMattesMutualInformationMetric::PDFValueType                   PDFValueType;
00066   typedef typename TMattesMutualInformationMetric::JointPDFType                   JointPDFType;
00067   typedef typename TMattesMutualInformationMetric::JointPDFRegionType             JointPDFRegionType;
00068   typedef typename TMattesMutualInformationMetric::JointPDFIndexType              JointPDFIndexType;
00069   typedef typename TMattesMutualInformationMetric::JointPDFValueType              JointPDFValueType;
00070   typedef typename TMattesMutualInformationMetric::JointPDFSizeType               JointPDFSizeType;
00071   typedef typename TMattesMutualInformationMetric::JointPDFDerivativesType        JointPDFDerivativesType;
00072   typedef typename TMattesMutualInformationMetric::JointPDFDerivativesIndexType   JointPDFDerivativesIndexType;
00073   typedef typename TMattesMutualInformationMetric::JointPDFDerivativesValueType   JointPDFDerivativesValueType;
00074   typedef typename TMattesMutualInformationMetric::JointPDFDerivativesRegionType  JointPDFDerivativesRegionType;
00075   typedef typename TMattesMutualInformationMetric::JointPDFDerivativesSizeType    JointPDFDerivativesSizeType;
00076 
00077   typedef typename TMattesMutualInformationMetric::CubicBSplineFunctionType            CubicBSplineFunctionType;
00078   typedef typename TMattesMutualInformationMetric::CubicBSplineDerivativeFunctionType  CubicBSplineDerivativeFunctionType;
00079 
00080   typedef typename TMattesMutualInformationMetric::JacobianType             JacobianType;
00081 
00082 protected:
00083   MattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader() {}
00084 
00085   virtual void BeforeThreadedExecution();
00086 
00087   virtual void AfterThreadedExecution();
00088 
00092   virtual bool ProcessPoint(
00093         const VirtualIndexType &          virtualIndex,
00094         const VirtualPointType &          virtualPoint,
00095         const FixedImagePointType &       mappedFixedPoint,
00096         const FixedImagePixelType &       mappedFixedPixelValue,
00097         const FixedImageGradientType &    mappedFixedImageGradient,
00098         const MovingImagePointType &      mappedMovingPoint,
00099         const MovingImagePixelType &      mappedMovingPixelValue,
00100         const MovingImageGradientType &   mappedMovingImageGradient,
00101         MeasureType &                     metricValueReturn,
00102         DerivativeType &                  localDerivativeReturn,
00103         const ThreadIdType                threadID ) const;
00104 
00106   virtual void ComputePDFDerivatives(const ThreadIdType &    threadID,
00107                              const OffsetValueType &         fixedImageParzenWindowIndex,
00108                              const JacobianType &            jacobian,
00109                              const OffsetValueType &         pdfMovingIndex,
00110                              const MovingImageGradientType & movingGradient,
00111                              const PDFValueType &            cubicBSplineDerivativeValue,
00112                              DerivativeValueType *           localSupportDerivativeResultPtr) const;
00113 
00114 private:
00115   MattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader( const Self & ); // purposely not implemented
00116   void operator=( const Self & ); // purposely not implemented
00117 };
00118 
00119 } // end namespace itk
00120 
00121 #ifndef ITK_MANUAL_INSTANTIATION
00122 #include "itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader.hxx"
00123 #endif
00124 
00125 #endif
00126