Closed Yhe9718 closed 2 years ago
Hi @hy939251175 ,
Thanks for your interest here, could you please help provide the error message and full test program for further analysis? Then @ahatamiz may help provide more information about the expected data shape.
Thanks in advance.
Hi @hy939251175 , would you please post the error message ? note that slice_map is only intended to select one slice of the entire 3D volume for visualization purposes only.
Thanks
Hi @Nic-Ma and @ahatamiz. thank you for your response. The error messages are as the following, and the code that I tried to run was unchanged from 3d_segmentation/unetr_btcv_segmentation_3d.ipynb
Many thanks
KeyError Traceback (most recent call last)
KeyError: 170
Hi, I tried to run the code(attached below) after loading the images but got an error with the dimension. I am wondering if the image's shape should be torch.Size([1, 220, 220, 45]).
Thank you
slice_map = { "img0035.nii.gz": 170, "img0036.nii.gz": 230, "img0037.nii.gz": 204, "img0038.nii.gz": 204, "img0039.nii.gz": 204, "img0040.nii.gz": 180, } case_num = 0 img_name = os.path.split(val_ds[case_num]["image_meta_dict"]["filename_or_obj"])[1] img = val_ds[case_num]["image"] label = val_ds[case_num]["label"] img_shape = img.shape label_shape = label.shape print(f"image shape: {img_shape}, label shape: {label_shape}") plt.figure("image", (18, 6)) plt.subplot(1, 2, 1) plt.title("image") plt.imshow(img[0, :, :, slice_map[img_name]].detach().cpu(), cmap="gray") plt.subplot(1, 2, 2) plt.title("label") plt.imshow(label[0, :, :, slice_map[img_name]].detach().cpu()) plt.show()