AllenInstitute / sonata

Collaboration between BBP and AIBS
BSD 3-Clause "New" or "Revised" License
54 stars 33 forks source link

NetPyNE 3D representation of 300 biophys cell network #78

Open salvadord opened 5 years ago

salvadord commented 5 years ago
salvadord commented 5 years ago
salvadord commented 5 years ago

@hernando - would be good to know how many cells are shown in the RTNEURON fig so can show similar representation with netpyne. thx

hernando commented 5 years ago

The figure I made contains all the 300 cells from the example, but it uses transparency to reduce the visual clutter, highlighting somas and depolarized branches.

salvadord commented 5 years ago
hernando commented 5 years ago

What do you mean by "1 color per pop"? The example contains only one population with positions and orientations. Can you tell me which vertical field of view have you used for this image, or is it an orthographic projection. I want to generate the same image with RTNeuron without simulation and then with simulation.

salvadord commented 5 years ago

Ah I meant per cell type -- if I remember correctly there are 3 exc and 2 inh cell types. In netpyne each of this is considered a population. I will try to find out the field of view. I opened this in the GUI 3D viewer and just changed the view 'manually' (using the mouse), but I will check with the GUI guys if it's possible to get the precise field of view information.

salvadord commented 5 years ago

New 3D view with the following field of view:

camera position: 56.353, 179.187, 740.154 camera rotation: -0.080, 0.091, 0.014, 713.259

screen shot 2019-01-30 at 10 30 19 am
salvadord commented 5 years ago

in case useful, here's the code that implements the netpyne gui (geppetto) camera positon and orientation:

screenshot 2019-01-30 at 15 36 56 screenshot 2019-01-30 at 15 37 45
hernando commented 5 years ago

I'm not able to reproduce this image with the examples/300_cells/simulation_config.json, the morphologies look substantially different. I cannot judge which is the correct one, yours or mine, so I've generated some pictures in order to compare RTNeuron's and NetPyNE's representations. I haven't applied any camera rotation in any of the images and the camera projection is orthogonal to facilitate comparisons. The only thing I've done is to pan for framing the circuit.

Let me know if you can match these figures.

5_cells_iclamp

5cells

9_cells

9cells The locations of the cells look funny, but they are correct, the files contains [0, 1, 2, 30, 31, 32, 60, 61, 62]

300 cells

300cells In this one I've picked cells 0, 50, 100, 150, 200 and 250.

salvadord commented 5 years ago

5_cells_iclamp: image

salvadord commented 5 years ago

9_cells: image

salvadord commented 5 years ago

300 cells: image

I tried to show the same cell gids, but in the GUI I have to select them by population relative id, so not 100% they are the same; here's the one's I'm showing:

salvadord commented 5 years ago

I see for the 5_cells example the y-axis is inverted. That's because in netpyne by convention assume positive y goes from top to bottom, since typically reflects cortical depth. I can just invert the y-axis coords.

The 9_cells seems to be ok.

And the 300 cells is also y-inverted, but there seem to be other issues as well. Perhaps we are not showing the same cells.

I will replot all with the y-axis inverted and so can compare better.

hernando commented 5 years ago

In the 5 cell example assuming the soma positions are correct (I say this based on the morphology types that I see), the inversion is a local inversion of the y axis of the morphology. The convention in SONATA is that soma positions and coordinates from swc files are in the same reference system. You mustn't do any transformation to swc points other than translating them to move the soma to (0, 0, 0), and it may not be even necessary in this case. The 9 cell example probably has the same problem, but due to the layout and simmetry it's undistinguishable. If you look carefully at the 300 cell example, the soma positions are the same, but they look either mirrored on the xz plane or rotated 180 degrees around the x axis. The morphologies are completely different on the other hand, so let's start with something simpler.

This is what I get when I render cell 0, whose morphology is Scnn1a_473845048_m.swc 1_cell I've double checked with another viewer that the morphology looks the same. They share the same data loading library, but I'd be surprised if the points are being modified at all during loading.

salvadord commented 5 years ago

5 cells after inverting y coord and swapping soma x and y 3d points (so cylinder is vertical instead of horizontal) -- I believe it looks the same as the RTneuron one now: image

hernando commented 5 years ago

This last image is almost correct. The branches look slightly different from mine because until now I didn't realize that the simplified level of detail (LOD) was kicking in in my renderings. If I disable LOD, they look the same except for those funky straight diagonal lines starting at the soma and going top right.

salvadord commented 5 years ago

ok great! the funky lines are just the stub axons... I can get rid of those for the 3d image.

salvadord commented 5 years ago

300 cell example, Cell 0 (Scnn1a_473845048_m.swc): image

same cell after rotating around to match rtneuron's (camera rotation coords: -0.372,-0.957,-0.425,496.173): image

So seems that after rotating the cell it is the same as shown by RTNeuron -- at least the apical tuft looks the same, as well as the overall number of dendrites.

So this could be caused by the rotation_angle specified in the internal_nodes.h5 which at the moment is not supported by the netpyne GUI.

hernando commented 5 years ago

If you don't take the rotation_angle into account we can't get the same images. I could disable it in my code, but then we can't claim that the images are representative of the circuit.

salvadord commented 5 years ago

Right, I'll check with the GUI team if there's any easy hack we could do for now to incorporate the rotation_angles.

In the meantime, this is the 300 cell with the y-axis fixed and the axons removed... it might be an option to include this fig in the paper and mention that NetPyNE GUI does not support rotation angles at this point:

screen shot 2019-03-06 at 4 21 55 pm