CGTalk > Software Specific Forums > Maxon Cinema 4D
Login register
Thread Closed share thread « Previous Thread | Next Thread »
 
Thread Tools Search this Thread Display Modes
Old 05-15-2013, 02:48 PM   #1
NWoolridge
Expert
 
NWoolridge's Avatar
 
Join Date: Aug 2002
Posts: 701
Free, accurate neuron building script

Hi all,

I realized I han't let people here know about this; Earlier this year I wrote a python script to allow C4D users to import neuron morphology data and automatically create accurate spline-based 3D models of nerve cells, based on data collected by scientists from a number of different species (including humans).

I've open-sourced the script and made it available at:

https://github.com/NWoolridge/NeuronBuild

Just download the NeuronBuild_1.5.py file and place it in your scripts location (or copy and paste the text of the script into your script editor). You will need to browse and download some neuron morphology files from:

http://neuromorpho.org/

My thanks to Graham Johnson for catching some bugs and improving the script...


A simple pyramidal neuron on the left, and a more complex basket cell on the right.



From the ReadMe:

A script to import swc files downloaded from neuromorpho.org, and create accurate spline-based models of neuronal structure. The original swc file format is detailed here:

Cannon, R.C, Turner, D.A, Pyapali, G.K, Wheal, H.V. An on-line archive of reconstructed hippocampal neurons. Journal of Neuroscience Methods. 84 1–2. pp 49-54. 1998

The reconstruction units are μm (micrometers). Note: soma (cell body) definitions vary from file to file; this script assumes a three point spline (which is very common). The soma object is disabled by default, since they rarely produce acceptable geometry. Note: use of neuromorpho files may come with an obligation to cite the original publication.

How to use:

- add to your C4D scripts folder (on Mac OS X: Applications/MAXON/CINEMA 4D R14/library/scripts or in the user prefs folder)
- Browse and download a .swc or .swc.txt file from http://neuromorpho.org/
- Open the script manager in C4D, the script should be in the pop-up menu at the top of the window.
- In the Script manager in C4D load the NeuronBuild script and click "Execute".
An import options dialog should appear; choose options for imported geometry, and click "Import File".
- In the open file dialog, choose the swc file and click "OK".
- A neuron should appear in your viewport.

If all the geometry options are chosen, the geometry consists of a HyperNURBs object, which contains a Connect object, which contains a null object, which contains the sweep objects that define the axons and dendrites. Since the Soma (cell body) definition in the swc files is so rudimentary, you may want to delete or hide it, and let the soma be defined by the merging dendrite roots. Within the sweep objects are n-sided splines (named "Profile") set to 6-sides; you could search for these objects and change the number of sides to 4 to simplify the geometry. Also in the SweepNURBs objects are the splines that define the dendrite paths, and rail splines that define their radius.
 
Old 05-15-2013, 03:24 PM   #2
JoelOtron
Lard of the pots
portfolio
Joel Dubin
Creative Director
MadMicrobe
USA
 
Join Date: Aug 2002
Posts: 6,512
Great job Nick
 
Old 05-15-2013, 03:43 PM   #3
deepshade
Expert
portfolio
Paul T
United Kingdom
 
Join Date: Aug 2008
Posts: 1,242
Looks like a lot of work went into this.

Appreciated - thank you

Last edited by deepshade : 05-16-2013 at 01:34 AM.
 
Old 05-15-2013, 04:14 PM   #4
jerm
Know-it-All
 
jerm's Avatar
Jeremy Solterbeck
USA
 
Join Date: May 2003
Posts: 334
Worked great! Thanks, really interesting Nick.
 
Old 05-15-2013, 04:18 PM   #5
ThePriest
Bad Ass
 
ThePriest's Avatar
portfolio
Stuart Townsend
Environment artist
Berkeley, USA
 
Join Date: Jun 2005
Posts: 2,545
Cool. Might experiment with this later.
__________________
۩PRIST

 
Old 05-15-2013, 04:23 PM   #6
ScientiaViz
PRO
 
ScientiaViz's Avatar
portfolio
Arik Thuesen
USA
 
