]> Creatis software - clitk.git/blob - registration/clitkAffineRegistrationGenericFilter.cxx
Added clitkAffineRegistration from Jef's file. Also does translations only and rigid...
[clitk.git] / registration / clitkAffineRegistrationGenericFilter.cxx
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to:
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
18
19 #ifndef CLITKAFFINEREGISTRATIONGENERICFILTER_CXX
20 #define CLITKAFFINEREGISTRATIONGENERICFILTER_CXX
21
22 #include "clitkAffineRegistrationGenericFilter.h"
23
24 namespace clitk
25 {
26
27 //====================================================================
28 // Constructor
29 AffineRegistrationGenericFilter::AffineRegistrationGenericFilter()
30 {
31   m_Verbose=false;
32 }
33
34 //====================================================================
35 // Update
36 void AffineRegistrationGenericFilter::Update()
37 {
38   //Read the PixelType and dimension of the reference image
39   int Dimension;
40   std::string PixelType;
41   clitk::ReadImageDimensionAndPixelType(m_ArgsInfo.reference_arg, Dimension, PixelType);
42   if (Dimension == 2) UpdateWithDim<2>(PixelType);
43   else if (Dimension == 3) UpdateWithDim<3>(PixelType);
44   else {
45     itkExceptionMacro(<< "Reference Image dimension is " << Dimension
46                       << " but I can only work on 2D and 3D images.");
47   }
48 }
49
50 //void AffineRegistrationGenericFilter::SetTransfo( itk::MultiResolutionImageRegistrationMethod<itk::Image<float,2>,itk::Image<float,2> >::Pointer & registration  )
51 //{
52 //  typedef itk::Euler2DTransform < double > Transform2DType;
53 //  Transform2DType::Pointer t2 =Transform2DType::New();
54 //
55 //  //Initializing the transform
56 //  Transform2DType::OutputVectorType translation;
57 //  translation[0] = m_ArgsInfo.transX_arg;
58 //  translation[1] = m_ArgsInfo.transY_arg;
59 //  t2->SetTranslation(translation);
60 //  t2->SetRotation(m_ArgsInfo.rotX_arg);
61 //
62 //  //For simplicity we set the center to the top left corner
63 //  Transform2DType::InputPointType center;
64 //  center[0] = 0.;
65 //  center[1] = 0.;
66 //  t2->SetCenter(center);
67 //  registration->SetTransform(t2);
68 //  registration->SetInitialTransformParameters(t2->GetParameters());
69 //}
70
71 //void clitk::AffineRegistrationGenericFilter::SetTransfo( itk::MultiResolutionImageRegistrationMethod<itk::Image<float,3>,itk::Image<float,3> >::Pointer & registration )
72 //{
73 //  typedef itk::Euler3DTransform < double > Transform3DType;
74 //  Transform3DType::Pointer t3 = Transform3DType::New();
75 //
76 //  t3->SetComputeZYX(true);
77 //  //Initializing the transform
78 //  Transform3DType::OutputVectorType translation;
79 //  translation[0] = m_ArgsInfo.transX_arg;
80 //  translation[1] = m_ArgsInfo.transY_arg;
81 //  translation[2] = m_ArgsInfo.transZ_arg;
82 //  t3->SetTranslation(translation);
83 //  t3->SetRotation(m_ArgsInfo.rotX_arg, m_ArgsInfo.rotY_arg, m_ArgsInfo.rotZ_arg);
84 //
85 //  //For simplicity we set the center to the top left corner
86 //  Transform3DType::InputPointType center;
87 //  center[0] = 0.;
88 //  center[1] = 0.;
89 //  center[2] = 0.;
90 //  t3->SetCenter(center);
91 //  registration->SetTransform(t3);
92 //  registration->SetInitialTransformParameters( t3->GetParameters());
93 //}
94
95 }
96 //====================================================================
97
98 #endif  //#define CLITKAFFINEREGISTRATIONCGENERICFILTER_CXX