cmtkImagePairNonrigidRegistration.h

Go to the documentation of this file.
00001 /*
00002 //
00003 //  Copyright 2004-2010 SRI International
00004 //
00005 //  Copyright 1997-2009 Torsten Rohlfing
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: 2752 $
00026 //
00027 //  $LastChangedDate: 2011-01-17 11:33:31 -0800 (Mon, 17 Jan 2011) $
00028 //
00029 //  $LastChangedBy: torstenrohlfing $
00030 //
00031 */
00032 
00033 #ifndef __cmtkImagePairNonrigidRegistration_h_included_
00034 #define __cmtkImagePairNonrigidRegistration_h_included_
00035 
00036 #include <cmtkconfig.h>
00037 
00038 #include <Base/cmtkSplineWarpXform.h>
00039 #include <Registration/cmtkImagePairRegistration.h>
00040 
00041 #include <string.h>
00042 
00043 namespace
00044 cmtk
00045 {
00046 
00049 
00056 class ImagePairNonrigidRegistration : 
00058   public ImagePairRegistration 
00059 {
00060 public:
00062   typedef ImagePairNonrigidRegistration Self;
00063 
00065   typedef ImagePairRegistration Superclass;
00066 
00067 protected:
00069   SplineWarpXform::SmartPtr InitialWarpXform;
00070 
00072   SplineWarpXform::SmartPtr InverseWarpXform;
00073 
00075   cmtkGetSetMacro(bool,MatchFltToRefHistogram);
00076 
00082   cmtkGetSetMacroDefault(bool,RepeatMatchFltToRefHistogram,true);
00083 
00085   cmtkGetSetMacro(int,RefineGrid);
00086 
00091   cmtkGetSetMacro(bool,DelayRefineGrid);
00092 
00094   cmtkGetSetMacro(Types::Coordinate,GridSpacing);
00095 
00102   cmtkGetSetMacro(bool,ExactGridSpacing);
00103 
00105   unsigned int IgnoreEdge;
00106 
00109   const char* RestrictToAxes;
00110 
00112   cmtkGetSetMacro(bool,FastMode);
00113 
00115   cmtkGetSetMacro(bool,AdaptiveFixParameters);
00116 
00124   cmtkGetSetMacro(float,AdaptiveFixThreshFactor);
00125 
00127   cmtkGetSetMacro(float,JacobianConstraintWeight);
00128 
00130   cmtkGetSetMacro(float,GridEnergyWeight);
00131 
00133   cmtkGetSetMacro(float,RelaxWeight);
00134 
00140   cmtkGetSetMacro(float,InverseConsistencyWeight);
00141 
00143   cmtkGetSetMacro(float,LandmarkErrorWeight);
00144 
00146   bool m_RelaxToUnfold;
00147 
00151   ImagePairNonrigidRegistration();
00152 
00156   virtual ~ImagePairNonrigidRegistration() {};
00157 
00167   virtual CallbackResult InitRegistration ();
00168 
00171   virtual void EnterResolution( CoordinateVector::SmartPtr&, Functional::SmartPtr&, const int, const int );
00172 
00179   virtual int DoneResolution( CoordinateVector::SmartPtr&, Functional::SmartPtr&, const int, const int );
00181 
00183   SplineWarpXform::SmartPtr GetTransformation() const
00184   {
00185     return SplineWarpXform::SmartPtr::DynamicCastFrom( this->m_Xform );
00186   }
00187 
00189   const UniformVolume::SmartPtr GetReformattedFloatingImage( Interpolators::InterpolationEnum interpolator = Interpolators::LINEAR ) const;
00190 
00191 private:
00193   MatchedLandmarkList::SmartPtr m_MatchedLandmarks;
00194 
00196   int RefinedGridAtLevel;
00197 
00199   int RefineGridCount;
00200 
00202   bool RelaxationStep;
00203 
00205   bool RefineDelayed;
00206 
00214   SplineWarpXform::SmartPtr MakeWarpXform( const UniformVolume::CoordinateVectorType& size, const AffineXform* initialAffine ) const;
00215 
00217   class LevelParameters
00219     : public Superclass::LevelParameters
00220   {
00221   public:
00223     LevelParameters( const Types::Coordinate resolution ) : m_Resolution( resolution ) {}
00224 
00226     Types::Coordinate m_Resolution;
00227   };
00228 
00231   virtual Functional* MakeFunctional( const int level, const Superclass::LevelParameters* levelParameters );
00232 };
00233 
00235 
00236 } // namespace cmtk
00237 
00238 #endif // __cmtkImagePairNonrigidRegistration_h_included_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines