-
Notifications
You must be signed in to change notification settings - Fork 87
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
PhysIO with BIDS physio data as input and cardiac pulses, no analog #36
Comments
Dear Hrvoje, thank you for the BIDS format suggestion. It does not seem too different from the custom and the Siemens Tics format, so I will see about implementing a reader asap.. Concerning your example and script file I have the following questions inline:
Do you mean you get a 1 at each peak of the pulse wave and 0 otherwise. Or do you get indeed a heartrate (averaged?) From the file, it looks like the former, but just wanted to be sure.
How did you create the Something like this(?)
See above. Seems to be straightforward to implement, I will use your example as a template, if that is OK?
This seems correct. However, when I ran your job after my assumed file conversion above, I could see that the heart beat detection performed by Spike2 is suboptimal in this case. You can see this in the diagnostic plot PhysIO provides, here is the screenshot: The spikes in the upper subplot (and the warning with the threshold) indicate that the heart cycle (peak-to-peak interval) jumps too drastically for a realistic heart rate. I would assume the peak detection erroneously re-interpreted side peaks as R-peaks (spiky minima) or missed occasional R-peaks (spike maxima). Therefore, it would be better to retrieve the raw cardiac time series, and then use the
It might be that the scan triggers for the custom format are not properly integrated. You don't need them here anyway, if you specify the relative onset of first scan volume and physio logging as
That's OK. All the best, |
Hi Lars, support for BIDS format would be great - it does seem like it is becoming a standard for fMRI data sharing.
|
Alright, I am on it :-)
Good. Same result to what I did.
Both important points to consider. I will take care of that!
It could very well be the hand movements. Do subjects press with the same hand where the PPU is attached? I would try to avoid that with new data. About usability of the data: Hard to say, I would give it a try, but in particular if you really think phys recording artifacts are correlated to subject response, you definitely have to check the F-contrasts (e.g., with One thing you could try is to remove the presumable double peaks that create the local minima peaks (e.g., 0.3 s at 361s) by removing the 1 there in the cardiac file. Not very principled w/o the raw data though. PhysIO has also the ability to flag and remove intervals of low reliability from the regressors. It's
This is true in general. For our Philips scanner here, I haven't seen much of a relevant drift in TR, but this might differ between systems. I will see to fix that for your data so you can use the triggers. All the best, |
Thanks for quick responses and suggestions how to deal with the data quality. We did try to put it PPU on the hand they didn't use to make responses, but they often used both hands. I will know more whether dropouts are movement related when I examine the physio data of more subjects, and I will definitely have to check the F-contrasts. A detail regarding the triggers: we were manually stopping each run so we actually most of the time have 1 trigger more than the actual number of volumes (your Perhaps I should open a separate issue for this, but I ran into an error when data in cardiac file would begin with heart beat (1, and then zeros). I artificially convert those cases into 0s, assuming it shouldnt be a big influence. Perhaps this caused an error only in my data as both columns in cardiac file were the same? On a sidenote, is there a way to instruct the toolbox to not open windows for drawing figures, just saving figures instead? I'm doing it on a server but would like to save all the figures at the same time, so that I can later go through the figures to identify subjects/runs that need more scrutiny, without rerunning the code to generate the figures. At the moment I have to specify |
Dear Hrvoje,
All the best, |
This was referring to possibility to use the actual triggers from the file (as in these BIDS formatted files). But yes, you seemed to implement it that way anyway - trigger times from the trigger files and actual count according to the Nscans.
Ok, will do. |
Hello, I have a quick additional question. I'm trying to verify whether physio regressors produce sensible effects with an F-contrast, per suggestion in your paper. I'm not using the functions provided in the toolbox as I'm using SPM from Nipype, so I would like to know a bit more details about it.. What is the GLM that you would run - do you include only the physio regressors in the 1st level GLM, and specify F contrast over all of the RETROICOR, HRV, RVT variables, perhaps also separate F over cardiac RETROICOR, respiratory, interactions etc? Or is it OK to include these contrasts in a GLM together with events and other nuisance regressors (motion etc)? I actually already tried the second approach, and I get results that do not look like those reported in your paper - I get very little activation in the midbrain and around ventricles, so now I'm trying to figure out whether the GLM is wrong or I have a bug somewhere in my code producing the physio regressors. Finally, is there a way to bring those F contrast to the group level, in a 2nd level GLM? Thanks! |
Dear Hrvoje, I created a new issue to answer this question to keep the discussion thread clean. |
Thanks, that's ok of course. I see that you closed this issue, do you have a new version of the toolbox with the BIDS format support that I can try out? |
Dear Hrvoje, I updated the TAPAS development branch with the BIDS reader for PhysIO now. Have a look at https://github.com/translationalneuromodeling/tapas/blob/development/PhysIO in particular and the example in Have a nice weekend, |
That's great to hear, thanks a lot for a speedy development! Hrvoje |
I tried the new code and I find an error: Error using rmdir
No directories were removed.
Error in tapas_physio_read_physlogfiles_bids (line 195)
rmdir(fileName, 's');
Error in tapas_physio_read_physlogfiles (line 62)
tapas_physio_read_physlogfiles_bids(log_files,
cardiac_modality, verbose);
Error in tapas_physio_main_create_regressors (line 120)
verbose] = tapas_physio_read_physlogfiles(...
|
Dear Hrvoje, thank you for spotting this! This was indeed a bug, and when I checked it on my Windows machine, I also got another access problem, since I didn't properly close the unzipped Best, |
Great, I made the correction locally and it worked fine. I didn't check that part yet, but its great that you added automatic extraction of parameters from the json file! |
Hi Lars, I got new data, and this time I collected analog cardiac measurements. If I feed this into PhysIO, with BIDS option I get the following error: TR = 1.450 +/- 0.010 s (Estimated mean +/- std time of repetition for one volume)
No cardiac R-peak (heartbeat) events provided
maxscan (incl. dummies) = 420
tmin (1st scan start (1st dummy))= 0.00 s
tmin (1st scan start (after dummies))= 0.00 s
tmax = 608.90 s
mean TR = 1.45 s
Error using stem (line 43)
X and Y must be the same size.
Error in tapas_physio_plot_cropped_phys_to_acqwindow
(line 68)
stem(cpulse, ampc*ones(length(cpulse),1), 'r--')
;
Error in tapas_physio_main_create_regressors (line
222)
tapas_physio_plot_cropped_phys_to_acqwindow(ons_secs,
sqpar); Instead of option physio.preproc.cardiac.initial_cpulse_select.method = 'load_from_logfile'; I tried using physio.preproc.cardiac.initial_cpulse_select.auto_matched.min = 0.4;
physio.preproc.cardiac.initial_cpulse_select.auto_matched.file = 'initial_cpulse_kRpeakfile.mat'; as in BIDS format allows analog cardiac responses, perhaps you set it up according to my data which had heart beat data instead? Here are the data files: Hrvoje |
Hello,
I'm trying to use the toolbox with my physio data recorded not by the scanner, but by the additional software called Spike2. The data I get is the trigger times, analog respiratory signal, but for the cardiac data I get only the heart rate 0/1 variable.
I converted all the data to BIDS format, physio data included. This essentially conforms the required inputs to the FSL's PNM (see the manual, section 8.6: pdf). Here are the sample files: physio_test.zip
Since PNM involves a lot of manual work, I opted for PhysIO first. Do you have support for BIDS input files in the newer versions on github by any chance?
Although it seems PhysioIO requires analog cardiac signal I gave it a try nevertheless by simply duplicating the cardiac 0/1 column and setting the following parameters
This seems to give sensible results, but I wanted to check with you before including them in fmri GLMs. Would RETROICOR computations be fine? What about HRV?
physio.log_files.scan_timing
but perhaps not in a correct format?Here is the script I used:
P.S. Its a multiband CMRR sequence, and this particular participant exited the scanner after this run so that's why it has a lengthy period with physio recordings after the last trigger
The text was updated successfully, but these errors were encountered: