Skip to content
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

Error running PhysIO: Item matlabbatch: No repeat named physio #264

Open
LLouedKhen opened this issue May 2, 2024 · 4 comments
Open

Error running PhysIO: Item matlabbatch: No repeat named physio #264

LLouedKhen opened this issue May 2, 2024 · 4 comments
Assignees
Labels
physio Issues related to PhysIO Toolbox

Comments

@LLouedKhen
Copy link

Hi,
I would like to create physiological regressors using a script but it keep crashing with the following message:
error: Item matlabbatch: No repeat named physio

The same batch works fine in the GUI, although I have to manually add the TAPAS toolbox to the gui Batch. TAPAS doesn't otherwise appear in the options under tools in the GUI.
I have used TAPAS PhysIO before in preprocessing pipeline but I don't recall running into this problem.

I am running scripts on SPM12 (updated), Matlab 2023a.

Here is my code:

for i = 1:length(subjects)
    thisPhysPath = physPaths{i};
    cd(thisPhysPath)
    physFiles = dir('Sess*');
    physFile1 = physFiles(1).name;
    physFile2 = physFiles(2).name;
    thisMRPath1 = imgPaths1{i};
    thisMRPath2 = imgPaths2{i};
    thisNScan1 = imgNum1(i);
    thisNScan2 = imgNum2(i);
    for r = 1:2
        if r == 1
            physFile = physFile1;
            epifolder = thisMRPath1;
            nscans = thisNScan1;

        elseif r == 2
            physFile = physFile2;
            epifolder = thisMRPath2;
            nscans = thisNScan2;
        end
        spm('Defaults','fMRI');
        spm_jobman('initcfg');
        matlabbatch{1}.physio.log_files.vendor = 'Biopac_Mat';
        matlabbatch{1}.physio.log_files.cardiac = physFile;
        matlabbatch{1}.physio.log_files.respiration = physFile;
        matlabbatch{1}.physio.log_files.scan_timing = {''};
        matlabbatch{1}.physio.log_files.sampling_interval = [];
        matlabbatch{1}.physio.log_files.relative_start_acquisition = 0;
        matlabbatch{1}.physio.log_files.align_scan = 'last';
        matlabbatch{1}.physio.scan_timing.sqpar.Nslices = 40;
        matlabbatch{1}.physio.scan_timing.sqpar.NslicesPerBeat = [];
        matlabbatch{1}.physio.scan_timing.sqpar.TR = 2.48;
        matlabbatch{1}.physio.scan_timing.sqpar.Ndummies = 0;
        matlabbatch{1}.physio.scan_timing.sqpar.Nscans = nscans;
        matlabbatch{1}.physio.scan_timing.sqpar.onset_slice = 20;
        matlabbatch{1}.physio.scan_timing.sqpar.time_slice_to_slice = [];
        matlabbatch{1}.physio.scan_timing.sqpar.Nprep = [];
        matlabbatch{1}.physio.scan_timing.sync.nominal = struct([]);
        matlabbatch{1}.physio.preproc.cardiac.modality = 'ECG';
        matlabbatch{1}.physio.preproc.cardiac.filter.no = struct([]);
        matlabbatch{1}.physio.preproc.cardiac.initial_cpulse_select.auto_matched.min = 0.4;
        matlabbatch{1}.physio.preproc.cardiac.initial_cpulse_select.auto_matched.file = 'initial_cpulse_kRpeakfile.mat';
        matlabbatch{1}.physio.preproc.cardiac.initial_cpulse_select.auto_matched.max_heart_rate_bpm = 90;
        matlabbatch{1}.physio.preproc.cardiac.posthoc_cpulse_select.off = struct([]);
        matlabbatch{1}.physio.preproc.respiratory.filter.passband = [0.01 2];
        matlabbatch{1}.physio.preproc.respiratory.despike = false;
        matlabbatch{1}.physio.model.output_multiple_regressors = 'multiple_regressors.txt';
        matlabbatch{1}.physio.model.output_physio = ['physio', num2str(r), '.mat'];
        matlabbatch{1}.physio.model.orthogonalise = 'none';
        matlabbatch{1}.physio.model.censor_unreliable_recording_intervals = false;
        matlabbatch{1}.physio.model.retroicor.yes.order.c = 3;
        matlabbatch{1}.physio.model.retroicor.yes.order.r = 4;
        matlabbatch{1}.physio.model.retroicor.yes.order.cr = 1;
        matlabbatch{1}.physio.model.rvt.no = struct([]);
        matlabbatch{1}.physio.model.hrv.no = struct([]);
        matlabbatch{1}.physio.model.noise_rois.no = struct([]);
        matlabbatch{1}.physio.model.movement.no = struct([]);
        matlabbatch{1}.physio.model.other.no = struct([]);
        matlabbatch{1}.physio.verbose.level = 2;
        matlabbatch{1}.physio.verbose.fig_output_file = '';
        matlabbatch{1}.physio.verbose.use_tabs = false;
        save('matlabbatch');
       
        spm_jobman('run',matlabbatch);
       

        copyfile('multiple_regressors.txt', 'epiFolder')
        copyfile('physio.mat', 'epiFolder')

        clear;clc

    end
end

Thank you so much for your help.
Best,
Leyla

@mrikasper
Copy link
Member

Dear Leyla,

Could you please try to replace matlabbatch{1}.physio by matlabbatch{1}.spm.tools.physio in all lines of your script?

All the best,
Lars

@mrikasper mrikasper self-assigned this May 2, 2024
@mrikasper mrikasper added the physio Issues related to PhysIO Toolbox label May 2, 2024
@LLouedKhen
Copy link
Author

LLouedKhen commented May 3, 2024 via email

@LLouedKhen
Copy link
Author

LLouedKhen commented May 3, 2024 via email

@mrikasper
Copy link
Member

mrikasper commented May 4, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
physio Issues related to PhysIO Toolbox
Projects
Status: To do
Development

No branches or pull requests

2 participants