ValueError: Field of view of image #1 is different from reference FOV

Tried running:

decoder = Decoder(estimator='svc', scoring='accuracy')
decoder.fit(X_train, y_train)

The shape of any file in X_train is (57, 68, 65, 244)

And here is the complete error log:

ValueError: Field of view of image #1 is different from reference FOV.
Reference affine:
array([[   3.43799996,    0.        ,    0.        ,  -96.5       ],
       [   0.        ,    3.43700004,    0.        , -132.5       ],
       [   0.        ,    0.        ,    3.        ,  -78.5       ],
       [   0.        ,    0.        ,    0.        ,    1.        ]])
Image affine:
array([[   3.43799996,    0.        ,    0.        ,  -96.5       ],
       [   0.        ,    3.43799996,    0.        , -132.5       ],
       [   0.        ,    0.        ,    3.        ,  -78.5       ],
       [   0.        ,    0.        ,    0.        ,    1.        ]])
Reference shape:
(57, 68, 65)
Image shape:
(57, 68, 65, 244)

You can find a recreation of the error here: GitHub - psymbio/nilearn_error

Just run the jupyter notebook: nilearn_error_recreation.ipynb

Hi, Indeed the image affine is slightly different from the reference affine. You probably want to resample the reference (atlas, I guess) to your data, e.g. using the nilearn.image.resample_to_img function.
HTH,
Bertrand