Open
celprov
opened this issue 7 months ago
•
5 comments
Draft of the PETQC workflow implementation.
I have modified MRIQC to add PET as an accepted modality type.
The workflow estimates motion correction parameter using 3dVolReg.
I added a node that determines the reference volume as the volume with the highest intensity sum and pass it on to the basefile argument of the VolReg interface.
Then, we generate a visual report that plots the framewise displacement, rotation and translation timeseries.
It also computes the mean FD, num_fd and perc_fd IQMs.
I did not manage to make it work until the end on the example pet data included in this repo
Many thanks, @celprov ! I think we need an update in niworkflows on this, particularly adding some pet information to the nipreps.json file. Will open a separate issue and PR to address this. Unless, @mgxd is faster than me ;-)
something like this ' "sub-{subject}/{datatype}/sub-{subject}[_ses-{session}][_acq-{acquisition}][_rec-{reconstruction}][_run-{run}][desc-{desc}]{suffix}{extension<.png|.svg|.html>|.png}"
Still testing this, and narrowing some issues down to pybids and niworkflows. This is after updating the nipreps.json file in niworkflows, so default_path_patterns include pet.
2025-05-05 10:21:12 | IMPORTANT | mriqc | Extracting metadata and entities for 1 input runs of modality 'pet'...
2025-05-05 10:21:12 | IMPORTANT | mriqc | File size ('pet'): 0.05|0.05 GB [maximum|average].
2025-05-05 10:21:16 | IMPORTANT | mriqc | Building MRIQC's workflows...
2025-05-05 10:21:19 | IMPORTANT | mriqc | Workflow building finished (exit code 0).
DEBUG: entities before Report: {'session': 'baseline', 'subject': '01', 'suffix': 'pet'}
DEBUG: report_type: pet
Traceback (most recent call last):
File "/Users/martinnorgaard/anaconda3/envs/mriqc/bin/mriqc", line 8, in
sys.exit(main())
File "/Users/martinnorgaard/Dropbox/Mac/Documents/GitHub/mriqc/mriqc/cli/run.py", line 197, in main
generate_reports()
File "/Users/martinnorgaard/Dropbox/Mac/Documents/GitHub/mriqc/mriqc/reports/individual.py", line 39, in generate_reports
output_files = [_single_report(ff) for mod in config.workflow.inputs.values() for ff in mod]
File "/Users/martinnorgaard/Dropbox/Mac/Documents/GitHub/mriqc/mriqc/reports/individual.py", line 39, in
output_files = [_single_report(ff) for mod in config.workflow.inputs.values() for ff in mod]
File "/Users/martinnorgaard/Dropbox/Mac/Documents/GitHub/mriqc/mriqc/reports/individual.py", line 90, in _single_report
robj = Report(
File "/Users/martinnorgaard/anaconda3/envs/mriqc/lib/python3.10/site-packages/nireports/assembler/report.py", line 268, in init
out_filename = build_path(bids_filters, OUTPUT_NAME_PATTERN)
File "/Users/martinnorgaard/anaconda3/envs/mriqc/lib/python3.10/site-packages/bids/layout/writing.py", line 188, in build_path
fields = {pat[1] for pat in Formatter().parse(new_path)
File "/Users/martinnorgaard/anaconda3/envs/mriqc/lib/python3.10/site-packages/bids/layout/writing.py", line 188, in
fields = {pat[1] for pat in Formatter().parse(new_path)
ValueError: Single '}' encountered in format string
@effigies @mgxd do you mind taking a quick look to move this forward? Many thanks
Adding "sub-{subject}/{datatype}/sub-{subject}[_ses-{session}][_acq-{acquisition}][_ce-{ceagent}][_rec-{reconstruction}][_run-{run}][_space-{space}][_cohort-{cohort}][desc-{desc}]{suffix}{extension<.png|.svg|.html>|.png}" to the niworkflows nipreps.json file seemed to work out.
Now getting File "/Users/martinnorgaard/Dropbox/Mac/Documents/GitHub/mriqc/mriqc/reports/individual.py", line 90, in _single_report
robj = Report(
File "/Users/martinnorgaard/anaconda3/envs/mriqc/lib/python3.10/site-packages/nireports/assembler/report.py", line 268, in init
out_filename = build_path(bids_filters, OUTPUT_NAME_PATTERN)
This can be fixed by adding "sub-{subject}[_ses-{session}][_acq-{acquisition}][_rec-{reconstruction}]"
"[_run-{run}][_space-{space}][_cohort-{cohort}][_desc-{desc}]_{suffix<pet>}{extension<.html|.svg|.png>|.html}"
to the OUTPUT_NAME_PATTERN in the nireports/assembler/report.py.
This product includes software developed by
the NiPreps Community (https://nipreps.org/).
Portions of this software were developed at the Department of
Psychology at Stanford University, Stanford, CA, US.
This software contains code ultimately derived from the
PCP Quality Assessment Protocol (QAP;
http://preprocessed-connectomes-project.org/quality-assessment-protocol)
by C. Craddock, S. Giavasis, D. Clark, Z. Shezhad, and J. Pellman.
This software is also distributed as a Docker container image.
The bootstrapping file for the image ("Dockerfile") is licensed
under the MIT License.