KVSlab / morphMan

A collection of tools for manipulation of morphological features in patient-specific geometries
https://morphman.readthedocs.io/en/latest/
Other
30 stars 12 forks source link

Issue with running Manipulate Branch tutorial #75

Closed JonathanPham closed 2 years ago

JonathanPham commented 2 years ago

Hi,

I am trying to run the tutorial for Manipulate Branch, but I am getting some errors. When I run the command, morphman-branch --ifile C0002/surface/model.vtp --ofile C0002/surface/moved_and_rotated_branch.vtp --azimuth-angle 180 --branch-number 1 --branch-location 21.7 18.1 25.9 --translation-method commandline --poly-ball-size 250 250 250, to translate and rotate the branch (as per the tutorial), I get the following error:

$ morphman-branch --ifile C0002/surface/model.vtp --ofile C0002/surface/moved_and_rotated_branch.vtp --azimuth-angle 180 --branch-number 1 --branch-location 21.7 18.1 25.9 --translation-method commandline --poly-ball-size 250 250 250
-- Computing centerlines and Voronoi diagram
-- Smoothing Voronoi diagram
-- Clipping Voronoi diagram
Computing distance.
/home/jonathanpham/anaconda3/envs/morphMan/lib/python3.10/site-packages/morphman/manipulate_branch.py:459: RuntimeWarning: divide by zero encountered in divide
  intersection = np.array(p2) + direction * (distance_array[id2] / length)
/home/jonathanpham/anaconda3/envs/morphMan/lib/python3.10/site-packages/morphman/manipulate_branch.py:459: RuntimeWarning: invalid value encountered in multiply
  intersection = np.array(p2) + direction * (distance_array[id2] / length)
Traceback (most recent call last):
  File "/home/jonathanpham/anaconda3/envs/morphMan/bin/morphman-branch", line 10, in <module>
    sys.exit(main_branch())
  File "/home/jonathanpham/anaconda3/envs/morphMan/lib/python3.10/site-packages/morphman/manipulate_branch.py", line 1105, in main_branch
    manipulate_branch(**read_command_line_branch())
  File "/home/jonathanpham/anaconda3/envs/morphMan/lib/python3.10/site-packages/morphman/manipulate_branch.py", line 112, in manipulate_branch
    move_and_rotate_branch(polar_angle, azimuth_angle, capped_surface, centerlines, centerlines_complete,
  File "/home/jonathanpham/anaconda3/envs/morphMan/lib/python3.10/site-packages/morphman/manipulate_branch.py", line 270, in move_and_rotate_branch
    origin, old_normal = get_origin(voronoi_remaining, centerlines, diverging_centerline_branch)
  File "/home/jonathanpham/anaconda3/envs/morphMan/lib/python3.10/site-packages/morphman/manipulate_branch.py", line 465, in get_origin
    new_normal = surface_with_normals.GetPointData().GetNormals().GetTuple(intersection_id)
ValueError: expects 0 <= tupleIdx && tupleIdx < GetNumberOfTuples()

It looks like the tutorial example is not working out-of-the-box for me. Any recommendations on how to solve this problem?

JonathanPham commented 2 years ago

Nevermind, I think the issue is that branch-number is set to 1 in the tutorial. I changed this value to 2 and it works for me now.