Difference between revisions of "SNT: Python Notebooks"

(Getting Started)
(Getting Started)
Line 9: Line 9:
 
Then, import the SNT classes you will need. For example, to download a neuron reconstruction from the MouseLight database, you would import the MouseLightLoader class:
 
Then, import the SNT classes you will need. For example, to download a neuron reconstruction from the MouseLight database, you would import the MouseLightLoader class:
 
<source lang="python">
 
<source lang="python">
 +
from jnius import autoclass, cast
 
MouseLightLoader = autoclass('tracing.io.MouseLightLoader')
 
MouseLightLoader = autoclass('tracing.io.MouseLightLoader')
 
</source>
 
</source>

Revision as of 19:08, 11 April 2019

Python Notebooks

Direct access to the SNT API from the Python programming language is made possible with the pyimagej module. This enables full integration between SNT and any library in the Python ecosystem.

Getting Started

To initialize Fiji from Python:

import imagej
ij = imagej.init('sc.fiji:fiji')

Then, import the SNT classes you will need. For example, to download a neuron reconstruction from the MouseLight database, you would import the MouseLightLoader class:

from jnius import autoclass, cast
MouseLightLoader = autoclass('tracing.io.MouseLightLoader')