From d778edf8022ef3c25aec6d4c38c07a671c40bf9b Mon Sep 17 00:00:00 2001 From: Vivien Delmon Date: Wed, 19 Oct 2011 11:25:51 +0200 Subject: [PATCH] Add Extrude option to clitkMeshToBinaryImageFilter - Set default value to true for backward compatibility --- itk/clitkMeshToBinaryImageFilter.h | 4 ++++ itk/clitkMeshToBinaryImageFilter.txx | 17 +++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/itk/clitkMeshToBinaryImageFilter.h b/itk/clitkMeshToBinaryImageFilter.h index 86c6f0f..acecc38 100644 --- a/itk/clitkMeshToBinaryImageFilter.h +++ b/itk/clitkMeshToBinaryImageFilter.h @@ -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 m_Mesh; diff --git a/itk/clitkMeshToBinaryImageFilter.txx b/itk/clitkMeshToBinaryImageFilter.txx index be482f5..94424b8 100644 --- a/itk/clitkMeshToBinaryImageFilter.txx +++ b/itk/clitkMeshToBinaryImageFilter.txx @@ -30,7 +30,7 @@ //-------------------------------------------------------------------- template clitk::MeshToBinaryImageFilter:: -MeshToBinaryImageFilter():itk::ImageSource() +MeshToBinaryImageFilter() : itk::ImageSource(), m_Extrude(true) { } //-------------------------------------------------------------------- @@ -102,11 +102,16 @@ GenerateData() sts->SetInformationInput(binary_image); // Extrusion - vtkSmartPointer extrude=vtkSmartPointer::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 extrude=vtkSmartPointer::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 stencil=vtkSmartPointer::New(); -- 2.47.1