Export preprocessed traces and derived measures (HRV, RVT) at original sampling rate, preferably as BIDS
mrikasper opened this issue · 3 comments
mrikasper commented
Create a function to write out continuous physiological recordings physio.ons_secs.[t,c,r,svolpulse]
according to BIDS in a function, e.g., code/readin/tapas_physio_write_physlogfiles_BIDS.m
- This function should be called within
tapas_physio_main_create_regressors
either after syncing (labeled part 2 of the file) or preprocessing (part 3 of the file would be a BIDS derivative, but maybe more useful?)- according to BIDS for continuous Phys recordings: https://bids-specification.readthedocs.io/en/stable/04-modality-specific-files/06-physiological-and-other-continuous-recordings.html
- if different sampling frequencies, use
_physio-cardiac
,_physio-respiratory
etc. as in specification (or resample?) - additional meta-data in
.json
files: https://bids-specification.readthedocs.io/en/stable/02-common-principles.html#tabular-files - example for
.json
with vendor-specific metadata:
{
"SamplingFrequency": 100.0,
"StartTime": -22.345,
"Columns": ["cardiac", "respiratory", "trigger"],
"cardiac": {
"LongName": "ECG channel 1",
"Description": "Converted Siemens_Tics (VD/VE) *_PULS.log file, cropped and synchronized to scanner and other physiology by TAPAS PhysIO Toolbox v7.2.3",
"Units": "mV"
}
"trigger": {
"LongName": "Scan Volume Trigger",
"Description": "Converted Siemens_Tics (VD/VE) *_Info.log file, corrected (for double triggers) and merged by TAPAS PhysIO Toolbox v7.2.3",
"Units": "1"
}
}
- Question: where is output file(s) saved?
- make it user input parameter, e.g., directly in parameter structure for saving:
physio.BIDS_out
file - Define new parameter(s) in
tapas_physio_new
, and call in example script - or standard prefix as in BIDS, derived from other file/folder names? e.g., as
sub-01_task-visual_run-1_physio.{json,tsv.gz}
- make it user input parameter, e.g., directly in parameter structure for saving:
mrikasper commented
Correspondence of BIDS columns to ons_secs
fields:
trigger
=ons_secs.svolpulse
(is a time vector, has to be transformed into the right row of the.tsv
file)- exists only after step 2 in main,
tapas_physio_create_scan_timing
- conversion from time in
svolpulse
to row in.tsv
file viafind(ons_secs.svolpulse(iVolume)==ons_secs.t)
or similar
- exists only after step 2 in main,
cardiac
=ons_secs.c
- exists after step 1 in main
tapas_physio_read_physlogfiles
- exists after step 1 in main
respiratory
=ons_secs.r
likeajumprope commented
@mrikasper where can I find the sampling frequency? Is it physio.log_files.sampling_interval? Also I am committing into the branch created from the issue, if you want to have a look
mrikasper commented
Related to this common user request, it would be great to also allow for the extraction of derived physiological measures (RVT, HRV) at the initial sampling frequency
- At the moment, this is only possible after the resampling to the volume onsets of the fMRI time series
- The output should ultimately be BIDS, but a first step would be to provide the traces themselves at raw resolution in the
physio.mat
file