]> Creatis software - clitk.git/blob - vv/vvMesh.h
removed headers
[clitk.git] / vv / vvMesh.h
1 #ifndef vvMesh_h
2 #define vvMesh_h
3 #include <string>
4 #include <utility>
5 #include <vector>
6
7 #include <itkObjectFactory.h>
8
9 #include "vvImage.h"
10
11 class vtkPolyData;
12 class vtkImageData;
13
14 /** A vvMesh is assumed to be either a 3D closed surface 
15  *  or a series of surfaces 
16  *  It uses a dual representation: both binary mask and mesh**/
17 class vvMesh : public itk::LightObject
18 {
19 public:
20     typedef vvMesh Self;
21     typedef itk::SmartPointer<Self> Pointer;
22     itkNewMacro(Self);
23
24     void ReadFromVTK(const char * filename);
25     std::string structure_name;
26     ///Contour color, [0,1]
27     double r,g,b;
28
29     vtkPolyData* GetMesh(unsigned int i) const {return meshes[i];}
30     void AddMesh(vtkPolyData* p);
31     ///Removes all meshes in the object
32     void RemoveMeshes();
33     unsigned int GetNumberOfMeshes() { return meshes.size(); }
34
35     vtkImageData* GetMask(unsigned int i) const {return masks[i];}
36     void AddMask(vtkImageData* im);
37     void RemoveMasks();
38     unsigned int GetNumberOfMasks() { return masks.size(); }
39
40     ///Pretty-print information about the mesh
41     void Print() const;
42     ///Copies the meta-informations from another mesh
43     void CopyInformation(vvMesh::Pointer input);
44     void SetSpacing(double spacing) {slice_spacing=spacing;}
45     double GetSpacing() {return slice_spacing;}
46     ///Recompute the meshes from the masks
47     void ComputeMeshes();
48     /**Recompute the masks from the meshes.
49      * extrude means that the mesh must be extruded before binarizing,
50      * which is useful when creating a mesh from a stack of slices */
51     void ComputeMasks(vtkImageData* sample,bool extrude=false);
52     ///Create a new vvMesh by propagating the mesh with a displacement VF
53     void propagateContour(vvImage::Pointer vf);
54 protected:
55     ///The spacing between the planar contour, assumed to be constant
56     double slice_spacing;
57     std::vector<vtkPolyData *> meshes;
58     std::vector<vtkImageData *> masks;
59
60     vvMesh();
61     ~vvMesh();
62 };
63
64 ///Propagate a contour using a vector of motion fields, returns a 4D contour
65
66 #endif