How to extract 2D patches from 3D medical image

I guess I already replied to you here: Creating non overlapping patches and reconstructing image back from the patches