1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
3 Main authors : XX XX XX
6 - University of LYON http://www.universite-lyon.fr/
7 - Léon Bérard cancer center http://www.centreleonberard.fr
8 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the copyright notices for more information.
14 It is distributed under dual licence
15 - BSD http://www.opensource.org/licenses/bsd-license.php
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
18 =========================================================================*/
20 #include "clitkDicomRTStruct2ImageFilter.h"
21 #include "clitkDicomRT_StructureSet.h"
22 #include "clitkDicomRTStruct2Image_ggo.h"
24 //--------------------------------------------------------------------
25 int main(int argc, char * argv[]) {
28 GGO(clitkDicomRTStruct2Image, args_info);
30 // Read and display information
31 clitk::DicomRT_StructureSet::Pointer s = clitk::DicomRT_StructureSet::New();
32 s->Read(args_info.input_arg);
33 if (args_info.verboseFile_flag) {
37 // New filter to convert to binary image
38 clitk::DicomRTStruct2ImageFilter filter;
39 filter.SetCropMaskEnabled(args_info.crop_flag);
40 filter.SetImageFilename(args_info.image_arg); // Used to get spacing + origin
41 if (args_info.roi_arg != -1) {
42 filter.SetROI(s->GetROIFromROINumber(args_info.roi_arg));
43 filter.SetOutputImageFilename(args_info.output_arg);
47 clitk::DicomRT_StructureSet::ROIConstIteratorType iter;
48 for(iter = s->GetROIs().begin(); iter != s->GetROIs().end(); iter++) {
49 clitk::DicomRT_ROI::Pointer roi = iter->second;
51 clitk::DicomRTStruct2ImageFilter filter;
52 filter.SetCropMaskEnabled(args_info.crop_flag);
53 filter.SetImageFilename(args_info.image_arg); // Used to get spacing + origin
54 std::string name = roi->GetName();
55 int num = roi->GetROINumber();
57 name.erase(remove_if(name.begin(), name.end(), isspace), name.end());
58 std::string n = std::string(args_info.output_arg).append
59 (clitk::toString(num)).append
63 if (args_info.verbose_flag) {
64 std::cout << num << " " << roi->GetName() << " num=" << num << " : " << n << std::endl;
66 filter.SetOutputImageFilename(n);
71 for(unsigned int i=0; i<s->GetListOfROI().size(); i++) {
72 clitk::DicomRTStruct2ImageFilter filter;
73 filter.SetCropMaskEnabled(args_info.crop_flag);
74 filter.SetImageFilename(args_info.image_arg); // Used to get spacing + origin
75 std::string name = s->GetListOfROI()[i]->GetName();
76 int num = s->GetListOfROI()[i]->GetROINumber();
77 filter.SetROI(s->GetListOfROI()[i]);
78 name.erase(remove_if(name.begin(), name.end(), isspace), name.end());
79 std::string n = std::string(args_info.output_arg).append
80 (clitk::toString(num)).append
84 if (args_info.verbose_flag) {
85 std::cout << i << " " << s->GetListOfROI()[i]->GetName() << " num=" << num << " : " << n << std::endl;
87 filter.SetOutputImageFilename(n);
92 // This is the end my friend