itkSetMacro(LikeImage, ImagePointer);
itkGetConstMacro(LikeImage, ImagePointer);
+ itkSetMacro(Extrude, bool);
+ itkGetMacro(Extrude, bool);
+
protected:
MeshToBinaryImageFilter();
virtual ~MeshToBinaryImageFilter() {}
virtual void GenerateOutputInformation();
virtual void GenerateData();
+ bool m_Extrude;
ImagePointer m_LikeImage;
vtkSmartPointer<vtkPolyData> m_Mesh;
//--------------------------------------------------------------------
template <class ImageType>
clitk::MeshToBinaryImageFilter<ImageType>::
-MeshToBinaryImageFilter():itk::ImageSource<ImageType>()
+MeshToBinaryImageFilter() : itk::ImageSource<ImageType>(), m_Extrude(true)
{
}
//--------------------------------------------------------------------
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();