Learn R Programming

⚠️There's a newer version (1.8.24) of this package.Take me there.

nat: NeuroAnatomy Toolbox

An R package for the (3D) visualisation and analysis of biological image data, especially tracings of single neurons. nat is the core package of a wider suite of neuroanatomy tools introduced at http://natverse.github.io. nat (and its ancestors) have been used in a number of papers from our group including:

Quick Start

For the impatient ...

# install
install.packages("nat")
# use
library(nat)

# plot some test data (?kcs20 for details)
# Drosophila Kenyon cells processed from raw data at http://flycircuit.tw
head(kcs20)
open3d()
plot3d(kcs20, col=type)
# get help
?nat

Installation

A confirmed stable version of nat can be installed from CRAN.

install.packages("nat")

However, nat remains under quite active development, so if you will be using nat extensively, we generally recommend installing the latest development version directly from github using the devtools package.

# install devtools if required
if (!requireNamespace("devtools")) install.packages("devtools")
# then install nat
devtools::install_github("natverse/nat")

Learn

To get an idea of what nat can do:

When you're ready to learn more:

Help

If you want some help using nat:

  • For installation issues, see the Installation vignette
  • Contact nat-user Google group - we normally respond promptly and you will also be helping future users.

If you think that you have found a bug:

  • Install the development version of nat using devtools (see above) and see if that helps.
  • Check the github issues and

Thanks for your interest in nat!

Copy Link

Version

Install

install.packages('nat')

Monthly Downloads

387

Version

1.8.23

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Gregory Jefferis

Last Published

August 25th, 2023

Functions in nat (1.8.23)

clampmax

Return function that finds maximum of its inputs within a clamping range
c.neuronlist

Combine multiple neuronlists into a single list
cmtk.version

Return cmtk version or test for presence of at least a specific version
cmtk.extract_affine

Extract affine registration from CMTK registration file or in-memory list
cmtk.targetvolume

Defines a target volume for a CMTK reformatx operation
cmtk.dof2mat

Convert CMTK registration to homogeneous affine matrix with dof2mat
cmtk.statistics

Calculate image statistics for a nrrd or other CMTK compatible file
MBL.surf

Surface object (hxsurf) for the left mushroom body in FCWB template space
all.equal.neuron

Check equality on key fields of neuron object
cmtk.call

Utility function to create and run calls to CMTK commandline tools
as.neuronlist.neuronlistfh

convert neuronlistfh to a regular (in memory) neuronlist
boundingbox

Get the bounding box of an im3d volume or other compatible object
image.im3d

Method to plot spatially calibrated image arrays
imexpand.grid

Convert locations of im3d voxel grid into XYZ coordinates
im3d-io

Read/Write calibrated 3D blocks of image data
im3d

Construct an im3d object representing 3D image data, densities etc
cmtkparams2affmat

Compose homogeneous affine matrix from CMTK registration parameters
amiratype

Return the type of an amiramesh file on disk or a parsed header
read.amiramesh

Read AmiraMesh data in binary or ascii format
cmtkreg

Create and test cmtkreg objects that specify path to a CMTK registration
is.swc

Test if a file is an SWC format neuron
graph.nodes

Return root, end, or branchpoints of an igraph object
ind2coord

Find XYZ coords corresponding to 1D indices into a 3D image
im3d-coords

Interconvert pixel and physical coordinates
intersect

Find the intersection of two collections of objects
nat-package

Analyse 3D biological image data especially neurons
cmtk.mat2dof

Use CMTK mat2dof to convert homogeneous affine matrix into CMTK registration
cmtk.reformatx

Reformat an image with a CMTK registration using the reformatx tool
ndigest

Calculated normalised digest value for an object
find.neuron

Find neurons within a 3D selection box (usually drawn in rgl window)
find.soma

Find neurons with soma inside 3D selection box (usually drawn in rgl window)
imscalebar

Make a scalebar to accompany an image.im3d plot
materials

Extract or set the materials for an object
is.vaa3draw

Check if a file is in the raw image format used by Hanchuan Peng's Vaa3D
ngraph

ngraph: a graph to encode a neuron's connectivity
nlapply

lapply and mapply for neuronlists (with optional parallelisation)
mirror

Mirror 3D object about a given axis, optionally using a warping registration
*.neuronlist

Arithmetic for neuron coordinates applied to neuronlists
nrrd.voxdims

Return voxel dimensions (by default absolute voxel dimensions)
as.mesh3d

Convert an object to an rgl mesh3d
as.neuronlist

Make a list of neurons that can be used for coordinate plotting/analysis
is.neuronlist

Test objects of neuronlist class to store multiple neurons
imslice

Slice out a 3D subarray (or 2d matrix) from a 3D image array
neuronlist-dataframe-methods

Methods for working with the dataframe attached to a neuronlist
is.nrrd

Check if a file is a NRRD file
plot3d.cmtkreg

Plot the domain of a CMTK registration
nvertices

Find the number of vertices in an object (or each element of a neuronlist)
plot3d.boundingbox

Plot a bounding box in 3D
projection

Make 2D (orthogonal) projection of 3D image data
nlscan

Scan through a set of neurons, individually plotting each one in 3D
normalise_swc

Normalise an SWC format block of neuron morphology data
npop3d

Remove plotted neurons or other 3D objects
prune

prune an object by removing points near (or far) from a target object
*.neuron

Arithmetic for neuron coordinates
read.hxsurf

Read Amira surface (aka HxSurface or HyperSurface) files into hxsurf object
read.landmarks

Generic functions to read/write landmarks in any supported format
nopen3d

