From 6d6d8cfc3939c2791be53712147e8708b4e0a067 Mon Sep 17 00:00:00 2001 From: manuegrx <47973414+manuegrx@users.noreply.github.com> Date: Mon, 21 Aug 2023 11:12:48 +0200 Subject: [PATCH 1/3] add mrtrix in capsul --- capsul/engine/module/__init__.py | 1 + capsul/engine/module/mrtrix.py | 101 ++++++++++++++ capsul/engine/module/nipype.py | 4 +- capsul/engine/test/test_capsul_engine.py | 25 +++- capsul/in_context/mrtrix.py | 127 ++++++++++++++++++ capsul/in_context/nipype.py | 18 ++- .../config_modules/mrtrix_config.py | 123 +++++++++++++++++ capsul/study_config/study_config.py | 13 +- .../test/test_study_config_configuration.py | 30 ++--- 9 files changed, 416 insertions(+), 26 deletions(-) create mode 100644 capsul/engine/module/mrtrix.py create mode 100644 capsul/in_context/mrtrix.py create mode 100644 capsul/study_config/config_modules/mrtrix_config.py diff --git a/capsul/engine/module/__init__.py b/capsul/engine/module/__init__.py index 85fb9bf05..7bc4514fa 100644 --- a/capsul/engine/module/__init__.py +++ b/capsul/engine/module/__init__.py @@ -4,4 +4,5 @@ 'ants', 'fsl', 'matlab', + 'mrtrix', 'spm'] diff --git a/capsul/engine/module/mrtrix.py b/capsul/engine/module/mrtrix.py new file mode 100644 index 000000000..4a5387c36 --- /dev/null +++ b/capsul/engine/module/mrtrix.py @@ -0,0 +1,101 @@ +# -*- coding: utf-8 -*- +from __future__ import absolute_import + +import os +from capsul import engine +import six + + +def init_settings(capsul_engine): + with capsul_engine.settings as settings: + settings.ensure_module_fields('mrtrix', + [dict(name='directory', + type='string', + description='Directory where mrtrix is installed') + ]) + + # init a single config + config = settings.config('mrtrix', 'global') + if not config: + settings.new_config('mrtrix', 'global', + {capsul_engine.settings.config_id_field: + 'mrtrix'}) + + +def check_notably_invalid_config(conf): + ''' + Checks if the given module config is obviously invalid, for instance + if a mandatory path is not filled + + Returns + ------- + invalid: list + list of invalid config keys + ''' + invalid = [] + for k in ('directory', ): + if getattr(conf, k, None) is None: + invalid.append(k) + return invalid + + +def activate_configurations(): + ''' + Activate the mrtrix module (set env variables) from the global + configurations, in order to use them via + :mod:`capsul.in_context.mrtrix` functions + ''' + conf = engine.configurations.get('capsul.engine.module.mrtrix', {}) + mrtrix_dir = conf.get('directory') + if mrtrix_dir: + os.environ['MRTRIXPATH'] = six.ensure_str(mrtrix_dir) + elif 'MRTRIXPATH' in os.environ: + del os.environ['MRTRIXPATH'] + + +def edition_widget(engine, environment, config_id='mrtrix'): + ''' Edition GUI for mrtrix config - see + :class:`~capsul.qt_gui.widgets.settings_editor.SettingsEditor` + ''' + from soma.qt_gui.controller_widget import ScrollControllerWidget + from soma.controller import Controller + import types + import traits.api as traits + + def validate_config(widget): + widget.update_controller() + controller = widget.controller_widget.controller + with widget.engine.settings as session: + conf = session.config(config_id, widget.environment) + values = {'config_id': config_id} + for k in ['directory']: + value = getattr(controller, k) + if value is traits.Undefined: + value = None + values[k] = value + if conf is None: + session.new_config(config_id, widget.environment, values) + else: + for k, value in values.items(): + if k == 'config_id': + continue + setattr(conf, k, values[k]) + + controller = Controller() + + controller.add_trait('directory', + traits.Directory(traits.Undefined, + desc='Directory where mrtrix is installed')) + + conf = engine.settings.select_configurations( + environment, {'mrtrix': 'any'}) + if conf: + fconf = conf.get('capsul.engine.module.mrtrix', {}) + controller.directory = fconf.get('directory', traits.Undefined) + + widget = ScrollControllerWidget(controller, live=True) + widget.engine = engine + widget.environment = environment + widget.accept = types.MethodType(validate_config, widget) + + return widget diff --git a/capsul/engine/module/nipype.py b/capsul/engine/module/nipype.py index 2fc0affae..e82feb038 100644 --- a/capsul/engine/module/nipype.py +++ b/capsul/engine/module/nipype.py @@ -18,7 +18,7 @@ def ensure_config_exists(engine): def init_settings(capsul_engine): with capsul_engine.settings as settings: - settings.ensure_module_fields('nipype',[]) + settings.ensure_module_fields('nipype', []) pass ensure_config_exists(capsul_engine) @@ -40,7 +40,7 @@ def activate_configurations(): from capsul.in_context import nipype # activate optional dependencies first - for module in ('spm', 'fsl', 'freesurfer', 'afni', 'ants'): + for module in ('spm', 'fsl', 'freesurfer', 'afni', 'ants', 'mrtrix'): module_name = Settings.module_name(module) mod_conf = engine.configurations.get(module_name) if mod_conf: diff --git a/capsul/engine/test/test_capsul_engine.py b/capsul/engine/test/test_capsul_engine.py index 196832574..ae311b785 100644 --- a/capsul/engine/test/test_capsul_engine.py +++ b/capsul/engine/test/test_capsul_engine.py @@ -184,6 +184,15 @@ def test_engine_settings(self): settings.new_config('ants', 'global', {'directory': '/there', cif: '235'}) + # Create a global mrtrix configuration + # FIXME : mrtrix cif ? + config = settings.config('mrtrix', 'global') + if config: + settings.remove_config('mrtrix', 'global', + getattr(config, cif)) + settings.new_config('mrtrix', 'global', {'directory': '/there', + cif: '235'}) + # Create two global SPM configurations settings.new_config('spm', 'global', {'version': '8', 'standalone': True, @@ -202,7 +211,8 @@ def test_engine_settings(self): 'capsul.engine.module.matlab': 'ALL', 'capsul.engine.module.spm': 'ALL', 'capsul.engine.module.afni': 'ALL', - 'capsul.engine.module.ants': 'ALL'}}, + 'capsul.engine.module.ants': 'ALL', + 'capsul.engine.module.mrtrix': 'ALL'}}, 'capsul.engine.module.fsl': {'config_environment': 'global', 'directory': '/there', cif: '5'}, @@ -212,6 +222,9 @@ def test_engine_settings(self): 'capsul.engine.module.ants': { 'config_environment': 'global', 'directory': '/there', cif: '235'}, + 'capsul.engine.module.mrtrix': { + 'config_environment': 'global', 'directory': '/there', + cif: '235'}, # FIXME : mrtrix cif ? 'capsul.engine.module.spm': {'config_environment': 'my_machine', 'version': '20', 'standalone': True, @@ -246,6 +259,16 @@ def test_engine_settings(self): 'capsul_engine': {'uses': {'capsul.engine.module.ants': 'any'}}}) + # FIXME : mrtrix cif ? + self.assertEqual( + self.ce.settings.select_configurations('global', + uses={'mrtrix': 'any'}), + {'capsul.engine.module.mrtrix': + {'config_environment': 'global', 'directory': '/there', + cif: '235'}, + 'capsul_engine': + {'uses': {'capsul.engine.module.mrtrix': 'any'}}}) + self.assertEqual( self.ce.settings.select_configurations('global', uses={'spm': 'any'}), diff --git a/capsul/in_context/mrtrix.py b/capsul/in_context/mrtrix.py new file mode 100644 index 000000000..1660a6218 --- /dev/null +++ b/capsul/in_context/mrtrix.py @@ -0,0 +1,127 @@ +# -*- coding: utf-8 -*- +''' +Specific subprocess-like functions to call mrtrix taking into account +configuration stored in ExecutionContext. To functions and class in +this module it is mandatory to activate an ExecutionContext (using a +with statement). For instance:: + + from capsul.engine import capsul_engine + from capsul.in_context.mrtrix import mrtrix_check_call + + ce = capsul_engine() + with ce: + mrtrix_check_call(['mrinfo', '/somewhere/myimage.nii']) + +For calling mrtrix command with this module, the first argument of +command line must be the mrtrix executable without any path. +The appropriate path is added from the configuration +of the ExecutionContext. +''' + +from __future__ import absolute_import + +import os +import os.path as osp +import soma.subprocess +from soma.utils.env import parse_env_lines +import six + +mrtrix_runtime_env = None + + +def mrtrix_command_with_environment(command, use_runtime_env=True): + ''' + Given an mrtrix command where first element is a command name without + any path. Returns the appropriate command to call taking into account + the mrtrix configuration stored in the + activated ExecutionContext. + ''' + + if use_runtime_env and mrtrix_runtime_env: + c0 = list(osp.split(command[0])) + c0 = osp.join(*c0) + cmd = [c0] + command[1:] + return cmd + + mrtrix_dir = os.environ.get('MRTRIXPATH') + if mrtrix_dir: + shell = os.environ.get('SHELL', '/bin/sh') + if shell.endswith('csh'): + cmd = [shell, '-c', + 'setenv MRTRIXPATH "{0}"; setenv PATH "{0}:$PATH";exec {1} '.format( + mrtrix_dir, command[0]) + \ + ' '.join("'%s'" % i.replace("'", "\\'") for i in command[1:])] + else: + cmd = [shell, '-c', + 'export MRTRIXPATH="{0}"; export PATH="{0}:$PATH"; exec {1} '.format( + mrtrix_dir, command[0]) + \ + ' '.join("'%s'" % i.replace("'", "\\'") for i in command[1:])] + + return cmd + + +def mrtrix_env(): + ''' + get mrtrix env variables + process + ''' + global mrtrix_runtime_env + + if mrtrix_runtime_env is not None: + return mrtrix_runtime_env + + mrtrix_dir = os.environ.get('MRTRIXPATH') + kwargs = {} + + cmd = mrtrix_command_with_environment(['env'], use_runtime_env=False) + new_env = soma.subprocess.check_output(cmd, **kwargs).decode( + 'utf-8').strip() + new_env = parse_env_lines(new_env) + env = {} + for l in new_env: + name, val = l.strip().split('=', 1) + name = six.ensure_str(name) + val = six.ensure_str(val) + if name not in ('_', 'SHLVL') and (name not in os.environ + or os.environ[name] != val): + env[name] = val + + # add PATH + if mrtrix_dir: + env['PATH'] = os.pathsep.join([mrtrix_dir, os.environ.get('PATH', '')]) + # cache dict + mrtrix_runtime_env = env + return env + + +class MrtrixPopen(soma.subprocess.Popen): + ''' + Equivalent to Python subprocess.Popen for mrtrix commands + ''' + def __init__(self, command, **kwargs): + cmd = mrtrix_command_with_environment(command) + super(MrtrixPopen, self).__init__(cmd, **kwargs) + + +def mrtrix_call(command, **kwargs): + ''' + Equivalent to Python subprocess.call for mrtrix commands + ''' + cmd = mrtrix_command_with_environment(command) + return soma.subprocess.call(cmd, **kwargs) + + +def mrtrix_check_call(command, **kwargs): + ''' + Equivalent to Python subprocess.check_call for mrtrix commands + ''' + cmd = mrtrix_command_with_environment(command) + return soma.subprocess.check_call(cmd, **kwargs) + + +def mrtrix_check_output(command, **kwargs): + ''' + Equivalent to Python subprocess.check_output for mrtrix commands + ''' + cmd = mrtrix_command_with_environment(command) + return soma.subprocess.check_output(cmd, **kwargs) diff --git a/capsul/in_context/nipype.py b/capsul/in_context/nipype.py index 2af2f6b55..7769fca0b 100644 --- a/capsul/in_context/nipype.py +++ b/capsul/in_context/nipype.py @@ -5,19 +5,21 @@ import os import os.path as osp + def configure_all(): ''' Configure nipye for all known software interfaces their configuration is present in os.environ. This environment must have been set by the CapsulEngine mechanism. ''' - #print('!!!') + configure_matlab() configure_spm() configure_fsl() configure_freesurfer() configure_afni() configure_ants() + configure_mrtrix() def configure_spm(): @@ -110,6 +112,7 @@ def configure_afni(): for var, value in env.items(): os.environ[var] = value + def configure_ants(): ''' Configure ANTS for nipype @@ -121,3 +124,16 @@ def configure_ants(): env = antsrun.ants_env() for var, value in env.items(): os.environ[var] = value + + +def configure_mrtrix(): + ''' + Configure mrtrix for nipype + ''' + from capsul import engine + conf = engine.configurations.get('capsul.engine.module.mrtrix') + if conf: + from capsul.in_context import mrtrix as mrtrixrun + env = mrtrixrun.mrtrix_env() + for var, value in env.items(): + os.environ[var] = value diff --git a/capsul/study_config/config_modules/mrtrix_config.py b/capsul/study_config/config_modules/mrtrix_config.py new file mode 100644 index 000000000..4ba714cf7 --- /dev/null +++ b/capsul/study_config/config_modules/mrtrix_config.py @@ -0,0 +1,123 @@ +# -*- coding: utf-8 -*- +''' +mrtrix configuration module + +Classes +======= +:class:`MRTRIXConfig` +------------------ +''' + +from __future__ import absolute_import +from traits.api import File, Bool, Undefined + +from capsul.study_config.study_config import StudyConfigModule +from capsul.engine import CapsulEngine +# from capsul.subprocess.mrtrix import check_mrtrix_configuration + + +class MRTRIXConfig(StudyConfigModule): + ''' + `mrtrix `_ configuration module + ''' + + def __init__(self, study_config, configuration): + super(MRTRIXConfig, self).__init__(study_config, configuration) + self.study_config.add_trait('mrtrix_path', File( + Undefined, + output=False, + desc='Parameter to specify the mrtrix path', groups=['mrtrix'])) + self.study_config.add_trait('use_mrtrix', Bool( + Undefined, + output=False, + desc='Parameter to tell that we need to configure mrtrix', + groups=['mrtrix'])) + + def __del__(self): + try: + self.study_config.engine.settings.module_notifiers.get( + 'capsul.engine.module.mrtrix', []).remove( + self.sync_from_engine) + except (ValueError, ReferenceError): + pass + + def initialize_module(self): + """ Set up mrtrix environment variables according to current + configuration. + """ + if 'capsul.engine.module.mrtrix' \ + not in self.study_config.engine._loaded_modules: + self.study_config.engine.load_module('capsul.engine.module.mrtrix') + if type(self.study_config.engine) is not CapsulEngine: + # engine is a proxy, thus we are initialized from a real + # CapsulEngine, which holds the reference values + self.sync_from_engine() + else: + self.sync_to_engine() + # TODO : do we need to add this tets for mrtrix as for afni/ants/fsl ? + # # this test aims to raise an exception in case of incorrect setting, + # # complying to capsul 2.x behavior. + # if self.study_config.use_mrtrix is True: + # check_mrtrix_configuration(self.study_config) + + def initialize_callbacks(self): + self.study_config.on_trait_change( + self.sync_to_engine, '[mrtrix_path, use_mrtrix]') + # WARNING ref to self in callback + self.study_config.engine.settings.module_notifiers[ + 'capsul.engine.module.mrtrix'] = [self.sync_from_engine] + + def sync_to_engine(self, param=None, value=None): + if getattr(self, '_syncing', False): + # manage recursive calls + return + self._syncing = True + try: + if 'MRTRIXConfig' in self.study_config.modules \ + and 'capsul.engine.module.mrtrix' \ + in self.study_config.engine._loaded_modules: + with self.study_config.engine.settings as session: + cif = self.study_config.engine.settings.config_id_field + config = session.config('mrtrix', 'global') + mrtrix_path = self.study_config.mrtrix_path + if mrtrix_path is Undefined: + mrtrix_path = None + + if config is None: + session.new_config( + 'mrtrix', 'global', + {'directory': mrtrix_path, + cif: 'mrtrix'}) + else: + config.directory = mrtrix_path + del config + del session + finally: + del self._syncing + + def sync_from_engine(self, param=None, value=None): + if getattr(self, '_syncing', False): + # manage recursive calls + return + self._syncing = True + try: + if 'MRTRIXConfig' in self.study_config.modules \ + and 'capsul.engine.module.mrtrix' \ + in self.study_config.engine._loaded_modules: + with self.study_config.engine.settings as session: + config = session.config('mrtrix', 'global') + if config: + directory = config.directory \ + if config.directory not in (None, '') \ + else Undefined + self.study_config.mrtrix_path = directory + if self.study_config.mrtrix_path not in (None, + Undefined): + self.study_config.use_mrtrix = True + else: + self.study_config.use_mrtrix = False + + except ReferenceError: + pass + finally: + del self._syncing diff --git a/capsul/study_config/study_config.py b/capsul/study_config/study_config.py index 4843465be..5e8b579b5 100644 --- a/capsul/study_config/study_config.py +++ b/capsul/study_config/study_config.py @@ -59,7 +59,7 @@ class StudyConfig(Controller): StudyConfig has modules (see BrainVISAConfig, AFNIConfig, FSLConfig, MatlabConfig, ANTSConfig, SmartCachingConfig, SomaWorkflowConfig, - SPMConfig, FOMConfig). + SPMConfig, FOMConfig, MRTRIXConfig). Modules are initialized in the constructor, so their list has to be setup before instantiating StudyConfig. A default modules list is used when no modules are specified: StudyConfig.default_modules @@ -108,7 +108,8 @@ class StudyConfig(Controller): set_study_configuration """ - default_modules = ['AFNIConfig', 'ANTSConfig', 'FSLConfig', 'MatlabConfig', 'SmartCachingConfig', + default_modules = ['AFNIConfig', 'ANTSConfig', 'FSLConfig', 'MatlabConfig', + 'MRTRIXConfig', 'SmartCachingConfig', 'SomaWorkflowConfig', 'SPMConfig'] _user_config_directory = os.path.join("~", ".config", "capsul") @@ -179,7 +180,7 @@ def __init__(self, study_name=None, init_config=None, modules=None, """ super(StudyConfig, self).__init__() - + if study_name: self.study_name = study_name @@ -323,7 +324,6 @@ def run(self, process_or_pipeline, output_directory=None, configuration dictionary """ - # Use soma workflow to execute the pipeline or process in parallel # on the local machine. This has now moved to CapsulEngine. if self.get_trait_value("use_soma_workflow"): @@ -351,16 +351,15 @@ def run(self, process_or_pipeline, output_directory=None, % (ptype, process_or_pipeline.name, ', '.join(missing))) - # Use the local machine to execute the pipeline or process if output_directory is None or output_directory is Undefined \ or output_directory == '': if 'output_directory' in process_or_pipeline.traits(): output_directory = getattr(process_or_pipeline, - 'output_directory') + 'output_directory') if output_directory in (None, Undefined, ''): output_directory = self.output_directory - # Not all processes need an output_directory defined on + # Not all processes need an output_directory defined on # StudyConfig if output_directory not in (None, Undefined, ''): # Check the output directory is valid diff --git a/capsul/study_config/test/test_study_config_configuration.py b/capsul/study_config/test/test_study_config_configuration.py index 01c269fbd..7319be0ff 100644 --- a/capsul/study_config/test/test_study_config_configuration.py +++ b/capsul/study_config/test/test_study_config_configuration.py @@ -38,8 +38,8 @@ 'process_output_directory': False, 'user_level': 0, }, - ['AFNIConfig', 'ANTSConfig', 'FSLConfig', 'MatlabConfig', 'SPMConfig', 'SmartCachingConfig', - 'SomaWorkflowConfig'], + ['AFNIConfig', 'ANTSConfig', 'FSLConfig', 'MatlabConfig', 'MRTRIXConfig', + 'SPMConfig', 'SmartCachingConfig', 'SomaWorkflowConfig'], None, None]], @@ -57,8 +57,8 @@ 'process_output_directory': False, 'user_level': 0, }, - ['AFNIConfig', 'ANTSConfig', 'FSLConfig', 'MatlabConfig', 'SPMConfig', 'SmartCachingConfig', - 'SomaWorkflowConfig'], + ['AFNIConfig', 'ANTSConfig', 'FSLConfig', 'MatlabConfig', 'MRTRIXConfig', + 'SPMConfig', 'SmartCachingConfig', 'SomaWorkflowConfig'], None, None]], @@ -76,8 +76,8 @@ 'process_output_directory': False, 'user_level': 0, }, - ['AFNIConfig', 'ANTSConfig', 'FSLConfig', 'MatlabConfig', 'SPMConfig', 'SmartCachingConfig', - 'SomaWorkflowConfig'], + ['AFNIConfig', 'ANTSConfig', 'FSLConfig', 'MatlabConfig', 'MRTRIXConfig', + 'SPMConfig', 'SmartCachingConfig', 'SomaWorkflowConfig'], None, None]], @@ -120,7 +120,7 @@ 'user_level': 0, }, ['AFNIConfig', 'ANTSConfig', 'BrainVISAConfig', 'FSLConfig', - 'FreeSurferConfig', 'MatlabConfig', 'SPMConfig', + 'FreeSurferConfig', 'MatlabConfig', 'MRTRIXConfig', 'SPMConfig', 'SmartCachingConfig', 'SomaWorkflowConfig'], None, None]], @@ -147,8 +147,8 @@ 'process_output_directory': False, 'user_level': 0, }, - ['AFNIConfig', 'ANTSConfig', 'FSLConfig', 'MatlabConfig', 'SPMConfig', - 'SmartCachingConfig', 'SomaWorkflowConfig'], + ['AFNIConfig', 'ANTSConfig', 'FSLConfig', 'MatlabConfig', 'MRTRIXConfig', + 'SPMConfig', 'SmartCachingConfig', 'SomaWorkflowConfig'], 'config.json', None]], @@ -193,8 +193,8 @@ 'process_output_directory': False, 'user_level': 0, }, - ['AFNIConfig', 'ANTSConfig', 'FSLConfig', 'MatlabConfig', 'SPMConfig', - 'SmartCachingConfig', 'SomaWorkflowConfig'], + ['AFNIConfig', 'ANTSConfig', 'FSLConfig', 'MatlabConfig', 'MRTRIXConfig', + 'SPMConfig', 'SmartCachingConfig', 'SomaWorkflowConfig'], 'config.json', None]], @@ -245,8 +245,8 @@ 'process_output_directory': False, 'user_level': 0, }, - ['AFNIConfig', 'ANTSConfig', 'FSLConfig', 'MatlabConfig', 'SPMConfig', - 'SmartCachingConfig', 'SomaWorkflowConfig'], + ['AFNIConfig', 'ANTSConfig', 'FSLConfig', 'MatlabConfig', 'MRTRIXConfig', + 'SPMConfig', 'SmartCachingConfig', 'SomaWorkflowConfig'], os.path.join('somewhere', 'config.json'), None]], @@ -291,8 +291,8 @@ 'process_output_directory': False, 'user_level': 0, }, - ['AFNIConfig', 'ANTSConfig', 'FSLConfig', 'MatlabConfig', 'SPMConfig', - 'SmartCachingConfig', 'SomaWorkflowConfig'], + ['AFNIConfig', 'ANTSConfig', 'FSLConfig', 'MatlabConfig', 'MRTRIXConfig', + 'SPMConfig', 'SmartCachingConfig', 'SomaWorkflowConfig'], os.path.join('somewhere', 'config.json'), os.path.join('somewhere', 'other_study.json')]], From a8c7e4b81a8848a905080961dca1a13573e4647b Mon Sep 17 00:00:00 2001 From: manuegrx <47973414+manuegrx@users.noreply.github.com> Date: Tue, 22 Aug 2023 09:20:12 +0200 Subject: [PATCH 2/3] change check_notably_invalid_config function --- capsul/engine/module/mrtrix.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/capsul/engine/module/mrtrix.py b/capsul/engine/module/mrtrix.py index 4a5387c36..7555a2343 100644 --- a/capsul/engine/module/mrtrix.py +++ b/capsul/engine/module/mrtrix.py @@ -32,11 +32,7 @@ def check_notably_invalid_config(conf): invalid: list list of invalid config keys ''' - invalid = [] - for k in ('directory', ): - if getattr(conf, k, None) is None: - invalid.append(k) - return invalid + return getattr(conf, 'directory', None) def activate_configurations(): From 5dc94d4b7f487a6b4337704ad43b63f423060f03 Mon Sep 17 00:00:00 2001 From: manuegrx <47973414+manuegrx@users.noreply.github.com> Date: Tue, 29 Aug 2023 17:12:53 +0200 Subject: [PATCH 3/3] change cif for mrtrix - capsul engine test --- capsul/engine/test/test_capsul_engine.py | 8 +++----- capsul/study_config/config_modules/mrtrix_config.py | 5 ----- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/capsul/engine/test/test_capsul_engine.py b/capsul/engine/test/test_capsul_engine.py index ae311b785..d20f01993 100644 --- a/capsul/engine/test/test_capsul_engine.py +++ b/capsul/engine/test/test_capsul_engine.py @@ -185,13 +185,12 @@ def test_engine_settings(self): cif: '235'}) # Create a global mrtrix configuration - # FIXME : mrtrix cif ? config = settings.config('mrtrix', 'global') if config: settings.remove_config('mrtrix', 'global', getattr(config, cif)) settings.new_config('mrtrix', 'global', {'directory': '/there', - cif: '235'}) + cif: '400'}) # Create two global SPM configurations settings.new_config('spm', 'global', {'version': '8', @@ -224,7 +223,7 @@ def test_engine_settings(self): cif: '235'}, 'capsul.engine.module.mrtrix': { 'config_environment': 'global', 'directory': '/there', - cif: '235'}, # FIXME : mrtrix cif ? + cif: '400'}, 'capsul.engine.module.spm': {'config_environment': 'my_machine', 'version': '20', 'standalone': True, @@ -259,13 +258,12 @@ def test_engine_settings(self): 'capsul_engine': {'uses': {'capsul.engine.module.ants': 'any'}}}) - # FIXME : mrtrix cif ? self.assertEqual( self.ce.settings.select_configurations('global', uses={'mrtrix': 'any'}), {'capsul.engine.module.mrtrix': {'config_environment': 'global', 'directory': '/there', - cif: '235'}, + cif: '400'}, 'capsul_engine': {'uses': {'capsul.engine.module.mrtrix': 'any'}}}) diff --git a/capsul/study_config/config_modules/mrtrix_config.py b/capsul/study_config/config_modules/mrtrix_config.py index 4ba714cf7..e2890cbdb 100644 --- a/capsul/study_config/config_modules/mrtrix_config.py +++ b/capsul/study_config/config_modules/mrtrix_config.py @@ -54,11 +54,6 @@ def initialize_module(self): self.sync_from_engine() else: self.sync_to_engine() - # TODO : do we need to add this tets for mrtrix as for afni/ants/fsl ? - # # this test aims to raise an exception in case of incorrect setting, - # # complying to capsul 2.x behavior. - # if self.study_config.use_mrtrix is True: - # check_mrtrix_configuration(self.study_config) def initialize_callbacks(self): self.study_config.on_trait_change(