Skip to content
This repository has been archived by the owner on Feb 26, 2025. It is now read-only.

Commit

Permalink
Make fork iterators homogeneous by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
eleftherioszisis committed Apr 22, 2022
1 parent d427225 commit 8ebcbec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
4 changes: 2 additions & 2 deletions neurom/core/morphology.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ def is_homogeneous_point(self):

def is_forking_point(self):
"""Is this section a forking point?"""
return len(self.children) > 1
return self.is_homogeneous_point() and len(self.children) > 1

def is_bifurcation_point(self):
"""Is tree a bifurcation point?"""
return len(self.children) == 2
return self.is_homogeneous_point() and len(self.children) == 2

def is_leaf(self):
"""Is tree a leaf?"""
Expand Down
16 changes: 1 addition & 15 deletions neurom/features/neurite.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,7 @@

def _map_sections(fun, neurite, iterator_type=Section.ipreorder, section_type=NeuriteType.all):
"""Map `fun` to all the sections."""
check_type = is_type(section_type)

def homogeneous_filter(section):
return check_type(section) and Section.is_homogeneous_point(section)

# forking sections cannot be heterogeneous
if (
iterator_type in {Section.ibifurcation_point, Section.iforking_point}
and section_type != NeuriteType.all
):
filt = homogeneous_filter
else:
filt = check_type

return list(map(fun, filter(filt, iterator_type(neurite.root_node))))
return list(map(fun, filter(is_type(section_type), iterator_type(neurite.root_node))))


@feature(shape=())
Expand Down

0 comments on commit 8ebcbec

Please sign in to comment.