Skip to content

Removal of AFNICommand._gen_fname breaks Allineate #3070

Closed
@tsalo

Description

@tsalo

Summary

I'm trying to use 3dAllineate within a workflow, and when writing out the transformation (but forgetting to end it with 1D) I came across an error with the automatic output filename determination. It looks like the method _gen_fname was removed from AFNICommand in #2964. I'm not sure what the appropriate fix is- should _gen_fname be re-added, or was it removed with another long-term solution in mind?

Actual behavior

After it successfully runs, Allineate raises the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 378, in run
    outputs = self.aggregate_outputs(runtime)
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py", line 455, in aggregate_outputs
    predicted_outputs = self._list_outputs()  # Predictions from _list_outputs
  File "/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/afni/preprocess.py", line 506, in _list_outputs
    outputs['out_matrix'] = self._gen_fname(
AttributeError: 'Allineate' object has no attribute '_gen_fname'

Expected behavior

The node should run and the output files should reflect what files were generated, rather than the filename I specified.

How to replicate the behavior

Run Allineate with out_matrix or out_param_file set as a filename that doesn't end in 1D or 1d. This should trigger AFNICommand._gen_fname, but that method doesn't exist.

Script/Workflow details

from nipype.interfaces import afni

allin = afni.Allineate(
    reference='/bids_dataset/sub-TEST1/ses-S2/anat/sub-TEST1_ses-S2_T1w.nii.gz',
    in_file='/bids_dataset/sub-TEST1/ses-S2/func/sub-TEST1_ses-S2_task-primaryEstimation_rec-magnitude_run-01_echo-1_sbref.nii.gz',
    out_matrix='sbref2anat.mat')
allin.run()

Platform details:

{'commit_hash': '4b69cfcfa',
 'commit_source': 'installation',
 'networkx_version': '2.3',
 'nibabel_version': '2.5.0',
 'nipype_version': '1.2.2',
 'numpy_version': '1.15.4',
 'pkg_path': '/usr/local/miniconda/lib/python3.7/site-packages/nipype',
 'scipy_version': '1.1.0',
 'sys_executable': '/usr/local/miniconda/bin/python',
 'sys_platform': 'linux',
 'sys_version': '3.7.1 (default, Dec 14 2018, 19:28:38) \n[GCC 7.3.0]',
 'traits_version': '4.6.0'}

Execution environment

Docker container built from the current fMRIPrep development Dockerfile (with pybids master installed).

Choose one

  • Container [Tag: ???]
  • My python environment inside container [Base Tag: ???]
  • My python environment outside container

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions