]> Creatis software - clitk.git/blobdiff - vv/vvMidPosition.cxx
Debug RTStruct conversion with empty struc
[clitk.git] / vv / vvMidPosition.cxx
index 8e715e7abc1d8fcadfef2337f945cf419593f641..ed5880b562fbc3c11e4ab9199a4eed14cc2e4332 100644 (file)
@@ -3,7 +3,7 @@
 
   Authors belong to:
   - University of LYON              http://www.universite-lyon.fr/
-  - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
 
   This software is distributed WITHOUT ANY WARRANTY; without even
 
   - BSD        See included LICENSE.txt file
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-======================================================================-====*/
+===========================================================================**/
 #include <QApplication>
 
 #include <itkWarpImageFilter.h>
+#if ( ITK_VERSION_MAJOR < 5 )
 #include <itkVectorResampleImageFilter.h>
+#else
+#include <itkResampleImageFilter.h>
+#endif
 
 #include "vvMidPosition.h"
 #include "clitkCommon.h"
@@ -95,8 +99,13 @@ vvImage::Pointer WarpRefImage(OutputVFType::Pointer vf,vvImage::Pointer image,in
 
   //We resample the VF because itk's warp filter doesn't like it when the vf and the image have
   //different spacings
+#if ( ITK_VERSION_MAJOR < 5 )
   typename itk::VectorResampleImageFilter<OutputVFType, OutputVFType >::Pointer
   resampler =itk::VectorResampleImageFilter<OutputVFType, OutputVFType >::New();
+#else
+  typename itk::ResampleImageFilter<OutputVFType, OutputVFType >::Pointer
+  resampler =itk::ResampleImageFilter<OutputVFType, OutputVFType >::New();
+#endif
   resampler->SetInput(vf);
   resampler->SetOutputSpacing(input->GetSpacing());
   resampler->SetOutputOrigin(vf->GetOrigin());
@@ -108,7 +117,7 @@ vvImage::Pointer WarpRefImage(OutputVFType::Pointer vf,vvImage::Pointer image,in
 
   typename FilterType::Pointer warp_filter = FilterType::New();
   warp_filter->SetInput(input);
-  warp_filter->SetDeformationField(resampler->GetOutput());
+  warp_filter->SetDisplacementField(resampler->GetOutput());
   warp_filter->SetOutputSpacing(input->GetSpacing());
   warp_filter->SetOutputOrigin(input->GetOrigin());
   warp_filter->SetOutputSize(input->GetLargestPossibleRegion().GetSize());
@@ -168,7 +177,8 @@ itk::Image<itk::Vector<float,3>,3>::Pointer AverageField(itk::Image<itk::Vector<
 
   // Average
   VFPixelType vector;
-  VFPixelType zeroVector=itk::NumericTraits<VFPixelType>::Zero;
+  VFPixelType zeroVector;//=itk::NumericTraits<VFPixelType>::Zero;
+  for(unsigned int i=0;i <VFPixelType::Dimension; i++) zeroVector[i] = 0.0;
 
   while (!(iterators[0]).IsAtEnd()) {
     vector=zeroVector;
@@ -190,4 +200,3 @@ void vvMidPosition::update_progress()
   p_bar.setValue(progress);
   p_bar.show();
 }
-