/*========================================================================= Program: vv http://www.creatis.insa-lyon.fr/rio/vv Main authors : XX XX XX Authors belongs to: - University of LYON http://www.universite-lyon.fr/ - Léon Bérard cancer center http://www.centreleonberard.fr - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the copyright notices for more information. It is distributed under dual licence - BSD http://www.opensource.org/licenses/bsd-license.php - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html =========================================================================*/ #include "clitkDicomRT_ROI_ConvertToImageFilter.h" #include "clitkDicomRT_StructureSet.h" #include "clitkDicomRTStruct2BinaryImage_ggo.h" //-------------------------------------------------------------------- int main(int argc, char * argv[]) { // Init command line GGO(clitkDicomRTStruct2BinaryImage, args_info); // Read and display information clitk::DicomRT_StructureSet::Pointer s = clitk::DicomRT_StructureSet::New(); s->Read(args_info.input_arg); // s->Print(std::cout); // New filter to convert to binary image clitk::DicomRT_ROI_ConvertToImageFilter filter; 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.SetOutputImageFilename(args_info.output_arg); filter.Update(); } else { for(unsigned int i=0; iGetListOfROI().size(); i++) { clitk::DicomRT_ROI_ConvertToImageFilter filter; filter.SetCropMaskEnabled(args_info.crop_flag); filter.SetImageFilename(args_info.image_arg); // Used to get spacing + origin std::string name = s->GetListOfROI()[i]->GetName(); int num = s->GetListOfROI()[i]->GetROINumber(); filter.SetROI(s->GetListOfROI()[i]); 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 << i << " " << s->GetListOfROI()[i]->GetName() << " num=" << num << " : " << n << std::endl; } filter.SetOutputImageFilename(n); filter.Update(); } } // This is the end my friend return 0; }