This is an automated email from the git hooks/post-receive script.

uecker-guest pushed a commit to annotated tag v0.2.09d
in repository bart.

commit 67660b3f36721c4955a06c9e2a6acc2e99232520
Author: Martin Uecker <muec...@gwdg.de>
Date:   Sun Dec 6 14:06:58 2015 +0100

    make bart matlab script look for system-wide bart
---
 matlab/bart.m | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/matlab/bart.m b/matlab/bart.m
index 638bec9..b26bed8 100644
--- a/matlab/bart.m
+++ b/matlab/bart.m
@@ -2,10 +2,18 @@ function [varargout] = bart(cmd, varargin);
 % BART Call BART command from Matlab.
 %   [A B] = bart('command', X Y) call command with inputs X Y and outputs A B
 %
-% 2014-2015 Martin Uecker <uec...@eecs.berkeley.edu>
+% 2014-2015 Martin Uecker <uec...@med.uni-goettingen.de>
 
-       if isempty(getenv('TOOLBOX_PATH'))
-               error('Environment variable TOOLBOX_PATH is not set.');
+       bart_path = getenv('TOOLBOX_PATH');
+
+       if isempty(bart_path)
+               if exist('/usr/local/bin/bart', 'file')
+                       bart_path = '/usr/local/bin';
+               elseif exist('/usr/bin/bart', 'file')
+                       bart_path = '/usr/bin';
+               else
+                       error('Environment variable TOOLBOX_PATH is not set.');
+               end
        end
 
        % clear the LD_LIBRARY_PATH environment variable (to work around
@@ -39,12 +47,12 @@ function [varargout] = bart(cmd, varargin);
        if ispc
                % For cygwin use bash and modify paths
                ERR = system(['bash.exe --login -c ', ...
-                       strrep(getenv('TOOLBOX_PATH'), filesep, '/'), ...
+                       strrep(bart_path, filesep, '/'), ...
                        '"', '/bart ', strrep(cmd, filesep, '/'), ' ', ...
                        strrep(in_str, filesep, '/'), ...
                        ' ', strrep(out_str, filesep, '/'), '"']);
        else
-               ERR = system([getenv('TOOLBOX_PATH'), '/bart ', cmd, ' ', 
in_str, ' ', out_str]);
+               ERR = system([bart_path, '/bart ', cmd, ' ', in_str, ' ', 
out_str]);
        end
 
        if ERR~=0

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/debian-med/bart.git

_______________________________________________
debian-med-commit mailing list
debian-med-commit@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit

Reply via email to