]> Creatis software - clitk.git/blob - registration/clitkPointListWriter.txx
Debug RTStruct conversion with empty struc
[clitk.git] / registration / clitkPointListWriter.txx
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 #ifndef __clitkPointListWriter_txx
19 #define __clitkPointListWriter_txx
20 #include "clitkPointListWriter.h"
21
22 namespace clitk
23 {
24
25   template<unsigned int Dimension>
26   PointListWriter< Dimension >
27   ::PointListWriter()
28   {
29     
30   }
31
32   template<unsigned int Dimension>
33   void
34   PointListWriter< Dimension >
35   ::Write(const PointListType& list, const std::string& filename )
36   {
37     std::ofstream os;
38     openFileForWriting(os, filename);
39     
40     for (unsigned int pointIndex=0; pointIndex<list.size(); pointIndex++)
41       { 
42         os << list[pointIndex][0];
43         for (unsigned int dim=1; dim<Dimension; dim++)
44           os <<"\t"<< list[pointIndex][dim];
45         os<<std::endl;
46       }
47   }
48   
49   
50   template<unsigned int Dimension>
51   void
52   PointListWriter< Dimension >
53   ::Write(const DisplacementListType& list, const std::string& filename )
54   {
55     std::ofstream os;
56     openFileForWriting(os, filename);
57     
58     for (unsigned int pointIndex=0; pointIndex<list.size(); pointIndex++)
59       { 
60         os << list[pointIndex][0];
61         for (unsigned int dim=1; dim<Dimension; dim++)
62           os <<"\t"<< list[pointIndex][dim];
63         os<<std::endl;
64       }
65   }
66   
67   
68   template<unsigned int Dimension>
69   void 
70   PointListWriter< Dimension >
71   ::Write(const PointListsType& lists, char** filename)
72   {
73     for (unsigned int number =0; number<lists.size(); number++)
74       Write(lists[number],filename[number]);
75   }
76
77
78   template<unsigned int Dimension>
79   void 
80   PointListWriter< Dimension >
81   ::Write(const DisplacementListsType& lists, char** filename)
82   {
83     for (unsigned int number =0; number<lists.size(); number++)
84       Write(lists[number],filename[number]);
85   }
86
87
88 }// clitk
89
90 #endif // PointListWriter