8
8
import nipype .interfaces .freesurfer as fs # freesurfer
9
9
import nipype .interfaces .spm as spm
10
10
11
+ from nipype import LooseVersion
12
+
11
13
from ...smri .freesurfer .utils import create_getmask_flow
12
14
13
15
def getthreshop (thresh ):
@@ -415,6 +417,11 @@ def create_featreg_preproc(name='featpreproc', highpass=True, whichvol='middle')
415
417
>>> preproc.run() # doctest: +SKIP
416
418
"""
417
419
420
+ version = 0
421
+ if fsl .Info .version () and \
422
+ LooseVersion (fsl .Info .version ()) > LooseVersion ('5.0.6' ):
423
+ version = 507
424
+
418
425
featpreproc = pe .Workflow (name = name )
419
426
420
427
"""
@@ -658,17 +665,6 @@ def create_featreg_preproc(name='featpreproc', highpass=True, whichvol='middle')
658
665
659
666
featpreproc .connect (medianval , ('out_stat' , getmeanscale ), meanscale , 'op_string' )
660
667
661
- """
662
- Perform temporal highpass filtering on the data
663
- """
664
-
665
- if highpass :
666
- highpass = pe .MapNode (interface = fsl .ImageMaths (suffix = '_tempfilt' ),
667
- iterfield = ['in_file' ],
668
- name = 'highpass' )
669
- featpreproc .connect (inputnode , ('highpass' , highpass_operand ), highpass , 'op_string' )
670
- featpreproc .connect (meanscale , 'out_file' , highpass , 'in_file' )
671
- featpreproc .connect (highpass , 'out_file' , outputnode , 'highpassed_files' )
672
668
673
669
"""
674
670
Generate a mean functional image from the first run
@@ -681,6 +677,37 @@ def create_featreg_preproc(name='featpreproc', highpass=True, whichvol='middle')
681
677
682
678
featpreproc .connect (meanscale , ('out_file' , pickfirst ), meanfunc3 , 'in_file' )
683
679
featpreproc .connect (meanfunc3 , 'out_file' , outputnode , 'mean' )
680
+
681
+ """
682
+ Perform temporal highpass filtering on the data
683
+ """
684
+
685
+ if highpass :
686
+ highpass = pe .MapNode (interface = fsl .ImageMaths (suffix = '_tempfilt' ),
687
+ iterfield = ['in_file' ],
688
+ name = 'highpass' )
689
+ featpreproc .connect (inputnode , ('highpass' , highpass_operand ), highpass , 'op_string' )
690
+ featpreproc .connect (meanscale , 'out_file' , highpass , 'in_file' )
691
+
692
+ if version < 507 :
693
+ featpreproc .connect (highpass , 'out_file' , outputnode , 'highpassed_files' )
694
+ else :
695
+ """
696
+ Add back the mean removed by the highpass filter operation as of FSL 5.0.7
697
+ """
698
+ meanfunc4 = pe .MapNode (interface = fsl .ImageMaths (op_string = '-Tmean' ,
699
+ suffix = '_mean' ),
700
+ iterfield = ['in_file' ],
701
+ name = 'meanfunc4' )
702
+
703
+ featpreproc .connect (meanscale , 'out_file' , meanfunc4 , 'in_file' )
704
+ addmean = pe .MapNode (interface = fsl .BinaryMaths (operation = 'add' ),
705
+ iterfield = ['in_file' , 'operand_file' ],
706
+ name = 'addmean' )
707
+ featpreproc .connect (highpass , 'out_file' , addmean , 'in_file' )
708
+ featpreproc .connect (meanfunc4 , 'out_file' , addmean , 'operand_file' )
709
+ featpreproc .connect (addmean , 'out_file' , outputnode , 'highpassed_files' )
710
+
684
711
return featpreproc
685
712
686
713
0 commit comments