Fetch position and other information for arbitrary treenode ids

catmaid_get_treenodes_detail(tnids = NULL, labels = NULL,
  skids = NULL, pid = 1, conn = NULL, raw = FALSE, ...)

Arguments

tnids

One or more (integer) treenode ids

labels

One or more (character) labels with which nodes must be tagged

skids

One or more skeleton ids or an expression compatible with catmaid_skids (see Details for advice re many skids)

pid

project id (default 1)

conn

the catmaid_connection object

raw

Whether to return completely unprocessed data (when TRUE) or to convert the nodes and connectors lists into processed data.frames (when FALSE, the default)

...

Additional arguments passed to the catmaid_fetch function.

Value

  • treenode_id,

  • parent_id,

  • x,

  • y,

  • z,

  • confidence,

  • radius,

  • skid,

  • edition_time,

  • user_id

Details

The key feature of this function is that allows you to fetch information for arbitrary tree nodes that do not need to be from the same skeleton. Furthermore the nodes can be defined by the presence of labels (tags) or by a skeleton id. labels and skids specifiers can be combined in order e.g. to find details for the somata for a given set of skeleton ids. However these queries are slow for more than a few hundred skids, at which point it is better to fetch using the label and then filter by skid post hoc in R.

See also

Examples

# \donttest{ # details for 3 nodes from two different skeletons catmaid_get_treenodes_detail(c(9943214L, 25069047L, 12829015L))
#> treenode_id parent_id x y z confidence radius skid #> 1 9943214 9943217 419085 175627 120280 5 -1 4116825 #> 2 25069047 25069046 426264 244230 143920 5 -1 7138957 #> 3 12829015 12829013 442500 147757 175160 5 -1 3821611 #> edition_time user_id #> 1 1498514622 113 #> 2 1521466478 134 #> 3 1496347172 150
# example label search tosoma=catmaid_get_treenodes_detail("to soma")
#> Error in catmaid_fetch(path, body = body, conn = conn, simplifyVector = T, ...): Bad Request (HTTP 400).
# } if (FALSE) { # If you have a lot of skids to query you will need to break up your queries # into smaller chunks. You could do this like so: catmaid_get_treenodes_detail_chunked <- function(skids, chunksize=300, chunkstoread=NULL, ...) { nchunks=ceiling(length(skids)/chunksize) chunks=rep(seq_len(nchunks), rep(chunksize, nchunks))[seq_along(skids)] l=list() if(is.null(chunkstoread)) chunkstoread=seq_len(nchunks) pb <- progress::progress_bar$new(total = length(skids), format = " :current/:total [:bar] eta: :eta", show_after=1) for(i in chunkstoread) { pb$tick(len = sum(chunks==i)) l[[length(l)+1]]=catmaid_get_treenodes_detail(skids=skids[chunks==i], ...) } dplyr::bind_rows(l) } }