ITK  4.13.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 
77 
79  itkNewMacro(Self);
80 
83 
85  typedef typename Superclass::RealType RealType;
86  typedef typename Superclass::TransformType TransformType;
87  typedef typename Superclass::TransformPointer TransformPointer;
88  typedef typename Superclass::TransformParametersType TransformParametersType;
89  typedef typename Superclass::TransformJacobianType TransformJacobianType;
90  typedef typename Superclass::GradientPixelType GradientPixelType;
91 
92  typedef typename Superclass::MeasureType MeasureType;
93  typedef typename Superclass::DerivativeType DerivativeType;
94  typedef typename Superclass::FixedImageType FixedImageType;
95  typedef typename Superclass::MovingImageType MovingImageType;
96  typedef typename Superclass::FixedImageConstPointer FixedImageConstPointer;
97  typedef typename Superclass::MovingImageConstPointer MovingImageConstPointer;
98  typedef typename Superclass::FixedImageRegionType FixedImageRegionType;
99 
102  DerivativeType & derivative) const ITK_OVERRIDE
103  {
104  itkWarningMacro(<< "This metric does not provide metric derivatives.");
106  }
108 
115  MeasureType GetValue(const TransformParametersType & parameters) const ITK_OVERRIDE;
116 
123  itkSetMacro(MeasureMatches, bool);
124  itkBooleanMacro(MeasureMatches);
125  itkGetConstMacro(MeasureMatches, bool);
127 
129  MultiThreader * GetMultiThreader()
130  { return m_Threader; }
131 
132 protected:
134  virtual ~MatchCardinalityImageToImageMetric() ITK_OVERRIDE {}
135  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
136 
142  MeasureType GetNonconstValue(const TransformParametersType & parameters);
143 
148  virtual
149  void ThreadedGetValue(const FixedImageRegionType & outputRegionForThread,
150  ThreadIdType threadId);
151 
157  virtual
158  ThreadIdType SplitFixedRegion(ThreadIdType i, int num, FixedImageRegionType & splitRegion);
159 
163  static ITK_THREAD_RETURN_TYPE ThreaderCallback(void *arg);
164 
167  struct ThreadStruct {
169  };
170 
171 private:
172  ITK_DISALLOW_COPY_AND_ASSIGN(MatchCardinalityImageToImageMetric);
173 
174  bool m_MeasureMatches;
175  std::vector< MeasureType > m_ThreadMatches;
176  std::vector< SizeValueType > m_ThreadCounts;
177 
180  MultiThreader::Pointer m_Threader;
181 };
182 } // end namespace itk
183 
184 #ifndef ITK_MANUAL_INSTANTIATION
185 #include "itkMatchCardinalityImageToImageMetric.hxx"
186 #endif
187 
188 #endif
Array class with size defined at construction time.
Definition: itkArray.h:50
Light weight base class for most itk classes.
#define ITK_THREAD_RETURN_TYPE
Computes similarity between two objects to be registered.
ImageToImageMetric< TFixedImage, TMovingImage > Superclass
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Superclass::MovingImageConstPointer MovingImageConstPointer
Define additional traits for native types such as int or float.
Computes similarity between regions of two images.
void GetDerivative(const TransformParametersType &, DerivativeType &derivative) const override
TransformType::ParametersType TransformParametersType
Superclass::TransformParametersType TransformParametersType