nipy / nipype

Workflows and interfaces for neuroimaging packages
https://nipype.readthedocs.org/en/latest/
Other
741 stars 523 forks source link

Spm apply inverse transform requires additional field? #3249

Open JoffJones opened 3 years ago

JoffJones commented 3 years ago

Summary

Setting the minimal inputs for spm.utils.ApplyInverseDeformation() gives the error: Item 'Image to base inverse on', field 'val': Number of matching files (0) less than required (1). Item defs: No field(s) named

Actual behavior

RuntimeError Traceback (most recent call last)

in () 5 inv.inputs.target = t1_r # target space 6 inv.inputs.interpolation = 0 ----> 7 inv.run() /home/jj02/.local/lib/python3.7/site-packages/nipype/interfaces/base/core.py in run(self, cwd, ignore_exception, **inputs) 395 try: 396 runtime = self._pre_run_hook(runtime) --> 397 runtime = self._run_interface(runtime) 398 runtime = self._post_run_hook(runtime) 399 outputs = self.aggregate_outputs(runtime) /home/jj02/.local/lib/python3.7/site-packages/nipype/interfaces/spm/base.py in _run_interface(self, runtime) 385 deepcopy(self._parse_inputs()) 386 ) --> 387 results = self.mlab.run() 388 runtime.returncode = results.runtime.returncode 389 if self.mlab.inputs.uses_mcr: /home/jj02/.local/lib/python3.7/site-packages/nipype/interfaces/base/core.py in run(self, cwd, ignore_exception, **inputs) 395 try: 396 runtime = self._pre_run_hook(runtime) --> 397 runtime = self._run_interface(runtime) 398 runtime = self._post_run_hook(runtime) 399 outputs = self.aggregate_outputs(runtime) /home/jj02/.local/lib/python3.7/site-packages/nipype/interfaces/matlab.py in _run_interface(self, runtime) 176 pass 177 if "MATLAB code threw an exception" in runtime.stderr: --> 178 self.raise_exception(runtime) 179 return runtime 180 /home/jj02/.local/lib/python3.7/site-packages/nipype/interfaces/base/core.py in raise_exception(self, runtime) 721 "Command:\n{cmdline}\nStandard output:\n{stdout}\n" 722 "Standard error:\n{stderr}\nReturn code: {returncode}" --> 723 ).format(**runtime.dictcopy()) 724 ) 725 RuntimeError: Command: matlab -nodesktop -nosplash -singleCompThread -r "addpath('/imaging/jj02/CALM/structural_connectomes/Brainnetome/test_parcellation');pyscript_applyinversedeformation;exit" Standard output: MATLAB is selecting SOFTWARE OPENGL rendering. < M A T L A B (R) > Copyright 1984-2019 The MathWorks, Inc. R2019a (9.6.0.1072779) 64-bit (glnxa64) March 8, 2019 To get started, type doc. For product information, visit www.mathworks.com. Using cbsu startup file /hpc-software/matlab/cbu/cbu_startup_v3 Executing pyscript_applyinversedeformation at 14-Sep-2020 13:23:04: ----------------------------------------------------------------------------------------------------- MATLAB Version: 9.6.0.1072779 (R2019a) MATLAB License Number: 666637 Operating System: Linux 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 Java Version: Java 1.8.0_181-b13 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode ----------------------------------------------------------------------------------------------------- MATLAB Version 9.6 (R2019a) 5G Toolbox Version 1.1 (R2019a) Aerospace Toolbox Version 3.1 (R2019a) Antenna Toolbox Version 4.0 (R2019a) Audio Toolbox Version 2.0 (R2019a) Automated Driving Toolbox Version 2.0 (R2019a) Bioinformatics Toolbox Version 4.12 (R2019a) Communications Toolbox Version 7.1 (R2019a) Computer Vision Toolbox Version 9.0 (R2019a) Control System Toolbox Version 10.6 (R2019a) Curve Fitting Toolbox Version 3.5.9 (R2019a) DSP System Toolbox Version 9.8 (R2019a) Database Toolbox Version 9.1 (R2019a) Datafeed Toolbox Version 5.8.1 (R2019a) Deep Learning Toolbox Version 12.1 (R2019a) Econometrics Toolbox Version 5.2 (R2019a) Embedded Coder Version 7.2 (R2019a) Filter Design HDL Coder Version 3.1.5 (R2019a) Financial Instruments Toolbox Version 2.9 (R2019a) Financial Toolbox Version 5.13 (R2019a) Fixed-Point Designer Version 6.3 (R2019a) Fuzzy Logic Toolbox Version 2.5 (R2019a) GPU Coder Version 1.3 (R2019a) Global Optimization Toolbox Version 4.1 (R2019a) HDL Coder Version 3.14 (R2019a) HDL Verifier Version 5.6 (R2019a) Image Acquisition Toolbox Version 6.0 (R2019a) Image Processing Toolbox Version 10.4 (R2019a) Instrument Control Toolbox Version 4.0 (R2019a) LTE Toolbox Version 3.1 (R2019a) MATLAB Coder Version 4.2 (R2019a) MATLAB Compiler Version 7.0.1 (R2019a) MATLAB Compiler SDK Version 6.6.1 (R2019a) MATLAB Parallel Server Version 7.0 (R2019a) MATLAB Report Generator Version 5.6 (R2019a) Mapping Toolbox Version 4.8 (R2019a) Model Predictive Control Toolbox Version 6.3 (R2019a) Optimization Toolbox Version 8.3 (R2019a) Parallel Computing Toolbox Version 7.0 (R2019a) Partial Differential Equation Toolbox Version 3.2 (R2019a) Phased Array System Toolbox Version 4.1 (R2019a) Predictive Maintenance Toolbox Version 2.0 (R2019a) RF Toolbox Version 3.6 (R2019a) Reinforcement Learning Toolbox Version 1.0 (R2019a) Risk Management Toolbox Version 1.5 (R2019a) Robotics System Toolbox Version 2.2 (R2019a) Robust Control Toolbox Version 6.6 (R2019a) Sensor Fusion and Tracking Toolbox Version 1.1 (R2019a) SerDes Toolbox Version 1.0 (R2019a) Signal Processing Toolbox Version 8.2 (R2019a) Statistical Parametric Mapping Version 7487 (SPM12) Statistics and Machine Learning Toolbox Version 11.5 (R2019a) Symbolic Math Toolbox Version 8.3 (R2019a) System Identification Toolbox Version 9.10 (R2019a) Text Analytics Toolbox Version 1.3 (R2019a) Trading Toolbox Version 3.5.1 (R2019a) Vehicle Network Toolbox Version 4.2 (R2019a) Vision HDL Toolbox Version 1.8 (R2019a) WLAN Toolbox Version 2.1 (R2019a) Wavelet Toolbox Version 5.2 (R2019a) SPM version: SPM12 Release: 7487 SPM path: /imaging/local/software/spm_cbu_svn/releases/spm12_fil_r7487/spm.m Item 'Image to base inverse on', field 'val': Number of matching files (0) less than required (1). Item defs: No field(s) named fnames interp Standard error: MATLAB code threw an exception: No executable modules, but still unresolved dependencies or incomplete module inputs. File:/imaging/local/software/spm_cbu_svn/releases/spm12_fil_r7487/spm_jobman.m Name:/imaging/local/software/spm_cbu_svn/releases/spm12_fil_r7487/spm_jobman.m Line:47 File:imaging/jj02/CALM/structural_connectomes/Brainnetome/test_parcellation/pyscript_applyinversedeformation.m Name:fill_run_job Line:115 File:pm_jobman Name:pyscript_applyinversedeformation Line:472 File:÷ Name: Line: Return code: 0 ### Expected behavior ### How to replicate the behavior ### Script/Workflow details Please put URL to code or code here (if not too long). import nipype.interfaces.spm.utils as spmu inv = spmu.ApplyInverseDeformation() inv.inputs.in_files = w_fan inv.inputs.deformation_field = t1_to_mni_deformation inv.inputs.target = t1_r # target space inv.inputs.interpolation = 0 inv.run() ### Platform details: Nipype version 1.5.1 ``` {'commit_hash': 'c5ce0e2c9', 'commit_source': 'installation', 'networkx_version': '2.4', 'nibabel_version': '3.1.0', 'nipype_version': '1.4.2', 'numpy_version': '1.18.3', 'pkg_path': '/home/jj02/.local/lib/python3.7/site-packages/nipype', 'scipy_version': '1.4.1', 'sys_executable': '/imaging/local/software/miniconda/bin/python', 'sys_platform': 'linux', 'sys_version': '3.7.3 | packaged by conda-forge | (default, Jul 1 2019, ' '21:52:21) \n' '[GCC 7.3.0]', 'traits_version': '6.0.0'} ``` ### Execution environment Choose one - Container [Tag: ???] - My python environment inside container [Base Tag: ???] - My python environment outside container
davidmeunier79 commented 3 years ago

HI @JoffJones I just a similar error when using the same function in a pipeline; I have done a modification in the way the SPM batch is called. I have done a version on my fork version : https://github.com/davidmeunier79/nipype/tree/bug_apply_inv and a PR: https://github.com/nipy/nipype/pull/3326

Can you have a check and let me know if that solved your issue as well? Thanks

effigies commented 3 years ago

Thanks for taking this on, @davidmeunier79. One question is whether this has always been a bug or if SPM has changed its input requirements at some version. Nipype generally tries to accommodate multiple versions of the wrapped tools, not just the latest, so it would be good to confirm the range of versions that the current and proposed interface work for.

davidmeunier79 commented 3 years ago

@effigies yes indeed, but I have no clue how it was earlier. FYI, the inspiration for the debug was from this post on the SPM list: https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=SPM;c03e7a18.1707