ITK  5.4.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 * https://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
27#include "itkPoint.h"
28#include <vector>
29
30namespace itk
31{
66template <typename TFixedImage, typename TMovingImage>
67class ITK_TEMPLATE_EXPORT MatchCardinalityImageToImageMetric : public ImageToImageMetric<TFixedImage, TMovingImage>
68{
69public:
70 ITK_DISALLOW_COPY_AND_MOVE(MatchCardinalityImageToImageMetric);
71
77
79 itkNewMacro(Self);
80
82 itkOverrideGetNameOfClassMacro(MatchCardinalityImageToImageMetric);
83
85 using typename Superclass::RealType;
86 using typename Superclass::TransformType;
87 using typename Superclass::TransformPointer;
88 using typename Superclass::TransformParametersType;
89 using typename Superclass::TransformJacobianType;
90 using typename Superclass::GradientPixelType;
91
92 using typename Superclass::MeasureType;
93 using typename Superclass::DerivativeType;
94 using typename Superclass::FixedImageType;
95 using typename Superclass::MovingImageType;
96 using typename Superclass::FixedImageConstPointer;
97 using typename Superclass::MovingImageConstPointer;
98 using typename Superclass::FixedImageRegionType;
99
101 void
102 GetDerivative(const TransformParametersType &, DerivativeType & derivative) const override
103 {
104 itkWarningMacro("This metric does not provide metric derivatives.");
105 derivative.Fill(typename DerivativeType::ValueType{});
106 }
115 MeasureType
116 GetValue(const TransformParametersType & parameters) const override;
117
124 itkSetMacro(MeasureMatches, bool);
125 itkBooleanMacro(MeasureMatches);
126 itkGetConstMacro(MeasureMatches, bool);
132 {
133 return m_Threader;
134 }
135
136protected:
139 void
140 PrintSelf(std::ostream & os, Indent indent) const override;
141
149
154 virtual void
155 ThreadedGetValue(const FixedImageRegionType & regionForThread, ThreadIdType threadId);
156
162 virtual ThreadIdType
164
172 ThreaderCallback(void * arg);
173
177 {
179 };
180
181private:
182 // default to measure percentage of pixel matches
183 bool m_MeasureMatches{ true };
184 std::vector<MeasureType> m_ThreadMatches{};
185 std::vector<SizeValueType> m_ThreadCounts{};
186
190};
191} // end namespace itk
194#ifndef ITK_MANUAL_INSTANTIATION
195# include "itkMatchCardinalityImageToImageMetric.hxx"
196#endif
197
198#endif
Array class with size defined at construction time.
Definition: itkArray.h:48
void Fill(TValue const &v)
Definition: itkArray.h:114
TValue ValueType
Definition: itkArray.h:52
Computes similarity between regions of two images.
typename FixedImageType::RegionType FixedImageRegionType
typename TransformType::ParametersType TransformParametersType
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Computes similarity between two objects to be registered.
void PrintSelf(std::ostream &os, Indent indent) const override
~MatchCardinalityImageToImageMetric() override=default
MeasureType GetValue(const TransformParametersType &parameters) const override
virtual ThreadIdType SplitFixedRegion(ThreadIdType i, int num, FixedImageRegionType &splitRegion)
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION ThreaderCallback(void *arg)
virtual void ThreadedGetValue(const FixedImageRegionType &regionForThread, ThreadIdType threadId)
void GetDerivative(const TransformParametersType &, DerivativeType &derivative) const override
MeasureType GetNonconstValue(const TransformParametersType &parameters)
A class for performing multithreaded execution.
static Pointer New()
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned int ThreadIdType
Definition: itkIntTypes.h:99
itk::ITK_THREAD_RETURN_TYPE ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION