Skip to content

Commit

Permalink
Account for all custom neurite types in NeuriteType (#902)
Browse files Browse the repository at this point in the history
  • Loading branch information
asanin-epfl authored Apr 29, 2021
1 parent 5b05766 commit dd03480
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 23 deletions.
7 changes: 6 additions & 1 deletion neurom/core/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ class NeuriteType(IntEnum):
undefined = SectionType.undefined
soma = 31
all = 32
custom = SectionType.custom5
custom5 = SectionType.custom5
custom6 = SectionType.custom6
custom7 = SectionType.custom7
custom8 = SectionType.custom8
custom9 = SectionType.custom9
custom10 = SectionType.custom10


NEURITES = (NeuriteType.all,
Expand Down
8 changes: 7 additions & 1 deletion neurom/view/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@
NeuriteType.apical_dendrite: 'purple',
NeuriteType.axon: 'blue',
NeuriteType.soma: 'black',
NeuriteType.undefined: 'green'}
NeuriteType.undefined: 'green',
NeuriteType.custom5: 'orange',
NeuriteType.custom6: 'orange',
NeuriteType.custom7: 'orange',
NeuriteType.custom8: 'orange',
NeuriteType.custom9: 'orange',
NeuriteType.custom10: 'orange'}


def _plane2col(plane):
Expand Down
141 changes: 121 additions & 20 deletions tests/data/dataset/point_neuron_feature_values.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
"NeuriteType.axon": [
0.8535128831863403
],
"NeuriteType.custom": [],
"NeuriteType.custom5": [],
"NeuriteType.custom6": [],
"NeuriteType.custom7": [],
"NeuriteType.custom8": [],
"NeuriteType.custom9": [],
"NeuriteType.custom10": [],
"NeuriteType.undefined": [],
"NeuriteType.soma": [],
"NeuriteType.all": [
Expand All @@ -35,7 +40,12 @@
"NeuriteType.axon": [
21.0
],
"NeuriteType.custom": [0],
"NeuriteType.custom5": [0],
"NeuriteType.custom6": [0],
"NeuriteType.custom7": [0],
"NeuriteType.custom8": [0],
"NeuriteType.custom9": [0],
"NeuriteType.custom10": [0],
"NeuriteType.undefined": [
0.0
],
Expand Down Expand Up @@ -107,7 +117,12 @@
0.7236249805881595,
0.34182623199705564
],
"NeuriteType.custom": [],
"NeuriteType.custom5": [],
"NeuriteType.custom6": [],
"NeuriteType.custom7": [],
"NeuriteType.custom8": [],
"NeuriteType.custom9": [],
"NeuriteType.custom10": [],
"NeuriteType.undefined": [],
"NeuriteType.soma": [],
"NeuriteType.all": [
Expand Down Expand Up @@ -302,7 +317,12 @@
107.76121287585062,
108.82672117676924
],
"NeuriteType.custom": [],
"NeuriteType.custom5": [],
"NeuriteType.custom6": [],
"NeuriteType.custom7": [],
"NeuriteType.custom8": [],
"NeuriteType.custom9": [],
"NeuriteType.custom10": [],
"NeuriteType.undefined": [],
"NeuriteType.soma": [],
"NeuriteType.all": [
Expand Down Expand Up @@ -466,7 +486,12 @@
"NeuriteType.axon": [
1.0
],
"NeuriteType.custom": [0],
"NeuriteType.custom5": [0],
"NeuriteType.custom6": [0],
"NeuriteType.custom7": [0],
"NeuriteType.custom8": [0],
"NeuriteType.custom9": [0],
"NeuriteType.custom10": [0],
"NeuriteType.undefined": [
0.0
],
Expand All @@ -490,7 +515,13 @@
"NeuriteType.axon": [
210.0
],
"NeuriteType.custom": [0],
"NeuriteType.custom5": [0],
"NeuriteType.custom6": [0],
"NeuriteType.custom7": [0],
"NeuriteType.custom8": [0],
"NeuriteType.custom9": [0],
"NeuriteType.custom10": [0],

"NeuriteType.undefined": [
0.0
],
Expand Down Expand Up @@ -522,7 +553,12 @@
"NeuriteType.axon": [
21.0
],
"NeuriteType.custom": [],
"NeuriteType.custom5": [],
"NeuriteType.custom6": [],
"NeuriteType.custom7": [],
"NeuriteType.custom8": [],
"NeuriteType.custom9": [],
"NeuriteType.custom10": [],
"NeuriteType.undefined": [],
"NeuriteType.soma": [],
"NeuriteType.all": [
Expand Down Expand Up @@ -649,7 +685,12 @@
80.70320753186719,
82.44254515324077
],
"NeuriteType.custom": [],
"NeuriteType.custom5": [],
"NeuriteType.custom6": [],
"NeuriteType.custom7": [],
"NeuriteType.custom8": [],
"NeuriteType.custom9": [],
"NeuriteType.custom10": [],
"NeuriteType.undefined": [],
"NeuriteType.soma": [],
"NeuriteType.all": [
Expand Down Expand Up @@ -816,7 +857,12 @@
"NeuriteType.axon": [
9.579117512683075
],
"NeuriteType.custom": [],
"NeuriteType.custom5": [],
"NeuriteType.custom6": [],
"NeuriteType.custom7": [],
"NeuriteType.custom8": [],
"NeuriteType.custom9": [],
"NeuriteType.custom10": [],
"NeuriteType.undefined": [],
"NeuriteType.soma": [],
"NeuriteType.all": [
Expand Down Expand Up @@ -888,7 +934,12 @@
2.094392668737722,
2.094393971479266
],
"NeuriteType.custom": [],
"NeuriteType.custom5": [],
"NeuriteType.custom6": [],
"NeuriteType.custom7": [],
"NeuriteType.custom8": [],
"NeuriteType.custom9": [],
"NeuriteType.custom10": [],
"NeuriteType.undefined": [],
"NeuriteType.soma": [],
"NeuriteType.all": [
Expand Down Expand Up @@ -981,7 +1032,12 @@
"NeuriteType.axon": [
0.853512884994
],
"NeuriteType.custom": [],
"NeuriteType.custom5": [],
"NeuriteType.custom6": [],
"NeuriteType.custom7": [],
"NeuriteType.custom8": [],
"NeuriteType.custom9": [],
"NeuriteType.custom10": [],
"NeuriteType.undefined": [],
"NeuriteType.soma": [],
"NeuriteType.all": [
Expand All @@ -1005,7 +1061,12 @@
"NeuriteType.axon": [
21.0
],
"NeuriteType.custom": [0],
"NeuriteType.custom5": [0],
"NeuriteType.custom6": [0],
"NeuriteType.custom7": [0],
"NeuriteType.custom8": [0],
"NeuriteType.custom9": [0],
"NeuriteType.custom10": [0],
"NeuriteType.undefined": [
0.0
],
Expand Down Expand Up @@ -1077,7 +1138,12 @@
0.7236246855393367,
0.3418260638851744
],
"NeuriteType.custom": [],
"NeuriteType.custom5": [],
"NeuriteType.custom6": [],
"NeuriteType.custom7": [],
"NeuriteType.custom8": [],
"NeuriteType.custom9": [],
"NeuriteType.custom10": [],
"NeuriteType.undefined": [],
"NeuriteType.soma": [],
"NeuriteType.all": [
Expand Down Expand Up @@ -1272,7 +1338,12 @@
107.76119894706187,
108.82670843871607
],
"NeuriteType.custom": [],
"NeuriteType.custom5": [],
"NeuriteType.custom6": [],
"NeuriteType.custom7": [],
"NeuriteType.custom8": [],
"NeuriteType.custom9": [],
"NeuriteType.custom10": [],
"NeuriteType.undefined": [],
"NeuriteType.soma": [],
"NeuriteType.all": [
Expand Down Expand Up @@ -1436,7 +1507,12 @@
"NeuriteType.axon": [
1.0
],
"NeuriteType.custom": [0],
"NeuriteType.custom5": [0],
"NeuriteType.custom6": [0],
"NeuriteType.custom7": [0],
"NeuriteType.custom8": [0],
"NeuriteType.custom9": [0],
"NeuriteType.custom10": [0],
"NeuriteType.undefined": [
0.0
],
Expand All @@ -1460,7 +1536,12 @@
"NeuriteType.axon": [
210.0
],
"NeuriteType.custom": [0],
"NeuriteType.custom5": [0],
"NeuriteType.custom6": [0],
"NeuriteType.custom7": [0],
"NeuriteType.custom8": [0],
"NeuriteType.custom9": [0],
"NeuriteType.custom10": [0],
"NeuriteType.undefined": [
0.0
],
Expand Down Expand Up @@ -1497,7 +1578,12 @@
"NeuriteType.axon": [
21.0
],
"NeuriteType.custom": [],
"NeuriteType.custom5": [],
"NeuriteType.custom6": [],
"NeuriteType.custom7": [],
"NeuriteType.custom8": [],
"NeuriteType.custom9": [],
"NeuriteType.custom10": [],
"NeuriteType.undefined": [],
"NeuriteType.soma": [],
"NeuriteType.all": [
Expand Down Expand Up @@ -1624,7 +1710,12 @@
80.70320815279175,
82.44254511788921
],
"NeuriteType.custom": [],
"NeuriteType.custom5": [],
"NeuriteType.custom6": [],
"NeuriteType.custom7": [],
"NeuriteType.custom8": [],
"NeuriteType.custom9": [],
"NeuriteType.custom10": [],
"NeuriteType.undefined": [],
"NeuriteType.soma": [],
"NeuriteType.all": [
Expand Down Expand Up @@ -1791,7 +1882,12 @@
"NeuriteType.axon": [
9.579117366740002
],
"NeuriteType.custom": [],
"NeuriteType.custom5": [],
"NeuriteType.custom6": [],
"NeuriteType.custom7": [],
"NeuriteType.custom8": [],
"NeuriteType.custom9": [],
"NeuriteType.custom10": [],
"NeuriteType.undefined": [],
"NeuriteType.soma": [],
"NeuriteType.all": [
Expand Down Expand Up @@ -1863,7 +1959,12 @@
2.0943951024087544,
2.0943951024087544
],
"NeuriteType.custom": [],
"NeuriteType.custom5": [],
"NeuriteType.custom6": [],
"NeuriteType.custom7": [],
"NeuriteType.custom8": [],
"NeuriteType.custom9": [],
"NeuriteType.custom10": [],
"NeuriteType.undefined": [],
"NeuriteType.soma": [],
"NeuriteType.all": [
Expand Down
2 changes: 1 addition & 1 deletion tests/io/test_swc_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def test_simple_reversed():

def test_custom_type():
neuron = load_neuron(Path(SWC_PATH, 'custom_type.swc'))
assert neuron.neurites[1].type == NeuriteType.custom
assert neuron.neurites[1].type == NeuriteType.custom5


def test_undefined_type():
Expand Down

0 comments on commit dd03480

Please sign in to comment.