View source: R/write_dti_tracks.R
| write.dti.trk | R Documentation |
Writes streamlines in the TRK format described at
http://trackvis.org/docs/?subsect=fileformat. The output is read by
TrackVis, by DSI Studio and by read.dti.trk.
write.dti.trk(
tracts,
filepath,
header = NULL,
coords_space = NULL,
endian = "little",
gzip = NULL
)
tracts |
the tracks to write, either an |
filepath |
character string, the path of the file to write. |
header |
named list or NULL, the header of the file the tracks were read
from, whose metadata (voxel sizes, dimensions, the voxel-to-RAS matrix, the
voxel order, and the scalars and properties of the file) is reused. If
|
coords_space |
character string or NULL, the coordinate system the
tracks are in, either 'native' (the coordinates are written as they are) or
'ras' (the coordinates are RAS+ mm and are transformed back to the space
used in the file, which is what 'nibabel' does when saving). If |
endian |
character string, 'little' (the default) or 'big'. TrackVis writes little endian files, big endian support is for reading files written on old big endian systems. |
gzip |
logical or NULL, whether to gzip-compress the output. If
|
the file path, invisibly.
## Not run:
trk <- read.dti.trk("brain.trk");
write.dti.trk(trk$tracks, "copy.trk", header = trk$header);
# Write RAS coordinates back to a file that uses voxelmm space:
trk_ras <- read.dti.trk("brain.trk", coords = "ras");
write.dti.trk(trk_ras$tracks, "copy.trk", header = trk_ras$header, coords_space = "ras");
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.