]> Creatis software - clitk.git/blob - vv/vvLandmarks.h
Debug RTStruct conversion with empty struc
[clitk.git] / vv / vvLandmarks.h
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 vvLandmarks_h
19 #define vvLandmarks_h
20 #include <iostream>
21 #include <vector>
22
23 #include "vtkFloatArray.h"
24 #include "vtkPolyData.h"
25 #include "vtkPoints.h"
26 #include "vvLandmarksGlyph.h"
27 #include "vtkStringArray.h"
28 #include <vtkAbstractTransform.h>
29
30 //typedef
31 struct vvLandmark {
32     float coordinates[4];
33     std::string comments;
34     double pixel_value;
35 };
36
37 class vvLandmarks
38 {
39 public :
40     vvLandmarks(int size);
41     ~vvLandmarks();
42
43     bool LoadFile(std::vector<std::string> filename);
44     void SaveFile(std::string filename);
45
46     void AddLandmark(float x,float y,float z,float t,double value);
47     void TransformUpdate(vtkAbstractTransform* transform);
48     void RemoveLastLandmark();
49     void RemoveLandmarkWithLabel(vtkStdString, int);
50     void RemoveLandmark(int index);
51     void RemoveAll();
52     
53     void ChangeComments(int index, std::string comments);
54     float* GetCoordinates(int index);
55     double GetPixelValue(int index);
56     std::string GetComments(int index);
57     vtkStringArray* GetLabels() { return mLabels[mTime]; }
58     unsigned int GetNumberOfPoints() { return (unsigned int) mLandmarks[mTime].size(); }
59     //int GetNumberOfSources(){return mText.size();}
60
61     vtkPolyData* GetOutput() {
62         return mPolyData;
63     }
64     //vtkPolyData* GetSources(int i){return mText[i]->GetOutput();}
65     void SetTime(int time);
66     int GetTime() {return mTime; }
67
68     bool ErrorMsg(int num,const char * text);
69
70 private:
71     ///Helper function to tackle the use of the comma as the decimal separator
72     std::string replace_dots(std::string input);
73     
74     typedef std::vector<vvLandmark> LandmarkContainerType;
75     std::vector<LandmarkContainerType> mLandmarks;
76     std::vector<LandmarkContainerType> mLandmarksInitial;
77     
78     vtkPolyData *mPolyData;
79     std::vector<vtkPoints*> mPoints;
80     std::vector<vtkFloatArray*> mIds;
81     //std::vector<vvLandmarksGlyph*> mText;
82     std::vector<vtkStringArray*> mLabels;
83     std::vector<std::string> mFilenames;
84     int mFormatVersion;
85     int mTime;
86
87     bool LoadTxtFile(std::vector<std::string> filenames);
88     bool LoadPtsFile(std::vector<std::string> filenames);
89   
90 };
91
92 #endif