mcdougallab / matlabneuroninterface

Interface for connecting NEURON and MATLAB
BSD 3-Clause "New" or "Revised" License
5 stars 1 forks source link

PlotShape.plot #57

Closed edovanveen closed 1 year ago

edovanveen commented 1 year ago

Closes issue #3

edovanveen commented 1 year ago

@ramcdougal Ready for review. Example output at https://github.com/mcdougallab/matlabneuroninterface/issues/3

ramcdougal commented 1 year ago

The built-in plotshape interpolates diameters rather than using a single diameter for a segment. (The segment diameter is the diameter at the center of the segment, but the diam3d information exists for all 3D points.)

For an (artificial) example of where this makes a difference, see the code and image just below: https://nrn.readthedocs.io/en/8.2.2/python/modelspec/programmatic/topology/geometry.html#d-specification-of-geometry

If this is hard or computationally inefficient, I don't think it should block merging this branch, because this is very useful as-is... but I'm mentioning it in case it isn't hard. :)

edovanveen commented 1 year ago

The built-in plotshape interpolates diameters rather than using a single diameter for a segment. (The segment diameter is the diameter at the center of the segment, but the diam3d information exists for all 3D points.)

Currently the plotted diameter in the xyz-plot is the average diameter of two consecutive 3D points. Would you rather plot cone segments? That is probably possible with a surface plot (as far as I know 'tapered' lineplots are not possible in MATLAB), but that will take some work; I would prefer to put that in a separate issue and focus on the other issues for now.

Whatever varname is selected by the user is currently shown per segment, by colour coding. So if the user selects diam, the segment diameter is used for colouring, not the pt3d interpolated diameter. Would you prefer to make varname diam a special case and use the pt3d interpolated diameter for the colour plot as well?

edovanveen commented 1 year ago

One more question: should we call n.define_shape() at the start of PlotShape.plot()?

ramcdougal commented 1 year ago

One more question: should we call n.define_shape() at the start of PlotShape.plot()?

Yes. Let's do that. It's what the interviews (but not Python) version does.

ramcdougal commented 1 year ago

Re cone segments: that's what the interviews version does, which I think is best, however I agree it's not a priority.

(I think the segment diameters ought to match the interpolated diameter at the center.)