1 /*========================================================================= 2 * 3 * Copyright Insight Software Consortium 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0.txt 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 *=========================================================================*/ 18 #ifndef itkMeanSquaresImageToImageMetricv4_h 19 #define itkMeanSquaresImageToImageMetricv4_h 20 21 #include "itkImageToImageMetricv4.h" 22 #include "itkMeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader.h" 23 #include "itkDefaultImageToImageMetricTraitsv4.h" 24 25 namespace itk 26 { 27 28 /** \class MeanSquaresImageToImageMetricv4 29 * 30 * \brief Class implementing a mean squares metric. 31 * 32 * This class supports vector images of type VectorImage 33 * and Image< VectorType, imageDimension >. 34 * 35 * See 36 * MeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader::ProcessPoint for algorithm implementation. 37 * 38 * \ingroup ITKMetricsv4 39 */ 40 template <typename TFixedImage, typename TMovingImage, typename TVirtualImage = TFixedImage, 41 typename TInternalComputationValueType = double, 42 typename TMetricTraits = DefaultImageToImageMetricTraitsv4<TFixedImage,TMovingImage,TVirtualImage,TInternalComputationValueType> 43 > 44 class ITK_TEMPLATE_EXPORT MeanSquaresImageToImageMetricv4 : 45 public ImageToImageMetricv4<TFixedImage, TMovingImage, TVirtualImage, TInternalComputationValueType, TMetricTraits> 46 { 47 public: 48 ITK_DISALLOW_COPY_AND_ASSIGN(MeanSquaresImageToImageMetricv4); 49 50 /** Standard class type aliases. */ 51 using Self = MeanSquaresImageToImageMetricv4; 52 using Superclass = ImageToImageMetricv4<TFixedImage, TMovingImage, TVirtualImage, TInternalComputationValueType, TMetricTraits>; 53 using Pointer = SmartPointer<Self>; 54 using ConstPointer = SmartPointer<const Self>; 55 56 /** Method for creation through the object factory. */ 57 itkNewMacro(Self); 58 59 /** Run-time type information (and related methods). */ 60 itkTypeMacro(MeanSquaresImageToImageMetricv4, ImageToImageMetricv4); 61 62 using DerivativeType = typename Superclass::DerivativeType; 63 64 using FixedImagePointType = typename Superclass::FixedImagePointType; 65 using FixedImagePixelType = typename Superclass::FixedImagePixelType; 66 using FixedImageGradientType = typename Superclass::FixedImageGradientType; 67 68 using MovingImagePointType = typename Superclass::MovingImagePointType; 69 using MovingImagePixelType = typename Superclass::MovingImagePixelType; 70 using MovingImageGradientType = typename Superclass::MovingImageGradientType; 71 72 using MovingTransformType = typename Superclass::MovingTransformType; 73 using JacobianType = typename Superclass::JacobianType; 74 using VirtualImageType = typename Superclass::VirtualImageType; 75 using VirtualIndexType = typename Superclass::VirtualIndexType; 76 using VirtualPointType = typename Superclass::VirtualPointType; 77 using VirtualPointSetType = typename Superclass::VirtualPointSetType; 78 79 /* Image dimension accessors */ 80 static constexpr typename TVirtualImage::ImageDimensionType VirtualImageDimension = TVirtualImage::ImageDimension; 81 static constexpr typename TFixedImage::ImageDimensionType FixedImageDimension = TFixedImage::ImageDimension; 82 static constexpr typename TMovingImage::ImageDimensionType MovingImageDimension = TMovingImage::ImageDimension; 83 84 protected: 85 MeanSquaresImageToImageMetricv4(); 86 ~MeanSquaresImageToImageMetricv4() override = default; 87 88 friend class MeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedImageRegionPartitioner< Superclass::VirtualImageDimension >, Superclass, Self >; 89 friend class MeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedIndexedContainerPartitioner, Superclass, Self >; 90 using MeanSquaresDenseGetValueAndDerivativeThreaderType = 91 MeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedImageRegionPartitioner< Superclass::VirtualImageDimension >, Superclass, Self >; 92 using MeanSquaresSparseGetValueAndDerivativeThreaderType = 93 MeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedIndexedContainerPartitioner, Superclass, Self >; 94 95 void PrintSelf(std::ostream& os, Indent indent) const override; 96 }; 97 98 } // end namespace itk 99 100 #ifndef ITK_MANUAL_INSTANTIATION 101 #include "itkMeanSquaresImageToImageMetricv4.hxx" 102 #endif 103 104 #endif 105