Closed sumaira-hussain closed 1 year ago
This is impossible to say without seeing the data. Can you share that?
000001.nii.gz 000002.nii.gz 000003.nii.gz 000004.nii.gz 000001.nii.gz 000002.nii.gz 000003.nii.gz 000004.nii.gz these are some sample images. containing images and their labels.
your images have three slices that are all identical. Is that intentional? Other than that the images look OK and the objects should easily be recognized by nnU-Net. If you send me the whole dataset in nnU-Net format I can take a look to see what's going on. You can also send this to my email f.isensee@dkfz.de so that it's not public.
No it’s not intentional. I will send you the whole dataset and code that has been used to convert png images into nifti images. I followed all the instructions yet my results are being null. It would be highly appreciated if you could help me identify what went wrong.
Get Outlook for iOShttps://aka.ms/o0ukef
From: Fabian Isensee @.> Sent: Friday, December 10, 2021 7:20:13 PM To: MIC-DKFZ/nnUNet @.> Cc: sumaira-hussain @.>; Author @.> Subject: Re: [MIC-DKFZ/nnUNet] Segmentation results for 2d ultrasound images are null (Issue #872)
your images have three slices that are all identical. Is that intentional? Other than that the images look OK and the objects should easily be recognized by nnU-Net. If you send me the whole dataset in nnU-Net format I can take a look to see what's going on. You can also send this to my email @.**@.> so that it's not public.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/MIC-DKFZ/nnUNet/issues/872#issuecomment-990885372, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFQP2BBDXAHL4PIHYTX5FGDUQHO63ANCNFSM5JGC3M4Q. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Looking forward to your mail :-) Best, Fabian
Hi Sumaira, thanks for the dataset. Here is the script I used to convert it. It works fine for me after I removed all the faulty cases:
import numpy as np
from batchgenerators.utilities.file_and_folder_operations import maybe_mkdir_p, subfiles, join
from skimage.io import imread
from nnunet.paths import nnUNet_raw_data
from nnunet.dataset_conversion.utils import generate_dataset_json
from nnunet.utilities.file_conversions import convert_2d_image_to_nifti
if __name__ == '__main__':
# set path
source = '/home/isensee/Downloads/BUS_dataset'
task_id = 999
task_name = "DELETEME"
foldername = "Task%03.0d_%s" % (task_id, task_name)
# setting up nnU-Net folders
out_base = join(nnUNet_raw_data, foldername)
imagestr = join(out_base, "imagesTr")
labelstr = join(out_base, "labelsTr")
maybe_mkdir_p(imagestr)
maybe_mkdir_p(labelstr)
# convert training png images to nii
ok = []
broken = []
shape_mismatch = []
for fname in subfiles(join(source, 'images'), suffix='.png', join=False):
try:
im = imread(join(source, 'images', fname))
seg = imread(join(source, 'label', fname))
if not all(i==j for i,j in zip(im.shape, seg.shape)):
shape_mismatch.append(fname)
continue
convert_2d_image_to_nifti(join(source, 'label', fname), join(labelstr, fname[:-4]), is_seg=True, transform=lambda x: (x > 0).astype(np.uint8))
convert_2d_image_to_nifti(join(source, 'images', fname), join(imagestr, fname[:-4]), is_seg=False)
ok.append(fname)
except:
broken.append(fname)
# convert testing png images to nii
# I do not have the test set in your zip file...
# finally we can call the utility for generating a dataset.json
generate_dataset_json(join(out_base, 'dataset.json'), imagestr, None, modalities=('nonCT',),
labels={0: "background", 1: "tumor"}, dataset_name=foldername, license='hands off!')
Best, Fabian
Thank you very much Dr. Fabian. I will check again.
Discussed in https://github.com/MIC-DKFZ/nnUNet/discussions/871