[FieldTrip] trial error

Evelyne Fraats e.fraats at kpnmail.nl
Fri Jun 9 15:03:49 CEST 2023


Dear all,

 

My name is Evelyne and I am just started to explore fieldtrip.

I use fieldtrip to define trials in physiological recordings to estimate
physiological regressors for MRI preprocessing. 

However, when using the physio toolbox, no trials are detected within my
data.

When I run the separate ft_definetrial function, I get trials, but I seem to
fail to include this in my matlabbatch.

This is my output with error message:

 

evaluating trial function 'ft_trialfun_general'

reading the header from
'/home/affneu/evefra/Spinalcord/data/Physio/subx19_new_threat_SPINAL.vhdr'

reading the events from
'/home/affneu/evefra/Spinalcord/data/Physio/subx19_new_threat_SPINAL.vhdr'

found 169 events

created 20 trials

the call to "ft_definetrial" took 0 seconds and required the additional
allocation of an estimated 0 MB

Item model: No field(s) named

event

 

 

------------------------------------------------------------------------

09-Jun-2023 15:02:40 - Running job #41

------------------------------------------------------------------------

09-Jun-2023 15:02:40 - Running 'TAPAS PhysIO Toolbox'

Warning: cfg.trialdef.eventtype='?' is deprecated, please specify
cfg.trialfun='ft_trialfun_show' 

evaluating trial function 'ft_trialfun_show'

reading the events from
'/home/affneu/evefra/Spinalcord/data/Physio/subx19_new_threat_SPINAL.vhdr'

the following events were found in the data

event type: 'New Segment' 

with event values: 

 

event type: 'Response' 

with event values: 'R  1' 

 

event type: 'Stimulus' 

with event values: 'S  1' 'S 97' 

 

no trials have been defined yet, see FT_DEFINETRIAL for further help

found 169 events

the call to "ft_definetrial" took 0 seconds and required the additional
allocation of an estimated 0 MB

evaluating trial function 'ft_trialfun_general'

reading the header from
'/home/affneu/evefra/Spinalcord/data/Physio/subx19_new_threat_SPINAL.vhdr'

reading the events from
'/home/affneu/evefra/Spinalcord/data/Physio/subx19_new_threat_SPINAL.vhdr'

09-Jun-2023 15:02:41 - Failed  'TAPAS PhysIO Toolbox'

Error using ft_definetrial

no trials were defined, see FT_DEFINETRIAL for help

 

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)

------------------

Running job #41

------------------

 

 

This is my code:

 

if physio_regressor == 1

        %cd /home/affneu/evefra/Spinalcord/data/Physio/ 

        %define log input

        data_path_physio = fullfile(data_path, 'Physio');

        data_path_physio_sub = dir(fullfile(data_path_physio,
sprintf('subx%d*threat*.eeg', sub))) ; %CHANE FORMAT       

        filenames = {data_path_physio_sub.name};

        filenames = filenames';  

        filefolder = {data_path_physio_sub.folder};

        filefolder = filefolder';

        filename_folder = cellfun(@(folder, name) fullfile(folder, name),
filefolder, filenames, 'UniformOutput', false);

 

        %define vhdr

        data_path_physio_sub = dir(fullfile(data_path_physio,
sprintf('subx%d*threat*.vhdr', sub))) ; %CHANE FORMAT       

        filenames = {data_path_physio_sub.name};

        filenames = filenames';  

        filefolder = {data_path_physio_sub.folder};

        filefolder = filefolder';

        filename_folder_vhdr = cellfun(@(folder, name) fullfile(folder,
name), filefolder, filenames, 'UniformOutput', false);

 

        %define vmkr

        data_path_physio_sub = dir(fullfile(data_path_physio,
sprintf('subx%d*threat*.vmrk', sub))) ; %CHANE FORMAT       

        filenames = {data_path_physio_sub.name};

        filenames = filenames';  

        filefolder = {data_path_physio_sub.folder};

        filefolder = filefolder';

        filename_folder_vmrk = cellfun(@(folder, name) fullfile(folder,
name), filefolder, filenames, 'UniformOutput', false);

 

        %define trials

        cfg = [];

        cfg.headerfile = char(filename_folder_vhdr);

        cfg.eventfile = char(filename_folder_vmrk);

        cfg.trialdef.eventtype = 'Stimulus';  

        cfg.trialdef.eventvalue = 'S  1';   

        cfg.trialdef.prestim = 0;             

        cfg.trialdef.poststim = 0; 

        %cfg.trialfun = 'ft_trialfun_show';

        trials = ft_definetrial(cfg);

        

 

      

        %run regressor estimation

               

        clear matlabbatch

        matlabbatch{1}.spm.tools.physio.save_dir =
{fullfile(data_path_tos_brain,'physio_regressors')};

        matlabbatch{1}.spm.tools.physio.log_files.vendor = 'BrainProducts';

        matlabbatch{1}.spm.tools.physio.log_files.cardiac = filename_folder;

        matlabbatch{1}.spm.tools.physio.log_files.respiration =
