aimsdata  5.1.2
Neuroimaging data handling
cutmesh.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 #ifndef AIMS_MESH_CUTMESH_H
35 #define AIMS_MESH_CUTMESH_H
36 
37 #include <aims/mesh/surface.h>
38 #include <aims/mesh/texture.h>
39 #include <vector>
40 
41 namespace aims
42 {
43 
59  class CutMesh
60  {
61  public:
62  CutMesh( const AimsSurfaceTriangle & insurf, const Point4df & plane );
63  CutMesh( const std::vector<const AimsSurfaceTriangle *> & insurf,
64  const Point4df & plane );
65  virtual ~CutMesh();
66 
68  void cut( bool buildborderline = true, bool meshplane = false,
69  bool checkplane = true );
71  void cutBorder( int timestep = 0 );
72 
74  std::vector<carto::rc_ptr<AimsSurfaceTriangle> > cutMeshes() const
75  { return _cut; }
78  { return _borderline; }
81  { return _planemesh; }
82 
83  protected:
84  virtual void initializeOutputTextures() {}
87  virtual void addTexturePoint( int /* mesh */, uint /* v */ ) {}
90  virtual void addTextureInterpolPoint( int /* mesh */, uint /* v */, float /* w1 */,
91  uint /* w */, float /* w2 */ )
92  {}
93 
94  std::vector<const AimsSurfaceTriangle *> _insurf;
95  std::vector<carto::rc_ptr<AimsSurfaceTriangle> > _insurfrc;
97 
98  std::vector<carto::rc_ptr<AimsSurfaceTriangle> > _cut;
101  };
102 
103 
107  template <typename T>
108  class CutTexturedMesh : public CutMesh
109  {
110  public:
111  CutTexturedMesh( const std::vector<const AimsSurfaceTriangle *> & insurf,
112  const std::vector<std::vector<const TimeTexture<T> *> >
113  & intex,
114  const Point4df & plane );
115  CutTexturedMesh( const std::vector<const AimsSurfaceTriangle *> & insurf,
116  const std::vector<std::vector<
117  carto::rc_ptr<TimeTexture<T> > > > & intex,
118  const Point4df & plane );
119  virtual ~CutTexturedMesh();
120 
121  void setTextures(
122  const std::vector<std::vector<carto::rc_ptr<TimeTexture<T> > > >
123  & intex );
124  void setTextures(
125  const std::vector<std::vector<const TimeTexture<T> *> > & intex );
126 
128  std::vector<std::vector<carto::rc_ptr<TimeTexture<T> > > >
129  cutTextures() const
130  { return _cuttex; }
131 
132  protected:
133  virtual void initializeOutputTextures();
134  virtual void addTexturePoint( int mesh, uint v );
135  virtual void addTextureInterpolPoint( int mesh, uint v, float w1,
136  uint w, float w2 );
137 
138  private:
139  std::vector<std::vector<const TimeTexture<T> *> > _intex;
140  std::vector<std::vector<carto::rc_ptr<TimeTexture<T> > > > _intexrc;
141 
142  std::vector<std::vector<carto::rc_ptr<TimeTexture<T> > > > _cuttex;
143  };
144 
145 }
146 
147 #endif
148 
Cut meshes by a plane.
Definition: cutmesh.h:60
std::vector< carto::rc_ptr< AimsSurfaceTriangle > > _cut
Definition: cutmesh.h:98
std::vector< carto::rc_ptr< AimsSurfaceTriangle > > cutMeshes() const
get output
Definition: cutmesh.h:74
void cutBorder(int timestep=0)
build border line mesh only
carto::rc_ptr< AimsSurfaceTriangle > planeMesh() const
get output
Definition: cutmesh.h:80
carto::rc_ptr< AimsSurfaceTriangle > _planemesh
Definition: cutmesh.h:100
carto::rc_ptr< AimsTimeSurface< 2, Void > > _borderline
Definition: cutmesh.h:99
CutMesh(const AimsSurfaceTriangle &insurf, const Point4df &plane)
void cut(bool buildborderline=true, bool meshplane=false, bool checkplane=true)
Perform calculations.
Point4df _plane
Definition: cutmesh.h:96
std::vector< carto::rc_ptr< AimsSurfaceTriangle > > _insurfrc
Definition: cutmesh.h:95
CutMesh(const std::vector< const AimsSurfaceTriangle * > &insurf, const Point4df &plane)
virtual ~CutMesh()
virtual void addTextureInterpolPoint(int, uint, float, uint, float)
this callback is called to handle textures: add tex corresponding to an interpolation between two ver...
Definition: cutmesh.h:90
virtual void addTexturePoint(int, uint)
this callback is called to handle textures: add tex corresponding to a vertex in the given mesh
Definition: cutmesh.h:87
carto::rc_ptr< AimsTimeSurface< 2, Void > > borderLine() const
get output
Definition: cutmesh.h:77
std::vector< const AimsSurfaceTriangle * > _insurf
Definition: cutmesh.h:94
virtual void initializeOutputTextures()
Definition: cutmesh.h:84
Textured variant of CutMesh.
Definition: cutmesh.h:109
virtual ~CutTexturedMesh()
Definition: cutmesh_d.h:65
void setTextures(const std::vector< std::vector< carto::rc_ptr< TimeTexture< T > > > > &intex)
Definition: cutmesh_d.h:71
virtual void addTextureInterpolPoint(int mesh, uint v, float w1, uint w, float w2)
this callback is called to handle textures: add tex corresponding to an interpolation between two ver...
Definition: cutmesh_d.h:186
virtual void initializeOutputTextures()
Definition: cutmesh_d.h:101
std::vector< std::vector< carto::rc_ptr< TimeTexture< T > > > > cutTextures() const
get output
Definition: cutmesh.h:129
virtual void addTexturePoint(int mesh, uint v)
this callback is called to handle textures: add tex corresponding to a vertex in the given mesh
Definition: cutmesh_d.h:116
CutTexturedMesh(const std::vector< const AimsSurfaceTriangle * > &insurf, const std::vector< std::vector< const TimeTexture< T > * > > &intex, const Point4df &plane)
Definition: cutmesh_d.h:44
The class for EcatSino data write operation.
Definition: borderfiller.h:13
AIMSDATA_API AimsTimeSurface< 3, Void > AimsSurfaceTriangle
Definition: surface.h:581
unsigned int uint