]> Creatis software - clitk.git/blob - registration/clitkConvertPointList.cxx
changes in license header
[clitk.git] / registration / clitkConvertPointList.cxx
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to: 
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://www.centreleonberard.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18
19 /* =================================================
20  * @file   clitkConvertPointList.cxx
21  * @author 
22  * @date   
23  * 
24  * @brief 
25  * 
26  ===================================================*/
27
28
29 // clitk
30 #include "clitkConvertPointList_ggo.h"
31 #include "clitkIO.h"
32 #include "clitkImageCommon.h"
33 #include "clitkList.h"
34 #include "clitkLists.h"
35
36
37 //--------------------------------------------------------------------
38 int main(int argc, char * argv[]) {
39
40   // Init command line
41   GGO(clitkConvertPointList, args_info);
42   CLITK_INIT;
43
44   // List
45   typedef itk::Point<double, 3> PointType;
46   typedef clitk::List<PointType> ListType;
47   typedef clitk::Lists<PointType> ListsType;
48   ListType refList;
49   ListsType targetLists;
50
51   // Image 
52   typedef itk::Image<signed short, 3> ImageType; 
53   ImageType::Pointer referenceImage=clitk::readImage<ImageType>(args_info.refIm_arg, args_info.verbose_flag);
54   
55   // Filenames
56   std::vector< std::string> fileNames;
57   for(unsigned int i=0; i< args_info.lists_given; i++)
58     {
59       fileNames.push_back(args_info.lists_arg[i]);
60       if (args_info.verbose_flag) std::cout<<"Adding input point list "<<fileNames[i]<<std::endl;
61     }
62
63   // Read and convert
64   targetLists.ReadAndConvertPointPairs(fileNames, refList, referenceImage, args_info.verbose_flag );
65
66   // Write  
67   if (args_info.ref_given)  refList.Write(args_info.ref_arg, args_info.verbose_flag); 
68   if (args_info.targets_given ==  args_info.lists_given) 
69     {
70       // output filenames
71       std::vector<std::string> oFileNames;
72       for(unsigned int i=0; i< args_info.targets_given; i++)
73         oFileNames.push_back(args_info.targets_arg[i]);
74       targetLists.Write(oFileNames, args_info.verbose_flag); 
75     }
76   
77   return EXIT_SUCCESS;
78
79 }// end main
80
81 //--------------------------------------------------------------------