Changeset 78


Ignore:
Timestamp:
Feb 17, 2009, 3:00:56 PM (10 years ago)
Author:
tjniskan
Message:
  • Moved fMRI related plugins to their own subdirectories
  • Created a subdirectory for map calculation plugins and added a few

basic plugins for those. At the moment these plugins do not support
masking etc. and I didn't test them at all so be cautious...

  • Made a minor memory optimation to an2_readfid.m
  • Fixed a few issues in files related updating via SVN
  • Disabled some annoying warnings that Matlab R2008a and higher

generate from uitree and uitreenode functions inan2_juigetfiles.m

  • Coded something minor to an2_maptool.m. This is still stub and does

not work at all. Please don't try to use it.

  • Fixed a bug that caused Aedes to fail without generating an error

when reading VNMR FID-files that don't have PROCPAR in the same folder.

  • Fixed a javaFrame -warning (with R2008a and higher) in aedes.m

M an2_revision.m
M an2_data_read.m
M an2_maptool.m
M aedes.m
D plugins/calculate_t2_map.m
D plugins/calculate_t1r_map.m
D plugins/basic_fmri_analysis.m
D plugins/resting_state_fc.m
A plugins/fmri_plugins
A plugins/fmri_plugins/basic_fmri_analysis.m
A plugins/fmri_plugins/resting_state_fc.m
A plugins/map_plugins
A plugins/map_plugins/t2.m
A plugins/map_plugins/t1_3_parameter_fit.m
A plugins/map_plugins/t1_saturation_recovery.m
A plugins/map_plugins/t1_rho.m
A plugins/map_plugins/t2_rho.m
A plugins/map_plugins/t1_inversion_recovery.m
M an2_readfid.m
M an2_check_updates.m
M an2_juigetfiles.m
M an2_update.m

