Skip to content

Commit

Permalink
FIX: Removes unused functions and imports.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Ellis committed Apr 15, 2016
1 parent 6437bf3 commit c39acaf
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 174 deletions.
5 changes: 1 addition & 4 deletions nipype/workflows/smri/freesurfer/autorecon1.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import sys
import os
import nipype
from nipype.interfaces.utility import Function,IdentityInterface
import nipype.pipeline.engine as pe # pypeline engine
from nipype.interfaces.freesurfer import *
from .utils import copy_file, copy_files
from .utils import copy_file


def checkT1s(T1_files, cw256=False):
Expand Down
2 changes: 0 additions & 2 deletions nipype/workflows/smri/freesurfer/autorecon2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import os
import nipype
from nipype.interfaces.utility import Function, IdentityInterface, Merge
import nipype.pipeline.engine as pe # pypeline engine
from nipype.interfaces.freesurfer import *
Expand Down
5 changes: 1 addition & 4 deletions nipype/workflows/smri/freesurfer/autorecon3.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import os
import nipype
from nipype.interfaces.utility import Function, IdentityInterface, Merge
from nipype.interfaces.utility import IdentityInterface, Merge
import nipype.pipeline.engine as pe # pypeline engine
from nipype.interfaces.freesurfer import *
from .ba_maps import create_ba_maps_wf
from .utils import createsrcsubj
from nipype.interfaces.io import DataGrabber

