JustasB / BlenderNEURON

Exports 3D structure and activity from NEURON simulator to Blender
http://blenderNEURON.org
MIT License
27 stars 7 forks source link

Create template/example of how to import morphology/activity from a file #16

Closed Helveg closed 3 years ago

Helveg commented 3 years ago

I have a large scale network simulation and I'd like to visually represent a small subsection; There is not really any documentation so I'm struggling. From the videos it seems that I should actually be simulating in NEURON for BlenderNEURON to pick up on the signal. This online approach is completely unfeasible; I have the recorded simulation data in an HDF5 file. Is it possible to feed this to BlenderNEURON in an offline fashion?

JustasB commented 3 years ago

Hi again,

Interesting use case. BN was initially designed for the "coupled to NEURON" use case, but I wanted to leave it relatively easy to add adapters for other simulators, or in your use case, pre-recorded simulation data.

You should be able to hack the methods of the BlenderNode class

In Blender's Python console, it's instantiated in the bpy.types.Object.BlenderNEURON_node variable.

image

Most likely, you could modify the import_groups_from_neuron method to read the HDF5 file instead of making an RCP call to NEURON.

In the method, the call to from_full_NEURON_group expects a JSON formatted version of morphology/activity for the sections.

If you convert your HDF5 data to the JSON format that method expects using Blender's python, then you should be able to perform the task all within Blender.

An alternative approach could be to replace the NEURON RCP node code (the methods listed here ) with code that reads your HDF5 file and formats the morphology/animation data in the same JSON format.

I can document what the JSON format should look like, but I would suggest placing a few print statements in the above import_groups_from_neuron method (with a few-compartment cell + few ms of activity) to get a quick sense.