yhygao / CBIM-Medical-Image-Segmentation

A PyTorch framework for medical image segmentation
Apache License 2.0
260 stars 46 forks source link

How to calculate the median spacing #14

Closed dzzhang96 closed 1 year ago

dzzhang96 commented 1 year ago

Hi yhygao,

Thank you for the codes! Can I ask how you calculate the median spacing when preprocessing the dataset? I found that all the three datasets have different median spacing.

yhygao commented 1 year ago

Hi,

Thank you for your interest in our work. You can write a simple script to get the median spacing of a new dataset. I use SimpleITK to get the spacing information of each image. Then put the spacing of all images into a list. You can get the median of the list with NumPy. I hope this helps.

dzzhang96 commented 1 year ago

@yhygao Thanks for the reply. Would you please elaborate on the following lines in the function preprocess in dataset_bcv.py and dataset_lits.py? Thanks again!

img = np.clip(img, -17, 201)
img -= 99.40
img /= 39.39
yhygao commented 1 year ago

This is to normalize the image as a preprocessing step. I followed nnUNet to normalize the image with the mean and std of the foreground. The value I chose were referred to the nnUNet paper (https://arxiv.org/pdf/1904.08128.pdf). I didn't compute the value by myself.