# This example shows how to convert tck to vtk
# run `ieegio_sample_data("streamlines/CNVII_R.tck")` to
# download sample data
if( ieegio_sample_data("streamlines/CNVII_R.tck", test = TRUE) ) {
path <- ieegio_sample_data("streamlines/CNVII_R.tck")
streamlines <- as_ieegio_streamlines(path)
# write to vtk
tfile <- tempfile(fileext = ".vtk")
io_write_vtk_streamlines(streamlines, con = tfile)
# read
vtk_streamlines <- io_read_vtk_streamlines(tfile)
# compare
plot(streamlines)
plot(vtk_streamlines)
# 0 0
range(streamlines[[1]]$coords - vtk_streamlines[[1]]$coords)
}
Run the code above in your browser using DataLab