| Title: | Microstructure Information from Diffusion Imaging |
| Version: | 0.2.0 |
| Description: | An implementation of a taxonomy of models of restricted diffusion in biological tissues parametrized by the tissue geometry (axis, diameter, density, etc.). This is primarily used in the context of diffusion magnetic resonance (MR) imaging to model the MR signal attenuation in the presence of diffusion gradients. The goal is to provide tools to simulate the MR signal attenuation predicted by these models under different experimental conditions. The package feeds a companion 'shiny' app available at https://midi-pastrami.apps.math.cnrs.fr that serves as a graphical interface to the models and tools provided by the package. Models currently available are the ones in Neuman (1974) <doi:10.1063/1.1680931>, Van Gelderen et al. (1994) <doi:10.1006/jmrb.1994.1038>, Stanisz et al. (1997) <doi:10.1002/mrm.1910370115>, Soderman & Jonsson (1995) <doi:10.1006/jmra.1995.0014> and Callaghan (1995) <doi:10.1006/jmra.1995.1055>. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| Depends: | R (≥ 3.5) |
| URL: | https://github.com/tractoverse/midi, https://tractoverse.github.io/midi/ |
| BugReports: | https://github.com/tractoverse/midi/issues |
| Imports: | cli, ggplot2, plotly, purrr, R6, rlang, withr |
| Suggests: | testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| Config/roxygen2/version: | 8.0.0 |
| Config/roxygen2/markdown: | TRUE |
| NeedsCompilation: | no |
| Packaged: | 2026-07-05 19:31:43 UTC; stamm-a |
| Author: | Aymeric Stamm |
| Maintainer: | Aymeric Stamm <aymeric.stamm@cnrs.fr> |
| Repository: | CRAN |
| Date/Publication: | 2026-07-05 19:40:02 UTC |
midi: Microstructure Information from Diffusion Imaging
Description
An implementation of a taxonomy of models of restricted diffusion in biological tissues parametrized by the tissue geometry (axis, diameter, density, etc.). This is primarily used in the context of diffusion magnetic resonance (MR) imaging to model the MR signal attenuation in the presence of diffusion gradients. The goal is to provide tools to simulate the MR signal attenuation predicted by these models under different experimental conditions. The package feeds a companion 'shiny' app available at https://midi-pastrami.apps.math.cnrs.fr that serves as a graphical interface to the models and tools provided by the package. Models currently available are the ones in Neuman (1974) doi:10.1063/1.1680931, Van Gelderen et al. (1994) doi:10.1006/jmrb.1994.1038, Stanisz et al. (1997) doi:10.1002/mrm.1910370115, Soderman & Jonsson (1995) doi:10.1006/jmra.1995.0014 and Callaghan (1995) doi:10.1006/jmra.1995.1055.
Author(s)
Maintainer: Aymeric Stamm aymeric.stamm@cnrs.fr (ORCID)
Authors:
Aymeric Stamm aymeric.stamm@cnrs.fr (ORCID)
See Also
Useful links:
Report bugs at https://github.com/tractoverse/midi/issues
Base compartment class
Description
The base class for compartment models.
Methods
Public methods
BaseCompartment$get_signal()
Computes the signal attenuation predicted by the model.
Usage
BaseCompartment$get_signal( small_delta, big_delta, G, direction = c(0, 0, 1), echo_time = NULL, n_max = 20L, m_max = 50L )
Arguments
small_deltaA numeric value specifying the duration of the gradient pulse in milliseconds.
big_deltaA numeric value specifying the duration between the gradient pulses in milliseconds.
GA numeric value specifying the strength of the gradient in mT.
\mum^{-1}.directionA numeric vector specifying the direction of the gradient. Defaults to
c(0, 0, 1).echo_timeA numeric value specifying the echo time in milliseconds.
n_maxAn integer value specifying the maximum order of the Bessel function. Defaults to
20L.m_maxAn integer value specifying the maximum number of extrema for the Bessel function. Defaults to
50L.
Returns
A numeric value storing the predicted signal attenuation.
Examples
freeComp <- FreeCompartment$new() freeComp$get_signal(small_delta = 30, big_delta = 30, G = 0.040) sphereComp <- SphereCompartment$new() sphereComp$get_signal(small_delta = 30, big_delta = 30, G = 0.040) sodermanComp <- SodermanCompartment$new() sodermanComp$get_signal(small_delta = 30, big_delta = 30, G = 0.040) staniszComp <- StaniszCompartment$new() staniszComp$get_signal(small_delta = 30, big_delta = 30, G = 0.040) neumanComp <- NeumanCompartment$new() neumanComp$get_signal( small_delta = 30, big_delta = 30, G = 0.040, echo_time = 40 ) callaghanComp <- CallaghanCompartment$new() callaghanComp$get_signal(small_delta = 30, big_delta = 30, G = 0.040) vanGelderenComp <- VanGelderenCompartment$new() vanGelderenComp$get_signal(small_delta = 30, big_delta = 30, G = 0.040)
BaseCompartment$get_parameter_names()
Returns the names of the compartment parameters
Usage
BaseCompartment$get_parameter_names()
Returns
A character vector storing the names of the compartment parameters.
Examples
freeComp <- FreeCompartment$new() freeComp$get_parameter_names()
BaseCompartment$get_parameters()
Returns the values of the compartment parameters
Usage
BaseCompartment$get_parameters()
Returns
A numeric vector storing the values of the compartment parameters.
Examples
freeComp <- FreeCompartment$new() freeComp$get_parameters()
BaseCompartment$clone()
The objects of this class are cloneable with this method.
Usage
BaseCompartment$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
## ------------------------------------------------
## Method `BaseCompartment$get_signal()`
## ------------------------------------------------
freeComp <- FreeCompartment$new()
freeComp$get_signal(small_delta = 30, big_delta = 30, G = 0.040)
sphereComp <- SphereCompartment$new()
sphereComp$get_signal(small_delta = 30, big_delta = 30, G = 0.040)
sodermanComp <- SodermanCompartment$new()
sodermanComp$get_signal(small_delta = 30, big_delta = 30, G = 0.040)
staniszComp <- StaniszCompartment$new()
staniszComp$get_signal(small_delta = 30, big_delta = 30, G = 0.040)
neumanComp <- NeumanCompartment$new()
neumanComp$get_signal(
small_delta = 30, big_delta = 30, G = 0.040,
echo_time = 40
)
callaghanComp <- CallaghanCompartment$new()
callaghanComp$get_signal(small_delta = 30, big_delta = 30, G = 0.040)
vanGelderenComp <- VanGelderenCompartment$new()
vanGelderenComp$get_signal(small_delta = 30, big_delta = 30, G = 0.040)
## ------------------------------------------------
## Method `BaseCompartment$get_parameter_names()`
## ------------------------------------------------
freeComp <- FreeCompartment$new()
freeComp$get_parameter_names()
## ------------------------------------------------
## Method `BaseCompartment$get_parameters()`
## ------------------------------------------------
freeComp <- FreeCompartment$new()
freeComp$get_parameters()
Base distribution class
Description
This class defines the base distribution class from which all other distributions inherit. It provides a common interface for fitting the distribution to data and generating random samples.
Methods
Public methods
BaseDistribution$fit()
Fit the distribution to the data.
Usage
BaseDistribution$fit(x)
Arguments
xA numeric vector of data to fit the distribution to.
Returns
Internally sets the parameters of the distribution. Returns nothing.
BaseDistribution$random()
Generate random samples from the distribution.
Usage
BaseDistribution$random(n)
Arguments
nAn integer specifying the number of samples to generate.
Returns
A numeric vector of size n containing the random samples.
BaseDistribution$get_mean()
Compute the mean of the distribution.
Usage
BaseDistribution$get_mean()
Returns
A numeric value storing the mean of the distribution.
BaseDistribution$get_variance()
Compute the variance of the distribution.
Usage
BaseDistribution$get_variance()
Returns
A numeric value storing the variance of the distribution.
BaseDistribution$clone()
The objects of this class are cloneable with this method.
Usage
BaseDistribution$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Callaghan's model for restricted diffusion in a cylinder
Description
A class to model restricted diffusion in a cylinder using the Callaghan's model.
Super classes
BaseCompartment -> CircularlyShapedCompartment -> CallaghanCompartment
Methods
Public methods
Inherited methods
CallaghanCompartment$clone()
The objects of this class are cloneable with this method.
Usage
CallaghanCompartment$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
References
Callaghan, P. T. (1995). Pulsed-gradient spin-echo NMR for planar, cylindrical, and spherical pores under conditions of wall relaxation. Journal of magnetic resonance, Series A, 113(1), 53-59.
Circularly-shaped compartment class
Description
A class to model restricted diffusion in a bounded medium described by a circular shape with a given radius.
Super class
BaseCompartment -> CircularlyShapedCompartment
Methods
Public methods
Inherited methods
CircularlyShapedCompartment$new()
Instantiates a new circular compartment.
Usage
CircularlyShapedCompartment$new(radius = NULL, diffusivity = NULL)
Arguments
radiusA numeric value specifying the radius of the sphere in
\mum.diffusivityA numeric value specifying the diffusivity within the sphere in
\mum^2.ms^{-1}.
Returns
An instance of the CircularlyShapedCompartment class.
CircularlyShapedCompartment$clone()
The objects of this class are cloneable with this method.
Usage
CircularlyShapedCompartment$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Cylinder bundle compartment class
Description
A class to model restricted diffusion in a bundle of cylinders.
Super class
BaseCompartment -> CylinderBundleCompartment
Methods
Public methods
Inherited methods
CylinderBundleCompartment$new()
Instantiates a new cylinder bundle compartment.
Usage
CylinderBundleCompartment$new( cylinder_density, cylinder_compartments, axial_diffusivity = NULL, radial_diffusivity = NULL )
Arguments
cylinder_densityA numeric value specifying the density of the cylinders in the voxel. Must be between 0 and 1.
cylinder_compartmentsA list of instances of the
CylinderCompartmentclass specifying the compartments within the bundle.axial_diffusivityA numeric value specifying the axial diffusivity in the space outside the cylinders in m
^2.s^{-1}. If not provided, defaults to a tortuosity model reducing the intrinsic diffusivity depending on orientation dispersion. Defaults toNULLin which case the extracellular axial diffusivity is set via a tortuosity model based on the dispersion in orientation.radial_diffusivityA numeric value specifying the radial diffusivity in the space outside the cylinders in m
^2.s^{-1}. Defaults toNULLin which case the extracellular radial diffusivity is set via a tortuosity model based on the intracellular density.
Returns
An instance of the CylinderBundleCompartment class.
CylinderBundleCompartment$clone()
The objects of this class are cloneable with this method.
Usage
CylinderBundleCompartment$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
withr::with_seed(1234, {
cyls <- rcylinders(
n = 100,
axis_mean = c(0, 0, 1),
radius_mean = 5,
diffusivity_mean = 3,
axis_concentration = 10,
radius_sd = 1,
diffusivity_sd = 0
)
})
comp <- CylinderBundleCompartment$new(
cylinder_density = 0.5,
cylinder_compartments = cyls
)
comp$get_signal(
small_delta = 30,
big_delta = 30,
G = 0.040,
direction = c(0, 0, 1)
)
comp$get_parameters()
Cylinder compartment class
Description
A class to model restricted diffusion in a cylinder.
Super classes
BaseCompartment -> CircularlyShapedCompartment -> CylinderCompartment
Methods
Public methods
Inherited methods
CylinderCompartment$new()
Instantiates a new cylinder compartment.
Usage
CylinderCompartment$new( axis = c(0, 0, 1), restricted_compartment = VanGelderenCompartment$new() )
Arguments
axisA length-3 numeric vector specifying the axis of the cylinder.
restricted_compartmentAn instance of the
CircularlyShapedCompartmentclass specifying the restricted compartment within the sphere. Defaults to a Van Gelderen compartment.
Returns
An instance of the CylinderCompartment class.
CylinderCompartment$clone()
The objects of this class are cloneable with this method.
Usage
CylinderCompartment$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
cylComp <- CylinderCompartment$new()
cylComp$get_signal(small_delta = 30, big_delta = 30, G = 0.040)
cylComp$get_parameter_names()
cylComp$get_parameters()
Free compartment class
Description
A class to model free unconstrained diffusion.
Super class
BaseCompartment -> FreeCompartment
Methods
Public methods
Inherited methods
FreeCompartment$new()
Instantiates a new free compartment.
Usage
FreeCompartment$new(diffusivity = NULL)
Arguments
diffusivityA numeric value specifying the diffusivity within the sphere in
\mum^2.ms^{-1}. Defaults toNULL, in which case the default free diffusivity of 3\mum^2.ms^{-1}is used.
Returns
An instance of the FreeCompartment class.
FreeCompartment$clone()
The objects of this class are cloneable with this method.
Usage
FreeCompartment$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Gamma distribution class
Description
This class defines the gamma distribution. It provides methods for fitting the distribution to data and generating random samples.
Super class
BaseDistribution -> GammaDistribution
Methods
Public methods
Inherited methods
GammaDistribution$new()
Creates a new gamma distribution.
Usage
GammaDistribution$new(shape = 1, scale = 1)
Arguments
shapeA numeric value specifying the shape parameter of the gamma distribution. Defaults to
1.0.scaleA numeric value specifying the scale parameter of the gamma distribution. Defaults to
1.0.
Returns
An instance of the gamma distribution as an object of class
GammaDistribution.
GammaDistribution$get_shape()
Retrieves the shape parameter of the gamma distribution.
Usage
GammaDistribution$get_shape()
Returns
A numeric value storing the shape parameter of the gamma distribution.
GammaDistribution$get_scale()
Retrieves the scale parameter of the gamma distribution.
Usage
GammaDistribution$get_scale()
Returns
A numeric value storing the scale parameter of the gamma distribution.
GammaDistribution$clone()
The objects of this class are cloneable with this method.
Usage
GammaDistribution$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
gd <- GammaDistribution$new(
shape = 1,
scale = 5
)
gd$get_shape()
gd$get_scale()
gd$get_mean()
gd$get_variance()
gd$random(10)
gd$fit(gd$random(100))
gd$get_shape()
gd$get_scale()
Neuman's model for restricted diffusion in a cylinder
Description
A class to model restricted diffusion in a cylinder using the Neuman's model.
Super classes
BaseCompartment -> CircularlyShapedCompartment -> NeumanCompartment
Methods
Public methods
Inherited methods
NeumanCompartment$clone()
The objects of this class are cloneable with this method.
Usage
NeumanCompartment$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
References
Neuman, C. H. (1974). Spin echo of spins diffusing in a bounded medium. The Journal of Chemical Physics, 60(11), 4508-4511.
Soderman's model for restricted diffusion in a cylinder
Description
A class to model restricted diffusion in a cylinder using the Soderman's model.
Super classes
BaseCompartment -> CircularlyShapedCompartment -> SodermanCompartment
Methods
Public methods
Inherited methods
SodermanCompartment$clone()
The objects of this class are cloneable with this method.
Usage
SodermanCompartment$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
References
Söderman, O., & Jönsson, B. (1995). Restricted diffusion in cylindrical geometry. Journal of Magnetic Resonance, Series A, 117(1), 94-97.
Sphere compartment class
Description
A class to model restricted diffusion in a sphere.
Super classes
BaseCompartment -> CircularlyShapedCompartment -> SphereCompartment
Methods
Public methods
Inherited methods
SphereCompartment$new()
Instantiates a new sphere compartment.
Usage
SphereCompartment$new(restricted_compartment = VanGelderenCompartment$new())
Arguments
restricted_compartmentAn instance of the
CircularlyShapedCompartmentclass specifying the restricted compartment within the sphere. Defaults to a Van Gelderen compartment.
Returns
An instance of the SphereCompartment class.
SphereCompartment$clone()
The objects of this class are cloneable with this method.
Usage
SphereCompartment$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
sphComp <- SphereCompartment$new()
sphComp$get_signal(small_delta = 30, big_delta = 30, G = 0.040)
sphComp$get_parameter_names()
sphComp$get_parameters()
Stanisz's model for restricted diffusion in a cylinder
Description
A class to model restricted diffusion in a cylinder using the Stanisz's model.
Super classes
BaseCompartment -> CircularlyShapedCompartment -> StaniszCompartment
Methods
Public methods
Inherited methods
StaniszCompartment$clone()
The objects of this class are cloneable with this method.
Usage
StaniszCompartment$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
References
Stanisz, G. J., Wright, G. A., Henkelman, R. M., & Szafer, A. (1997). An analytical model of restricted diffusion in bovine optic nerve. Magnetic Resonance in Medicine, 37(1), 103-111.
Van Gelderen's model for restricted diffusion in a cylinder
Description
A class to model restricted diffusion in a cylinder using the Van Gelderen's model.
Super classes
BaseCompartment -> CircularlyShapedCompartment -> VanGelderenCompartment
Methods
Public methods
Inherited methods
VanGelderenCompartment$clone()
The objects of this class are cloneable with this method.
Usage
VanGelderenCompartment$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
References
Vangelderen, P., DesPres, D., Vanzijl, P. C. M., & Moonen, C. T. W. (1994). Evaluation of restricted diffusion in cylinders. Phosphocreatine in rabbit leg muscle. Journal of Magnetic Resonance, Series B, 103(3), 255-260.
Watson distribution class
Description
This class defines the Watson distribution. It provides methods for fitting the distribution to data and generating random samples.
Super class
BaseDistribution -> WatsonDistribution
Methods
Public methods
Inherited methods
WatsonDistribution$new()
Creates a new Watson distribution.
Usage
WatsonDistribution$new(mu = c(0, 0, 1), kappa = 10)
Arguments
muA numeric vector of length 3 specifying the mean direction of the Watson distribution. Defaults to
(0, 0, 1).kappaA numeric value specifying the concentration parameter of the Watson distribution. Defaults to
10.0.
Returns
An instance of the Watson distribution as an object of class
WatsonDistribution.
WatsonDistribution$get_axis()
Retrieves the mean axis of the Watson distribution.
Usage
WatsonDistribution$get_axis()
Returns
A numeric vector of length 3 storing the mean axis of the Watson distribution.
WatsonDistribution$get_concentration()
Retrieves the concentration parameter of the Watson distribution.
Usage
WatsonDistribution$get_concentration()
Returns
A numeric value storing the concentration parameter of the Watson distribution.
WatsonDistribution$clone()
The objects of this class are cloneable with this method.
Usage
WatsonDistribution$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
wd <- WatsonDistribution$new(
mu = c(0, 0, 1),
kappa = 10
)
wd$get_axis()
wd$get_concentration()
wd$random(10)
wd$fit(wd$random(100))
wd$get_axis()
wd$get_concentration()
Plots a cross section of a cylinder bundle using ggplot2
Description
Plots a cross section of a cylinder bundle from an object of class bundle
as generated by simulate_bundle() using
ggplot2.
Usage
## S3 method for class 'bundle'
autoplot(object, grid_size = 100L, ...)
Arguments
object |
An object of class |
grid_size |
An integer value specifying the number of points on which
the unit circle should be discretized to draw the spheres. Defaults to
|
... |
Additional arguments to be passed to the |
Value
A ggplot2::ggplot() object.
Examples
density <- 0.5
voxel_size <- 5 # micrometers
withr::with_seed(1234, {
out <- simulate_bundle(density, voxel_size)
})
ggplot2::autoplot(out)
B-Value Calculation
Description
A function to calculate the b-value for a given set of experimental parameters.
Usage
bvalue(small_delta, big_delta, G)
Arguments
small_delta |
A numeric value specifying the duration of the gradient pulse in ms. |
big_delta |
A numeric value specifying the duration between the gradient pulses in ms. |
G |
A numeric value specifying the strength of the gradient in
|
Value
A numeric value storing the predicted b-value in
ms/\mum^2.
Examples
bvalue(small_delta = 30, big_delta = 30, G = 0.040)
Plots a cross section of a cylinder bundle
Description
Plots a cross section of a cylinder bundle
Usage
## S3 method for class 'bundle'
plot(x, grid_size = 100L, ...)
Arguments
x |
An object of class |
grid_size |
An integer value specifying the number of points on which
the unit circle should be discretized to draw the spheres. Defaults to
|
... |
Additional arguments to be passed to the |
Value
Nothing.
Examples
density <- 0.5
voxel_size <- 5 # micrometers
withr::with_seed(1234, {
out <- simulate_bundle(density, voxel_size)
})
plot(out)
Plots a 3D representation of a cylinder bundle using plotly
Description
Plots a 3D representation of a cylinder bundle from an object of class
bundle as generated by simulate_bundle() using
plotly.
Usage
plot3d(b, show_linear_mesh = FALSE)
Arguments
b |
An object of class |
show_linear_mesh |
A logical value indicating whether the linear mesh of
each cylinder should be displayed. Defaults to |
Value
An HTML widget of class plotly::plotly storing the 3D
visualization of the cylinder bundle.
Examples
density <- 0.5
voxel_size <- 5 # micrometers
withr::with_seed(1234, {
out <- simulate_bundle(density, voxel_size)
})
plot3d(out)
Sample cylinder compartments
Description
This function samples n cylinder compartments with given axis, radius
and diffusivity distributions.
Usage
rcylinders(
n,
axis_mean,
radius_mean,
diffusivity_mean,
axis_concentration = Inf,
radius_sd = 0,
diffusivity_sd = 0,
restricted_model = c("Callaghan", "Neuman", "Soderman", "Stanisz", "Van Gelderen")
)
Arguments
n |
An integer value specifying the number of compartments to sample. |
axis_mean |
A numeric value specifying the mean of the axis distribution. |
radius_mean |
A numeric value specifying the mean of the radius distribution. |
diffusivity_mean |
A numeric value specifying the mean of the diffusivity distribution. |
axis_concentration |
A numeric value specifying the concentration of the
axis distribution. Defaults to |
radius_sd |
A numeric value specifying the standard deviation of the
radius distribution. Defaults to |
diffusivity_sd |
A numeric value specifying the standard deviation of
the diffusivity distribution. Defaults to |
restricted_model |
A character vector specifying the restricted
diffusion model to use. Defaults to |
Details
The axis distribution is given by a mean and a concentration parameter and
the Dimroth-Watson distribution is used to sample values. The radius and
diffusivity distributions are given by a mean and a standard deviation and
the Gamma distribution is used to sample values. If the concentration
parameter is set to Inf the axis is fixed to the mean value. If the
standard deviation of the radius and diffusivity distributions are set to 0
the radius and diffusivity are fixed to the mean values. If all parameters
are fixed, only one compartment is sampled.
Value
A list of n cylinder compartments of class
CylinderCompartment.
Examples
# Sample 10 cylinder compartments with fixed axis, radius and diffusivity
# set.seed(42)
cyl_distr <- rcylinders(
n = 10L,
axis_mean = c(0, 0, 1),
radius_mean = 5,
diffusivity_mean = 3
)
Runs the MIDI Shiny web application
Description
This is a helper function to run the MIDI Shiny web application in the default web browser.
Usage
run_app()
Value
Nothing, but launches the Shiny app in the default web browser.
Examples
run_app()
Generates a cross section of a cylinder bundle
Description
Generates a cross section of a cylinder bundle with a given density and voxel size. The cross section is generated by simulating a random distribution of cylinders and computing the intersection of the cylinders with a plane. The radii of the cylinders are drawn from a Gamma distribution fitted from data retrieved by histology in the genu of the corpus callosum (Aboitiz et al., 1992). The number of cylinders is determined by the density and the voxel size.
Usage
simulate_bundle(
density = 0.5,
voxel_size = 10,
rel_tol = 0.001,
verbose = FALSE
)
Arguments
density |
A numeric value between 0 and 1 specifying the density of the
cylinders in the voxel. Defaults to |
voxel_size |
A numeric value specifying the size of the voxel in micro-
meters. Defaults to |
rel_tol |
A numeric value specifying the relative tolerance to reach the
target volume defined as |
verbose |
A logical value specifying whether to print messages. Defaults
to |
Value
A list with the following components:
-
sections: A numeric matrix with 3 columns:-
x: The x-coordinates of the centers of the cylinders; -
y: The y-coordinates of the centers of the cylinders; -
r: The radii of the cylinders in micrometers.
-
-
voxel_size: The size of the voxel in micrometers
References
Aboitiz, F., Scheibel, A. B., Fisher, R. S., & Zaidel, E. (1992). Fiber composition of the human corpus callosum. Brain research, 598(1-2), 143-153.
Examples
density <- 0.5
voxel_size <- 5 # micrometers
withr::with_seed(1234, {
out <- simulate_bundle(density, voxel_size)
})
# Actual density in the simulated substrate
sum(out$sections[, "r"]^2 * pi) / voxel_size^2