aimsdata 6.0.0
Neuroimaging data handling
mesh_rasterization_d.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_SURFACE_MESHRASTERIZATION_D_H
35#define AIMS_SURFACE_MESHRASTERIZATION_D_H
36
38#include <cartodata/volume/volume.h>
39#include <aims/bucket/bucket.h>
40
41
42namespace aims
43{
44
45 template <int D, typename T>
47 const AimsTimeSurface<D,T> & mesh,
49 int value )
50 {
51 const std::vector<Point3df> & vert = mesh.vertex();
52 const std::vector<AimsVector<uint, D> > & polygons = mesh.polygon();
53 std::vector<float> vs = volume->getVoxelSize();
54 typename std::vector<AimsVector<uint, D> >::const_iterator
55 ip, ep = polygons.end();
56 Point3df v1, v2, v1v, v2v, direction;
57 float lmax;
58 unsigned i;
59 carto::Volume<int16_t> & vol = *volume;
60
61 for( ip=polygons.begin(); ip!=ep; ++ip )
62 {
63 const AimsVector<uint, D> & poly = *ip;
64 for( i=0; i<D; ++i )
65 {
66 v1 = vert[poly[i]];
67 v2 = vert[poly[(i+1) % D]];
68 v1v = Point3df( v1[0] / vs[0], v1[1] / vs[1], v1[2] / vs[2]);
69 v2v = Point3df( v2[0] / vs[0], v2[1] / vs[1], v2[2] / vs[2]);
70 direction = v2v - v1v;
71 lmax = direction.norm();
72 direction.normalize();
73 rasterizeLine( v1v, direction, lmax, vol, value );
74 }
75 }
76 }
77
78}
79
80#endif
81
82
83
The template class to manage a mesh with time if needed.
Definition surface.h:317
const std::vector< AimsVector< uint, D > > & polygon() const
Get a const reference to the vector of polygons of the 0 surface.
Definition surface.h:366
const std::vector< Point3df > & vertex() const
Get a const reference to the vector of verteces of the surface of index 0.
Definition surface.h:348
AimsVector< T, D > & normalize()
float norm() const
static void rasterizeLine(const Point3df &p0, const Point3df &direction, float lmax, T &volume, int value)
T should be carto::Volume<int16_t> or BucketMap<Void>::Bucket.
static void rasterizeMeshWireframe(const AimsTimeSurface< D, T > &mesh, carto::rc_ptr< carto::Volume< int16_t > > &volume, int value=1)
Rasterize polygons edges into a volume.
The class for EcatSino data write operation.
AimsVector< float, 3 > Point3df