1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
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.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
24 #include <itkObjectFactory.h>
31 /** A vvMesh is assumed to be either a 3D closed surface
32 * or a series of surfaces
33 * It uses a dual representation: both binary mask and mesh**/
34 class vvMesh : public itk::LightObject
38 typedef itk::SmartPointer<Self> Pointer;
41 void ReadFromVTK(const char * filename);
42 std::string structure_name;
43 ///Contour color, [0,1]
46 vtkPolyData* GetMesh(unsigned int i) const {return meshes[i];}
47 void AddMesh(vtkPolyData* p);
48 ///Removes all meshes in the object
50 unsigned int GetNumberOfMeshes() { return (unsigned int)meshes.size(); }
52 vtkImageData* GetMask(unsigned int i) const {return masks[i];}
53 void AddMask(vtkImageData* im);
55 unsigned int GetNumberOfMasks() { return (unsigned int)masks.size(); }
57 ///Pretty-print information about the mesh
59 ///Copies the meta-informations from another mesh
60 void CopyInformation(vvMesh::Pointer input);
61 void SetSpacing(double spacing) {slice_spacing=spacing;}
62 double GetSpacing() {return slice_spacing;}
63 ///Recompute the meshes from the masks
65 /**Recompute the masks from the meshes.
66 * extrude means that the mesh must be extruded before binarizing,
67 * which is useful when creating a mesh from a stack of slices */
68 void ComputeMasks(vtkImageData* sample,bool extrude=false);
69 ///Create a new vvMesh by propagating the mesh with a displacement VF
70 void propagateContour(vvImage::Pointer vf);
72 ///The spacing between the planar contour, assumed to be constant
74 std::vector<vtkPolyData *> meshes;
75 std::vector<vtkImageData *> masks;
81 ///Propagate a contour using a vector of motion fields, returns a 4D contour