catmaid_get_volume | R Documentation |
Fetch a mesh volume from CATMAID
catmaid_get_volume( x, rval = c("mesh3d", "catmaidmesh", "raw"), invertFaces = FALSE, conn = NULL, pid = 1, ... )
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 |
pid |
project id (default 1) |
... |
Additional arguments passed to the |
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.
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.
catmaid_get_volumelist
,
catmaid_add_volume
, as.catmaidmesh
,
mesh3d
, hxsurf
,
shapelist3d
## NB all these examples refer to the FAFB adult Drosophila brain ## CATMAID instance fafbconn=vfbcatmaid("fafb") v14.neuropil=catmaid_get_volume('v14.neuropil', conn=fafbconn) # specifying by name is easier / less fragile than numeric ids ## Not run: AL_R=catmaid_get_volume("AL_R", conn=fafbconn) shade3d(AL_R, col='red', alpha=.3) if(require("Morpho")) { plotNormals(facenormals(AL_R), length=5e3) } ## Fetch MB surfaces vl=catmaid_get_volumelist(conn=fafbconn) mbids=vl$id[grepl("^MB_", vl$name)] mbsurfs=lapply(mbids, catmaid_get_volume, conn=fafbconn) # ... and plot mapply(shade3d, mbsurfs, col=rainbow(length(mbsurfs))) ## find surfaces for olfactory glomeruli # not currently present in the catmaid FAFB glomids=vl$id[grepl("v14.[DV][MLAPC]{0,1}[0-9]{0,1}[dvaplm]{0,1}$", vl$name)] # fetch them all gg=lapply(glomids, catmaid_get_volume, conn=fafbconn) # ... 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) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.