natverse / nat

NeuroAnatomy Toolbox: An R package for the (3D) visualisation and analysis of biological image data, especially tracings of single neurons.
https://natverse.org/nat/
64 stars 29 forks source link

bug in get_distance_to_soma #509

Closed dokato closed 1 month ago

dokato commented 1 year ago

I'm not entirely sure what's wrong with this specific neurons from the examples: "TKC8R", but the soma distance computation fails here.

library(nat)
> nat::get_distance_to_soma(Cell07PNs$TKC8R)
  [1] 36.0384385  0.0000000  0.4536370  0.8955272  1.3241211  1.7475879  2.1705297
  [8]  2.5922016  3.0122541  3.4382780  3.8691165  4.3070684  4.7523296  5.2098921
 [15]  5.6698427  6.1359706  6.6068536  7.0787425  7.5537950  8.0282166  8.5005323
 [22]  8.9719975  9.4404400  9.9041639 10.3652199 10.8240043 11.2750198 11.7274375
 [29] 12.1706492 12.6070647 13.0434301 13.4757999 13.9040351 14.3291011 14.7476902
 [36] 15.1613061 15.5699426 15.9607997 16.3528742 16.7439885 17.1268937 17.5167328
 [43] 17.9143509 18.3076047 18.7236740 19.1641655 19.6159973 20.0789811 20.5482825
 [50] 20.9973789 21.4362093 21.8654764 22.2890921 22.6948526 23.0962770 23.5066920
 [57] 23.8885104 24.2579151 24.6153933 24.9434949 25.2610658 25.5755796 25.8806436
 [64] 26.1907803 26.4975637 26.8102962 27.1201618 27.4340634 27.7565897 28.0801510
 [71] 28.4013865 28.7269874 29.0515892 29.3859505 29.7186284 30.0522588 30.3935102
 [78] 30.7401223 31.0979547 31.4566041 31.8328571 32.2220644 32.6155829 33.0112323
 [85] 33.4014595 33.7899448 34.1699438 34.5424592 34.9075376 35.2860573 35.6611498
 [92] 36.4214412 36.8036816 37.1873042 37.5751192 37.9845062 38.3921970 38.8053126
 [99] 39.2284112 39.6395342 40.0504361 40.4642016 40.8758071 41.2978953 41.7096520
[106] 42.1202947 42.5381633 42.9525463 43.3695051 43.7885905 44.2122481 44.6364369
[113] 45.0644837 45.4954979 45.9305721 46.3650633 46.8000128 47.2361776 47.6775655
[120] 48.1183521 48.5530099        Inf        Inf        Inf        Inf        Inf
[127]        Inf        Inf        Inf        Inf        Inf        Inf        Inf
[134]        Inf        Inf        Inf        Inf        Inf        Inf        Inf
....

nTrrees is 1 here...

jefferis commented 1 month ago

Closed by updating the neuron to eliminate discontinuities