]> Creatis software - clitk.git/blobdiff - segmentation/clitkFillMaskFilter.txx
COMP: itk4 compatibility
[clitk.git] / segmentation / clitkFillMaskFilter.txx
index 7ddda01b3f19f4a3cd4650741f5f010e01672cda..7d2369cdf9839eb317ed0ec26b747eca351e3855 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
@@ -14,7 +14,7 @@
 
   - BSD        See included LICENSE.txt file
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-  ======================================================================-====*/
+  ===========================================================================**/
 
 #ifndef CLITKFILLMASKFILTER_TXX
 #define CLITKFILLMASKFILTER_TXX
@@ -27,9 +27,6 @@ clitk::FillMaskFilter<ImageType>::FillMaskFilter():
   // Default global options
   this->SetNumberOfRequiredInputs(1);
   ResetDirections();
-  AddDirection(2);
-  AddDirection(1);
-  AddDirection(0);
 }
 //--------------------------------------------------------------------
 
@@ -108,7 +105,6 @@ GenerateData()
   //---------------------------------------- 
   typename InternalImageType::Pointer output = inputCaster->GetOutput();
   for (unsigned int i=0; i<m_Directions.size();i++) {
-    DD(i);
     //---------------------------------------- 
     // Fill the holes of a mask in 2D
     //----------------------------------------
@@ -145,6 +141,9 @@ GenerateData()
         start2D[m_Directions[i]]=sliceIndex;
         desiredRegion.SetIndex( start2D );
         extractFilter->SetExtractionRegion( desiredRegion );
+#if ITK_VERSION_MAJOR == 4
+        extractFilter->SetDirectionCollapseToSubmatrix();
+#endif
         extractFilter->Update( );
         typename ImageSliceType::Pointer slice= extractFilter->GetOutput();
         
@@ -196,7 +195,6 @@ GenerateData()
       }
     
     // Join to a 3D image      
-    std::cout<<"Joining the slices..."<<std::endl;
     joinFilter->Update();
     
     // Permute the axes to reset to orientation
@@ -229,17 +227,13 @@ GenerateData()
     output->SetOrigin(input->GetOrigin());
   }
   
-  writeImage<InternalImageType>(output, "toto.mhd");
-  
   // Cast
-  DD("cast");
   typedef itk::CastImageFilter<InternalImageType,ImageType> OutputCastImageFilterType;
   typename OutputCastImageFilterType::Pointer outputCaster =OutputCastImageFilterType::New();
   outputCaster->SetInput(output);
   outputCaster->Update();
   
   // Output
-  DD("Graft");
   this->GraftOutput(outputCaster->GetOutput());
 }
 //--------------------------------------------------------------------