cmtkGroupwiseRegistrationFunctionalXformTemplateBase.h

Go to the documentation of this file.
00001 /*
00002 //
00003 //  Copyright 1997-2009 Torsten Rohlfing
00004 //
00005 //  Copyright 2004-2010 SRI International
00006 //
00007 //  This file is part of the Computational Morphometry Toolkit.
00008 //
00009 //  http://www.nitrc.org/projects/cmtk/
00010 //
00011 //  The Computational Morphometry Toolkit is free software: you can
00012 //  redistribute it and/or modify it under the terms of the GNU General Public
00013 //  License as published by the Free Software Foundation, either version 3 of
00014 //  the License, or (at your option) any later version.
00015 //
00016 //  The Computational Morphometry Toolkit is distributed in the hope that it
00017 //  will be useful, but WITHOUT ANY WARRANTY; without even the implied
00018 //  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 //  GNU General Public License for more details.
00020 //
00021 //  You should have received a copy of the GNU General Public License along
00022 //  with the Computational Morphometry Toolkit.  If not, see
00023 //  <http://www.gnu.org/licenses/>.
00024 //
00025 //  $Revision: 2398 $
00026 //
00027 //  $LastChangedDate: 2010-10-05 14:54:37 -0700 (Tue, 05 Oct 2010) $
00028 //
00029 //  $LastChangedBy: torstenrohlfing $
00030 //
00031 */
00032 
00033 #ifndef __cmtkGroupwiseRegistrationFunctionalXformTemplateBase_h_included_
00034 #define __cmtkGroupwiseRegistrationFunctionalXformTemplateBase_h_included_
00035 
00036 #include <cmtkconfig.h>
00037 
00038 #include <Registration/cmtkGroupwiseRegistrationFunctionalBase.h>
00039 
00040 #include <System/cmtkSmartPtr.h>
00041 #include <System/cmtkThreads.h>
00042 #include <System/cmtkThreadPool.h>
00043 
00044 #include <Base/cmtkUniformVolume.h>
00045 #include <Base/cmtkXform.h>
00046 
00047 #include <vector>
00048 
00049 #ifdef CMTK_BUILD_MPI
00050 #  include <mpi.h>
00051 #endif
00052 
00053 namespace
00054 cmtk
00055 {
00056 
00059 
00070 template<class TXform>
00071 class GroupwiseRegistrationFunctionalXformTemplateBase : 
00073   public GroupwiseRegistrationFunctionalBase
00074 {
00075 public:
00077   typedef GroupwiseRegistrationFunctionalBase Superclass;
00078   
00080   typedef GroupwiseRegistrationFunctionalXformTemplateBase<TXform> Self;
00081 
00083   typedef SmartPointer<Self> SmartPtr;
00084 
00086   typedef TXform XformType;
00087 
00089   typedef typename XformType::SmartPtr XformPointer;
00090 
00092   GroupwiseRegistrationFunctionalXformTemplateBase();
00093 
00095   virtual ~GroupwiseRegistrationFunctionalXformTemplateBase();
00096 
00098   virtual void SetNumberOfHistogramBins( const size_t numberOfHistogramBins );
00099 
00101   virtual void SetCropImageHistograms( const bool crop = true )
00102   {
00103     this->m_CropImageHistograms = crop;
00104   }
00105 
00110   virtual const XformType* GetXformByIndex( const size_t idx ) const
00111   {
00112     return XformType::SmartPtr::DynamicCastFrom( this->m_XformVector[idx] );
00113   }
00114 
00119   virtual typename XformType::SmartPtr GetXformByIndex( const size_t idx )
00120   {
00121     return XformType::SmartPtr::DynamicCastFrom( this->m_XformVector[idx] );
00122   }
00123   
00128   virtual const XformType* GetActiveXformByIndex( const size_t idx ) const
00129   {
00130     return XformType::SmartPtr::DynamicCastFrom( this->m_XformVector[idx + this->m_ActiveXformsFrom] );
00131   }
00132 
00137   virtual typename XformType::SmartPtr GetActiveXformByIndex( const size_t idx )
00138   {
00139     return XformType::SmartPtr::DynamicCastFrom( this->m_XformVector[idx + this->m_ActiveXformsFrom] );
00140   }
00141 
00142 protected:
00145   size_t m_HistogramBins;
00146 
00149   size_t m_HistogramKernelRadiusMax;
00150 
00155   float m_MaxRelativeNumberOutsidePixels;
00156 
00158   byte m_PrivateUserBackgroundValue;
00159 
00160 private:
00162   bool m_CropImageHistograms;
00163 
00165   virtual UniformVolume::SmartPtr PrepareSingleImage( UniformVolume::SmartPtr& image );
00166 
00168   virtual void PrepareTargetImages();
00169 };
00170 
00172 
00173 } // namespace cmtk
00174 
00175 #endif // #ifndef __cmtkGroupwiseRegistrationFunctionalXformTemplateBase_h_included_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines