catmaid_get_treenodes_detail: Fetch position and other information for arbitrary treenode...

View source: R/catmaid_skeleton.R

catmaid_get_treenodes_detailR Documentation

Fetch position and other information for arbitrary treenode ids

Description

Fetch position and other information for arbitrary treenode ids

Usage

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.

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.

Value

  • treenode_id,

  • parent_id,

  • x,

  • y,

  • z,

  • confidence,

  • radius,

  • skid,

  • edition_time,

  • user_id

See Also

catmaid_get_treenode_table, catmaid_get_connectors, catmaid_get_compact_skeleton

Examples


# details for 3 nodes from two different skeletons
catmaid_get_treenodes_detail(c(9943214L, 25069047L, 12829015L))

# example label search
tosoma=catmaid_get_treenodes_detail(labels="to soma")


## Not run: 
# 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)
}


## End(Not run)

jefferis/rcatmaid documentation built on Aug. 16, 2022, 8:52 p.m.