t1-volume – Volume-based processing of T1-weighted MR images with SPM

43 views
Skip to first unread message

Shahzad ALi

unread,
Mar 21, 2025, 5:33:20 PMMar 21
to Clinica
Hi, Dear Alice,
I’m using the T1 Volume Pipeline to process T1-weighted MRI data and need clarification on how to assign the group label in following command:
clinica run t1-volume [OPTIONS] BIDS_DIRECTORY CAPS_DIRECTORY GROUP_LABEL 
Do I have to divide subjects based on their diagnosis group like 'AD' and 'CN' and use it as group labels, or is there a recommended naming convention?
Can I process both groups in a single pipeline run, or do I need to run the pipeline separately for each group?
Thank you in advance for your help! 

Best regards,
Shahzad
-------------------



Alice Joubert

unread,
Mar 24, 2025, 6:09:23 AMMar 24
to clinic...@googlegroups.com
Dear Shahzad,

The `GROUP_LABEL` argument in t1-volume is a user-defined string that will be used to name the subjects used for the DARTEL inter-subject registration. That means you can put anything you want depending on your application, it will just be a name in the output architecture (see this output here in our documentation). If you want to have two groups you would need to run the pipeline separately for each group, and you can select subjects in your input directory with the `-tsv` option.

Hope this helps,

Alice

--
You received this message because you are subscribed to the Google Groups "Clinica" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clinica-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/clinica-user/34975e69-95be-4aba-925d-4bce3b3b6676n%40googlegroups.com.

Shahzad ALi

unread,
Mar 24, 2025, 1:18:30 PMMar 24
to clinic...@googlegroups.com
Hi, Dear Alice, 
Thanks for your response. I run this.
clinica run t1-volume BIDS_Converted/BIDS_Multimodal CAPS_DIR/CAPS_Multimodal AD -tsv BIDS_Converted/BIDS_Multimodal/participants_AD.tsv
2025-03-24 18:07:51,474:INFO:The t1-volume pipeline is divided into 4 parts:
t1-volume-tissue-segmentation pipeline: Tissue segmentation, bias correction and spatial normalization to MNI space
t1-volume-create-dartel pipeline: Inter-subject registration with the creation of a new DARTEL template
t1-volume-dartel2mni pipeline: DARTEL template to MNI
t1-volume-parcellation pipeline: Atlas statistics
2025-03-24 18:07:51,474:INFO:Part 1/4: Running t1-volume-segmentation pipeline.
2025-03-24 18:07:51,626:INFO:Setting SPM path to /Users/shahzadali/Documents/MATLAB/spm12
2025-03-24 18:07:52,741:INFO:The CAPS dataset 'None', located at /Volumes/CrucialX6/SS_ADNI/Clinica/ADNI_multimodal/CAPS_DIR/CAPS_Multimodal, already contains a 'dataset_description.json' file.
2025-03-24 18:07:52,742:WARNING:The existing CAPS dataset, located at /Volumes/CrucialX6/SS_ADNI/Clinica/ADNI_multimodal/CAPS_DIR/CAPS_Multimodal has a name 'eb8eff5f-1ba9-41cb-8586-ead098267da6' different from the new name '39265f8d-918e-40e4-a099-ec509afb6ac4'. The old name will be kept.
/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/utils/stream.py:103: UserWarning: The existing CAPS dataset, located at /Volumes/CrucialX6/SS_ADNI/Clinica/ADNI_multimodal/CAPS_DIR/CAPS_Multimodal has a name 'eb8eff5f-1ba9-41cb-8586-ead098267da6' different from the new name '39265f8d-918e-40e4-a099-ec509afb6ac4'. The old name will be kept.
  warnings.warn(message, warning_type)
2025-03-24 18:07:52,760:ERROR:The TSV file does not contain session_id column (path:  /Clinica/ADNI_multimodal/BIDS_Converted/BIDS_Multimodal/participants_AD.tsv)

As there is no session_id in the participants.tsv file (generated by clinica BIDS converter). However, there is a .tsv file (sub-*_sessions.tsv) under each subject folder, which contains the sessionid. Do we need to get that from that file for each subject?

Best,

Shahzad

-----------------------------------------------------------------------



Alice Joubert

unread,
Mar 25, 2025, 5:06:58 AMMar 25
to clinic...@googlegroups.com
Hello,

When we mention the option `-tsv` for clinica pipelines, it refers to a file containing subjects id and session id of interest. It is described here in the documentation. The user can produce it himself or use our specific IOtool for this purpose. The `tsv` files produced by the converters are metadata files linked to BIDS specifications but are not related at all.

