baiwenjia / ukbb_cardiac

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

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

Open yaacoo opened 2 years ago

yaacoo commented 2 years ago

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!!

gustavahlberg commented 2 years ago

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

yaacoo commented 2 years ago

No, I have not found a solution..

iimog commented 2 years ago

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.

Janner125 commented 3 days ago

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.

hello,iimog!do you konw hou did this work get the 82 traits? I do not know the detils