]> Creatis software - clitk.git/blobdiff - itk/clitkMeshToBinaryImageFilter.txx
Merge branch 'master' of git.creatis.insa-lyon.fr:clitk
[clitk.git] / itk / clitkMeshToBinaryImageFilter.txx
index db9897015b8b96d3f36f0a1d24336a8f6c4cdcd0..cd9a3bafbbc2a421b780a7f837df371429345b98 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
@@ -30,7 +30,7 @@
 //--------------------------------------------------------------------
 template <class ImageType>
 clitk::MeshToBinaryImageFilter<ImageType>::
-MeshToBinaryImageFilter():itk::ImageSource<ImageType>()
+MeshToBinaryImageFilter() : itk::ImageSource<ImageType>(), m_Extrude(true)
 {
 }
 //--------------------------------------------------------------------
@@ -102,11 +102,23 @@ GenerateData()
   sts->SetInformationInput(binary_image);
     
   // Extrusion
-  vtkSmartPointer<vtkLinearExtrusionFilter> extrude=vtkSmartPointer<vtkLinearExtrusionFilter>::New();
-  extrude->SetInput(m_Mesh);
-  // We extrude in the -slice_spacing direction to respect the FOCAL convention 
-  extrude->SetVector(0, 0, -m_LikeImage->GetSpacing()[2]);
-  sts->SetInput(extrude->GetOutput());
+  if (m_Extrude)
+  {
+    vtkSmartPointer<vtkLinearExtrusionFilter> extrude=vtkSmartPointer<vtkLinearExtrusionFilter>::New();
+    extrude->SetInput(m_Mesh);
+    // We extrude in the -slice_spacing direction to respect the FOCAL convention 
+    extrude->SetVector(0, 0, -m_LikeImage->GetSpacing()[2]);
+    sts->SetInput(extrude->GetOutput());
+    
+    // When extrude ScaleFactor indicate the extrusion scaling (default = 1)
+    /*
+      extrude->SetScaleFactor(m_LikeImage->GetSpacing()[2]/2.0);
+      DD(extrude->GetScaleFactor());
+      DD(extrude->GetCapping());
+    */ 
+  }
+  else
+    sts->SetInput(m_Mesh);
 
   // Stencil
   vtkSmartPointer<vtkImageStencil> stencil=vtkSmartPointer<vtkImageStencil>::New();
@@ -134,7 +146,7 @@ GenerateData()
   m_Exporter->SetInput( stencil->GetOutput() );
   m_Importer->Update();
 
-  writeImage<ImageType>(m_Importer->GetOutput(), "f.mhd");
+  // writeImage<ImageType>(m_Importer->GetOutput(), "f.mhd");
 
   this->SetNthOutput(0, m_Importer->GetOutput());