finsberg / ldrb

A software for assigning myocardial fiber orientations based on the Laplace Dirichlet Ruled-Based algorithm
http://finsberg.github.io/ldrb
GNU Lesser General Public License v3.0
22 stars 8 forks source link

A potential bug in the code #29

Closed wilburmao closed 1 year ago

wilburmao commented 2 years ago

Hi Finsberg,

When I run the demo_lv.py code, I find that the resulting fiber orientations are not entirely expected. For example, when I use these parameters: alpha_endo_lv=60, alpha_epi_lv=-60, the fiber angle in the mid-layer should be consistent. But you can see that the fiber changes direction in the mid-layer. Only the top layer fibers in the z-direction are shown for clarity. image Similarly, when alpha_endo_lv=0, alpha_epi_lv=-60, the mid-layer fibers also have inconsistent angles on the right. image When the alpha_endo_lv=-10, alpha_epi_lv=-60, the fibers in the mid-layer seem to be correct. image

finsberg commented 2 years ago

Thanks @wilburmao. I agree that this does looks strange. How does it look if you use another function space (say, CG2 or DG1)? Does this help?

wilburmao commented 2 years ago

The results are about the same for different function spaces.

finsberg commented 2 years ago

@wilburmao Sorry for taking so long with fixing this one. I just submitted a bug fix. Would you be able to see if this problem is fixed now?

jingbinzhao415 commented 2 years ago

Hi Dr. Finsberg,

I have tested the updated version of ldrb. When I run the demo_lv.py code, some results of orientation are confused me. The fibers' orientation in the middle layer are expected as 0 degree, green arrows are what I expected. Below are my results. example1 alpha_endo_lv=60, # Fiber angle on the endocardium alpha_epi_lv=-60, # Fiber angle on the epicardium beta_endo_lv=0, # Sheet angle on the endocardium beta_epi_lv=0, # Sheet angle on the epicardium

image

example2 alpha_endo_lv=90, # Fiber angle on the endocardium alpha_epi_lv=-90, # Fiber angle on the epicardium beta_endo_lv=0, # Sheet angle on the endocardium beta_epi_lv=0, # Sheet angle on the epicardium

image

Thank you in advanced for your help!

Best, Jingbin

finsberg commented 2 years ago

I agree that the fiber orientations in the middle layer, or to say it more precisely, at the point where the radius is half way between ends and epi should be zero. Whether it is actually zero in the mesh you are using will depend on whether the nodes between endo and epi are located exactly half way between ends and epi.

You can try to do this on a finer mesh and see if the problem still remains.

finsberg commented 1 year ago

@wilburmao @jingbinzhao415 We just fixed a bug in ldrb. Could you check if the problem is fixed now, after upgrading to the latest version

python3 -m pip install ldrb --upgrade
jingbinzhao415 commented 1 year ago

Hi Dr. Finsberg,

@wilburmao I have checked it and the fiber looks good now. Thank you for your help!

finsberg commented 1 year ago

Great! I am closing this now then