]> Creatis software - clitk.git/commitdiff
Merge branch 'master' of git.creatis.insa-lyon.fr:clitk
authorRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Thu, 17 Jan 2013 08:19:36 +0000 (09:19 +0100)
committerRomulo Pinho <romulo.pinho@lyon.unicancer.fr>
Thu, 17 Jan 2013 08:19:36 +0000 (09:19 +0100)
common/vvImageReader.txx
registration/clitkAffineRegistrationGenericFilter.cxx
registration/clitkBLUTDIRGenericFilter.cxx
tools/clitkImageToVectorImageGenericFilter.h
tools/clitkImageToVectorImageGenericFilter.txx
vv/vvSlicer.cxx

index 9b0e21ae6c17f8fd498008272c53fa84a9aaaa5c..3ef04c6e0487f9b6bcec51e294e4f3075a6032e0 100644 (file)
@@ -23,7 +23,6 @@
 #include <itkImageFileReader.h>
 #include <itkImageSeriesReader.h>
 #include <itkImageToVTKImageFilter.h>
-#include <itkAnalyzeImageIO.h>
 #include <itkFlexibleVectorCastImageFilter.h>
 
 #include <vtkTransform.h>
@@ -73,8 +72,6 @@ void vvImageReader::UpdateWithDim(std::string InputPixelType)
 template<class InputPixelType, unsigned int VImageDimension>
 void vvImageReader::UpdateWithDimAndInputPixelType()
 {
-  itk::AnalyzeImageIO *analyzeImageIO = NULL;
-
   if (mType == MERGEDWITHTIME)   // In this case we can load the images
     // one at the time to avoid excessive
     // memory use
@@ -97,7 +94,6 @@ void vvImageReader::UpdateWithDimAndInputPixelType()
         mLastError = error.str();
         return;
       }
-      analyzeImageIO = dynamic_cast<itk::AnalyzeImageIO*>( reader->GetImageIO() );
     }
   } else if (mType == SLICED) {
     mImage=vvImage::New();
@@ -134,7 +130,6 @@ void vvImageReader::UpdateWithDimAndInputPixelType()
                 << "(slice #" << mSlice << ") " << err << std::endl;
       return;
     }
-    analyzeImageIO = dynamic_cast<itk::AnalyzeImageIO*>( reader->GetImageIO() );
   } else {
     if (mInputFilenames.size() > 1) {
       typedef itk::Image< InputPixelType, VImageDimension > InputImageType;
@@ -177,23 +172,6 @@ void vvImageReader::UpdateWithDimAndInputPixelType()
         mLastError = error.str();
         return;
       }
-      analyzeImageIO = dynamic_cast<itk::AnalyzeImageIO*>( reader->GetImageIO() );
-    }
-  }
-
-  // For unknown analyze orientations, we set identity
-  if(analyzeImageIO) {
-    const double m[16] = {1.,0.,0.,0.,
-                          0.,0.,1.,0.,
-                          0.,-1.,0.,0.,
-                          0.,0.,0.,1.};
-    // TODO SR and BP: check on the list of transforms and not the first only
-    int i;
-    for(i=0; i<16 && m[i]==mImage->GetTransform()[0]->GetMatrix()->GetElement(i%4, i/4); i++);
-    if(i==16) {
-      itkWarningMacro(<< "Analyze image file format detected with unknown orientation. "
-                      << "Forcing identity orientation, use other file format if not ok.");
-      mImage->GetTransform()[0]->Identity();
     }
   }
 }
@@ -203,8 +181,6 @@ void vvImageReader::UpdateWithDimAndInputPixelType()
 template<class InputPixelType, unsigned int VImageDimension>
 void vvImageReader::UpdateWithDimAndInputVectorPixelType()
 {
-  itk::AnalyzeImageIO *analyzeImageIO = NULL;
-
   typedef itk::Image< InputPixelType, VImageDimension > InputImageType;
   typename InputImageType::Pointer input;
 
@@ -239,7 +215,6 @@ void vvImageReader::UpdateWithDimAndInputVectorPixelType()
       mLastError = error.str();
       return;
     }
-    analyzeImageIO = dynamic_cast<itk::AnalyzeImageIO*>( reader->GetImageIO() );
   }
   
   typedef itk::Image< itk::Vector<float , 3>, VImageDimension > VectorImageType;
@@ -251,24 +226,6 @@ void vvImageReader::UpdateWithDimAndInputVectorPixelType()
   casted_input = caster->GetOutput();
   
   mImage = vvImageFromITK<VImageDimension, itk::Vector<float, 3> >(casted_input, mType == IMAGEWITHTIME || mType == VECTORFIELDWITHTIME);
