Skip to content

N4BiasFieldCorrection fails for compiled ANTS #3138

@salma1601

Description

@salma1601

Summary

N4BiasFieldCorrection throws an error

Actual behavior

The rescale_intensities trait is set by default to False while it must not be specified for ANTS version under 2.1.0

Expected behavior

rescale_intensities should be undefined by default

How to replicate the behavior

We can replicate the behavior with compiled ANTs

Script/Workflow details

My Ants version

salma@salma-Latitude-E7450:~/CODE/sammba-mri $ N4BiasFieldCorrection --version ANTs Version: 0.0.0.0 Compiled: Dec 22 2019 22:03:46

Ants version as read by nipype

salma@salma-Latitude-E7450:~/CODE/sammba-mri $ python -c "from nipype.interfaces import ants; print(ants.base.Info.version())" 200104-19:14:53,203 nipype.utils INFO:  Running nipype version 1.5.0-dev+g7f6cc2de2 (latest: 1.4.0) 0.0.0
from nipype.interfaces import ants bias_correct = ants.N4BiasFieldCorrection().run bias_correct(input_image='/tmp/func.nii.gz')

throws the following error

200104-19:20:52,963 nipype.utils INFO: Running nipype version 1.5.0-dev+g7f6cc2de2 (latest: 1.4.0) --------------------------------------------------------------------------- Exception Traceback (most recent call last) <ipython-input-1-9321c82e17d6> in <module> 2 3 bias_correct = ants.N4BiasFieldCorrection().run ----> 4 bias_correct(input_image='/tmp/func.nii.gz') ~/CODE/nipype/nipype/interfaces/base/core.py in run(self, cwd, ignore_exception, **inputs) 348 self.inputs.trait_set(**inputs) 349 self._check_mandatory_inputs() --> 350 self._check_version_requirements(self.inputs) 351 interface = self.__class__ 352 self._duecredit_cite() ~/CODE/nipype/nipype/interfaces/base/core.py in _check_version_requirements(self, trait_object, raise_exception) 281 raise Exception( 282 "Trait %s (%s) (version %s < required %s)" --> 283 % (name, self.__class__.__name__, version, min_ver) 284 ) 285 Exception: Trait rescale_intensities (N4BiasFieldCorrection) (version 0.0.0 < required 2.1.0) 

while forcing the trait rescale_intensities to be undefined solves the issue

from nipype.interfaces.base import traits bias_correct(input_image='/tmp/func.nii.gz', rescale_intensities=traits.Undefined)

Platform details:

200104-19:19:19,39 nipype.utils INFO:  Running nipype version 1.5.0-dev+g7f6cc2de2 (latest: 1.4.0) {'commit_hash': '7f6cc2de2',  'commit_source': 'repository',  'networkx_version': '2.4',  'nibabel_version': '3.0.0',  'nipype_version': '1.5.0-dev+g7f6cc2de2',  'numpy_version': '1.17.4',  'pkg_path': '/home/salma/CODE/nipype/nipype',  'scipy_version': '1.3.2',  'sys_executable': '/home/salma/miniconda3/bin/python',  'sys_platform': 'linux',  'sys_version': '3.7.4 (default, Aug 13 2019, 20:35:49) \n[GCC 7.3.0]',  'traits_version': '5.2.0'}``` 
 ### Execution environment - My python environment outside container 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions