From: Vivien Delmon Date: Wed, 19 Oct 2011 09:25:51 +0000 (+0200) Subject: Add Extrude option to clitkMeshToBinaryImageFilter X-Git-Tag: v1.3.0~180^2~1 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=d778edf8022ef3c25aec6d4c38c07a671c40bf9b;p=clitk.git Add Extrude option to clitkMeshToBinaryImageFilter - Set default value to true for backward compatibility --- 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();