Exemplo n.º 1
0
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:

from nipype.interfaces.niftyfit import no_niftyfit, get_custom_path, DwiTool
from nipype.testing import assert_equal, skipif, example_data


@skipif(no_niftyfit(cmd="dwi_tool"))
def test_seg_em():

    # Create a reg_aladin object
    test_node = DwiTool()

    # Check if the command is properly defined
    yield assert_equal, test_node.cmd, get_custom_path("dwi_tool")

    # Assign some input data
    in_file = example_data("diffusion.nii")
    test_node.inputs.source_file = in_file

    cmd_tmp = "{cmd} -famap dwifit__famap -logdti2 dwifit__logdti2 -mdmap \
dwifit__mdmap -rgbmap dwifit__rgbmap -source {in_file}  -v1map dwifit__v1map"
    expected_cmd = cmd_tmp.format(cmd=get_custom_path("dwi_tool"), in_file=in_file)

    yield assert_equal, test_node.cmdline, expected_cmd
Exemplo n.º 2
0
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:

from nipype.interfaces.niftyfit import no_niftyfit, get_custom_path, FitAsl
from nipype.testing import assert_equal, skipif, example_data


@skipif(no_niftyfit(cmd='fit_asl'))
def test_seg_em():

    # Create a reg_aladin object
    test_node = FitAsl()

    # Check if the command is properly defined
    yield assert_equal, test_node.cmd, get_custom_path('fit_asl')

    # Assign some input data
    in_file = example_data('im1.nii')
    test_node.inputs.source_file = in_file

    cmd_tmp = '{cmd} -cbf im1_cbf -error im1_error -source {in_file} \
-syn im1_syn'
    expected_cmd = cmd_tmp.format(
        cmd=get_custom_path('fit_asl'),
        in_file=in_file)

    yield assert_equal, test_node.cmdline, expected_cmd
Exemplo n.º 3
0
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:

from nipype.interfaces.niftyfit import no_niftyfit, get_custom_path, FitQt1
from nipype.testing import assert_equal, skipif, example_data


@skipif(no_niftyfit(cmd='fit_qt1'))
def test_seg_em():

    # Create a reg_aladin object
    test_node = FitQt1()

    # Check if the command is properly defined
    yield assert_equal, test_node.cmd, get_custom_path('fit_qt1')

    # Assign some input data
    in_file = example_data('im1.nii')
    test_node.inputs.source_file = in_file

    cmd_tmp = '{cmd} -source {in_file} -error im1_error -m0map im1_m0map \
-mcmap im1_mcmap -res im1_res -syn im1_syn -t1map im1_t1map'
    expected_cmd = cmd_tmp.format(
        cmd=get_custom_path('fit_qt1'),
        in_file=in_file)

    yield assert_equal, test_node.cmdline, expected_cmd
Exemplo n.º 4
0
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:

from nipype.interfaces.niftyfit import no_niftyfit, get_custom_path, DwiTool
from nipype.testing import skipif, example_data
import os
import pytest


@skipif(no_niftyfit(cmd='dwi_tool'))
def test_dwi_tool():
    # Create a node object
    test_node = DwiTool()

    # Check if the command is properly defined
    assert test_node.cmd == get_custom_path('dwi_tool')

    # test raising error with mandatory args absent
    with pytest.raises(ValueError):
        test_node.run()

    # Assign some input data
    in_file = example_data('diffusion.nii')
    bval_file = example_data('bvals')
    bvec_file = example_data('bvecs')
    b0_file = example_data('b0.nii')
    mask_file = example_data('mask.nii')
    test_node.inputs.source_file = in_file
    test_node.inputs.mask_file = mask_file
    test_node.inputs.bval_file = bval_file
    test_node.inputs.bvec_file = bvec_file
Exemplo n.º 5
0
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:

import pytest

from nipype.interfaces.niftyfit import no_niftyfit, get_custom_path, FitAsl
from nipype.testing import example_data


