From: David Sarrut Date: Wed, 27 Jul 2011 09:44:13 +0000 (+0200) Subject: Replace ListOfROI (vector) by MapOfROI to avoid ambiguity between the ROI number... X-Git-Tag: v1.3.0~260 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=ccee1e1e6ab4c196c850a28e000677b361f0c856;p=clitk.git Replace ListOfROI (vector) by MapOfROI to avoid ambiguity between the ROI number and the index. Remplace GetROI with GetROIFromROINumber --- diff --git a/tools/clitkDicomRTStruct2Image.cxx b/tools/clitkDicomRTStruct2Image.cxx index 228ca0b..cc23126 100644 --- a/tools/clitkDicomRTStruct2Image.cxx +++ b/tools/clitkDicomRTStruct2Image.cxx @@ -39,11 +39,35 @@ int main(int argc, char * argv[]) { filter.SetCropMaskEnabled(args_info.crop_flag); filter.SetImageFilename(args_info.image_arg); // Used to get spacing + origin if (args_info.roi_arg != -1) { - filter.SetROI(s->GetROI(args_info.roi_arg)); + filter.SetROI(s->GetROIFromROINumber(args_info.roi_arg)); filter.SetOutputImageFilename(args_info.output_arg); filter.Update(); } else { + clitk::DicomRT_StructureSet::ROIConstIteratorType iter; + for(iter = s->GetROIs().begin(); iter != s->GetROIs().end(); iter++) { + clitk::DicomRT_ROI::Pointer roi = iter->second; + // Create the filter + clitk::DicomRTStruct2ImageFilter filter; + filter.SetCropMaskEnabled(args_info.crop_flag); + filter.SetImageFilename(args_info.image_arg); // Used to get spacing + origin + std::string name = roi->GetName(); + int num = roi->GetROINumber(); + filter.SetROI(roi); + 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"); + if (args_info.verbose_flag) { + std::cout << num << " " << roi->GetName() << " num=" << num << " : " << n << std::endl; + } + filter.SetOutputImageFilename(n); + filter.Update(); + } + + /* for(unsigned int i=0; iGetListOfROI().size(); i++) { clitk::DicomRTStruct2ImageFilter filter; filter.SetCropMaskEnabled(args_info.crop_flag); @@ -62,7 +86,7 @@ int main(int argc, char * argv[]) { } filter.SetOutputImageFilename(n); filter.Update(); - } + }*/ } // This is the end my friend