From 7d1671bb2465e849fd16e636b5cd07426f5879ba Mon Sep 17 00:00:00 2001 From: tbaudier Date: Fri, 8 Jul 2016 13:21:05 +0200 Subject: [PATCH] Add --mha tag in clitkDicomRTStruct2Image to allow structure with special characters in the name --- tools/clitkDicomRTStruct2Image.cxx | 20 +++++++++++++++----- tools/clitkDicomRTStruct2Image.ggo | 2 ++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/tools/clitkDicomRTStruct2Image.cxx b/tools/clitkDicomRTStruct2Image.cxx index 04564a0..302f65c 100644 --- a/tools/clitkDicomRTStruct2Image.cxx +++ b/tools/clitkDicomRTStruct2Image.cxx @@ -68,11 +68,21 @@ int main(int argc, char * argv[]) { filter.SetCropMaskEnabled(args_info.crop_flag); filter.SetImageFilename(args_info.image_arg); // Used to get spacing + origin name.erase(remove_if(name.begin(), name.end(), isspace), name.end()); - std::string n = std::string(args_info.output_arg).append - (clitk::toString(num)).append - ("_").append - (name).append - (".mhd"); + std::string n; + if (args_info.mha_flag) { + n = std::string(args_info.output_arg).append + (clitk::toString(num)).append + ("_").append + (name).append + (".mha"); + } + else { + n = std::string(args_info.output_arg).append + (clitk::toString(num)).append + ("_").append + (name).append + (".mhd"); + } if (args_info.verbose_flag) { std::cout << num << " " << roi->GetName() << " num=" << num << " : " << n << std::endl; } diff --git a/tools/clitkDicomRTStruct2Image.ggo b/tools/clitkDicomRTStruct2Image.ggo index 8a09da1..980f8a9 100644 --- a/tools/clitkDicomRTStruct2Image.ggo +++ b/tools/clitkDicomRTStruct2Image.ggo @@ -16,6 +16,8 @@ groupoption "roiNameSubstr" s "Substring of ROI name to binarize (reuturns a option "crop" c "Crop binary mask" flag off +option "mha" - "Write the RTStruct as a mha image to avoid special character problems" flag off + #option "roi" r "ROI to print (ID)" int no #option "contour" c "contour to print (ID)" int no #option "offset" o "to display points as image offsets" flag off -- 2.47.1