aimsdata  4.7.0
Neuroimaging data handling
bundleSampler.h
Go to the documentation of this file.
1 /* Copyright (c) 1995-2017 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 AIMS_FIBERS_BUNDLESAMPLER_H
37 #define AIMS_FIBERS_BUNDLESAMPLER_H
38 
39 #include <aims/fibers/bundles.h>
40 
41 
42  //---------------//
43  // BundleSampler //
44 //---------------//
45 
46 namespace aims
47 {
48 
49 typedef std::vector< aims::FiberPoint > Fiber;
50 typedef std::vector< Fiber > Fibers;
51 
56 {
57 public:
58 
65  BundleSampler(float percent, const std::string &bundle_name,
66  const std::string &sampled_bundle_name, int mode);
76  BundleSampler(float percent, const std::string &bundle_name,
77  const std::string &sampled_bundle_name, int mode,
78  bool discarded);
79  virtual ~BundleSampler();
80 
81 protected:
82 
83 
84  virtual void bundleStarted( const aims::BundleProducer &,
85  const aims::BundleInfo & );
86  virtual void bundleTerminated( const aims::BundleProducer &,
87  const aims::BundleInfo & );
88  virtual void fiberStarted( const aims::BundleProducer &,
89  const aims::BundleInfo &,
90  const aims::FiberInfo & );
91  virtual void fiberTerminated( const aims::BundleProducer &,
92  const aims::BundleInfo &,
93  const aims::FiberInfo & );
94  virtual void newFiberPoint( const aims::BundleProducer &,
95  const aims::BundleInfo &,
96  const aims::FiberInfo &,
97  const aims::FiberPoint & );
98  virtual void noMoreBundle( const aims::BundleProducer & );
99 
100 private:
101 
102  float _percent;
103  int _mode;
104  // mode = 0: fibers are randomly selected (default)
105  // mode = 1: at least one fiber per bundle is selected
106  std::string _bundle_name;
107  std::string _sampled_bundle_name;
108  bool _fiber_selected;
109  bool _first_fiber;
110  int _fiber_count;
111  int _fiber_selected_count;
112  bool _discarded;
113  Fiber _fiber;
114  Fibers _fibers;
115 };
116 
117 } // namespace aims
118 
119 #endif // ifndef AIMS_FIBERS_BUNDLESAMPLER_H
std::vector< aims::FiberPoint > Fiber
Definition: bundleRegroup.h:50
virtual void fiberTerminated(const aims::BundleProducer &, const aims::BundleInfo &, const aims::FiberInfo &)
Serial processing of bundles.
Definition: bundles.h:152
std::vector< Fiber > Fibers
Definition: bundleRegroup.h:51
virtual void bundleStarted(const aims::BundleProducer &, const aims::BundleInfo &)
The class for EcatSino data write operation.
Definition: border.h:42
Filter fibers by randomly discarding a proportion of them.
Definition: bundleSampler.h:55
virtual void newFiberPoint(const aims::BundleProducer &, const aims::BundleInfo &, const aims::FiberInfo &, const aims::FiberPoint &)
Serial processing of bundles.
Definition: bundles.h:185
BundleSampler(float percent, const std::string &bundle_name, const std::string &sampled_bundle_name, int mode)
Parameters:
virtual ~BundleSampler()
virtual void fiberStarted(const aims::BundleProducer &, const aims::BundleInfo &, const aims::FiberInfo &)
virtual void bundleTerminated(const aims::BundleProducer &, const aims::BundleInfo &)