def create_AutoRecon3(name="AutoRecon3", qcache=False, plugin_args=None,
Expand Down
164 changes: 0 additions & 164 deletions nipype/workflows/smri/freesurfer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,167 +492,3 @@ def checkenv(exitonfail=False):
sys.exit(2)
else:
print("Warning: " + msg)


def create_recoding_wf(in_file, out_file=None):
wf = nipype.Workflow(name="RecodeLabels")

inputspec = nipype.pipeline.Node(nipype.IdentityInterface(['labelmap',
'recode_file']),
name="inputspec")
inputspec.inputs.recode_file = in_file

convert_labelmap = nipype.pipeline.Node(fs.MRIConvert(), name="ConvertLabelMap")
convert_labelmap.inputs.in_type = 'mgz'
convert_labelmap.inputs.out_type = 'nii'
convert_labelmap.inputs.out_orientation = 'RAS'
convert_labelmap.inputs.out_file = 'labelmap.nii'
wf.connect([(inputspec, convert_labelmap, [('labelmap', 'in_file')])])

recode = nipype.Node(nipype.Function(['in_file',
'out_file',
'recode_file'],
['out_file'],
recodeLabelMap),
name = "RecodeLabelMap")
if out_file == None:
recode.inputs.out_file = 'recodedlabelmap.nii'
else:
recode.inputs.out_file = out_file

wf.connect([(convert_labelmap, recode, [('out_file', 'in_file')]),
(inputspec, recode, [('recode_file', 'recode_file')])])

center_labelmap = nipype.Node(nipype.Function(['in_file'], ['out_file'],
center_volume),
name="CenterLabelMap")

wf.connect([(recode, center_labelmap, [('out_file', 'in_file')])])

outputspec = nipype.Node(nipype.IdentityInterface(['recodedlabelmap']), name="outputspec")

wf.connect([(center_labelmap, outputspec, [('out_file', 'recodedlabelmap')])])
return wf

def createsrcsubj(source_directory):
"""
Returns a node that acts as the datasource for a source subject such as
'fsaverage'
"""
outfields = ['lh_BA1_exvivo',
'lh_BA2_exvivo',
'lh_BA3a_exvivo',
'lh_BA3b_exvivo',
'lh_BA4a_exvivo',
'lh_BA4p_exvivo',
'lh_BA6_exvivo',
'lh_BA44_exvivo',
'lh_BA45_exvivo',
'lh_V1_exvivo',
'lh_V2_exvivo',
'lh_MT_exvivo',
'lh_entorhinal_exvivo',
'lh_perirhinal_exvivo',
'lh_BA1_exvivo_thresh',
'lh_BA2_exvivo_thresh',
'lh_BA3a_exvivo_thresh',
'lh_BA3b_exvivo_thresh',
'lh_BA4a_exvivo_thresh',
'lh_BA4p_exvivo_thresh',
'lh_BA6_exvivo_thresh',
'lh_BA44_exvivo_thresh',
'lh_BA45_exvivo_thresh',
'lh_V1_exvivo_thresh',
'lh_V2_exvivo_thresh',
'lh_MT_exvivo_thresh',
'lh_entorhinal_exvivo_thresh',
'lh_perirhinal_exvivo_thresh',
'rh_BA1_exvivo',
'rh_BA2_exvivo',
'rh_BA3a_exvivo',
'rh_BA3b_exvivo',
'rh_BA4a_exvivo',
'rh_BA4p_exvivo',
'rh_BA6_exvivo',
'rh_BA44_exvivo',
'rh_BA45_exvivo',
'rh_V1_exvivo',
'rh_V2_exvivo',
'rh_MT_exvivo',
'rh_entorhinal_exvivo',
'rh_perirhinal_exvivo',
'rh_BA1_exvivo_thresh',
'rh_BA2_exvivo_thresh',
'rh_BA3a_exvivo_thresh',
'rh_BA3b_exvivo_thresh',
'rh_BA4a_exvivo_thresh',
'rh_BA4p_exvivo_thresh',
'rh_BA6_exvivo_thresh',
'rh_BA44_exvivo_thresh',
'rh_BA45_exvivo_thresh',
'rh_V1_exvivo_thresh',
'rh_V2_exvivo_thresh',
'rh_MT_exvivo_thresh',
'rh_entorhinal_exvivo_thresh',
'rh_perirhinal_exvivo_thresh']
datasource = pe.Node(nio.nio.DataGrabber(outfields=outfields), name="Source_Subject")
datasource.inputs.base_directory = source_directory
datasource.inputs.template = '*'
datasource.inputs.field_template = dict(
lh_BA1_exvivo='label/lh.BA1_exvivo.label',
lh_BA2_exvivo='label/lh.BA2_exvivo.label',
lh_BA3a_exvivo='label/lh.BA3a_exvivo.label',
lh_BA3b_exvivo='label/lh.BA3b_exvivo.label',
lh_BA4a_exvivo='label/lh.BA4a_exvivo.label',
lh_BA4p_exvivo='label/lh.BA4p_exvivo.label',
lh_BA6_exvivo='label/lh.BA6_exvivo.label',
lh_BA44_exvivo='label/lh.BA44_exvivo.label',
lh_BA45_exvivo='label/lh.BA45_exvivo.label',
lh_V1_exvivo='label/lh.V1_exvivo.label',
lh_V2_exvivo='label/lh.V2_exvivo.label',
lh_MT_exvivo='label/lh.MT_exvivo.label',
lh_entorhinal_exvivo='label/lh.entorhinal_exvivo.label',
lh_perirhinal_exvivo='label/lh.perirhinal_exvivo.label',
lh_BA1_exvivo_thresh='label/lh.BA1_exvivo.thresh.label',
lh_BA2_exvivo_thresh='label/lh.BA2_exvivo.thresh.label',
lh_BA3a_exvivo_thresh='label/lh.BA3a_exvivo.thresh.label',
lh_BA3b_exvivo_thresh='label/lh.BA3b_exvivo.thresh.label',
lh_BA4a_exvivo_thresh='label/lh.BA4a_exvivo.thresh.label',
lh_BA4p_exvivo_thresh='label/lh.BA4p_exvivo.thresh.label',
lh_BA6_exvivo_thresh='label/lh.BA6_exvivo.thresh.label',
lh_BA44_exvivo_thresh='label/lh.BA44_exvivo.thresh.label',
lh_BA45_exvivo_thresh='label/lh.BA45_exvivo.thresh.label',
lh_V1_exvivo_thresh='label/lh.V1_exvivo.thresh.label',
lh_V2_exvivo_thresh='label/lh.V2_exvivo.thresh.label',
lh_MT_exvivo_thresh='label/lh.MT_exvivo.thresh.label',
lh_entorhinal_exvivo_thresh='label/lh.entorhinal_exvivo.thresh.label',
lh_perirhinal_exvivo_thresh='label/lh.perirhinal_exvivo.thresh.label',
rh_BA1_exvivo='label/rh.BA1_exvivo.label',
rh_BA2_exvivo='label/rh.BA2_exvivo.label',
rh_BA3a_exvivo='label/rh.BA3a_exvivo.label',
rh_BA3b_exvivo='label/rh.BA3b_exvivo.label',
rh_BA4a_exvivo='label/rh.BA4a_exvivo.label',
rh_BA4p_exvivo='label/rh.BA4p_exvivo.label',
rh_BA6_exvivo='label/rh.BA6_exvivo.label',
rh_BA44_exvivo='label/rh.BA44_exvivo.label',
rh_BA45_exvivo='label/rh.BA45_exvivo.label',
rh_V1_exvivo='label/rh.V1_exvivo.label',
rh_V2_exvivo='label/rh.V2_exvivo.label',
rh_MT_exvivo='label/rh.MT_exvivo.label',
rh_entorhinal_exvivo='label/rh.entorhinal_exvivo.label',
rh_perirhinal_exvivo='label/rh.perirhinal_exvivo.label',
rh_BA1_exvivo_thresh='label/rh.BA1_exvivo.thresh.label',
rh_BA2_exvivo_thresh='label/rh.BA2_exvivo.thresh.label',
rh_BA3a_exvivo_thresh='label/rh.BA3a_exvivo.thresh.label',
rh_BA3b_exvivo_thresh='label/rh.BA3b_exvivo.thresh.label',
rh_BA4a_exvivo_thresh='label/rh.BA4a_exvivo.thresh.label',
rh_BA4p_exvivo_thresh='label/rh.BA4p_exvivo.thresh.label',
rh_BA6_exvivo_thresh='label/rh.BA6_exvivo.thresh.label',
rh_BA44_exvivo_thresh='label/rh.BA44_exvivo.thresh.label',
rh_BA45_exvivo_thresh='label/rh.BA45_exvivo.thresh.label',
rh_V1_exvivo_thresh='label/rh.V1_exvivo.thresh.label',
rh_V2_exvivo_thresh='label/rh.V2_exvivo.thresh.label',
rh_MT_exvivo_thresh='label/rh.MT_exvivo.thresh.label',
rh_entorhinal_exvivo_thresh='label/rh.entorhinal_exvivo.thresh.label',
rh_perirhinal_exvivo_thresh='label/rh.perirhinal_exvivo.thresh.label')
return datasource, outfields

0 comments on commit c39acaf

Please sign in to comment.