X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkDicomRTStruct2ImageFilter.cxx;h=2e11fdc42a6ccd2a3243d8f6598b74c52cddd534;hb=543b72e23ad001ac2a7743b9beacf48e2d0054ac;hp=86052170850c9a373294bb686574d60c94ce0d1f;hpb=f40a0478425afcc7cbb1df27a4fe44a84e3e9ac4;p=clitk.git diff --git a/common/clitkDicomRTStruct2ImageFilter.cxx b/common/clitkDicomRTStruct2ImageFilter.cxx index 8605217..2e11fdc 100644 --- a/common/clitkDicomRTStruct2ImageFilter.cxx +++ b/common/clitkDicomRTStruct2ImageFilter.cxx @@ -31,6 +31,7 @@ #include #include #include +#include //-------------------------------------------------------------------- @@ -38,6 +39,7 @@ clitk::DicomRTStruct2ImageFilter::DicomRTStruct2ImageFilter() { mROI = NULL; mWriteOutput = false; + mWriteMesh = false; mCropMask = true; } //-------------------------------------------------------------------- @@ -83,6 +85,14 @@ void clitk::DicomRTStruct2ImageFilter::SetCropMaskEnabled(bool b) //-------------------------------------------------------------------- +//-------------------------------------------------------------------- +void clitk::DicomRTStruct2ImageFilter::SetWriteMesh(bool b) +{ + mWriteMesh = b; +} +//-------------------------------------------------------------------- + + //-------------------------------------------------------------------- void clitk::DicomRTStruct2ImageFilter::SetOutputImageFilename(std::string s) { @@ -181,6 +191,18 @@ void clitk::DicomRTStruct2ImageFilter::Update() // Get Mesh vtkPolyData * mesh = mROI->GetMesh(); + if (mWriteMesh) { + vtkSmartPointer meshWriter = vtkSmartPointer::New(); + std::string vtkName = mOutputFilename; + vtkName += ".vtk"; + meshWriter->SetFileName(vtkName.c_str()); +#if VTK_MAJOR_VERSION <= 5 + meshWriter->SetInput(mesh); +#else + meshWriter->SetInputData(mesh); +#endif + meshWriter->Write(); + } // Get bounds double *bounds=mesh->GetBounds();