Giter VIP home page Giter VIP logo

translationalneuromodeling / tapas Goto Github PK

View Code? Open in Web Editor NEW
203.0 23.0 86.0 155.71 MB

TAPAS - Translational Algorithms for Psychiatry-Advancing Science

Home Page: https://translationalneuromodeling.github.io/tapas/

License: GNU General Public License v3.0

MATLAB 41.57% Shell 3.73% Makefile 0.82% M4 0.01% C 1.57% Python 1.19% HTML 33.14% TeX 0.48% Jupyter Notebook 16.39% M 0.25% Cython 0.32% Objective-C 0.52%
computational psychiatry behavioral neuroscience psychosomatics neurology statistical-learning bayesian-inference hierarchical-models fmri

tapas's People

Contributors

alexsayal avatar aponteeduardo avatar benoitberanger avatar chmathys avatar danielhoffmannayala avatar dschoebi avatar igsandra avatar imrekertesz avatar inezpereira avatar jheinzle avatar jsheunis avatar mms-neuro avatar mrikasper avatar nbuergi avatar saskiabollmann avatar sharrison5 avatar stefanfraessle avatar tnu-yaoy avatar tnutapas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tapas's Issues

creating RETROICOR regressors with PhysIO without batch

I have just downloaded the PhysIO package and try to create the RETROICOR regressors without the use of batch or SPM GUI. I am looking at the documentation, checked the examples (/PhysIO/examples) and feel a bit lost. The examples are only batches. I have cardiac and respiration measurements saved as a .mat file and I try to figure out how to create the log files needed by PhysIO (now I am not able to create the RETROICOR regressors even with the batch...). Any help will be appreciated! Sorry for bothering you!

adapting for multiband?

Hi, firstly wanted to say great job on the toolbox, really great, very useful piece of software youve put together.
secondly, i have a question id appreciate some advice on please?
From looking through the code it doesnt seem to explicitly deal with multiband slice excitation, so ive been trying to figure out how to adapt it.
But, as the code downsamples the slice aligned retroicor regressors (e.g. c_phase) to volume timing (e.g. c_sample_phase) which are used to form the final matrix R, it doesnt seem like i need to do anything? As the regression isnt being done on a slice by slice basis in the GLM?
Presumably as long as I have enough slice excitations in a TR to be able to reasonably estimate the card/resp phase per slice, then downsampling to volume temporal resolution will work ok?
thanks
Steve

Problem with post-hoc manual peak selection

Hello,

we are using the Biopac system to record PPG and respiration.

First of all, I would like to refer to another post by DanielHoffmann. They also used biopac and we experienced similar difficulties in terms of peak detection of the PPG data. To get rid of the strong baseline fluctuations we also decided to implement a filter which resolved the problem for most of our data.

However, it did not completely resolve the problem as we still have peaks which have not been correctly identified. That's why we would like to use the manual peak selection which unfortunately does not work.

Running 'TAPAS PhysIO Toolbox'
No cardiac R-peak (heartbeat) events provided
Failed 'TAPAS PhysIO Toolbox'
Error using close
Invalid figure handle.
In file "C:\Program Files\MATLAB\R2015b\toolbox\matlab\graphics\close.p" (???), function "close" at line 0.
In file "D:\Datensicherung\BPS Projekt_18.1.2018\PhysIO\tapas_physio_correct_cardiac_pulses_manually.m" (???), function "tapas_physio_correct_cardiac_pulses_manually" at line 106.
In file "D:\Datensicherung\BPS Projekt_18.1.2018\PhysIO\tapas_physio_main_create_regressors.m" (???), function "tapas_physio_main_create_regressors" at line 169.
In file "D:\spm12\toolbox\PhysIO\tapas_physio_cfg_matlabbatch.m" (???), function "run_physio" at line 1467.

The following modules did not run:
Failed: TAPAS PhysIO Toolbox

Error using MATLABbatch system
Job execution failed. The full log of this run can be found in MATLAB command window, starting with the lines (look for the line showing the exact #job as
displayed in this error message)

Do you have any idea why this error occurs? Do you need more information?

I'm looking forward to your reply. Thank you very much in advance!

Best,
Micha

F-contrasts in dummy GLM for PhysIO performance assessment

From a user:

Dear Lars,

Hope my email finds you well.

Recently, i have finished the first step suggested by you, that is

  1. create “dummy-glms” just containing RETROICOR/motion regressors in the design matrix, for each session individually (setting multiple regressors, but leaving multiple conditions empty), and then run tapas_physio_report_contrasts on them. tapas_physio_compute_tsnr_gains will work the same way.

But then i am confused about the second step. According to you, in the first step i shall create the F-contrast spanning the physiological noise regressors of all eight sessions manually. Can you elucidate this more precisely? Now for each session for each participant, i have a folder containing the 6 F contrasts for the physiology noise(namely all phys, all phys+move, caidiac, respiratory, card*Resp interaction, move), how shall i create F-contrast spanning the physiological noise regressors of all the sessions? Do you mean in the second level for each physiological noise?

Hope my questions are not bothering you too much. I will appreciate if you can give me further information.

Sincerely yours,
Yulin

Matlab Image Processing Toolbox in Noise ROIs creation

Dear Lars,
I was not able to use the PhysIO Toolbox because it would appear that a function (strel.m) is associated with the Image Processing Matlab Toolbox. Is it possible to avoid the use of the Image Processing Toolbox ?

Error message :
Done 'Coregister: Reslice'
Done
Failed 'TAPAS PhysIO Toolbox'
Undefined function 'strel' for input arguments of type 'char'.
In file "/home/anne/MATLAB/tapas/PhysIO/code/tapas_physio_create_noise_rois_regressors.m" (???), function "tapas_physio_create_noise_rois_regressors" at line 112.
In file "/home/anne/MATLAB/tapas/PhysIO/code/tapas_physio_main_create_regressors.m" (???), function "tapas_physio_main_create_regressors" at line 335.
In file "/home/anne/MATLAB/tapas/PhysIO/code/tapas_physio_cfg_matlabbatch.m" (???), function "run_physio" at line 1520.

The following modules did not run:
Failed: TAPAS PhysIO Toolbox

Thanks in advance,

Caroline

Filtering out white matter and CSF noise time series with PhysIO

Dear TAPAS-users,

I recently answered a user request on NITRC of how to perform nuisance regression when you don't have physiological logfiles.

In short, PhysIO can do that, extracting the relevant nuisance regressors, and SPM plus the batch editor help to do the rest, i.e., ending up with a filtered fMRI time series Nifti file that you may use, for example, for a resting state connectivity analysis. This way, you can setup your whole preprocessing pipeline in SPM.

Here are the details, including an example batch of the whole procedure:

https://www.nitrc.org/forum/forum.php?thread_id=9959&forum_id=2

Sample code and data-sets for Biopac recordings

Dear Lars,

Would you happen to have a sample code and data-sets for physiological data recorded with Biopac? If not, would it be possible to provide a file or text that may offer an example of how to properly prepare data acquired from Biopac (e.g. cardio, respiration, and triggers) so that they are compatible with the TAPAS toolbox?

