X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkDicomRTStruct2ImageFilter.cxx;h=2e11fdc42a6ccd2a3243d8f6598b74c52cddd534;hb=d55f025b18f68066a52b8f33c2dc6481e82c2580;hp=bf4d4c432d8649ba2c4c5566b356070cd708c535;hpb=c91252d780814d0d771464cdbce0f0a2cf94e891;p=clitk.git diff --git a/common/clitkDicomRTStruct2ImageFilter.cxx b/common/clitkDicomRTStruct2ImageFilter.cxx index bf4d4c4..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(); @@ -238,8 +260,6 @@ void clitk::DicomRTStruct2ImageFilter::Update() } } -std::cout << "origin " << origin[0] << " " << origin[1] << " " << origin[2] << std::endl; -std::cout << "extend " << extend[0] << " " << extend[1] << " " << extend[2] << std::endl; // Create new output image mBinaryImage = vtkSmartPointer::New(); #if VTK_MAJOR_VERSION <= 5