![]() |
ITK
4.2.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 __itkANTSNeighborhoodCorrelationImageToImageMetricv4_h 00019 #define __itkANTSNeighborhoodCorrelationImageToImageMetricv4_h 00020 00021 #include "itkImageToImageMetricv4.h" 00022 #include "itkConstNeighborhoodIterator.h" 00023 00024 #include "itkANTSNeighborhoodCorrelationImageToImageMetricv4DenseGetValueAndDerivativeThreader.h" 00025 00026 #include <deque> 00027 00028 namespace itk { 00029 00097 template<class TFixedImage, class TMovingImage, class TVirtualImage = TFixedImage> 00098 class ITK_EXPORT ANTSNeighborhoodCorrelationImageToImageMetricv4 : 00099 public ImageToImageMetricv4< TFixedImage, TMovingImage, TVirtualImage> 00100 { 00101 public: 00102 00104 typedef ANTSNeighborhoodCorrelationImageToImageMetricv4 Self; 00105 typedef ImageToImageMetricv4<TFixedImage, TMovingImage, TVirtualImage> Superclass; 00106 typedef SmartPointer<Self> Pointer; 00107 typedef SmartPointer<const Self> ConstPointer; 00108 00110 itkNewMacro(Self); 00111 00113 itkTypeMacro(Self, Superclass); 00114 00116 typedef typename Superclass::MeasureType MeasureType; 00117 typedef typename Superclass::DerivativeType DerivativeType; 00118 typedef typename Superclass::DerivativeValueType DerivativeValueType; 00119 typedef typename Superclass::VirtualPointType VirtualPointType; 00120 typedef typename Superclass::FixedImagePointType FixedImagePointType; 00121 typedef typename Superclass::FixedImagePixelType FixedImagePixelType; 00122 typedef typename Superclass::FixedTransformType FixedTransformType; 00123 typedef typename Superclass::FixedImageGradientType FixedImageGradientType; 00124 typedef typename FixedTransformType::JacobianType FixedImageJacobianType; 00125 00126 typedef typename Superclass::MovingImagePointType MovingImagePointType; 00127 typedef typename Superclass::MovingImagePixelType MovingImagePixelType; 00128 typedef typename Superclass::MovingImageGradientType MovingImageGradientType; 00129 typedef typename Superclass::MovingTransformType MovingTransformType; 00130 typedef typename MovingTransformType::JacobianType MovingImageJacobianType; 00131 typedef typename Superclass::JacobianType JacobianType; 00132 00133 typedef typename Superclass::VirtualImageGradientType VirtualImageGradientType; 00134 00135 typedef typename Superclass::FixedImageType FixedImageType; 00136 typedef typename Superclass::MovingImageType MovingImageType; 00137 typedef typename Superclass::VirtualImageType VirtualImageType; 00138 typedef typename Superclass::FixedOutputPointType FixedOutputPointType; 00139 typedef typename Superclass::MovingOutputPointType MovingOutputPointType; 00140 00141 typedef typename Superclass::InternalComputationValueType InternalComputationValueType; 00142 00143 typedef typename Superclass::FixedTransformType::JacobianType 00144 FixedTransformJacobianType; 00145 typedef typename Superclass::MovingTransformType::JacobianType 00146 MovingTransformJacobianType; 00147 00148 typedef typename Superclass::NumberOfParametersType NumberOfParametersType; 00149 typedef typename Superclass::ImageDimensionType ImageDimensionType; 00150 00151 typedef typename VirtualImageType::RegionType ImageRegionType; 00152 typedef typename VirtualImageType::SizeType RadiusType; 00153 typedef typename VirtualImageType::IndexType IndexType; 00154 00155 /* Image dimension accessors */ 00156 itkStaticConstMacro(FixedImageDimension, ImageDimensionType, 00157 ::itk::GetImageDimension<FixedImageType>::ImageDimension); 00158 00159 itkStaticConstMacro(MovingImageDimension, ImageDimensionType, 00160 ::itk::GetImageDimension<MovingImageType>::ImageDimension); 00161 00162 itkStaticConstMacro(VirtualImageDimension, ImageDimensionType, 00163 ::itk::GetImageDimension<VirtualImageType>::ImageDimension); 00164 00165 // Set the radius of the neighborhood window centered at each pixel. 00166 // See the note above about using a radius less than 2. 00167 itkSetMacro(Radius, RadiusType); 00168 00169 // Get the Radius of the neighborhood window centered at each pixel 00170 itkGetMacro(Radius, RadiusType); 00171 itkGetConstMacro(Radius, RadiusType); 00172 00173 void Initialize(void) throw ( itk::ExceptionObject ); 00174 00175 00176 protected: 00177 ANTSNeighborhoodCorrelationImageToImageMetricv4(); 00178 virtual ~ANTSNeighborhoodCorrelationImageToImageMetricv4(); 00179 00180 // interested values here updated during scanning 00181 typedef InternalComputationValueType QueueRealType; 00182 typedef std::deque<QueueRealType> SumQueueType; 00183 typedef ConstNeighborhoodIterator<VirtualImageType> ScanIteratorType; 00184 00185 // one ScanMemType for each thread 00186 typedef struct ScanMemType { 00187 // queues used in the scanning 00188 // sum of the fixed value squared 00189 SumQueueType QsumFixed2; 00190 // sum of the moving value squared 00191 SumQueueType QsumMoving2; 00192 SumQueueType QsumFixed; 00193 SumQueueType QsumMoving; 00194 SumQueueType QsumFixedMoving; 00195 SumQueueType Qcount; 00196 00197 QueueRealType fixedA; 00198 QueueRealType movingA; 00199 QueueRealType sFixedMoving; 00200 QueueRealType sFixedFixed; 00201 QueueRealType sMovingMoving; 00202 00203 FixedImageGradientType fixedImageGradient; 00204 MovingImageGradientType movingImageGradient; 00205 00206 FixedImagePointType mappedFixedPoint; 00207 MovingImagePointType mappedMovingPoint; 00208 VirtualPointType virtualPoint; 00209 } ScanMemType; 00210 00211 typedef struct ScanParametersType { 00212 // const values during scanning 00213 ImageRegionType scanRegion; 00214 SizeValueType numberOfFillZero; // for each queue 00215 SizeValueType windowLength; // number of voxels in the scanning window 00216 IndexValueType scanRegionBeginIndexDim0; 00217 00218 typename FixedImageType::ConstPointer fixedImage; 00219 typename MovingImageType::ConstPointer movingImage; 00220 typename VirtualImageType::ConstPointer virtualImage; 00221 RadiusType radius; 00222 00223 } ScanParametersType; 00224 00225 friend class ANTSNeighborhoodCorrelationImageToImageMetricv4DenseGetValueAndDerivativeThreader< Superclass, Self >; 00226 typedef ANTSNeighborhoodCorrelationImageToImageMetricv4DenseGetValueAndDerivativeThreader< Superclass, Self > 00227 ANTSNeighborhoodCorrelationImageToImageMetricv4DenseGetValueAndDerivativeThreaderType; 00228 00230 void InitializeScanning(const ImageRegionType &scanRegion, 00231 ScanIteratorType &scanIt, ScanMemType &scanMem, 00232 ScanParametersType &scanParameters ) const; 00233 00234 virtual void PrintSelf(std::ostream & os, Indent indent) const; 00235 00236 private: 00237 ANTSNeighborhoodCorrelationImageToImageMetricv4( const Self & ); //purposely not implemented 00238 void operator=(const Self &); //purposely not implemented 00239 00240 // Radius of the neighborhood window centered at each pixel 00241 RadiusType m_Radius; 00242 }; 00243 00244 } // end namespace itk 00245 00246 #ifndef ITK_MANUAL_INSTANTIATION 00247 #include "itkANTSNeighborhoodCorrelationImageToImageMetricv4.hxx" 00248 #endif 00249 00250 #endif 00251
1.7.6.1