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 "clitkDicomRT_ROI_ConvertToImageFilter.h"
21 #include "clitkDicomRT_StructureSet.h"
22 #include "clitkDicomRTStruct2BinaryImage_ggo.h"
24 //--------------------------------------------------------------------
25 int main(int argc, char * argv[]) {
28 GGO(clitkDicomRTStruct2BinaryImage, 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 // s->Print(std::cout);
35 // New filter to convert to binary image
36 clitk::DicomRT_ROI_ConvertToImageFilter filter;
37 filter.SetCropMaskEnabled(args_info.crop_flag);
38 filter.SetImageFilename(args_info.image_arg); // Used to get spacing + origin
39 if (args_info.roi_arg != -1) {
40 filter.SetROI(s->GetROI(args_info.roi_arg));
41 filter.SetOutputImageFilename(args_info.output_arg);
45 for(unsigned int i=0; i<s->GetListOfROI().size(); i++) {
46 clitk::DicomRT_ROI_ConvertToImageFilter filter;
47 filter.SetCropMaskEnabled(args_info.crop_flag);
48 filter.SetImageFilename(args_info.image_arg); // Used to get spacing + origin
49 std::string name = s->GetListOfROI()[i]->GetName();
50 int num = s->GetListOfROI()[i]->GetROINumber();
51 filter.SetROI(s->GetListOfROI()[i]);
52 name.erase(remove_if(name.begin(), name.end(), isspace), name.end());
53 std::string n = std::string(args_info.output_arg).append
54 (clitk::toString(num)).append
58 if (args_info.verbose_flag) {
59 std::cout << i << " " << s->GetListOfROI()[i]->GetName() << " num=" << num << " : " << n << std::endl;
61 filter.SetOutputImageFilename(n);
66 // This is the end my friend