Constellation: Connectivity-based Structural Parcellation


bundleLoader.h
Go to the documentation of this file.
1/* Copyright (c) 1995-2012 CEA
2 *
3 * This software and supporting documentation were developed by
4 * CEA/DSV/SHFJ
5 * 4 place du General Leclerc
6 * 91401 Orsay cedex
7 * France
8 *
9 * This software is governed by the CeCILL license version 2 under
10 * French law and abiding by the rules of distribution of free software.
11 * You can use, modify and/or redistribute the software under the
12 * terms of the CeCILL license version 2 as circulated by CEA, CNRS
13 * and INRIA at the following URL "http://www.cecill.info".
14 *
15 * As a counterpart to the access to the source code and rights to copy,
16 * modify and redistribute granted by the license, users are provided only
17 * with a limited warranty and the software's author, the holder of the
18 * economic rights, and the successive licensors have only limited
19 * liability.
20 *
21 * In this respect, the user's attention is drawn to the risks associated
22 * with loading, using, modifying and/or developing or reproducing the
23 * software by the user in light of its specific status of free software,
24 * that may mean that it is complicated to manipulate, and that also
25 * therefore means that it is reserved for developers and experienced
26 * professionals having in-depth computer knowledge. Users are therefore
27 * encouraged to load and test the software's suitability as regards their
28 * requirements in conditions enabling the security of their systems and/or
29 * data to be ensured and, more generally, to use and operate it in the
30 * same conditions as regards security.
31 *
32 * The fact that you are presently reading this means that you have had
33 * knowledge of the CeCILL license version 2 and that you accept its terms.
34 */
35
36#ifndef CONSTELLATION_BUNDLELOADER_H
37#define CONSTELLATION_BUNDLELOADER_H
38
39/* Extracted from code from Pascal Cathier
40 */
41
42#include <aims/fibers/bundles.h>
44
45namespace constel {
46
48
49 public: // typedefs
50 typedef std::vector<Fiber> Bundle;
51
52 public: // constructors & destructor
53 BundleLoader() : m_fibers(new Bundle), w_fibers(new WeightedFibers) {}
54 virtual ~BundleLoader() {}
55
56 public: // set & get
57 carto::rc_ptr<Bundle> getFibers() const { return m_fibers; }
59 return w_fibers;
60 }
61
62 private: // functions
63 void bundleStarted(
64 const aims::BundleProducer &, const aims::BundleInfo &) {}
65
66 void bundleTerminated(
67 const aims::BundleProducer &, const aims::BundleInfo &) {}
68
69 void fiberStarted(
70 const aims::BundleProducer &, const aims::BundleInfo &,
71 const aims::FiberInfo &fiberInfo) {
72 m_fibers->push_back(Fiber());
73 w_fibers->push_back(WeightedFiber( Fiber(), fiberInfo.weight() ));
74 }
75
76 void fiberTerminated(
77 const aims::BundleProducer &, const aims::BundleInfo &,
78 const aims::FiberInfo &) {}
79
80 void newFiberPoint(
81 const aims::BundleProducer &, const aims::BundleInfo &,
82 const aims::FiberInfo &, const aims::FiberPoint & point) {
83 m_fibers->back().push_back(point);
84 w_fibers->back().first.push_back(point);
85 }
86
87 void noMoreBundle(const aims::BundleProducer &) {}
88
89 private: // data
90 carto::rc_ptr<Bundle> m_fibers;
91 carto::rc_ptr<WeightedFibers> w_fibers;
92 };
93}
94#endif
double weight() const
carto::rc_ptr< WeightedFibers > getWeightedFibers() const
carto::rc_ptr< Bundle > getFibers() const
std::vector< Fiber > Bundle
aims::Polyline::Point_t FiberPoint
std::pair< Fiber, double > WeightedFiber
Definition bundleSet.h:11
std::vector< WeightedFiber > WeightedFibers
Definition bundleSet.h:12
std::vector< Point > Fiber
Definition bundleSet.h:8