translationalneuromodeling / tapas

TAPAS - Translational Algorithms for Psychiatry-Advancing Science
https://translationalneuromodeling.github.io/tapas/
GNU General Public License v3.0
219 stars 90 forks source link

PhysIO with multiband and multiecho fMRI #258

Open ejrise opened 9 months ago

ejrise commented 9 months ago

Hi Tapas Team,

I am using PhysIO (Tapas version 6.0.1) to get respiration and pulse regressors for 7T multiecho MRI data. The acquisiton has 84 slices, TR=2.1, 300 volumes, and a multiband factor of 4, so I have been attempting to implement the proposed MB workaround by setting nSlices = 84/4 = 21. The log files are Siemens VD. However, when I do this, I get the following error:

09-Feb-2024 17:06:50 - Failed 'TAPAS PhysIO Toolbox' Error using tapas_physio_log Number of slice event bundles does not match Nscans. Check parameters sqpar.Nscans, Ndummies and Nprep. (Matlab error: Array indices must be positive integers or logical values.) In file "/Volumes/GoogleDrive/My Drive/MATLAB/spm12/toolbox/PhysIO/code/utils/tapas_physio_log.m" (???), function "tapas_physio_log" at line 56. In file "/Volumes/GoogleDrive/My Drive/MATLAB/spm12/toolbox/PhysIO/code/sync/tapas_physio_get_onsets_from_locs.m" (???), function "tapas_physio_get_onsets_from_locs" at line 113. In file "/Volumes/GoogleDrive/My Drive/MATLAB/spm12/toolbox/PhysIO/code/sync/tapas_physio_create_scan_timing.m" (???), function "tapas_physio_create_scan_timing" at line 122. In file "/Volumes/GoogleDrive/My Drive/MATLAB/spm12/toolbox/PhysIO/tapas_physio_main_create_regressors.m" (???), function "tapas_physio_main_create_regressors" at line 165. In file "/Volumes/GoogleDrive/My Drive/MATLAB/spm12/toolbox/PhysIO/tapas_physio_cfg_matlabbatch.m" (???), function "run_physio" at line 1661.

I've tried different inputs for onset_slice that I've seen in other issue posts, such as [0:20], [1:21], or 10 (the "middle" slice). No matter what I input for this, I still get this error.

I also wanted to check that Tapas is compatible with multiecho data. It looks like tapas_physio_create_scan_timing_from_tics_siemens.m only includes the data from the first echo (ECHO = 0), but I wanted to confirm this.

Here is my batch file and an example subject of log files: batch_example.txt subject_Info.log subject_PULS.log subject_RESP.log

Thanks for any help you can provide!

mrikasper commented 9 months ago

Dear Liz,

Thank you for trying out PhysIO. Could you try to see what happens if you set the number of slices back to 84 (i.e., disregard the MB factor)? This might be a bug that we recently discovered internally.

All the best, Lars

ejrise commented 9 months ago

Hi Lars,

Thanks for your quick response! When I set the slices to 84, the code works and I get the following:

physio_out.zip

Even though it works, I'm not sure if the outputted regressors are correct due to the multiband acquisition.

Two more questions:

  1. Do the cardiac pulse triggers (seen in the "bands" in figs 1,2, and 4) affect the regressor output at all? In Fig. 4, I see markers for cardiac R-peak (heartbeat) events only during the triggers, but those triggers aren't present throughout the whole cardiac time series. I'm not sure exactly why the trigger is set up this way as I didn't set up this part of the sequence.

  2. This participant has many respiration waves whose peaks are cut off due to a too-tight respiration belt (you can see in the histogram in Fig. 12). However, the program doesn't seem to be censoring those sections of the data (Fig. 14). Is there a setting I can adjust to censor the sections where the peaks are cut off?

Thanks again for your help!

mrikasper commented 8 months ago

Dear Liz,

My apologies for the delayed reply, please see my thoughts inline below:

Thanks for your quick response! When I set the slices to 84, the code works and I get the following:

physio_out.zip

Even though it works, I'm not sure if the outputted regressors are correct due to the multiband acquisition.

Two more questions:

  1. Do the cardiac pulse triggers (seen in the "bands" in figs 1,2, and 4) affect the regressor output at all? In Fig. 4, I see markers for cardiac R-peak (heartbeat) events only during the triggers, but those triggers aren't present throughout the whole cardiac time series. I'm not sure exactly why the trigger is set up this way as I didn't set up this part of the sequence.
  1. This participant has many respiration waves whose peaks are cut off due to a too-tight respiration belt (you can see in the histogram in Fig. 12). However, the program doesn't seem to be censoring those sections of the data (Fig. 14). Is there a setting I can adjust to censor the sections where the peaks are cut off?
  • Yes, the clipping of the breathing belt amplitude is suboptimal, as these periods will appear as a period of constant max or min breathing phase for RETROICOR, and also respiratory volume per time will be underestimated.
  • Censoring can be enabled by setting model.censor_unreliable_recording_intervals = true;
  • This should be on by default, and it looks like it was performed in you physio.mat file.
  • The censoring is only performed after the model estimation, and only for RETROICOR, i.e., you will only see it in the respective columns of the output regressor matrix R.
  • From the looks of it, this is exactly what is happening, see the following zoomed plot of the respiratory regressors, which have occasional occurences of zeros:

image

I hope this helps!

All the best, Lars