ITK  4.8.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, ImageDimensionType,
99  TVirtualImage::ImageDimension);
100  itkStaticConstMacro(MovingImageDimension, ImageDimensionType,
101  TMovingImage::ImageDimension);
102 
104  typedef TInternalComputationValueType PDFValueType;
105 
114 
116  itkGetModifiableObjectMacro(JointPDF, JointPDFType );
117 
118  // Declare the type for the derivative calculation
121  typedef typename JPDFGradientImageType::Pointer JPDFGradientImagePointer;
122 
125  typedef typename MarginalGradientImageType::Pointer MarginalGradientImagePointer;
126 
132 
138 
139 
141  itkSetClampMacro( NumberOfHistogramBins, SizeValueType, 5, NumericTraits< SizeValueType >::max() );
142  itkGetConstReferenceMacro(NumberOfHistogramBins, SizeValueType );
144 
146  itkSetMacro(VarianceForJointPDFSmoothing, TInternalComputationValueType);
147  itkGetMacro(VarianceForJointPDFSmoothing, TInternalComputationValueType);
149 
151  virtual void Initialize() throw (itk::ExceptionObject) ITK_OVERRIDE;
152 
153  virtual MeasureType GetValue() const ITK_OVERRIDE;
154 
155 protected:
157  virtual ~JointHistogramMutualInformationImageToImageMetricv4();
158 
162  virtual void InitializeForIteration() const ITK_OVERRIDE;
163 
165  MeasureType ComputeValue() const;
166 
169  inline void ComputeJointPDFPoint( const FixedImagePixelType fixedImageValue, const MovingImagePixelType movingImageValue, JointPDFPointType & jointPDFpoint ) const;
170 
174  friend class JointHistogramMutualInformationComputeJointPDFThreader< ThreadedIndexedContainerPartitioner, Self >;
175 
178  typedef JointHistogramMutualInformationComputeJointPDFThreader< ThreadedIndexedContainerPartitioner, Self >
180 
183 
185  friend class JointHistogramMutualInformationGetValueAndDerivativeThreader< ThreadedIndexedContainerPartitioner, Superclass, Self >;
186 
187  typedef JointHistogramMutualInformationGetValueAndDerivativeThreader< ThreadedImageRegionPartitioner< Superclass::VirtualImageDimension >, Superclass, Self >
189  typedef JointHistogramMutualInformationGetValueAndDerivativeThreader< ThreadedIndexedContainerPartitioner, Superclass, Self >
191 
193  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
194 
197 
198 private:
199  JointHistogramMutualInformationImageToImageMetricv4(const Self &); //purposely not implemented
200  void operator=(const Self &); //purposely not implemented
201 
204 
207 
209  mutable typename JointPDFType::Pointer m_JointPDF;
210 
212  TInternalComputationValueType m_VarianceForJointPDFSmoothing;
213 
216  TInternalComputationValueType m_FixedImageTrueMin;
217  TInternalComputationValueType m_FixedImageTrueMax;
218  TInternalComputationValueType m_MovingImageTrueMin;
219  TInternalComputationValueType m_MovingImageTrueMax;
220  TInternalComputationValueType m_FixedImageBinSize;
221  TInternalComputationValueType m_MovingImageBinSize;
222 
223  TInternalComputationValueType m_JointPDFSum;
225 
226  TInternalComputationValueType m_Log2;
228 
229 };
230 
231 } // end namespace itk
232 
233 #ifndef ITK_MANUAL_INSTANTIATION
234 #include "itkJointHistogramMutualInformationImageToImageMetricv4.hxx"
235 #endif
236 
237 #endif
Superclass::CoordinateRepresentationType CoordinateRepresentationType
Superclass::RegionType RegionType
Definition: itkImage.h:140
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:123
Superclass::DimensionType ImageDimensionType
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:122
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