baiwenjia / ukbb_cardiac

Some code for processing and analysing UK Biobank cardiac MR images.
Apache License 2.0
148 stars 64 forks source link

average_3d_ffd segmentation fault error #13

Open vt232 opened 2 years ago

vt232 commented 2 years ago

Hi, I tried running the code both on MacOS and Ubuntu, using the official MIRTK docker image as base image. In both cases I get a seg fault error during execution of the average_3d_ffd program. Seems like the issue is in the nested loop in average_3d_ffd.cc. X, Y and Z are 1 (single control point) for every forward / backward transformation pair except for the very first and the very last pairs. In particular, for the first example, the very first forward transformation from fr00 to fr01 has 29 control points, while the corresponding backward transformation has a single control point, which causes the seg fault error. What is the correct way to fix this issue?

iimog commented 2 years ago

This is probably related to an issue in mirtk (https://github.com/BioMedIA/MIRTK/issues/782). You can work around it by removing the -approximate option in the call to mirtk compose-dofs and add a call to mirtk convert-dof to combine the multiple transformations into a single one. Once the issue is solved in mirtk no workaround (except for updating mirtk) should be necessary.

fymobo commented 1 year ago

This is probably related to an issue in mirtk (BioMedIA/MIRTK#782). You can work around it by removing the -approximate option in the call to mirtk compose-dofs and add a call to mirtk convert-dof to combine the multiple transformations into a single one. Once the issue is solved in mirtk no workaround (except for updating mirtk) should be necessary.

Hello there, thanks very much for your contribution. I modified the code in as you did and it works well for most of ukb data. However, I still got errors in strain analysis by MIRTK for several participants' data as follows:

MatrixToAffineParameters: Matrix is singular or very close to singular!. Error: convert-dof command returned non-zero exit status 1

Could you please help me with this issue? Thanks very much!

iimog commented 1 year ago

I have the same problem as well in roughly 3-5% of the participants. I tried several things but was unable to fix it so far. This issue seems to be related: https://github.com/BioMedIA/MIRTK/issues/758 but increasing the tolerance also did not fix it. If you have any ideas, I'm happy to hear them.

fymobo commented 1 year ago

I have the same problem as well in roughly 3-5% of the participants. I tried several things but was unable to fix it so far. This issue seems to be related: BioMedIA/MIRTK#758 but increasing the tolerance also did not fix it. If you have any ideas, I'm happy to hear them.

Thanks for your reply! The strain analysis pipeline will be interrupted and no tabular result will be written when this problem is raised. Is it convenient for you to share the modified code in eval_strain_lax.py and eval_strain_sax.py to fix this problem? I really appreciate your kind help!

iimog commented 1 year ago

Ah yes, I did not change anything there. Instead, I'm now running each participant individually. So if one fails, that does not affect the others. It also allows better parallelization. But I have to aggregate the results manually in the end.

fymobo commented 1 year ago

I used try-expection code block and it also worked. Thank you!!!