JEMRIS  2.8.1
open-source MRI simulations
MicrostructureSingleFiber.h
1 /*
2  * MicrostructureSingleFiber.h
3  *
4  * Created on: Jan 22, 2010
5  * Author: dpflug
6  */
7 
8 
9 /*
10  * JEMRIS Copyright (C)
11  * 2006-2015 Tony Stoecker
12  * 2007-2015 Kaveh Vahedipour
13  * 2009-2015 Daniel Pflugfelder
14  *
15  *
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 2 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, write to the Free Software
28  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29  */
30 
31 #ifndef MICROSTRUCTURESINGLEFIBER_H_
32 #define MICROSTRUCTURESINGLEFIBER_H_
33 
34 #include "Microstructure.h"
35 #include <vector>
36 
41 public:
43  virtual ~MicrostructureSingleFiber();
44 
48  void SetFiberOrientation(double dx,double dy,double dz);
49 
53  void SetCylinderDensity(double density){if((density>0) && (density<1)) m_cyl_dens = density; else cout <<"density must be between 0 and 1!"<<endl;};
54 
58  void SetCylinderRadius(double inner, double outer=0) {m_cyl_radius_inner = inner; if (outer > inner) m_cyl_radius_outer=outer; else m_cyl_radius_outer=inner;};
59 
63  void SetRadiusDistribution(string filename);
64  void SetRadiusDistribution(double alpha, double beta, double rmax);
65 
69  void SetSeed(int val) {m_seed = val;}
70 
74  void SetD(double D,int index) {m_D[index]=D;};
75 
79  void GenerateStructure();
80 
81  virtual void IndexObject(triple pos, int &LastId ,int &shellid);
82 
83  virtual double GetD(int LastId,int shellid);
84 
88  void SetAxonToNeuronRadiusRatio(double ratio) {m_myelin_axon_ratio=ratio;};
89 
90  /*
91  * @brief Dump microstructure to file
92  */
93  void DumpStructure();
94 
95 protected:
96 
97  virtual bool CylinderCollide(const neuron &test); /* test if this neuron is overlapping with any other in structure. */
98  double GetCylinderVolume(const neuron &test); /* calculate volume of cylinder in box. */
102  double GetPointDistance(const triple pos, const neuron &tmp);
103 
107  double GetCylinderDistance(const neuron&n1, const neuron&n2);
111  virtual void SetCylOrientation(neuron &tmp) {tmp.dx = m_fiber_orientation[0];tmp.dy = m_fiber_orientation[1];tmp.dz = m_fiber_orientation[2];};
112 
116  void CalcPercentiles();
117 
121  void GetRadius(neuron &tmp,const double complete_vol, const double used_vol);
122 
123 
125  double m_cyl_dens;
128  double m_D[2];
130  vector<neuron> m_axons;
132  int m_seed;
135  /* variables for axon radius distribution */
137  vector<int> m_percentiles;
138  vector<double> m_radius_axis;
139  vector<double> m_radius_hist;
142 };
143 
144 #endif /* MICROSTRUCTURESINGLEFIBER_H_ */
void SetRadiusDistribution(string filename)
Set axon radius distribution, string: -> filename, three doubles: distribution from AxCaliber (Assaf ...
Definition: MicrostructureSingleFiber.cpp:232
void CalcPercentiles()
if radius distribution is used: calculate compartments (begin with largest radii, then fill up with s...
Definition: MicrostructureSingleFiber.cpp:265
double dz
z-component of fiber orientation
Definition: Microstructure.h:42
double dy
y-component of fiber orientation
Definition: Microstructure.h:41
Microsructure base class.
Definition: Microstructure.h:55
void SetD(double D, int index)
Set Diffusion constants.
Definition: MicrostructureSingleFiber.h:74
vector< double > m_radius_hist
values for radius distribution
Definition: MicrostructureSingleFiber.h:139
double dx
x-component of fiber orientation
Definition: Microstructure.h:40
double m_cyl_radius_outer
outer radius of cylinders
Definition: MicrostructureSingleFiber.h:127
double m_cyl_dens
density of cylinders
Definition: MicrostructureSingleFiber.h:125
double m_cyl_radius_inner
inner radius of cylinders
Definition: MicrostructureSingleFiber.h:126
void GetRadius(neuron &tmp, const double complete_vol, const double used_vol)
Get a trial axon radius.
Definition: MicrostructureSingleFiber.cpp:311
virtual void SetCylOrientation(neuron &tmp)
sets orientation of cyl in GenerateStructure.
Definition: MicrostructureSingleFiber.h:111
void SetFiberOrientation(double dx, double dy, double dz)
set cylinder orientation
Definition: MicrostructureSingleFiber.cpp:61
double m_D[2]
diffusion constants per layer
Definition: MicrostructureSingleFiber.h:128
void SetCylinderDensity(double density)
Set Cylinder Density;.
Definition: MicrostructureSingleFiber.h:53
double GetPointDistance(const triple pos, const neuron &tmp)
Get distance between point pos and cylinder tmp.
Definition: MicrostructureSingleFiber.cpp:167
bool m_use_var_rad
true for variable radius distribution
Definition: MicrostructureSingleFiber.h:136
void SetAxonToNeuronRadiusRatio(double ratio)
sets ratio axon/(axion + myelin sheet). Needed if radius distribution of neurons is used ...
Definition: MicrostructureSingleFiber.h:88
void GenerateStructure()
builds Structure
Definition: MicrostructureSingleFiber.cpp:74
Cartesians positions for diffusion trajectory of a spin.
Definition: TrajectoryDiffusion.h:46
Definition of a neuron/axon for the Microstructure.
Definition: Microstructure.h:39
int m_seed
random number seed
Definition: MicrostructureSingleFiber.h:132
vector< double > m_radius_axis
axis for radius distribution
Definition: MicrostructureSingleFiber.h:138
Microstructure consisting of parallel cylinders.
Definition: MicrostructureSingleFiber.h:40
double m_myelin_axon_ratio
ratio axon to (axon+myelin). Between 0 and 1. Used for variable radii only; else myelin radius is set...
Definition: MicrostructureSingleFiber.h:140
double m_fiber_orientation[3]
orientation of cylinders
Definition: MicrostructureSingleFiber.h:124
virtual void IndexObject(triple pos, int &LastId, int &shellid)
Definition: MicrostructureSingleFiber.cpp:147
double m_extracellular_spacing
minimal space between neurons
Definition: MicrostructureSingleFiber.h:141
double GetCylinderDistance(const neuron &n1, const neuron &n2)
Get distance between two cylinders.
Definition: MicrostructureSingleFiber.cpp:203
vector< neuron > m_axons
container holding the neurons.
Definition: MicrostructureSingleFiber.h:130
void SetCylinderRadius(double inner, double outer=0)
Set Cylinder Radius;.
Definition: MicrostructureSingleFiber.h:58
void SetSeed(int val)
Set seed for random number generator.
Definition: MicrostructureSingleFiber.h:69
virtual double GetD(int LastId, int shellid)
Definition: MicrostructureSingleFiber.cpp:181
vector< int > m_percentiles
compartment indices (first place axons from large compartment)
Definition: MicrostructureSingleFiber.h:137

-- last change 17.06.2016 | Tony Stoecker | Imprint --