Writing Scripts for Neuroptikon - JaneliaSciComp/Neuroptikon GitHub Wiki
The Sample Scripts folder holds many example of writing scripts for Neuroptikon.
How To Add An Image to a Neuron
The example script "Sample Scripts/Neuron Image/Neuron Image Example.py" shows a basic example of a neuron with an image attached.
To attach an image create a neuron with a list of dictionaries with the image's title and path to the image for the neuronImage parameter. Make sure that Neuroptikon can access the image path.
neuron1 = network.createNeuron(name = '1', neuronImage=[{'label': "Neuron 1's image", 'path':'./neuron1.jpg'}])
To view the image, inspect the neuron by selecting it and from the menu click "View>Open Inspector Window". You can see a thumbnail of the image in the Neuron tab and a larger image in the Neuron Image tab.
How to Add Links to a Neuron
The example script "Sample Scripts/Neuron Links.py" shows an example of how to links to a neuron.
To add links create a neuron with a list of links for the links parameter.
neuron1 = network.createNeuron(name = 'neu1', links=['http://github.com/JaneliaSciComp/Neuroptikon', 'http://github.com/JaneliaSciComp/Neuroptikon/wiki'])
To view or follow the links inspect the neuron by selecting it and from the menu click "View>Open Inspector Window". You will see the url for the links. Clicking on a link will bring it up in your computer's default web browser.
How to add a synapse to a neuron
The example script Sample Scripts/Synapses.py shows how to add synapses to a neuron.
To add a synapse to a neuron
neuron.synapseOn(neuron2, preSynapticRegion=regionA, postSynapticRegion=regionB)
neuron2.synapseOn(neuron)
Synapses are not shown by default. To show synapses deselect Hide Synapses On Connections. You can search for a neuron's pre an post-synaptic partners using neuron.searchPre() and neuron.searchPost() function.
To add regions to an existing synapse
synapse = neuron.synapseOn(neuron2)
synapse.preSynapticRegion = regionA
synapse.postSynapticRegion = regionB
To find all pre- or post-synaptic neurons from a synapse
postSynapticNeuronList = synapse.postSynapticNeurons()
preSynapticNeuronList = synapse.preSynapticNeurons()