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; i<s->GetListOfROI().size(); i++) {
clitk::DicomRTStruct2ImageFilter filter;
filter.SetCropMaskEnabled(args_info.crop_flag);
}
filter.SetOutputImageFilename(n);
filter.Update();
- }
+ }*/
}
// This is the end my friend