Hope this helps !

Alice

Shahzad ALi

unread,
Mar 25, 2025, 6:31:48 PMMar 25
to clinic...@googlegroups.com
Hi, Dear Alice, 

Thanks for your response. I have get this tsv using iotools command. 

However, when i run this command:

clinica run t1-volume BIDS_Dir/BIDS_Multimodal CAPS_DIR/CAPS_Multimodal AD -tsv BIDS_Dir/Summary/participants_AD.tsv

2025-03-25 23:20:00,607:INFO:The t1-volume pipeline is divided into 4 parts:

t1-volume-tissue-segmentation pipeline: Tissue segmentation, bias correction and spatial normalization to MNI space

t1-volume-create-dartel pipeline: Inter-subject registration with the creation of a new DARTEL template

t1-volume-dartel2mni pipeline: DARTEL template to MNI

t1-volume-parcellation pipeline: Atlas statistics

2025-03-25 23:20:00,607:INFO:Part 1/4: Running t1-volume-segmentation pipeline.

2025-03-25 23:20:00,690:INFO:Setting SPM path to /Users/shahzadali/spm12

2025-03-25 23:20:01,271:INFO:The CAPS dataset 'None', located at /Volumes/CrucialX6/SS_ADNI/Clinica/ADNI_multimodal/CAPS_DIR/CAPS_Multimodal, already contains a 'dataset_description.json' file.

2025-03-25 23:20:01,271:WARNING:The existing CAPS dataset, located at /Volumes/CrucialX6/SS_ADNI/Clinica/ADNI_multimodal/CAPS_DIR/CAPS_Multimodal has a name 'eb8eff5f-1ba9-41cb-8586-ead098267da6' different from the new name '48cdbe1c-af42-45f7-ba8a-b45112edfb4c'. The old name will be kept.

/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/utils/stream.py:103: UserWarning: The existing CAPS dataset, located at /Volumes/CrucialX6/SS_ADNI/Clinica/ADNI_multimodal/CAPS_DIR/CAPS_Multimodal has a name 'eb8eff5f-1ba9-41cb-8586-ead098267da6' different from the new name '48cdbe1c-af42-45f7-ba8a-b45112edfb4c'. The old name will be kept.

  warnings.warn(message, warning_type)

2025-03-25 23:20:03,399:INFO:Setting SPM path to /Users/shahzadali/spm12

Traceback (most recent call last):

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/nipype/utils/spm_docs.py", line 48, in _strip_header

    index = doc.index(hdr)

ValueError: substring not found


The above exception was the direct cause of the following exception:


