how to prepare 3D nifti images for 2D semantic segmentation network training

7 views (last 30 days)
Hi,
I have a bunch of 3D nifti images (which every image composed of multipule 2D images, i.e: 512 x 512 x 150). I also have a deep learning training network for semantic segmentation of 2D images (512 x 512). Do I need to extract from each 3D nifti image - a bunch of PNG images to use them as inputs to the network? Or can I use them as nifti type? if so - how?
code examples will be great!

Answers (1)

Raunak Gupta
Raunak Gupta on 31 May 2020
Hi,
From my understanding you have bunch of nifti image you can read into a matrix. You can combine those bunch of images along last dimension so that lets say you have 10 images then overall matrix will have a size (512 x 512 x 1500) assuming each nifti image is of size (512 x 512 x 150). This can then pass to the trainNetwork instead of a datastore object. Similar concatenation can be done for labels.
That being said this will work only when the entire data you have fit in the memory.
If the data doesn’t fits into the memory I recommended the way you mentioned of saving the individual 512 x 512 images as a ‘.tif or .png file and then reading those (1500 files in this case) using imageDatastore. Datastore will ensure that minibatch number of images will only reside in memory at any point of training.
Hope this helps!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!