ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
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 __itkCorrelationImageToImageMetricv4HelperThreader_h 00019 #define __itkCorrelationImageToImageMetricv4HelperThreader_h 00020 00021 #include "itkImageToImageMetricv4GetValueAndDerivativeThreader.h" 00022 00023 namespace itk 00024 { 00025 00035 template < class TDomainPartitioner, class TImageToImageMetric, class TCorrelationMetric > 00036 class CorrelationImageToImageMetricv4HelperThreader 00037 : public ImageToImageMetricv4GetValueAndDerivativeThreader< TDomainPartitioner, TImageToImageMetric > 00038 { 00039 public: 00041 typedef CorrelationImageToImageMetricv4HelperThreader Self; 00042 typedef ImageToImageMetricv4GetValueAndDerivativeThreader< TDomainPartitioner, TImageToImageMetric > Superclass; 00043 typedef SmartPointer< Self > Pointer; 00044 typedef SmartPointer< const Self > ConstPointer; 00045 00046 itkTypeMacro( CorrelationImageToImageMetricv4HelperThreader, ImageToImageMetricv4GetValueAndDerivativeThreader ); 00047 00048 itkNewMacro( Self ); 00049 00050 typedef typename Superclass::DomainType DomainType; 00051 typedef typename Superclass::AssociateType AssociateType; 00052 00053 typedef typename Superclass::ImageToImageMetricv4Type ImageToImageMetricv4Type; 00054 typedef typename Superclass::VirtualIndexType VirtualIndexType; 00055 typedef typename Superclass::VirtualPointType VirtualPointType; 00056 typedef typename Superclass::FixedImagePointType FixedImagePointType; 00057 typedef typename Superclass::FixedImagePixelType FixedImagePixelType; 00058 typedef typename Superclass::FixedImageGradientType FixedImageGradientType; 00059 typedef typename Superclass::MovingImagePointType MovingImagePointType; 00060 typedef typename Superclass::MovingImagePixelType MovingImagePixelType; 00061 typedef typename Superclass::MovingImageGradientType MovingImageGradientType; 00062 typedef typename Superclass::MeasureType MeasureType; 00063 typedef typename Superclass::DerivativeType DerivativeType; 00064 typedef typename Superclass::DerivativeValueType DerivativeValueType; 00065 00066 typedef typename Superclass::InternalComputationValueType InternalComputationValueType; 00067 typedef typename Superclass::NumberOfParametersType NumberOfParametersType; 00068 00069 typedef typename Superclass::FixedOutputPointType FixedOutputPointType; 00070 typedef typename Superclass::MovingOutputPointType MovingOutputPointType; 00071 protected: 00072 CorrelationImageToImageMetricv4HelperThreader() {} 00073 00075 virtual void BeforeThreadedExecution(); 00076 00084 virtual void AfterThreadedExecution(); 00085 00086 00087 /* Overload: don't need to compute the image gradients and store derivatives 00088 * 00089 * Method called by the threaders to process the given virtual point. This 00090 * in turn calls \c TransformAndEvaluateFixedPoint, \c 00091 * TransformAndEvaluateMovingPoint, and \c ProcessPoint. 00092 */ 00093 virtual bool ProcessVirtualPoint( const VirtualIndexType & virtualIndex, 00094 const VirtualPointType & virtualPoint, 00095 const ThreadIdType threadId ); 00096 00097 00101 virtual bool ProcessPoint( 00102 const VirtualIndexType & , 00103 const VirtualPointType & , 00104 const FixedImagePointType & , 00105 const FixedImagePixelType & , 00106 const FixedImageGradientType & , 00107 const MovingImagePointType & , 00108 const MovingImagePixelType & , 00109 const MovingImageGradientType & , 00110 MeasureType & , 00111 DerivativeType & , 00112 const ThreadIdType ) const 00113 { 00114 return false; 00115 } 00116 00117 00118 private: 00119 CorrelationImageToImageMetricv4HelperThreader( const Self & ); // purposely not implemented 00120 void operator=( const Self & ); // purposely not implemented 00121 00122 /* per thread variables for correlation and its derivatives */ 00123 mutable std::vector< InternalComputationValueType > m_FixSumPerThread; 00124 mutable std::vector< InternalComputationValueType > m_MovSumPerThread; 00125 }; 00126 00127 } // end namespace itk 00128 00129 #ifndef ITK_MANUAL_INSTANTIATION 00130 #include "itkCorrelationImageToImageMetricv4HelperThreader.hxx" 00131 #endif 00132 00133 #endif 00134