For a 3D image, I would like to represent each voxel as a 3D patch consisting of neighbouring voxels (of radius r and includes padding if needed). So the result would be a 4