Open customised rgl window
nview3d

Set the 3D viewpoint of an RGL window using anatomical terms
read.neuron.swc

Read a neuron in swc file format
read.neuronlistfh

Read a local, or remote, neuronlistfh object saved to a file.
coord2ind

Find 1D indices into a 3D image given spatial coordinates
smooth_neuron

Smooth the 3D coordinates of a neuron skeleton
plot3d.dotprops

3D plots of dotprops objects using rgl package
spine

Compute the longest path (aka spine or backbone) of a neuron
cmtkreglist

Make in-memory CMTK registration list from affine matrix or CMTK parameters
dotprops

dotprops: Neurons as point clouds with tangent vectors (but no connectivity)
fileformats

Set or return list of registered file formats that we can read
flip

Flip an array, matrix or vector about an axis
*.dotprops

Arithmetic for dotprops objects
read.morphml

Return parsed XML or R list versions of a NeuroML file
is.im3d

Test if an object is of class im3d
plot3d.hxsurf

Plot amira surface objects in 3D using rgl
neuron

neuron: class to represent traced neurons
read.neuron

Read a single neuron from a file
subset.hxsurf

Subset hxsurf object to specified regions
subset.dotprops

Subset points in dotprops object that match given conditions
voxdims

Return voxel dimensions of an object
is.neuroml

Check whether a file is in NeuroML format
pan3d

Some useful extensions / changes to rgl defaults
plot.neuron

Plot a 2D projection of a neuron
prune_strahler

Prune a neuron by removing segments with a given Strahler order
as.data.frame.neuronlist

Get or set the attached data.frame of a neuronlist
prune_vertices

Prune selected vertices or edges from a neuron
rootpoints

Return the root or branch points of a neuron or graph
is.fijitraces

Check whether a file is in Fiji's simple neurite tracer format
is.amiramesh

Check if file is amiramesh format
plot.neuronlist

2D plots of the elements in a neuronlist, optionally using a subset expression
read.nrrd

Read nrrd file into an array in memory
read.neurons

Read one or more neurons from file to a neuronlist in memory
seglengths

Calculate length of all segments in neuron
plot3d

plot3d methods for different nat objects
seglist

Make/convert neuron connectivity information into a seglist object
scale.neuron

Scale and centre neuron 3D coordinates
write.amiramesh

Write a 3D data object to an amiramesh format file
xformpoints

Transform 3D points using a registration, affine matrix or function
plot3d.neuron

Plot neurons in 3D using rgl library
kcs20

List of 20 Kenyon Cells from Chiang et al 2011 converted to dotprops objects
xyzmatrix

Get and assign coordinates for classes containing 3D vertex data
plot3d.neuronlist

3D plots of the elements in a neuronlist, optionally using a subset expression
read.cmtkreg

Read a CMTK format registration
read.cmtk

Read CMTK TypedStream file to a list in memory
summary.neuronlist

Summary statistics for neurons (e.g. cable length, number of nodes)
read.vaa3draw

Read Vaa3d format image data
potential_synapses

Calculate number of potential synapses between two neurons
pointsinside

Find which points of an object are inside a surface
[.neuronlistfh

Extract from neuronlistfh object or its attached data.frame
strahler_order

Find the Strahler order of each point in a neuron
write.cmtk

Write a suitable list to a CMTK TypedStream file on disk
reglist

A simple wrapper class for multiple transformations
union

Find the union of two collections of objects
read.neuron.fiji

Read a neuron saved by Fiji's Simple Neurite Tracer Plugin
unmask

Make im3d image array containing values at locations defined by a mask
threshold

Threshold an object, typically to produce a mask
write.hxsurf

Write Amira surface (aka HxSurface or HyperSurface) into .surf file.
neuronlistfh

neuronlistfh - List of neurons loaded on demand from disk or remote website
mask

Mask an object, typically to produce a copy with some values zeroed out
neuronlist

Create a neuronlist from zero or more neurons
write.cmtkreg

Write out CMTK registration list to folder
origin

Return the space origin of a 3D image object
subset

Subset methods for different nat objects
write.neuron

Write out a neuron in any of the file formats we know about
xform

Transform the 3D location of objects such as neurons
xformimage

Transform image files using a registration or affine matrix
read.neuron.neuroml

Read one or more neurons from a NeuroML v1 file
sub2ind

Find 1D index given n-dimensional indices
setdiff

Find the (asymmetric) difference between two collections of objects
simplify_reglist

Simplify a registration list
remotesync

Synchronise a remote object
write.nrrd

Write data and metadata to NRRD file or create a detached NRRD (nhdr) file.
write.vtk

Write object to VTK file
resample

Resample an object with a new spacing
seglist2swc

Recalculate Neurons's SWCData using SegList and point information
segmentgraph

Return a simplified segment graph for a neuron
write.neuronlistfh

Write out a neuronlistfh object to an RDS file
subset.neuron

Subset neuron by keeping only vertices that match given conditions
write.neurons

Write neurons from a neuronlist object to individual files, or a zip archive
subset.neuronlist

Subset neuronlist returning either new neuronlist or names of chosen neurons
as.im3d

Convert a suitable object to an im3d object.
as.hxsurf

Convert an object to a nat hxsurf object
all.equal.dotprops

all.equal method tailored to dotprops objects
affmat2cmtkparams

Decompose homogeneous affine matrix to CMTK registration parameters
all.equal.im3d

Check equality on data and key attributes of im3d objects
Cell07PNs

Cell07PNs: 40 Sample Projection Neurons from Jefferis, Potter et al 2007
cmtk.bindir

Return path to directory containing CMTK binaries