How to Use 'Find Maximum' in mirviewer with Scripting

Hello,

After performing sLORETA and analyzing the power spectral density (PSD), I would like to obtain Find Maximum images for each frequency band using mirviewer.

Could you please let me know how to do this via scripting, or if there is a recommended workflow?

Thank you in advance!

Hello @elbrain,

You can do so with the following script:

%% Input 

% PSD file (source space)
psdFile = 'Subject01/S01_AEF_20131218_01_600Hz_notch/timefreq_psd_250616_1010.mat';

%% Get voxel coordinates for maximum

% Get MRI file
sStudy = bst_get('AnyFile', psdFile);
sSubject = bst_get('Subject', sStudy.BrainStormSubject);
MriFile = sSubject.Anatomy(sSubject.iAnatomy).FileName;

% Plot PSD data on MRI
hFig = view_mri(MriFile, psdFile);

% Find maximum and go to location
figure_mri('JumpMaximum', hFig);

% Get location coordinats
sMri = panel_surface('GetSurfaceMri', hFig);
Handles = bst_figures('GetFigureHandles', hFig);

% Get location in voxels
voxXYZ = figure_mri('GetLocation', 'voxel', sMri, Handles);
disp(voxXYZ) % [voxels]

% Get location in SCS
scsXYZ = figure_mri('GetLocation', 'SCS', sMri, Handles) * 1000;
disp(scsXYZ) % [mm]
1 Like