From c39acaf35ea58afc620e8b49b2768b1b25ceacc6 Mon Sep 17 00:00:00 2001 From: David Ellis Date: Fri, 15 Apr 2016 16:56:42 -0500 Subject: [PATCH] FIX: Removes unused functions and imports. --- .../workflows/smri/freesurfer/autorecon1.py | 5 +- .../workflows/smri/freesurfer/autorecon2.py | 2 - .../workflows/smri/freesurfer/autorecon3.py | 5 +- nipype/workflows/smri/freesurfer/utils.py | 164 ------------------ 4 files changed, 2 insertions(+), 174 deletions(-) diff --git a/nipype/workflows/smri/freesurfer/autorecon1.py b/nipype/workflows/smri/freesurfer/autorecon1.py index b77b65465c..e29a949166 100644 --- a/nipype/workflows/smri/freesurfer/autorecon1.py +++ b/nipype/workflows/smri/freesurfer/autorecon1.py @@ -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): diff --git a/nipype/workflows/smri/freesurfer/autorecon2.py b/nipype/workflows/smri/freesurfer/autorecon2.py index 2fd85bce13..f09e991439 100644 --- a/nipype/workflows/smri/freesurfer/autorecon2.py +++ b/nipype/workflows/smri/freesurfer/autorecon2.py @@ -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 * diff --git a/nipype/workflows/smri/freesurfer/autorecon3.py b/nipype/workflows/smri/freesurfer/autorecon3.py index ffc0eec7b9..656f81188e 100644 --- a/nipype/workflows/smri/freesurfer/autorecon3.py +++ b/nipype/workflows/smri/freesurfer/autorecon3.py @@ -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, diff --git a/nipype/workflows/smri/freesurfer/utils.py b/nipype/workflows/smri/freesurfer/utils.py index 023cf612ec..74d45776d2 100644 --- a/nipype/workflows/smri/freesurfer/utils.py +++ b/nipype/workflows/smri/freesurfer/utils.py @@ -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