Skip to content

NF: allow to select last volume for MC, various DOC tune ups #1141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 9, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions nipype/workflows/fmri/fsl/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ def pickvol(filenames, fileidx, which):
idx = 0
elif which.lower() == 'middle':
idx = int(np.ceil(load(filenames[fileidx]).get_shape()[3]/2))
elif which.lower() == 'last':
idx = load(filenames[fileidx]).get_shape()[3]-1
else:
raise Exception('unknown value for volume selection : %s'%which)
raise Exception('unknown value for volume selection : %s' % which)
return idx

def getbtthresh(medianvals):
Expand Down Expand Up @@ -381,7 +383,7 @@ def create_featreg_preproc(name='featpreproc', highpass=True, whichvol='middle')

name : name of workflow (default: featpreproc)
highpass : boolean (default: True)
whichvol : which volume of the first run to register to ('first', 'middle', 'mean')
whichvol : which volume of the first run to register to ('first', 'middle', 'last', 'mean')

Inputs::

Expand Down Expand Up @@ -467,6 +469,7 @@ def create_featreg_preproc(name='featpreproc', highpass=True, whichvol='middle')
run.
"""


img2float = pe.MapNode(interface=fsl.ImageMaths(out_data_type='float',
op_string = '',
suffix='_dtype'),
Expand All @@ -475,7 +478,7 @@ def create_featreg_preproc(name='featpreproc', highpass=True, whichvol='middle')
featpreproc.connect(inputnode, 'func', img2float, 'in_file')

"""
Extract the first volume of the first run as the reference
Extract the middle (or what whichvol points to) volume of the first run as the reference
"""

if whichvol != 'mean':
Expand All @@ -488,7 +491,7 @@ def create_featreg_preproc(name='featpreproc', highpass=True, whichvol='middle')


"""
Realign the functional runs to the reference (1st volume of first run)
Realign the functional runs to the reference (`whichvol` volume of first run)
"""

motion_correct = pe.MapNode(interface=fsl.MCFLIRT(save_mats = True,
Expand Down Expand Up @@ -518,7 +521,7 @@ def create_featreg_preproc(name='featpreproc', highpass=True, whichvol='middle')
featpreproc.connect(plot_motion, 'out_file', outputnode, 'motion_plots')

"""
Extract the mean volume of the first functional run
Extract the mean volume of the first functional runpreproc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra preproc

"""

meanfunc = pe.Node(interface=fsl.ImageMaths(op_string = '-Tmean',
Expand Down Expand Up @@ -1093,7 +1096,7 @@ def create_fsl_fs_preproc(name='preproc', highpass=True, whichvol='middle'):
return featpreproc

def create_reg_workflow(name='registration'):
"""Create a FEAT preprocessing workflow together with freesurfer
"""Create a FEAT preprocessing workflow

Parameters
----------
Expand Down