ukbb_cardiac icon indicating copy to clipboard operation
ukbb_cardiac copied to clipboard

Demo fails to calculate wall thickness (ValueError: not enough values to unpack)

Open yaacoo opened this issue 2 years ago • 4 comments

Hi, Running the demo pipeline, all of the results CSV files are generated except for the wall thickness. The error I get is:

1 Traceback (most recent call last): File "short_axis/eval_wall_thickness.py", line 45, in <module> '{0}/wall_thickness_ED'.format(data_dir)) File "/ukbb_cardiac/common/cardiac_utils.py", line 370, in evaluate_wall_thickness aha_axis = determine_aha_coordinate_system(seg, affine) File "/ukbb_cardiac/common/cardiac_utils.py", line 194, in determine_aha_coordinat e_system _, contours, _ = cv2.findContours(cv2.inRange(epi, 1, 1), cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE) ValueError: not enough values to unpack (expected 3, got 2)

Thanks!!

yaacoo avatar Apr 19 '22 19:04 yaacoo

I get the same issue. Did you find a solution?

gustavahlberg avatar Jul 01 '22 13:07 gustavahlberg

No, I have not found a solution..

yaacoo avatar Jul 01 '22 15:07 yaacoo

In my version of opencv, the cv2.findContours only returns two values (apparently, it used to be three). The first one is no longer returned, but it was ignored anyway. So just removing the first underscore in the seven occurences of

_, contours, _ = cv2.findContours(...

to get

contours, _ = cv2.findContours(...

in common/cardiac_utils.py makes it work for me.

iimog avatar Jul 06 '22 17:07 iimog