itkOptMatchCardinalityImageToImageMetric.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkOptMatchCardinalityImageToImageMetric_h
00018 #define __itkOptMatchCardinalityImageToImageMetric_h
00019
00025 #include "itkImageToImageMetric.h"
00026 #include "itkCovariantVector.h"
00027 #include "itkPoint.h"
00028 #include "itkMultiThreader.h"
00029 #include <vector>
00030
00031 namespace itk
00032 {
00066 template < class TFixedImage, class TMovingImage >
00067 class ITK_EXPORT MatchCardinalityImageToImageMetric :
00068 public ImageToImageMetric< TFixedImage, TMovingImage>
00069 {
00070 public:
00071
00073 typedef MatchCardinalityImageToImageMetric Self;
00074 typedef ImageToImageMetric<TFixedImage, TMovingImage > Superclass;
00075 typedef SmartPointer<Self> Pointer;
00076 typedef SmartPointer<const Self> ConstPointer;
00077
00079 itkNewMacro(Self);
00080
00082 itkTypeMacro(MatchCardinalityImageToImageMetric, ImageToImageMetric);
00083
00084
00086 typedef typename Superclass::RealType RealType;
00087 typedef typename Superclass::TransformType TransformType;
00088 typedef typename Superclass::TransformPointer TransformPointer;
00089 typedef typename Superclass::TransformParametersType TransformParametersType;
00090 typedef typename Superclass::TransformJacobianType TransformJacobianType;
00091 typedef typename Superclass::GradientPixelType GradientPixelType;
00092
00093 typedef typename Superclass::MeasureType MeasureType;
00094 typedef typename Superclass::DerivativeType DerivativeType;
00095 typedef typename Superclass::FixedImageType FixedImageType;
00096 typedef typename Superclass::MovingImageType MovingImageType;
00097 typedef typename Superclass::FixedImageConstPointer FixedImageConstPointer;
00098 typedef typename Superclass::MovingImageConstPointer MovingImageConstPointer;
00099 typedef typename Superclass::FixedImageRegionType FixedImageRegionType;
00100
00101
00103 void GetDerivative( const TransformParametersType &,
00104 DerivativeType & derivative ) const
00105 {
00106 itkWarningMacro(<< "This metric does not provide metric derivatives.");
00107 derivative.Fill( NumericTraits<ITK_TYPENAME DerivativeType::ValueType>::Zero );
00108 }
00110
00117 MeasureType GetValue( const TransformParametersType & parameters ) const;
00118
00125 itkSetMacro(MeasureMatches, bool);
00126 itkBooleanMacro(MeasureMatches);
00127 itkGetMacro(MeasureMatches, bool);
00129
00131 MultiThreader * GetMultiThreader()
00132 {return m_Threader;}
00133
00134 protected:
00135 MatchCardinalityImageToImageMetric();
00136 virtual ~MatchCardinalityImageToImageMetric() {};
00137 void PrintSelf(std::ostream& os, Indent indent) const;
00138
00144 MeasureType GetNonconstValue( const TransformParametersType & parameters );
00145
00150 virtual
00151 void ThreadedGetValue(const FixedImageRegionType& outputRegionForThread,
00152 int threadId );
00153
00159 virtual
00160 int SplitFixedRegion(int i,int num, FixedImageRegionType& splitRegion);
00161
00165 static ITK_THREAD_RETURN_TYPE ThreaderCallback( void *arg );
00166
00168 struct ThreadStruct
00169 {
00170 Pointer Metric;
00171 };
00172
00173 private:
00174 MatchCardinalityImageToImageMetric(const Self&);
00175 void operator=(const Self&);
00176
00177 bool m_MeasureMatches;
00178 std::vector<MeasureType> m_ThreadMatches;
00179 std::vector<unsigned long> m_ThreadCounts;
00180
00183 MultiThreader::Pointer m_Threader;
00184 };
00185
00186 }
00187
00188 #ifndef ITK_MANUAL_INSTANTIATION
00189 #include "itkMatchCardinalityImageToImageMetric.txx"
00190 #endif
00191
00192 #endif
00193