]> Creatis software - clitk.git/commitdiff
Add Extrude option to clitkMeshToBinaryImageFilter
authorVivien Delmon <vivien.delmon@creatis.insa-lyon.fr>
Wed, 19 Oct 2011 09:25:51 +0000 (11:25 +0200)
committerVivien Delmon <vivien.delmon@creatis.insa-lyon.fr>
Wed, 19 Oct 2011 09:25:51 +0000 (11:25 +0200)
- Set default value to true for backward compatibility

itk/clitkMeshToBinaryImageFilter.h
itk/clitkMeshToBinaryImageFilter.txx

index 86c6f0f69b8925f04c22abac429ac21518915c36..acecc385558081696b5b5db039770c2edccbf313 100644 (file)
@@ -74,6 +74,9 @@ namespace clitk {
     itkSetMacro(LikeImage, ImagePointer);
     itkGetConstMacro(LikeImage, ImagePointer);
 
+    itkSetMacro(Extrude, bool);
+    itkGetMacro(Extrude, bool);
+
   protected:
     MeshToBinaryImageFilter();
     virtual ~MeshToBinaryImageFilter() {}
@@ -81,6 +84,7 @@ namespace clitk {
     virtual void GenerateOutputInformation();
     virtual void GenerateData();
 
+    bool m_Extrude;
     ImagePointer m_LikeImage;
     vtkSmartPointer<vtkPolyData> m_Mesh;
 
index be482f5232dc0320c61022943e4b2bc72e5d628e..94424b8631ca4e9fa7d7e1f3c4af3fbf90bf1d70 100644 (file)
@@ -30,7 +30,7 @@
 //--------------------------------------------------------------------
 template <class ImageType>
 clitk::MeshToBinaryImageFilter<ImageType>::
-MeshToBinaryImageFilter():itk::ImageSource<ImageType>()
+MeshToBinaryImageFilter() : itk::ImageSource<ImageType>(), m_Extrude(true)
 {
 }
 //--------------------------------------------------------------------
@@ -102,11 +102,16 @@ 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());
+  }
+  else
+    sts->SetInput(m_Mesh);
 
   // Stencil
   vtkSmartPointer<vtkImageStencil> stencil=vtkSmartPointer<vtkImageStencil>::New();