Giter VIP home page Giter VIP logo

nat.jrcbrains's Introduction

nat.jrcbrains

natverse Docs Travis build status

nat.jrcbrains allows bridging registrations for Drosophila brains from Janelia Research Campus to be used with the NeuroAnatomy Toolbox suite of R packages.

Installation

You can install the development version of nat.jrcbrains from GitHub using the remotes package (part of devtools):

if (!requireNamespace("remotes")) install.packages("remotes")
remotes::install_github('natverse/nat.jrcbrains')

Example

You must first download the registrations you want from

This is most easily done as follows:

library(nat.jrcbrains)
download_saalfeldlab_registrations()

To run this example you will need JRC 2018 Female - JFRC 2010, which is included as one of the downloaded bridging registrations since v0.3.1

library(nat.jrcbrains)
library(nat.templatebrains)
# sample neurons in JFRC2 space
pd2a = read.neurons("https://ars.els-cdn.com/content/image/1-s2.0-S0896627318307426-mmc5.zip")
# note use of via argument to insist on higher quality bridging registration
# to FAFB14
pd2a.fafb14=xform_brain(pd2a, sample=JFRC2, reference="FAFB14", via=c("FAFB14um"))

Registration Formats

By default nat.jrcbrains will use registrations in the Saalfeld h5 format. As an end user, support for these registrations should be installed transparently when you install nat.jrcbrains.

ANTs format registrations

If you intend to use registrations in ANTs format, then you will need to install the suggested nat.ants package. This is turn has additional dependencies that can be hard to install. See the README for https://github.com/jefferis/nat.ants for details but essentially doing

source("https://neuroconductor.org/neurocLite.R")
neuro_install("ANTsRCore")
remotes::install_github("jefferis/nat.ants")

should do the trick.

Acknowledgements

This is a thin wrapper to allow convenient download and application of bridging registrations developed by John Bogovic in Stephan Saalfeld's lab at Janelia. See:

An unbiased template of the Drosophila brain and ventral nerve cord. John A Bogovic, Hideo Otsuna, Larissa Heinrich, Masayoshi Ito, Jennifer Jeter, Geoffrey Meissner, Aljoscha Nern, Jennifer Colonell, Oz Malkesman, Kei Ito, Stephan Saalfeld bioRxiv 376384; doi:10.1101/376384

for details and additional downloads. Please cite their paper if you make use of these registrations.

In addition if you make use of the infrastructure in this and other natverse packages, we would be grateful if you would cite:

The natverse, a versatile toolbox for combining and analysing neuroanatomical data. A. S. Bates and J. D. Manton and S. R. Jagannathan and M. Costa and P. Schlegel and T. Rohlfing and G. S. X. E. Jefferis. eLife 9. doi:10.7554/eLife.53350

You can also get citation information from inside R for the natverse or individual packages like so:

citation('natverse')
citation('nat.jrcbrains')

Your citations will help support future tool development by the Saalfeld lab and ourselves.

nat.jrcbrains's People

Contributors

jefferis avatar sridharjagannathan avatar

Watchers

 avatar  avatar  avatar

nat.jrcbrains's Issues

Implement `download_saalfeldlab_registrations`

Implement the function download_saalfeldlab_registrations to automatically download the transformations (.nii) for the jrc-2018-brain-templates and put them into proper folder names. Also consider adding the (.h5) formats for the registrations as well.

Switch to h5 registrations (supported by nat.h5reg)

We should switch to nat.h5reg as the default format / support package. This is easier to install and more accurate than ANTs (although it does not support transforms of image data yet). Furthermore Stephan and John are adopting this h5 format as their canonical form.

Only download missing registration files

If we stored headers next to downloaded files, we should be able to use this header to check if remote file is new or not.

> h1=httr::HEAD("https://ndownloader.figshare.com/files/12919949?private_link=85b2f2e4f479c94441f2")
 httr::headers(h1)
[snip ...]
$`x-amz-version-id`
[1] "SvNuj35Vt3qah0Nq3VCneHUyZ9Sa_EeQ"

Can't find the registration

Dear all,

