R/catmaid-package.R
, R/catmaid.R
catmaid-package.Rd
This package provide access to the API exposed by the CATMAID (C ollaborative A nnotation T oolkit for M assive A mounts of I mage D ata) web tool. This includes a bridge to the neuroanatomy toolbox (R package nat), thereby allowing analysis and visualisation of neuronal skeletons.
To use, first call catmaid_login
to authenticate to a catmaid
server. You can then use functions such as
catmaid_get_neuronnames
or
catmaid_get_compact_skeleton
to query the server. You can also
roll your own server queries using the low-level catmaid_fetch
command.
By default all query functions will use the
server/authentication details specified by the last successful call to
catmaid_login
unless a catmaid_connection
object is provided as an argument.
See catmaid_login
for details of the
environment variables that can be set to specify default login values. It
makes sense to set these in your .Renviron
file if you
regularly use a specific CATMAID server. Note that you can have different
.Renviron
files in the home folder of different Rstudio projects if
you regularly use more than one CATMAID server. Note that the use of
environment variables is now preferred over setting R options.
Unit tests can be run as per the examples section below.
In order to do live tests you will need to set environment variables with
your catmaid login credentials using the function
catmaid_connection_setenv
.
The first version of this package was based in large part on python code at https://github.com/schlegelp/CATMAID-to-Blender/blob/master/CATMAIDImport.py. See http://catmaid.org for further details about CATMAID and https://github.com/acardona/CATMAID/blob/master/django/applications/catmaid/urls.py for a list of URLs that the web API accepts.
Useful links:
if (FALSE) {
## test package
library(catmaid)
library(testthat)
test_package("catmaid")
## same but use appropriate login info
conn=catmaid_login(server="https://myserver.com", user="calvin", password='hobbes')
## alternatively, login using an API token
# see http://catmaid.github.io/dev/api.html#api-token for how to get one
conn=catmaid_login(server="https://myserver.com",
token = "9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b")
catmaid_connection_setenv(conn)
test_package("catmaid")
}