-
-  // For unknown analyze orientations, we set identity
-  if (analyzeImageIO)
-  {
-    const double m[16] = {1.,0.,0.,0.,
-                          0.,0.,1.,0.,
-                          0.,-1.,0.,0.,
-                          0.,0.,0.,1.};
-    int i;
-    for (i = 0; i < 16 && m[i] == mImage->GetTransform()[0]->GetMatrix()->GetElement(i % 4, i / 4); i++)
-      ;
-    if (i == 16)
-    {
-      itkWarningMacro(<< "Analyze image file format detected with unknown orientation. "
-                      << "Forcing identity orientation, use other file format if not ok.");
-      mImage->GetTransform()[0]->Identity();
-    }
-  }
 }
 //----------------------------------------------------------------------------
 
index 3f0145eca9d10064044db55d8908f4aebc458633..6b0ecffbfdba87541e128945fceae0b13a0fcd5d 100644 (file)
@@ -541,7 +541,11 @@ void AffineRegistrationGenericFilter::UpdateWithInputImageType()
   if (m_Verbose) std::cout << "Starting the registration now..." << std::endl;
 
   try {
+#if ITK_VERSION_MAJOR < 4 || (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR <= 2)
     registration->StartRegistration();
+#else
+    registration->Update();
+#endif
   } catch ( itk::ExceptionObject & err ) {
     std::cerr << "ExceptionObject caught !" << std::endl;
     std::cerr << err << std::endl;
index 06045c52defc3a3774844c2bd30334cb4add04a1..c786eeb59dedbd6e1c50d48799e632af63dd126f 100644 (file)
@@ -733,7 +733,11 @@ namespace clitk
 
       try
       {
+#if ITK_VERSION_MAJOR < 4 || (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR <= 2)
         registration->StartRegistration();
+#else
+        registration->Update();
+#endif
       }
       catch( itk::ExceptionObject & err )
       {
index 546ae96a81ace35b426d157db02bc9d70aa231c2..726186db75646fff5f516a864db4bc494cb16689 100644 (file)
@@ -36,7 +36,6 @@
 
 //itk include
 #include "itkLightObject.h"
-#include "itkCompose3DVectorImageFilter.h"
 
 namespace clitk 
 {
index b26863ed731232bc81edd23808c12ba27d385bb2..8bbeab86ab3bc53853ce0554dc247edaeb44e3c8 100644 (file)
  * @brief 
  * 
  ===================================================*/
-
+#if ITK_VERSION_MAJOR < 4 || (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR <= 2)
+# include "itkCompose3DVectorImageFilter.h"
+#else
+# include "itkComposeImageFilter.h"
+#endif
 
 namespace clitk
 {
@@ -78,7 +82,11 @@ namespace clitk
     typedef itk::Image<itk::Vector<PixelType,3>, Dimension> OutputImageType;
     
     // Filter
+#if ITK_VERSION_MAJOR < 4 || (ITK_VERSION_MAJOR == 4 && ITK_VERSION_MINOR <= 2)
     typedef itk::Compose3DVectorImageFilter<InputImageType,OutputImageType> ComposeFilterType;
+#else
+    typedef itk::ComposeImageFilter<InputImageType,OutputImageType> ComposeFilterType;
+#endif
     typename ComposeFilterType::Pointer composeFilter=ComposeFilterType::New();
 
     // Read the inputs
index 1e1245f425b787523aeb69d7e9cf87c7086c851d..fd5240b29f06ad5931646559a3c7d9760cdb98b5 100644 (file)
@@ -1396,12 +1396,12 @@ void vvSlicer::Render()
     double yCursor = (y - this->GetInput()->GetOrigin()[1])/this->GetInput()->GetSpacing()[1];
     double zCursor = (z - this->GetInput()->GetOrigin()[2])/this->GetInput()->GetSpacing()[2];
 
-    if (xCursor >= this->GetImageActor()->GetDisplayExtent()[0] &&
-        xCursor < this->GetImageActor()->GetDisplayExtent()[1]+1 &&
-        yCursor >= this->GetImageActor()->GetDisplayExtent()[2] &&
-        yCursor < this->GetImageActor()->GetDisplayExtent()[3]+1 &&
-        zCursor >= this->GetImageActor()->GetDisplayExtent()[4] &&
-        zCursor < this->GetImageActor()->GetDisplayExtent()[5]+1 ) {
+    if (xCursor >= this->GetImageActor()->GetDisplayExtent()[0]-0.5 &&
+        xCursor < this->GetImageActor()->GetDisplayExtent()[1]+0.5 &&
+        yCursor >= this->GetImageActor()->GetDisplayExtent()[2]-0.5 &&
+        yCursor < this->GetImageActor()->GetDisplayExtent()[3]+0.5 &&
+        zCursor >= this->GetImageActor()->GetDisplayExtent()[4]-0.5 &&
+        zCursor < this->GetImageActor()->GetDisplayExtent()[5]+0.5 ) {
       vtkRenderer * renderer = this->Renderer;
 
       renderer->WorldToView(x,y,z);