def test_create_surface_pipe():

    # params
    params = {
        "nii_to_mesh_pipe": {
            "split_hemi_pipe": {},
        }
    }

    # params_template
    template_name = "haiko89_template"
    template_dir = load_test_data(template_name)

    params_template = format_template(template_dir, template_name)

    # running workflow
    segment_pnh = create_nii_to_mesh_pipe(params=parse_key(
        params, "nii_to_mesh_pipe"),
                                          params_template=params_template,
                                          name="nii_to_mesh_pipe")

    segment_pnh.base_dir = data_path

    segment_pnh.write_graph(graph2use="colored")
    assert op.exists(op.join(data_path, "nii_to_mesh_pipe", "graph.png"))
Esempio n. 2
0
def test_create_long_multi_preparation_pipe():

    params = {
        "long_multi_preparation_pipe": {
            "mapnode_prep_T1": {
                "crop": {
                    "args": [
                        "Should not be used, specific to all",
                        "Should not be used, specific to all"
                    ]
                },
                "norm_intensity": {
                    "dimension": [3, 3],
                    "bspline_fitting_distance": [200, 200],
                    "n_iterations": [[50, 50, 40, 30], [50, 50, 40, 30]],
                    "convergence_threshold": [0.00000001, 0.00000001],
                    "shrink_factor": [2, 2],
                    "args": ["-r 0 --verbose 1", "-r 0 --verbose 1"]
                },
                "denoise": {
                    "shrink_factor": [3, 3]
                }
            },
            "mapnode_prep_T2": {
                "crop": {
                    "args": ["Should not be used, specific to all"]
                },
                "norm_intensity": {
                    "dimension": [3],
                    "bspline_fitting_distance": [200],
                    "n_iterations": [50, 50, 40, 30],
                    "convergence_threshold": [0.00000001],
                    "shrink_factor": [2],
                    "args": ["-r 0 --verbose 1"]
                },
                "denoise": {
                    "shrink_factor": [3]
                }
            },
            "align_T2_on_T1": {
                "dof": 6,
                "cost": "normmi"
            }
        }
    }

    # running workflow
    segment_pnh = create_long_multi_preparation_pipe(
        params=parse_key(params, "long_multi_preparation_pipe"),
        name="long_multi_preparation_pipe")

    segment_pnh.base_dir = data_path

    segment_pnh.write_graph(graph2use="colored")
    assert op.exists(
        op.join(data_path, "long_multi_preparation_pipe", "graph.png"))
Esempio n. 3
0
def test_create_long_single_preparation_pipe():

    params = {
        "long_single_preparation_pipe": {
            "prep_T1": {
                "crop": {
                    "args": "should be defined in indiv"
                },
                "norm_intensity": {
                    "dimension": 3,
                    "bspline_fitting_distance": 200,
                    "n_iterations": [50, 50, 40, 30],
                    "convergence_threshold": 0.00000001,
                    "shrink_factor": 2,
                    "args": "-r 0 --verbose 1"
                },
                "denoise": {
                    "shrink_factor": 1
                }
            },
            "prep_T2": {
                "crop": {
                    "args": "should be defined in indiv"
                },
                "norm_intensity": {
                    "dimension": 3,
                    "bspline_fitting_distance": 200,
                    "n_iterations": [50, 50, 40, 30],
                    "convergence_threshold": 0.00000001,
                    "shrink_factor": 2,
                    "args": "-r 0 --verbose 1"
                },
                "denoise": {
                    "shrink_factor": 1
                }
            },
            "align_T2_on_T1": {
                "dof": 6,
                "cost": "normmi"
            }
        }
    }

    # 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"))
Esempio n. 4
0
def test_MapNodeParams():
    params = {"crop": {"args": "88 144 14 180 27 103"}}

    crop_bb = MapNodeParams(fsl.ExtractROI(),
                            name='crop_bb',
                            params=parse_key(params, "crop"),
                            iterfield=["in_file"])

    crop_bb.inputs.in_file = [T1_file, T2_file]

    with pytest.raises(ValueError):
        crop_bb.run()
Esempio n. 5
0
def test_create_short_manual_preparation_pipe():

    params = {"short_preparation_pipe": {"crop": {"args": ""}}}

    # running workflow
    segment_pnh = create_short_preparation_pipe(
        params=parse_key(params, "short_preparation_pipe"),
        name="short_manual_preparation_pipe")

    segment_pnh.base_dir = data_path

    segment_pnh.write_graph(graph2use="colored")
    assert op.exists(
        op.join(data_path, "short_manual_preparation_pipe", "graph.png"))
Esempio n. 6
0
def test_create_short_auto_reorient_preparation_pipe():

    params = {
        "short_preparation_pipe": {
            "reorient": {
                "new_dims": "x z -y"
            },
            "bet_crop": {}
        }
    }

    # running workflow
    segment_pnh = create_short_preparation_pipe(
        params=parse_key(params, "short_preparation_pipe"),
        name="short_auto_reorient_preparation_pipe")

    segment_pnh.base_dir = data_path

    segment_pnh.write_graph(graph2use="colored")
    assert op.exists(
        op.join(data_path, "short_auto_reorient_preparation_pipe",
                "graph.png"))
Esempio n. 7
0
def test_parse_key_empty():
    params = {}

    val = parse_key(params, "test")
    assert not val
Esempio n. 8
0
def test_parse_key_Undefined():
    params = traits.Undefined

    val = parse_key(params, "test")
    assert not val