NeuroMorph-EPFL / NeuroMorph

The NeuroMorph analysis and visualization toolkit
https://neuromorph.epfl.ch/
Other
64 stars 23 forks source link

Centerline Processing fails in Blender 3.6.2 #7

Closed svizec closed 1 week ago

svizec commented 1 year ago

Hello,

I am trying to create a centerline on a mesh object that is actually a slightly deformed cylinder, and then I would like to extract the cross-sections. I tried the Neuromorph Centerline Processing plugin in Blender 3.6.2, but I got the following error message:

Python: Traceback (most recent call last): File "C:\Users*USER\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\NeuroMorph_Centerline_Processing.py", line 243, in execute this_area, this_poly = get_cross_section(crv, ind, mesh, kd_mesh, self) File "C:\Users*USER\AppData\Roaming\Blender Foundation\Blender\3.6\scripts\addons\NeuroMorph_Centerline_Processing.py", line 1417, in get_cross_section x = break_code NameError: name 'break_code' is not defined

I checked the Python script for definitions of break_code and could not find anything. Then I went and tried running the plugin on a simple cylinder mesh. I used the "poke face" command to generate a central point (vertex) on the capping planar faces. Then, I selected the newly created vertices and tried the "Approximate Centerline" command with 10 centerline points. It failed with the same error message. It also created a strange artefact, shown in one of the figures below. The artefact is a new object that was created along with another object (a copy?) of a cylinder (see the screenshot of the model tree below). The only object I had in the tree before was the Cylinder.

image image image image

Thank you in advance for any help you could provide.

Žiga

ajorstad commented 1 year ago

Hi Žiga-

Thanks for using NeuroMorph.

The Centerline tool requires the object to have vertices along the length of the cylindar, which the tool uses to guide the generation of the geometry. You will need to subdivide all the long rectangles of your cylindar several times. The default setting of the tool tries to create 200 centerline points, which is too many for your case. For example, if you subdivide your rectangles 4 times, then ask for 15 or 17 centerline points, this should give you a reasonable result.

From the screenshot, we can also see that the search radius around the centerline point needs to be increased quite a bit (try 3?). This should be bigger than the cross sections of your object. The "artefact" you mention is the tool trying to create a cross section, from which it then creates a single centerline point, but the surface wasn't big enough to intersect the entire boundary of your object.

(break_code is my simple hack for stopping the calculation when it has reached at a state that cannot be fixed.)

Hope that helps!