PennLINC / qsiprep

Preprocessing of diffusion MRI
http://qsiprep.readthedocs.io
BSD 3-Clause "New" or "Revised" License
140 stars 58 forks source link

Preprocessing multi-session anat data #815

Closed jhauneuro closed 1 week ago

jhauneuro commented 2 months ago

Summary

When I preprocess longitudinal (2 sessions) dwi with anat data, my final preprocessed T1w image looks strange - it appears as if there are two superimposed T1w images. I ran the preprocessing with the --longitudinal flag but get worse results. I also ran each session separately using a bids filter but the preprocessed T1w results get overwritten (they get saved in an anat folder outside the session folders). I checked the raw T1w data from both sessions for this subject and they look fine. Any ideas why I am getting these T1w results or suggestions for a workaround?

Additional details

What were you trying to do?

Preprocess longitudinal dwi and anat data.

What did you expect to happen?

Get preprocessed outputs for longitudinal dwi and anat data.

What actually happened?

The preprocessed anat data either looks like 2 superpimposed T1w images or gets overwritten if I try to preprocess each session separately.

Reproducing the bug

Here is the command I ran:

docker run -ti --rm --gpus '"device=1"' \
    -v /usr/local/freesurfer/7.4.1/license.txt:/opt/freesurfer/license.txt:ro \
    -v $bids_dir:/data:ro \
    -v $eddy_config_file:/sngl/eddy/eddy_config.json:ro \
    -v $out_dir:/out \
    -v $out_dir:/scratch \
    qsiprep:latest /data /out participant \
    --eddy-config /sngl/eddy/eddy_config.json \
    --output-resolution $res --pepolar-method TOPUP \
    --bids-database-dir $bids_dir --omp-nthreads 1 --mem 500 \
    -w /scratch --participant-label $subj

Screenshot of the preprocessed T1w:

sub-x_desc-preproc_T1w Screenshot 2024-08-28 at 2 03 11 PM

and result with the --longitudinal flag:

sub-x_desc-preproc_T1w long flag Screenshot 2024-08-28 at 2 06 42 PM
cookpa commented 2 months ago

Has the size of the participant's head / brain changed a lot in the interval between the scans? I think the intra-session alignment of T1w is rigid, if you have big volume changes (eg, an adolescent) it will not be able to map very well

jhauneuro commented 2 months ago

@cookpa yes, there is ~10% difference in brain volume just based off estimates of the brain masks. These are scans acquired in toddlers about two years apart so we expect to see significant changes between their time points/sessions. From the documentation it looks like qsiprep uses mri_robust_template as a default when a subject has more than one T1w image. In the case of considerable changes in brain size, is there any way to disable mri_robust_template and preprocess the anat data of each session separately?

cookpa commented 1 month ago

The only way I know of is to use BIDS filters that select each session. You must save the output for each session to separate BIDS datasets. If you process each session in turn using the same output dataset, the participant-level anat/ folder gets overwritten.

jhauneuro commented 1 month ago

Yes, I think that's what I'll do for now. Thanks.