Error SSP: Heartbeats

Hello,

When I try to compute SSP: Heartbeats on link raw file, I get an error in panel_ssp_selection.m:


** Error: Line 691: Attempted to access Singular(9); index out of bounds because numel(Singular)=8.
**
** Call stack:
** >panel_ssp_selection.m>UpdateComp at 691
** >panel_ssp_selection.m>OpenRaw at 622
** >bst_call.m at 28
** >macro_methodcall.m at 39
** >panel_ssp_selection.m at 26
** >panel_record.m>CallProcessOnRaw at 2377
** >panel_record.m>@(h,ev)CallProcessOnRaw(‘process_ssp_ecg’) at 180
**


I think the problem appears, when Singular has less 10 elements, but this code trying to display not less 10 elements:
if (length(sCat.CompMask) > 1)
% ICA: Show all components
if isICA
iDispComp = 1:size(sCat.Components,2);
% PCA: Get only the components that grab 95% of the signal
else
Singular = sCat.SingVal ./ sum(sCat.SingVal);
iDispComp = union(1, find(cumsum(Singular)<=.95));
% Keep only the first components
iDispComp = intersect(iDispComp, 1:20);
% Always show at least the 10 first components
iDispComp = union(iDispComp, 1:10); % <----- not less 10 elements
end
% Add all the components
for i = iDispComp
strComp = sprintf(‘Component #%d’, i);
if ~isempty(sCat.SingVal) && ~isICA
strComp = [strComp, sprintf(’ [%d%%]’, round(100 * Singular(i)))]; % <----- try to display 10 elements
end
listModel.addElement(BstListItem(’’, ‘’, strComp, int32(sCat.CompMask(i))));
end
else
listModel.addElement(BstListItem(’’, ‘’, ‘Single component’, int32(2)));
end

p.s. Sorry for my english.

Hello,

Thanks for reporting this. I replaced the line
iDispComp = union(iDispComp, 1:10);
with:
iDispComp = union(iDispComp, 1:min(10,length(Singular)));

But I’m not sure why you have only 8 components here. It means that you only have only 8 sensors…?
The SSP approach can work only with MEG systems or high density EEG.
And if these are not MEG recordings, you probably don’t have a lot of cardiac contamination.

For more information, read the new set of online tutorials:
http://neuroimage.usc.edu/brainstorm/TutorialsNew

Francois

I have the same problem:


** Error: [process_ssp] Artifacts > SSP: Generic
** Line 527: Attempted to access F.%cell(:,451); index out of bounds because size(F.%cell)=[330,193].
**
** Call stack:
** >process_ssp2.m>Run at 527
** >process_ssp2.m at 29
** >process_ssp.m>Run at 117
** >process_ssp.m at 26
** >bst_process.m>Run at 229
** >bst_process.m at 36
** >panel_process_select.m>ShowPanel at 2645
** >panel_process_select.m at 30
** >panel_record.m>CallProcessOnRaw at 2437
** >panel_record.m>@(h,ev)CallProcessOnRaw('process_ssp') at 192
**
**
** File: MNI0001/@rawMNI0001_MEGs0003_resting_20121128_01_AUX/data_0raw_MNI0001_MEGs0003_resting_20121128_01_AUX.mat
**


Attached is the process and parameters.

This is a different issue that happens when you use the average SSP method and apply a bandpass filter at the same time.

@Francois: in process_ssp2.m, line 527, the iTimeZero index is computed before removing the transients from F, so the index will go out of bounds after removing the transients. Not sure what the best fix would be as the iTimeZero index might end up being removed with the transients…

Does this modification solves the issue?

Works on my end, thanks!