-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ball-and-stick morphology not plotting correctly #597
Comments
It seems that the default soma plotting draws an 'outline' of the three points, so that's why you get the line. You can try How the points of the soma are interpreted has been discussed before, and it looks like there needs to be figured out as per #530. |
Regardless of the above, the documentation needs to be cleared up so it's easier to find these properties. |
You there is something very wrong with the soma plotting, it seems the radius of the soma is completely ignored ? (I hope this is only the case for plotting, and not the internal representation of the soma ?) I corrected the position of the soma by moving the 0,0,0 position to the first line: (As i mentioned the radius is completely ignored though) I think the cleanest way out of this would be to add an option to allow the soma to be plotted like any other section, as a set of cylinders. |
@wvangeit unfortunately you are right Werner. The radius of the soma is completely ignored in principle. The actual radius is computed assuming that the points of the soma belong to the contour. This computation gives a radius that is used for the plotting of the sphere. |
@lidakanari But is this only used for plotting, or also in the internal representation in NeuroM (to calculate total surface areas etc) |
@wvangeit This is independent of the plotting. It is used in the internal representation of the soma. |
After discussion and investigation w/ @wvangeit, it seems like the best course of action is:
Finally, the area of the soma will be calculated as the area of the cylinders (without the end caps), and radius will be that of the equivalent sphere with that area. |
We have made this change back and forth a few times in the past. I am a bit skeptical about this proposal... Is it compatible with the computations here: "An equivalent radius (rs) is computed as the average distance of each point of the single contour from this center. " from the http://neuromorpho.org/SomaFormat.html ? I've discussed this issue with Giorgio and Rembrandt and they both proposed the computation to be performed as described here as opposed to the cylinders approach. Of course this depends on the file format issues that are not yet resolved as @mgeplf pointed out. I am afraid that this change might not be compatible with the contour definition in the ascii files from the lab. In most cases the diameters are set to zero or a random value. When the data are converted (into csv or h5) the diameters values that are propagated in the new formats do not correspond to the actual diameters of the soma. |
But isn't that just a format problem ? I agree that you can throw away the radii in the ASC format (and the SomaFormat quote also refers to how to get the radius from the ASC file, not from SWC). |
Yes, it is obviously a file format problem. I have a proposal: Case1: If the soma is a contour I would avoid changing the computation to assume cylinders according to the contour as this is a "special case"
Case2: As Mike says (I think it is already like this) According to the definition from the same link, the swc "correct" format should be: So in order to avoid confusion I would propose to check if:
|
But so just to be sure: Case1 doesn't exist in SWC. And yes, for the rest, it's basically what Brian is doing: https://github.com/brian-team/brian2/blob/master/brian2/spatialneuron/morphology.py#L1040 |
It does in practice... However the conversion into this case from ascii or other formats is obscure and depends on the converter so it is not reliable. |
I agree w/ @wvangeit, except I would treat the 3 point case as the 'normal' case, unless it follows the 'neuromorpho' style, at which point it would be loaded neuromorpho style. |
Sure, about case 3 I think we all agree. I don't understand the disagreement... If case1 doesn't exist why should we change how we currently treat it? I have data in this format for which I don't assume cylinders btw. |
Currently the SWC reader is treating the points as a contour, but in NEURON, it's treated as any other compartment style set of cylinders. The idea would be to switch over to that representation, since the standard (http://www.neuronland.org/NLMorphologyConverter/MorphologyFormats/SWC/Spec.html), doesn't explicitly say they should be contours, and thus implicitly suggests they should be interpreted the same as the neurites (ie: cylinders.) |
So, to recap the discussion on Friday:
Does that sound right? |
@mgeplf Agreed! I'd like to add that if anyone needs to produce SWC with a soma in contour format it will be better to produce an SWC+ following the conventions for the "contour soma" type. This way we can avoid misunderstandings and interpret the data correctly. |
In favor of #915 |
I have the following swc morphology:
1 1 0.0 -10.0 0.0 20.0 -1
2 1 0.0 0.0 0.0 20.0 1
3 1 0.0 10.0 0.0 20.0 2
4 3 0.0 10.0 0.0 2.0 3
5 3 0.0 100.0 0.0 2.0 4
When I plot this with:
import matplotlib.pyplot as plt
import neurom
import neurom.viewer
neurom.viewer.draw(neurom.load_neuron('ballandstick.swc'))
plt.show()
I get:
![screen shot 2017-02-23 at 10 21 24](https://cloud.githubusercontent.com/assets/3098670/23252689/119048f4-f9b2-11e6-84e7-d65f997f52de.png)
It seems the diameter of the soma is not plotted correctly ? (Or is there maybe an option to enable plotting the diameter of the soma ?)
The text was updated successfully, but these errors were encountered: