Get each slice of a volume as numpy array

Hi Andras,
Would you please tell me how to split the volume into slices after having volume into numpy array?

What I need to do is to apply clustering FCM algorithm on volume to get classified volume. For which I am thinking in this way.
Get the volume
Split it into slices
convert each slice into its respective numpy array
passing numpy array of a slice to algorithm
Getting the updated numpy array
converting numpy back to slice of volume
Then collectivly combining all the slices into volume

Thank you

Looking forward for your reply

You can easily get a slice of a volume by standard numpy indexing of arrays. Here is an example: https://gist.github.com/lassoan/d85be45b7284a3b4e580688fccdb1d02

However, I would recommend to segment in 3D rather than arbitrarily splitting the volume to 2D pieces and re-assembling it.

1 Like

Hi Andras,
Thank you for suggesting. Please tell where should I start from if I want to do 3D segmentation.

Regards,
Saima Safdar

What would you like to segment? On what imaging modality? For what clinical purpose?

Hi,
want to segment three parts brain, ventricles and tumor, MRI. automating the segmentation process and then using it for brain deformation calculation.