The code below seems to be the same as the code above. I think it would be better to make any volume a 4D volume (possibly with only one single element in the fourth, optional dimension). I think a `np.reshape` would do the trick, although there might exist some more clever and efficient alternatives.

Another option would be to put the duplicated code in a function (e.g.` resample_one_volume`).