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

itkOptMatchCardinalityImageToImageMetric.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkOptMatchCardinalityImageToImageMetric.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-04-23 03:43:42 $
00007   Version:   $Revision: 1.5 $
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 __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   itkGetConstMacro(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&); //purposely not implemented
00175   void operator=(const Self&); //purposely not implemented
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 } // end namespace itk
00187 
00188 #ifndef ITK_MANUAL_INSTANTIATION
00189 #include "itkMatchCardinalityImageToImageMetric.txx"
00190 #endif
00191 
00192 #endif
00193 

Generated at Mon Jul 12 2010 19:21:28 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000