nipype icon indicating copy to clipboard operation
nipype copied to clipboard

Can not specify own_atlas in CAT12Segment

Open b1060t opened this issue 2 years ago • 0 comments
trafficstars

Summary

I'm trying to use aal3.nii as own atlas in CAT12Segment:

seg.inputs.own_atlas = [os.path.abspath(os.path.join('data', 'bin', 'aal3.nii'))]

But after adding this line, an error occurred when running the matlab script:

Unable to perform assignment because the left and right sides have a different number of elements

The generated code is:

jobs{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.ownatlas(1) = '/abs/path/to/workflow/cat12segment/subj_id/seg/aal3.nii';

Actual behavior

CAT12Segment can not proceed.

Expected behavior

Segmentation with aal labels

How to replicate the behavior

Specify the value of own_atlas

Script/Workflow details

data = getPandas('pat_data').iloc[:1]

key_list = data['KEY'].tolist()

wf = Workflow(name='cat12segment', base_dir=os.path.abspath('tmp'))

info_src = Node(util.IdentityInterface(fields=['key']), name='info_src')
info_src.iterables = ('key', key_list)

raw_src = Node(nio.DataGrabber(infields=['key'], outfields=['raw']), name='raw_src')
raw_src.inputs.base_directory = os.path.abspath(os.path.join('data', 'subj'))
raw_src.inputs.sort_filelist = False
raw_src.inputs.template = '*'
raw_src.inputs.template_args = {
    'raw': [['key']]
}
raw_src.inputs.field_template = {
    'raw': os.path.join('%s', 'raw', 'raw.nii')
}

seg = Node(CAT12Segment(), name='seg')
seg.inputs.own_atlas = [os.path.abspath(os.path.join('data', 'bin', 'aal3.nii'))]

sink = Node(nio.DataSink(), name='sink')
sink.inputs.base_directory = os.path.abspath(os.path.join('data', 'subj'))
sink.inputs.parameterization = False

wf.connect([
    (info_src, raw_src, [('key', 'key')]),
    (raw_src, seg, [('raw', 'in_files')]),
    (info_src, sink, [('key', 'container')]),
    (seg, sink, [
        ('gm_modulated_image', 'cat12.mri.@gm'),
        ('wm_modulated_image', 'cat12.mri.@wm'),
        ('csf_modulated_image', 'cat12.mri.@csf'),
        ('mri_images', 'cat12.mri.@mri_images'),
        ('label_files', 'cat12.label.@label_files'),
        ('label_roi', 'cat12.label.@label_roi'),
        ('label_rois', 'cat12.label.@label_rois'),
        ('lh_central_surface', 'cat12.surf.@lh_central_surface'),
        ('lh_sphere_surface', 'cat12.surf.@lh_sphere_surface'),
        ('rh_central_surface', 'cat12.surf.@rh_central_surface'),
        ('rh_sphere_surface', 'cat12.surf.@rh_sphere_surface'),
        ('report_files', 'cat12.report.@report_files'),
        ('report', 'cat12.report.@report'),
        ('surface_files', 'cat12.surf.@surface_files'),
        ]),
])

wf.run()

Platform details:

{'commit_hash': 'dd60d5f',
 'commit_source': 'repository',
 'networkx_version': '2.5',
 'nibabel_version': '5.0.0',
 'nipype_version': '1.8.5',
 'numpy_version': '1.24.1',
 'pkg_path': '/home/biobot/.pyenv/versions/3.10.9/lib/python3.10/site-packages/nipype',
 'scipy_version': '1.10.0',
 'sys_executable': '/home/biobot/.pyenv/versions/3.10.9/bin/python',
 'sys_platform': 'linux',
 'sys_version': '3.10.9 (main, Jan 29 2023, 21:28:03) [GCC 11.3.0]',
 'traits_version': '6.3.2'}

Execution environment

Choose one

  • My python environment outside container

b1060t avatar Apr 07 '23 02:04 b1060t