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 if (args_info.verboseFile_flag) {
37 // New filter to convert to binary image
38 clitk::DicomRT_ROI_ConvertToImageFilter 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->GetROI(args_info.roi_arg));
43 filter.SetOutputImageFilename(args_info.output_arg);
47 for(unsigned int i=0; i<s->GetListOfROI().size(); i++) {
48 clitk::DicomRT_ROI_ConvertToImageFilter filter;
49 filter.SetCropMaskEnabled(args_info.crop_flag);
50 filter.SetImageFilename(args_info.image_arg); // Used to get spacing + origin
51 std::string name = s->GetListOfROI()[i]->GetName();
52 int num = s->GetListOfROI()[i]->GetROINumber();
53 filter.SetROI(s->GetListOfROI()[i]);
54 name.erase(remove_if(name.begin(), name.end(), isspace), name.end());
55 std::string n = std::string(args_info.output_arg).append
56 (clitk::toString(num)).append
60 if (args_info.verbose_flag) {
61 std::cout << i << " " << s->GetListOfROI()[i]->GetName() << " num=" << num << " : " << n << std::endl;
63 filter.SetOutputImageFilename(n);
68 // This is the end my friend