# -*- 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 FitAsl from nipype.interfaces.niftyreg import no_nifty_package, get_custom_path from nipype.testing import example_data @pytest.mark.skipif(no_nifty_package(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 cmd = get_custom_path('fit_asl', env_dir='NIFTYFIT_DIR') assert fit_asl.cmd == cmd # 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
# 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.niftyreg import no_nifty_package, get_custom_path from nipype.interfaces.niftyseg import UnaryStats, BinaryStats from nipype.testing import example_data @pytest.mark.skipif(no_nifty_package(cmd='seg_stats'), reason="niftyseg is not installed") def test_unary_stats(): """ Test for the seg_stats interfaces """ # Create a node object unarys = UnaryStats() # Check if the command is properly defined cmd = get_custom_path('seg_stats', env_dir='NIFTYSEGDIR') assert unarys.cmd == cmd # test raising error with mandatory args absent with pytest.raises(ValueError): unarys.run() # Assign some input data in_file = example_data('im1.nii') unarys.inputs.in_file = in_file unarys.inputs.operation = 'a' expected_cmd = '{cmd} {in_file} -a'.format(
# 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.niftyreg import no_nifty_package, get_custom_path from nipype.interfaces.niftyseg import PatchMatch from nipype.testing import example_data @pytest.mark.skipif(no_nifty_package(cmd='seg_PatchMatch'), reason="niftyseg is not installed") def test_seg_patchmatch(): # Create a node object seg_patchmatch = PatchMatch() # Check if the command is properly defined cmd = get_custom_path('seg_PatchMatch', env_dir='NIFTYSEGDIR') assert seg_patchmatch.cmd == cmd # test raising error with mandatory args absent with pytest.raises(ValueError): seg_patchmatch.run() # Assign some input data in_file = example_data('im1.nii') mask_file = example_data('im2.nii') db_file = example_data('db.xml') seg_patchmatch.inputs.in_file = in_file seg_patchmatch.inputs.mask_file = mask_file
# -*- 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.niftyreg import (no_nifty_package, get_custom_path, RegAladin, RegF3D) from nipype.testing import example_data @pytest.mark.skipif(no_nifty_package(cmd='reg_aladin'), reason="niftyreg is not installed. reg_aladin not found.") def test_reg_aladin(): """ tests for reg_aladin interface""" # Create a reg_aladin object nr_aladin = RegAladin() # Check if the command is properly defined assert nr_aladin.cmd == get_custom_path('reg_aladin') # test raising error with mandatory args absent with pytest.raises(ValueError): nr_aladin.run() # Assign some input data ref_file = example_data('im1.nii') flo_file = example_data('im2.nii') rmask_file = example_data('mask.nii') nr_aladin.inputs.ref_file = ref_file nr_aladin.inputs.flo_file = flo_file
# 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.niftyreg import no_nifty_package, get_custom_path from nipype.interfaces.niftyseg import LabelFusion, CalcTopNCC from nipype.testing import example_data @pytest.mark.skipif(no_nifty_package(cmd='seg_LabFusion'), reason="niftyseg is not installed") def test_seg_lab_fusion(): """ Test interfaces for seg_labfusion""" # Create a node object steps = LabelFusion() # Check if the command is properly defined cmd = get_custom_path('seg_LabFusion', env_dir='NIFTYSEGDIR') assert steps.cmd == cmd # test raising error with mandatory args absent with pytest.raises(ValueError): steps.run() # Assign some input data in_file = example_data('im1.nii') file_to_seg = example_data('im2.nii') template_file = example_data('im3.nii') steps.inputs.in_file = in_file steps.inputs.kernel_size = 2.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.niftyreg import no_nifty_package, get_custom_path from nipype.interfaces.niftyseg import EM from nipype.testing import example_data @pytest.mark.skipif(no_nifty_package(cmd='seg_EM'), reason="niftyseg is not installed") def test_seg_em(): # Create a node object seg_em = EM() # Check if the command is properly defined cmd = get_custom_path('seg_EM', env_dir='NIFTYSEGDIR') assert seg_em.cmd == cmd # test raising error with mandatory args absent with pytest.raises(ValueError): seg_em.run() # Assign some input data in_file = example_data('im1.nii') seg_em.inputs.in_file = in_file seg_em.inputs.no_prior = 4 cmd_tmp = '{cmd} -in {in_file} -nopriors 4 -bc_out {bc_out} -out \
# 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.niftyreg import no_nifty_package, get_custom_path from nipype.interfaces.niftyseg import (UnaryMaths, BinaryMaths, BinaryMathsInteger, TupleMaths, Merge) from nipype.testing import example_data @pytest.mark.skipif(no_nifty_package(cmd='seg_maths'), reason="niftyseg is not installed") def test_unary_maths(): # Create a node object unarym = UnaryMaths() # Check if the command is properly defined cmd = get_custom_path('seg_maths', env_dir='NIFTYSEGDIR') assert unarym.cmd == cmd # test raising error with mandatory args absent with pytest.raises(ValueError): unarym.run() # Assign some input data in_file = example_data('im1.nii') unarym.inputs.in_file = in_file unarym.inputs.operation = 'otsu' unarym.inputs.output_datatype = 'float'
# -*- 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: from nipype.interfaces.niftyreg import (no_nifty_package, get_custom_path, RegAverage, RegResample, RegJacobian, RegTools, RegMeasure, RegTransform) from nipype.testing import example_data import os import pytest @pytest.mark.skipif(no_nifty_package(cmd='reg_resample'), reason="niftyreg is not installed. reg_resample not found." ) def test_reg_resample_res(): """ tests for reg_resample interface """ # Create a reg_resample object nr_resample = RegResample() # Check if the command is properly defined assert nr_resample.cmd == get_custom_path('reg_resample') # test raising error with mandatory args absent with pytest.raises(ValueError): nr_resample.run() # Resample res ref_file = example_data('im1.nii') flo_file = example_data('im2.nii') trans_file = example_data('warpfield.nii')
# 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.niftyreg import no_nifty_package, get_custom_path from nipype.interfaces.niftyseg import EM from nipype.testing import example_data @pytest.mark.skipif(no_nifty_package(cmd='seg_EM'), reason="niftyseg is not installed") def test_seg_em(): # Create a node object seg_em = EM() # Check if the command is properly defined cmd = get_custom_path('seg_EM', env_dir='NIFTYSEGDIR') assert seg_em.cmd == cmd # test raising error with mandatory args absent with pytest.raises(ValueError): seg_em.run() # Assign some input data in_file = example_data('im1.nii') seg_em.inputs.in_file = in_file seg_em.inputs.no_prior = 4 cmd_tmp = '{cmd} -in {in_file} -nopriors 4 -bc_out {bc_out} -out \
# -*- 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: from nipype.interfaces.niftyreg import (no_nifty_package, get_custom_path, RegAverage, RegResample, RegJacobian, RegTools, RegMeasure, RegTransform) from nipype.testing import example_data import os import pytest @pytest.mark.skipif( no_nifty_package(cmd='reg_resample'), reason="niftyreg is not installed. reg_resample not found.") def test_reg_resample_res(): """ tests for reg_resample interface """ # Create a reg_resample object nr_resample = RegResample() # Check if the command is properly defined assert nr_resample.cmd == get_custom_path('reg_resample') # test raising error with mandatory args absent with pytest.raises(ValueError): nr_resample.run() # Resample res ref_file = example_data('im1.nii') flo_file = example_data('im2.nii') trans_file = example_data('warpfield.nii')
# -*- 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.niftyreg import (no_nifty_package, get_custom_path, RegAladin, RegF3D) from nipype.testing import example_data @pytest.mark.skipif( no_nifty_package(cmd='reg_aladin'), reason="niftyreg is not installed. reg_aladin not found.") def test_reg_aladin(): """ tests for reg_aladin interface""" # Create a reg_aladin object nr_aladin = RegAladin() # Check if the command is properly defined assert nr_aladin.cmd == get_custom_path('reg_aladin') # test raising error with mandatory args absent with pytest.raises(ValueError): nr_aladin.run() # Assign some input data ref_file = example_data('im1.nii') flo_file = example_data('im2.nii') rmask_file = example_data('mask.nii') nr_aladin.inputs.ref_file = ref_file
# 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 FitDwi, DwiTool from nipype.interfaces.niftyreg import no_nifty_package, get_custom_path from nipype.testing import example_data @pytest.mark.skipif(no_nifty_package(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 cmd = get_custom_path('fit_dwi', env_dir='NIFTYFITDIR') assert fit_dwi.cmd == cmd # 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
# 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.niftyreg import no_nifty_package, get_custom_path from nipype.interfaces.niftyseg import FillLesions from nipype.testing import example_data @pytest.mark.skipif(no_nifty_package(cmd='seg_FillLesions'), reason="niftyseg is not installed") def test_seg_filllesions(): # Create a node object seg_fill = FillLesions() # Check if the command is properly defined cmd = get_custom_path('seg_FillLesions', env_dir='NIFTYSEGDIR') assert seg_fill.cmd == cmd # test raising error with mandatory args absent with pytest.raises(ValueError): seg_fill.run() # Assign some input data in_file = example_data('im1.nii') lesion_mask = example_data('im2.nii') seg_fill.inputs.in_file = in_file seg_fill.inputs.lesion_mask = lesion_mask
# 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 FitDwi, DwiTool from nipype.interfaces.niftyreg import no_nifty_package, get_custom_path from nipype.testing import example_data @pytest.mark.skipif(no_nifty_package(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 cmd = get_custom_path('fit_dwi', env_dir='NIFTYFITDIR') assert fit_dwi.cmd == cmd # 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