ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkANTSNeighborhoodCorrelationImageToImageMetricv4DenseGetValueAndDerivativeThreader.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 __itkANTSNeighborhoodCorrelationImageToImageMetricv4DenseGetValueAndDerivativeThreader_h
00019 #define __itkANTSNeighborhoodCorrelationImageToImageMetricv4DenseGetValueAndDerivativeThreader_h
00020 
00021 #include "itkImageToImageMetricv4GetValueAndDerivativeThreader.h"
00022 #include "itkThreadedImageRegionPartitioner.h"
00023 
00024 namespace itk
00025 {
00026 
00032 template< class TImageToImageMetric, class TNeighborhoodCorrelationMetric >
00033 class ANTSNeighborhoodCorrelationImageToImageMetricv4DenseGetValueAndDerivativeThreader
00034   : public ImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedImageRegionPartitioner< TImageToImageMetric::VirtualImageDimension >, TImageToImageMetric >
00035 {
00036 public:
00038   typedef ANTSNeighborhoodCorrelationImageToImageMetricv4DenseGetValueAndDerivativeThreader Self;
00039   typedef ImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedImageRegionPartitioner< TImageToImageMetric::VirtualImageDimension >, TImageToImageMetric >
00040                                                                                                 Superclass;
00041   typedef SmartPointer< Self >                                                                  Pointer;
00042   typedef SmartPointer< const Self >                                                            ConstPointer;
00043 
00044   itkTypeMacro( ANTSNeighborhoodCorrelationImageToImageMetricv4DenseGetValueAndDerivativeThreader, ImageToImageMetricv4GetValueAndDerivativeThreader );
00045 
00046   itkNewMacro( Self );
00047 
00048   typedef typename Superclass::DomainType    DomainType;
00049   typedef typename Superclass::AssociateType AssociateType;
00050 
00051   typedef typename Superclass::VirtualImageType        VirtualImageType;
00052   typedef typename Superclass::VirtualPointType        VirtualPointType;
00053   typedef typename Superclass::VirtualIndexType        VirtualIndexType;
00054   typedef typename Superclass::FixedImagePointType     FixedImagePointType;
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 
00064   typedef TNeighborhoodCorrelationMetric                                 NeighborhoodCorrelationMetricType;
00065   typedef typename NeighborhoodCorrelationMetricType::ScanIteratorType   ScanIteratorType;
00066   typedef typename NeighborhoodCorrelationMetricType::ScanMemType        ScanMemType;
00067   typedef typename NeighborhoodCorrelationMetricType::ScanParametersType ScanParametersType;
00068   typedef typename NeighborhoodCorrelationMetricType::ImageRegionType    ImageRegionType;
00069   typedef typename NeighborhoodCorrelationMetricType::InternalComputationValueType InternalComputationValueType;
00070   typedef typename NeighborhoodCorrelationMetricType::SumQueueType       SumQueueType;
00071   typedef typename NeighborhoodCorrelationMetricType::ImageDimensionType ImageDimensionType;
00072   typedef typename NeighborhoodCorrelationMetricType::JacobianType       JacobianType;
00073   typedef typename NeighborhoodCorrelationMetricType::NumberOfParametersType       NumberOfParametersType;
00074 
00075 protected:
00076   ANTSNeighborhoodCorrelationImageToImageMetricv4DenseGetValueAndDerivativeThreader() {}
00077 
00081   virtual bool ProcessPoint(
00082         const VirtualIndexType &          itkNotUsed(virtualIndex),
00083         const VirtualPointType &          itkNotUsed(virtualPoint),
00084         const FixedImagePointType &       itkNotUsed(mappedFixedPoint),
00085         const FixedImagePixelType &       itkNotUsed(mappedFixedPixelValue),
00086         const FixedImageGradientType &    itkNotUsed(mappedFixedImageGradient),
00087         const MovingImagePointType &      itkNotUsed(mappedMovingPoint),
00088         const MovingImagePixelType &      itkNotUsed(mappedMovingPixelValue),
00089         const MovingImageGradientType &   itkNotUsed(mappedMovingImageGradient),
00090         MeasureType &                     itkNotUsed(metricValueReturn),
00091         DerivativeType &                  itkNotUsed(localDerivativeReturn),
00092         const ThreadIdType                itkNotUsed(threadID) ) const
00093     {
00094     return false;
00095     }
00096 
00097   virtual void ThreadedExecution( const DomainType& domain,
00098                                   const ThreadIdType threadId );
00099 
00102   void UpdateQueues(const ScanIteratorType &scanIt,
00103     ScanMemType &scanMem, const ScanParametersType &scanParameters,
00104     const ThreadIdType threadID) const;
00105 
00106   void UpdateQueuesAtBeginningOfLine(
00107     const ScanIteratorType &scanIt, ScanMemType &scanMem,
00108     const ScanParametersType &scanParameters,
00109     const ThreadIdType threadID) const;
00110 
00114   void UpdateQueuesToNextScanWindow(
00115     const ScanIteratorType &scanIt, ScanMemType &scanMem,
00116     const ScanParametersType &scanParameters,
00117     const ThreadIdType threadID) const;
00118 
00121   bool ComputeInformationFromQueues(
00122     const ScanIteratorType &scanIt, ScanMemType &scanMem,
00123     const ScanParametersType &scanParameters,
00124     const ThreadIdType threadID) const;
00125 
00126   void ComputeMovingTransformDerivative(
00127     const ScanIteratorType &scanIt, ScanMemType &scanMem,
00128     const ScanParametersType &scanParameters, DerivativeType &deriv,
00129     MeasureType &local_cc, const ThreadIdType threadID) const;
00130 
00131 private:
00132   ANTSNeighborhoodCorrelationImageToImageMetricv4DenseGetValueAndDerivativeThreader( const Self & ); // purposely not implemented
00133   void operator=( const Self & ); // purposely not implemented
00134 };
00135 
00136 } // end namespace itk
00137 
00138 #ifndef ITK_MANUAL_INSTANTIATION
00139 #include "itkANTSNeighborhoodCorrelationImageToImageMetricv4DenseGetValueAndDerivativeThreader.hxx"
00140 #endif
00141 
00142 #endif
00143