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

traits.trait_errors.TraitError: The 'template' trait of a SubjectSummaryInputSpec instance must be 'MNI152NLin2009cAsym', but a value of 'MNIInfant' <class 'str'> was specified. #823

Open
chiuhoward opened this issue Oct 9, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@chiuhoward
Copy link

Summary

Tried to run qsiprep with the infant flag but the workflow was still expecting an adult template.

Additional details

  • QSIPrep version: 0.23.1.dev0+g634483f.d20240830
  • Docker version:
  • Singularity version: apptainer version 1.3.2-1.el7

What were you trying to do?

I am trying to preprocess the same data with the new version of qsiprep; I'd previously preprocessed the same dataset with qsiprep 0.21.4.

What did you expect to happen?

I expect the pipeline to run like it did previously (version 0.21.4).

What actually happened?

Process Process-2:
Traceback (most recent call last):
  File "/opt/conda/envs/qsiprep/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/opt/conda/envs/qsiprep/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/cli/workflow.py", line 122, in build_workflow
    retval["workflow"] = init_qsiprep_wf()
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/workflows/base.py", line 82, in init_qsiprep_wf
    single_subject_wf = init_single_subject_wf(subject_id)
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/workflows/base.py", line 205, in init_single_subject_wf
    SubjectSummary(template=config.workflow.anatomical_template),
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 563, in __init__
    super(SimpleInterface, self).__init__(
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 202, in __init__
    self.inputs.trait_set(**inputs)
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/traits/has_traits.py", line 1520, in trait_set
    setattr(self, name, value)
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/traits/base_trait_handler.py", line 74, in error
    raise TraitError(
traits.trait_errors.TraitError: The 'template' trait of a SubjectSummaryInputSpec instance must be 'MNI152NLin2009cAsym', but a value of 'MNIInfant' <class 'str'> was specified.

I looked in the documentation and the only option for --anatomical-template was MNI152NLin2009cAsym. I also noticed that in this version of the code, the templates were no longer bundled in the qsiprep/data folder, so maybe I'd need a new way to pass templates into qsiprep?

Reproducing the bug

I'd tried running the same script just by changing the singularity container to point back to 0.21.4 and it still initiates the pipeline.

export APPTAINERENV_FS_LICENSE=$GROUP_HOME/freesurferlicense.txt
export APPTAINER_TMPDIR='/scratch/users/chiuh/tmp'
export APPTAINER_CACHEDIR='/scratch/users/chiuh/cache'

# --containall --writable-tmpfs 

singularity run --cleanenv \
--bind /home/groups/jyeatman/software/howard/ENA50/ENA50_T1w_LPS.nii.gz:/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/data/mni_1mm_t1w_lps_brain_infant.nii.gz \
--bind /home/groups/jyeatman/software/howard/ENA50/ENA50_T2w_LPS.nii.gz:/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/data/mni_1mm_t2w_lps_brain_infant.nii.gz \
--bind /home/groups/jyeatman/software/howard/ENA50/ENA50_T1w_skull_LPS.nii.gz:/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/data/mni_1mm_t1w_lps_infant.nii.gz \
--bind /home/groups/jyeatman/software/howard/ENA50/ENA50_T2w_skull_LPS.nii.gz:/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/data/mni_1mm_t2w_lps_infant.nii.gz \
--bind /home/groups/jyeatman/software/howard/ENA50/ENA50_mask_LPS.nii.gz:/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/data/mni_1mm_t1w_lps_brainmask_infant.nii.gz \
/home/groups/jyeatman/software/singularity_images/qsiprep-0.23.0.sif \
/scratch/groups/jyeatman/howard/DBPFullwT1Oct24/DBPFullwT1 \
/scratch/groups/jyeatman/howard/DBPFullwT1derivOct24/ participant --participant-label sub-$SLURM_ARRAY_TASK_ID \
--infant \
--nthreads 10 \
--omp-nthreads 8 \
--output-resolution 1.7 \
--unringing-method rpg \
--denoise-method dwidenoise \
--b1-biascorrect-stage none \
--pepolar-method TOPUP+DRBUDDI
@chiuhoward chiuhoward added the bug Something isn't working label Oct 9, 2024
@chiuhoward
Copy link
Author

Updates:
I tried two other things and they both didn't work:

  1. Reran the same script by commenting out all the --bind lines and got the same error.
  2. Reran the same script without bind lines, and also passing a --anatomical-template MNIInfant argument. This returned qsiprep: error: argument --anatomical-template: invalid choice: 'MNIInfant' (choose from 'MNI152NLin2009cAsym'

@mattcieslak
Copy link
Collaborator

@tsalo This must have been a side effect of the templateflow PR. Also a good point that we don't have any infant tests.

@chiuhoward I'm not sure your binding strategy will work anymore because we're using templateflow instead of the built-in templates.

Were there issues with 0.21.4 when you used it? I think all the changes since 0.21.4 have been related to infrastructure and no new software/methods have changed

@chiuhoward
Copy link
Author

@mattcieslak The binding strategy worked with 0.21.4 - I never figured out the way to pass alternative templates into qsiprep “properly” so that was the bodge that worked for me.

@mattcieslak
Copy link
Collaborator

How about the quality of the results? I don't think the actual processing will be that different, but you'll have a much more difficult time getting the alternative templates into later versions

@chiuhoward
Copy link
Author

@mattcieslak Yeah I think the quality wasn't great (with or without a reverse phase-encoding direction), hence I wanted to rerun with v23 since you mentioned that there have been many enhancements since then.

I am not committed to using specific alternative templates - using different templates was also just part of trying to optimize the dataset I had as the MNI Infant template seemed slightly larger than the neonatal ones, and I also tried varying other parameters like tractography method, cleaning, step size, angles, etc. There were too many possibilities, that's why I also wrote to ask what was "recommended" with 23.0.

Thank you both so much for looking into this @tsalo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants