ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkPointSetToImageMetric.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 #ifndef itkPointSetToImageMetric_h
19 #define itkPointSetToImageMetric_h
20 
21 #include "itkImageBase.h"
22 #include "itkTransform.h"
25 #include "itkMacro.h"
27 
28 namespace itk
29 {
47 template< typename TFixedPointSet, typename TMovingImage >
48 class ITK_TEMPLATE_EXPORT PointSetToImageMetric:public SingleValuedCostFunction
49 {
50 public:
56 
58  typedef Superclass::ParametersValueType CoordinateRepresentationType;
59 
62 
64  typedef TMovingImage MovingImageType;
65  typedef typename TMovingImage::PixelType MovingImagePixelType;
66  typedef typename MovingImageType::ConstPointer MovingImageConstPointer;
67 
69  typedef TFixedPointSet FixedPointSetType;
70  typedef typename FixedPointSetType::ConstPointer FixedPointSetConstPointer;
71 
73  itkStaticConstMacro(MovingImageDimension, unsigned int,
74  TMovingImage::ImageDimension);
75  itkStaticConstMacro(FixedPointSetDimension, unsigned int,
76  TFixedPointSet::PointDimension);
78 
79  typedef typename FixedPointSetType::PointsContainer::ConstIterator PointIterator;
80  typedef typename FixedPointSetType::PointDataContainer::ConstIterator PointDataIterator;
81 
84  itkGetStaticConstMacro(MovingImageDimension),
85  itkGetStaticConstMacro(FixedPointSetDimension) > TransformType;
86 
92 
97 
100  typedef CovariantVector< RealType,
101  itkGetStaticConstMacro(MovingImageDimension) > GradientPixelType;
102  typedef Image< GradientPixelType,
103  itkGetStaticConstMacro(MovingImageDimension) > GradientImageType;
109 
111 
113 
115  typedef Superclass::MeasureType MeasureType;
116 
118  typedef Superclass::DerivativeType DerivativeType;
119 
121  typedef Superclass::ParametersType ParametersType;
122 
124  itkSetConstObjectMacro(FixedPointSet, FixedPointSetType);
125  itkGetConstObjectMacro(FixedPointSet, FixedPointSetType);
127 
129  itkSetConstObjectMacro(MovingImage, MovingImageType);
130  itkGetConstObjectMacro(MovingImage, MovingImageType);
132 
134  itkSetObjectMacro(Transform, TransformType);
135 
137  itkGetModifiableObjectMacro(Transform, TransformType);
138 
140  itkSetObjectMacro(Interpolator, InterpolatorType);
141 
143  itkGetModifiableObjectMacro(Interpolator, InterpolatorType);
144 
146  itkGetModifiableObjectMacro(GradientImage, GradientImageType);
147 
149  itkGetConstReferenceMacro(NumberOfPixelsCounted, SizeValueType);
150 
152  void SetTransformParameters(const ParametersType & parameters) const;
153 
161  itkSetMacro(ComputeGradient, bool);
162  itkGetConstReferenceMacro(ComputeGradient, bool);
164 
166  virtual unsigned int GetNumberOfParameters(void) const ITK_OVERRIDE
167  { return m_Transform->GetNumberOfParameters(); }
168 
171  virtual void Initialize(void);
172 
173 protected:
175  virtual ~PointSetToImageMetric() ITK_OVERRIDE {}
176  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
177 
179 
181 
183 
185 
187 
189 
191 
192 private:
193  ITK_DISALLOW_COPY_AND_ASSIGN(PointSetToImageMetric);
194 };
195 } // end namespace itk
196 
197 #ifndef ITK_MANUAL_INSTANTIATION
198 #include "itkPointSetToImageMetric.hxx"
199 #endif
200 
201 #endif
FixedPointSetType::PointDataContainer::ConstIterator PointDataIterator
virtual unsigned int GetNumberOfParameters(void) const override
This class is a base for the CostFunctions returning a single value.
FixedPointSetType::PointsContainer::ConstIterator PointIterator
Superclass::ParametersValueType CoordinateRepresentationType
TransformType::Pointer TransformPointer
TransformType::JacobianType TransformJacobianType
Superclass::DerivativeType DerivativeType
Image< GradientPixelType, itkGetStaticConstMacro(MovingImageDimension) > GradientImageType
GradientRecursiveGaussianImageFilter< MovingImageType, GradientImageType > GradientImageFilterType
Computes the gradient of an image by convolution with the first derivative of a Gaussian.
TransformType::OutputPointType OutputPointType
TransformType::ParametersType TransformParametersType
InterpolateImageFunction< MovingImageType, CoordinateRepresentationType > InterpolatorType
unsigned long SizeValueType
Definition: itkIntTypes.h:143
CovariantVector< RealType, itkGetStaticConstMacro(MovingImageDimension) > GradientPixelType
NumericTraits< MovingImagePixelType >::RealType RealType
Superclass::MeasureType MeasureType
Computes similarity between a point set and an image.
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
Array2D class representing a 2D array with size defined at construction time.
Definition: itkArray2D.h:45
MovingImageType::ConstPointer MovingImageConstPointer
Class to hold and manage different parameter types used during optimization.
TMovingImage::PixelType MovingImagePixelType
SingleValuedCostFunction Superclass
SmartPointer< const Self > ConstPointer
Base class for all image interpolaters.
FixedPointSetConstPointer m_FixedPointSet
GradientImageFilterType::Pointer GradientImageFilterPointer
SmartPointer< GradientImageType > GradientImagePointer
Control indentation during Print() invocation.
Definition: itkIndent.h:49
InterpolatorType::Pointer InterpolatorPointer
TransformType::InputPointType InputPointType
MovingImageConstPointer m_MovingImage
Superclass::ParametersType ParametersType
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:52
A templated class holding a n-Dimensional covariant vector.
Transform< CoordinateRepresentationType, itkGetStaticConstMacro(MovingImageDimension), itkGetStaticConstMacro(FixedPointSetDimension) > TransformType
Templated n-dimensional image class.
Definition: itkImage.h:75
FixedPointSetType::ConstPointer FixedPointSetConstPointer