From b3ebccec24c23e77b6bade48e26af109aadabdc7 Mon Sep 17 00:00:00 2001 From: dsarrut Date: Fri, 27 May 2011 11:23:18 +0200 Subject: [PATCH] Correct extrusion (-spacing instead of spacing) --- .../clitkDicomRT_ROI_ConvertToImageFilter.cxx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/common/clitkDicomRT_ROI_ConvertToImageFilter.cxx b/common/clitkDicomRT_ROI_ConvertToImageFilter.cxx index 07c7a95..64feebb 100644 --- a/common/clitkDicomRT_ROI_ConvertToImageFilter.cxx +++ b/common/clitkDicomRT_ROI_ConvertToImageFilter.cxx @@ -19,12 +19,18 @@ #include #include + +// clitk #include "clitkDicomRT_ROI_ConvertToImageFilter.h" +#include "clitkImageCommon.h" + +// vtk #include #include #include #include -#include "clitkImageCommon.h" +#include + //-------------------------------------------------------------------- clitk::DicomRT_ROI_ConvertToImageFilter::DicomRT_ROI_ConvertToImageFilter() @@ -121,11 +127,9 @@ void clitk::DicomRT_ROI_ConvertToImageFilter::Update() std::cerr << "Error. Please provide image info (spacing/origin) with SetImageFilename" << std::endl; exit(0); } - // DD("Update"); // Get Mesh vtkPolyData * mesh = mROI->GetMesh(); - DD(mesh->GetNumberOfCells()); // Get bounds double *bounds=mesh->GetBounds(); @@ -176,7 +180,8 @@ void clitk::DicomRT_ROI_ConvertToImageFilter::Update() // Extrude vtkSmartPointer extrude=vtkSmartPointer::New(); extrude->SetInput(mesh); - extrude->SetVector(0, 0, mROI->GetContourSpacing()); + ///We extrude in the -slice_spacing direction to respect the FOCAL convention (NEEDED !) + extrude->SetVector(0, 0, -mSpacing[2]); // Binarization vtkSmartPointer sts=vtkSmartPointer::New(); @@ -192,6 +197,12 @@ void clitk::DicomRT_ROI_ConvertToImageFilter::Update() stencil->SetInput(mBinaryImage); stencil->ReverseStencilOn(); stencil->Update(); + + vtkSmartPointer w = vtkSmartPointer::New(); + w->SetInput(stencil->GetOutput()); + w->SetFileName("binary2.mhd"); + w->Write(); + mBinaryImage->ShallowCopy(stencil->GetOutput()); if (mWriteOutput) { -- 2.47.1