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

Runtime Warning in Manipulate Bend, Manipulate Curvature #69

Closed SMSadat98 closed 2 years ago

SMSadat98 commented 2 years ago

I have a simple geometry containing one inlet and 2 outlets. While using both Manipulate bend and Manipulate curvature, it displays the following warning:

For Manipulate bend:

-- Clipping Voronoi diagram -- Computing translation directions. -- Smoothing, clean, and check surface C:\Users\user\anaconda3\envs\morphman\lib\site-packages\morphman-0.3-py3.6.egg\morphman\common\surface_operations.py:554: RuntimeWarning: invalid value encountered in arccos Cleaning surface. Triangulating surface. Computing centerlines. Computing centerlines...

Due to the error in the surface_operations module in line 554, the "# Extract translation vectors" portion in manipulate bend does not get executed. The process finishes but there is no change in the geometry.

I have attached the picture of the geometry and can also provide the vtp file personally. Can anyone help me out?

image

hkjeldsberg commented 2 years ago

Hello @SMSadat98,

Thanks for reporting the issue. This may have been a previously known issue, which we have fixed in later versions of morphMan. So my immediate suggestion would be to upgrade to the latest version (v1.2).

Alternatively, if you share the .vtp-model with me and the command you are running I can have a look myself.

Best regards, Henrik

SMSadat98 commented 2 years ago

Hello @hkjeldsberg

Thank you very much for the early response.

A bit of a mistake on my end: I did not specify the values of alpha and beta properly at first. However, the problems I am facing now are:

  1. The vertical bend (alpha) works fine, up to the value 0.6. any more than results in an error.
  2. The horizontal bend (beta) did not work at all for me and showed mostly "centerline_operations.py:133: RuntimeWarning: invalid value encountered in power" error.

How may I share the .vtp model?

Also, I have attached a picture marking the regions I am trying to modify.

Best Regards, Sadat

Script:

from morphman import manipulate_bend, read_command_line_bend

Set input and output paths

id_name = "" input_filepath = "C:\Users\user\Desktop\Morphman\"+id_name+"\"+id_name+".vtp" output_filepath = "C:\Users\user\Desktop\Morphman\"+id_name+"\"+id_name+"bend.vtp"

Get default values for manipulate_bend

default_values = read_command_line_bend(input_filepath, output_filepath)

Set region of interest

default_values["region_of_interest"] = "manual" default_values["region_points"] = []

Method specific parameters

default_values["alpha"] = 0 default_values["beta"] = 0.4

Parameters for reconstructing the surface

default_values["poly_ball_size"] = [50, 50, 50]

Run manipulation

manipulate_bend(**default_values)

example

hkjeldsberg commented 2 years ago

Hi @SMSadat98 ,

I see, and thanks for supplying the command line arguments! You can send the model to henrik.kjeldsberg@live.no, and I can have a look.

Best regards, Henrik

SMSadat98 commented 2 years ago

Hello @hkjeldsberg

I have sent the .vtp model.

Best regards, Sadat

SMSadat98 commented 2 years ago

Hello @hkjeldsberg

I was trying to update to morphman v1.2. I have all the dependencies with the correct versions as per morphman documentation.

but while importing morphman, I get the error:

ImportError: DLL load failed while importing vtkvmtkSegmentationPython: The specified module could not be found.

I have tried several proposed solutions such as reinstalling packages properly, reinstalling c++ redistributable. I have also tried to add the directory containing the vtkvmtkSegmentationPython.pyd file to system path (sys.path.append()). None of them work.

Any suggestions?

Best regards, Sadat

hkjeldsberg commented 2 years ago

Hello @SMSadat98 ,

I investigated your initial issue, and made a hotfix for it under #70. It will be merged to master as soon as the tests pass. Running your command using the fix resulted in the following manipulated model (shown in red). model_new

The recent error you discovered seems to be related to Windows installation, and this is something I am currently investigating. I'll ping you as soon as I have an explanation for this.

Best regards, Henrik

hkjeldsberg commented 2 years ago

Hello again @SMSadat98 ,

I discovered that people are having the similar issue as you, but without any immediate fix. So i would suggest one of two things:

  1. Follow the suggestions in this thread: https://bytemeta.vip/repo/vmtk/vmtk/issues/379

or

  1. Comment out the following lines inside M:\.conda\envs\your_environment\lib\site-packages\vmtk\vtkvmtk.py (edit the path to your conda installation):
    from .vtkvmtkSegmentationPython import *
    from .vtkvmtkITKPython import *

    morphMan does not depend upon them, and they seem to be causing the trouble. The second optioned worked fine for me, and I was able to import morphMan without any issues.

Best regards, Henrik

SMSadat98 commented 2 years ago

Hello @hkjeldsberg

Regarding the installation of morphman 1.2, the second method worked perfectly. Thank you very much!

Hopefully the hotfix to manipulate bend gets merged soon!

For issues regarding bifurcation, should I post a new issue or should I continue here?

Best Regards, Sadat

hkjeldsberg commented 2 years ago

Hi @SMSadat98 ,

That's great to hear!

I actually already merged it to the master branch now, so if you are working on the development version of morphMan, just pull the latest changes and it should be fixed!

For any new issues, we should probably start a new thread. So I'll be closing this one for now.

Best, Henrik