Skip to content

Error in tree.model_network() #2

Open

Description

@RomStriker

Hi,

I am trying to create a model from centerline swc file. However, when running the tree.model_network() method. I get the following error

Traceback (most recent call last):
  File "/home/roman/vascularmd/create_synthetic_data.py", line 31, in <module>
    tree.model_network()  # Parametric modeling of the network
  File "/home/roman/vascularmd/ArterialTree.py", line 484, in model_network
    original_label = self.__model_furcation(n, original_label, criterion, akaike, max_distance)
  File "/home/roman/vascularmd/ArterialTree.py", line 691, in __model_furcation
    nbifprec = list(self._model_graph.predecessors(e_in[0][0]))[0]
IndexError: list index out of range

It happens when it processes the first bifurcation. e_in contains the edge from the source to the first bifurcation, so e_in[0][0] is the source point with no predecessors.

I tried to fix it using a try block as below:

try:
	combine = True
	nbifprec = list(self._model_graph.predecessors(e_in[0][0]))[0]
	branch = list(self._model_graph.successors(nbifprec))
	branch = branch.index(e_in[0][0])
	bifprec = self._model_graph.nodes[nbifprec]['bifurcation']

	C0 = bifprec.get_apexsec()[branch][0] # If merged bifurcations, C0 is the apex section of the previous bifurcation
except:
	combine = False
	C0 = e_in[0][0]

but then it just seems to run forever. For a tree with 500 branches, how long should it take?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions