ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkJointHistogramMutualInformationImageToImageMetricv4.h
Go to the documentation of this file.
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 
19 #ifndef itkJointHistogramMutualInformationImageToImageMetricv4_h
20 #define itkJointHistogramMutualInformationImageToImageMetricv4_h
21 
23 #include "itkImage.h"
25 
28 
29 namespace itk
30 {
43 template<typename TFixedImage,typename TMovingImage,typename TVirtualImage = TFixedImage,
44  typename TInternalComputationValueType = double,
45  typename TMetricTraits = DefaultImageToImageMetricTraitsv4<TFixedImage,TMovingImage,TVirtualImage,TInternalComputationValueType>
46  >
48  public ImageToImageMetricv4<TFixedImage, TMovingImage, TVirtualImage, TInternalComputationValueType, TMetricTraits>
49 {
50 public:
51 
54  typedef ImageToImageMetricv4<TFixedImage, TMovingImage, TVirtualImage,
55  TInternalComputationValueType,TMetricTraits> Superclass;
58 
60  itkNewMacro(Self);
61 
64 
68 
72  typedef TInternalComputationValueType InternalComputationValueType;
73 
78 
88 
89  typedef typename Superclass::FixedTransformType::JacobianType FixedTransformJacobianType;
90  typedef typename Superclass::MovingTransformType::JacobianType MovingTransformJacobianType;
91 
96 
97  /* Image dimension accessors */
98  itkStaticConstMacro(VirtualImageDimension, typename TVirtualImage::ImageDimensionType, TVirtualImage::ImageDimension);
99  itkStaticConstMacro(MovingImageDimension, typename TMovingImage::ImageDimensionType, TMovingImage::ImageDimension);
100 
102  typedef TInternalComputationValueType PDFValueType;
103 
112 
114  itkGetModifiableObjectMacro(JointPDF, JointPDFType );
115 
116  // Declare the type for the derivative calculation
119  typedef typename JPDFGradientImageType::Pointer JPDFGradientImagePointer;
120 
123  typedef typename MarginalGradientImageType::Pointer MarginalGradientImagePointer;
124 
130 
136 
137 
139  itkSetClampMacro( NumberOfHistogramBins, SizeValueType, 5, NumericTraits< SizeValueType >::max() );
140  itkGetConstReferenceMacro(NumberOfHistogramBins, SizeValueType );
142 
144  itkSetMacro(VarianceForJointPDFSmoothing, TInternalComputationValueType);
145  itkGetMacro(VarianceForJointPDFSmoothing, TInternalComputationValueType);
147 
149  virtual void Initialize() throw (itk::ExceptionObject) ITK_OVERRIDE;
150 
151  virtual MeasureType GetValue() const ITK_OVERRIDE;
152 
153 protected:
155  virtual ~JointHistogramMutualInformationImageToImageMetricv4();
156 
160  virtual void InitializeForIteration() const ITK_OVERRIDE;
161 
163  MeasureType ComputeValue() const;
164 
167  inline void ComputeJointPDFPoint( const FixedImagePixelType fixedImageValue, const MovingImagePixelType movingImageValue, JointPDFPointType & jointPDFpoint ) const;
168 
172  friend class JointHistogramMutualInformationComputeJointPDFThreader< ThreadedIndexedContainerPartitioner, Self >;
173 
176  typedef JointHistogramMutualInformationComputeJointPDFThreader< ThreadedIndexedContainerPartitioner, Self >
178 
181 
183  friend class JointHistogramMutualInformationGetValueAndDerivativeThreader< ThreadedIndexedContainerPartitioner, Superclass, Self >;
184 
185  typedef JointHistogramMutualInformationGetValueAndDerivativeThreader< ThreadedImageRegionPartitioner< Superclass::VirtualImageDimension >, Superclass, Self >
187  typedef JointHistogramMutualInformationGetValueAndDerivativeThreader< ThreadedIndexedContainerPartitioner, Superclass, Self >
189 
191  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
192 
195 
196 private:
197  JointHistogramMutualInformationImageToImageMetricv4(const Self &) ITK_DELETE_FUNCTION;
198  void operator=(const Self &) ITK_DELETE_FUNCTION;
199 
202 
205 
207  mutable typename JointPDFType::Pointer m_JointPDF;
208 
210  TInternalComputationValueType m_VarianceForJointPDFSmoothing;
211 
214  TInternalComputationValueType m_FixedImageTrueMin;
215  TInternalComputationValueType m_FixedImageTrueMax;
216  TInternalComputationValueType m_MovingImageTrueMin;
217  TInternalComputationValueType m_MovingImageTrueMax;
218  TInternalComputationValueType m_FixedImageBinSize;
219  TInternalComputationValueType m_MovingImageBinSize;
220 
221  TInternalComputationValueType m_JointPDFSum;
223 
224  TInternalComputationValueType m_Log2;
226 
227 };
228 
229 } // end namespace itk
230 
231 #ifndef ITK_MANUAL_INSTANTIATION
232 #include "itkJointHistogramMutualInformationImageToImageMetricv4.hxx"
233 #endif
234 
235 #endif
Superclass::CoordinateRepresentationType CoordinateRepresentationType
Superclass::RegionType RegionType
Definition: itkImage.h:137
Superclass::VirtualPointSetType VirtualPointSetType
Light weight base class for most itk classes.
Superclass::MeasureType MeasureType
JointHistogramMutualInformationSparseComputeJointPDFThreaderType::Pointer m_JointHistogramMutualInformationSparseComputeJointPDFThreader
Superclass::VirtualIndexType VirtualIndexType
JointHistogramMutualInformationDenseComputeJointPDFThreaderType::Pointer m_JointHistogramMutualInformationDenseComputeJointPDFThreader
Represent the size (bounds) of a n-dimensional image.
Definition: itkSize.h:52
MetricTraits::MovingGradientPixelType MovingGradientPixelType
Superclass::ParametersValueType ParametersValueType
MetricTraits::FixedGradientPixelType FixedGradientPixelType
void ComputeJointPDFPoint(const FixedImagePixelType fixedImageValue, const MovingImagePixelType movingImageValue, JointPDFPointType &jointPDFpoint) const
Class for partitioning of an ImageRegion.
typedef(itk::Concept::IsFloatingPoint< FixedImagePixelValueType >) OnlyDefinedForFloatingPointTypes0
Superclass::IndexValueType IndexValueType
Definition: itkImage.h:120
Computes the gradient of an image by convolution with the first derivative of a Gaussian.
Superclass::NumberOfParametersType NumberOfParametersType
unsigned long SizeValueType
Definition: itkIntTypes.h:143
Provide a threaded computation of the joint PDF for JointHistogramMutualInformationImageToImageMetric...
Superclass::ParametersType ParametersType
TPixel PixelType
Definition: itkImage.h:89
FixedImageType::PixelType FixedImagePixelType
ImageToImageMetricv4< TFixedImage, TMovingImage, TVirtualImage, TInternalComputationValueType, TMetricTraits > Superclass
Superclass::VirtualPointType VirtualPointType
Superclass::DerivativeType DerivativeType
Superclass::IndexType IndexType
Definition: itkImage.h:119
Standard exception handling object.
Linearly interpolate an image at specified positions.
MovingImageType::PixelType MovingImagePixelType
Computes the mutual information between two images to be registered using the method referenced below...
Processes points for JointHistogramMutualInformationImageToImageMetricv4 GetValueAndDerivative().
MovingImageType::PointType MovingImagePointType
virtual MeasureType GetValue() const override
void PrintSelf(std::ostream &os, Indent indent) const override
Control indentation during Print() invocation.
Definition: itkIndent.h:49
LinearInterpolateImageFunction< MarginalPDFType, double > MarginalPDFInterpolatorType
Define additional traits for native types such as int or float.
FixedImageType::PointType FixedImagePointType
Templated n-dimensional image class.
Definition: itkImage.h:75
itk::GradientRecursiveGaussianImageFilter< MarginalPDFType > MarginalGradientFilterType
Superclass::VirtualImageType VirtualImageType