export_mesh {rTwig} | R Documentation |
Export Mesh
Description
Exports a QSM cylinder mesh in various formats
Usage
export_mesh(
cylinder,
filename,
format = "ply",
radius = NULL,
color = NULL,
palette = NULL,
facets = 6,
normals = FALSE,
alpha = 1
)
Arguments
cylinder |
QSM cylinder data frame. |
filename |
File name and path for exporting. The file extension is automatically added if not present. |
format |
Mesh file format. Defaults to |
radius |
Radius column name either quoted or unquoted. Defaults to the modified radii. |
color |
Optional cylinder color parameter.
|
palette |
Optional cylinder color palette for numerical data.
Palettes include |
facets |
The number of facets in the polygon cross section. Defaults to 6. A higher number of facets improves visual smoothness at the cost of plotting speed, performance and memory. |
normals |
Export surface normals per vertex. Defaults to FALSE. |
alpha |
Set the transparency of the cylinders used in the "ply" format. Defaults to 1. 1 is opaque and 0 is fully transparent. |
Value
A mesh file
Examples
## Load QSM
file <- system.file("extdata/QSM.mat", package = "rTwig")
qsm <- import_treeqsm(file)
cylinder <- qsm$cylinder
cylinder <- update_cylinders(cylinder)
# PLY
filename <- tempfile(pattern = "QSM_ply")
export_mesh(
cylinder = cylinder,
filename = filename,
format = "ply",
color = "distanceToTwig",
palette = "viridis",
normals = TRUE
)
# OBJ
filename <- tempfile(pattern = "QSM_obj")
export_mesh(
cylinder = cylinder,
filename = filename,
format = "obj",
normals = TRUE
)
# STL
filename <- tempfile(pattern = "QSM_stl")
export_mesh(
cylinder = cylinder,
filename = filename,
format = "stl",
normals = TRUE
)
# QSM Blender Addons
filename <- tempfile(pattern = "QSM_blender")
export_mesh(
cylinder = cylinder,
filename = filename,
format = "blender",
normals = TRUE
)