KidsWithTokens / MedSegDiff

Medical Image Segmentation with Diffusion Model
MIT License
979 stars 147 forks source link

Brats3D dataloader #87

Open saisusmitha opened 1 year ago

saisusmitha commented 1 year ago

@WuJunde Hi. In brats data loader code - in BRATSDataset3D Why is there n = x // 155 #quotientslice = x % 155 #remainder given - I think it's saying which slice to consider - are we considering only one slice out of 155 for training? Also when I run segmentation_sample.py the batch size is 1 and the same folder i.e single folder from the dataset directory is selected every time - I don't know y can you help me out

WuJunde commented 1 year ago

n is the index of which volume it is, slice index (x) // slice number one volume(155) == the index of volume (n)

saisusmitha commented 1 year ago

@WuJunde I understood it partially Tq. Is this the site(https://www.med.upenn.edu/cbica/brats2020/data.html) from where the data is downloaded because the folders are not slice wise as you showed in readme. It shows lots of slice wise folders data └───training │ └───slice0001 │ │ t1.nii.gz │ │ t2.nii.gz │ │ flair.nii.gz │ │ t1ce.nii.gz │ │ seg.nii.gz │ └───slice0002 Kindly tell me how to preprocess to get such slice-wise folder. I downloaded it from the above link and the data loader works without changing much of it (so did you show just renamed version of original data or you had to do some preprocessing to convert into slice wise folders?) Also, can you explain what exactly the brats3d dataset class does i.e the preprocessing part? What is the dataset for validation? did you split the training data into 332 for train and 37 for validation? For validation suppose there are 37 images in validation folder,in segmentation_sample.py while loading them, the n is always 0 as 37 is less than 155 and only 1st folder which is saved in the database (filedict = self.database[n]) is getting selected, and evaluated in the loop. Kindly correct my understanding as explained above I am facing issues. This is how the datset looks for me. Its a folder for each patient. Kindly tell if there is some preprocessing in saving them to slice wise folders as you showed in readme brats3d brstas3d_1

WuJunde commented 1 year ago

brats3d loader is used for volume data, like yours. another brats dataloader is used for the slices data, as which I show In readme. so you can just use brats3d loader, no need to prepare dataset follow my readme.

saisusmitha commented 1 year ago

@WuJunde Tq. Can you share the code to process them into slices as you did. In the dowloaded dataset there are 369 patients so 369 folders. Then does n represent 0 to 369? Can you tell me what exactly n and x is in brats3d dataset

My another question is: What is the dataset for validation? did you split the training data into 332 for train and 37 for validation? Suppose for validation there are 37 images in validation folder,in segmentation_sample.py while loading them, the n is always 0 as 37 is less than 155 and only 1st folder which is saved in the database (filedict = self.database[n]) is getting selected, and evaluated in the loop. Kindly correct my understanding as explained above I am facing issues.

Kindly explain and share the code for saving 3d data slice wise as you did.

saisusmitha commented 1 year ago

@WuJunde Kindly help me withe above issues