Skip to content

Commit

Permalink
Soma contour centroid oriented so 1 end is largest positive direction. (
Browse files Browse the repository at this point in the history
#2491)

A temporary pull request to allow comparison with #2470 

This was an attempt to see if this produces the same result as #2470.
But the conclusion was that this is not easy. We are still merging this
PR/change because we thought it would be helpful to have this change
into the NEURON master branch as a reference point if we ever have
to compare this change in isolation.
  • Loading branch information
nrnhines authored Oct 12, 2023
1 parent 4946a24 commit ba1cedc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions share/lib/hoc/import3d/import3d_gui.hoc
Original file line number Diff line number Diff line change
Expand Up @@ -1227,14 +1227,21 @@ proc contour2centroid() {local i, j, imax, imin, ok localobj mean, pts, d, max,
tobj = m.symmeig(m)
// major axis is the one with largest eigenvalue
major = m.getcol(tobj.max_ind)
// For plotting and round-off error consistency
// between meschach and eigen use the heuristic that
// major axis points in positive direction.
// i.e. if greatest value is negative, reverse orientation.
if (major.x[major.c.abs().max_ind()] < 0) {
major.mul(-1)
}
// minor is normal and in xy plane
minor = m.getcol(3-tobj.min_ind-tobj.max_ind)
minor.x[2] = 0
minor.div(minor.mag)
if (g != nil) {
g.beginline(4, 3) g.line(mean.x[0], mean.x[1])
g.line(mean.x[0] + 20*major.x[0], mean.x[1] + 20*major.x[1]) g.flush
}
if (g != nil) {
g.beginline(4, 3) g.line(mean.x[0], mean.x[1])
g.line(mean.x[0] + 20*major.x[0], mean.x[1] + 20*major.x[1]) g.flush
}
d = new Vector(pts.ncol)
rad = new Vector(pts.ncol)
for i=0, pts.ncol-1 {
Expand Down

0 comments on commit ba1cedc

Please sign in to comment.