]> Creatis software - clitk.git/blob - vv/vvMeshReader.h
Debug RTStruct conversion with empty struc
[clitk.git] / vv / vvMeshReader.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 vvMeshReader_h
19 #define vvMeshReader_h
20 #include <QThread>
21
22 #include <string>
23
24 #include "vvImage.h"
25 #include "vvMesh.h"
26
27 class vvMeshReader : public QThread
28 {
29 public:
30     ///Returns the contour names present in a dc struct file
31     std::vector<std::pair<int,std::string> > GetROINames();
32
33     vvMeshReader();
34     void SetFilename(const std::string f) { filename=f; }
35     void SetModeToVTK() {vtk_mode=true;}
36     void SetSelectedItems(const std::vector<int> & items) {selected_contours=items;}
37     void SetImage(vvImage::Pointer im) {image=im;}
38     void SetPropagationVF(vvImage::Pointer vf) {this->vf=vf;}
39     std::vector<vvMesh::Pointer> GetOutput() {return result;}
40     ///Called from the main thread, runs the reader and displays the progress bar
41     void Update();
42
43 protected:
44     void run();
45     std::string filename;
46     ///Indicates if the reader should expect a vtk polydata file instead of a dicom-struct
47     bool vtk_mode;
48     ///The list of indexes of contours the reader should read
49     std::vector<int> selected_contours;
50     ///Image the mesh will be displayed over, for binarization
51     vvImage::Pointer image;
52     std::vector<vvMesh::Pointer> result;
53
54     ///Read a DC-struct file and return an extruded version of the contours
55     std::vector<vvMesh::Pointer> readSelectedContours();
56     ///Vector field used to propagate the contour
57     vvImage::Pointer vf;
58     ///Binarize the output of readSelectedContours() and mesh it with a Marching Cubes
59     void Remesh(vvMesh::Pointer roi);
60 };
61
62 #endif