ITK  5.2.0
Insight Toolkit
itkMatchCardinalityImageToImageMetric.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 : public ImageToImageMetric<TFixedImage, TMovingImage>
68 {
69 public:
70  ITK_DISALLOW_COPY_AND_MOVE(MatchCardinalityImageToImageMetric);
71 
77 
79  itkNewMacro(Self);
80 
83 
85  using RealType = typename Superclass::RealType;
86  using TransformType = typename Superclass::TransformType;
87  using TransformPointer = typename Superclass::TransformPointer;
88  using TransformParametersType = typename Superclass::TransformParametersType;
89  using TransformJacobianType = typename Superclass::TransformJacobianType;
90  using GradientPixelType = typename Superclass::GradientPixelType;
91 
92  using MeasureType = typename Superclass::MeasureType;
93  using DerivativeType = typename Superclass::DerivativeType;
94  using FixedImageType = typename Superclass::FixedImageType;
95  using MovingImageType = typename Superclass::MovingImageType;
96  using FixedImageConstPointer = typename Superclass::FixedImageConstPointer;
97  using MovingImageConstPointer = typename Superclass::MovingImageConstPointer;
98  using FixedImageRegionType = typename Superclass::FixedImageRegionType;
99 
101  void
102  GetDerivative(const TransformParametersType &, DerivativeType & derivative) const override
103  {
104  itkWarningMacro(<< "This metric does not provide metric derivatives.");
106  }
108 
115  MeasureType
116  GetValue(const TransformParametersType & parameters) const override;
117 
124  itkSetMacro(MeasureMatches, bool);
125  itkBooleanMacro(MeasureMatches);
126  itkGetConstMacro(MeasureMatches, bool);
128 
132  {
133  return m_Threader;
134  }
135 
136 protected:
138  ~MatchCardinalityImageToImageMetric() override = default;
139  void
140  PrintSelf(std::ostream & os, Indent indent) const override;
141 
147  MeasureType
148  GetNonconstValue(const TransformParametersType & parameters);
149 
154  virtual void
155  ThreadedGetValue(const FixedImageRegionType & regionForThread, ThreadIdType threadId);
156 
162  virtual ThreadIdType
163  SplitFixedRegion(ThreadIdType i, int num, FixedImageRegionType & splitRegion);
164 
169  ThreaderCallback(void * arg);
170 
174  {
176  };
177 
178 private:
180  std::vector<MeasureType> m_ThreadMatches;
181  std::vector<SizeValueType> m_ThreadCounts;
182 
186 };
187 } // end namespace itk
188 
189 #ifndef ITK_MANUAL_INSTANTIATION
190 # include "itkMatchCardinalityImageToImageMetric.hxx"
191 #endif
192 
193 #endif
itk::ImageToImageMetric::FixedImageConstPointer
typename FixedImageType::ConstPointer FixedImageConstPointer
Definition: itkImageToImageMetric.h:77
itk::MultiThreaderBase
A class for performing multithreaded execution.
Definition: itkMultiThreaderBase.h:105
itk::ImageToImageMetric
Computes similarity between regions of two images.
Definition: itkImageToImageMetric.h:52
itk::SingleValuedCostFunction::MeasureType
double MeasureType
Definition: itkSingleValuedCostFunction.h:50
itk::ImageToImageMetric::TransformParametersType
typename TransformType::ParametersType TransformParametersType
Definition: itkImageToImageMetric.h:90
itkPoint.h
itk::ImageToImageMetric::RealType
typename NumericTraits< MovingImagePixelType >::RealType RealType
Definition: itkImageToImageMetric.h:106
itk::ImageToImageMetric::TransformJacobianType
typename TransformType::JacobianType TransformJacobianType
Definition: itkImageToImageMetric.h:91
itk::MatchCardinalityImageToImageMetric::m_MeasureMatches
bool m_MeasureMatches
Definition: itkMatchCardinalityImageToImageMetric.h:179
itk::ImageToImageMetric::FixedImageType
TFixedImage FixedImageType
Definition: itkImageToImageMetric.h:75
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::MatchCardinalityImageToImageMetric::GetDerivative
void GetDerivative(const TransformParametersType &, DerivativeType &derivative) const override
Definition: itkMatchCardinalityImageToImageMetric.h:102
itk::ThreadIdType
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
itk::ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
itk::ITK_THREAD_RETURN_TYPE ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION
Definition: itkThreadSupport.h:82
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::MatchCardinalityImageToImageMetric::ThreadStruct
Definition: itkMatchCardinalityImageToImageMetric.h:173
itk::MatchCardinalityImageToImageMetric
Computes similarity between two objects to be registered.
Definition: itkMatchCardinalityImageToImageMetric.h:67
itk::MatchCardinalityImageToImageMetric::m_ThreadCounts
std::vector< SizeValueType > m_ThreadCounts
Definition: itkMatchCardinalityImageToImageMetric.h:181
itkImageToImageMetric.h
itk::ImageToImageMetric::MovingImageConstPointer
typename MovingImageType::ConstPointer MovingImageConstPointer
Definition: itkImageToImageMetric.h:72
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:58
itk::CovariantVector
A templated class holding a n-Dimensional covariant vector.
Definition: itkCovariantVector.h:70
itk::MatchCardinalityImageToImageMetric::m_Threader
MultiThreaderBase::Pointer m_Threader
Definition: itkMatchCardinalityImageToImageMetric.h:185
itk::ImageToImageMetric::TransformPointer
typename TransformType::Pointer TransformPointer
Definition: itkImageToImageMetric.h:87
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ImageToImageMetric::MovingImageType
TMovingImage MovingImageType
Definition: itkImageToImageMetric.h:70
itk::MatchCardinalityImageToImageMetric::m_ThreadMatches
std::vector< MeasureType > m_ThreadMatches
Definition: itkMatchCardinalityImageToImageMetric.h:180
itk::Array
Array class with size defined at construction time.
Definition: itkArray.h:47
itk::Transform
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
itk::MatchCardinalityImageToImageMetric::GetMultiThreader
MultiThreaderBase * GetMultiThreader()
Definition: itkMatchCardinalityImageToImageMetric.h:131
itk::MatchCardinalityImageToImageMetric::ThreadStruct::Metric
Pointer Metric
Definition: itkMatchCardinalityImageToImageMetric.h:175
itk::Array::Fill
void Fill(TValue const &v)
Definition: itkArray.h:117
itk::ImageToImageMetric::FixedImageRegionType
typename FixedImageType::RegionType FixedImageRegionType
Definition: itkImageToImageMetric.h:78