Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not specify own_atlas in CAT12Segment #3562

Open
b1060t opened this issue Apr 7, 2023 · 0 comments
Open

Can not specify own_atlas in CAT12Segment #3562

b1060t opened this issue Apr 7, 2023 · 0 comments

Comments

@b1060t
Copy link

b1060t commented Apr 7, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant