Closed FransR09 closed 7 years ago
Hi @FransR09 Thanks for your comments.
Yes, actually I do the segmentation patch-wise, running over the whole 3D volume and then I stitch the predicted patches at the end in a whole volume with the same size than the original input.
Thank you. Could you please tell me which lines are for the stitching? Sorry I'm kinda lost in the code.
Hi @FransR09
For training, patches are extracted in the function getSamplesSubject, in the sampling.py file (inside /Modules/IO/).
For testing, in the segmentVolume function (startTesting.py file ) in line 111 all patches are extracted from a given patient in extract samples (according to the coords given by the sampleWholeImage function). Then, in line 126 we run over all patches to construct the final prediction (i.e. whole volume).
Hope it helps.
Cheers.
Thanks so much@josedolz. Now I understand more about the codes. But still got two questions:
1) how do you solve the "left" "right" confusion? since the brain tissues you're dealing with are symmetric. i.e. same tissue with left and right parts, do they have the same or different labels?
2) I don't quite understand this line: segmentationImage = np.argmax(probMaps, axis=0), how is argmax gonna retrieve the voxel values of the image?
Hi @FransR09 ,
sorry for my delayed answer, I am busy with couple of papers and I have hard time to find some free time for this..:)
For 1, in the paper is explained that we treat each of the structures as a single target. So they have different labels. I never tried, but I expect that giving the same label to same structure regardless they location on the brain would also work nicely.
For question 2, probMaps is actually an image of size: (num_classes, size_X,size_Y,size_Z), where size_X, size_Y and size_Z represent sizes of your volume in the three axes, and num_classes is the number of targets you want to segment. Since the output of a CNN (before the discrete prediction) predicts probabilities, you will have a spatial probability map per class, indicating at each voxel the probability of belonging to that class. So, probMaps[0,:,:,:] is the prob map for the background, probMaps[1,:,:,:] is the prob map for class 1, and so on. Then, with argmax you simply retrieve the image in which each voxel has its maximum value, i.e. probability.
I think I can already close this issue.
Hi, your work is great. I'm curious to know do you stitch patches at the end? Otherwise you should only get the probability map for that single patch, right?