0

I want to use 3D-UNet to do semantic segmentation to MRI data. I read the whole brain MRI data as a 3D array, the shape of it is (193,229,193). And I use scipy.ndimage.zoom() resize its mask to (256, 256, 128). Aftering resize, you can see the result: Code:

resize_img = itpl.zoom(img, (resize[0] / img.shape[0], resize[1] / img.shape[1], resize[2] / img.shape[2]), mode='nearest')

The mask becomes to be not binary, 1 and 0.

What's the reason and how should I do to preprocessing the data in 3D-UNet.

PinkR1ver
  • 402
  • 1
  • 4
  • 13

1 Answers1

0

This issue was asked in another post A weird image modification after applying scipy.ndimage.zoom function to a mri segmentation image and addressed. You should add-in order=0 flag to your zoom call to keep the image binary. it'll fix the problem.

Z.A.
  • 1
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 06 '22 at 06:21