Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reshape error #12

Closed
chengjianhong opened this issue Apr 6, 2020 · 3 comments
Closed

Reshape error #12

chengjianhong opened this issue Apr 6, 2020 · 3 comments

Comments

@chengjianhong
Copy link

Hi,
Thanks for your excellent work, I used it to segment the lung, but the following error occurred:

Traceback (most recent call last):
  File "Lung_mask.py", line 133, in <module>
    save_lung_mask()
  File "Lung_mask.py", line 16, in save_lung_mask
    segmentation = mask.apply(input_image,model)
  File "/home/jhcheng/userfolder/Anaconda3/envs/py36/lib/python3.6/site-packages/lungmask/mask.py", line 62, in apply
    outmask = np.asarray([utils.reshape_mask(outmask[i], xnew_box[i], inimg_raw.shape[1:]) for i in range(outmask.shape[0])], dtype=np.uint8)
  File "/home/jhcheng/userfolder/Anaconda3/envs/py36/lib/python3.6/site-packages/lungmask/mask.py", line 62, in <listcomp>
    outmask = np.asarray([utils.reshape_mask(outmask[i], xnew_box[i], inimg_raw.shape[1:]) for i in range(outmask.shape[0])], dtype=np.uint8)
  File "/home/jhcheng/userfolder/Anaconda3/envs/py36/lib/python3.6/site-packages/lungmask/utils.py", line 79, in reshape_mask
    res[tbox[0]:tbox[2],tbox[1]:tbox[3]] = imgres
ValueError: could not broadcast input array from shape (26,871) into shape (26,803)

@JoHof
Copy link
Owner

JoHof commented Apr 6, 2020

Hi,

well, thats weird. I am not sure how this could happen. Does it happen with every image you try or is it just one case?

@JoHof
Copy link
Owner

JoHof commented Apr 6, 2020

what shape does input_image have? input_image.GetSize()

@chengjianhong
Copy link
Author

chengjianhong commented Apr 6, 2020

@JoHof I checked my input image. The image shape is (803,26,512) and its voxel dimension is 0.474x6.95x0.475. This image is not consistent with my other images, I will exclude it.
image

@JoHof JoHof closed this as completed Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants