@@ -165,10 +165,9 @@ class ArtifactDetectInputSpec(BaseInterfaceInputSpec):
165165 desc = ("Use differences between successive motion (first element)"
166166 "and intensity paramter (second element) estimates in order"
167167 "to determine outliers. (default is [True, False])" ))
168- use_norm = traits .Bool (True , requires = ['norm_threshold' ],
168+ use_norm = traits .Bool (requires = ['norm_threshold' ],
169169 desc = ("Uses a composite of the motion parameters in "
170- "order to determine outliers." ),
171- usedefault = True )
170+ "order to determine outliers." ))
172171 norm_threshold = traits .Float (desc = ("Threshold to use to detect motion-rela"
173172 "ted outliers when composite motion is "
174173 "being used" ), mandatory = True ,
@@ -307,7 +306,7 @@ def _list_outputs(self):
307306 outputs ['intensity_files' ] = []
308307 outputs ['statistic_files' ] = []
309308 outputs ['mask_files' ] = []
310- if isdefined (self .inputs .use_norm ) and self . inputs . use_norm :
309+ if isdefined (self .inputs .norm_threshold ) :
311310 outputs ['norm_files' ] = []
312311 if self .inputs .bound_by_brainmask :
313312 outputs ['displacement_files' ] = []
@@ -321,7 +320,7 @@ def _list_outputs(self):
321320 outputs ['intensity_files' ].insert (i , intensityfile )
322321 outputs ['statistic_files' ].insert (i , statsfile )
323322 outputs ['mask_files' ].insert (i , maskfile )
324- if isdefined (self .inputs .use_norm ) and self . inputs . use_norm :
323+ if isdefined (self .inputs .norm_threshold ) :
325324 outputs ['norm_files' ].insert (i , normfile )
326325 if self .inputs .bound_by_brainmask :
327326 outputs ['displacement_files' ].insert (i , displacementfile )
@@ -427,7 +426,7 @@ def _detect_outliers_core(self, imgfile, motionfile, runidx, cwd=None):
427426 mask_img = Nifti1Image (mask .astype (np .uint8 ), affine )
428427 mask_img .to_filename (maskfile )
429428
430- if self .inputs .use_norm :
429+ if isdefined ( self .inputs .norm_threshold ) :
431430 brain_pts = None
432431 if self .inputs .bound_by_brainmask :
433432 voxel_coords = np .nonzero (mask )
@@ -470,20 +469,20 @@ def _detect_outliers_core(self, imgfile, motionfile, runidx, cwd=None):
470469 # write output to outputfile
471470 np .savetxt (artifactfile , outliers , fmt = b'%d' , delimiter = ' ' )
472471 np .savetxt (intensityfile , g , fmt = b'%.2f' , delimiter = ' ' )
473- if self .inputs .use_norm :
472+ if isdefined ( self .inputs .norm_threshold ) :
474473 np .savetxt (normfile , normval , fmt = b'%.4f' , delimiter = ' ' )
475474
476475 if isdefined (self .inputs .save_plot ) and self .inputs .save_plot :
477476 import matplotlib
478477 matplotlib .use (config .get ("execution" , "matplotlib_backend" ))
479478 import matplotlib .pyplot as plt
480479 fig = plt .figure ()
481- if isdefined (self .inputs .use_norm ) and self . inputs . use_norm :
480+ if isdefined (self .inputs .norm_threshold ) :
482481 plt .subplot (211 )
483482 else :
484483 plt .subplot (311 )
485484 self ._plot_outliers_with_wave (gz , iidx , 'Intensity' )
486- if isdefined (self .inputs .use_norm ) and self . inputs . use_norm :
485+ if isdefined (self .inputs .norm_threshold ) :
487486 plt .subplot (212 )
488487 self ._plot_outliers_with_wave (normval , np .union1d (tidx , ridx ),
489488 'Norm (mm)' )
@@ -521,7 +520,7 @@ def _detect_outliers_core(self, imgfile, motionfile, runidx, cwd=None):
521520 'std' : np .std (gz , axis = 0 ).tolist ()},
522521 ]},
523522 ]
524- if self .inputs .use_norm :
523+ if isdefined ( self .inputs .norm_threshold ) :
525524 stats .insert (3 , {'motion_norm' :
526525 {'mean' : np .mean (normval , axis = 0 ).tolist (),
527526 'min' : np .min (normval , axis = 0 ).tolist (),
0 commit comments