runtracker.m 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. function runtracker(tracker_version)
  2. global Par
  3. if nargin < 1
  4. Par.tracker_version = 'default';
  5. else
  6. Par.tracker_version = tracker_version;
  7. end
  8. %clear and welcome message
  9. clc; fprintf('Starting Tracker. Please have some patience...\n');
  10. %what matlab version
  11. MatlabVersion = version;
  12. if str2double([MatlabVersion(1) MatlabVersion(3)]) == 95 % R2018
  13. Par.ML = 2018;
  14. elseif str2double([MatlabVersion(1) MatlabVersion(3)]) == 84 % R2014
  15. Par.ML = 2014;
  16. else % before R2014b
  17. Par.ML = 2013;
  18. end
  19. % Ask to select screen and configure accordingly
  20. % BOLD screen at 3T needs to be flipped
  21. % PTB will take care of this
  22. Par.ScreenChoice = questdlg('Which setup (3T/Mock/NIN)?', 'Select Setup',...
  23. '3T','Mock','NIN','Mock');
  24. % remember the startfolder
  25. Par.StartFolder = cd;
  26. % add scripts shared between projects
  27. addpath(genpath(fullfile(pwd,'SharedScripts')));
  28. % Add the log-folder as an environment variable
  29. if ispc % windows
  30. setenv('TRACKER_LOGS', 'C:\Users\NINuser\Documents\Logs');
  31. else % unix
  32. setenv('TRACKER_LOGS', fullfile(getenv('HOME'),'Desktop','Logs'));
  33. end
  34. [~,~,~] = mkdir(getenv('TRACKER_LOGS'));
  35. % Select our experiment folder
  36. cd TRACKER_PTB
  37. Par.ExpFolder = uigetdir(pwd,'Choose your experiment root-folder (contains Engine & Experiment folders)');
  38. if Par.ExpFolder
  39. % Add stuff to the path
  40. addpath(genpath(Par.ExpFolder));
  41. % Go to folder
  42. cd(Par.ExpFolder);
  43. % Run tracker
  44. Par.hTracker = tracker_CK; % standard light version of tracker
  45. Par.hTracker_ax=findobj(Par.hTracker,'Tag','axes1');
  46. if strcmp(Par.tracker_version, 'tracker_dark')
  47. set(Par.hTracker_ax,'Color','k');
  48. end
  49. else
  50. fprintf('You did not choose a valid Experiment folder. Exiting...\n')
  51. end