obj2vtk: obj2vtk

View source: R/obj2vtk.R

obj2vtkR Documentation

obj2vtk

Description

Batch-converts OBJ mesh files into VTK mesh files

Usage

obj2vtk(files = NULL, ID = NULL, vtk_path = NULL, print.progress = TRUE)

Arguments

files

Optional parameter indicating where to save the VTK files. The default is the current directory.

ID

optional vector with IDs used for saving the VTK meshes. Default is the same name as the OBJ meshes

print.progress

optional parameter indicating whether to print the progress

Details

Takes a a list of OBJ meshes and transforms those files into VTK. For more information check the R package _freesurferformats_ (Schäfer, 2020)

Value

This function returns a table with the meshes information (name, number of faces and vertices) and the volume for each surface mesh.

Author(s)

Marta Vidal-Garcia

References

Schlager S (2017). “Morpho and Rvcg - Shape Analysis in R.” In Zheng G, Li S, Szekely G (eds.), _Statistical Shape and Deformation Analysis_, 217-256. Academic Press. ISBN 9780128104934. Tim Schäfer (2020). freesurferformats: Read and Write 'FreeSurfer' Neuroimaging File Formats. R package version 0.1.10. https://CRAN.R-project.org/package=freesurferformats

Examples

# Convert all OBJ meshes to VTK meshes
setwd("./data")
dir(pattern = "*.obj")
obj2vtk(files = NULL, ID = NULL, vtk_path = NULL, print.progress = TRUE)
setwd("../")

# Convert a subset OBJ meshes to VTK meshes, and change ID
setwd("./data")
files_obj <- dir(pattern = "*.obj")[1:2]
ID_vtk <- c("specimen1", "specimen2")
obj2vtk(files = files, ID = NULL, vtk_path = NULL, print.progress = TRUE)
setwd("../")


marta-vidalgarcia/mesh_process documentation built on May 7, 2022, 12:08 a.m.