sccn / EEG-BIDS

21 stars 17 forks source link

Homogenize 'sessions' and 'bidstask' parameters in pop_importbids #165

Closed crisglav closed 3 months ago

crisglav commented 1 year ago

If I specify in pop_importbids the parameter sessions as {'baseline'} instead of {'ses-baseline'} I get an error in https://github.com/sccn/bids-matlab-tools/blob/01d140cd7534348304c513d3e1a5ddaee9d86b44/pop_importbids.m#L247

It would be solved if that line was changed to subFolders = subFolders(contains(subFolders, opt.sessions));

I think it is more intuitive to specify only the name of the session (withoy the 'ses-'). Currently, the task parameter is specified as a string and the session as a cell array, it would also be nice to homogenize both parameters.

arnodelorme commented 1 year ago

contains will not cut it here (what if you have two session 'rest' and 'rest2' -- if you specify 'rest' then both session will be imported). This said, we could test for the presence of the prefix 'ses-' and add it if it is missing

for iSess = 1:length(opt.sessions)
     if ~contains(opt.sessions, 'ses-')
            opt.sessions{iSess} = [ 'ses-'  opt.sessions{iSess} ];
     end
end

@dungscout96 would you mind to effect that change?

crisglav commented 1 year ago

Thanks for looking at it! That should work too.

dungscout96 commented 3 months ago

We no longer require session input to contain 'ses-'. Let us know if you still find the issue.