vcgIsosurface: Create Isosurface from 3D-array

Description Usage Arguments Value Examples

View source: R/vcgIsosurface.r

Description

Create Isosurface from 3D-array using Marching Cubes algorithm

Usage

1
2
3
vcgIsosurface(vol, threshold, from = NULL, to = NULL, spacing = NULL,
  origin = NULL, direction = NULL, IJK2RAS = diag(c(-1, -1, 1, 1)),
  as.int = FALSE)

Arguments

vol

an integer valued 3D-array

threshold

threshold for creating the surface

from

numeric: the lower threshold of a range (overrides threshold)

to

numeric: the upper threshold of a range (overrides threshold)

spacing

numeric 3D-vector: specifies the voxel dimensons in x,y,z direction.

origin

numeric 3D-vector: origin of the original data set, will transpose the mesh onto that origin.

direction

a 3x3 direction matrix

IJK2RAS

4x4 IJK2RAS transformation matrix

as.int

logical: if TRUE, the array will be stored as integer (might decrease RAM usage)

Value

returns a triangular mesh of class "mesh3d"

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#this is the example from the package "misc3d"
x <- seq(-2,2,len=50)
g <- expand.grid(x = x, y = x, z = x)
v <- array(g$x^4 + g$y^4 + g$z^4, rep(length(x),3))
storage.mode(v) <- "integer"
## Not run: 
mesh <- vcgIsosurface(v,threshold=10)
require(rgl)
wire3d(mesh)
##now smooth it a little bit
wire3d(vcgSmooth(mesh,"HC",iteration=3),col=3)

## End(Not run)

zarquon42b/Rvcg documentation built on Jan. 17, 2019, 9:10 a.m.