Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkMatchCardinalityImageToImageMetric.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkMatchCardinalityImageToImageMetric.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-02-03 04:05:28 $
00007   Version:   $Revision: 1.6 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkMatchCardinalityImageToImageMetric_h
00018 #define __itkMatchCardinalityImageToImageMetric_h
00019 
00020 // First make sure that the configuration is available.
00021 // This line can be removed once the optimized versions
00022 // gets integrated into the main directories.
00023 #include "itkConfigure.h"
00024 
00025 #ifdef ITK_USE_OPTIMIZED_REGISTRATION_METHODS
00026 #include "itkOptMatchCardinalityImageToImageMetric.h"
00027 #else
00028 
00029 #include "itkImageToImageMetric.h"
00030 #include "itkCovariantVector.h"
00031 #include "itkPoint.h"
00032 #include "itkMultiThreader.h"
00033 #include <vector>
00034 
00035 namespace itk
00036 {
00070 template < class TFixedImage, class TMovingImage > 
00071 class ITK_EXPORT MatchCardinalityImageToImageMetric : 
00072     public ImageToImageMetric< TFixedImage, TMovingImage>
00073 {
00074 public:
00075 
00077   typedef MatchCardinalityImageToImageMetric    Self;
00078   typedef ImageToImageMetric<TFixedImage, TMovingImage >  Superclass;
00079 
00080   typedef SmartPointer<Self>         Pointer;
00081   typedef SmartPointer<const Self>   ConstPointer;
00082 
00084   itkNewMacro(Self);
00085 
00087   itkTypeMacro(MatchCardinalityImageToImageMetric, ImageToImageMetric);
00088 
00089  
00091   typedef typename Superclass::RealType                 RealType;
00092   typedef typename Superclass::TransformType            TransformType;
00093   typedef typename Superclass::TransformPointer         TransformPointer;
00094   typedef typename Superclass::TransformParametersType  TransformParametersType;
00095   typedef typename Superclass::TransformJacobianType    TransformJacobianType;
00096   typedef typename Superclass::GradientPixelType        GradientPixelType;
00097   typedef typename Superclass::InputPointType           InputPointType;
00098   typedef typename Superclass::OutputPointType          OutputPointType;
00099 
00100   typedef typename Superclass::MeasureType              MeasureType;
00101   typedef typename Superclass::DerivativeType           DerivativeType;
00102   typedef typename Superclass::FixedImageType           FixedImageType;
00103   typedef typename Superclass::MovingImageType          MovingImageType;
00104   typedef typename Superclass::FixedImageConstPointer   FixedImageConstPointer;
00105   typedef typename Superclass::MovingImageConstPointer  MovingImageConstPointer;
00106   typedef typename Superclass::FixedImageRegionType     FixedImageRegionType;
00107 
00108 
00110   void GetDerivative( const TransformParametersType &,
00111                       DerivativeType & derivative ) const
00112     {
00113       itkWarningMacro(<< "This metric does not provide metric derivatives.");
00114       derivative.Fill( NumericTraits<ITK_TYPENAME DerivativeType::ValueType>::Zero );
00115     }
00117 
00124   MeasureType GetValue( const TransformParametersType & parameters ) const;
00125 
00132   itkSetMacro(MeasureMatches, bool);
00133   itkBooleanMacro(MeasureMatches);
00134   itkGetMacro(MeasureMatches, bool);
00136 
00138   itkSetClampMacro( NumberOfThreads, int, 1, ITK_MAX_THREADS );
00139   itkGetConstReferenceMacro( NumberOfThreads, int );
00141 
00143   MultiThreader * GetMultiThreader()
00144     {return m_Threader;}
00145 
00146 protected:
00147   MatchCardinalityImageToImageMetric();
00148   virtual ~MatchCardinalityImageToImageMetric() {};
00149   void PrintSelf(std::ostream& os, Indent indent) const;
00150 
00156   MeasureType GetNonconstValue( const TransformParametersType & parameters );
00157 
00162   virtual
00163   void ThreadedGetValue(const FixedImageRegionType& outputRegionForThread,
00164                         int threadId );
00165 
00171   virtual
00172   int SplitFixedRegion(int i,int num, FixedImageRegionType& splitRegion);
00173 
00177   static ITK_THREAD_RETURN_TYPE ThreaderCallback( void *arg );
00178 
00180   struct ThreadStruct
00181   {
00182     Pointer Metric;
00183   };
00184 
00185 private:
00186   MatchCardinalityImageToImageMetric(const Self&); //purposely not implemented
00187   void operator=(const Self&); //purposely not implemented
00188 
00189   bool m_MeasureMatches;
00190   std::vector<MeasureType> m_ThreadMatches;
00191   std::vector<unsigned long> m_ThreadCounts;
00192   
00195   MultiThreader::Pointer m_Threader;
00196   int m_NumberOfThreads;
00197 };
00198 
00199 
00200 } // end namespace itk
00201 
00202 #ifndef ITK_MANUAL_INSTANTIATION
00203 #include "itkMatchCardinalityImageToImageMetric.txx"
00204 #endif
00205 
00206 #endif
00207 
00208 #endif
00209 
00210 

Generated at Mon Apr 14 13:27:21 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000