Example #1
0
def check_deps(workflow):
    """Make sure all dependencies are installed."""
    from nipype.utils.filemanip import which
    return sorted((node.interface.__class__.__name__, node.interface._cmd)
                  for node in workflow._get_all_nodes()
                  if (hasattr(node.interface, '_cmd')
                      and which(node.interface._cmd.split()[0]) is None))
Example #2
0
def check_deps(workflow):
    from nipype.utils.filemanip import which
    return sorted(
        (node.interface.__class__.__name__, node.interface._cmd)
        for node in workflow._get_all_nodes()
        if (hasattr(node.interface, '_cmd') and
            which(node.interface._cmd.split()[0]) is None))
Example #3
0
def check_deps(workflow):
    """Make sure workflow dependencies are present before runtime."""
    from nipype.utils.filemanip import which

    return sorted((node.interface.__class__.__name__, node.interface._cmd)
                  for node in workflow._get_all_nodes()
                  if (hasattr(node.interface, "_cmd")
                      and which(node.interface._cmd.split()[0]) is None))
Example #4
0
    def _parse_inputs(self, skip=None):
        if skip is None:
            skip = []

        if not isdefined(self.inputs.in_config):
            from nipype.utils.filemanip import which
            path = which(self._cmd)
            if path is None:
                path = os.getenv(MRTRIX3_HOME, '/opt/mrtrix3')
            else:
                path = op.dirname(op.dirname(path))

            self.inputs.in_config = op.join(
                path, 'src/dwi/tractography/connectomics/'
                'example_configs/fs_default.txt')

        return super(LabelConvert, self)._parse_inputs(skip=skip)
Example #5
0
    def _parse_inputs(self, skip=None):
        if skip is None:
            skip = []

        if not isdefined(self.inputs.in_config):
            from nipype.utils.filemanip import which
            path = which(self._cmd)
            if path is None:
                path = os.getenv(MRTRIX3_HOME, '/opt/mrtrix3')
            else:
                path = op.dirname(op.dirname(path))

            self.inputs.in_config = op.join(
                path, 'src/dwi/tractography/connectomics/'
                'example_configs/fs_default.txt')

        return super(LabelConvert, self)._parse_inputs(skip=skip)
Example #6
0
import os
import sys
import subprocess

from heudiconv.cli.run import main as runner
from .utils import TESTS_DATA_PATH
import pytest
from nipype.utils.filemanip import which


@pytest.mark.skipif(which("sbatch"), reason="skip a real slurm call")
@pytest.mark.parametrize(
    'invocation',
    [
        "--files %s/01-fmap_acq-3mm" %
        TESTS_DATA_PATH,  # our new way with automated groupping
        "-d %s/{subject}/* -s 01-fmap_acq-3mm" %
        TESTS_DATA_PATH  # "old" way specifying subject
    ])
def test_queue_no_slurm(tmpdir, invocation):
    tmpdir.chdir()
    hargs = invocation.split(" ")
    hargs.extend(["-f", "reproin", "-b", "--minmeta", "--queue", "SLURM"])

    # simulate command-line call
    _sys_args = sys.argv
    sys.argv = ['heudiconv'] + hargs

    try:
        with pytest.raises(OSError):
            runner(hargs)
Example #7
0
from nipype.utils.filemanip import fname_presuffix, split_filename, which
from nipype.interfaces.base import (traits, TraitedSpec,
                                    BaseInterfaceInputSpec, File,
                                    SimpleInterface, InputMultiObject,
                                    isdefined, CommandLineInputSpec)
from nipype.interfaces.mrtrix3 import Generate5tt, ResponseSD, MRConvert
from nipype.interfaces.mrtrix3.utils import Generate5ttInputSpec
from nipype.interfaces.mrtrix3.base import MRTrix3Base, MRTrix3BaseInputSpec
from nipype.interfaces.mrtrix3.preprocess import ResponseSDInputSpec
from nipype.interfaces.mrtrix3.tracking import TractographyInputSpec, Tractography
from ..niworkflows.viz.utils import cuts_from_bbox, compose_view, plot_denoise
from .denoise import (SeriesPreprocReport, SeriesPreprocReportInputSpec,
                      SeriesPreprocReportOutputSpec)

LOGGER = logging.getLogger('nipype.interface')
RC3_ROOT = which('average_response')  # Only exists in RC3
if RC3_ROOT is not None:
    # Use the directory containing average_response
    RC3_ROOT = os.path.split(RC3_ROOT)[0]
SS3T_ROOT = which('ss3t_csd_beta1')
if SS3T_ROOT is None:
    if os.getenv('SS3T_HOME'):
        SS3T_ROOT = os.getenv('SS3T_HOME')
    elif os.path.exists('/opt/3Tissue/bin/ss3t_csd_beta1'):
        SS3T_ROOT = '/opt/3Tissue/bin'


class TckGenInputSpec(TractographyInputSpec):
    power = traits.CFloat(argstr='-power %f')
    select = traits.CInt(argstr='-select %d')
    select = traits.CInt(
Example #8
0
def get_matlab_command():
    """Determine whether Matlab is installed and can be executed."""
    if "NIPYPE_NO_MATLAB" not in os.environ:
        from nipype.utils.filemanip import which

        return which(os.getenv("MATLABCMD", "matlab"))