Join Date: Feb 2013
Posts: 124
Very cool, Nick!
A big THANK YOU!

edit: Having fun! Rat cells on cloners.
Some of the dendrites aren't quite completing the connection. Is that a setting or a data problem, Nick?
Attached Images
File Type: jpg WoolridgeNeuronBuilder1.jpg (97.6 KB, 125 views)

Last edited by ScientiaViz : 05-16-2013 at 06:01 PM.
 
Old 05-15-2013, 04:27 PM   #7
Gary3fx
New Member
Gary
Medical animation specialist
3fx
Elkins Park PA, USA
 
Join Date: Oct 2006
Posts: 10
Great work!

Thanks for making this script free Nick, a nice tool to help harness vast amounts of scientific neuron data available online. A very elegant solution indeed.
Attached Images
File Type: jpg Dopaminergic_.jpg (13.7 KB, 155 views)
 
Old 05-15-2013, 04:51 PM   #8
NWoolridge
Expert
 
NWoolridge's Avatar
 
Join Date: Aug 2002
Posts: 701
Quote:
Originally Posted by Gary3fx
Thanks for making this script free Nick, a nice tool to help harness vast amounts of scientific neuron data available online. A very elegant solution indeed.


Hi Gary,

And thank you for alerting me to the existence of neuromorpho.org in the first place!
 
Old 05-15-2013, 05:37 PM   #9
AdamT
oh ... what?
 
AdamT's Avatar
Adam Trachtenberg
Modeler, Animator, Attorney
3D Anvil
Miami, USA
 
Join Date: Jun 2002
Posts: 10,464
Thanks, Nick. This is very cool!
 
Old 05-15-2013, 06:55 PM   #10
celke
Frequenter
portfolio
Carsten Elke
Switzerland
 
Join Date: Aug 2008
Posts: 106
That is great. Thanks a lot.

cheers

celke
 
Old 05-16-2013, 01:05 PM   #11
Carl007
Expert
portfolio
Flâneur
 
Join Date: Oct 2002
Posts: 237
Thank you very much!

Weird shit those neurons....
 
Old 05-16-2013, 06:39 PM   #12
cubeman
PRO
portfolio
Manfred Kostka
Hamburg, Germany
 
Join Date: Jan 2009
Posts: 185
This is just amazing! Thank you, Nick!

Cube
 
Old 05-16-2013, 11:40 PM   #13
NWoolridge
Expert
 
NWoolridge's Avatar
 
Join Date: Aug 2002
Posts: 701
Quote:
Originally Posted by ScientiaViz
Having fun! Rat cells on cloners.
Some of the dendrites aren't quite completing the connection. Is that a setting or a data problem, Nick?


Hmm, I'm not sure... Could you upload or point to the data file that's giving you problems? I tested on a range of different files, but I easily could have missed some edge case....
 
Old 05-17-2013, 12:04 AM   #14
ScientiaViz
PRO
 
ScientiaViz's Avatar
portfolio
Arik Thuesen
USA
 
Join Date: Feb 2013
Posts: 124
Thanks Nick.
The Amaral file I downloaded was named c12971.CNG.swc.
If you want I can email my C4D file.
-A
 
Old 05-17-2013, 01:20 AM   #15
NWoolridge
Expert
 
NWoolridge's Avatar
 
Join Date: Aug 2002
Posts: 701
Quote:
Originally Posted by ScientiaViz
Thanks Nick.
The Amaral file I downloaded was named c12971.CNG.swc.
If you want I can email my C4D file.
-A


I got the file from neuromorpho.org... Interesting file; it has a series of structures at the end of the file with the ID "10", which is not standard for the file format (as far as I know). They are not part of the neuron, but contours that provide some context or orienting info, perhaps from the brain structure from which they were derived...

The script ideally should ignore them, but it just builds them anyway... I'll revise the script!

Most of the dendrite branches connect well in this file, but there are some "misses"; That seems to happen in some files. I'm not sure if it is a data quality problem or a script logic issue (although its self-serving, I tend to think its the former... ).

Nick
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:02 AM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.