Skip to content

Commit

Permalink
Add super-duper explicit methods to NodeConnectorRelation
Browse files Browse the repository at this point in the history
  • Loading branch information
clbarnes committed Nov 14, 2023
1 parent 63cd77a commit 0bb6354
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions navis/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,36 @@ class NodeConnectorRelation(IntEnum):
i.e. "the (tree)node is <NodeConnectorType> the connector node"
Based on the `CATMAID link types`_.
Inspired by the `CATMAID link types`_.
A node PRESYNAPTIC_TO a connector is an output site.
A node POSTSYNAPTIC_TO a connector is an input site.
.. _`CATMAID link types`: https://github.com/catmaid/CATMAID/blob/2964e04e6e9772aff5d305e72c1b878030fe0e25/django/applications/catmaid/control/link.py#L16
"""
PRESYNAPTIC_TO = 0
POSTSYNAPTIC_TO = 1
ABUTTING = 2
GAPJUNCTION_WITH = 3
TIGHTJUNCTION_WITH = 4
DESMOSOME_WITH = 5
ATTACHMENT_TO = 6
CLOSE_TO = 7
# ABUTTING = 2
# GAPJUNCTION_WITH = 3
# TIGHTJUNCTION_WITH = 4
# DESMOSOME_WITH = 5
# ATTACHMENT_TO = 6
# CLOSE_TO = 7

def is_output_node(self) -> bool:
"""Whether the node is sending output via the connector"""
return self == NodeConnectorRelation.PRESYNAPTIC_TO

def is_input_node(self) -> bool:
"""Whether the node is receiving input via the connector"""
return self == NodeConnectorRelation.POSTSYNAPTIC_TO

def is_output_connector(self) -> bool:
"""Whether the connector is sending output to the node"""
return self.is_input_node()

def is_input_connector(self) -> bool:
"""Whether the connector is receiving input from the node"""
return self.is_output_node()


def Neuron(x: Union[nx.DiGraph, str, pd.DataFrame, 'TreeNeuron', 'MeshNeuron'],
Expand Down

0 comments on commit 0bb6354

Please sign in to comment.