Splitting NIFTI images to voxel patches

I am trying to split a 3D MRA NIFTI image into voxel patches of equal sizes (e.g. 2 x 2 x 2).
The goal is to use the voxels to train a 3D CNN to detect anomalies within the cerebral arteries.

How can this be achieved with Python?