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