diff --git a/macapype/nodes/pad.py b/macapype/nodes/pad.py index e22a6a819..fad646941 100644 --- a/macapype/nodes/pad.py +++ b/macapype/nodes/pad.py @@ -39,36 +39,6 @@ def pad_back(seg_pipe, data_preparation_pipe, inputnode, pad_node, "out_file", outputnode, outputnodefile) - elif "long_single_preparation_pipe" in params.keys(): - if "prep_T1" in params["long_single_preparation_pipe"].keys(): - - print("Padding mask in native space") - pad_node = pe.Node( - niu.Function( - input_names=[ - 'cropped_img_file', - 'orig_img_file', - 'indiv_crop'], - output_names=['padded_img_file'], - function=padding_cropped_img), - name=pad_nodename) - - seg_pipe.connect( - node, nodefile, - pad_node, "cropped_img_file") - - seg_pipe.connect( - data_preparation_pipe, "outputnode.native_T1", - pad_node, "orig_img_file") - - seg_pipe.connect( - inputnode, "indiv_params", - pad_node, "indiv_crop") - - seg_pipe.connect( - pad_node, "padded_img_file", - outputnode, outputnodefile) - return pad_node diff --git a/macapype/pipelines/full_pipelines.py b/macapype/pipelines/full_pipelines.py index b024b8e02..1fb392200 100644 --- a/macapype/pipelines/full_pipelines.py +++ b/macapype/pipelines/full_pipelines.py @@ -20,8 +20,7 @@ from macapype.nodes.pad import pad_back from .prepare import (create_short_preparation_pipe, - create_short_preparation_T1_pipe, - create_long_single_preparation_pipe,) + create_short_preparation_T1_pipe) from .segment import (create_old_segment_pipe, create_native_old_segment_pipe, @@ -164,7 +163,7 @@ def create_full_spm_subpipes( else: print("Error, short_preparation_pipe, \ - long_multi_preparation_pipe was not found in params, skipping") + was not found in params, skipping") test_node = pe.Node(niu.Function(input_names=['list_T1', 'list_T2'], output_names=[''], @@ -806,11 +805,7 @@ def create_full_ants_subpipes( Params: - short_data_preparation_pipe (see :class:`create_short_preparation_pipe \ - `) or \ - long_single_preparation_pipe \ - (see :class:`create_long_single_preparation_pipe \ - `) or \ - long_multi_preparation_pipe \ + `) - brain_extraction_pipe (see :class:`create_brain_extraction_pipe \ `) @@ -899,18 +894,14 @@ def create_full_ants_subpipes( name='outputnode') # preprocessing - if 'long_single_preparation_pipe' in params.keys(): - data_preparation_pipe = create_long_single_preparation_pipe( - params=parse_key(params, "long_single_preparation_pipe")) - - elif 'short_preparation_pipe' in params.keys(): + if 'short_preparation_pipe' in params.keys(): data_preparation_pipe = create_short_preparation_pipe( params=parse_key(params, "short_preparation_pipe"), params_template=params_template_stereo) else: - print("Error, short_preparation_pipe, long_single_preparation_pipe or\ - long_multi_preparation_pipe was not found in params, skipping") + print("Error, short_preparation_pipe \ + was not found in params, skipping") test_node = pe.Node(niu.Function(input_names=['list_T1', 'list_T2'], output_names=[''], diff --git a/macapype/pipelines/prepare.py b/macapype/pipelines/prepare.py index 8b428f921..198423343 100644 --- a/macapype/pipelines/prepare.py +++ b/macapype/pipelines/prepare.py @@ -71,7 +71,7 @@ def _create_avg_reorient_pipeline(name="avg_reorient_pipe", params={}): return reorient_pipe ############################################################################### -# choices between the 3 main pipelines: "short", "long_single" et "long_multi" +# main pipeline: "short_preparation_pipe" ############################################################################### def create_short_preparation_pipe(params, params_template={}, @@ -655,7 +655,7 @@ def create_short_preparation_T1_pipe(params, params_template, dictionary of node sub-parameters (from a json file) name: - pipeline name (default = "long_multi_preparation_pipe") + pipeline name (default = "short_preparation_T1_pipe") Outputs: diff --git a/macapype/pipelines/tests/test_prepare.py b/macapype/pipelines/tests/test_prepare.py index 4786b00bd..8074b34cd 100644 --- a/macapype/pipelines/tests/test_prepare.py +++ b/macapype/pipelines/tests/test_prepare.py @@ -3,8 +3,7 @@ from macapype.utils.utils_tests import make_tmp_dir from macapype.utils.misc import parse_key -from macapype.pipelines.prepare import (create_short_preparation_pipe, - create_long_single_preparation_pipe) +from macapype.pipelines.prepare import create_short_preparation_pipe data_path = make_tmp_dir() @@ -61,48 +60,3 @@ def test_create_crop_T1_short_preparation_pipe(): assert op.exists(op.join(data_path, "short_manual_preparation_pipe", "graph.png")) - - -def test_create_long_single_preparation_pipe(): - params = { - "long_single_preparation_pipe": - { - "prep_T1": - { - "crop_T1": - { - "args": "should be defined in indiv" - }, - "denoise": - { - "shrink_factor": 1 - } - }, - "prep_T2": - { - "crop_T2": - { - "args": "should be defined in indiv" - }, - "denoise": - { - "shrink_factor": 1 - } - }, - "align_T2_on_T1": - { - } - } - } - - # running workflow - segment_pnh = create_long_single_preparation_pipe( - params=parse_key(params, "long_single_preparation_pipe"), - name="long_single_preparation_pipe") - - segment_pnh.base_dir = data_path - - segment_pnh.write_graph(graph2use="colored") - assert op.exists(op.join(data_path, - "long_single_preparation_pipe", - "graph.png")) diff --git a/macapype/utils/utils_params.py b/macapype/utils/utils_params.py index 98eea5124..fd1187270 100644 --- a/macapype/utils/utils_params.py +++ b/macapype/utils/utils_params.py @@ -82,44 +82,11 @@ def update_preparation_params(ssoft=[], subjects=None, sessions=None, if "crop_T1" in indiv.keys(): count_T1_crops += 1 - if "crop_T2" in indiv.keys() and 't1' not in ssoft: - - count_long_crops += 1 - - crop_T1_args = indiv["crop_T1"]["args"] - crop_T2_args = indiv["crop_T2"]["args"] - if isinstance(crop_T1_args, list) and \ - isinstance(crop_T2_args, list): - - count_multi_long_crops += 1 - print("count_all_sessions {}".format(count_all_sessions)) print("count_T1_crops {}".format(count_T1_crops)) - print("count_long_crops {}".format(count_long_crops)) - print("count_multi_long_crops {}".format( - count_multi_long_crops)) if count_all_sessions: - if count_multi_long_crops == count_all_sessions: - print("**** Found list of crops for T1 and T2\ - for all sub/ses in indiv -> \ - long_multi_preparation_pipe") - - prep_pipe = "long_multi_preparation_pipe" - - extra_wf_name += "_indiv_crop_long_multi" - - elif count_long_crops == count_all_sessions: - - print("**** Found crop for T1 and crop for T2\ - for all sub/ses in indiv -> \ - long_single_preparation_pipe") - - prep_pipe = "long_single_preparation_pipe" - - extra_wf_name += "_indiv_crop_long_single" - - elif count_T1_crops == count_all_sessions: + if count_T1_crops == count_all_sessions: print("**** Found crop for T1 for all \ sub/ses in indiv \ @@ -128,7 +95,7 @@ def update_preparation_params(ssoft=[], subjects=None, sessions=None, extra_wf_name += "_indiv_crop" else: - print("**** not all sub/ses have T1 and T2 crops,\ + print("**** not all sub/ses have T1 crops,\ using autocrop ") extra_wf_name += "_crop_aladin" @@ -179,27 +146,6 @@ def update_preparation_params(ssoft=[], subjects=None, sessions=None, print("Adding crop_T1") params["short_preparation_pipe"]["crop_T1"] = \ {"args": "should be defined in indiv"} - else: - print("modifying prep = {}".format(prep_pipe)) - - params[prep_pipe] = { - "prep_T1": { - "crop_T1": { - "args": "should be defined in indiv"} - }, - "prep_T2": { - "crop_T2": { - "args": "should be defined in indiv"} - } - } - - if "denoise" in params["short_preparation_pipe"].keys(): - denoise = params["short_preparation_pipe"]["denoise"] - - params[prep_pipe]["prep_T1"]["denoise"] = denoise - params[prep_pipe]["prep_T2"]["denoise"] = denoise - - del params["short_preparation_pipe"] return params, indiv_params, extra_wf_name