Skip to content

Commit

Permalink
add SPM to the path (defaults to spm12, just like ft_read_mri)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertoostenveld committed Mar 20, 2024
1 parent bf53448 commit 82112af
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions utilities/ft_convert_coordsys.m
Expand Up @@ -75,6 +75,12 @@
method = ft_getopt(varargin, 'method'); % default is handled below
templatefile = ft_getopt(varargin, 'template'); % default is handled in the SPM section
feedback = ft_getopt(varargin, 'feedback', 'no');
spmversion = ft_getopt(varargin, 'spmversion');

% use the version that is on the path, or default to spm12
if ~ft_hastoolbox('spm') && isempty(spmversion)
spmversion = 'spm12';
end

if ~isfield(object, 'coordsys') || isempty(object.coordsys)
% determine the coordinate system of the input object
Expand Down Expand Up @@ -185,10 +191,8 @@
ft_error('affine or non-linear transformation require the anatomial MRI to be expressed in mm');
end

% the following requires SPM to be on the path. However, this is not the proper place to
% choose between SPM versions. The user can either use cfg.spmversion in a high-level
% function, or has to add the path to the desired SPM version by hand.
ft_hastoolbox('spm', -1);
% the following requires SPM to be on the path
ft_hastoolbox(spmversion, 1);
end

if method==1
Expand Down

0 comments on commit 82112af

Please sign in to comment.