I am trying to use nblast on Ubuntu. After solving a lot of dependency problem, I was finally at the step of xform_brain. I got an error retrun from the function:

`Error in value[[3L]](cond) : 
  Unable to find bridging registration between JRC2018F and JRCFIB2018F`

I reinstall the nat.jrcbrain and download saalfeldlab_registrations, but it only finish the 6 downloads without re-do the registration.
So I tried register_saalfeldlab_registrations() manually, and it returns:

`Adding h5reg in forward direction
Adding h5reg in reverse direction
Adding h5reg in forward direction
Adding h5reg in reverse direction
Adding h5reg in forward direction
Adding h5reg in reverse direction
Adding h5reg in forward direction
Adding h5reg in reverse direction
Adding h5reg in forward direction
Adding h5reg in reverse direction
Adding h5reg in forward direction
Adding h5reg in reverse direction

/home/jiajun/.local/share/R/nat.jrcbrains/JRC2018F_FAFB
TRUE

/home/jiajun/.local/share/R/nat.jrcbrains/JRC2018F_FCWB
TRUE

/home/jiajun/.local/share/R/nat.jrcbrains/JRC2018F_JFRC2010
TRUE

/home/jiajun/.local/share/R/nat.jrcbrains/JRC2018F_JFRC2013
TRUE

/home/jiajun/.local/share/R/nat.jrcbrains/JRC2018F_JRCFIB2018F
TRUE

/home/jiajun/.local/share/R/nat.jrcbrains/JRC2018U_JRC2018F
TRUE

Warning messages:
1: In doTryCatch(return(expr), name, parentenv, handler) :
display list redraw incomplete
2: In doTryCatch(return(expr), name, parentenv, handler) :
invalid graphics state
3: In doTryCatch(return(expr), name, parentenv, handler) :
invalid graphics state`

I also tried plot(bridging_graph(),vertex.size=15,edge.arrow.size =.5), the figure looks pretty normal.

I also got a notification when I do library(nat.jrcbrains) that I don't have extra transformation. And I got a no TLS stream available error when I tried download_jefferislab_registrations().

I really don't know what to do now. Could you give me any advice on my problem? Thank you in advance!

Best,
Jiajun

Add support for JFRC2/JFRC2010 template brain

@bogovicj has made a bridging registration from JRC2018F to JFRC2010. JFRC2010 is normally considered an alias for JFRC2, the VFB template. However for somewhat obscure reasons the template that John was given at Janelia had a 1µm spacing in Z whereas the one that is available externally has isotropic voxel size 0.622088 µm.

The simplest way that I have found to deal with this is to treat JFRC2010 and JFRC2 as different templates and to add an affine bridging registration between the two to handle this anisotropic scale difference. Unfortunately this means that registration paths involving this template are 1 step longer than they should be.

This is compounded by a somewhat similar issue with the FAFB14 brain (which must be rescaled from nm to µm) meaning that the FAFB14-JFRC2 is two steps longer than necessary. Until xform_brain and friends become more intelligent e.g. natverse/nat#387 and natverse/nat.templatebrains#46 the best workaround is to specify JFRC2010 in the via argument:

# make sure you start a clean R session
library(nat.jrcbrains)
library(catmaid)
vfb=catmaid_login(server="https://fafb.catmaid.virtualflybrain.org")
da1pns=read.neurons.catmaid('name:DA1', conn=vfb)
# new path
da1pns.jfrc2v1<- xform_brain(da1pns, reference=JFRC2, sample="FAFB14", via = c("FAFB14um", 'JFRC2010'))
# best that has been available until now
da1pns.jfrc2v2<- xform_brain(da1pns, reference=JFRC2, sample="FAFB14", via = c("FAFB14um", "JFRC2013"))
nopen3d()
plot3d(JFRC2)
plot3d(da1pns.jfrc2v1, col='red')
plot3d(da1pns.jfrc2v2, col='green')
nview3d('frontal', zoom=.6)

# to watch out for, the elmr package can give a low quality registration
library(elmr)
da1pns.jfrc2v3<- xform_brain(da1pns, reference=JFRC2, sample="FAFB14", via = "JFRC2013")
plot3d(da1pns.jfrc2v3, col='blue')

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.