]> Creatis software - clitk.git/commitdiff
added initial image centralization to BLUTDIR
authorRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Tue, 28 Feb 2012 09:47:09 +0000 (10:47 +0100)
committerRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Tue, 28 Feb 2012 09:47:09 +0000 (10:47 +0100)
registration/clitkBLUTDIRGenericFilter.cxx

index ca10c2d04d4fc4adc52e035d160b66843808a663..9f808e7e1ffa24b8126457acf3ea72894e44704e 100644 (file)
@@ -29,7 +29,8 @@ It is distributed under dual licence
 
 #include "clitkBLUTDIRGenericFilter.h"
 #include "clitkBLUTDIRCommandIterationUpdateDVF.h"
-
+#include "itkCenteredTransformInitializer.h"
+  
 namespace clitk
 {
 
@@ -495,6 +496,20 @@ namespace clitk
         itk::Vector<double,3> finalTranslation = clitk::GetTranslationPartMatrix3D(rigidTransformMatrix);
         rigidTransform->SetTranslation(finalTranslation);
       }
+      else
+      {
+        if(m_Verbose) std::cout<<"No itinial matrix given. Centering all images..."<<std::endl;
+        
+        rigidTransform=RigidTransformType::New();
+        
+        typedef itk::CenteredTransformInitializer<RigidTransformType, FixedImageType, MovingImageType > TransformInitializerType;
+        typename TransformInitializerType::Pointer initializer = TransformInitializerType::New();
+        initializer->SetTransform( rigidTransform );
+        initializer->SetFixedImage( fixedImage );
+        initializer->SetMovingImage( movingImage );        
+        initializer->GeometryOn();
+        initializer->InitializeTransform();
+      }
 
 
       //=======================================================