Fetch a mesh volume from CATMAID

catmaid_get_volume(x, rval = c("mesh3d", "catmaidmesh", "raw"),
  invertFaces = FALSE, conn = NULL, pid = 1, ...)

Arguments

x

The integer volume id or character volume name

rval

The class to return.

invertFaces

Whether to invert the faces (swapping inside and outside, see details).

conn

the catmaid_connection object

pid

project id (default 1)

...

Additional arguments passed to the catmaid_fetch function.

Value

When rval mesh3d, the standard format used by the rgl and nat packages is the default. catmaidmesh is a tidy version of the mesh format used by catmaid. raw will allow any return value.

Details

Note that if x is a volume name as a character vector then it must be unique (something that CATMAID servers do not insist on).

Note also that this function is targeted at mesh volumes, but CATMAID also support box volumes - these can still be returned and will have a valid set of vertices but an invalid set of indices.

I have noticed that some CATMAID meshes are returned with the normals facing into the mesh (the opposite of what one would expect). This causes pointsinside to do the opposite of what one would expect. Use invertFaces=TRUE to fix this.

See also

catmaid_get_volumelist, catmaid_add_volume, as.catmaidmesh, mesh3d, hxsurf, shapelist3d

Examples

# NOT RUN {
v375=catmaid_get_volume(375)
v13.AL_R=catmaid_get_volume("v13.AL_R")
shade3d(v13.AL_R, col='red', alpha=.3)

if(require("Morpho")) {
  plotNormals(facenormals(v13.AL_R), long=5e3)
}

# find surfaces for olfactory glomeruli
vl=catmaid_get_volumelist()
glomids=vl$id[grepl("_glomerulus$", vl$name)]
# fetch them all
gg=lapply(glomids, catmaid_get_volume)
# ... and plot
mapply(shade3d, gg, col=rainbow(length(gg)))

# alternatively wrap them all in an rgl shapelist3d, plotting each object
sl=shapelist3d(gg, col=rainbow(length(gg)), plot=TRUE)

# }