ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkDemonsImageToImageMetricv4.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 __itkDemonsImageToImageMetricv4_h
00019 #define __itkDemonsImageToImageMetricv4_h
00020 
00021 #include "itkImageToImageMetricv4.h"
00022 
00023 #include "itkDemonsImageToImageMetricv4GetValueAndDerivativeThreader.h"
00024 
00025 namespace itk
00026 {
00027 
00054 template <class TFixedImage, class TMovingImage, class TVirtualImage = TFixedImage >
00055 class ITK_EXPORT DemonsImageToImageMetricv4 :
00056 public ImageToImageMetricv4<TFixedImage, TMovingImage, TVirtualImage>
00057 {
00058 public:
00060   typedef DemonsImageToImageMetricv4                                     Self;
00061   typedef ImageToImageMetricv4<TFixedImage, TMovingImage, TVirtualImage> Superclass;
00062   typedef SmartPointer<Self>                                             Pointer;
00063   typedef SmartPointer<const Self>                                       ConstPointer;
00064 
00066   itkNewMacro(Self);
00067 
00069   itkTypeMacro(DemonsImageToImageMetricv4, ImageToImageMetricv4);
00070 
00072   typedef typename Superclass::MeasureType             MeasureType;
00073   typedef typename Superclass::DerivativeType          DerivativeType;
00074 
00075   typedef typename Superclass::FixedImagePointType     FixedImagePointType;
00076   typedef typename Superclass::FixedImagePixelType     FixedImagePixelType;
00077   typedef typename Superclass::FixedImageGradientType  FixedImageGradientType;
00078 
00079   typedef typename Superclass::MovingImagePointType    MovingImagePointType;
00080   typedef typename Superclass::MovingImagePixelType    MovingImagePixelType;
00081   typedef typename Superclass::MovingImageGradientType MovingImageGradientType;
00082 
00083   typedef typename Superclass::MovingTransformType     MovingTransformType;
00084   typedef typename Superclass::JacobianType            JacobianType;
00085   typedef typename Superclass::VirtualImageType        VirtualImageType;
00086   typedef typename Superclass::VirtualIndexType        VirtualIndexType;
00087   typedef typename Superclass::VirtualPointType        VirtualPointType;
00088   typedef typename Superclass::VirtualSampledPointSetType
00089                                                        VirtualSampledPointSetType;
00090   typedef typename Superclass::NumberOfParametersType  NumberOfParametersType;
00091 
00092   typedef typename Superclass::InternalComputationValueType InternalComputationValueType;
00093 
00094   typedef typename Superclass::ImageDimensionType      ImageDimensionType;
00095 
00096   /* Image dimension accessors */
00097   itkStaticConstMacro(VirtualImageDimension, ImageDimensionType,
00098       ::itk::GetImageDimension<TVirtualImage>::ImageDimension);
00099   itkStaticConstMacro(FixedImageDimension, ImageDimensionType,
00100       ::itk::GetImageDimension<TFixedImage>::ImageDimension);
00101   itkStaticConstMacro(MovingImageDimension, ImageDimensionType,
00102       ::itk::GetImageDimension<TMovingImage>::ImageDimension);
00103 
00104   virtual void Initialize(void) throw ( itk::ExceptionObject );
00105 
00108   itkGetConstMacro(IntensityDifferenceThreshold, InternalComputationValueType);
00109   itkSetMacro(IntensityDifferenceThreshold, InternalComputationValueType);
00111 
00113   itkGetConstMacro(DenominatorThreshold, InternalComputationValueType);
00114 
00115 protected:
00116   itkGetConstMacro(Normalizer, InternalComputationValueType);
00117 
00118   DemonsImageToImageMetricv4();
00119   virtual ~DemonsImageToImageMetricv4();
00120 
00121   friend class DemonsImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedImageRegionPartitioner< Superclass::VirtualImageDimension >, Superclass, Self >;
00122   friend class DemonsImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedIndexedContainerPartitioner, Superclass, Self >;
00123   typedef DemonsImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedImageRegionPartitioner< Superclass::VirtualImageDimension >, Superclass, Self >
00124     DemonsDenseGetValueAndDerivativeThreaderType;
00125   typedef DemonsImageToImageMetricv4GetValueAndDerivativeThreader< ThreadedIndexedContainerPartitioner, Superclass, Self >
00126     DemonsSparseGetValueAndDerivativeThreaderType;
00127 
00128   void PrintSelf(std::ostream& os, Indent indent) const;
00129 
00130 private:
00131 
00134   InternalComputationValueType   m_DenominatorThreshold;
00135 
00137   InternalComputationValueType   m_IntensityDifferenceThreshold;
00138 
00139   /* Used to normalize derivative calculation. Automatically calculated */
00140   InternalComputationValueType   m_Normalizer;
00141 
00142   DemonsImageToImageMetricv4(const Self &); //purposely not implemented
00143   void operator = (const Self &); //purposely not implemented
00144 };
00145 
00146 } // end namespace itk
00147 
00148 #ifndef ITK_MANUAL_INSTANTIATION
00149 #include "itkDemonsImageToImageMetricv4.hxx"
00150 #endif
00151 
00152 #endif
00153