7 #include <itkObjectFactory.h>
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
21 typedef itk::SmartPointer<Self> Pointer;
24 void ReadFromVTK(const char * filename);
25 std::string structure_name;
26 ///Contour color, [0,1]
29 vtkPolyData* GetMesh(unsigned int i) const {return meshes[i];}
30 void AddMesh(vtkPolyData* p);
31 ///Removes all meshes in the object
33 unsigned int GetNumberOfMeshes() { return meshes.size(); }
35 vtkImageData* GetMask(unsigned int i) const {return masks[i];}
36 void AddMask(vtkImageData* im);
38 unsigned int GetNumberOfMasks() { return masks.size(); }
40 ///Pretty-print information about the mesh
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
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);
55 ///The spacing between the planar contour, assumed to be constant
57 std::vector<vtkPolyData *> meshes;
58 std::vector<vtkImageData *> masks;
64 ///Propagate a contour using a vector of motion fields, returns a 4D contour