Many thanks in advance for your time and assistance.

Kind regards,
Ryan

tapas_fitModel breaks with longer sequences

Hi thanks for making these awesome tools available.

I have just started trying the model and following the example in the HGF_demo.

It works as per the demo example using the example binary data. However, if I generate a sequence any longer than about 375 elements it breaks.

e.g.

for i=370:400
u = rand(i,1)<0.25;

bopars = tapas_fitModel([],...
u,...
'tapas_hgf_binary_config',...
'tapas_bayes_optimal_binary_config',...
'tapas_quasinewton_optim_config');

fprintf(['failed at length(u) = ',num2str(i+1),])
end

Breaks when u reaches ~ 376 elements.

I'm sure I'm missing a simple step?

Many thanks, Paul

PhysIO Data Processing

Hello,

we are using PhysIO with a respiratory belt and PPU data from a Biopac system.
Our data was not processed in any way before going into PhysIO, so low frequency trends and scanner-related high frequency artifacts are still present. (see image attached)

img_3298

The following two issues emerged:

  1. Upon inspection of the graphical outputs, we noticed that the 1st & 2nd pass peak detection steps failed to recognize every peak where the entire signal was below the zero line. Contrary to respiratory data, which is indeed bandpass filtered, cardiac data is not filtered in PhysIO before going into processing.

  2. On a sidenote, we were not quite sure whether the high frequency (scanner-related) noise would meddle with the exact positioning of the peak?

Our pragmatic remedy to both issues was High-Pass filtering the cardiac signal with a 2nd order butterworth filter (0.5 lower, 5 Hz upper cutoff, Matlab) before introducing it into PhysIO which seemed to fully resolve the issues with peak detection.

We wonder whether our simple bandpass filtering is a valid approach.
If it is, would the exact parameters just be determined empirically by trying out settings and evaluating their effects on the signal or are there more specific guidelines?

