]> Creatis software - clitk.git/blob - vv/vvMeshReader.h
Initial revision
[clitk.git] / vv / vvMeshReader.h
1 /*=========================================================================
2
3  Program:   vv
4  Language:  C++
5  Author :   Joel Schaerer (joel.schaerer@insa-lyon.fr)
6  Program:   vv
7
8 Copyright (C) 2008
9 Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
10 CREATIS-LRMN http://www.creatis.insa-lyon.fr
11
12 This program is free software: you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation, version 3 of the License.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
24 =========================================================================*/
25 #ifndef vvMeshReader_h
26 #define vvMeshReader_h
27
28 #include <QThread>
29
30 #include <string>
31
32 #include "vvImage.h"
33 #include "vvMesh.h"
34
35 class vvMeshReader : public QThread
36 {
37 public:
38     ///Returns the contour names present in a dc struct file
39     std::vector<std::pair<int,std::string> > GetROINames();
40
41     vvMeshReader();
42     void SetFilename(const std::string f) { filename=f; }
43     void SetModeToVTK() {vtk_mode=true;}
44     void SetSelectedItems(const std::vector<int> & items) {selected_contours=items;}
45     void SetImage(vvImage::Pointer im) {image=im;}
46     void SetPropagationVF(vvImage::Pointer vf) {this->vf=vf;}
47     std::vector<vvMesh::Pointer> GetOutput() {return result;}
48     ///Called from the main thread, runs the reader and displays the progress bar
49     void Update();
50
51 protected:
52     void run();
53     std::string filename;
54     ///Indicates if the reader should expect a vtk polydata file instead of a dicom-struct
55     bool vtk_mode;
56     ///The list of indexes of contours the reader should read
57     std::vector<int> selected_contours;
58     ///Image the mesh will be displayed over, for binarization
59     vvImage::Pointer image;
60     std::vector<vvMesh::Pointer> result;
61
62     ///Read a DC-struct file and return an extruded version of the contours
63     std::vector<vvMesh::Pointer> readSelectedContours();
64     ///Vector field used to propagate the contour
65     vvImage::Pointer vf;
66     ///Binarize the output of readSelectedContours() and mesh it with a Marching Cubes
67     void Remesh(vvMesh::Pointer roi);
68 };
69
70 #endif