44
55"""
66
7- from morphio import SectionType
87import numpy as np
98from .. import morphology as base_morphology
109
@@ -38,6 +37,8 @@ class dendrites(base_morphology.dendrites):
3837 def __call__ (self , morphology , filter_by_section = False ):
3938 """Return an index (integer NumPy array) that can be used
4039 to retrieve the sections corresponding to the filter. """
40+ from morphio import SectionType
41+
4142 section_index = np .array ([], dtype = int )
4243 for label in (SectionType .apical_dendrite , SectionType .basal_dendrite ):
4344 if label in morphology .section_groups :
@@ -53,6 +54,8 @@ def __call__(self, morphology, filter_by_section=False):
5354class apical_dendrites (base_morphology .apical_dendrites ):
5455
5556 def __call__ (self , morphology , filter_by_section = False ):
57+ from morphio import SectionType
58+
5659 if SectionType .apical_dendrite in morphology .section_groups :
5760 section_index = morphology .section_groups [SectionType .apical_dendrite ]
5861 if filter_by_section :
@@ -66,6 +69,8 @@ def __call__(self, morphology, filter_by_section=False):
6669class basal_dendrites (base_morphology .basal_dendrites ):
6770
6871 def __call__ (self , morphology , filter_by_section = False ):
72+ from morphio import SectionType
73+
6974 if SectionType .basal_dendrite in morphology .section_groups :
7075 section_index = morphology .section_groups [SectionType .basal_dendrite ]
7176 if filter_by_section :
@@ -79,6 +84,8 @@ def __call__(self, morphology, filter_by_section=False):
7984class axon (base_morphology .axon ):
8085
8186 def __call__ (self , morphology , filter_by_section = False ):
87+ from morphio import SectionType
88+
8289 if SectionType .axon in morphology .section_groups :
8390 section_index = morphology .section_groups [SectionType .axon ]
8491 if filter_by_section :
@@ -92,6 +99,8 @@ def __call__(self, morphology, filter_by_section=False):
9299class soma (base_morphology .axon ):
93100
94101 def __call__ (self , morphology , filter_by_section = False ):
102+ from morphio import SectionType
103+
95104 if SectionType .soma in morphology .section_groups :
96105 section_index = morphology .section_groups [SectionType .soma ]
97106 if filter_by_section :
0 commit comments