@@ -195,7 +195,8 @@ def _list_outputs(self):
195
195
196
196
197
197
class 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)" )
199
200
radius = traits .Float (50 , usedefault = True ,
200
201
desc = 'radius in mm to calculate angular FDs, 50mm is the '
201
202
'default since it is used in Power et al. 2012' )
@@ -249,9 +250,11 @@ class FramewiseDisplacement(BaseInterface):
249
250
}]
250
251
251
252
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
253
254
diff = mpars [:- 1 , :] - mpars [1 :, :]
254
255
diff [:, :3 ] *= self .inputs .radius
256
+ if self .inputs .format == "AFNI" :
257
+ diff [:, :3 ] *= (np .pi / 180 )
255
258
fd_res = np .abs (diff ).sum (axis = 1 )
256
259
257
260
self ._results = {
0 commit comments