Import MRI MGH file, script

Hello!
I wanted to script automatical import of my MRI data, which is in the .mgz format, and when I do it manually I see the pop-up window asking me if I want to "Apply the standard transformation Freesurfer -> Brainstrom" and I want to say "NO", but when I try to generate a script from the import_mri process I don't see that it is an option. Is there a way to script this?
Thanks!
Julie

Hi Julie, when the .mgz is imported with a script using import_mri.m it applies the "Apply the standard transformation Freesurfer -> Brainstrom", the option to opt out is only presented for the interactive case.

A walkaround this limitation is to read the .mgz file without the transformations, save it in a new file, and import the new file:

% MRI files 
mriMgzFile = 'T1.mgz';               % Original MGZ file
mriBstFile = 'subjectimage_T1.mat';  % Temporary Brainstorm MRI file to be created

% Read MGZ without transformations 
isApplyBst     = 0;
isApplyVox2ras = 0; 
[sMri, vox2ras, tReorient] = in_mri_mgh(mriFile, isApplyBst, isApplyVox2ras);
%    - MriFile    : full path to a MRI file, WITH EXTENSION
%    - isApplyBst : If 1, apply best orientation found to match Brainstorm convention
%                   considering that the volume is aligned as the standard T1.mgz in the 
%                   FreeSurfer output folder.
%    - isApplyVox2ras : Apply additional transformation to the volume

% Save as MRI as Brainstorm MRI file
out_mri_bst(sMri, mriBstFile);

% Process: Import MRI
bst_process('CallProcess', 'process_import_mri', [], [], ...
    'subjectname', 'NewSubject', ...
    'mrifile',     {mriBstFile, 'BST'}, ...
    'nas',         [0, 0, 0], ...
    'lpa',         [0, 0, 0], ...
    'rpa',         [0, 0, 0], ...
    'ac',          [0, 0, 0], ...
    'pc',          [0, 0, 0], ...
    'ih',          [0, 0, 0]);

Great! thanks a lot Raymundo!!