ITK  4.4.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< class TFixedImage, class TMovingImage >
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 
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 
101  void GetDerivative(const TransformParametersType &,
102  DerivativeType & derivative) const
103  {
104  itkWarningMacro(<< "This metric does not provide metric derivatives.");
106  }
108 
115  MeasureType GetValue(const TransformParametersType & parameters) const;
116 
123  itkSetMacro(MeasureMatches, bool);
124  itkBooleanMacro(MeasureMatches);
125  itkGetConstMacro(MeasureMatches, bool);
127 
129  MultiThreader * GetMultiThreader()
130  { return m_Threader; }
131 
132 protected:
135  void PrintSelf(std::ostream & os, Indent indent) const;
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  MatchCardinalityImageToImageMetric(const Self &); //purposely not implemented
173  void operator=(const Self &); //purposely not implemented
174 
176  std::vector< MeasureType > m_ThreadMatches;
177  std::vector< SizeValueType > m_ThreadCounts;
178 
181  MultiThreader::Pointer m_Threader;
182 };
183 } // end namespace itk
184 
185 #ifndef ITK_MANUAL_INSTANTIATION
186 #include "itkMatchCardinalityImageToImageMetric.hxx"
187 #endif
188 
189 #endif
190