Files:
10 added
4 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • aedes.m

    r77 r78  
    43134313 
    43144314  H.OVERLAY_CONTROL_FIG = figure('units','pixel',...
    4315         'position',...
    4316         [fig_left fig_bottom ...
    4317         fig_w fig_h],...
    4318         'Name','Image Overlay Controls',...
    4319         'numbertitle','off',...
    4320         'Toolbar','none',...
    4321         'Color',FigColor,...
    4322         'Menubar','none',...
    4323         'DoubleBuffer','on',...
    4324         'DockControls','off',...
    4325         'renderer','painters',...
    4326         'resize','off',...
    4327         'CloseRequestFcn',{@l_OverlayControlCB,'close_window'},...
    4328         'Handlevisibility','off');
     4315    'position',...
     4316    [fig_left fig_bottom ...
     4317    fig_w fig_h],...
     4318    'Name','Image Overlay Controls',...
     4319    'numbertitle','off',...
     4320    'Toolbar','none',...
     4321    'Color',FigColor,...
     4322    'Menubar','none',...
     4323    'DoubleBuffer','on',...
     4324    'DockControls','off',...
     4325    'renderer','painters',...
     4326    'resize','off',...
     4327    'CloseRequestFcn',{@l_OverlayControlCB,'close_window'},...
     4328    'Handlevisibility','off');
     4329 
     4330  % Suppress warning from get(fh,'javaFrame') generated in Matlab R2008a->
     4331  matlab_version = version;
     4332  matlab_version = str2num(matlab_version(1:3));
     4333  if matlab_version>=7.6
     4334    warning('off','MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame');
     4335  end
    43294336 
    43304337  % Try to set the figure as floating i.e. "always on top"
    4331   try
    4332         % Matlab R2008a generates a warning from get(fh,'javaFrame'), suppress
    4333         % it with warning off
    4334         warning off
    4335         jf = get(H.OVERLAY_CONTROL_FIG,'javaFrame');
    4336         pause(0.1) % Make Matlab more stable...
    4337         wh = jf.fFigureClient.getWindow;
    4338         pause(0.1)
    4339         wh.setAlwaysOnTop(true);
    4340         pause(0.1)
    4341         warning on
    4342   catch
    4343         % Make sure that warnings are on
    4344         warning on
    4345   end
     4338  jf = get(H.OVERLAY_CONTROL_FIG,'javaFrame');
     4339  pause(0.1) % Make Matlab more stable...
     4340  wh = jf.fFigureClient.getWindow;
     4341  pause(0.1)
     4342  wh.setAlwaysOnTop(true);
     4343  pause(0.1)
    43464344                                                           
    43474345  uipanel_h = uipanel('parent',H.OVERLAY_CONTROL_FIG,...
     
    58825880    'closereq',@l_SaveTSfigPosition);
    58835881 
     5882  % Suppress warning from get(fh,'javaFrame') generated in Matlab R2008a->
     5883  matlab_version = version;
     5884  matlab_version = str2num(matlab_version(1:3));
     5885  if matlab_version>=7.6
     5886    warning('off','MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame');
     5887  end
     5888 
    58845889  % Try to set the figure as floating i.e. "always on top"
    5885   try
    5886     % Matlab R2008a generates a warning from get(fh,'javaFrame'), suppress
    5887     % it with warning off
    5888     warning off
    5889     jf = get(H.TSFIG,'javaFrame');
    5890     pause(0.1) % Make Matlab more stable...
    5891     wh = jf.fFigureClient.getWindow;
    5892     pause(0.1)
    5893     wh.setAlwaysOnTop(true);
    5894     pause(0.1)
    5895     warning on
    5896   catch
    5897     % Make sure that warnings are on
    5898     warning on
    5899   end
     5890  jf = get(H.TSFIG,'javaFrame');
     5891  pause(0.05) % Make Matlab more stable...
     5892  wh = jf.fFigureClient.getWindow;
     5893  pause(0.05)
     5894  wh.setAlwaysOnTop(true);
     5895  pause(0.05)
    59005896 
    59015897  H.TSAX = axes('parent',H.TSFIG,...
  • an2_check_updates.m

    r45 r78  
    1 function [isUpdateAvailable,HeadRev,WorkingCopyRev]=an2_check_updates()
     1function [isUpdateAvailable,HeadRev,WorkingCopyRev,error_msg]=an2_check_updates()
    22% AN2_CHECK_UPDATES - Check if Aedes updates are available
    33%
     
    3838isUpdateAvailable = false;
    3939HeadRev = [];
     40error_msg = '';
    4041
    4142% Get current revision and repository URL
     
    4849
    4950% Get head repository revision
    50 HeadRev=l_GetHeadRevision(repo);
     51[HeadRev,msg]=l_GetHeadRevision(repo);
    5152if isempty(HeadRev)
    5253  % Something wrong with running SVN commands. Perhaps SVN is not
    53   % installed?
    54 elseif HeadRev<0
    55   % Something wrong with detecting network. Perhaps not inside University
    56   % network or not connected to the network at all...
     54  % installed? Network problems?
     55  error_msg = msg;
    5756else
    5857  if rev<HeadRev
    59         isUpdateAvailable = true;
     58    isUpdateAvailable = true;
    6059  end
    6160end
     
    7069  msg = '';
    7170 
    72   % Try to determine if the computer is connected to the network and is
    73   % inside University network... If this checking fails and the user has no
    74   % network, the svn will wait for timeout...
    75   % Check if we are inside university firewalls
    76   if isunix
    77         % Unix/Linux
    78         [s,w]=unix('ifconfig');
    79         if ~isempty(w)
    80           ind = strfind(w,'inet addr:');
    81           if ~isempty(ind)
    82                 try
    83                   if ~strcmpi(w(ind(1)+10:ind(1)+16),'193.167')
    84                         HeadRev = -1;
    85                         return
    86                   end
    87                 catch
    88                   HeadRev = -1;
    89                   return
    90                 end
    91           else
    92                 HeadRev = -1;
    93                 return
    94           end
    95         else
    96           HeadRev = -1;
    97           return
    98         end
    99   elseif ispc
    100         % Windows
    101         [s,w]=dos('ipconfig');
    102         if isempty(findstr(w,'uku.fi'))
    103           HeadRev = -1;
    104           return
    105         end
    106   else
    107         % Mac OS X
    108   end
    109  
    110  
    11171  % Try to determine the head revision in svn
    11272  if isunix
    113         % Unix/Linux
    114         [s,w] = unix(['svn info ',repo_url]);
    115         if s~=0
    116           return
    117         end
     73    % Unix/Linux
     74    [s,w] = unix(['svn info ',repo_url]);
     75    if s~=0
     76      msg=w;
     77      return
     78    end
    11879  elseif ispc
    119         % Windows
    120         [s,w] = dos(['svn info ',repo_url]);
    121         if s~=0
    122           return
    123         end
     80    % Windows
     81    [s,w] = dos(['svn info ',repo_url]);
     82    if s~=0
     83      msg=w;
     84      return
     85    end
    12486  else
    125         % Mac OS X
     87    % Mac OS X
     88    [s,w] = unix(['svn info ',repo_url]);
     89    if s~=0
     90      msg=w;
     91      return
     92    end
    12693  end
    12794 
     
    12996  C=textscan(w,'%s','delimiter','\n');
    13097  if ~isempty(C)
    131         C=C{:};
     98    C=C{:};
    13299  else
    133         return
     100    return
    134101  end
    135102 
     
    137104  rev_ind = find(strncmpi(C,'Revision:',4));
    138105  if ~isempty(rev_ind)
    139         rev_str = C{rev_ind};
     106    rev_str = C{rev_ind};
    140107  else
    141         return
     108    return
    142109  end
    143110  HeadRev=str2num(rev_str(11:end));
  • an2_data_read.m

    r77 r78  
    282282 
    283283  %% Read parameters from procpar file
    284   try
    285     [procpar,msg]=an2_readprocpar([f_path,'procpar']);%,'wbar',showWbar);
    286     if isempty(procpar)
    287       DATA=[];
    288       return
    289     end
    290   catch
     284  [procpar,msg]=an2_readprocpar([f_path,'procpar']);%,'wbar',showWbar);
     285  if isempty(procpar)
    291286    DATA=[];
    292     error('An error occurred while reading procpar file!')
     287    error(msg);
     288    return
    293289  end
    294290 
     
    394390    if isempty(DATA)
    395391      DATA=[];
     392      error('Unknown error while reading "%s".',[f_path,'fid'])
    396393      return
    397394    end
  • an2_juigetfiles.m

    r51 r78  
    106106else
    107107  iconpath = [pwd,filesep,'icons',filesep];
     108end
     109
     110%% Disable warnings about deprecated functions in Matlab R2008a->
     111ver = version;
     112ver = str2num(ver(1:3));
     113if ver>=7.6
     114  warning('off','MATLAB:uitree:DeprecatedFunction');
     115  warning('off','MATLAB:uitreenode:DeprecatedFunction');
    108116end
    109117
  • an2_maptool.m

    r45 r78  
    5858  'position',fig_pos,...
    5959  'NumberTitle','off',...
    60   'Name','Map Tool',...
     60  'Name','Aedes Map Tool',...
    6161  'Menubar','none',...
    6262  'toolbar','none',...
     
    8383
    8484
     85
     86%% OPTIONS %%%%%%%%%%%%%%%%%%%%%%%
     87
     88% Options uipanel ----------------------
     89H.OPTIONS_UIPANEL = uipanel('parent',H.FIG,...
     90  'units','pixels',...
     91  'position',[5 40 fig_w-10 300],...
     92  'BackGroundColor',GD.col.frame,...
     93  'title','Options',...
     94  'fontweight','bold');
     95tmp = get(H.OPTIONS_UIPANEL,'position');
     96
     97H.OUTDIR_UIPANEL = uipanel('parent',H.OPTIONS_UIPANEL,...
     98  'units','pixels',...
     99  'position',[5 5 tmp(3)-10 80],...
     100  'BackGroundColor',GD.col.frame);
     101tmp = get(H.OUTDIR_UIPANEL,'position');
     102
     103% Output directory editbox ---------------
     104
     105% Get default output folder from preferences
     106try
     107  DefaultOutputFolder = getpref('Aedes','MapToolDefaultOutputFolder');
     108catch
     109  if isunix
     110        DefaultOutputFolder = getenv('HOME');
     111  else
     112        DefaultOutputFolder = getenv('USERPROFILE');
     113  end
     114end
     115H.OUTDIR_EDIT = uicontrol('parent',H.OUTDIR_UIPANEL,...
     116  'style','edit',...
     117  'units','pixels',...
     118  'position',[5 5 tmp(3)-60 22],...
     119  'backgroundcolor',GD.col.edit,...
     120  'enable','off',...
     121  'horizontalalign','left',...
     122  'string',DefaultOutputFolder);
     123tmp = get(H.OUTDIR_EDIT,'position');
     124
     125% Output directory browse btn ------------
     126H.OUTDIR_BROWSE = uicontrol('parent',H.OUTDIR_UIPANEL,...
     127  'style','pushbutton',...
     128  'units','pixels',...
     129  'position',[tmp(1)+tmp(3)+3 tmp(2) 47 tmp(4)],...
     130  'string','...',...
     131  'enable','off');
     132tmp = get(H.OUTDIR_EDIT,'position');
     133
     134% Input dir as output dir
     135H.OUTDIR_RADIO1 = uicontrol('parent',H.OUTDIR_UIPANEL,...
     136  'units','pixels',...
     137  'position',[tmp(1) tmp(2)+tmp(4)+3 350 tmp(4)],...
     138  'style','radio',...
     139  'value',0,...
     140  'String','Use custom folder',...
     141  'BackGroundColor',GD.col.frame,...
     142  'callback',{@l_SelectOutputDir,'custom'});
     143tmp = get(H.OUTDIR_RADIO1,'position');
     144
     145H.OUTDIR_RADIO2 = uicontrol('parent',H.OUTDIR_UIPANEL,...
     146  'units','pixels',...
     147  'position',[tmp(1) tmp(2)+tmp(4)+3 tmp(3) tmp(4)],...
     148  'style','radio',...
     149  'value',1,...
     150  'String','Use data input folder as output folder',...
     151  'BackGroundColor',GD.col.frame,...
     152  'callback',{@l_SelectOutputDir,'input'});
     153
     154% Maptype and fit values uipanel ------------------
     155tmp = get(H.OUTDIR_UIPANEL,'position');
     156panel_w = 215;
     157panel_h = 190;
     158H.MAPTYPE_UIPANEL = uipanel('parent',H.OPTIONS_UIPANEL,...
     159  'units','pixels',...
     160  'position',[5 tmp(2)+tmp(4)+5 panel_w panel_h],...
     161  'backgroundcolor',GD.col.frame);
     162tmp = get(H.MAPTYPE_UIPANEL,'position');
     163
     164% Maptype popup --------------------------
     165H.MAPTYPE_TX = uicontrol('parent',H.MAPTYPE_UIPANEL,...
     166  'units','pixels',...
     167  'position',[5 tmp(4)-10-15 70 15],...
     168  'style','text',...
     169  'String','Map type',...
     170  'backgroundcolor',GD.col.frame,...
     171  'horizontalalign','left');
     172tmp = get(H.MAPTYPE_TX,'position');
     173maptypes = l_GetMapTypes;
     174H.MAPTYPE_POPUP = uicontrol('parent',H.MAPTYPE_UIPANEL,...
     175  'units','pixels',...
     176  'position',[tmp(1) tmp(2)-20-3 200 20],...
     177  'style','popup',...
     178  'string',maptypes);
     179tmp = get(H.MAPTYPE_TX,'position');
     180
     181% Fit values edit and popup -------------------
     182H.FITVALS_TX = uicontrol('parent',H.MAPTYPE_UIPANEL,...
     183  'units','pixels',...
     184  'position',[tmp(1) tmp(2)-15-40 tmp(3) 15],...
     185  'style','text',...
     186  'String','Fit values',...
     187  'backgroundcolor',GD.col.frame,...
     188  'horizontalalign','left');
     189tmp = get(H.FITVALS_TX,'position');
     190
     191H.FITVALS_EDIT = uicontrol('parent',H.MAPTYPE_UIPANEL,...
     192  'units','pixels',...
     193  'position',[tmp(1) tmp(2)-22-3 200 22],...
     194  'style','edit',...
     195  'String','',...
     196  'backgroundcolor',GD.col.edit,...
     197  'horizontalalign','left');
     198tmp = get(H.FITVALS_EDIT,'position');
     199
     200% % Fit value multiplication
     201% H.FITVALS_MULTI = uicontrol('parent',H.MAPTYPE_UIPANEL,...
     202%   'units','pixels',...
     203%   'position',[tmp(1) tmp(2)-22-2 tmp(3) 22],...
     204%   'style','popup',...
     205%   'String',{'Multiplication: 1',...
     206%   'Multiplication: 1000',...
     207%   'Multiplication: 100',...
     208%   'Multiplication: 10',...
     209%   'Multiplication: 0.1',...
     210%   'Multiplication: 0.01',...
     211%   'Multiplication: 0.001',...
     212%   'Multiplication: custom'});
     213% tmp = get(H.FITVALS_MULTI,'position');
     214
     215% Use procpar field --------------------------
     216H.FITVALS_USE_PROCPAR = uicontrol('parent',H.MAPTYPE_UIPANEL,...
     217  'units','pixels',...
     218  'position',[tmp(1) tmp(2)-22-2 tmp(3) 22],...
     219  'style','popup',...
     220  'tooltip',sprintf('Select the procpar field\n that contains the fit values'),...
     221  'String',{'Use procpar field...'},...
     222  'horizontalalign','left');
     223tmp = get(H.FITVALS_USE_PROCPAR,'position');
     224H.FITVALS_USE_PROCPAR_SAVE = uicontrol('parent',H.MAPTYPE_UIPANEL,...
     225  'units','pixels',...
     226  'position',[tmp(1) tmp(2)-20-2 tmp(3) 20],...
     227  'style','checkbox',...
     228  'tooltip',sprintf('Use this procpar field as\n default for this map type'),...
     229  'String','Use as default for this map type',...
     230  'horizontalalign','left',...
     231  'backgroundcolor',GD.col.frame,...
     232  'fontsize',8);
     233
     234
     235%% Output file name and mask file controls
     236tmp=get(H.MAPTYPE_UIPANEL,'position');
     237H.OUTPUTFILE_UIPANEL = uipanel('parent',H.OPTIONS_UIPANEL,...
     238  'units','pixels',...
     239  'position',[tmp(1)+tmp(3)+5 tmp(2) 270 tmp(4)],...
     240  'backgroundcolor',GD.col.frame);
     241tmp=get(H.OUTPUTFILE_UIPANEL,'position');
     242
     243% Output file name text and edit
     244H.OUTPUTFILE_TX = uicontrol('parent',H.OUTPUTFILE_UIPANEL,...
     245  'units','pixels',...
     246  'position',[5 tmp(4)-15-10 120 15],...
     247  'style','text',...
     248  'String','Output File Name',...
     249  'backgroundcolor',GD.col.frame,...
     250  'horizontalalign','left');
     251tmp = get(H.OUTPUTFILE_TX,'position');
     252outputfile_tooltip = ...
     253  sprintf(['The following special formatting can be\n',...
     254  'used in this dialog:\n',...
     255  '%%m = map type identifier (t2map, t1rmap, etc.)\n',...
     256  '%%f = file name from input folder (e.g. MyData.fid -> %%f = MyData)\n',...
     257  ' \n',...
     258  'Note that numbering and file extension are handled automatically.']);
     259H.OUTPUTFILE_EDIT = uicontrol('parent',H.OUTPUTFILE_UIPANEL,...
     260  'units','pixels',...
     261  'position',[tmp(1) tmp(2)-22-3 250 22],...
     262  'style','edit',...
     263  'String','%m_%f',...
     264  'backgroundcolor',GD.col.edit,...
     265  'horizontalalign','left',...
     266  'tooltip',outputfile_tooltip);
     267tmp = get(H.OUTPUTFILE_EDIT,'position');
     268
     269% Overwrite without warning checkbox
     270H.OUTPUTFILE_OVERWRITE = uicontrol('parent',H.OUTPUTFILE_UIPANEL,...
     271  'units','pixels',...
     272  'position',[tmp(1) tmp(2)-20-2 tmp(3) 20],...
     273  'style','checkbox',...
     274  'value',0,...
     275  'String','Overwrite without warning',...
     276  'backgroundcolor',GD.col.frame,...
     277  'horizontalalign','left');
     278tmp = get(H.OUTPUTFILE_OVERWRITE,'position');
     279
     280% Fit type text
     281H.FITTYPE_TX = uicontrol('parent',H.OUTPUTFILE_UIPANEL,...
     282  'units','pixels',...
     283  'position',[5 tmp(2)-15-20 120 15],...
     284  'style','text',...
     285  'String','Fit type',...
     286  'backgroundcolor',GD.col.frame,...
     287  'horizontalalign','left');
     288tmp = get(H.FITTYPE_TX,'position');
     289
     290% Linearized or non-linear fit
     291H.LINEARFIT_RADIO = uicontrol('parent',H.OUTPUTFILE_UIPANEL,...
     292  'units','pixels',...
     293  'position',[tmp(1) tmp(2)-22-3 200 22],...
     294  'style','radio',...
     295  'value',1,...
     296  'string','Linearized fit',...
     297  'backgroundcolor',GD.col.frame);
     298tmp = get(H.LINEARFIT_RADIO,'position');
     299H.NONLINEARFIT_RADIO = uicontrol('parent',H.OUTPUTFILE_UIPANEL,...
     300  'units','pixels',...
     301  'position',[tmp(1) tmp(2)-22-3 tmp(3) 22],...
     302  'style','radio',...
     303  'value',0,...
     304  'string','Non-linear fit',...
     305  'backgroundcolor',GD.col.frame);
     306tmp = get(H.NONLINEARFIT_RADIO,'position');
     307
     308% % Initial values -------------------------------
     309% H.INITIALVAL_TX = uicontrol('parent',H.OUTPUTFILE_UIPANEL,...
     310%   'units','pixels',...
     311%   'position',[35 tmp(2)-15-3 90 15],...
     312%   'style','text',...
     313%   'String','Initial values',...
     314%   'backgroundcolor',GD.col.frame,...
     315%   'horizontalalign','left');
     316% tmp = get(H.INITIALVAL_TX,'position');
     317%
     318% H.INITIALVAL_POPUP = uicontrol('parent',H.OUTPUTFILE_UIPANEL,...
     319%   'units','pixels',...
     320%   'position',[tmp(1)+tmp(3) tmp(2)-2 70 22],...
     321%   'style','popup',...
     322%   'string',{'Auto','Custom'},...
     323%   'enable','off');
     324% tmp = get(H.INITIALVAL_POPUP,'position');
     325% H.INITIALVAL_EDIT = uicontrol('parent',H.OUTPUTFILE_UIPANEL,...
     326%   'units','pixels',...
     327%   'position',[tmp(1)+tmp(3) tmp(2) 60 22],...
     328%   'style','edit',...
     329%   'String','',...
     330%   'backgroundcolor',GD.col.edit,...
     331%   'horizontalalign','left',...
     332%   'enable','off');
     333
     334% % Mask File ---------------------------------
     335% H.MASKFILE_TX = uicontrol('parent',H.MASK_UIPANEL,...
     336%   'units','pixels',...
     337%   'position',[tmp(1) tmp(2)-15-20 tmp(3) 15],...
     338%   'style','text',...
     339%   'String','Mask File',...
     340%   'backgroundcolor','r',...GD.col.frame,...
     341%   'horizontalalign','left');
     342% tmp = get(H.MASKFILE_TX,'position');
     343% H.MASKFILE_EDIT = uicontrol('parent',H.MASK_UIPANEL,...
     344%   'units','pixels',...
     345%   'position',[tmp(1) tmp(2)-22 tmp(3) 22],...
     346%   'style','edit',...
     347%   'String','',...
     348%   'backgroundcolor',GD.col.edit,...
     349%   'horizontalalign','left');
     350
     351% Add options to selected files -------------
     352tmp = get(H.OUTPUTFILE_UIPANEL,'position');
     353btn_h = 30;
     354btn_w = 130;
     355H.ADD_OPT_TO_SEL = uicontrol('parent',H.OPTIONS_UIPANEL,...
     356  'units','pixels',...
     357  'position',[tmp(1)+tmp(3)+5 tmp(2)+tmp(4)-btn_h btn_w btn_h],...
     358  'style','pushbutton',...
     359  'string','Add to selected',...
     360  'tooltip','Add options to selected files');
     361tmp = get(H.ADD_OPT_TO_SEL,'position');
     362H.ADD_OPT_TO_ALL = uicontrol('parent',H.OPTIONS_UIPANEL,...
     363  'units','pixels',...
     364  'position',[tmp(1) tmp(2)-btn_h-3 tmp(3) tmp(4)],...
     365  'style','pushbutton',...
     366  'string','Add to all',...
     367  'tooltip','Add options to all files');
     368
     369
    85370%% FILES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    86371
    87372% Files uipanel ---------------------
     373tmp = get(H.OPTIONS_UIPANEL,'position');
    88374H.FILES_UIPANEL = uipanel('parent',H.FIG,...
    89375  'units','pixels',...
    90   'position',[5 40 fig_w-10 220],...
     376  'position',[tmp(1) tmp(2)+tmp(4)+5 fig_w-10 220],...
    91377  'BackGroundColor',GD.col.frame,...
    92378  'title','Data Files',...
     
    160446
    161447
    162 %% OPTIONS %%%%%%%%%%%%%%%%%%%%%%%
    163 
    164 % Options uipanel ----------------------
    165 tmp = get(H.FILES_UIPANEL,'position');
    166 H.OPTIONS_UIPANEL = uipanel('parent',H.FIG,...
    167   'units','pixels',...
    168   'position',[tmp(1) tmp(2)+tmp(4)+5 fig_w-10 300],...
    169   'BackGroundColor',GD.col.frame,...
    170   'title','Options',...
    171   'fontweight','bold');
    172 tmp = get(H.OPTIONS_UIPANEL,'position');
    173 
    174 H.OUTDIR_UIPANEL = uipanel('parent',H.OPTIONS_UIPANEL,...
    175   'units','pixels',...
    176   'position',[5 5 tmp(3)-10 80],...
    177   'BackGroundColor',GD.col.frame);
    178 tmp = get(H.OUTDIR_UIPANEL,'position');
    179 
    180 % Output directory editbox ---------------
    181 
    182 % Get default output folder from preferences
    183 try
    184   DefaultOutputFolder = getpref('Aedes','MapToolDefaultOutputFolder');
    185 catch
    186   if isunix
    187         DefaultOutputFolder = getenv('HOME');
    188   else
    189         DefaultOutputFolder = getenv('USERPROFILE');
    190   end
    191 end
    192 H.OUTDIR_EDIT = uicontrol('parent',H.OUTDIR_UIPANEL,...
    193   'style','edit',...
    194   'units','pixels',...
    195   'position',[5 5 tmp(3)-60 22],...
    196   'backgroundcolor',GD.col.edit,...
    197   'enable','off',...
    198   'horizontalalign','left',...
    199   'string',DefaultOutputFolder);
    200 tmp = get(H.OUTDIR_EDIT,'position');
    201 
    202 % Output directory browse btn ------------
    203 H.OUTDIR_BROWSE = uicontrol('parent',H.OUTDIR_UIPANEL,...
    204   'style','pushbutton',...
    205   'units','pixels',...
    206   'position',[tmp(1)+tmp(3)+3 tmp(2) 47 tmp(4)],...
    207   'string','...',...
    208   'enable','off');
    209 tmp = get(H.OUTDIR_EDIT,'position');
    210 
    211 % Input dir as output dir
    212 H.OUTDIR_RADIO1 = uicontrol('parent',H.OUTDIR_UIPANEL,...
    213   'units','pixels',...
    214   'position',[tmp(1) tmp(2)+tmp(4)+3 350 tmp(4)],...
    215   'style','radio',...
    216   'value',0,...
    217   'String','Use custom folder',...
    218   'BackGroundColor',GD.col.frame,...
    219   'callback',{@l_SelectOutputDir,'custom'});
    220 tmp = get(H.OUTDIR_RADIO1,'position');
    221 
    222 H.OUTDIR_RADIO2 = uicontrol('parent',H.OUTDIR_UIPANEL,...
    223   'units','pixels',...
    224   'position',[tmp(1) tmp(2)+tmp(4)+3 tmp(3) tmp(4)],...
    225   'style','radio',...
    226   'value',1,...
    227   'String','Use data input folder as output folder',...
    228   'BackGroundColor',GD.col.frame,...
    229   'callback',{@l_SelectOutputDir,'input'});
    230 
    231 % Maptype and fit values uipanel ------------------
    232 tmp = get(H.OUTDIR_UIPANEL,'position');
    233 panel_w = 215;
    234 panel_h = 190;
    235 H.MAPTYPE_UIPANEL = uipanel('parent',H.OPTIONS_UIPANEL,...
    236   'units','pixels',...
    237   'position',[5 tmp(2)+tmp(4)+5 panel_w panel_h],...
    238   'backgroundcolor',GD.col.frame);
    239 tmp = get(H.MAPTYPE_UIPANEL,'position');
    240 
    241 % Maptype popup --------------------------
    242 H.MAPTYPE_TX = uicontrol('parent',H.MAPTYPE_UIPANEL,...
    243   'units','pixels',...
    244   'position',[5 tmp(4)-10-15 70 15],...
    245   'style','text',...
    246   'String','Map type',...
    247   'backgroundcolor',GD.col.frame,...
    248   'horizontalalign','left');
    249 tmp = get(H.MAPTYPE_TX,'position');
    250 maptypes = l_GetMapTypes;
    251 H.MAPTYPE_POPUP = uicontrol('parent',H.MAPTYPE_UIPANEL,...
    252   'units','pixels',...
    253   'position',[tmp(1) tmp(2)-20-3 200 20],...
    254   'style','popup',...
    255   'string',maptypes);
    256 tmp = get(H.MAPTYPE_TX,'position');
    257 
    258 % Fit values edit and popup -------------------
    259 H.FITVALS_TX = uicontrol('parent',H.MAPTYPE_UIPANEL,...
    260   'units','pixels',...
    261   'position',[tmp(1) tmp(2)-15-40 tmp(3) 15],...
    262   'style','text',...
    263   'String','Fit values',...
    264   'backgroundcolor',GD.col.frame,...
    265   'horizontalalign','left');
    266 tmp = get(H.FITVALS_TX,'position');
    267 
    268 H.FITVALS_EDIT = uicontrol('parent',H.MAPTYPE_UIPANEL,...
    269   'units','pixels',...
    270   'position',[tmp(1) tmp(2)-22-3 200 22],...
    271   'style','edit',...
    272   'String','',...
    273   'backgroundcolor',GD.col.edit,...
    274   'horizontalalign','left');
    275 tmp = get(H.FITVALS_EDIT,'position');
    276 
    277 % % Fit value multiplication
    278 % H.FITVALS_MULTI = uicontrol('parent',H.MAPTYPE_UIPANEL,...
    279 %   'units','pixels',...
    280 %   'position',[tmp(1) tmp(2)-22-2 tmp(3) 22],...
    281 %   'style','popup',...
    282 %   'String',{'Multiplication: 1',...
    283 %   'Multiplication: 1000',...
    284 %   'Multiplication: 100',...
    285 %   'Multiplication: 10',...
    286 %   'Multiplication: 0.1',...
    287 %   'Multiplication: 0.01',...
    288 %   'Multiplication: 0.001',...
    289 %   'Multiplication: custom'});
    290 % tmp = get(H.FITVALS_MULTI,'position');
    291 
    292 % Use procpar field --------------------------
    293 H.FITVALS_USE_PROCPAR = uicontrol('parent',H.MAPTYPE_UIPANEL,...
    294   'units','pixels',...
    295   'position',[tmp(1) tmp(2)-22-2 tmp(3) 22],...
    296   'style','popup',...
    297   'tooltip',sprintf('Select the procpar field\n that contains the fit values'),...
    298   'String',{'Use procpar field...'},...
    299   'horizontalalign','left');
    300 tmp = get(H.FITVALS_USE_PROCPAR,'position');
    301 H.FITVALS_USE_PROCPAR_SAVE = uicontrol('parent',H.MAPTYPE_UIPANEL,...
    302   'units','pixels',...
    303   'position',[tmp(1) tmp(2)-20-2 tmp(3) 20],...
    304   'style','checkbox',...
    305   'tooltip',sprintf('Use this procpar field as\n default for this map type'),...
    306   'String','Use as default for this map type',...
    307   'horizontalalign','left',...
    308   'backgroundcolor',GD.col.frame,...
    309   'fontsize',8);
    310 
    311 
    312 %% Output file name and mask file controls
    313 tmp=get(H.MAPTYPE_UIPANEL,'position');
    314 H.OUTPUTFILE_UIPANEL = uipanel('parent',H.OPTIONS_UIPANEL,...
    315   'units','pixels',...
    316   'position',[tmp(1)+tmp(3)+5 tmp(2) 270 tmp(4)],...
    317   'backgroundcolor',GD.col.frame);
    318 tmp=get(H.OUTPUTFILE_UIPANEL,'position');
    319 
    320 % Output file name text and edit
    321 H.OUTPUTFILE_TX = uicontrol('parent',H.OUTPUTFILE_UIPANEL,...
    322   'units','pixels',...
    323   'position',[5 tmp(4)-15-10 120 15],...
    324   'style','text',...
    325   'String','Output File Name',...
    326   'backgroundcolor',GD.col.frame,...
    327   'horizontalalign','left');
    328 tmp = get(H.OUTPUTFILE_TX,'position');
    329 outputfile_tooltip = ...
    330   sprintf(['The following special formatting can be\n',...
    331   'used in this dialog:\n',...
    332   '%%m = map type identifier (t2map, t1rmap, etc.)\n',...
    333   '%%f = file name from input folder (e.g. MyData.fid -> %%f = MyData)\n',...
    334   ' \n',...
    335   'Note that numbering and file extension are handled automatically.']);
    336 H.OUTPUTFILE_EDIT = uicontrol('parent',H.OUTPUTFILE_UIPANEL,...
    337   'units','pixels',...
    338   'position',[tmp(1) tmp(2)-22-3 250 22],...
    339   'style','edit',...
    340   'String','%m_%f',...
    341   'backgroundcolor',GD.col.edit,...
    342   'horizontalalign','left',...
    343   'tooltip',outputfile_tooltip);
    344 tmp = get(H.OUTPUTFILE_EDIT,'position');
    345 
    346 % Overwrite without warning checkbox
    347 H.OUTPUTFILE_OVERWRITE = uicontrol('parent',H.OUTPUTFILE_UIPANEL,...
    348   'units','pixels',...
    349   'position',[tmp(1) tmp(2)-20-2 tmp(3) 20],...
    350   'style','checkbox',...
    351   'value',0,...
    352   'String','Overwrite without warning',...
    353   'backgroundcolor',GD.col.frame,...
    354   'horizontalalign','left');
    355 tmp = get(H.OUTPUTFILE_OVERWRITE,'position');
    356 
    357 % Fit type text
    358 H.FITTYPE_TX = uicontrol('parent',H.OUTPUTFILE_UIPANEL,...
    359   'units','pixels',...
    360   'position',[5 tmp(2)-15-20 120 15],...
    361   'style','text',...
    362   'String','Fit type',...
    363   'backgroundcolor',GD.col.frame,...
    364   'horizontalalign','left');
    365 tmp = get(H.FITTYPE_TX,'position');
    366 
    367 % Linearized or non-linear fit
    368 H.LINEARFIT_RADIO = uicontrol('parent',H.OUTPUTFILE_UIPANEL,...
    369   'units','pixels',...
    370   'position',[tmp(1) tmp(2)-22-3 200 22],...
    371   'style','radio',...
    372   'value',1,...
    373   'string','Linearized fit',...
    374   'backgroundcolor',GD.col.frame);
    375 tmp = get(H.LINEARFIT_RADIO,'position');
    376 H.NONLINEARFIT_RADIO = uicontrol('parent',H.OUTPUTFILE_UIPANEL,...
    377   'units','pixels',...
    378   'position',[tmp(1) tmp(2)-22-3 tmp(3) 22],...
    379   'style','radio',...
    380   'value',0,...
    381   'string','Non-linear fit',...
    382   'backgroundcolor',GD.col.frame);
    383 tmp = get(H.NONLINEARFIT_RADIO,'position');
    384 
    385 % % Initial values -------------------------------
    386 % H.INITIALVAL_TX = uicontrol('parent',H.OUTPUTFILE_UIPANEL,...
    387 %   'units','pixels',...
    388 %   'position',[35 tmp(2)-15-3 90 15],...
    389 %   'style','text',...
    390 %   'String','Initial values',...
    391 %   'backgroundcolor',GD.col.frame,...
    392 %   'horizontalalign','left');
    393 % tmp = get(H.INITIALVAL_TX,'position');
    394 %
    395 % H.INITIALVAL_POPUP = uicontrol('parent',H.OUTPUTFILE_UIPANEL,...
    396 %   'units','pixels',...
    397 %   'position',[tmp(1)+tmp(3) tmp(2)-2 70 22],...
    398 %   'style','popup',...
    399 %   'string',{'Auto','Custom'},...
    400 %   'enable','off');
    401 % tmp = get(H.INITIALVAL_POPUP,'position');
    402 % H.INITIALVAL_EDIT = uicontrol('parent',H.OUTPUTFILE_UIPANEL,...
    403 %   'units','pixels',...
    404 %   'position',[tmp(1)+tmp(3) tmp(2) 60 22],...
    405 %   'style','edit',...
    406 %   'String','',...
    407 %   'backgroundcolor',GD.col.edit,...
    408 %   'horizontalalign','left',...
    409 %   'enable','off');
    410 
    411 % % Mask File ---------------------------------
    412 % H.MASKFILE_TX = uicontrol('parent',H.MASK_UIPANEL,...
    413 %   'units','pixels',...
    414 %   'position',[tmp(1) tmp(2)-15-20 tmp(3) 15],...
    415 %   'style','text',...
    416 %   'String','Mask File',...
    417 %   'backgroundcolor','r',...GD.col.frame,...
    418 %   'horizontalalign','left');
    419 % tmp = get(H.MASKFILE_TX,'position');
    420 % H.MASKFILE_EDIT = uicontrol('parent',H.MASK_UIPANEL,...
    421 %   'units','pixels',...
    422 %   'position',[tmp(1) tmp(2)-22 tmp(3) 22],...
    423 %   'style','edit',...
    424 %   'String','',...
    425 %   'backgroundcolor',GD.col.edit,...
    426 %   'horizontalalign','left');
    427 
    428 % Add options to selected files -------------
    429 tmp = get(H.OUTPUTFILE_UIPANEL,'position');
    430 btn_h = 30;
    431 btn_w = 130;
    432 H.ADD_OPT_TO_SEL = uicontrol('parent',H.OPTIONS_UIPANEL,...
    433   'units','pixels',...
    434   'position',[tmp(1)+tmp(3)+5 tmp(2)+tmp(4)-btn_h btn_w btn_h],...
    435   'style','pushbutton',...
    436   'string','Add to selected',...
    437   'tooltip','Add options to selected files');
    438 tmp = get(H.ADD_OPT_TO_SEL,'position');
    439 H.ADD_OPT_TO_ALL = uicontrol('parent',H.OPTIONS_UIPANEL,...
    440   'units','pixels',...
    441   'position',[tmp(1) tmp(2)-btn_h-3 tmp(3) tmp(4)],...
    442   'style','pushbutton',...
    443   'string','Add to all',...
    444   'tooltip','Add options to all files');
    445448
    446449
  • an2_readfid.m

    r77 r78  
    10701070  mode_bits = fliplr(double(dec2bin(tmp_mode,16))==49);
    10711071  for tt=1:length(BlockHeadStatusLabels)
    1072         if ~isempty(BlockHeadStatusLabels{tt})
    1073           hdr.BlockHeaders.status.(BlockHeadStatusLabels{tt}) = status_bits(tt);
    1074         end
    1075         if ~isempty(BlockHeadModeLabels{tt})
    1076           hdr.BlockHeaders.mode.(BlockHeadModeLabels{tt}) = mode_bits(tt);
    1077         end
     1072    if ~isempty(BlockHeadStatusLabels{tt})
     1073      hdr.BlockHeaders.status.(BlockHeadStatusLabels{tt}) = status_bits(tt);
     1074    end
     1075    if ~isempty(BlockHeadModeLabels{tt})
     1076      hdr.BlockHeaders.mode.(BlockHeadModeLabels{tt}) = mode_bits(tt);
     1077    end
    10781078  end
    10791079 
    10801080  %% Determine data precision
    10811081  if hdr.BlockHeaders.status.S_FLOAT==1
    1082         prec_str = ['single=>',Dat.precision];
    1083         prec = 4; % Precision in bytes
     1082    prec_str = ['single=>',Dat.precision];
     1083    prec = 4; % Precision in bytes
    10841084  elseif hdr.BlockHeaders.status.S_32==1 ...
    1085           && hdr.BlockHeaders.status.S_FLOAT==0
    1086         prec_str = ['int32=>',Dat.precision];
    1087         prec = 4;
     1085      && hdr.BlockHeaders.status.S_FLOAT==0
     1086    prec_str = ['int32=>',Dat.precision];
     1087    prec = 4;
    10881088  elseif hdr.BlockHeaders.status.S_32==0 ...
    1089           && hdr.BlockHeaders.status.S_FLOAT==0
    1090         prec_str = ['int16=>',Dat.precision];
    1091         prec = 2;
     1089      && hdr.BlockHeaders.status.S_FLOAT==0
     1090    prec_str = ['int16=>',Dat.precision];
     1091    prec = 2;
    10921092  end
    10931093 
     
    10991099 
    11001100  % Read the whole data including block headers etc...
    1101   tmp = fread(file_fid,inf,prec_str);
    1102   tmp=reshape(tmp,nVals+hdr.FileHeader.np*hdr.FileHeader.ntraces,[]);
     1101  kspace = fread(file_fid,inf,prec_str);
     1102  kspace=reshape(kspace,nVals+hdr.FileHeader.np*hdr.FileHeader.ntraces,[]);
    11031103 
    11041104  % Remove block headers from the data
    1105   tmp=tmp(nVals+1:end,:);
     1105  kspace=kspace(nVals+1:end,:);
    11061106 
    11071107  % Transform to complex values
    1108   kspace = reshape(tmp,hdr.FileHeader.np,...
     1108  kspace = reshape(kspace,hdr.FileHeader.np,...
    11091109        hdr.FileHeader.ntraces,hdr.FileHeader.nblocks);
    11101110 
    11111111  % Do DC-correction if necessary
    11121112  if ~Dat.DCcorrection || ( nt(1)>1 )
    1113         kspace=complex(kspace(1:2:end,:,:),kspace(2:2:end,:,:));
     1113    kspace=complex(kspace(1:2:end,:,:),kspace(2:2:end,:,:));
    11141114  else
    1115         kspace=complex(kspace(1:2:end,:,:)-hdr.BlockHeaders.lvl,...
    1116           kspace(2:2:end,:,:)-hdr.BlockHeaders.tlt);
     1115    kspace=complex(kspace(1:2:end,:,:)-hdr.BlockHeaders.lvl,...
     1116      kspace(2:2:end,:,:)-hdr.BlockHeaders.tlt);
    11171117  end
    11181118 
    11191119  %% Store and order k-space values
    11201120  if any(AcqType==[1 2])
    1121         switch seqcon(2:3)
    1122           case {'cc','sc'}
    1123                 %kspace(:,:,ii) = complex_block;
    1124           otherwise
    1125                 %kspace(:,ii,:) = complex_block;
    1126                 kspace = permute(kspace,[1 3 2]);
    1127         end
     1121    switch seqcon(2:3)
     1122      case {'cc','sc'}
     1123        %kspace(:,:,ii) = complex_block;
     1124      otherwise
     1125        %kspace(:,ii,:) = complex_block;
     1126        kspace = permute(kspace,[1 3 2]);
     1127    end
    11281128  else
    1129         %kspace(:,:,ii) = complex_block;
     1129    %kspace(:,:,ii) = complex_block;
    11301130  end
    11311131 
  • an2_revision.m

    r77 r78  
    8181repo = url_str;
    8282
    83 % Hard-coded to "trunk" at the moment. In the future this will be the only
    84 % repo available...
    85 %repo = 'trunk';
    86 
    87 
    8883% Get revision line
    8984rev_ind = find(strncmpi(C,'Revision:',4));
     
    9893% bash-script every time it is called so that this file "an2_revision.m" is
    9994% always in the list of committed files. DO NOT EDIT THE NEXT LINE!!!
    100 % - SVN Hook -
     95% - Svn Hook -
  • an2_update.m

    r45 r78  
    3939
    4040% Check if updates are available
    41 [isUpdateAvailable,HeadRev,WorkingCopyRev]=an2_check_updates();
     41[isUpdateAvailable,HeadRev,WorkingCopyRev,error_msg]=an2_check_updates();
    4242
    4343if isUpdateAvailable
    4444  if strcmpi(opt,'noprompt')
    45         fprintf(1,'Updating from revision %d to %d\n',...
    46           WorkingCopyRev,HeadRev)
     45    fprintf(1,'Updating from revision %d to %d\n',...
     46      WorkingCopyRev,HeadRev)
    4747  elseif any(strcmpi(opt,{'prompt','semiprompt'}))
    48         % Prompt for updates
    49         dialog_str = {'Updates for Aedes are available.',...
    50           '',...
    51           ['Your current revision: ',num2str(WorkingCopyRev)],...
    52           ['The latest revision: ',num2str(HeadRev)],...
    53           '',...
    54           'Do you want install updates now?',...
    55           '',...
    56           '',...
    57           ['NOTE: You can disable automatic update checking from the',...
    58           ' Tools-menu in Aedes.']};
    59         resp=questdlg(dialog_str,'Updates available. Install now?',...
    60           'Yes','No','Yes');
    61         if strcmpi(resp,'No')
    62           done = [];
    63           return
    64         end
    65         [cwh,txh]=an2_calc_wait('Installing updates...');
     48    % Prompt for updates
     49    dialog_str = {'Updates for Aedes are available.',...
     50      '',...
     51      ['Your current revision: ',num2str(WorkingCopyRev)],...
     52      ['The latest revision: ',num2str(HeadRev)],...
     53      '',...
     54      'Do you want to install updates now?'};
     55    resp=questdlg(dialog_str,'Updates available. Install updates now?',...
     56      'Yes','No','Yes');
     57    if strcmpi(resp,'No')
     58      done = [];
     59      return
     60    end
     61    [cwh,txh]=an2_calc_wait('Installing updates...');
    6662  end
    6763elseif isempty(HeadRev)
    6864  % Something wrong with SVN
    6965  if strcmpi(opt,'prompt')
    70         h=warndlg('Could not check updates. Is SVN properly installed?',...
    71           'Could not check updates','modal');
    72         uiwait(h);
    73         return
     66    h=warndlg({'Could not check updates. Do you have hetwork access and is SVN properly installed?','',...
     67      'The following error was encountered:','',...
     68      error_msg},...
     69      'Could not check updates','modal');
     70    uiwait(h);
     71    return
    7472  elseif any(strcmpi(opt,{'noprompt','semiprompt'}))
    75         fprintf(1,'Could not check updates. Is SVN properly installed?\n')
    76         return
    77   end
    78 
    79 elseif HeadRev<0
    80   % Something wrong with network. Not inside University network
    81   if strcmpi(opt,'prompt')
    82         h=warndlg('Could not check updates. Are you connected to Kuopio University network?',...
    83           'Could not check updates','modal');
    84         uiwait(h);
    85         return
    86   elseif any(strcmpi(opt,{'noprompt','semiprompt'}))
    87         fprintf(1,'Could not check updates. Are you connected to Kuopio University network?\n')
    88         return
     73    fprintf(1,'Could not check updates.\n');
     74    fprintf(1,'The following error was encountered:\n');
     75    fprintf(1,error_msg);
     76    return
    8977  end
    9078else
     
    9280  % semiprompt mode is selected
    9381  if strcmpi(opt,'prompt')
    94         h=helpdlg('No updates available. Aedes is up-to-date.',...
    95           'Aedes up-to-date');
    96         uiwait(h);
     82    h=helpdlg('No updates available. Aedes is up-to-date.',...
     83      'Aedes up-to-date');
     84    uiwait(h);
    9785  elseif strcmpi(opt,'noprompt')
    98         fprintf(1,'No updates available. Aedes is up-to-date.\n');
     86    fprintf(1,'No updates available. Aedes is up-to-date.\n');
    9987  end
    10088  return
     
    113101  C=C{:};
    114102else
    115  
     103  % Mac OSX
     104  [s,w]=unix(['svn up "',fp,'"']);
     105  C=textscan(w,'%s','delimiter','\n');
     106  C=C{:};
    116107end
    117108if s~=0
    118109  try
    119         delete(cwh)
     110    delete(cwh)
    120111  catch
    121112  end
    122113  if any(strcmpi(opt,{'prompt','semiprompt'}))
    123         h=errordlg({'Update failed because of following error:',...
    124           C{:}},...
    125           'Update failed','modal');
    126         uiwait(h);
    127         return
     114    h=errordlg({'Update failed because of following error:',...
     115      C{:}},...
     116      'Update failed','modal');
     117    uiwait(h);
     118    return
    128119  elseif strcmpi(opt,'noprompt')
    129         fprintf(1,'\n********************* ERROR ***********************\n')
    130         fprintf(1,'Update failed because of following error:\n');
    131         fprintf(1,'%s\n',C{:});
    132         fprintf(1,'***************************************************\n')
    133         return
     120    fprintf(1,'\n********************* ERROR ***********************\n')
     121    fprintf(1,'Update failed because of following error:\n');
     122    fprintf(1,'%s\n',C{:});
     123    fprintf(1,'***************************************************\n')
     124    return
    134125  end
    135126end
     
    148139for ii=1:length(C)
    149140  if strncmpi(C{ii},'C  ',3)
    150         % Conflict
    151         c_ind(end+1)=ii;
     141    % Conflict
     142    c_ind(end+1)=ii;
    152143  elseif strncmpi(C{ii},'G  ',3)
    153         % Merge
    154         g_ind(end+1)=ii;
     144    % Merge
     145    g_ind(end+1)=ii;
    155146  end
    156147end
     
    165156  % Update successful
    166157  if any(strcmpi(opt,{'prompt','semiprompt'}))
    167         resp=questdlg({['Updated successfully to revision ',num2str(HeadRev),'.'],...
    168           '',...
    169           ['You can use "View Details..." the view the changelog.']},...
    170           'Update successful','OK','View Details...','View Details...');
    171         if strcmpi(resp,'View Details...')
    172           ShowChangeLog = true;
    173         else
    174           ShowChangeLog = false;
    175         end
     158    resp=questdlg({['Updated successfully to revision ',num2str(HeadRev),'.'],...
     159      '',...
     160      ['You can use "View Details..." the view the changelog.']},...
     161      'Update successful','OK','View Details...','View Details...');
     162    if strcmpi(resp,'View Details...')
     163      ShowChangeLog = true;
     164    else
     165      ShowChangeLog = false;
     166    end
    176167  elseif strcmpi(opt,'noprompt')
    177         fprintf(1,'Updated successfully to revision %d\n',HeadRev);
    178        
    179         % Echo the update information to the command window
    180         fprintf(1,'%s\n',C{:});
    181         fprintf(1,'Update complete.\n');
     168    fprintf(1,'Updated successfully to revision %d\n',HeadRev);
     169   
     170    % Echo the update information to the command window
     171    fprintf(1,'%s\n',C{:});
     172    fprintf(1,'Update complete.\n');
    182173  end
    183174 
     
    189180  % Show the Change log and information
    190181  if ShowChangeLog
    191         if isunix
    192           [s,w] = unix(sprintf('svn log "%s" -r%d:%d',...
    193                 fp,HeadRev,WorkingCopyRev+1));
    194           if s~=0
    195                
    196           end
    197         elseif ispc
    198           [s,w] = dos(sprintf('svn log "%s" -r%d:%d',...
    199                 fp,HeadRev,WorkingCopyRev+1));
    200           if s~=0
    201                
    202           end
    203         else
    204          
    205         end
    206         W = textscan(w,'%s','delimiter','\n');
    207         W=W{:};
    208         web(['text://',...
    209           '<title>Update information and changelog</title>',...
    210           sprintf('<h1>Updated Aedes successfully to revision %d</h1>',...
    211           HeadRev),...
    212           sprintf('<h2>Updated files from revision %d to %d</h2>',...
    213           WorkingCopyRev,HeadRev),...
    214           sprintf('%s<br>',C{:}),...
    215           '<br>',...
    216           sprintf('<h2>Changelog from revision %d to %d</h2>',...
    217           WorkingCopyRev,HeadRev),...
    218           sprintf('%s<br>',W{:})]);
     182    if isunix
     183      [s,w] = unix(sprintf('svn log "%s" -r%d:%d',...
     184        fp,HeadRev,WorkingCopyRev+1));
     185      if s~=0
     186       
     187      end
     188    elseif ispc
     189      [s,w] = dos(sprintf('svn log "%s" -r%d:%d',...
     190        fp,HeadRev,WorkingCopyRev+1));
     191      if s~=0
     192       
     193      end
     194    else
     195     
     196    end
     197    W = textscan(w,'%s','delimiter','\n');
     198    W=W{:};
     199    web(['text://',...
     200      '<title>Update information and changelog</title>',...
     201      sprintf('<h1>Updated Aedes successfully to revision %d</h1>',...
     202      HeadRev),...
     203      sprintf('<h2>Updated files from revision %d to %d</h2>',...
     204      WorkingCopyRev,HeadRev),...
     205      sprintf('%s<br>',C{:}),...
     206      '<br>',...
     207      sprintf('<h2>Changelog from revision %d to %d</h2>',...
     208      WorkingCopyRev,HeadRev),...
     209      sprintf('%s<br>',W{:})]);
    219210  end
    220211 
     
    234225  % Update successful but with conflicts and/or merges
    235226  if isempty(c_ind)
    236         % Only merges
    237         fprintf(1,'\n********************* WARNING *********************\n')
    238         fprintf(1,['Updated to revision %d but with errors.\n',...
    239           'The following files contain MERGES:\n'],HeadRev)
    240         fprintf(1,'%s\n',g_files{:})
    241         fprintf(1,'***************************************************\n')
    242         if any(strcmpi(opt,{'prompt','semiprompt'}))
    243           h = warndlg({['Updated to revision ',num2str(HeadRev),' but with errors.'],...
    244                 '',...
    245                 'The following files contain MERGES:',...
    246                 '',...
    247                 g_files{:},...
    248                 '',...
    249                 'Contact the fellow in the About-dialog...'},...
    250                 'Updated with errors','modal');
    251           uiwait(h);
    252         end
    253        
     227    % Only merges
     228    fprintf(1,'\n********************* WARNING *********************\n')
     229    fprintf(1,['Updated to revision %d but with errors.\n',...
     230      'The following files contain MERGES:\n'],HeadRev)
     231    fprintf(1,'%s\n',g_files{:})
     232    fprintf(1,'***************************************************\n')
     233    if any(strcmpi(opt,{'prompt','semiprompt'}))
     234      h = warndlg({['Updated to revision ',num2str(HeadRev),' but with errors.'],...
     235        '',...
     236        'The following files contain MERGES:',...
     237        '',...
     238        g_files{:},...
     239        ''},...
     240        'Updated with errors','modal');
     241      uiwait(h);
     242    end
     243   
    254244  elseif isempty(g_ind)
    255         % Only conflicts
    256         fprintf(1,'\n********************* WARNING *********************\n')
    257         fprintf(1,['Updated to revision %d but with errors.\n',...
    258           'The following files contain CONFLICTS:\n'],HeadRev)
    259         fprintf(1,'%s\n',g_files{:})
    260         fprintf(1,'***************************************************\n')
    261         if any(strcmpi(opt,{'prompt','semiprompt'}))
    262           h = warndlg({['Updated to revision ',num2str(HeadRev),' but with errors.'],...
    263                 '',...
    264                 'The following files contain CONFLICTS:',...
    265                 '',...
    266                 c_files{:},...
    267                 '',...
    268                 'Contact the fellow in the About-dialog...'},...
    269                 'Updated with errors','modal');
    270           uiwait(h);
    271         end
    272        
     245    % Only conflicts
     246    fprintf(1,'\n********************* WARNING *********************\n')
     247    fprintf(1,['Updated to revision %d but with errors.\n',...
     248      'The following files contain CONFLICTS:\n'],HeadRev)
     249    fprintf(1,'%s\n',g_files{:})
     250    fprintf(1,'***************************************************\n')
     251    if any(strcmpi(opt,{'prompt','semiprompt'}))
     252      h = warndlg({['Updated to revision ',num2str(HeadRev),' but with errors.'],...
     253        '',...
     254        'The following files contain CONFLICTS:',...
     255        '',...
     256        c_files{:},...
     257        ''},...
     258        'Updated with errors','modal');
     259      uiwait(h);
     260    end
     261   
    273262  else
    274         % Both conflicts and merges
    275         fprintf(1,'\n********************* WARNING *********************\n')
    276         fprintf(1,['Updated to revision %d but with errors.\n',...
    277           'The following files contain CONFLICTS:\n'],HeadRev)
    278         fprintf(1,'%s\n',c_files{:})
    279         fprintf(1,'\nThe following files contain MERGES:\n')
    280         fprintf(1,'%s\n',g_files{:})
    281         fprintf(1,'***************************************************\n')
    282         if any(strcmpi(opt,{'prompt','semiprompt'}))
    283           h = warndlg({['Updated to revision ',num2str(HeadRev),' but with errors.'],...
    284                 '',...
    285                 'The following files contain CONFLICTS:',...
    286                 '',...
    287                 c_files{:},...
    288                 '',...
    289                 'The following files contain MERGES:',...
    290                 '',...
    291                 g_files{:},...
    292                 '',...
    293                 'Contact the fellow in the About-dialog...'},...
    294                 'Updated with errors','modal');
    295           uiwait(h);
    296         end
     263    % Both conflicts and merges
     264    fprintf(1,'\n********************* WARNING *********************\n')
     265    fprintf(1,['Updated to revision %d but with errors.\n',...
     266      'The following files contain CONFLICTS:\n'],HeadRev)
     267    fprintf(1,'%s\n',c_files{:})
     268    fprintf(1,'\nThe following files contain MERGES:\n')
     269    fprintf(1,'%s\n',g_files{:})
     270    fprintf(1,'***************************************************\n')
     271    if any(strcmpi(opt,{'prompt','semiprompt'}))
     272      h = warndlg({['Updated to revision ',num2str(HeadRev),' but with errors.'],...
     273        '',...
     274        'The following files contain CONFLICTS:',...
     275        '',...
     276        c_files{:},...
     277        '',...
     278        'The following files contain MERGES:',...
     279        '',...
     280        g_files{:},...
     281        ''},...
     282        'Updated with errors','modal');
     283      uiwait(h);
     284    end
    297285  end
    298286 
Note: See TracChangeset for help on using the changeset viewer.

Powered by Trac 1.0.9.Copyright © Juha-Pekka Niskanen 2008