ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkMatchCardinalityImageToImageMetric.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 itkMatchCardinalityImageToImageMetric_h
19 #define itkMatchCardinalityImageToImageMetric_h
20 
26 #include "itkImageToImageMetric.h"
27 #include "itkPoint.h"
28 #include <vector>
29 
30 namespace itk
31 {
66 template< typename TFixedImage, typename TMovingImage >
67 class ITK_TEMPLATE_EXPORT MatchCardinalityImageToImageMetric:
68  public ImageToImageMetric< TFixedImage, TMovingImage >
69 {
70 public:
71  ITK_DISALLOW_COPY_AND_ASSIGN(MatchCardinalityImageToImageMetric);
72 
78 
80  itkNewMacro(Self);
81 
84 
86  using RealType = typename Superclass::RealType;
87  using TransformType = typename Superclass::TransformType;
88  using TransformPointer = typename Superclass::TransformPointer;
89  using TransformParametersType = typename Superclass::TransformParametersType;
90  using TransformJacobianType = typename Superclass::TransformJacobianType;
91  using GradientPixelType = typename Superclass::GradientPixelType;
92 
93  using MeasureType = typename Superclass::MeasureType;
94  using DerivativeType = typename Superclass::DerivativeType;
95  using FixedImageType = typename Superclass::FixedImageType;
96  using MovingImageType = typename Superclass::MovingImageType;
97  using FixedImageConstPointer = typename Superclass::FixedImageConstPointer;
98  using MovingImageConstPointer = typename Superclass::MovingImageConstPointer;
99  using FixedImageRegionType = typename Superclass::FixedImageRegionType;
100 
103  DerivativeType & derivative) const override
104  {
105  itkWarningMacro(<< "This metric does not provide metric derivatives.");
107  }
109 
116  MeasureType GetValue(const TransformParametersType & parameters) const override;
117 
124  itkSetMacro(MeasureMatches, bool);
125  itkBooleanMacro(MeasureMatches);
126  itkGetConstMacro(MeasureMatches, bool);
128 
131  { return m_Threader; }
132 
133 protected:
135  ~MatchCardinalityImageToImageMetric() override = default;
136  void PrintSelf(std::ostream & os, Indent indent) const override;
137 
143  MeasureType GetNonconstValue(const TransformParametersType & parameters);
144 
149  virtual
150  void ThreadedGetValue(const FixedImageRegionType & outputRegionForThread,
151  ThreadIdType threadId);
152 
158  virtual
159  ThreadIdType SplitFixedRegion(ThreadIdType i, int num, FixedImageRegionType & splitRegion);
160 
164  static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION ThreaderCallback(void *arg);
165 
168  struct ThreadStruct {
170  };
171 
172 private:
174  std::vector< MeasureType > m_ThreadMatches;
175  std::vector< SizeValueType > m_ThreadCounts;
176 
180 };
181 } // end namespace itk
182 
183 #ifndef ITK_MANUAL_INSTANTIATION
184 #include "itkMatchCardinalityImageToImageMetric.hxx"
185 #endif
186 
187 #endif
typename FixedImageType::RegionType FixedImageRegionType
Array class with size defined at construction time.
Definition: itkArray.h:46
Light weight base class for most itk classes.
Define numeric traits for std::vector.
typename TransformType::JacobianType TransformJacobianType
itk::ITK_THREAD_RETURN_TYPE ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
Computes similarity between two objects to be registered.
void Fill(TValue const &v)
Definition: itkArray.h:109
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:83
typename TransformType::ParametersType TransformParametersType
A class for performing multithreaded execution.
typename FixedImageType::ConstPointer FixedImageConstPointer
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
typename TransformType::Pointer TransformPointer
typename NumericTraits< MovingImagePixelType >::RealType RealType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Computes similarity between regions of two images.
void GetDerivative(const TransformParametersType &, DerivativeType &derivative) const override
A templated class holding a n-Dimensional covariant vector.
typename MovingImageType::ConstPointer MovingImageConstPointer