| .canonicalize.gradient.table | R Documentation |
Gradient tables occur in two orientations in the wild: the FSL layout, in which the first axis is the vector component (3 rows of N values for b-vectors, a single row of N values for b-values), and the volumes layout, in which each line is one volume (N rows of 3 values for b-vectors, as used by HCP, and N rows of 4 values for the MRtrix gradient table format). This helper maps both to one row per volume.
.canonicalize.gradient.table(
m,
n_components,
layout,
what,
square_is_ambiguous = FALSE
)
m |
numeric matrix, the table as read from the file. |
n_components |
integer, the number of values per volume (3 for b-vectors, 4 for a gradient table, 1 for b-values). |
layout |
character string, one of 'auto', 'components' or 'volumes'. How to interpret the input. With 'auto' (the default), the orientation is derived from the matrix dimensions. |
what |
character string, a human-readable description of the data, used in the messages. |
square_is_ambiguous |
logical, how to handle a table that has exactly
|
a numeric matrix with one row per volume and n_components columns.
A square 3x3 file is ambiguous, and the two reference implementations
do not agree on it: MRtrix3 reads such a b-vectors file with the components
in the rows, while DIPY reads it with the volumes in the rows. Like
MRtrix3, read.dti.bvec treats the lines as
components, and warns, because silently guessing here would scramble the
gradient directions. Matrices passed in memory are read with one row per
volume, which is the R convention, and no warning is needed.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.