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     }
00105 
00112   MeasureType GetValue( const TransformParametersType & parameters ) const;
00113 
00120   itkSetMacro(MeasureMatches, bool);
00121   itkBooleanMacro(MeasureMatches);
00122   itkGetMacro(MeasureMatches, bool);
00123   
00125   itkSetClampMacro( NumberOfThreads, int, 1, ITK_MAX_THREADS );
00126   itkGetConstReferenceMacro( NumberOfThreads, int );
00127   
00129   MultiThreader * GetMultiThreader()
00130     {return m_Threader;}
00131 
00132 protected:
00133   MatchCardinalityImageToImageMetric();
00134   virtual ~MatchCardinalityImageToImageMetric() {};
00135   void PrintSelf(std::ostream& os, Indent indent) const;
00136 
00142   MeasureType GetNonconstValue( const TransformParametersType & parameters );
00143 
00148   virtual
00149   void ThreadedGetValue(const FixedImageRegionType& outputRegionForThread,
00150                         int threadId );
00151 
00157   virtual
00158   int SplitFixedRegion(int i,int num, FixedImageRegionType& splitRegion);
00159 
00163   static ITK_THREAD_RETURN_TYPE ThreaderCallback( void *arg );
00164 
00166   struct ThreadStruct
00167   {
00168     Pointer Metric;
00169   };
00170 
00171 private:
00172   MatchCardinalityImageToImageMetric(const Self&); //purposely not implemented
00173   void operator=(const Self&); //purposely not implemented
00174 
00175   bool m_MeasureMatches;
00176   std::vector<MeasureType> m_ThreadMatches;
00177   std::vector<unsigned long> m_ThreadCounts;
00178   
00181   MultiThreader::Pointer m_Threader;
00182   int m_NumberOfThreads;
00183 };
00184 
00185 } // end namespace itk
00186 
00187 #ifndef ITK_MANUAL_INSTANTIATION
00188 #include "itkMatchCardinalityImageToImageMetric.txx"
00189 #endif
00190 
00191 #endif
00192 
00193 
00194 

Generated at Wed May 24 23:37:39 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000