How to Generate tSNR Maps?

Hi there,

Sorry in advance, I’m a bit of a newbie. I’m trying to have a look at my tSNR maps for my data and I’m wondering how I go about doing this? I preprocessed it using fMRIPrep and have also put it through MRIQC. Is there a way to get tSNR maps through either of these tools or would I need something else?

The MRIQC output file comes with ‘Standard Deviation of Signal Over Time’ maps…are these the same as tSNR?

Any information you might have on this would be great. Thanks!

Hi @ejdavid ,

You already get an estimate of your TSNR through MRIQC, but that is just the average value over the whole brain. MRIQC does calculate a TSNR map though, that is stored in its working directory. You can save the working directory by passing the -w /PATH/TO/THE/WORKING/DIRECTORY in your MRIQC call.

The TSNR map will then be in:
/PATH/TO/THE/WORKING/DIRECTORY/workflow_enumerator/funcMRIQC/_in_file_..work..PRJECT..sub-SUB..func..sub-SUB_task-TASK_run-RUN_bold.nii.gz/compute_tsnr/tsnr.nii.gz

No, this is only one part of the TSNR calculation. The TSNR is the Mean signal over time divided by the Standard deviation of Signal Over time.

The calculation can be easily done with FSL for instance (and in every other neurimaging package at well):

# bold.nii.gz is here a 4D functional image
fslmaths bold.nii.gz -Tmean bold_mean.nii.gz
fslmaths bold.nii.gz -Tstd bold_std.nii.gz
fslmaths bold_mean.nii.gz -div bold_std.nii.gz TSNR_map.nii.gz
1 Like

Thanks for the quick reply on this!

I’ve tried rerunning MRIQC by passing in the working directory path, but the working directory remains empty after MRIQC finishes. The call I used is:

docker run -it --rm -v /lbc/lbc1/derivatives/brainstem_funk/BIDS_test/:/data:ro -v /lbc/lbc1/derivatives/brainstem_funk/mriqc/:/out nipreps/mriqc:latest /data /out participant --participant_label 0001 -w /lbc/lbc1/derivatives/brainstem_funk/mriqc/work

MRIQC seems to have generated the appropriate files otherwise, but I am getting two error messages so perhaps this is related to the empty working directory?

230608-22:04:44,658 nipype.interface WARNING:
         Estimated signal variation in the background was too small (MAD=0.0, sigma=7.794517379218305)
230608-22:20:20,189 nipype.interface WARNING:
         QC metrics failed to upload. Status 422: {"_status": "ERR", "_issues": {"bids_meta": {"PartialFourier": "must be of boolean type", "TaskName": "required field"}}, "_error": {"code": 422, "message": "Insertion failure: 1 document(s) contain(s) error(s)"}}

Have I done something wrong here? Any idea why the working directory isn’t saving? Thanks again!!

For the working directory, you have to define its path with respect to how you defined your binding directories with the mriqc container. For instance, you could tell its path to be -w /out/temp and you will be then able to see it in your computer at: /lbc/lbc1/derivatives/brainstem_funk/mriqc/temp.

Fantastic! It worked! Thank you so much!!