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: 2004/03/12 15:46:47 $
00007   Version:   $Revision: 1.4 $
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 #include "itkImageToImageMetric.h"
00021 #include "itkCovariantVector.h"
00022 #include "itkPoint.h"
00023 #include "itkMultiThreader.h"
00024 #include <vector>
00025 
00026 namespace itk
00027 {
00061 template < class TFixedImage, class TMovingImage > 
00062 class ITK_EXPORT MatchCardinalityImageToImageMetric : 
00063     public ImageToImageMetric< TFixedImage, TMovingImage>
00064 {
00065 public:
00066 
00068   typedef MatchCardinalityImageToImageMetric    Self;
00069   typedef ImageToImageMetric<TFixedImage, TMovingImage >  Superclass;
00070 
00071   typedef SmartPointer<Self>         Pointer;
00072   typedef SmartPointer<const Self>   ConstPointer;
00073 
00075   itkNewMacro(Self);
00076 
00078   itkTypeMacro(MatchCardinalityImageToImageMetric, ImageToImageMetric);
00079 
00080  
00082   typedef typename Superclass::RealType                 RealType;
00083   typedef typename Superclass::TransformType            TransformType;
00084   typedef typename Superclass::TransformPointer         TransformPointer;
00085   typedef typename Superclass::TransformParametersType  TransformParametersType;
00086   typedef typename Superclass::TransformJacobianType    TransformJacobianType;
00087   typedef typename Superclass::GradientPixelType        GradientPixelType;
00088 
00089   typedef typename Superclass::MeasureType              MeasureType;
00090   typedef typename Superclass::DerivativeType           DerivativeType;
00091   typedef typename Superclass::FixedImageType           FixedImageType;
00092   typedef typename Superclass::MovingImageType          MovingImageType;
00093   typedef typename Superclass::FixedImageConstPointer   FixedImageConstPointer;
00094   typedef typename Superclass::MovingImageConstPointer  MovingImageConstPointer;
00095   typedef typename Superclass::FixedImageRegionType     FixedImageRegionType;
00096 
00097 
00099   void GetDerivative( const TransformParametersType &,
00100                       DerivativeType & derivative ) const
00101     {
00102       itkWarningMacro(<< "This metric does not provide metric derivatives.");
00103       derivative.Fill( NumericTraits<ITK_TYPENAME DerivativeType::ValueType>::Zero );
00104     }
00106 
00113   MeasureType GetValue( const TransformParametersType & parameters ) const;
00114 
00121   itkSetMacro(MeasureMatches, bool);
00122   itkBooleanMacro(MeasureMatches);
00123   itkGetMacro(MeasureMatches, bool);
00125 
00127   itkSetClampMacro( NumberOfThreads, int, 1, ITK_MAX_THREADS );
00128   itkGetConstReferenceMacro( NumberOfThreads, int );
00130 
00132   MultiThreader * GetMultiThreader()
00133     {return m_Threader;}
00134 
00135 protected:
00136   MatchCardinalityImageToImageMetric();
00137   virtual ~MatchCardinalityImageToImageMetric() {};
00138   void PrintSelf(std::ostream& os, Indent indent) const;
00139 
00145   MeasureType GetNonconstValue( const TransformParametersType & parameters );
00146 
00151   virtual
00152   void ThreadedGetValue(const FixedImageRegionType& outputRegionForThread,
00153                         int threadId );
00154 
00160   virtual
00161   int SplitFixedRegion(int i,int num, FixedImageRegionType& splitRegion);
00162 
00166   static ITK_THREAD_RETURN_TYPE ThreaderCallback( void *arg );
00167 
00169   struct ThreadStruct
00170   {
00171     Pointer Metric;
00172   };
00173 
00174 private:
00175   MatchCardinalityImageToImageMetric(const Self&); //purposely not implemented
00176   void operator=(const Self&); //purposely not implemented
00177 
00178   bool m_MeasureMatches;
00179   std::vector<MeasureType> m_ThreadMatches;
00180   std::vector<unsigned long> m_ThreadCounts;
00181   
00184   MultiThreader::Pointer m_Threader;
00185   int m_NumberOfThreads;
00186 };
00187 
00188 } // end namespace itk
00189 
00190 #ifndef ITK_MANUAL_INSTANTIATION
00191 #include "itkMatchCardinalityImageToImageMetric.txx"
00192 #endif
00193 
00194 #endif
00195 
00196 
00197 
00198 

Generated at Sun Sep 23 13:27:25 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000