Skip to content

Commit cf8b357

Browse files
committed
Closes #512
1 parent 8a642a4 commit cf8b357

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

fmriprep/interfaces/images.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,15 @@ def _flatten_split_merge(in_files):
213213

214214

215215
def _gen_reference(fixed_image, moving_image, out_file=None):
216-
import os.path as op
217216
import numpy
218217
from nilearn.image import resample_img, load_img
219218

220219
if out_file is None:
221220
out_file = genfname(fixed_image, suffix='reference')
222-
new_zooms = load_img(moving_image).header.get_zooms()
223-
resample_img(fixed_image, target_affine=numpy.diag(new_zooms),
221+
new_zooms = load_img(moving_image).header.get_zooms()[:3]
222+
# Avoid small differences in reported resolution to cause changes to
223+
# FOV. See https://github.com/poldracklab/fmriprep/issues/512
224+
new_zooms_round = numpy.round(new_zooms, 3)
225+
resample_img(fixed_image, target_affine=numpy.diag(new_zooms_round),
224226
interpolation='nearest').to_filename(out_file)
225227
return out_file

0 commit comments

Comments
 (0)