@@ -195,7 +195,8 @@ def _list_outputs(self):
195195
196196
197197class FramewiseDisplacementInputSpec (BaseInterfaceInputSpec ):
198- in_plots = File (exists = True , mandatory = True , desc = 'motion parameters as written by FSL MCFLIRT' )
198+ in_file = File (exists = True , mandatory = True , desc = 'motion parameters as written by FSL MCFLIRT or AFNI 3dvolreg' )
199+ format = traits .Enum ("FSL" , "AFNI" , desc = "Format of the motion parameters file: FSL (radians), AFNI (degrees)" )
199200 radius = traits .Float (50 , usedefault = True ,
200201 desc = 'radius in mm to calculate angular FDs, 50mm is the '
201202 'default since it is used in Power et al. 2012' )
@@ -249,9 +250,11 @@ class FramewiseDisplacement(BaseInterface):
249250 }]
250251
251252 def _run_interface (self , runtime ):
252- mpars = np .loadtxt (self .inputs .in_plots ) # mpars is N_t x 6
253+ mpars = np .loadtxt (self .inputs .in_file ) # mpars is N_t x 6
253254 diff = mpars [:- 1 , :] - mpars [1 :, :]
254255 diff [:, :3 ] *= self .inputs .radius
256+ if self .inputs .format == "AFNI" :
257+ diff [:, :3 ] *= (np .pi / 180 )
255258 fd_res = np .abs (diff ).sum (axis = 1 )
256259
257260 self ._results = {
0 commit comments