filename_folder;

        matlabbatch{1}.spm.tools.physio.log_files.scan_timing = {''};

        matlabbatch{1}.spm.tools.physio.log_files.sampling_interval = [];

        matlabbatch{1}.spm.tools.physio.log_files.relative_start_acquisition
= 0;

        matlabbatch{1}.spm.tools.physio.log_files.align_scan = 'last';

        matlabbatch{1}.spm.tools.physio.scan_timing.sqpar.Nslices = 44;

        matlabbatch{1}.spm.tools.physio.scan_timing.sqpar.NslicesPerBeat =
[];

        matlabbatch{1}.spm.tools.physio.scan_timing.sqpar.TR = 3.39;

        matlabbatch{1}.spm.tools.physio.scan_timing.sqpar.Ndummies = 0;

        matlabbatch{1}.spm.tools.physio.scan_timing.sqpar.Nscans = 147;

        matlabbatch{1}.spm.tools.physio.scan_timing.sqpar.onset_slice = 1;

 
matlabbatch{1}.spm.tools.physio.scan_timing.sqpar.time_slice_to_slice = [];

        matlabbatch{1}.spm.tools.physio.scan_timing.sqpar.Nprep = [];

        matlabbatch{1}.spm.tools.physio.scan_timing.sync.nominal =
struct([]);

        matlabbatch{1}.spm.tools.physio.preproc.cardiac.modality = 'ECG';

        matlabbatch{1}.spm.tools.physio.preproc.cardiac.filter.no =
struct([]);

 
matlabbatch{1}.spm.tools.physio.preproc.cardiac.initial_cpulse_select.auto_m
atched.min = 0.4;

 
matlabbatch{1}.spm.tools.physio.preproc.cardiac.initial_cpulse_select.auto_m
atched.file = 'initial_cpulse_kRpeakfile.mat';

 
matlabbatch{1}.spm.tools.physio.preproc.cardiac.initial_cpulse_select.auto_m
atched.max_heart_rate_bpm = 90;

 
matlabbatch{1}.spm.tools.physio.preproc.cardiac.posthoc_cpulse_select.off =
struct([]);

        matlabbatch{1}.spm.tools.physio.preproc.respiratory.filter.passband
= [0.01 2];

        matlabbatch{1}.spm.tools.physio.preproc.respiratory.despike = false;

        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.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 = '';

        matlabbatch{1}.spm.tools.physio.verbose.use_tabs = false;

        matlabbatch{1}.spm.tools.physio.model.event.trials =
trials.trl(:,1);

 

        spm_jobman('run', matlabbatch)

    end

 

 

If anybody has some tips, it would be greatly appreciated.

Best,
Evelyne

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230609/347fff99/attachment.htm>


More information about the fieldtrip mailing list