ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkCenteredTransformInitializer.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkCenteredTransformInitializer_h
00019 #define __itkCenteredTransformInitializer_h
00020 
00021 #include "itkObject.h"
00022 #include "itkObjectFactory.h"
00023 #include "itkImageMomentsCalculator.h"
00024 
00025 #include <iostream>
00026 
00027 namespace itk
00028 {
00060 template< class TTransform,
00061           class TFixedImage,
00062           class TMovingImage >
00063 class ITK_EXPORT CenteredTransformInitializer:public Object
00064 {
00065 public:
00067   typedef CenteredTransformInitializer Self;
00068   typedef Object                       Superclass;
00069   typedef SmartPointer< Self >         Pointer;
00070   typedef SmartPointer< const Self >   ConstPointer;
00071 
00073   itkNewMacro(Self);
00074 
00076   itkTypeMacro(CenteredTransformInitializer, Object);
00077 
00079   typedef TTransform                      TransformType;
00080   typedef typename TransformType::Pointer TransformPointer;
00081 
00083   itkStaticConstMacro(InputSpaceDimension, unsigned int,
00084                       TransformType::InputSpaceDimension);
00085   itkStaticConstMacro(OutputSpaceDimension, unsigned int,
00086                       TransformType::OutputSpaceDimension);
00088 
00090   typedef   TFixedImage  FixedImageType;
00091   typedef   TMovingImage MovingImageType;
00092 
00093   typedef   typename FixedImageType::ConstPointer  FixedImagePointer;
00094   typedef   typename MovingImageType::ConstPointer MovingImagePointer;
00095 
00097   typedef ImageMomentsCalculator< FixedImageType >  FixedImageCalculatorType;
00098   typedef ImageMomentsCalculator< MovingImageType > MovingImageCalculatorType;
00099 
00100   typedef typename FixedImageCalculatorType::Pointer
00101   FixedImageCalculatorPointer;
00102   typedef typename MovingImageCalculatorType::Pointer
00103   MovingImageCalculatorPointer;
00104 
00106   typedef typename TransformType::OffsetType OffsetType;
00107 
00109   typedef typename TransformType::InputPointType InputPointType;
00110 
00112   typedef typename TransformType::OutputVectorType OutputVectorType;
00113 
00115   itkSetObjectMacro(Transform,   TransformType);
00116 
00118   itkSetConstObjectMacro(FixedImage,  FixedImageType);
00119 
00121   itkSetConstObjectMacro(MovingImage, MovingImageType);
00122 
00124   virtual void InitializeTransform();
00125 
00128   void GeometryOn() { m_UseMoments = false; }
00129   void MomentsOn()  { m_UseMoments = true; }
00131 
00133   itkGetConstObjectMacro(FixedCalculator,  FixedImageCalculatorType);
00134   itkGetConstObjectMacro(MovingCalculator, MovingImageCalculatorType);
00135 protected:
00136   CenteredTransformInitializer();
00137   ~CenteredTransformInitializer(){}
00139 
00140   void PrintSelf(std::ostream & os, Indent indent) const;
00141 
00142   itkGetObjectMacro(Transform, TransformType);
00143 private:
00144   CenteredTransformInitializer(const Self &); //purposely not implemented
00145   void operator=(const Self &);               //purposely not implemented
00146 
00147   TransformPointer m_Transform;
00148 
00149   FixedImagePointer m_FixedImage;
00150 
00151   MovingImagePointer m_MovingImage;
00152 
00153   bool m_UseMoments;
00154 
00155   FixedImageCalculatorPointer  m_FixedCalculator;
00156   MovingImageCalculatorPointer m_MovingCalculator;
00157 }; //class CenteredTransformInitializer
00158 }  // namespace itk
00159 
00160 #ifndef ITK_MANUAL_INSTANTIATION
00161 #include "itkCenteredTransformInitializer.hxx"
00162 #endif
00163 
00164 #endif /* __itkCenteredTransformInitializer_h */
00165