View source: R/write_dti_tracks.R
| write.dti.tck | R Documentation |
Writes streamlines in the TCK format described at
https://mrtrix.readthedocs.io/en/latest/getting_started/image_data.html.
The format stores a triplet of NaN values between streamlines and a triplet
of Inf values at the end. The output is read by MRtrix and by
read.dti.tck.
write.dti.tck(
tracts,
filepath,
datatype = "Float32LE",
gzip = NULL,
header = list()
)
tracts |
the tracks to write, either an |
filepath |
character string, the path of the file to write. |
datatype |
character string, one of 'Float32LE' (the default, and what MRtrix writes), 'Float32BE', 'Float64LE' or 'Float64BE'. |
gzip |
logical or NULL, whether to gzip-compress the output. If
|
header |
named list of additional header entries to store in the file, e.g., the header of the file the tracks were read from. The entries 'id', 'datatype', 'count', 'file' and 'derived' are always computed by the readers and cannot be set. |
the file path, invisibly.
Tracts without any point cannot be represented in the TCK format: they
are written as a bare delimiter, which every reader (including this
package and 'nibabel') drops again, so the file reads back with fewer
tracts than it was written from. Writing such a file raises a warning.
write.dti.trk preserves empty tracts.
## Not run:
tck <- read.dti.tck("brain.tck", max_tracks = 1000);
write.dti.tck(tck$tracks, "first_1000.tck", header = tck$header);
# Round trip through a compressed file:
write.dti.tck(tck$tracks, "copy.tck.gz");
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.