@@ -593,25 +593,30 @@ def _remove_first_mask(in_file):
593593 return workflow
594594
595595
596- def _warp_dir (fixed_image , pe_dir , nlevels = 3 ):
596+ def _warp_dir (moving_image , fixed_image , pe_dir , nlevels = 3 ):
597597 """Extract the ``restrict_deformation`` argument from metadata."""
598598 import numpy as np
599599 import nibabel as nb
600600
601- img = nb .load (fixed_image )
601+ moving = nb .load (moving_image )
602+ fixed = nb .load (fixed_image )
602603
603- if np .any (nb .affines .obliquity (img .affine ) > 0.05 ):
604+ if np .any (nb .affines .obliquity (fixed .affine ) > 0.05 ):
604605 from nipype import logging
605606
606607 logging .getLogger ("nipype.interface" ).warn (
607608 "Running fieldmap-less registration on an oblique dataset"
608609 )
609610
610- vs = nb .affines .voxel_sizes (img .affine )
611- order = np .around (np .abs (img .affine [:3 , :3 ] / vs ))
612- retval = order @ [1 if pe_dir [0 ] == ax else 0.1 for ax in "ijk" ]
611+ moving_axcodes = nb .aff2axcodes (moving .affine , ["RR" , "AA" , "SS" ])
612+ moving_pe_axis = moving_axcodes ["ijk" .index (pe_dir [0 ])]
613+
614+ fixed_axcodes = nb .aff2axcodes (fixed .affine , ["RR" , "AA" , "SS" ])
615+
616+ deformation = [0.1 , 0.1 , 0.1 ]
617+ deformation [fixed_axcodes .index (moving_pe_axis )] = 1.0
613618
614- return nlevels * [retval . tolist () ]
619+ return nlevels * [deformation ]
615620
616621
617622def _mm2vox (moving_image , fixed_image , pe_dir , registration_config ):
0 commit comments