Traceback (most recent call last):

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/bin/clinica", line 8, in <module>

    sys.exit(main())

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/cmdline.py", line 113, in main

    cli()

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 1161, in __call__

    return self.main(*args, **kwargs)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 1082, in main

    rv = self.invoke(ctx)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 1697, in invoke

    return _process_result(sub_ctx.command.invoke(sub_ctx))

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 1697, in invoke

    return _process_result(sub_ctx.command.invoke(sub_ctx))

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 1443, in invoke

    return ctx.invoke(self.callback, **ctx.params)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 788, in invoke

    return __callback(*args, **kwargs)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/decorators.py", line 33, in new_func

    return f(get_current_context(), *args, **kwargs)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/pipelines/t1_volume/t1_volume_cli.py", line 95, in cli

    ctx.invoke(

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/click/core.py", line 788, in invoke

    return __callback(*args, **kwargs)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/pipelines/t1_volume_tissue_segmentation/t1_volume_tissue_segmentation_cli.py", line 73, in cli

    pipeline.run(plugin="MultiProc", plugin_args={"n_procs": n_procs})

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/pipelines/engine.py", line 729, in run

    self.build()

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/pipelines/engine.py", line 45, in func_wrapper

    res = func(self, *args, **kwargs)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/pipelines/engine.py", line 690, in build

    self._check_dependencies()

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/pipelines/engine.py", line 798, in _check_dependencies

    dependency.check()

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/utils/check_dependency.py", line 115, in check

    check_software(self.name, log_level="error", specifier=self.version_constraint)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/utils/check_dependency.py", line 786, in check_software

    _check_software_version(software, log_level=log_level, specifier=specifier)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/utils/check_dependency.py", line 689, in _check_software_version

    if (installed_version := get_software_version(software)) not in specifier:

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/utils/check_dependency.py", line 518, in get_software_version

    return _get_spm_version()

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/clinica/utils/check_dependency.py", line 540, in _get_spm_version

    return Version(spm.SPMCommand().version)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/nipype/interfaces/spm/base.py", line 303, in __init__

    super().__init__(**inputs)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 199, in __init__

    unavailable_traits = self._check_version_requirements(

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 297, in _check_version_requirements

    if names and self.version:

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/nipype/interfaces/spm/base.py", line 351, in version

    info_dict = Info.getinfo(

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/nipype/interfaces/spm/base.py", line 235, in getinfo

    out = sd._strip_header(out.runtime.stdout)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv/lib/python3.10/site-packages/nipype/utils/spm_docs.py", line 50, in _strip_header

    raise OSError("This docstring was not generated by Nipype!\n") from e

OSError: This docstring was not generated by Nipype!





I have spm12 installed in matlab, Here are some checks:

clinica --version

clinica, version 0.9.1

>> spm('version')
ans =
    'SPM12 (dev)'

>> which spm
/Users/shahzadali/spm12/spm.m

echo $SPM_HOME

/Users/shahzadali/spm12

shahzadali@Shahzads-MacBook-Pro ~ % 


pip show nipype

Name: nipype

Version: 1.9.2

Summary: Neuroimaging in Python: Pipelines and Interfaces

Home-page: http://nipy.org/nipype

Author: nipype developers

Author-email: neuroi...@python.org

License: Apache License, 2.0

Location: /Users/shahzadali/fsl/lib/python3.11/site-packages

Requires: acres, click, etelemetry, filelock, looseversion, networkx, nibabel, numpy, packaging, prov, puremagic, pydot, python-dateutil, rdflib, scipy, simplejson, traits

Required-by: 


Best,

Shahzad 

-----------------------------------------------------------------------



Alice Joubert

unread,
Mar 27, 2025, 5:52:30 AMMar 27
to clinic...@googlegroups.com
Hello Shahzad,

Regarding your set-up, we are using nipype 1.8.6 in our current version but in clinica v0.9.1 as well. Normally by installing the clinica package in a specific environment you should have the right dependency. I am not sure this would solve anything but out of curiosity would you make a new environment with clinica in it ? You can also upgrade to clinica v0.9.3 though it would not change anything for t1-volume.

Tell me if that changes anything,

Alice

 

Shahzad ALi

unread,
Apr 5, 2025, 10:45:23 AMApr 5
to clinic...@googlegroups.com
I tried with Clinica 0.9.1 / 0.9.2 / 0.9.4 but the same error:

(clinicaEnv_094) shahzadali@Shahzads-MacBook-Pro ADNI % clinica run t1-volume BIDS_Dir/BIDS_Multimodal CAPS_DIR/CAPS_Multimodal AD -tsv BIDS_Dir/Summary/participants_AD.tsv

2025-04-04 20:00:52,413:INFO:The t1-volume pipeline is divided into 4 parts:

t1-volume-tissue-segmentation pipeline: Tissue segmentation, bias correction and spatial normalization to MNI space

t1-volume-create-dartel pipeline: Inter-subject registration with the creation of a new DARTEL template

t1-volume-dartel2mni pipeline: DARTEL template to MNI

t1-volume-parcellation pipeline: Atlas statistics

2025-04-04 20:00:52,413:INFO:Part 1/4: Running t1-volume-segmentation pipeline.

2025-04-04 20:00:52,510:INFO:Setting SPM path to /Users/shahzadali/spm12

2025-04-04 20:00:54,227:INFO:The CAPS dataset 'None', located at /Volumes/CrucialX6/NeuroimagingData/ADNI/CAPS_DIR/CAPS_Multimodal, already contains a 'dataset_description.json' file.

2025-04-04 20:00:54,229:WARNING:The existing CAPS dataset, located at /Volumes/CrucialX6/NeuroimagingData/ADNI/CAPS_DIR/CAPS_Multimodal has a name 'eb8eff5f-1ba9-41cb-8586-ead098267da6' different from the new name '3825af6d-231d-43f5-b68a-cc1e1aef079c'. The old name will be kept.

/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/clinica/utils/stream.py:103: UserWarning: The existing CAPS dataset, located at /Volumes/CrucialX6/NeuroimagingData/ADNI/CAPS_DIR/CAPS_Multimodal has a name 'eb8eff5f-1ba9-41cb-8586-ead098267da6' different from the new name '3825af6d-231d-43f5-b68a-cc1e1aef079c'. The old name will be kept.

  warnings.warn(message, warning_type)

2025-04-04 20:00:57,327:INFO:Setting SPM path to /Users/shahzadali/spm12

Traceback (most recent call last):

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/nipype/utils/spm_docs.py", line 48, in _strip_header

    index = doc.index(hdr)

ValueError: substring not found


The above exception was the direct cause of the following exception:


Traceback (most recent call last):

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/bin/clinica", line 8, in <module>

    sys.exit(main())

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/clinica/cmdline.py", line 113, in main

    cli()

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/click/core.py", line 1161, in __call__

    return self.main(*args, **kwargs)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/click/core.py", line 1082, in main

    rv = self.invoke(ctx)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/click/core.py", line 1697, in invoke

    return _process_result(sub_ctx.command.invoke(sub_ctx))

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/click/core.py", line 1697, in invoke

    return _process_result(sub_ctx.command.invoke(sub_ctx))

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/click/core.py", line 1443, in invoke

    return ctx.invoke(self.callback, **ctx.params)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/click/core.py", line 788, in invoke

    return __callback(*args, **kwargs)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/click/decorators.py", line 33, in new_func

    return f(get_current_context(), *args, **kwargs)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/clinica/pipelines/t1_volume/t1_volume_cli.py", line 95, in cli

    ctx.invoke(

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/click/core.py", line 788, in invoke

    return __callback(*args, **kwargs)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/clinica/pipelines/t1_volume_tissue_segmentation/t1_volume_tissue_segmentation_cli.py", line 73, in cli

    pipeline.run(plugin="MultiProc", plugin_args={"n_procs": n_procs})

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/clinica/pipelines/engine.py", line 729, in run

    self.build()

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/clinica/pipelines/engine.py", line 45, in func_wrapper

    res = func(self, *args, **kwargs)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/clinica/pipelines/engine.py", line 690, in build

    self._check_dependencies()

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/clinica/pipelines/engine.py", line 798, in _check_dependencies

    dependency.check()

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/clinica/utils/check_dependency.py", line 115, in check

    check_software(self.name, log_level="error", specifier=self.version_constraint)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/clinica/utils/check_dependency.py", line 786, in check_software

    _check_software_version(software, log_level=log_level, specifier=specifier)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/clinica/utils/check_dependency.py", line 689, in _check_software_version

    if (installed_version := get_software_version(software)) not in specifier:

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/clinica/utils/check_dependency.py", line 518, in get_software_version

    return _get_spm_version()

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/clinica/utils/check_dependency.py", line 540, in _get_spm_version

    return Version(spm.SPMCommand().version)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/nipype/interfaces/spm/base.py", line 303, in __init__

    super().__init__(**inputs)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 199, in __init__

    unavailable_traits = self._check_version_requirements(

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 297, in _check_version_requirements

    if names and self.version:

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/nipype/interfaces/spm/base.py", line 351, in version

    info_dict = Info.getinfo(

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/nipype/interfaces/spm/base.py", line 235, in getinfo

    out = sd._strip_header(out.runtime.stdout)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/nipype/utils/spm_docs.py", line 50, in _strip_header

    raise OSError("This docstring was not generated by Nipype!\n") from e

OSError: This docstring was not generated by Nipype!



Best,

Shahzad

-----------------------------------------------------------------------



Alice Joubert

unread,
Apr 7, 2025, 6:01:50 AMApr 7
to clinic...@googlegroups.com
Hello Shahzad,

Can you tell me what are you environment variables we ask for in the case of matlab with spm set-up (see documentation here) ?

Best,

Alice

Shahzad ALi

unread,
Apr 7, 2025, 6:16:26 AMApr 7
to clinic...@googlegroups.com
Hi Alice,
Here are the environment variables for SPM and Matlab:


% nano ./.zshrc

  UW PICO 5.09                         File: ./.zshrc                           



export PATH="/Applications/MATLAB_R2024a.app/bin:$PATH"


export PATH="/opt/ants/bin:$PATH"

export ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS=7



export PATH="/opt/homebrew/bin:$PATH"


export PATH="/opt/homebrew/opt/qt@5/bin:$PATH"

export LDFLAGS="-L/opt/homebrew/opt/libomp/lib"

export CPPFLAGS="-I/opt/homebrew/opt/libomp/include"


export SPM_HOME=/Users/shahzadali/spm12



# >>> conda initialize >>>

# !! Contents within this block are managed by 'conda init' !!

__conda_setup="$('/Users/shahzadali/miniconda3/bin/conda' 'shell.zsh' 'hook' 2>$

if [ $? -eq 0 ]; then

    eval "$__conda_setup"

else

    if [ -f "/Users/shahzadali/miniconda3/etc/profile.d/conda.sh" ]; then

        . "/Users/shahzadali/miniconda3/etc/profile.d/conda.sh"

    else

        export PATH="/Users/shahzadali/miniconda3/bin:$PATH"

    fi

fi

unset __conda_setup

# <<< conda initialize <<<

    

export FREESURFER_HOME=/Applications/freesurfer/7.4.1

source $FREESURFER_HOME/SetUpFreeSurfer.sh

        

export FS_LICENSE=/Applications/freesurfer/7.4.1/.license


export PATH="/Users/shahzadali/fsl/bin:$PATH"




^G Get Help  ^O WriteOut  ^R Read File ^Y Prev Pg   ^K Cut Text  ^C Cur Pos   

^X Exit      ^J Justify   ^W Where is  ^V Next Pg   ^U UnCut Text^T To Spell  


Best,

Shahzad 

-----------------------------------------------------------------------



Alice Joubert

unread,
Apr 8, 2025, 10:02:44 AMApr 8
to clinic...@googlegroups.com
Hello Shahzad, 

Did you also do the step where you add SPM to your matlab path ? (Here in our documentation)

Best,

Alice

Shahzad ALi

unread,
Apr 8, 2025, 10:08:13 AMApr 8
to clinic...@googlegroups.com
Hi, Dear Alice, 
Yes I did. Please check the attached screenshot. It indicates, SPM is working properly in matlab.

Best,

Shahzad 

----------------------------------------------------------



Screenshot 2025-04-08 at 16.05.19.png
Screenshot 2025-04-08 at 16.06.47.png

Alice Joubert

unread,
Apr 14, 2025, 3:20:20 AMApr 14
to clinic...@googlegroups.com
Hello Shahzad, 

I could not reproduce. Could you add a line inside the original nypipe script temporarily ? The script is  : nipype/interfaces/spm/base.py and you can add the following :

mlab = MatlabCommand(matlab_cmd=matlab_cmd, resource_monitor=
False) mlab.inputs.mfile = False if paths: mlab.inputs.paths = paths if use_mcr: mlab.inputs.nodesktop = Undefined mlab.inputs.nosplash = Undefined mlab.inputs.single_comp_thread = Undefined mlab.inputs.mfile = True mlab.inputs.uses_mcr = True mlab.inputs.script = """ if isempty(which('spm')), throw(MException('SPMCheck:NotFound','SPM not in matlab path')); end; spm_path = spm('dir'); [name, version] = spm('ver'); fprintf(1, 'NIPYPE path:%s|name:%s|release:%s', spm_path, name, version); exit; """ try: out = mlab.run() except (IOError, RuntimeError) as e: ...... return None print(out.runtime.stdout) # added line here out = sd._strip_header(out.runtime.stdout)

Then run the pipeline again, and tell me what you get.

Best,

Alice

Shahzad ALi

unread,
Apr 14, 2025, 3:49:37 AMApr 14
to clinic...@googlegroups.com
Dear Alice,
Thanks, I just added the print suggested line, and here is the output I get:

(clinicaEnv_094) shahzadali@Mac ADNI % clinica run t1-volume BIDS_Dir/BIDS_Multimodal CAPS_DIR/CAPS_Multimodal AD -tsv BIDS_Dir/Summary/participants_AD.tsv

2025-04-14 09:47:02,069:INFO:The t1-volume pipeline is divided into 4 parts:

t1-volume-tissue-segmentation pipeline: Tissue segmentation, bias correction and spatial normalization to MNI space

t1-volume-create-dartel pipeline: Inter-subject registration with the creation of a new DARTEL template

t1-volume-dartel2mni pipeline: DARTEL template to MNI

t1-volume-parcellation pipeline: Atlas statistics

2025-04-14 09:47:02,070:INFO:Part 1/4: Running t1-volume-segmentation pipeline.

2025-04-14 09:47:02,370:INFO:Setting SPM path to /Users/shahzadali/spm12


    matlab: No MATLAB bin directory for this machine architecture.


           ARCH = maci64


2025-04-14 09:47:05,305:INFO:The CAPS dataset 'None', located at /Volumes/CrucialX6/NeuroimagingData/ADNI/CAPS_DIR/CAPS_Multimodal, already contains a 'dataset_description.json' file.

2025-04-14 09:47:05,311:WARNING:The existing CAPS dataset, located at /Volumes/CrucialX6/NeuroimagingData/ADNI/CAPS_DIR/CAPS_Multimodal has a name 'eb8eff5f-1ba9-41cb-8586-ead098267da6' different from the new name 'eb0da499-5f25-47e7-95c2-8b77dec6d453'. The old name will be kept.

/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/clinica/utils/stream.py:103: UserWarning: The existing CAPS dataset, located at /Volumes/CrucialX6/NeuroimagingData/ADNI/CAPS_DIR/CAPS_Multimodal has a name 'eb8eff5f-1ba9-41cb-8586-ead098267da6' different from the new name 'eb0da499-5f25-47e7-95c2-8b77dec6d453'. The old name will be kept.

  warnings.warn(message, warning_type)

2025-04-14 09:47:13,096:INFO:Setting SPM path to /Users/shahzadali/spm12


    matlab: No MATLAB bin directory for this machine architecture.


           ARCH = maci64

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/nipype/interfaces/spm/base.py", line 304, in __init__

    super().__init__(**inputs)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 199, in __init__

    unavailable_traits = self._check_version_requirements(

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 297, in _check_version_requirements

    if names and self.version:

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/nipype/interfaces/spm/base.py", line 352, in version

    info_dict = Info.getinfo(

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/nipype/interfaces/spm/base.py", line 236, in getinfo

    out = sd._strip_header(out.runtime.stdout)

  File "/Users/shahzadali/miniconda3/envs/clinicaEnv_094/lib/python3.10/site-packages/nipype/utils/spm_docs.py", line 50, in _strip_header

    raise OSError("This docstring was not generated by Nipype!\n") from e

OSError: This docstring was not generated by Nipype!


Best,

Shahzad 

-----------------------------------------------------------------------



Alice Joubert

unread,
Apr 14, 2025, 4:34:58 AMApr 14
to clinic...@googlegroups.com
I find it weird that you can make matlab work with the graphical user interface but not with nypipe because of this specific problem... Just in case, can you follow this thread to make you have the right binaries for matlab ?

Shahzad ALi

unread,
May 4, 2025, 11:04:51 AMMay 4
to clinic...@googlegroups.com
Hi, Dear Alice, 
Following up on our previous conversation regarding the t1-volume pipeline issue, I’ve been continuously trying to resolve it. After trying different ways, somehow I managed to get it partially working using the following command:

  • clinica run t1-volume BIDS_Dir CAPS_DIR AD -tsv participants_1.tsv -wd /tmp/spm/

However, I’m encountering two main problems:

  1. When the pipeline starts, it opens a MATLAB window. If I leave it open, the process gets stuck at the CAPS rename warning step. If I manually close the MATLAB window, the first phase completes successfully (I’ve attached a screenshot of the test subject directory).

  2. The pipeline then proceeds to the second step:

    Part 2/4: Running t1-volume-create-dartel pipeline

           At this point, it opens the MATLAB window again. If I close it, the process fails and returns the following error:

2025-05-04 16:29:38,510:INFO:Setting SPM path to /Users/shahzadali/Documents/MATLAB/spm25

2025-05-04 16:29:38,511:INFO:Found installation of spm with version 25.25.1.2, satisfying >=12.

2025-05-04 16:29:38,513:ERROR:This pipeline needs at least 2 images to create DARTEL template but Clinica only found 1.


I have attached the full log for your reference.

Could you please guide me on how to proceed with this?

Thank you for your support.

Best,

Shahzad 

---------------------------------



Screenshot 2025-05-04 at 16.37.49.png
t1-volume.rtf

Shahzad ALi

unread,
May 4, 2025, 11:40:35 AMMay 4
to clinic...@googlegroups.com
Dear Alice,
Regarding my previous query, I understood the problem I mentioned in my previous email regarding at least 2 subjects.

Thanks & Best,

Shahzad

-----------------------------------------------------------------------


Alice Joubert

unread,
May 5, 2025, 11:43:05 AMMay 5
to clinic...@googlegroups.com
Hello Shazhad, 

For the second issue I think it depends on your input data, you need to have at least two images for the pipeline to create a template.  For the first point I need to investigate but normally the script from nypipe which we use to run SPM is supposed to close MATLAB windows on its own. I will investigate when possible.

Best,

Alice

Reply all
Reply to author
Forward
0 new messages