@pytest.mark.skipif(no_niftyfit(cmd='fit_asl'),
                    reason="niftyfit is not installed")
def test_fit_asl():
    """ Testing FitAsl interface."""
    # Create the test node
    fit_asl = FitAsl()

    # Check if the command is properly defined
    assert fit_asl.cmd == get_custom_path('fit_asl')

    # test raising error with mandatory args absent
    with pytest.raises(ValueError):
        fit_asl.run()

    # Tests on the interface:
    # Runs cbf fitting assuming all tissue is GM!
    in_file = example_data('asl.nii.gz')
    fit_asl.inputs.source_file = in_file

    cmd_tmp = '{cmd} -source {in_file} -cbf {cbf} -error {error} -syn {syn}'
    expected_cmd = cmd_tmp.format(
Exemplo n.º 6
0
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:

import pytest

from nipype.interfaces.niftyfit import no_niftyfit, get_custom_path, FitQt1
from nipype.testing import example_data


@pytest.mark.skipif(no_niftyfit(cmd='fit_qt1'),
                    reason="niftyfit is not installed")
def test_fit_qt1():
    """ Testing FitQt1 interface."""
    # Create a node object
    fit_qt1 = FitQt1()

    # Check if the command is properly defined
    assert fit_qt1.cmd == get_custom_path('fit_qt1')

    # test raising error with mandatory args absent
    with pytest.raises(ValueError):
        fit_qt1.run()

    # Regular test:
    in_file = example_data('TI4D.nii.gz')
    fit_qt1.inputs.source_file = in_file

    cmd_tmp = '{cmd} -source {in_file} -comp {comp} -error {error} -m0map \
{map0} -mcmap {cmap} -res {res} -syn {syn} -t1map {t1map}'
    expected_cmd = cmd_tmp.format(
Exemplo n.º 7
0
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:

from nipype.interfaces.niftyfit import no_niftyfit, get_custom_path, FitDwi
from nipype.testing import assert_equal, skipif, example_data


@skipif(no_niftyfit(cmd='fit_dwi'))
def test_seg_em():

    # Create a reg_aladin object
    test_node = FitDwi()

    # Check if the command is properly defined
    yield assert_equal, test_node.cmd, get_custom_path('fit_dwi')

    # Assign some input data
    in_file = example_data('diffusion.nii')
    bval_file = example_data('bvals')
    bvec_file = example_data('bvecs')
    test_node.inputs.source_file = in_file
    test_node.inputs.bval_file = bval_file
    test_node.inputs.bvec_file = bvec_file

    cmd_tmp = '{cmd} -bval {bval} -bvec {bvec} -famap dwifit__famap -mcmap \
dwifit__mcmap -mdmap dwifit__mdmap -res dwifit__resmap -rgbmap dwifit__rgbmap \
-source {in_file} -syn dwifit__syn -tenmap2 dwifit__tenmap2 -v1map \
dwifit__v1map'
    expected_cmd = cmd_tmp.format(
        cmd=get_custom_path('fit_dwi'),
        in_file=in_file,
Exemplo n.º 8
0
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:

import pytest

from nipype.interfaces.niftyfit import (no_niftyfit, get_custom_path, FitDwi,
                                        DwiTool)
from nipype.testing import example_data


@pytest.mark.skipif(no_niftyfit(cmd='fit_dwi'),
                    reason="niftyfit is not installed")
def test_fit_dwi():
    """ Testing FitDwi interface."""
    # Create a node object
    fit_dwi = FitDwi()

    # Check if the command is properly defined
    assert fit_dwi.cmd == get_custom_path('fit_dwi')

    # test raising error with mandatory args absent
    with pytest.raises(ValueError):
        fit_dwi.run()

    # Assign some input data
    in_file = example_data('dwi.nii.gz')
    bval_file = example_data('bvals')
    bvec_file = example_data('bvecs')
    fit_dwi.inputs.source_file = in_file
    fit_dwi.inputs.bval_file = bval_file
    fit_dwi.inputs.bvec_file = bvec_file
Exemplo n.º 9
0
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:

from nipype.interfaces.niftyfit import no_niftyfit, get_custom_path, DwiTool
from nipype.testing import skipif, example_data
import os
import pytest


@skipif(no_niftyfit(cmd='dwi_tool'))
def test_dwi_tool():
    # Create a node object
    test_node = DwiTool()

    # Check if the command is properly defined
    assert test_node.cmd == get_custom_path('dwi_tool')

    # test raising error with mandatory args absent
    with pytest.raises(ValueError):
        test_node.run()

    # Assign some input data
    in_file = example_data('diffusion.nii')
    bval_file = example_data('bvals')
    bvec_file = example_data('bvecs')
    b0_file = example_data('b0.nii')
    mask_file = example_data('mask.nii')
    test_node.inputs.source_file = in_file
    test_node.inputs.mask_file = mask_file
    test_node.inputs.bval_file = bval_file
    test_node.inputs.bvec_file = bvec_file
Exemplo n.º 10
0
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:

import pytest

from nipype.interfaces.niftyfit import no_niftyfit, get_custom_path, FitQt1
from nipype.testing import example_data


@pytest.mark.skipif(no_niftyfit(cmd='fit_qt1'),
                    reason="niftyfit is not installed")
def test_fit_qt1():
    """ Testing FitQt1 interface."""
    # Create a node object
    fit_qt1 = FitQt1()

    # Check if the command is properly defined
    assert fit_qt1.cmd == get_custom_path('fit_qt1')

    # test raising error with mandatory args absent
    with pytest.raises(ValueError):
        fit_qt1.run()

    # Regular test:
    in_file = example_data('TI4D.nii.gz')
    fit_qt1.inputs.source_file = in_file

    cmd_tmp = '{cmd} -source {in_file} -comp {comp} -error {error} -m0map \
{map0} -mcmap {cmap} -res {res} -syn {syn} -t1map {t1map}'
Exemplo n.º 11
0
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:

import pytest

from nipype.interfaces.niftyfit import no_niftyfit, get_custom_path, FitAsl
from nipype.testing import example_data


@pytest.mark.skipif(no_niftyfit(cmd='fit_asl'),
                    reason="niftyfit is not installed")
def test_fit_asl():
    """ Testing FitAsl interface."""
    # Create the test node
    fit_asl = FitAsl()

    # Check if the command is properly defined
    assert fit_asl.cmd == get_custom_path('fit_asl')

    # test raising error with mandatory args absent
    with pytest.raises(ValueError):
        fit_asl.run()

    # Tests on the interface:
    # Runs cbf fitting assuming all tissue is GM!
    in_file = example_data('asl.nii.gz')
    fit_asl.inputs.source_file = in_file

    cmd_tmp = '{cmd} -source {in_file} -cbf {cbf} -error {error} -syn {syn}'
    expected_cmd = cmd_tmp.format(
Exemplo n.º 12
0
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:

import pytest

from nipype.interfaces.niftyfit import (no_niftyfit, get_custom_path, FitDwi,
                                        DwiTool)
from nipype.testing import example_data


@pytest.mark.skipif(no_niftyfit(cmd='fit_dwi'),
                    reason="niftyfit is not installed")
def test_fit_dwi():
    """ Testing FitDwi interface."""
    # Create a node object
    fit_dwi = FitDwi()

    # Check if the command is properly defined
    assert fit_dwi.cmd == get_custom_path('fit_dwi')

    # test raising error with mandatory args absent
    with pytest.raises(ValueError):
        fit_dwi.run()

    # Assign some input data
    in_file = example_data('dwi.nii.gz')
    bval_file = example_data('bvals')
    bvec_file = example_data('bvecs')
    fit_dwi.inputs.source_file = in_file
    fit_dwi.inputs.bval_file = bval_file
    fit_dwi.inputs.bvec_file = bvec_file