(On another sidenote, we wonder whether the bandpass filter could distort the cardiac signal's phase information, which filters are known to do in the vicinity of their cutoff frequencies)

If it's not, what approach would you recommend?

Thank you very much for your effort!

Regards,
Daniel

Using raw physio data without DICOM files

Hi,
I recently conducted an fMRI study on a Siemens Prisma scanner while measuring respiration and pulse. I have some hypotheses that correspond only to my respiration and pulse measurements. I ran the Tapas script (including the DICOM, PPU, and Resp files) to preprocess the data. I am wondering where in the final .mat outputs can I find the transformed raw data corresponding to the PPU and resp files, and the pre-processed data corresponding to these measures. I believe that I should find some output here that I can use on its own (without the brain scans) for the purpose of testing my hypotheses relating to only these files, but I am not sure where I can find them. Ideally I am looking for output that I can import into programs used to analyse heart-rate related data (e.g., Kubios or labchart).
Thank you for your comments!
Dorottya

RETROICOR Pipeline not Proceeding to Completion

Hello,

I am trying to create RETROICOR regressors to use in fMRI analysis. I am working with Siemens .resp/.puls files as described here. I have successfully removed the log headers and created the corresponding cardiac/respiratory time series as one-column text-files. I thus set my physio.log_files.vendor as 'Custom' as opposed to 'Siemens'. I interpolated both physiological time series to 200 Hz and matched the beginning and end time to those of the fMRI scan they are associated with.

The parameters I used are below (slightly altered such as to be hardcoded with the files I provide below).

`physio = tapas_physio_new('RETROICOR');
physio.log_files.vendor = 'custom';
physio.log_files.respiration = 'R2c001_resp.txt';
physio.log_files.cardiac = 'R2c001_puls.txt';
physio.preproc.cardiac.modality = 'OXY';
physio.save_dir = '';

physio.log_files.sampling_interval = [.005, .005];
physio.log_files.relative_start_acquisition = 0;
physio.log_files.scan_timing = '';
physio.log_files.align_scan = 'last';

physio.scan_timing.sqpar.Nslices = 20;
physio.scan_timing.sqpar.NslicesPerBeat = 20;
physio.scan_timing.sqpar.TR = 1.25;
physio.scan_timing.sqpar.Ndummies = 1;
physio.scan_timing.sqpar.Nscans = 482;
physio.scan_timing.sqpar.onset_slice = 11;
physio.scan_timing.sync.method = 'nominal';

physio.preproc.cardiac.initial_cpulse_select.method = 'auto';
physio.preproc.cardiac.initial_cpulse_select.file = 'initial_cpulse_kRpeakfile.mat';
physio.preproc.cardiac.initial_cpulse_select.min = 0.4;
physio.preproc.cardiac.posthoc_cpulse_select.method = 'auto';
physio.preproc.cardiac.posthoc_cpulse_select.percentile = 80;
physio.preproc.cardiac.posthoc_cpulse_select.upper_thresh = 60;
physio.preproc.cardiac.posthoc_cpulse_select.lower_thresh = 60;
physio.model.orthogonalise = 'RETROICOR';
physio.model.censor_unreliable_recording_intervals = false;
physio.model.output_multiple_regressors = 'multiple_regressors.txt';
physio.model.output_physio = 'physio.mat';
physio.model.retroicor.include = true;
physio.model.retroicor.order.c = 2;
physio.model.retroicor.order.r = 2;
physio.model.retroicor.order.cr = 0;
physio.model.rvt.include = false;
physio.model.rvt.delays = 0;
physio.model.hrv.include = false;
physio.model.hrv.delays = 0;
physio.model.noise_rois.include = false;
physio.model.noise_rois.thresholds = 0.9;
physio.model.noise_rois.n_voxel_crop = 0;
physio.model.noise_rois.n_components = 1;
physio.model.movement.include = false;
physio.model.movement.order = 6;
physio.model.movement.censoring_threshold = 0.5;
physio.model.movement.censoring_method = 'FD';
physio.model.other.include = false;
physio.verbose.level = 2;
physio.verbose.process_log = cell(0, 1);
physio.verbose.fig_handles = zeros(0, 1);
physio.verbose.fig_output_file = 'physio.fig';
physio.verbose.use_tabs = false;
physio.ons_secs.c_scaling = 1;
physio.ons_secs.r_scaling = 1;

physio = tapas_physio_main_create_regressors(physio);`

When I run main_create_regressors file with the resulting physio struct, it creates all figures until the last one I need, which would be 'RETROICOR GLM regressors'. I would imagine that this is the output I would need to do RETROICOR regression. The error message is:

"""""
Warning: Guessed additional cardiac pulse at time series start for phase estimation
Warning: Guessed additional cardiac pulse at time series end for phase estimation
Undefined function or variable 'R'.

Error in tapas_physio_orthogonalise_physiological_regressors (line 84)
subplot(1,3,1); imagesc(R); title({'Physiological regressor matrix for GLM'...

Error in tapas_physio_main_create_regressors (line 370)
[R, verbose] = tapas_physio_orthogonalise_physiological_regressors(...

Error in physio_toolbox (line 221)
physio = tapas_physio_main_create_regressors(physio);
"""""

It does complete the 'RETROICOR timecouse physiological regressors' figure however.

Below I have attached the physio time series that I use in this analysis. I have confirmed with the diagnostic figures that they look as expected. Please let me know if you have any advice for generating the GLM regressors, or alternatively if the timecourse regressors I do have are sufficient for fMRI noise regression.

Thank you,
Steven

R2c001_puls.txt
R2c001_resp.txt

Undefined function or variable 'VOLLOCS'.

Hey,

I am trying to incorporate PhysIO into our labs pipeline. I ran the Siemens_VD example script, switching out variables for my participants data, and came across this error

`>> testing_physio_11053_1
Undefined function or variable 'VOLLOCS'.

Error in tapas_physio_create_scan_timing (line 115)
ons_secs.t, VOLLOCS, LOCS, sqpar, verbose);

Error in tapas_physio_main_create_regressors (line 149)
log_files, scan_timing, ons_secs, verbose);

Error in testing_physio_11053_1 (line 58)
physio = tapas_physio_main_create_regressors(physio); `

The script does print the Raw Physio Logfile Data figure but none of the regressors.
Here is a folder with my dicom, 3 log files and Matlab script.

Any help is much appreciated,

Thanks!

PhysIO toolbox heartbeat modeling

The warning 'there seem to be skipped heartbeats in the sequence of pulses' occurs for some subjects only if the last scan is used as a reference for time matching. This bug (?) occurs for 4 out of 36 subjects.
Siemens Scanner and ECG cardiac files were used.

first_scan_asref
last_sca_asref

BIDS with analog cardiac data; failed cardiac pulse detection

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 tapas_physio_example_siemens_hcp_ppu3t_spm_job.m.

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:
sub-s080.zip

Hrvoje

Originally posted by @hstojic in #36 (comment)

HGF: Multiple cues -> binary outcomes

Dear Dr Mathys and HGF users,

I used the HGF successfully in the past to successfully model learning in simple designs but now I am tackling a more complex design and I was wondering if you had any advice.

In brief, at each trial, the agent sees one of 14 cues which is probabilistically associated with a binary outcome (rewarded or not). I am trying to track the agent’s learning of the cue-> reward association. My issue here is that with this number of cues I can’t figure out how to code the inputs in contingency space as I would do in a design with 2 cues. I tried treating the problem as a multi-arm bandit situation with 14 arms but this does not seem optimal and leads to poor fits compared to simple RW models.

I was therefore wondering if by any chance you had any suggestion on how to tackle this design with the HGF or would know about any papers doing something similar?

Thank you for your help and best wishes,

MP

PhysIO on CMRR multiband data from Siemens Prisma

Physio_20170803_120306_85d97388-a318-4a32-b3a9-bb10c2109660_Info.log
Physio_20170803_120306_85d97388-a318-4a32-b3a9-bb10c2109660_PULS.log
Physio_20170803_120306_85d97388-a318-4a32-b3a9-bb10c2109660_RESP.log

Hi tapas group,

I am currently implementing the PhysIO toolbox on a dataset acquired using CMRR multiband sequences (factor=6). I am using Matlab command line by modifying the script comes with examples. I got Figures 1-5 (with verbose.level=2), but meanwhile getting glitches (no output generated). I am attaching the .log files I have and the script I am using. Here are messages I got from Matlab:

PhysIO
Warning: First volume with missing slice events (144: 0 instead of 66 found)

In tapas_physio_log (line 50)
In tapas_physio_get_onsets_from_locs (line 73)
In tapas_physio_create_scan_timing (line 114)
In tapas_physio_main_create_regressors (line 141)
In PhysIO (line 322)
maxscan (incl. dummies) = 135
tmin (1st scan start (1st dummy))= 20.14 s
tmin (1st scan start (after dummies))= 20.14 s
tmax = 154.05 s
mean TR = 0.99 s

Warning: No figures found to save to file

In tapas_physio_log (line 50)
In tapas_physio_print_figs_to_file (line 36)
In tapas_physio_main_create_regressors (line 401)
In PhysIO (line 322)
Output argument "R" (and maybe others) not assigned during call to "tapas_physio_main_create_regressors".

Error in PhysIO (line 322)
[physio_out, R, ons_secs] = tapas_physio_main_create_regressors(physio);

Any help is appreciated!

Thank you,
Yuqi

HUGE_analysis_resting_state

Hi,
I'm trying to perform the HUGE analysis on DCMs created from resting-state data. However, it comes up with an error when estimating the priors:
TAPAS:HUGE: Unsupported format. Use cell array of DCM in SPM format as first input.
Reference to non-existent field 'dt'.

Error in tapas_huge_import_spm (line 86)
DcmInfo.hemParam.scaleC = DcmSpm{1}.Y.dt/DcmSpm{1}.U.dt;

Error in tapas_huge_build_prior (line 44)
DcmInfo = tapas_huge_import_spm(DcmInfo);

Error in Insula_HUGE_analysis (line 2)
priors = tapas_huge_build_prior(DCM_insula_cluster);

The issue is that the DCM files do not have a U.dt field which from what I understand is the input time resolution. However, as this is resting-state data there are no exogenous inputs. Thanks very much for your help.

Best wishes,
Kristian

physIO extract breath duration or max inhalation/exhalation

I would like to extract the time of each breath (max exhalation and/or max inhalation) detected by physIO. Is there something similar to ons_secs.cpulse for respiration? The "interpolated breath duration (secs)" timecourse from the attached figure would also work well.

I have been unable to locate these derived respiration measures in the created physio.mat object. If they are present, please point the field out to me, and apologies. If not, is there a simple way to extract them, perhaps writing an additional csv when physIO is run?

Thanks!
Jo Etzel

capture

Questions about fitting real response data in HGF

Dear Dr. Mathys,

Currently, I am trying to implement HGF models in my experiment. I’ve gone through the HGF toolbox following your very helpful manual and demo.
 
But I have a problem when I try to fit the model using the real response, and I am wondering whether you could give me some help, as you mentioned less in the manual about using real binary response.
 
My task is a prediction task given a prior cue, which is similar with the task in Iglesias et al 2013, Neuron. I am using both perceptual and response models to simulate the trial-wise trajectories, i.e., belief or prediction error, directly as follows:
est = tapas_fitModel (y,...
                         u,...
                         'tapas_hgf_binary_config',...
                         'tapas_unitsq_sgm_config',...
                         'tapas_quasinewton_optim_config'); 

%% y is the real response vector, and u is the stimulus input (contingency space: 0 and 1).

To simplify the questions, first of all, I am wondering whether what I am doing is correct or not by simply adding the response y in the tapas_fitModel function? If not, what should be the correct procedure to fit the real response data?
  
Thanks in advance,
Best,
Bin

PhysIO installation into SPM toolbox

Hello,

I am having trouble installing the PhysIO component of the TAPAS package into the SPM toolbox.

I copied the "physio/code" folder to the "spm12/toolbox/physio" folder, resulting in the following directory: "spm12/toolbox/physio/code". However, the SPM toolbox menu did not seem to recognize the physio toolbox. So, I then copied all contents of the "code" folder into the "toolbox/physio" folder, with the resulting directory: "spm12/toolbox/physio". The physio toolbox was then recognized by the SPM toolbox menu.

However, when I clicked on "physio" in the SPM toolbox menu, I received the following error message.


"Not enough input arguments.

Error in tapas_physio_job2physio (line 32)
physio = tapas_physio_update_from_job(physio, job, ...

Error in spm (line 1009)
evalin('base',xTB(i).prog);

Error while evaluating UIControl Callback"

Any ideas as to how I could resolve this?

Thank you very much in advance for your time!

Kind regards,
Ryan

Bug in HGF softmax_binary_sim.m?

Hi there,

I'm currently playing around with simulated data with the HGF and noticed - what I think is - a bug in one of the scripts. Since I'm new to modelling and programming, though, I might just have misunderstood or overlooked something, so please correct me if I'm wrong.

While tapas_softmax_binary is equipped to take into account reward values via a second and third column in the input u, the corresponding simulation script tapas_softmax_binary_sim doesn't seem to actually take them into account (line 24). Also, the if-condition on line 15 seems to be based on the wrong variable (e.g. since mu1hat is defined as infStates(:,1,1), the statement size(mu1hat,2) == 1 will always be true).

Original code:

if size(mu1hat,2) == 1
    if ~any(mu1hat<0) && ~any(mu1hat>1)
        % Apply the logistic sigmoid to the inferred states
        prob = tapas_sgm(be.*(2.*mu1hat-1),1);
    else
        error('tapas:hgf:SoftMaxBinary:InfStatesIncompatible', 'infStates incompatible with tapas_softmax_binary observation model.')
    end
else
    % Apply the logistic sigmoid to the inferred states
    prob = tapas_sgm(be.*(mu1hat(:,1)-mu1hat(:,2)),1);
end

What I would suggest instead:

if size(r.u,2) == 1  %%<<<<<-------------Replaced mu1hat with r.u, as presumably should be
    if ~any(mu1hat<0) && ~any(mu1hat>1)
        % Apply the logistic sigmoid to the inferred states
        prob = tapas_sgm(be.*(2.*mu1hat-1),1);
    else
        error('tapas:hgf:SoftMaxBinary:InfStatesIncompatible', 'infStates incompatible with tapas_softmax_binary observation model.')
    end
elseif size(r.u,2) == 3
    % Gather the reward values
    r0 = r.u(:,2);
    r1 = r.u(:,3);
    % Apply the logistic sigmoid to the inferred states
    prob = tapas_sgm(be.*(r1.*mu1hat-r0.*(1-mu1hat)),1);  %%<<<<----- added the reward values
end

Does that make sense?

Best,
Niklas

HGF: Gaussian noise on responses on a continuous scale

Dear Dr Mathys,

I wonder whether you know of any paper that has used "gaussian_obs" as response model for empirically observed responses on a continuous scale (as opposed to the "simulated" responses that you used as example in your documentation).

Thanks in advance

Best,
ianthe

Using PhysIO with HCP data

From a user:

Hello,

I'm interested in using PhysIO for physiological data from the human connectome project. The physiological data is in HCP available as a single text file, containing 3 columns (trigger, physio, cardio (not sure about the order right now)). Does PhysIO support reading such text files, or is it necessary to read the raw physiological data?

  • Anders

SIEMENS PMU logging synchronization

Dear Lars,
thank you for providing a toolbox for noise control in fMRI data!
In our actual data set, we face a problem with synchronization of the PMU-logging files .resp and .puls with the raw image files MR... Independent of which MR..- file is given in „log_scan_time“, the toolbox takes into account the same cutout region for physiological regressors. When „align_scan“ is first, the very beginnig of the physiological recordings is cut out for regressors, when „align_scan“ is last, the very end of the physiological recordings are taken into for regressor building.
In our scanning session, we did five runs, localizer, T1, T2 and two functional T2*. Thus, we would expect the cutout regions fort he T2*-runs to be in the middle of the physiological recordings, as PMU-logging was gathered from before all scanning started and ended after the last T2*-run.

Do you have any hint how to synchronize the data properly?

Kind regards,
Alex

Unreliable segments flagging

Hello,

in your 2017 paper "The PhysIO Toolbox for Modeling Physiological Noise in fMRI Data" at the end of section 2.7.3 you write:

If unreliable segments have been detected earlier (see section Assessment of Recording Quality and Recovery), the regressors will be split and the common multiple regressors file will contain zeros at these time points. The regressors derived in the unreliable segments are saved in a separate file.

While processing our physiological data, we do find indicators in the output figures that there indeed are constant, hence unreliable data snippets in the data. Yet, these segments are neither "flagged" in the common multiple regressors (text) file (by setting their values to 0), nor are there any separate (text) files saved additionally in our save directory.
The respective Matlab variables physio.ons_secs.c_is_reliable and physio.ons_secs.r_is_reliable are created and properly reflect the "unreliable" data snippets' indices. But they don't seem to be used for any purpose related to modification of output regressors?
Could you elucidate this discrepancy?

If this feature is indeed not implemented: would you recommend for us to manually "censor" these loci in physio.models.R by substituting the affected sections' values with 0?

Thank you very much for your help!

Regards,
Daniel

Question: HGF - how to set parameters within region that model assumptions aren't violated…?

Hi there TAPAS team,

Please look kindly on my newbie status!

I am completely new to implementing the HGF, with a psychology/cogneuro background and little mathematical know-how I'm finding a few points in confusing. Primarily, how to set the parameters to simulate responses given inputs. It's my first go at running a simulation, so going with the demo:

sim = tapas_simModel(u,...
                     'tapas_hgf_binary',...
                     [f -2.5 -6],...
                     'tapas_unitsq_sgm',...
                     5);

but just swapping in the inputs from my task. This throws an error: Error using tapas_hgf_binary (line 225) Variational approximation invalid. Parameters are in a region where model assumptions are
violated.

The tips in the comments of tapas/HGF/tapas_hgf_ar1_binary_config.m (quoted below) hint at the procedure but I'm afraid I have no idea what 'wide and loose' actually means with respect to the values for these parameters, and every number I try returns the 'model assumptions are violated' error...

Cheers,
Megan
(PhD Student)

% - When analyzing a new dataset, take your inputs u and use
%
%   >> est = tapas_fitModel([], u, 'tapas_hgf_binary_config', 'tapas_bayes_optimal_binary_config');
%
%   to determine the Bayes optimal perceptual parameters (given your current priors as defined in
%   this file here, so choose them wide and loose to let the inputs influence the result). You can
%   then use the optimal parameters as your new prior means for the perceptual parameters.
%
% - If you get an error saying that the prior means are in a region where model assumptions are
%   violated, lower the prior means of the omegas, starting with the highest level and proceeding
%   downwards.

from the hgf_demo.m

% To do that, we simply choose values for $\omega$. Here, we take $\omega_2=-2.5$ and 
% $\omega_3=-6$. But in addition to the perceptual model _hgf_binary_, we now 
% need a response model. Here, we take the unit square sigmoid model, _unitsq_sgm_, 
% with parameter $\zeta=5$.
%%

HGF in one-condition tasks with a task-learning component

Dear Dr Mathys,

I would kindly ask you for an elucidation regarding the HGF toolbox.

Our data consist in a series of 0 and 1 (y) which correspond to
self-reported awareness judgment. There are no variations in condition
but there is a learning component to the task (participants should
report less and less « yes » response through the course of the task).

We are interested in modeling the participants' internal beliefs about
their response to the upcoming trial (a priori expectation that he/she
will response yes or no) given the previous trial history.

We are just a bit confused about how this should be done with the HGF
toolbox.

We are using the following command line:

est = tapas_fitModel(y, y, 'tapas_hgf_binary_config',
'tapas_beta_obs_config');

Could you please confirm that using y as both response and input is the
correct implementation of our intention? Otherwise, is there another
specific approach to apply HGF modeling to one-condition tasks with a
task-learning component ?

Finally, we are currently only using the HGF perceptual model and
comparing a Beta to a Softmax observational model. Would you have any
suggestion concerning other types of perceptual or observational models
we could use with this kind of data?

Thanks a lot for for your attention,
Best regards,

Giovanni

Interpretation of the output

Hi,

I want to use the Physio Toolbox of TAPAS with the SCANPHYSLOG files of the acquisitions (with Philips), but I have the following doubts.

First, It is very important for me to understand what is the meaning of the 24 columns in the multiple_regressors.txt file that this toolbox creates. As for the rows, this file has one line for each volume, and I also would like to understand how, based on the information of a volume, the hemodynamic activity can be modulated in different areas of the brain.

Finally, I would like to understand the following issue: in the SCANPHYSLOG file, 500 lines represent a second of the acquisition, and therefore if the TR = 2, a volume equals 1000 lines. I noticed that the total number of lines exceeds the corresponding number, which would be 250,000 (1000 lines x 250 volumes) and by doing some tests I have seen that there are many lines at the beginning that do not correspond to the first volumes. Does PhysIO-Toolbox know how to interpret this correctly? Or should I manually delete lines that are not corresponded with volumes in the SCANPHYSLOG-file before using Physio Toolbox?

Thank you very much in advance.

Best regards,
Marina Fernández Álvarez, PhD-student.

Laboratory of Functional Neuroscience
Pablo de Olavide University
Ctra. de Utrera, Km.1
41013 - Seville (Spain)

Using PhysIO with physio data in Siemens DICOM files

From a user:

Dear Lars,

I am looking forward to using PhysIO on some new data we have collected using the HCP protocol (multiband). The physio data are saved as a DICOM file. Does the PhysIO software have capability of parsing these files? I'm attaching an example here in case it would help.

Also, from this page, it appears that there is a bit of a delayed start for multiband sequences. Where would this be specified in PhysIO?

Thanks, Dara

mpdcm - Usage syntax

Hello,

I have been trying to implement the mpdcm toolbox and I have successfully compiled it, but I have not found any examples, tests, or use cases in the readme or source code.

I was wondering if you had any examples with known output so I can verify my installation? Alternatively, if you have a readme on the functionality of the elements in the toolbox and the syntax to use them, that would be great too. Thank you!

-Cooper

PhysIO CMRR Multiband Pulse only

Hello,

I am acquiring physiological data on a Siemens Prisma with the proprietary PPU and respiratory cushion, using a CMRR multiband sequence.
Since the respiratory signal fails more than what I am willing to accept, I decided to use the pulse data only. I am exporting *_Info.log, *_RESP.log, and _PULS.log files.

If I provide the PULS and Info files only, I get the following error:

Error in the scan trigger data.
Warning: No respiratory time series provided 
Warning: First volume with missing slice events (374: 0 instead of 42 found)
07-Feb-2019 16:54:46 - Failed  'TAPAS PhysIO Toolbox'
Index exceeds matrix dimensions.
In file "C:\Users\alexandresayal\Documents\MATLAB\spm12\toolbox\PhysIO\tapas_physio_crop_scanphysevents_to_acq_window.m" (???), function "tapas_physio_crop_scanphysevents_to_acq_window" at line 70.
In file "C:\Users\alexandresayal\Documents\MATLAB\spm12\toolbox\PhysIO\tapas_physio_main_create_regressors.m" (???), function "tapas_physio_main_create_regressors" at line 215.
In file "C:\Users\alexandresayal\Documents\MATLAB\spm12\toolbox\PhysIO\tapas_physio_cfg_matlabbatch.m" (???), function "run_physio" at line 1520.

Could you provide some help on this?
I attach the log files, error data and batch used.

Thank you in advance,

batchfilesiemens_cardiac_only.zip
Physio_20181203_151116_9b6683d7-1925-4bdb-ae00-3365fff615ef_Info.log
Physio_20181203_151116_9b6683d7-1925-4bdb-ae00-3365fff615ef_PULS.log
Physio_20181203_151116_9b6683d7-1925-4bdb-ae00-3365fff615ef_RESP.log

PhysIO, error in `tapas_physio_main_create_regressors` if heart beat present in the first sample

Hello,

PhysIO produces the following error if I run it with cardiac data where heart pulse is present already in the first sample. The problem goes away if I simply eliminate these 1st sample pulses (which should not cause a big issue in any case).

No scan trigger 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

In an assignment  A(:) = B, the number of elements in A and B must be the same.

Error in tapas_physio_get_cardiac_phase (line 76)
    scannertpriorpulse(i) = pulset(n);

Error in tapas_physio_create_retroicor_regressors (line 90)
            tapas_physio_get_cardiac_phase(cpulse, spulse, verbose, svolpulse);

Error in tapas_physio_main_create_regressors (line 287)
                tapas_physio_create_retroicor_regressors(ons_secs, sqpar, ...

Here are the files and a script I ran:
pulse_issue.zip

Precision-weighting of prediction errors

Dear Dr Mathys and HGF experts,

I am running a 2-levels HGF model using the hgf_binary.m function to explore internal beliefs about the response to the upcoming trial given the previous trial history, and related prediction errors (PE). I would kindly ask to you some elucidtions about how the precision weighting (psi) on PE is computed.

According to Equation 6 in Iglesias et al. (2013) and Equation 4 in Paliwal et al. (2014), psi is the ratio between pihat at the level below (representing the precision of the prediction about input from the level below) and pi at the current level (representing the precision of the beliefs at the current level):

psi = pihat(l-1)/pi(l). 

In the hgf_binary.m code (line 253-255) this is true for the third level but not for the second level:

psi        = NaN(n-1,l);
psi(:,2)   = 1./pi(:,2);
psi(:,3:l) = pihat(:,2:l-1)./pi(:,3:l);

Does the second level represent an exception to Iglesias et al. equation?
According to Equation 41 in Mathys et al. (2011), the precision of the prediction at the current level:

pi2 = pihat2 + 1/pihat1,

resulting as the inverse of uncertainty sa2. Therefore, if psi2 = 1/pi2 and sa2 = 1/pi2, then psi2=sa2.
I am wondering if, by doing so, when I compute precision-weighted PE (epsi2) I am weighting PE for the precision or for the uncertainty. As, on average, in my results uncertainty is relatively low (with consequent high precision pi), I obtained very low values for epsi2. Should I use: psi(:,2)=pihat(:,1)/pi(:,2)?

I have a question I'd like to ask you: would it be correct to use raw PE in an fMRI study, if I don't want to make any inference about uncertainty and precision of the prediction, but to focus only on how discrepancies between internal beliefs and real outcomes are processed?

Thank you very much for your attention.
Best wishes,

Giovanni

Ref.
Iglesias et al. (2013): https://doi.org/10.1016/j.neuron.2013.09.009
Paliwal et al. (2014): https://doi.org/10.3389/fnhum.2014.00428
Mathys et al. (2011): https://doi.org/10.3389/fnhum.2011.00039

Fitting multi-session learning data with HGF

Hi Chris,

We met at the SPM course last year in your fMRI workshop. I hope you don’t mind me asking a quick follow-up question re: the hgf toolbox.

If you have learning data from two fmri sessions how do you fit multi-session data using HGF? Can you specify data from two sessions but one subject?

Thanks,

Akshay

PhysIO with BIDS physio data as input and cardiac pulses, no analog

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.

  1. 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?

  2. 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

matlabbatch{1}.spm.tools.physio.preproc.cardiac.modality = 'PPU';
matlabbatch{1}.spm.tools.physio.preproc.cardiac.initial_cpulse_select.load_from_logfile = struct([]);
matlabbatch{1}.spm.tools.physio.preproc.cardiac.posthoc_cpulse_select.off = struct([]);

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?

  1. Finally, When running a job, the toolbox gives an output: "No scan trigger events provided". I do have trigger data, but unsure where and how to provide it. I have placed it in physio.log_files.scan_timing but perhaps not in a correct format?

Here is the script I used:

matlabbatch{1}.spm.tools.physio.save_dir = {'/media/hstojic/dataneuro/fnclearning_fmri/dProcessed/physio_test'};
matlabbatch{1}.spm.tools.physio.log_files.vendor = 'Custom';
matlabbatch{1}.spm.tools.physio.log_files.cardiac = {'/media/hstojic/dataneuro/fnclearning_fmri/dProcessed/physio_test/cardiac.csv'};
matlabbatch{1}.spm.tools.physio.log_files.respiration = {'/media/hstojic/dataneuro/fnclearning_fmri/dProcessed/physio_test/respiratory.csv'};
matlabbatch{1}.spm.tools.physio.log_files.scan_timing = {'/media/hstojic/dataneuro/fnclearning_fmri/dProcessed/physio_test/trigger.csv'};
matlabbatch{1}.spm.tools.physio.log_files.sampling_interval = 0.02;
matlabbatch{1}.spm.tools.physio.log_files.relative_start_acquisition = 255.45;
matlabbatch{1}.spm.tools.physio.log_files.align_scan = 'first';
matlabbatch{1}.spm.tools.physio.scan_timing.sqpar.Nslices = 16;
matlabbatch{1}.spm.tools.physio.scan_timing.sqpar.NslicesPerBeat = [];
matlabbatch{1}.spm.tools.physio.scan_timing.sqpar.TR = 1.45;
matlabbatch{1}.spm.tools.physio.scan_timing.sqpar.Ndummies = 0;
matlabbatch{1}.spm.tools.physio.scan_timing.sqpar.Nscans = 474;
matlabbatch{1}.spm.tools.physio.scan_timing.sqpar.onset_slice = 9;
matlabbatch{1}.spm.tools.physio.scan_timing.sqpar.time_slice_to_slice = 0.090625;
matlabbatch{1}.spm.tools.physio.scan_timing.sqpar.Nprep = 0;
matlabbatch{1}.spm.tools.physio.scan_timing.sync.nominal = struct([]);
matlabbatch{1}.spm.tools.physio.preproc.cardiac.modality = 'PPU';
matlabbatch{1}.spm.tools.physio.preproc.cardiac.initial_cpulse_select.load_from_logfile = struct([]);
matlabbatch{1}.spm.tools.physio.preproc.cardiac.posthoc_cpulse_select.off = struct([]);
matlabbatch{1}.spm.tools.physio.model.output_multiple_regressors = 'multiple_regressors.txt';
matlabbatch{1}.spm.tools.physio.model.output_physio = 'physio.mat';
matlabbatch{1}.spm.tools.physio.model.orthogonalise = 'none';
matlabbatch{1}.spm.tools.physio.model.censor_unreliable_recording_intervals = false;
matlabbatch{1}.spm.tools.physio.model.retroicor.yes.order.c = 3;
matlabbatch{1}.spm.tools.physio.model.retroicor.yes.order.r = 4;
matlabbatch{1}.spm.tools.physio.model.retroicor.yes.order.cr = 1;
%matlabbatch{1}.spm.tools.physio.model.rvt.no = struct([]);
%matlabbatch{1}.spm.tools.physio.model.hrv.no = struct([]);
matlabbatch{1}.spm.tools.physio.model.rvt.yes.delays = 0;
matlabbatch{1}.spm.tools.physio.model.hrv.yes.delays = 0;
matlabbatch{1}.spm.tools.physio.model.noise_rois.no = struct([]);
matlabbatch{1}.spm.tools.physio.model.movement.no = struct([]);
matlabbatch{1}.spm.tools.physio.model.other.no = struct([]);
matlabbatch{1}.spm.tools.physio.verbose.level = 2;
matlabbatch{1}.spm.tools.physio.verbose.fig_output_file = '/media/hstojic/dataneuro/fnclearning_fmri/dProcessed/physio_test';
matlabbatch{1}.spm.tools.physio.verbose.use_tabs = false;

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

Assessing PhysIO Noise Correction Quality within GLM

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!

Originally posted by @hstojic in #36 (comment)

rDCM example for empirical data

Hi, I was wondering if you guys could provide a pointer on how to run rDCM given an empirical fMRI.

This would be similar to thetapas_rdcm_tutorial.m tutorial but without the step of reading a pre-defined DCM file.

Do I first need to create a DCM struct? And, if so, is there a helper function that assists in this step?

Thanks.
Pablo

PhysIO warnings "Invalid MinPeakHeight" and "Guessed additional cardiac pulse" when using the gradient for time synchronization

We are running the physio toolbox on data sets from several different studies, all performed in the same lab using a Phillips 3T scanner, and frequently getting the following warnings:

Warning: Invalid MinPeakHeight. There are no data points greater than MinPeakHeight. 
> In tapas_physio_findpeaks>getPeaksAboveMinPeakHeight (line 128)
  In tapas_physio_findpeaks (line 54)
  In tapas_physio_rescale_gradient_gain_fluctuations (line 66)
  In tapas_physio_create_scan_timing_from_gradients_philips (line 177)
  In tapas_physio_create_scan_timing (line 85)
  In tapas_physio_main_create_regressors (line 149)
  In tapas_physio_cfg_matlabbatch>run_physio (line 1520)
  In cfg_run_cm (line 29)
  In cfg_util>local_runcj (line 1688)
  In cfg_util (line 959)
  In cfg_ui>MenuFileRun_Callback (line 703)
  In gui_mainfcn (line 95)
  In cfg_ui (line 53)
Warning: Guessed additional cardiac pulse at time series end for phase estimation 
> In tapas_physio_log (line 55)
  In tapas_physio_get_cardiac_phase (line 61)
  In tapas_physio_create_retroicor_regressors (line 90)
  In tapas_physio_main_create_regressors (line 287)
  In tapas_physio_cfg_matlabbatch>run_physio (line 1520)
  In cfg_run_cm (line 29)
  In cfg_util>local_runcj (line 1688)
  In cfg_util (line 959)
  In cfg_ui>MenuFileRun_Callback (line 703)
  In gui_mainfcn (line 95)
  In cfg_ui (line 53)

For some participants and tasks we might get either warning or both. What do they mean? Should we be worried about them?

We have noticed that the gradient data is missing (the values are zero) in certain sections of the physio log or sometimes completely missing, and we will get one or both of the above warnings. When the gradient is missing, what does the PhysIO toolbox do? Does it fall back to the nominal method, and are the results reliable in this case?

Some of these warnings could be eliminated by changing the gradient_log.zero and gradient_log.slice parameters. We have also noticed that changing these parameters will yield completely uncorrelated regressors for the cardiac parameters, and the same is true for using the nominal method versus the gradient data. How should we set the gradient_log.zero and gradient_log.slice parameters for the best results? They are mentioned in the FAQ, but there's no explanation on how to set them optimally.

cannot include motion regressors when running PhysIO from matlab script?

Hi,

I have been playing around with the PhysIO toolbox both through the SPM GUI and edited versions of the provided example Matlab scripts.

When I input the rp*.txt file as another multiple regressor through the SPM batch system, it is added to the end of the RETROICOR regressors in the output multiple_regressors.txt file. I am then able to use the super-helpful tapas_physio_report_contrasts and tapas_physio_compute_tsnr_gains commands with no issue (for some reason, the report_contrasts command assumes that my GLM includes the movement parameters, otherwise I get an error that the contrast vectors are too long for my specified model).

However, when I went to adapt one of the example scripts to match my input, the output multiple_regressors.txt file does not include the movement parameters as the last 6 regressors, despite the rp*.txt file being specified under model.input_other_multiple_regressors.

I tried comparing the script generated by the SPM batch system with the provided example scripts, but it looks as if the physio structure is built differently depending on whether I use the SPM batch system or the matlab scripts.

Am I just missing something really obvious in specifying the structure via the scripts?

Thanks in advance,

suzanne

Cannot download HGF Toolbox from TNU website

I am trying to download the HGF toolbox from the TNU website but the downloads page of TAPAS seems to be unavailable. Is there any other way that I can download the toolbox? Thank you in advance! Best, Imca

PhysIO - errors when including Noise ROIs module

Hi,

I was playing around with adding the aCompCor (Noise ROIs) module in addition to the RETROICOR in the SPM batch GUI. I am using the realigned files as the fMRI input and a single WM+CSF segmentation file coregistered to the fMRI files as the Noise ROI image input (per the Behzadi 2007 paper).

When I go to run the batch, I keep getting one of three error messages when the toolbox reaches the Noise ROI step:

  1. If I keep the number of principal components set to the default of 1, then I get an error using horzcat, "Dimensions of matrices being concatenated are not consistent."
  2. If I set the number of components >1, 'Index exceeds matrix dimensions' error. This error seems to occur for any number of components >1 (iterated up to 10).
  3. I finally, tried specifying a float (0.95) to let the toolbox determine the number of components. This resulted in the error message, "In an assignment A(:)=B, the number of elements in A and B must be the same".

I was able to get a bit more information about where the error is occurring by running this as a script directly from matlab:

Error in tapas_physio_create_noise_rois_regressors (line 171)
R = [R, COEFF(:,1:nComponents)];

Error in tapas_physio_main_create_regressors (line 307)
[noise_rois_R, model.noise_rois, verbose] =
tapas_physio_create_noise_rois_regressors(...

There is not a lot of documentation about adding any of the other modules other than RETROICOR, so I am not sure how best to proceed.

Thanks in advance,

suzanne

Interpretation of HGF output

Dear Dr Mathys,

I am a complete novice in computational modelling and the HGF and have been struggling to understand what some of the Greek symbols represent in the model output when fitting the HGF to some practice, continuous data. For example, in the 'p_prc' output file (mu_0, sigma_0, rho, om, pi_u etc) and in the 'traj' output file (e.g. muhat, sigma hat etc).
Would you be able to explain what these symbols, or some of the key symbols, represent in the model?

Thank you so much for your kind help,

Chantal

Scan Timing from gradient in Philip scanner

From a user:

Dear Dr. Kasper,

I am using Tapas for my analysis and I would like to get the scanner timing information. I had total 355 volumes, (34 slices ), although the spacing in volumes seems correct I am only able to get 330 volumes.

I have attached the Matlab figure and the screenshot of the figure, It would be great if you can suggest if the thresholding and spacing are required to change or should I proceed with the nominal setting?

gradienttimecourse

PhysIO toolbox error (gausswin/findpeaks)

From a User:

Dear Dr. Kasper,

I’m using the PhysIO toolbox to obtain regressors files that i use during my spm analysis. When i run the batch (that worked previously with other files), i obtain two errors and i don’t understand why they appear now given that the batch has worked very well with other similar data.

Here are the errors :
Failed 'TAPAS PhysIO Toolbox'
Undefined function 'gausswin' for input arguments of type 'double'.
In file "C:\Users\nabila brihmat\Documents\programs\spm12\toolbox\PhysIO\tapas_physio_findpeaks_template_correlation.m" (v787), function "tapas_physio_findpeaks_template_correlation" at line 180.
In file "C:\Users\nabila brihmat\Documents\programs\spm12\toolbox\PhysIO\tapas_physio_get_cardiac_pulses_auto_matched.m" (???), function "tapas_physio_get_cardiac_pulses_auto_matched" at line 72.
In file "C:\Users\nabila brihmat\Documents\programs\spm12\toolbox\PhysIO\tapas_physio_get_cardiac_pulses.m" (???), function "tapas_physio_get_cardiac_pulses" at line 88.
In file "C:\Users\nabila brihmat\Documents\programs\spm12\toolbox\PhysIO\tapas_physio_main_create_regressors.m" (???), function "tapas_physio_main_create_regressors" at line 159.
In file "C:\Users\nabila brihmat\Documents\programs\spm12\toolbox\PhysIO\tapas_physio_cfg_matlabbatch.m" (???), function "run_physio" at line 1463.

Failed 'TAPAS PhysIO Toolbox'
Undefined function 'generatemsgid' for input arguments of type 'char'.
In file "C:\Users\nabila brihmat\Documents\programs\spm12\toolbox\PhysIO\tapas_physio_findpeaks.m" (???), function "getPeaksAboveMinPeakHeight" at line 127.
In file "C:\Users\nabila brihmat\Documents\programs\spm12\toolbox\PhysIO\tapas_physio_findpeaks.m" (???), function "tapas_physio_findpeaks" at line 54.
In file "C:\Users\nabila brihmat\Documents\programs\spm12\toolbox\PhysIO\tapas_physio_rescale_gradient_gain_fluctuations.m" (???), function "tapas_physio_rescale_gradient_gain_fluctuations" at line 66.
In file "C:\Users\nabila brihmat\Documents\programs\spm12\toolbox\PhysIO\tapas_physio_create_scan_timing_from_gradients_philips.m" (???), function "tapas_physio_create_scan_timing_from_gradients_philips" at line 177.
In file "C:\Users\nabila brihmat\Documents\programs\spm12\toolbox\PhysIO\tapas_physio_create_scan_timing.m" (???), function "tapas_physio_create_scan_timing" at line 85.
In file "C:\Users\nabila brihmat\Documents\programs\spm12\toolbox\PhysIO\tapas_physio_main_create_regressors.m" (???), function "tapas_physio_main_create_regressors" at line 139.
In file "C:\Users\nabila brihmat\Documents\programs\spm12\toolbox\PhysIO\tapas_physio_cfg_matlabbatch.m" (???), function "run_physio" at line 1463.

would you have any idea of the cause of these errors ?

Thanks in advance for your response,
Best regards,

Nabila

MATLAB Code for rDCM

Hi,

I am interested in using rDCM to calculate whole brain effective connectivity using DCM for controls vs patients.

I was wondering if I can get access to MATLAB code and basic instructions on this topic. I am familiar with basic DCM steps but not sure how to perform whole brain DCM.

I would really appreciate any directions on this topic.

Thanks a lot !
Sahil

2-level HGF for binary inputs

Dear Dr. Mathys,

I am trying to use the 2-level version of HGF for binary inputs. What I am doing is to modify the [c.mu_0mu; c.logsa_0mu; c.logkamu; c.ommu] in tapas_hgf_binary_config.m to fix the third level to 0. Is that correct? should I do something else? Or do you have a sample script for the 2-level HGF? I am just wondering whether what I am doing is correct or not.

Thank you very much in advance,

Best,
Bin

PhysIO, error in `tapas_physio_findpeaks_template_correlation (line 210)`

Hello,

I encountered an error that I cannot easily find a fix. Here is the error output:

No scan trigger events provided
    maxscan (incl. dummies) = 426 
    tmin (1st scan start (1st dummy))=   0.00 s
    tmin (1st scan start (after dummies))=   0.00 s
    tmax = 617.60 s 
    mean TR =   1.45 s

Warning: Guessed additional cardiac pulse at time series start for phase estimation 
> In tapas_physio_log (line 55)
  In tapas_physio_get_cardiac_phase (line 50)
  In tapas_physio_create_retroicor_regressors (line 90)
  In tapas_physio_main_create_regressors (line 287) 
Warning: Ignoring extra legend entries. 
> In legend>set_children_and_strings (line 658)
  In legend>make_legend (line 334)
  In legend (line 282)
  In tapas_physio_get_cardiac_pulse_template (line 210)
  In tapas_physio_get_cardiac_pulses_auto_matched (line 56)
  In tapas_physio_get_cardiac_pulses (line 88)
  In tapas_physio_rvt (line 68)
  In tapas_physio_create_rvt_regressors (line 55)
  In tapas_physio_main_create_regressors (line 318) 
Subscript indices must either be real positive integers or logicals.

Error in tapas_physio_findpeaks_template_correlation (line 210)
        amplitudeWeight = abs(cPadded(n+searchPosition+1));

Error in tapas_physio_get_cardiac_pulses_auto_matched (line 72)
            c, pulseCleanedTemplate, cpulseSecondGuess, averageHeartRateInSamples, ...

Error in tapas_physio_get_cardiac_pulses (line 88)
                    tapas_physio_get_cardiac_pulses_auto_matched( ...

Error in tapas_physio_rvt (line 68)
timeRpulseMax = tapas_physio_get_cardiac_pulses(t, fr, ...

Error in tapas_physio_create_rvt_regressors (line 55)
rvt = tapas_physio_rvt(ons_secs.fr, ons_secs.t, sample_points, verbose);

Error in tapas_physio_main_create_regressors (line 318)
            [convRVT, ons_secs.rvt, verbose] = tapas_physio_create_rvt_regressors(...

It seems like tapas_physio_findpeaks_template_correlation is producing an error, due to searchPosition (half of the averageHeartRateINSamples) being absolutely larger than n variable (bestPosition), resulting in a negative index. Perhaps an unusually high averageHeartRateInSamples ?

Files:

sub-s023.zip

BUG: PhysIO, Error in tapas_physio_crop_scanphysevents_to_acq_window

I was trying out the new BIDS support in the development branch. I have a remaining issue with one run. The following error pops up:

TR = 1.450 +/- 0.010 s (Estimated mean +/- std time of repetition for one volume)
Index exceeds array bounds.

Error in tapas_physio_crop_scanphysevents_to_acq_window (line 87)
if ~isempty(r),  r      = r(acqwindow); end;

Error in tapas_physio_main_create_regressors (line 215)
            [ons_secs, scan_timing.sqpar, verbose] = tapas_physio_crop_scanphysevents_to_acq_window(...

Here is the data and script I used:
physio_s038_r06.zip

I think this is because first trigger actually occurs before physio recordings began (as indicated by positive value in the json file). With this subject we accidentally didnt start recording before starting the run. I worked out manually exact time when it should have occured. The new development version cannot handle this for some reason.

Question: HGF Demo binary input semantics

Hi all,

I'm a novice in computational approaches to cognition and am going through the HGF toolbox demo. I had a bit of confusion in regards to what the binary input mapped onto in the Iglesias et al piece. My guess is that they don't have any intrinsic relation to the stimuli, but rather a "1" is either a face or house depending on which cue (high/low tone) is presented on that trial of the task. This is the only way for me to make sense of the transition of contingency rates noted in Dr. Mathys' video tutorial on the HGF demo (unless I'm assuming something incorrectly about the frequency of outcomes -- e.g., if "1s" are faces, is seems the first 50 or so trials seems are overwhelmingly faces).

Thanks in advance for your time & assistance,
Paul

Signal Processing Toolbox - needed?

Function tapas/PhysIO/code/utils/tapas_physio_findpeaks.m employs the findpeaks function from the Signal Processing Toolbox in MATLAB. Is it really needed? I see the script has the comment:

% Finds local peaks in the data. Wrapper for Matlab's findpeaks, 
% with compatibility alternative, if no signal processing toolbox available

but I could not find this alternative, tapas_physio_findpeaks_compatible.m, in the archive:

https://www.tnu.ethz.ch/en/software/tapas/archive.html

Did I miss it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.