From: dsarrut Date: Fri, 27 May 2011 09:23:18 +0000 (+0200) Subject: Correct extrusion (-spacing instead of spacing) X-Git-Tag: v1.3.0~338^2~5 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=b3ebccec24c23e77b6bade48e26af109aadabdc7;p=clitk.git Correct extrusion (-spacing instead of spacing) --- 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) {