2, error('matrices only!'), end
- c = num2cell(cstr,2);
- cstr = cell(size(c));
- for i=1:prod(size(c)), cstr{i}=num2str(c{i}); end
-else
- error('contrast input must be string or number')
-end
-
-
-%-Evaluate individual lines of contrast matrix input
-%-----------------------------------------------------------------------
-I = zeros(size(c,1),1);
-msg = cell(size(c)); [msg{:}] = deal(' (OK)');
-for i=1:size(c,1)
- if isstr(c{i})
- c{i} = evalin('base',['[',c{i},']'],'''!''');
- end
- if isstr(c{i})
- msg{i} = '!evaluation error';
- else
- if isempty(c{i})
- msg{i}=' (empty line - ignored)';
- elseif all(c{i}(:)==0)
- if size(c{i},1)==1, str='vector'; else, str='matrix'; end
- c{i}=[]; msg{i}=[' (zero ',str,' - ignored)'];
- elseif STAT=='T' & size(c{i},1)>1
- c{i}='!'; msg{i}='!vector required';
- elseif size(c{i},2)>p
- c{i}='!'; msg{i}=sprintf('!too long - only %d prams',p);
- else
- if size(c{i},2)1, str=' column'; else, str=''; end
- if tmp>1, str=[str,'s']; end
- msg{i} = sprintf(' (right padded with %d zero%s)',tmp,str);
- end
- if ~spm_SpUtil('allCon',X,c{i}')
- c{i}='!'; msg{i}='!invalid contrast';
- end
- end
- end
- I(i)=~isstr(c{i});
-end
-
-%-Construct contrast matrix, validity indicator, and collate parsing messages
-%-----------------------------------------------------------------------
-c = cat(1,c{find(I)});
-msg = [char(cstr), repmat(' <- ',size(msg,1),1), char(msg)];
-emsg = msg(find(~I),:);
-imsg = msg(find( I),:);
-
-if all(I) & STAT=='T' & size(c,1)>1 %-Check for vector t-contrasts!
- I=zeros(size(I)); emsg={'!vector required'}; imsg={};
-end
-
-%-Return arguments
-%-----------------------------------------------------------------------
-varargout = {c',I,emsg,imsg,msg};
-
-
-
-%=======================================================================
-case 'parseistr' %-Parse index string
-%=======================================================================
-% [iX0,I,emsg,imsg] = ui_get_contrasts(D, 'ParseIStr',str,max)
-% str should be a string (row)vector
-
-
-%-Sort out parameters
-%-----------------------------------------------------------------------
-str = varargin{2};
-mx = varargin{3};
-
-
-%-Process input string
-%-----------------------------------------------------------------------
-I = evalin('base',['[',str,']'],'''!''');
-
-if isstr(I)
- varargout = {'!',0,[str,' <- !evaluation error'],''};
- return
-end
-
-%-Construct list of valid indicies
-%-----------------------------------------------------------------------
-ok = ismember(I(:)',[1:mx]);
-iX0 = I(ok);
-
-%-Construct diagnostic info messages
-%-----------------------------------------------------------------------
-str = ''; msg='';
-if any(ok)
- str = strvcat(str,num2str(I(ok)));
- msg = strvcat(msg,' <- (OK)');
-end
-tmp = ( I<1 | I>mx ); %-Out of range
-if any(tmp)
- str = strvcat(str,num2str(I(tmp)));
- msg = strvcat(msg,sprintf(' <- (ignored - not in [1:%d]',mx));
-end
-tmp = ( ~tmp & ~ok ); %-Non integer in range
-if any(tmp)
- str = strvcat(str,num2str(I(tmp)));
- msg = strvcat(msg,' <- (ignored - non-integer)');
-end
-
-%-Return arguments
-%-----------------------------------------------------------------------
-varargout = {iX0,1,'',cellstr([str,msg])};
-
-
-%=======================================================================
-case 'reset_cb'
-%=======================================================================
-% ui_get_contrasts(D, 'Reset_CB')
-
-hConList = findobj(gcbf,'Tag','ConList');
-STAT = get(findobj(gcbf,'Tag','TFA','Value',1),'UserData');
-
-ui_get_contrasts(D,'ListCon',hConList,STAT,[])
-
-
-%=======================================================================
-case 'd_setup_cb'
-%=======================================================================
-% ui_get_contrasts(D, 'D_Setup_CB')
-
-F = gcbf;
-STAT = get(findobj(F,'Tag','TFA','Value',1),'UserData');
-STATmode = get(findobj(F,'Tag','STATmode'),'UserData');
-
-set(F,'UIContextMenu',[]) %-Disable Fig ContextMenu
-H = get(findobj(F,'Tag','DefineNew'),'UserData'); %-Get define UI handles
-set(findobj(H,'flat','Tag','D_name'),'String','') %-Clear name
-%set(findobj(H,'flat','Tag','D_ConMtx'),'UserData',[]) %-Clear con definition
-set(H,'Visible','on') %-Show UI
-ui_get_contrasts(D, 'D_TF',F,STAT,STATmode); %-Setup rest of define UI
-
-
-%=======================================================================
-case {'d_conmtx_cb','d_x1cols_cb'}
-%=======================================================================
-% ui_get_contrasts(D, 'D_ConMtx_CB')
-% ui_get_contrasts(D, 'D_X1cols_CB')
-
-fcn = find(strcmp(lower(varargin{1}),{'d_conmtx_cb','d_x1cols_cb'}));
-
-F = gcbf;
-h = gcbo;
-str = get(h,'String');
-
-hD_ConMtx = findobj(F,'Tag','D_ConMtx');
-hD_X1cols = findobj(F,'Tag','D_X1cols');
-
-
-%-Extract info from holding objects
-%-----------------------------------------------------------------------
-xX = get(findobj(F,'Tag','DesMtxAx'),'UserData');
-STAT = get(findobj(F,'Tag','D_TF','Value',1),'UserData');
-
-
-if fcn==1 %-Parse string from ConMtx widget
-%-----------------------------------------------------------------------
-
- set(hD_X1cols,'String','')
- [c,I,emsg,imsg] = ui_get_contrasts(D, 'ParseCon',str,xX.xKXs,STAT);
- if all(I)
- DxCon = spm_FcUtil('Set','',STAT,'c',c,xX.xKXs);
- else
- DxCon = [];
- end
-
-elseif fcn==2 %-Process column indicies from X1cols widget
-%-----------------------------------------------------------------------
- set(hD_ConMtx,'String','')
-
- nPar = spm_SpUtil('size',xX.xKXs,2);
- [iX0,I,emsg,imsg] = ui_get_contrasts(D, 'ParseIStr',str,nPar);
-
- if I
- try %-try-catch block for any errors in spm_FcUtil!
- DxCon = spm_FcUtil('Set','',STAT,'iX0',iX0,xX.xKXs);
- if STAT=='T' & size(DxCon.c,2)>1
- I = 0; emsg = {'! t-contrasts must be vectors'};
- end
- catch
- I = 0;
- emsg = lasterr;
- end
- end
-end
-
-
-%-Define the contrast or report errors...
-%-----------------------------------------------------------------------
-set(findobj(F,'Tag','D_ConErrs'),'String',emsg,'Value',[])
-set(findobj(F,'Tag','D_ConInfo'),'String',imsg,'Value',[])
-if all(I)
- set(hD_ConMtx,'UserData',DxCon); %-Store contrast
- ui_get_contrasts(D, 'GraphCons',DxCon,-1,F) %-Depict contrast
-else
- set(hD_ConMtx,'UserData',[]); %-Clear contrast store
- ui_get_contrasts(D, 'GraphCons',[],[],F) %-Clear contrast plot
-end
-ui_get_contrasts(D, 'D_Status',F) %-Set StatusLine
-
-
-%=======================================================================
-case 'd_reset_cb'
-%=======================================================================
-% ui_get_contrasts(D, 'D_Reset_CB')
-
-STAT = get(findobj(gcbf,'Tag','TFA','Value',1),'UserData');
-set(findobj(gcbf,'Tag','D_name'),'String','') %-Clear name
-set(findobj(gcbf,'Tag','D_ConMtx'),'UserData',[]) %-Contrast definition
-ui_get_contrasts(D, 'D_TF',gcbf,STAT); %-Setup rest of define UI
-
-
-%=======================================================================
-case 'd_cancel_cb'
-%=======================================================================
-% ui_get_contrasts(D, 'D_Cancel_CB')
-
-set(get(findobj(gcbf,'Tag','DefineNew'),'UserData'),'Visible','off')
-set(gcbf,'UIContextMenu',findobj(gcbf,'Tag','mConMan_ConMen'))
-ui_get_contrasts(D, 'StatusLine')
-
-
-%=======================================================================
-case 'd_ok_cb'
-%=======================================================================
-% ui_get_contrasts(D, 'D_OK_CB')
-
-F = gcbf;
-
-name = get(findobj(F,'Tag','D_name'),'String');
-DxCon = get(findobj(F,'Tag','D_ConMtx'),'UserData');
-STAT = get(findobj(F,'Tag','D_TF','Value',1),'UserData');
-
-dNam = ~isempty(name);
-dCon = ~isempty(DxCon);
-
-if ~(dNam & dCon)
- spm('Beep')
- str = { 'contrast name not defined!','',...
- 'no valid contrast defined!',''};
- msgbox(str([dNam+1,dCon+3]),...
- sprintf('%s%s: %s...',spm('ver'),...
- spm('GetUser',' (%s)'),mfilename),'error','modal')
- return
-end
-
-
-%-Append new contrast to xCon structure of mConMan figure 'UserData'
-%-----------------------------------------------------------------------
-DxCon.name = name;
-if ~strcmp(DxCon.STAT,STAT), error('STAT & DxCon.STAT mismatch!'), end
-if isempty(xCon)
- xCon = DxCon;
-else
- xCon = [xCon, DxCon];
-end
-D = set_contrasts(D, xCon, 0);
-sf_SetD(D, 1, F);
-
-
-%-Redisplay the new list of contrasts, with the new one selected
-%-----------------------------------------------------------------------
-hConList = findobj(F,'Tag','ConList');
-I = length(xCon);
-
-%-Use this code to add the new contrast to a multiple selection, if allowed
-% Q = get(hConList,'UserData');
-% I = Q(get(hConList,'Value'));
-% n = get(findobj(F,'Tag','Prompt'),'UserData');
-% if abs(n)>1, I=[I,length(xCon)]; else, I=length(xCon); end
-
-ui_get_contrasts(D, 'TFA',F,xCon(end).STAT); %-Set STAT
-ui_get_contrasts(D, 'ListCon',hConList,xCon(end).STAT,I) %-ListCon
-
-%-Hide the DefineNew UI
-%-----------------------------------------------------------------------
-set(get(findobj(gcbf,'Tag','DefineNew'),'UserData'),'Visible','off')
-set(gcbf,'UIContextMenu',findobj(gcbf,'Tag','mConMan_ConMen'))
-
-
-%=======================================================================
-case 'd_status'
-%=======================================================================
-% ui_get_contrasts(D, 'D_Status',F)
-
-if nargin<3, F=gcbf; else, F=varargin{2}; end
-str = {' not',''};
-dNam = ~isempty(get(findobj(F,'Tag','D_name'),'String'));
-dCon = ~isempty(get(findobj(F,'Tag','D_ConMtx'),'UserData'));
-if dNam & dCon, ok='on'; col='g'; else, ok='off'; col='w'; end
-ui_get_contrasts(D, 'StatusLine',F,...
- sprintf('name%s defined, contrast%s defined',str{dNam+1},str{dCon+1}),...
- col)
-%set(findobj(F,'Tag','D_OK'),'Enable',ok) %-Enable "OK" button?
-
-
-%=======================================================================
-case 'createfig'
-%=======================================================================
-% [F,H] = ui_get_contrasts(D, 'CreateFig')
-% Handle Structure - H.{hConList,hDesMtxAx,hPrompt,hSTATmode,hStatLin,hNew}
-
-cF = get(0,'CurrentFigure'); %-Save current figure
-
-%-Generic callBack code. Fetches object for method calls in callbacks
-%-----------------------------------------------------------------------
-cb = 'conD = get(findobj(''Tag'', ''mConMan''),''UserData''); ';
-
-%-Create window, compute scaling for screen size
-%-----------------------------------------------------------------------
-WS = spm('WinScale'); %-Window scaling factors
-FS = spm('FontSizes'); %-Scaled font sizes
-PF = spm_platform('fonts'); %-Font names (for this platform)
-S0 = get(0,'ScreenSize'); %-Screen size
-
-F = figure('IntegerHandle','off',...
- 'Tag','mConMan',...
- 'Name','SPM contrast manager','NumberTitle','off',...
- 'Position',[S0(3)/2,S0(4)/2,0,0] + [-250,-200,500,400].*WS,...
- 'Resize','off',...
- 'Color',[1 1 1]*.7,...
- 'MenuBar','none',...
- 'DefaultTextColor','k',...
- 'DefaultTextFontName',PF.helvetica,...
- 'DefaultTextFontSize',FS(10),...
- 'DefaultAxesFontName',PF.helvetica,...
- 'DefaultUicontrolBackgroundColor',[1 1 1]*.7,...
- 'DefaultUicontrolFontName',PF.helvetica,...
- 'DefaultUicontrolFontSize',FS(10),...
- 'DefaultUicontrolInterruptible','on',...
- 'Colormap',gray(64),...
- 'Renderer','painters',...
- 'Visible','off');
-
-%-Draw GUI objects
-%-----------------------------------------------------------------------
-hPrompt = uicontrol(F,'Style','Text','Tag','Prompt','UserData',[],...
- 'String','',...
- 'FontName',PF.times,...
- 'FontWeight','Bold',...
- 'FontAngle','Italic',...
- 'FontSize',FS(16),...
- 'ForegroundColor','k',...
- 'BackgroundColor',[1,1,1]*.7,...
- 'HorizontalAlignment','Center',...
- 'Position',[020 370 280 025].*WS);
-
-% ----------------
-%-T/F/all buttons...
-
-hSTATmode = uicontrol(F,'Style','Frame','Tag','STATmode',...
- 'Position',[040 340 260 028].*WS);
-uicontrol(F,'Style','Text','String','show',...
- 'FontName',PF.times,'FontAngle','Italic','FontSize',FS(8),...
- 'ForegroundColor','w',...
- 'Position',[045 365 030 010].*WS);
-hT = uicontrol(F,'Style','RadioButton','String','t-contrasts','Tag','TFA',...
- 'ToolTipString','...to show only contrasts for SPM{t}',...
- 'FontSize',FS(9),...
- 'ForegroundColor','k',...
- 'UserData','T',...
- 'Position',[044 343 105 020].*WS);
-hF = uicontrol(F,'Style','RadioButton','String','F-contrasts','Tag','TFA',...
- 'ToolTipString','...to show only contrasts for SPM{F}',...
- 'FontSize',FS(9),...
- 'ForegroundColor','k',...
- 'UserData','F',...
- 'Position',[149 343 105 020].*WS);
-hA = uicontrol(F,'Style','RadioButton','String','all','Tag','TFA',...
- 'ToolTipString','...to show all defined contrasts',...
- 'FontSize',FS(9),...
- 'ForegroundColor','k',...
- 'UserData','',...
- 'Position',[254 343 041 020].*WS);
-set([hT,hF,hA],'CallBack',[cb 'ui_get_contrasts(conD, ''TFA'');'],...
- 'Interruptible','off','BusyAction','Queue')
-
-
-% ----------------
-%-Contrast list...
-
-uicontrol(F,'Style','Text','Tag','ConListHdr',...
- 'String','### {type} : name',...
- 'FontSize',FS(8),'FontAngle','Italic',...
- 'HorizontalAlignment','Left',...
- 'BackgroundColor','w',...
- 'Position',[042 320 256 016].*WS);
-
-hConList = uicontrol(F,'Style','ListBox','Tag','ConList',...
- 'ToolTipString',['Select contrast(s) - drag/shift-click',...
- '/ctrl-click to select multiple contrasts'],...
- 'String',{'list','not','set','yet'},...
- 'Max',2,...
- 'CallBack',[cb 'ui_get_contrasts(conD, ''ConList_CB'')'],...
- 'Interruptible','off','BusyAction','Queue',...
- 'BackgroundColor','w',...
- 'Position',[040 080 260 240].*WS);
-
-% ----------------
-%-Control buttons & status area...
-
-hNew = uicontrol(F,'Style','Pushbutton','String','Define new contrast...',...
- 'Tag','New',...
- 'ToolTipString','define new contrast',...
- 'ForegroundColor','b',...
- 'Callback',[cb 'ui_get_contrasts(conD, ''D_Setup_CB'')'],...
- 'Enable','on',...
- 'Position',[040 050 150 022].*WS);
-
-uicontrol(F,'Style','Pushbutton','String','Reset',...
- 'ToolTipString','reset selection',...
- 'ForegroundColor','r',...
- 'Callback',[cb 'ui_get_contrasts(conD, ''Reset_CB'')'],...
- 'Position',[195 050 050 022].*WS);
-
-uicontrol(F,'Style','Pushbutton','String','Done',...
- 'ToolTipString','done - press when selected contrast(s)',...
- 'ForegroundColor','m',...
- 'Tag','Done','UserData',1,...
- 'Callback',[cb 'ui_get_contrasts(conD, ''Done_CB'')'],...
- 'Interruptible','off','BusyAction','Cancel',...
- 'Position',[250 050 050 022].*WS);
-
-uicontrol(F,'Style','Frame','Tag','StatusArea',...
- 'Position',[010 010 480 030].*WS);
-
-if exist('spm_help.m')==2
- uicontrol(F,'Style','Pushbutton','String','?',...
- 'ToolTipString','help on contrasts and the contrast manager',...
- 'ForegroundColor','g',...
- 'Callback','spm_help(''spm_conman.m'')',...
- 'Position',[460 015 020 020].*WS);
-end
-
-hStatLin = uicontrol(F,'Style','Text','Tag','StatusLine',...
- 'String','',...
- 'FontAngle','Italic',...
- 'HorizontalAlignment','Center',...
- 'ForegroundColor','w',...
- 'Position',[020 015 430 020].*WS);
-
-% ----------------
-%-Axes for design matrix and parameter estimability...
-
-hDesMtxAx = axes('Parent',F,'Tag','DesMtxAx',...
- 'Position',[0.65 0.30 0.30 0.40],...
- 'Color','w',...
- 'Box','on','XTick',[],'YTick',[]);
-
-hParEstAx = axes('Parent',F,'Tag','ParEstAx',...
- 'Position',[0.65 0.18 0.30 0.05],...
- 'Color','w',...
- 'Box','on','XTick',[],'YTick',[]);
-
-% ----------------
-%-Figure UICOntextMenu
-
-h = uicontextmenu('Tag','mConMan_ConMen');
-set(F,'UIContextMenu',h)
-uimenu(h,'Label','Define new contrast...',...
- 'Tag','CM_New',...
- 'CallBack',[cb 'ui_get_contrasts(conD, ''D_Setup_CB'')'],...
- 'Interruptible','off','BusyAction','Cancel');
-uimenu(h,'Label','Rename selected contrast...',...
- 'Tag','CM_Ren',...
- 'CallBack',[cb 'ui_get_contrasts(conD, ''Rename_CB'')'],...
- 'Interruptible','off','BusyAction','Cancel');
-uimenu(h,'Label','Reset','Separator','on',...
- 'CallBack',[cb 'ui_get_contrasts(conD, ''Reset_CB'')'],...
- 'Interruptible','off','BusyAction','Cancel');
-uimenu(h,'Label','Done',...
- 'CallBack',[cb 'ui_get_contrasts(conD, ''Done_CB'')'],...
- 'Interruptible','off','BusyAction','Cancel');
-uimenu(h,'Label','help','Separator','on',...
- 'CallBack','spm_help(''spm_conman'')',...
- 'Interruptible','off','BusyAction','Cancel');
-uimenu(h,'Label','crash out','Separator','on',...
- 'CallBack',[cb 'ui_get_contrasts(conD, ''Initialise'',''reset'');'],...
- 'Interruptible','off','BusyAction','Cancel');
-set(h,'CallBack',[cb 'ui_get_contrasts(conD, ''FConMenu_CB'')'],...
- 'Interruptible','off','BusyAction','Cancel');
-
-
-%-Draw contrast definition GUI
-%-----------------------------------------------------------------------
-H = []; %-Save handles for visibility switching
-
-h = uicontrol(F,'Style','Frame','Tag','DefineNew',...
- 'Position',[010 045 300 350].*WS);
-H = [H,h];
-h = uicontrol(F,'Style','Text','Tag','D_Prompt','UserData',[],...
- 'String','define contrast...',...
- 'FontName',PF.times,...
- 'FontWeight','Bold',...
- 'FontAngle','Italic',...
- 'FontSize',FS(14),...
- 'ForegroundColor','b',...
- 'HorizontalAlignment','Center',...
- 'Position',[020 360 280 030].*WS);
-H = [H,h];
-
-% ----------------
-%-name
-h = uicontrol(F,'Style','Frame','Position',[020 335 280 033].*WS);
-H = [H,h];
-h = uicontrol(F,'Style','Text','String','name',...
- 'FontSize',FS(10),...
- 'FontAngle','Italic',...
- 'ForegroundColor','w',...
- 'HorizontalAlignment','Center',...
- 'Position',[025 355 045 020].*WS);
-H = [H,h];
-h = uicontrol(F,'Style','Edit','Tag','D_name',...
- 'ToolTipString','enter name for contrast',...
- 'HorizontalAlignment','Left',...
- 'BackgroundColor',COLOUR,...
- 'Callback',[cb 'ui_get_contrasts(conD, ''D_Status'')'],...
- 'Interruptible','off',...
- 'Position',[080 340 215 022].*WS);
-H = [H,h];
-
-% ----------------
-%-type
-h = uicontrol(F,'Style','Frame','Position',[020 295 280 033].*WS);
-H = [H,h];
-h = uicontrol(F,'Style','Text','String','type',...
- 'FontSize',FS(10),...
- 'FontAngle','Italic',...
- 'ForegroundColor','w',...
- 'HorizontalAlignment','Center',...
- 'Position',[025 315 040 020].*WS);
-H = [H,h];
-
-hDT = uicontrol(F,'Style','RadioButton','String','t-contrast','Tag','D_TF',...
- 'ToolTipString','...to define contrast for SPM{t}',...
- 'FontSize',FS(9),...
- 'ForegroundColor','k',...
- 'UserData','T',...
- 'Position',[080 300 105 022].*WS);
-hDF = uicontrol(F,'Style','RadioButton','String','F-contrast','Tag','D_TF',...
- 'ToolTipString','...to define contrast for SPM{F}',...
- 'FontSize',FS(9),...
- 'ForegroundColor','k',...
- 'UserData','F',...
- 'Position',[190 300 105 022].*WS);
-set([hDT,hDF],'CallBack',[cb 'ui_get_contrasts(conD, ''D_TF'');'],...
- 'Interruptible','off','BusyAction','Queue')
-H = [H,hDT,hDF];
-
-% ----------------
-%-contrast
-h = uicontrol(F,'Style','Frame','Position',[020 080 280 208].*WS);
-H = [H,h];
-h = uicontrol(F,'Style','Text','String','contrast',...
- 'FontSize',FS(10),...
- 'FontAngle','Italic',...
- 'ForegroundColor','w',...
- 'HorizontalAlignment','Center',...
- 'Position',[025 275 055 020].*WS);
-H = [H,h];
-h = uicontrol(F,'Style','Text','String','contrast',...
- 'FontSize',FS(6),...
- 'HorizontalAlignment','Right',...
- 'Position',[030 255 045 008].*WS);
-H = [H,h];
-h = uicontrol(F,'Style','Text','String','weights',...
- 'FontSize',FS(6),...
- 'HorizontalAlignment','Right',...
- 'Position',[030 245 045 008].*WS);
-H = [H,h];
-h = uicontrol(F,'Style','Text','String','vector','Tag','D_Ttxt',...
- 'FontSize',FS(6),...
- 'HorizontalAlignment','Right',...
- 'Position',[030 235 045 008].*WS);
-H = [H,h];
-h = uicontrol(F,'Style','Text','String','matrix','Tag','D_Ftxt',...
- 'FontSize',FS(6),...
- 'HorizontalAlignment','Right',...
- 'Position',[030 235 045 008].*WS);
-H = [H,h];
-h = uicontrol(F,'Style','Edit','Tag','D_ConMtx',...
- 'ToolTipString','enter contrast',...
- 'HorizontalAlignment','Left',...
- 'BackgroundColor',COLOUR,...
- 'Max',2,...
- 'CallBack',[cb 'ui_get_contrasts(conD, ''D_ConMtx_CB'')'],...
- 'Interruptible','off','BusyAction','Queue',...
- 'UserData',[],...
- 'Position',[080 200 215 082].*WS);
-H = [H,h];
-h = uicontrol(F,'Style','Text','String','or','Tag','D_Ftxt',...
- 'FontAngle','Italic',...
- 'FontSize',FS(6),...
- 'HorizontalAlignment','Left',...
- 'Position',[025 205 030 008].*WS);
-H = [H,h];
-h = uicontrol(F,'Style','Text','String','columns for','Tag','D_Ftxt',...
- 'FontSize',FS(6),...
- 'HorizontalAlignment','Right',...
- 'Position',[022 190 070 008].*WS);
-H = [H,h];
-h = uicontrol(F,'Style','Text','String','reduced design','Tag','D_Ftxt',...
- 'FontSize',FS(6),...
- 'HorizontalAlignment','Right',...
- 'Position',[022 180 070 008].*WS);
-H = [H,h];
-h = uicontrol(F,'Style','Edit','Tag','D_X1cols',...
- 'ToolTipString',...
- 'enter column indicies of reduced design matrix X0',...
- 'HorizontalAlignment','Left',...
- 'BackgroundColor',COLOUR,...
- 'CallBack',[cb 'ui_get_contrasts(conD, ''D_X1cols_CB'')'],...
- 'Interruptible','off','BusyAction','Queue',...
- 'Position',[090 180 155 020].*WS);
-H = [H,h];
-h = uicontrol(F,'Style','Pushbutton','String','...submit',...
- 'FontSize',FS(8),...
- 'ForegroundColor','c',...
- 'Position',[245 180 050 020].*WS);
-H = [H,h];
-
-%-Errors & info boxes...
-h = uicontrol(F,'Style','ListBox','Tag','D_ConErrs',...
- 'ToolTipString','contrast parsing errors',...
- 'FontName',PF.courier,'FontSize',FS(7),...
- 'ForegroundColor','r',...
- 'BackgroundColor',[1 1 1]*.7,...
- 'Enable','on','Max',2,'Value',[],...
- 'Position',[027 127 268 042].*WS);
-H = [H,h];
-h = uicontrol(F,'Style','ListBox','Tag','D_ConInfo',...
- 'ToolTipString','contrast parsing info',...
- 'FontName',PF.courier,'FontSize',FS(7),...
- 'ForegroundColor','g',...
- 'BackgroundColor',[1 1 1]*.7,...
- 'Enable','on','Max',2,'Value',[],...
- 'Position',[027 085 268 042].*WS);
-H = [H,h];
-
-% ----------------
-%-Control buttons & status area...
-h = uicontrol(F,'Style','Pushbutton','String','Reset',...
- 'Tag','D_Reset',...
- 'ToolTipString','reset definition interface',...
- 'ForegroundColor','b',...
- 'Callback',[cb 'ui_get_contrasts(conD, ''D_Reset_CB'')'],...
- 'Interruptible','off','BusyAction','Cancel',...
- 'Position',[140 053 050 022].*WS);
-H = [H,h];
-h = uicontrol(F,'Style','Pushbutton','String','Cancel',...
- 'Tag','D_Cancel',...
- 'ToolTipString','cancel contrast definition',...
- 'ForegroundColor','r',...
- 'Callback',[cb 'ui_get_contrasts(conD, ''D_Cancel_CB'')'],...
- 'Interruptible','off','BusyAction','Cancel',...
- 'Position',[195 053 050 022].*WS);
-H = [H,h];
-h = uicontrol(F,'Style','Pushbutton','String','OK',...
- 'Tag','D_OK',...
- 'ToolTipString','OK - press to accept newly defined contrast',...
- 'ForegroundColor','m',...
- 'Callback',[cb 'ui_get_contrasts(conD, ''D_OK_CB'')'],...
- 'Interruptible','off','BusyAction','Cancel',...
- 'Position',[250 053 050 022].*WS);
-H = [H,h];
-set(findobj(H,'flat','Tag','DefineNew'),'UserData',H)
-
-
-%-Finish up
-%-----------------------------------------------------------------------
-set(0,'CurrentFigure',cF)
-varargout = {F,struct( 'hConList', hConList,...
- 'hDesMtxAx', hDesMtxAx,...
- 'hParEstAx', hParEstAx,...
- 'hPrompt', hPrompt,...
- 'hSTATmode', hSTATmode,...
- 'hStatLin', hStatLin,...
- 'hNew', hNew )};
-
-
-%=======================================================================
-otherwise %-unknown action
-%=======================================================================
-error(['Illegal Action string: ',varargin{1}])
-
-
-%=======================================================================
-end % - E N D
-return
-%=======================================================================
-
-
-%=======================================================================
-% Subfunctions
-%=======================================================================
-function sf_ImDesMtx(xX, h)
-%-Picture design matrix
-
-axes(h)
-if isfield(xX,'nKX') & ~isempty(xX.nKX)
- hDesMtxIm = image((xX.nKX+1)*32);
-else
- hDesMtxIm = image(...
- (spm_DesMtx('sca',xX.xKXs.X,xX.name)+1)*32);
-end
-set(h,'YTick',[],'XTick',[]) %-No Tick marks
-set(h,'Tag','DesMtxAx','UserData',xX) %-Reset axis UserData after image
-xlabel('Design matrix')
-set(hDesMtxIm,'UserData',...
- struct('X',xX.xKXs.X,'Xnames',{xX.name}))
-set(hDesMtxIm,'ButtonDownFcn','spm_DesRep(''SurfDesMtx_CB'')')
-return
-
-function sf_ImParEst(xX, h)
-%-Picture design parameter estimability
-
-axes(h)
-est = spm_SpUtil('IsCon',xX.xKXs);
-nPar = length(est);
-
-hParEstIm = image((est+1)*32);
-set(h, 'XLim',[0,nPar]+.5,'XTick',[1:nPar-1]+.5,'XTickLabel','',...
- 'YLim',[0,1]+.5,'YDir','reverse','YTick',[],...
- 'Box','on','TickDir','in','XGrid','on','GridLineStyle','-');
-xlabel('parameter estimability')
-set(h,'Tag','ParEstAx') %-Reset 'Tag' after image cleared it
-set(hParEstIm,'UserData',struct('est',est,'Xnames',{xX.name}))
-set(hParEstIm,'ButtonDownFcn','spm_DesRep(''SurfEstIm_CB'')')
-return
-
-function sf_SetD(D, changef, F)
-% Sets new data into figure
-if nargin < 2, changef = 0; end
-if nargin < 3, F = get(findobj('Tag', 'mConMan'),'UserData'); end
-
-hD_Reset = findobj(F,'Tag','D_Reset');
-set(F, 'UserData', D);
-set(hD_Reset, 'UserData', changef);
-return
diff --git a/lib/marsbar-0.44/@mardo/unfiltered_efficiency.m b/lib/marsbar-0.44/@mardo/unfiltered_efficiency.m
deleted file mode 100644
index 45bb582..0000000
--- a/lib/marsbar-0.44/@mardo/unfiltered_efficiency.m
+++ /dev/null
@@ -1,17 +0,0 @@
-function e = unfiltered_efficiency(D, Ic)
-% Calculate unfiltered efficiency for given SPM design and contrast
-
-if nargin < 2
- error('Need design and contrast number');
-end
-if ~has_contrasts(D)
- error('Need design with contrasts');
-end
-
-% Get contrast matrix to test for
-xCon = get_contrasts(D);
-con = xCon(Ic).c;
-
-X = design_matrix(D);
-e = 1 / trace(con' * pinv(X' * X) * con);
-return
diff --git a/lib/marsbar-0.44/@mardo/verbose.m b/lib/marsbar-0.44/@mardo/verbose.m
deleted file mode 100644
index 9438539..0000000
--- a/lib/marsbar-0.44/@mardo/verbose.m
+++ /dev/null
@@ -1,11 +0,0 @@
-function res = verbose(obj, data)
-% get/set method for verbose field
-%
-% $Id$
-
-if nargin > 1
- obj.verbose = data;
- res = obj;
-else
- res = obj.verbose;
-end
diff --git a/lib/marsbar-0.44/@mardo_2/add_trial_f.m b/lib/marsbar-0.44/@mardo_2/add_trial_f.m
deleted file mode 100644
index 2438aca..0000000
--- a/lib/marsbar-0.44/@mardo_2/add_trial_f.m
+++ /dev/null
@@ -1,36 +0,0 @@
-function [D, changef] = add_trial_f(D)
-% method to add trial-specific F contrasts
-%
-% D - design to put contrasts into
-%
-% Returns
-% D - design with any added contrasts
-% changef - set to 1 if any contrasts have been added
-%
-% The routine only adds contrasts that are not already present
-%
-% $Id$
-
-if ~strcmp(modality(D), 'fmri')
- error('Can only set trial-specific F contrasts for FMRI designs');
-end
-SPM = des_struct(D);
-xX = SPM.xX;
-[nScan nBeta] = size(xX.X);
-
-%-Append contrasts for fMRI - specified by SPM.Sess(s).Fc(i)
-%-----------------------------------------------------------------------
-xCon = [];
-if isfield(SPM,'Sess')
- for s = 1:length(SPM.Sess)
- for i = 1:length(SPM.Sess(s).Fc)
- iX0 = 1:nBeta;
- iX = SPM.Sess(s).col(SPM.Sess(s).Fc(i).i);
- iX0(iX) = [];
- Fcname = sprintf('Sess(%d):%s',s,SPM.Sess(s).Fc(i).name);
- xcon = spm_FcUtil('Set',Fcname,'F','iX0',iX0,xX.xKXs);
- xCon = [xCon xcon];
- end
- end
-end
-[D Ic changef] = add_contrasts(D, xCon);
diff --git a/lib/marsbar-0.44/@mardo_2/apply_filter.m b/lib/marsbar-0.44/@mardo_2/apply_filter.m
deleted file mode 100644
index ac1ce9d..0000000
--- a/lib/marsbar-0.44/@mardo_2/apply_filter.m
+++ /dev/null
@@ -1,71 +0,0 @@
-function Y = apply_filter(D, Y, flags)
-% applies filter in design to data
-% FORMAT Y = apply_filter(D, Y, flags)
-%
-% D - design, which includes a filter
-% Y - data to filter (2D matrix or marsy data object)
-% flags - string specifying one option, or cell array specifying more
-% than one option, or struct with fields specifying options.
-% Values for strings, cell contents or field names are
-% 'no_whitening' - specifies not to use whitening matrix even
-% if present in model
-% 'sessions' - when used as struct field, value for field
-% specifies sessions to apply filter for. The
-% data size must match the length of the
-% included sessions.
-%
-% Returns
-% Y - filtered data
-%
-% $Id$
-
-if nargin < 2
- error('Need data to filter');
-end
-if nargin < 3
- flags = [];
-end
-if ~isempty(flags)
- if ischar(flags), flags = {flags}; end
- if iscell(flags)
- flags = cell2struct(repmat({''}, size(flags)), flags, 1);
- end
-end
-if ~is_fmri(D)
- return
-end
-if ~has_filter(D)
- error('This FMRI design does not contain a filter');
-end
-
-SPM = des_struct(D);
-K = SPM.xX.K;
-if ~has_whitener(D) | isfield(flags, 'no_whitening')
- W = eye(n_time_points(D));
-else
- W = SPM.xX.W;
-end
-
-% Filtering from subset of sessions
-if isfield(flags, 'sessions')
- ss = flags.sessions;
- if ~isempty(ss)
- blk_rows = block_rows(D);
- if any(ss < 1 | ss > length(blk_rows))
- error('Sessions appear to be out of range');
- end
- K = K(ss);
- K.row = blk_rows{ss} - blk_rows{ss}(1) + 1;
- W = W(blk_rows{ss}, blk_rows{ss});
- end
-end
-
-if isa(Y, 'marsy') % marsy object
- rd = region_data(Y);
- for r = 1:length(rd)
- rd{r} = pr_spm_filter(K, W*rd{r});
- end
- Y = region_data(Y, [], rd);
-else % 2D matrix
- Y = pr_spm_filter(K, W*Y);
-end
diff --git a/lib/marsbar-0.44/@mardo_2/autocorr.m b/lib/marsbar-0.44/@mardo_2/autocorr.m
deleted file mode 100644
index cd9c7ea..0000000
--- a/lib/marsbar-0.44/@mardo_2/autocorr.m
+++ /dev/null
@@ -1,98 +0,0 @@
-function D = autocorr(D, autocorr_type, varargin)
-% method to set autocorrelation types for design
-% FORMAT D = autocorr(D, autocorr_type, varargin)
-%
-% D - design object
-% autocorr_type - autocorrelation type specification, one of
-% 'SPM'
-% 'fmristat'
-% 'none'
-% varargin - parameters defining autocorrelation model.
-% If autocorr type is 'SPM':
-% varargin{1} should be vector with estimated AR
-% coefficients (default is [0.2])
-% varargin{2} is optional, and is flag; non-zero value
-% specifies voxel-wise covariance estimates (default 1)
-% If autocorr type is 'fmristat'
-% varargin{1} is scalar value for order of fmristat
-% model (default is 1);
-%
-% $Id$
-
-if nargin < 2
- error('Need autocorr type');
-end
-
-if ~is_fmri(D)
- warning('Can only set autocorrelation for FMRI design types');
- return
-end
-
-% Get design, put into some useful variables
-v_f = verbose(D);
-SPM = des_struct(D);
-nscan = SPM.nscan;
-
-SPM.xVi.cov_calc = 'summary';
-
-switch lower(autocorr_type)
- case 'fmristat'
- % Fit fmristat model AR(n)
- if nargin < 3, varargin{1} = 1; end
- cVi = varargin{1};
- if prod(size(cVi)) > 1
- error('Expecting scalar for fmristat order');
- end
- SPM.xVi.Vi = struct('type', 'fmristat', 'order', cVi);
- cVi = sprintf('fmristat AR(%d)',cVi);
- f2cl = 'V'; % Field to CLear
-
- case 'spm'
- % SPM AR coefficient(s) to be specified
- if nargin < 3, varargin{1} = 0.2; end
- if nargin < 4, varargin{2} = 1; end
- cVi = varargin{1};
- if any(cVi > 1 | cVi < 0)
- error('Rho estimates should be > 0 and < 1');
- end
- SPM.xVi.Vi = pr_spm_ce(nscan, cVi);
- cVi = sprintf('AR(%0.1f)',cVi(1));
- f2cl = 'V';
- if varargin{2}
- SPM.xVi.cov_calc = 'vox';
- end
-
- case 'none'
- % xVi.V is i.i.d
- %---------------------------------------------------------------
- SPM.xVi.V = speye(sum(nscan));
- cVi = 'i.i.d';
- f2cl = 'Vi';
-
- otherwise
- error(['Eccentric autocorr type ' autocorr_type]);
-end
-
-% If we've set V, need to clear Vi, because the
-% estimate method takes the presence of Vi to mean that
-% V can be cleared, with 'redo_covar' flag
-% Conversely V needs to be cleared if Vi was estimated
-if isfield(SPM.xVi, f2cl)
- SPM.xVi = rmfield(SPM.xVi, f2cl);
- if v_f, fprintf('Clearing previous %s matrix\n', f2cl); end
-end
-
-% Also: remove previous W matrices
-% Either will need to be recalculated or won't be used
-if isfield(SPM.xX, 'W')
- SPM.xX = rmfield(SPM.xX, 'W');
- if v_f, fprintf('Clearing previous W matrix\n'); end
-end
-
-% fill into design
-SPM.xVi.form = cVi;
-xsDes = struct('Serial_correlations', SPM.xVi.form);
-SPM.xsDes = mars_struct('ffillmerge', SPM.xsDes, xsDes);
-
-% put stuff into object
-D = des_struct(D,SPM);
diff --git a/lib/marsbar-0.44/@mardo_2/bf_dt.m b/lib/marsbar-0.44/@mardo_2/bf_dt.m
deleted file mode 100644
index 160ab9b..0000000
--- a/lib/marsbar-0.44/@mardo_2/bf_dt.m
+++ /dev/null
@@ -1,7 +0,0 @@
-function d = bf_dt(D)
-% method returns length of time bin for basis functions
-%
-% $Id$
-
-SPM = des_struct(D);
-d = mars_struct('getifthere', SPM, 'xBF', 'dt');
diff --git a/lib/marsbar-0.44/@mardo_2/block_cols.m b/lib/marsbar-0.44/@mardo_2/block_cols.m
deleted file mode 100644
index 9da4157..0000000
--- a/lib/marsbar-0.44/@mardo_2/block_cols.m
+++ /dev/null
@@ -1,14 +0,0 @@
-function cols = block_cols(D)
-% method gets design columns for block (session / subject)
-% FORMAT cols = block_cols(D)
-%
-% Returns cell array of column indices (one per session)
-%
-% $Id$
-
-if ~is_fmri(D)
- error('Needs FMRI design');
-end
-
-SPM = des_struct(D);
-cols = {SPM.Sess(:).col};
diff --git a/lib/marsbar-0.44/@mardo_2/block_rows.m b/lib/marsbar-0.44/@mardo_2/block_rows.m
deleted file mode 100644
index 48caa0e..0000000
--- a/lib/marsbar-0.44/@mardo_2/block_rows.m
+++ /dev/null
@@ -1,20 +0,0 @@
-function rows = block_rows(D)
-% returns cell array of rows for each (subject/session) block
-%
-% $Id$
-
-SPM = des_struct(D);
-if strcmp(modality(D), 'fmri')
- Sess = SPM.Sess;
- rows = {Sess(:).row};
-else % PET I guess
- xX = SPM.xX;
- if ~isfield(xX, 'I')
- error('Expecting I field in SPM design');
- end
- scol = xX.I(:, 3); % the subject column
- subjnos = unique(scol);
- for s = 1:length(subjnos);
- rows{s} = find(scol == subjnos(s));
- end
-end
diff --git a/lib/marsbar-0.44/@mardo_2/can_mars_estimate.m b/lib/marsbar-0.44/@mardo_2/can_mars_estimate.m
deleted file mode 100644
index b6fa024..0000000
--- a/lib/marsbar-0.44/@mardo_2/can_mars_estimate.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function tf = can_mars_estimate(D)
-% method returns 1 if design can be estimated in MarsBaR
-%
-% $Id$
-
-tf = ~is_fmri(D) | (has_filter(D) & has_autocorr(D));
diff --git a/lib/marsbar-0.44/@mardo_2/compute_contrasts.m b/lib/marsbar-0.44/@mardo_2/compute_contrasts.m
deleted file mode 100644
index 1c7ac87..0000000
--- a/lib/marsbar-0.44/@mardo_2/compute_contrasts.m
+++ /dev/null
@@ -1,51 +0,0 @@
-function [marsS] = compute_contrasts(marsDe, Ic)
-% compute and return results of contrast statistics
-% FORMAT marsS = compute_contrasts(marsDe, Ic)
-%
-% marsDe - design object
-% Ic - indices into contrast structure
-%
-% Output
-% marsS - statistic result structure
-%
-% For the 'con', 'stat' 'P' 'Pc' fields below, the results are matrices
-% with one row per contrast, one column per ROI estimated
-%
-% The statistics results structure has fields
-% 'con' - contrast value (numerator of t statistic, or ESS for F)
-% 'stat' - t or F statistic value
-% 'P' - uncorrected P value
-% 'Pc' - P values corrected for number of ROIs
-% 'MVres' - multivariate results structure with fields
-% 'y_pre' - predicted temporal response
-% 'y_obs' - observerd temporal response
-% 'Pf' - probabability for last (rank of subspace)
-% eigenvalues
-% 'u' - principle components
-% 'ds' - component weights (diag(S))
-% 'df' - degrees of freedom for Pf
-% 'columns' - names of regions
-% 'rows' - cell array of structs, one per contrast calculated,
-% with fields:
-% 'name' - contrast name
-% 'stat' - statistic type (T|F)
-%
-% $Id$
-
-SPM = des_struct(marsDe);
-xCon = SPM.xCon;
-
-if nargin < 2
- Ic = 1:length(xCon);
-end
-
-%- results
-[marsS.con marsS.stat, marsS.P, marsS.Pc] = ...
- pr_stat_compute(SPM, Ic);
-marsS.MVres = pr_stat_compute_mv(SPM, Ic);
-
-marsS.columns = region_name(SPM.marsY);
-for i = 1:length(Ic)
- marsS.rows{i}.name = xCon(Ic(i)).name;
- marsS.rows{i}.stat = xCon(Ic(i)).STAT;
-end
diff --git a/lib/marsbar-0.44/@mardo_2/convert_vols.m b/lib/marsbar-0.44/@mardo_2/convert_vols.m
deleted file mode 100644
index f3b26fe..0000000
--- a/lib/marsbar-0.44/@mardo_2/convert_vols.m
+++ /dev/null
@@ -1,51 +0,0 @@
-function o = convert_vols(o, ver)
-% method that converts vol structs in design and converts to format 'ver'
-% FORMAT o = convert_fo(o, ver)
-%
-% Input
-% o - design object
-% ver - optional version for vols from '99' or '5'
-% Defaults to version for current SPM version
-%
-% Output
-% o - object with converted vols
-%
-% Example
-% % Convert vols to current format
-% o = convert_vols(o);
-%
-% % Convert to native format for SPM99 designs
-% o = convert_vols(o, native_vol_ver(o));
-%
-% $Id$
-
-if nargin < 2
- ver = mars_vol_utils('current_ver');
-end
-
-SPM = des_struct(o);
-SPM = sf_conv(SPM, ver, 'xY', 'VY');
-SPM = sf_conv(SPM, ver, 'xM', 'VM');
-SPM = sf_conv(SPM, ver, 'xVol', 'VRpv');
-SPM = sf_conv(SPM, ver, 'Vbeta');
-SPM = sf_conv(SPM, ver, 'VResMS');
-SPM = sf_conv(SPM, ver, 'VM');
-o = des_struct(o, SPM);
-
-xCon = get_contrasts(o);
-if ~isempty(xCon)
- for i = 1:length(xCon)
- xCon(i) = sf_conv(xCon(i), ver, 'Vcon');
- xCon(i) = sf_conv(xCon(i), ver, 'Vspm');
- end
-end
-o = set_contrasts(o, xCon, 0);
-return
-
-function S = sf_conv(S, ver, varargin)
-V = mars_struct('getifthere', S, varargin{:});
-if ~isempty(V)
- V = mars_vol_utils('convert', V, ver);
- S = setfield(S, varargin{:}, V);
-end
-return
diff --git a/lib/marsbar-0.44/@mardo_2/design_vol.m b/lib/marsbar-0.44/@mardo_2/design_vol.m
deleted file mode 100644
index 4701d30..0000000
--- a/lib/marsbar-0.44/@mardo_2/design_vol.m
+++ /dev/null
@@ -1,32 +0,0 @@
-function V = design_vol(D, imgs)
-% returns vols in appropriate format for saving in design
-% FORMAT V = design_vol(D, imgs)
-%
-% Input
-% D - mardo design object
-% imgs - image names or vol structs
-%
-% Output
-% V - paths relative to swd
-%
-% $Id$
-
-if nargin < 2
- error('Need image information');
-end
-
-if iscell(imgs)
- imgs = char(imgs);
-end
-if ischar(imgs)
- imgs = full_vol(D, imgs);
-end
-if isstruct(imgs)
- V = imgs;
- fnames = spm_str_manip(strvcat(imgs(:).fname), 't');
- for i = 1:prod(size(imgs))
- V(i).fname = deblank(fnames(i,:));
- end
-else
- error('Odd input format for images');
-end
diff --git a/lib/marsbar-0.44/@mardo_2/estimate.m b/lib/marsbar-0.44/@mardo_2/estimate.m
deleted file mode 100644
index 877e1d6..0000000
--- a/lib/marsbar-0.44/@mardo_2/estimate.m
+++ /dev/null
@@ -1,103 +0,0 @@
-function [marsD] = estimate(marsD, marsY, params)
-% estimate method - estimates GLM for SPM2 model
-%
-% marsD - SPM design object
-% marsY - MarsBaR data object or 2D data matrix
-% params - struct containing options, as fields
-% redo_covar - if 1, remodels covariance
-% redo_whitening - if 1, recalcalates whitening
-% (by default, both are set to 1)
-%
-% e.g.
-% % Estimate model on design D and data Y, using original covariance and
-% % whitening
-% E = estimate(D, Y, struct('reco_covar', 0, ...
-% 'redo_whitening', 0);
-%
-% $Id$
-
-def_params = struct(...
- 'redo_covar', 1, ...
- 'redo_whitening', 1);
-
-if nargin < 2
- error('Need data to estimate');
-end
-if nargin < 3
- params = [];
-end
-
-% Replicate original behaviour calling with cell array of strings
-params = sf_call_compat(params);
-
-% Fill with defaults
-params = mars_struct('ffillmerge', def_params, params);
-
-% ensure we have a data object
-marsY = marsy(marsY);
-
-% check design is complete
-if ~can_mars_estimate(marsD)
- error('This design needs more information before it can be estimated');
-end
-
-% Check data and design dimensions
-if n_time_points(marsY) ~= n_time_points(marsD)
- error('The data and design must have the same number of rows');
-end
-
-% get SPM design structure
-SPM = des_struct(marsD);
-
-% process params
-if params.redo_covar
- if isfield(SPM, 'xVi')
- if isfield(SPM.xVi, 'V') & isfield(SPM.xVi, 'Vi')
- SPM.xVi = rmfield(SPM.xVi, 'V');
- if verbose(marsD)
- disp('Re-estimating covariance');
- end
- end
- end
-end
-if params.redo_whitening
- if isfield(SPM.xX, 'W')
- SPM.xX = rmfield(SPM.xX, 'W');
- if verbose(marsD)
- disp('Re-estimating whitening filter');
- end
- end
-end
-
-SPM = pr_estimate(SPM, marsY);
-SPM.marsY = marsY;
-SPM.SPMid = sprintf('SPM2: MarsBaR estimation. mardo_2 version %s', ...
- marsD.cvs_version);
-
-% return modified structure
-marsD = des_struct(marsD, SPM);
-
-return
-
-function params = sf_call_compat(params)
-% Replicates old calling behaviour, for backwards compatibility
-
-% Replicate result of passing empty cell array, but warn that this
-% will be removed soon
-if ischar(params) | iscell(params)
- warning(['Cell / char form of params deprecated, ' ...
- 'please use struct form instead']);
-end
-if iscell(params) & isempty(params)
- warning(['Empty cell array changes default options; '...
- 'This behaviour will change for future versions']);
- params = struct(...
- 'redo_covar', 0, ...
- 'redo_whitening', 0);
-end
-if ischar(params)params = {params}; end
-if iscell(params)
- params = params(:);
- params = cell2struct(num2cell(ones(size(params))), params, 1);
-end
-return
diff --git a/lib/marsbar-0.44/@mardo_2/event_cols.m b/lib/marsbar-0.44/@mardo_2/event_cols.m
deleted file mode 100644
index 6fe43f9..0000000
--- a/lib/marsbar-0.44/@mardo_2/event_cols.m
+++ /dev/null
@@ -1,18 +0,0 @@
-function I = event_cols(D, e_spec)
-% method gets design columns for single event
-%
-% $Id$
-
-if nargin < 2
- error('Need design and event spec');
-end
-if ~is_fmri(D)
- error('Needs FMRI design');
-end
-
-SPM = des_struct(D);
-Sess = SPM.Sess;
-bf = SPM.xBF.bf;
-ss = e_spec(1);
-en = e_spec(2);
-I = Sess(ss).col(Sess(ss).Fc(en).i(1:size(bf,2)));
diff --git a/lib/marsbar-0.44/@mardo_2/event_onsets.m b/lib/marsbar-0.44/@mardo_2/event_onsets.m
deleted file mode 100644
index 5031442..0000000
--- a/lib/marsbar-0.44/@mardo_2/event_onsets.m
+++ /dev/null
@@ -1,40 +0,0 @@
-function [onsets, durations] = event_onsets(D, e_spec)
-% method gets onsets and durations for event/session
-% FORMAT [onsets durations] = event_onsets(D, e_spec)
-%
-% D - design object
-% e_spec - event specification (see event_fitted for details)
-%
-% Returns
-% onsets - onset times in TRs
-% durations - duration of events in TRs
-%
-% $Id$
-
-if nargin < 2
- error('Need design and event spec');
-end
-if ~is_fmri(D)
- error('Needs FMRI design');
-end
-if prod(size(e_spec)) > 2
- error('Can only deal with one event at a time');
-end
-
-s = e_spec(1);
-e = e_spec(2);
-SPM = des_struct(D);
-
-U = SPM.Sess(s).U(e);
-onsets = U.ons;
-durations = U.dur;
-
-if strcmp(SPM.xBF.UNITS, 'secs')
- TR = tr(D);
- onsets = onsets / TR;
- durations = durations / TR;
-end
-
-if prod(size(durations)) == 1
- durations = ones(size(onsets)) * durations;
-end
diff --git a/lib/marsbar-0.44/@mardo_2/event_regressor.m b/lib/marsbar-0.44/@mardo_2/event_regressor.m
deleted file mode 100644
index cf34eca..0000000
--- a/lib/marsbar-0.44/@mardo_2/event_regressor.m
+++ /dev/null
@@ -1,44 +0,0 @@
-function [X, dt] = event_regressor(D, e_spec, dur)
-% method gets estimated regressor for single event
-% FORMAT [X dt] = event_regressor(D, e_spec, dur)
-%
-% D - design object
-% e_spec - event specification (see event_fitted for details)
-% dur - event duration in seconds (default = 0)
-%
-% Returns
-% X - event regressor for single event
-% (one column per basis function used to model event)
-% dt - time units (seconds per row in X)
-%
-% $Id$
-
-if nargin < 2
- error('Need design and event spec');
-end
-if nargin < 3
- dur = 0;
-end
-if ~is_fmri(D)
- error('Needs FMRI design');
-end
-
-if size(e_spec, 1) == 1, e_spec = e_spec'; end
-
-SPM = des_struct(D);
-Sess = SPM.Sess;
-dt = SPM.xBF.dt;
-bf = SPM.xBF.bf;
-ss = e_spec(1);
-en = e_spec(2);
-
-if ~dur
- % SPM2 does a second's worth of spike for events without durations
- sf = 1/dt;
-else
- sf = ones(round(dur/dt), 1);
-end
-X = [];
-for b = 1:size(bf,2)
- X = [X conv(sf, bf(:,b))];
-end
diff --git a/lib/marsbar-0.44/@mardo_2/event_specs.m b/lib/marsbar-0.44/@mardo_2/event_specs.m
deleted file mode 100644
index 8b14a4d..0000000
--- a/lib/marsbar-0.44/@mardo_2/event_specs.m
+++ /dev/null
@@ -1,31 +0,0 @@
-function [e_specs, e_names] = event_specs(D)
-% method to return event specifications for all event in model
-% FORMAT [e_specs, e_names] = event_specs(D)
-%
-% D - design object
-%
-% Returns
-% e_specs - event specification 2 by N matrix where row 1 is the
-% session number of the event, row 2 is the event number in
-% the session
-%
-% e_names - names of each event
-%
-% $Id$
-
-if ~is_fmri(D)
- error('Needs FMRI design');
-end
-
-SPM = des_struct(D);
-Sess = SPM.Sess;
-nsess = length(Sess);
-
-e_specs = [];
-e_names = {};
-e_ctr = 1;
-for ss = 1:nsess
- nevs = length(Sess(ss).U);
- e_specs = [e_specs [ones(1, nevs) * ss; 1:nevs]];
- e_names = [e_names {Sess(ss).Fc(:).name}];
-end
diff --git a/lib/marsbar-0.44/@mardo_2/event_x_fir.m b/lib/marsbar-0.44/@mardo_2/event_x_fir.m
deleted file mode 100644
index 85a15f8..0000000
--- a/lib/marsbar-0.44/@mardo_2/event_x_fir.m
+++ /dev/null
@@ -1,96 +0,0 @@
-function Xn = event_x_fir(D, e_spec, bin_length, bin_no, opts)
-% method to return FIR design matrix columns for session
-% FORMAT Xn = event_x_fir(D, e_spec, bin_length, bin_no, opts)
-%
-% D - design object
-% e_spec - event specification for single event
-% [session no; event no]
-% bin_length - bin length in seconds [TR]
-% bin_no - number of bins for FIR [25 seconds / bin_length]
-% opts - structure, containing fields with options
-% 'single' - if field present, gives single FIR
-% This option removes any duration information, and
-% returns a simple per onset FIR model, where ones in the
-% design matrix corresponds to 1 event at the given
-% offset. See event_fitted_fir.m for more details.
-%
-% Returns
-% Xn - columns in design matrix for FIR model
-%
-% $Id$
-
-if nargin < 2
- error('Need event specfication');
-end
-if nargin < 3
- bin_length = [];
-end
-if nargin < 4
- bin_no = [];
-end
-if nargin < 5
- opts = [];
-end
-
-s = e_spec(1);
-e = e_spec(2);
-if isempty(bin_length)
- bin_length = tr(D);
-end
-if isempty(bin_no)
- bin_no = round(25/bin_length);
-end
-
-SPM = des_struct(D);
-
-xBF = SPM.xBF;
-xBF.name = 'Finite Impulse Response';
-xBF.order = bin_no;
-xBF.length = xBF.order*bin_length;
-xBF = pr_spm_get_bf(xBF);
-
-U = SPM.Sess(s).U(e);
-k = SPM.nscan(s);
-
-% If all the durations are zero, the model is already single. The stick
-% function values have been set to 1/dt though, which is confusing, so
-% we'll reset the stick functions to have 1s
-if ~any(U.dur), opts.single = 1; end
-
-if isfield(opts, 'single')
- U.u = sf_ones_ons(U, xBF, k);
- if verbose(D)
- if any(diff(U.dur))
- warning(['Different event durations; ' ...
- 'single FIR model likely to be invalid']);
- end
- end
-else
- U.u = U.u(:,1);
-end
-
-Xn = pr_spm_volterra(U,xBF.bf,1);
-Xn = Xn([0:(k - 1)]* xBF.T + xBF.T0 + 32,:);
-
-return
-
-function sf = sf_ones_ons(U, xBF, k)
-% Return onsets with only 1s in start time bin for each event
-
-ons = U.ons;
-T = xBF.T;
-dt = xBF.dt;
-switch xBF.UNITS
- case 'scans'
- TR = T*dt;
- case 'secs'
- TR = 1;
-end
-
-ton = round(ons*TR/dt) + 32;
-sf = sparse((k*T + 128),1);
-for j = 1:length(ton)
- sf(ton(j),:) = sf(ton(j),:) + 1;
-end
-
-return
diff --git a/lib/marsbar-0.44/@mardo_2/fill.m b/lib/marsbar-0.44/@mardo_2/fill.m
deleted file mode 100644
index c4fec54..0000000
--- a/lib/marsbar-0.44/@mardo_2/fill.m
+++ /dev/null
@@ -1,291 +0,0 @@
-function D = fill(D, actions)
-% fills missing entries from SPM FMRI design matrix
-% FORMAT D = fill(D, actions)
-%
-% D - mardo object containing spm design
-% actions - string or cell array of strings with actions:
-% 'defaults' - fills empty parts of design with defaults
-% (in fact this is always done)
-% 'filter' - asks for and fills filter
-% 'autocorr' - asks for and fills autocorrelation
-% 'for_estimation' fill filter &| autocorr if not present
-% 'images' - asks for and fills with images, mask, scaling
-%
-% Returns
-% D - returned mardo SPM design
-%
-% Copied/pasted then rearranged from SPM2 spm_fmri_spm_ui
-% Matthew Brett - 17/11/01 - MRS2TH
-%
-% $Id$
-
-if nargin < 2
- actions = '';
-end
-if ~is_fmri(D), return, end
-if isempty(actions), actions = {'defaults'}; end
-if ischar(actions), actions = {actions}; end
-fe = find(ismember(actions, 'for_estimation'));
-if ~isempty(fe)
- A = [];
- if is_fmri(D)
- if ~has_filter(D), A = {'filter'}; end
- if ~has_autocorr(D), A = [A {'autocorr'}]; end
- end
- actions(fe) = [];
- actions = [actions(1:fe(1)-1) A actions(fe(1):end)];
-end
-actions = [{'defaults'}, actions];
-
-% Get design, put into some useful variables
-v_f = verbose(D);
-SPM = des_struct(D);
-xX = SPM.xX;
-have_sess = isfield(SPM, 'Sess');
-if have_sess, Sess = SPM.Sess; end
-
-% get file indices
-%---------------------------------------------------------------
-row = block_rows(D);
-nsess = length(row);
-nscan = zeros(1,nsess);
-for i = 1:nsess
- nscan(i) = length(row{i});
-end
-
-done_list = {};
-for a = 1:length(actions)
- if ismember(actions{a}, done_list), continue, end
- done_list = [actions(a) done_list];
- switch lower(actions{a})
- case 'defaults'
-
- % prepare various default settings, offer to design
- xM = []; % masking
- xGX = []; % globals
- sGXcalc = 'none'; % global calculation description
- sGMsca = 'none'; % grand mean scaling description
- Global = 'none'; % proportional scaling or no
-
- BFstr = ''; DSstr = ''; ntr = [];
- if have_sess
- % Number of trial types per session
- for i = 1:nsess, ntr(i) = length(SPM.Sess(i).U); end
- BFstr = SPM.xBF.name;
- end
-
- xsDes = struct(...
- 'Basis_functions', BFstr,...
- 'Number_of_sessions', sprintf('%d',nsess),...
- 'Trials_per_session', sprintf('%-3d',ntr),...
- 'Global_calculation', sGXcalc,...
- 'Grand_mean_scaling', sGMsca,...
- 'Global_normalisation', Global);
-
- if isfield(SPM, 'xsDes')
- xsDes = mars_struct('fillafromb', SPM.xsDes, xsDes);
- end
-
- SPM.xsDes = xsDes;
- SPM = mars_struct('merge', SPM, ...
- struct('xGX', xGX,...
- 'xM', xM));
-
- case 'images'
- [Finter,Fgraph,CmdLine] = spm('FnUIsetup','fMRI stats model setup',0);
- % get filenames
- %---------------------------------------------------------------
- P = [];
- for i = 1:nsess
- str = sprintf('select scans for session %0.0f',i);
- q = spm_get(nscan(i),mars_veropts('get_img_ext'),str);
- P = strvcat(P,q);
- end
-
- % place in data field
- %---------------------------------------------------------------
- SPM.xY.P = P;
-
- % Assemble remaining design parameters
- %=======================================================================
-
- % Global normalization
- %-----------------------------------------------------------------------
- spm_input('Global intensity normalisation...',1,'d',mfilename)
- str = 'remove Global effects';
- SPM.xGX.iGXcalc = spm_input(str,'+1','scale|none',{'Scaling' 'None'});
- SPM.xGX.sGXcalc = 'mean voxel value';
- SPM.xGX.sGMsca = 'session specific';
-
- % Assemble other design parameters
- %=======================================================================
- spm_help('!ContextHelp',mfilename)
- spm_input('Global intensity normalisation...',1,'d',mfilename);
-
- % get file identifiers and Global values
- %=======================================================================
- fprintf('%-40s: ','Mapping files') %-#
- VY = spm_vol(SPM.xY.P);
- fprintf('%30s\n','...done') %-#
-
- %-Check compatability of images
- %-----------------------------------------------------------------------
- [samef msg] = mars_vol_check(VY);
- if ~samef, disp(char(msg)),error('Cannot use images'),end;
-
- %-place in xY
- %-----------------------------------------------------------------------
- SPM.xY.VY = VY;
-
- %-Compute Global variate
- %=======================================================================
- GM = 100;
- q = length(VY);
- g = zeros(q,1);
- fprintf('%-40s: %30s','Calculating globals',' ') %-#
- for i = 1:q
- fprintf('%s%30s',repmat(sprintf('\b'),1,30),sprintf('%4d/%-4d',i,q)) %-#
- g(i) = spm_global(VY(i));
- end
- fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-#
-
- % scale if specified (otherwise session specific grand mean scaling)
- %-----------------------------------------------------------------------
- gSF = GM./g;
- if strcmp(SPM.xGX.iGXcalc,'None')
- for i = 1:nsess
- gSF(SPM.Sess(i).row) = GM./mean(g(SPM.Sess(i).row));
- end
- end
-
- %-Apply gSF to memory-mapped scalefactors to implement scaling
- %-----------------------------------------------------------------------
- for i = 1:q
- SPM.xY.VY(i).pinfo(1:2,:) = SPM.xY.VY(i).pinfo(1:2,:)*gSF(i);
- end
-
- %-place global variates in global structure
- %-----------------------------------------------------------------------
- SPM.xGX.rg = g;
- SPM.xGX.GM = GM;
- SPM.xGX.gSF = gSF;
-
-
- %-Masking structure
- %---------------------------------------------------------------
- SPM.xM = struct('T', ones(q,1),...
- 'TH', g.*gSF,...
- 'I', 0,...
- 'VM', {[]},...
- 'xs', struct('Masking','analysis threshold'));
-
- xsDes = struct(...
- 'Global_calculation', SPM.xGX.sGXcalc,...
- 'Grand_mean_scaling', SPM.xGX.sGMsca,...
- 'Global_normalisation', SPM.xGX.iGXcalc);
-
- SPM.xsDes = mars_struct('ffillmerge',...
- SPM.xsDes,...
- xsDes);
-
- case 'filter'
- % Get filter
- if ~have_sess, return, end
-
- [Finter,Fgraph,CmdLine] = spm('FnUIsetup', 'FMRI model filter', 0);
-
- % TR if not set (it should be)
- if ~mars_struct('isthere', SPM, 'xY', 'RT')
- SPM.xY.RT = spm_input('Interscan interval {secs}','+1');
- end
- SPM.xsDes.Interscan_interval = sprintf('%0.2f {s}',SPM.xY.RT);
-
- spm_input('High pass filter','+1','d',mfilename)
- [SPM.xX.K SPM.xsDes.High_pass_Filter] = ...
- pr_get_filter(SPM.xY.RT, SPM.Sess);
-
- case 'autocorr'
- [Finter,Fgraph,CmdLine] = ...
- spm('FnUIsetup','FMRI autocorrelation options',0);
-
- % Contruct Vi structure for non-sphericity ReML estimation
- %===============================================================
- str = 'Correct for serial correlations?';
- cVi = {'none', 'SPM AR(0.2)','SPM AR (specify)', 'fmristat AR(n)'};
- cVi = spm_input(str,'+1','m',cVi, cVi);
-
- % create Vi struct
- %-----------------------------------------------------------------------
- vox_cov_possible = 0;
- switch lower(cVi{1})
-
- case 'fmristat ar(n)'
- % Fit fmristat model AR(n)
- %---------------------------------------------------------------
- cVi = spm_input('fmristat AR model order', '+1', 'e', 2);
- SPM.xVi.Vi = struct('type', 'fmristat', 'order', cVi);
- cVi = sprintf('fmristat AR(%d)',cVi);
- f2cl = 'V'; % Field to CLear
-
- case 'spm ar (specify)'
- % SPM AR coefficient(s) to be specified
- %---------------------------------------------------------------
- cVi = spm_input('AR rho parameter(s)', '+1', 'e', 0.2);
- SPM.xVi.Vi = pr_spm_ce(nscan,cVi);
- cVi = sprintf('AR(%0.1f)',cVi(1));
- f2cl = 'V';
- vox_cov_possible = 1;
-
- case 'none'
- % xVi.V is i.i.d
- %---------------------------------------------------------------
- SPM.xVi.V = speye(sum(nscan));
- cVi = 'i.i.d';
- f2cl = 'Vi';
-
- otherwise
- % otherwise assume AR(0.2) in xVi.Vi
- %---------------------------------------------------------------
- SPM.xVi.Vi = pr_spm_ce(nscan,0.2);
- cVi = 'AR(0.2)';
- f2cl = 'V';
- vox_cov_possible = 1;
-
- end
-
- % If we've set V, need to clear Vi, because the
- % estimate method takes the presence of Vi to mean that
- % V can be cleared, with 'redo_covar' flag
- % Conversely V needs to be cleared if Vi was estimated
- if isfield(SPM.xVi, f2cl)
- SPM.xVi = rmfield(SPM.xVi, f2cl);
- if v_f, fprintf('Clearing previous %s matrix\n', f2cl); end
- end
-
- % Also: remove previous W matrices
- % Either will need to be recalculated or won't be used
- if isfield(SPM.xX, 'W')
- SPM.xX = rmfield(SPM.xX, 'W');
- if v_f, fprintf('Clearing previous W matrix\n'); end
- end
-
- % Whether to average covariance estimates over voxels
- SPM.xVi.cov_calc = 'summary';
- if vox_cov_possible
- if spm_input('Use voxel data for covariance','+1','y/n', [1 0], 1);
- SPM.xVi.cov_calc = 'vox';
- end
- end
-
- % fill into design
- SPM.xVi.form = cVi;
- xsDes = struct('Serial_correlations', SPM.xVi.form);
- SPM.xsDes = mars_struct('ffillmerge', SPM.xsDes, xsDes);
-
- otherwise
- error(['Unpredictable: ' actions{a}]);
- end
-end
-
-% put stuff into object
-D = des_struct(D,SPM);
diff --git a/lib/marsbar-0.44/@mardo_2/fwhm.m b/lib/marsbar-0.44/@mardo_2/fwhm.m
deleted file mode 100644
index 311eccc..0000000
--- a/lib/marsbar-0.44/@mardo_2/fwhm.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function f = fwhm(o)
-% method returns FWHM, or empty if not available
-%
-% $Id: tr.m,v 1.1 2004/01/26 22:08:55 matthewbrett Exp $
-
-f = [];
-SPM = des_struct(o);
-if mars_struct('isthere', SPM, 'xVol', 'FWHM')
- f = SPM.xVol.FWHM;
-end
diff --git a/lib/marsbar-0.44/@mardo_2/get_images.m b/lib/marsbar-0.44/@mardo_2/get_images.m
deleted file mode 100644
index abf9922..0000000
--- a/lib/marsbar-0.44/@mardo_2/get_images.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function VY = get_images(marsD)
-% method to get image vols from design
-% FORMAT VY = get_images(marsD)
-%
-% $Id$
-
-D = des_struct(marsD);
-VY = D.xY.VY;
diff --git a/lib/marsbar-0.44/@mardo_2/has_autocorr.m b/lib/marsbar-0.44/@mardo_2/has_autocorr.m
deleted file mode 100644
index b890dac..0000000
--- a/lib/marsbar-0.44/@mardo_2/has_autocorr.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function tf = has_autocorr(o)
-% returns 1 if object contains autocorrelation specification
-%
-% $Id$
-
-tf = 0;
-des = des_struct(o);
-if isfield(des, 'xVi')
- tf = isfield(des.xVi, 'Vi') | isfield(des.xVi, 'V');
-end
diff --git a/lib/marsbar-0.44/@mardo_2/has_filter.m b/lib/marsbar-0.44/@mardo_2/has_filter.m
deleted file mode 100644
index bdbd733..0000000
--- a/lib/marsbar-0.44/@mardo_2/has_filter.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function tf = has_filter(o)
-% returns 1 if object contains filter
-%
-% $Id$
-
-tf = 0;
-des = des_struct(o);
-if isfield(des, 'xX')
- tf = isfield(des.xX, 'K');
-end
diff --git a/lib/marsbar-0.44/@mardo_2/has_images.m b/lib/marsbar-0.44/@mardo_2/has_images.m
deleted file mode 100644
index 1277253..0000000
--- a/lib/marsbar-0.44/@mardo_2/has_images.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function tf = has_images(o)
-% returns 1 if design contains images
-%
-% $Id$
-
-tf = 0;
-des = des_struct(o);
-if isfield(des, 'xY')
- tf = isfield(des.xY, 'VY');
-end
diff --git a/lib/marsbar-0.44/@mardo_2/has_whitener.m b/lib/marsbar-0.44/@mardo_2/has_whitener.m
deleted file mode 100644
index f179ef8..0000000
--- a/lib/marsbar-0.44/@mardo_2/has_whitener.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function tf = has_whitener(D)
-% returns 1 if design has whitening filter
-%
-% $Id$
-
-tf = 0;
-SPM = des_struct(D);
-if isfield(SPM, 'xX')
- tf = isfield(SPM.xX, 'W');
-end
diff --git a/lib/marsbar-0.44/@mardo_2/mardo_2.m b/lib/marsbar-0.44/@mardo_2/mardo_2.m
deleted file mode 100644
index 01d8e83..0000000
--- a/lib/marsbar-0.44/@mardo_2/mardo_2.m
+++ /dev/null
@@ -1,123 +0,0 @@
-function [o, others] = mardo_2(params, others, varargin)
-% class constructor for SPM2 MarsBaR design object
-% FORMAT [o, others] = mardo_2(params, others, varargin)
-% Inputs
-% params - structure,containing fields, or SPM/MarsBaR design
-% others - structure, containing other fields to define
-%
-% Outputs
-% o - mardo_2 object (unless disowned)
-% others - any unrecognized fields from params, for processing by
-% children
-%
-% This object is called from the mardo object contructor
-% with a mardo object as input. mardo_2 checks to see
-% if the contained design is an SPM2 design, returns
-% the object unchanged if not. If it is an SPM2
-% design, it claims ownership of the passed object.
-%
-% Note the third argument. If this call is a call as a constructor (i.e
-% not an action string call), this can be the 'child_pass_f', which is 1
-% if this call is from a child, passing a mardo object to be handled by
-% the mardo_2 class. In this case we just accept this design is for us,
-% and don't do any SPM2 specific processing
-%
-% The constructor can also be called to give class functions, where the
-% name of the class function is a character string which is one of:
-% 'spm_filter' - applies spm_filter routine to passed args
-%
-% $Id$
-
-myclass = 'mardo_2';
-cvs_v = marsbar('ver'); % was CVS version; now marsbar version
-
-% Default object structure
-defstruct = [];
-
-if nargin < 1
- defstruct.cvs_version = cvs_v;
- o = class(defstruct, myclass, mardo);
- others = [];
- return
-end
-if nargin < 2
- others = [];
-end
-if nargin < 3
- arg3 = 0;
-else
- arg3 = varargin{1};
-end
-
-% parse out string action calls (class functions)
-if ischar(params)
- switch params
- case 'spm_filter'
- if nargin < 2
- error('Need filter');
- elseif nargin < 3
- o = pr_spm_filter(others);
- else
- o = pr_spm_filter(others, arg3);
- end
- return
- otherwise
- error(sprintf('Is "%s" a filename? Use ``mardo`` to load from files',...
- params));
- end
-end
-
-% Deal with passed objects of this (or child) class
-if isa(params, myclass)
- o = params;
- % Check for simple form of call
- if isempty(others), return, end
-
- % Otherwise, we are being asked to set fields of object
- % (Moot at the moment, as there are no fields specific for this object)
- [p others] = mars_struct('split', others, defstruct);
- return
-end
-
-% Set child_pass_f
-child_pass_f = arg3;
-
-% normal call is via mardo constructor
-if isa(params, 'mardo')
- % Check to see if this is a suitable design, return if not
- des = des_struct(params);
- if ~arg3 & ~my_design(des), o = params; return, end
- % own
- if isfield(des, 'SPM')
- des = des.SPM;
- end
- uo = des_struct(params, des);
- params = [];
-else
- uo = [];
-end
-
-if ~isa(uo, 'mardo') % mardo object not passed
- % umbrella object, parse out fields for (this object and children)
- % third argument of 0 prevents recursive call back to here
- [uo, params] = mardo(params, others, 0);
-else
- % fill params with other parameters
- params = mars_struct('ffillmerge', params, others);
-end
-
-% parse parameters into those for this object, children
-[params, others] = mars_struct('ffillsplit', defstruct, params);
-
-% add cvs tag
-params.cvs_version = cvs_v;
-
-% set the mardo object
-o = class(params, myclass, uo);
-
-% convert vols to current format, if not passed from a child
-if ~child_pass_f
- o = convert_vols(o);
-end
-
-return
diff --git a/lib/marsbar-0.44/@mardo_2/mardo_99.m b/lib/marsbar-0.44/@mardo_2/mardo_99.m
deleted file mode 100644
index 60cca6f..0000000
--- a/lib/marsbar-0.44/@mardo_2/mardo_99.m
+++ /dev/null
@@ -1,105 +0,0 @@
-function o = mardo_99(o)
-% method to convert SPM2 design to SPM99 design
-%
-% The conversion is crude, and only transfers those fields
-% known to be of use in MarsBaR estimation
-%
-% $Id$
-
-% Process design
-params = paramfields(o);
-des = params.des_struct;
-
-% Transfer images, if present
-if isfield(des,'xY')
- des = mars_struct('merge', des, ...
- mars_struct('split', des.xY, {'VY', 'RT'}));
- des = rmfield(des, 'xY');
-end
-
-% move names
-des.xX.Xnames = des.xX.name;
-
-% Strip unused fields
-des.xX = mars_struct('strip', des.xX, {'W', 'name'});
-
-% convert sessions (sort of)
-if isfield(des, 'Sess')
- S = des.Sess;
- % get basis function stuff
- BFstr = des.xBF.name;
- bf = des.xBF.bf;
- des.xX.dt = des.xBF.dt;
- for s = 1:length(S)
- Ss = S(s);
- nconds = length(Ss.U);
- % Rows, cols
- S2{s}.row = Ss.row;
- S2{s}.col = Ss.col;
- % Set basis functions
- S2{s}.BFstr = BFstr;
- S2{s}.DSstr = 'Variable SOA ';
- % Other comparable stuff
- for t = 1:nconds
- S2{s}.name(t) = Ss.U(t).name;
- S2{s}.ons{t} = Ss.U(t).ons;
- S2{s}.pst{t} = Ss.U(t).pst;
- S2{s}.sf{t} = Ss.U(t).u(33:end,:);
- S2{s}.ind{t} = Ss.Fc(t).i;
- S2{s}.bf{t} = bf;
- % Parametric modulation
- if Ss.U(t).P.h
- S2{s}.Pname{t} = Ss.U(t).P.name;
- S2{s}.Pv{t} = Ss.U(t).P.P;
- else
- S2{s}.Pname{t} = '';
- S2{s}.Pv{t} = [];
- end
- end
- % Not sensibly set stuff
- S2{s}.rep = 0;
- end
- des.Sess = S2;
-end
-
-% Remove basis function field
-des = mars_struct('strip', des, {'xBF'});
-
-% covariance priors
-if isfield(des,'xVi')
- fprintf('Removing SPM2 non-sphericity information\n');
- rmfield(des,'xVi');
-end
-
-% convert filter structure
-if isfield(des.xX, 'K')
- K = des.xX.K;
- if isstruct(K)
- def_filt = struct('RT',0,...
- 'row',[],...
- 'LChoice','none',...
- 'LParam', 0,...
- 'HChoice','specify',...
- 'HParam',0);
- for k = 1:length(K)
- % split off useful fields
- K2{k} = mars_struct('splitmerge',K(k),def_filt);
- end
- elseif K == 1
- K2 = eye(size(des.xX,1));
- else
- K2 = K;
- end
- des.xX.K = K2;
-end
-
-% Default F contrast field
-des.F_iX0 = struct('iX0', [des.xX.iB des.xX.iG], ...
- 'name', 'effects of interest');
-
-% Need to identify as SPM99 design
-des.SPMid = ['SPM99: Results imported from SPM2 design: ' des.SPMid];
-
-% put into parent object
-params.des_struct = des;
-o = mardo_99(params);
diff --git a/lib/marsbar-0.44/@mardo_2/mars_spm_graph.m b/lib/marsbar-0.44/@mardo_2/mars_spm_graph.m
deleted file mode 100644
index 9017f5e..0000000
--- a/lib/marsbar-0.44/@mardo_2/mars_spm_graph.m
+++ /dev/null
@@ -1,591 +0,0 @@
-function [r_st,marsD,changef] = mars_spm_graph(marsD,rno,Ic)
-% Graphical display of adjusted data
-% FORMAT [r_st,marsD,changef] = mars_spm_graph(marsD,rno,Ic)
-%
-% marsD - SPM design object
-% required fields in des_struct are:
-% xX - Design Matrix structure
-% - (see spm_spm.m for structure)
-% betas - the betas!
-% ResidualMS - the residual mean square
-% xCon - contrast definitions
-% - required fields are:
-% .c - contrast vector/matrix
-% (see spm_FcUtil.m for details of contrast structure... )
-% marsY - MarsBaR data object
-%
-% rno - region number (index for marsD.marsY)
-% Ic - contrast number (optional)
-%
-% Returns
-% r_st - return structure, with fields
-% Y - fitted data for the selected voxel
-% y - adjusted data for the selected voxel
-% beta - parameter estimates
-% Bcov - covariance of parameter estimates
-% cbeta = betas multiplied by contrast
-% marsD - design structure, with possibly added contrasts
-% changef - set to 1 if design has changed
-%
-% see spm2 version of spm_graph for details
-%_______________________________________________________________________
-% @(#)spm_graph.m 2.43 Karl Friston 03/12/19
-%
-% $Id$
-
-if ~is_mars_estimated(marsD)
- error('Need estimated design for plot');
-end
-if nargin < 2
- rno = [];
-end
-if nargin < 3
- Ic = [];
-end
-changef = 0;
-
-% make values ready for return
-def_r_st = struct(...
- 'Y', [],...
- 'y', [],...
- 'beta', [],...
- 'SE', [],...
- 'cbeta',[], ...
- 'PSTH',[]);
-cbeta = []; PSTH = [];
-
-% get stuff from object
-SPM = des_struct(marsD);
-xCon = SPM.xCon;
-
-% Check if we want to, and can, assume region no is 1
-if isempty(rno)
- if n_regions(SPM.marsY) > 1
- error('Need to specify region number');
- end
- rno = 1;
-end
-
-% Get required data and filter
-sY = summary_data(SPM.marsY);
-y = apply_filter(marsD, sY(:, rno));
-
-% Get design matrix for convenience
-xX = SPM.xX;
-
-% Label for region
-XYZstr = region_name(SPM.marsY, rno);
-XYZstr = XYZstr{1};
-
-%-Get parameter estimates, ResidualMS, (compute) fitted data & residuals
-%=======================================================================
-
-%-Parameter estimates: beta = xX.pKX*xX.K*y;
-%-----------------------------------------------------------------------
-beta = SPM.betas(:, rno);
-
-%-Residual mean square: ResidualMS = sum(R.^2)/xX.trRV;
-%-----------------------------------------------------------------------
-ResidualMS = SPM.ResidualMS(rno);
-Bcov = ResidualMS*SPM.xX.Bcov;
-
-%-Get Graphics figure handle
-%-----------------------------------------------------------------------
-Fgraph = spm_figure('GetWin','Graphics');
-
-
-%-Delete previous axis and their pagination controls (if any)
-%-----------------------------------------------------------------------
-spm_results_ui('Clear',Fgraph,2);
-
-%-Compute residuals
-%-----------------------------------------------------------------------
-if isempty(y)
-
- % make R = NaN so it will not be plotted
- %---------------------------------------------------------------
- R = NaN*ones(size(SPM.xX.X,1),1);
-
-else
- % residuals (non-whitened)
- %---------------------------------------------------------------
- R = spm_sp('r',SPM.xX.xKXs,y);
-
-end
-
-%-Get parameter and hyperparameter estimates
-%=======================================================================
-%-Parameter estimates: beta = xX.pKX*xX.K*y;
-%-Residual mean square: ResidualMS = sum(R.^2)/xX.trRV
-%---------------------------------------------------------------
-
-P05_Z = 1.6449; % = spm_invNcdf(1 - 0.05);
-CI = P05_Z;
-
-%-Colour specifications and index;
-%-----------------------------------------------------------------------
-Col = [0 0 0; .8 .8 .8; 1 .5 .5];
-
-%-Plot
-%=======================================================================
-
-% find out what to plot
-%-----------------------------------------------------------------------
-Cplot = { 'Contrast estimates and 90% C.I.',...
- 'Fitted responses',...
- 'Event-related responses',...
- 'Parametric responses',...
- 'Volterra Kernels'};
-
-
-% ensure options are appropriate
-%-----------------------------------------------------------------------
-try
- Sess = SPM.Sess;
-catch
- Cplot = Cplot(1:2);
-end
-Cplot = Cplot{spm_input('Plot',-1,'m',Cplot)};
-
-switch Cplot
-
-% select contrast if
-%----------------------------------------------------------------------
-case {'Contrast estimates and 90% C.I.','Fitted responses'}
-
- if isempty(Ic)
- % determine which contrast
- %---------------------------------------------------------------
- [Ic marsD changef] = ui_get_contrasts(...
- marsD, 'T|F',1, 'Select contrast...', ' for plot', 1);
- if changef, SPM.xCon = get_contrasts(marsD); end
- end
- TITLE = {Cplot SPM.xCon(Ic).name};
-
-% select session and trial if
-%----------------------------------------------------------------------
-case {'Event-related responses','Parametric responses','Volterra Kernels'}
-
- % get session
- %--------------------------------------------------------------
- s = length(Sess);
- if s > 1
- s = spm_input('which session','+1','n1',1,s);
- end
-
- % effect names
- %--------------------------------------------------------------
- switch Cplot
- case 'Volterra Kernels'
- u = length(Sess(s).Fc);
- otherwise
- u = length(Sess(s).U);
- end
- Uname = {};
- for i = 1:u
- Uname{i} = Sess(s).Fc(i).name;
- end
-
- % get effect
- %--------------------------------------------------------------
- str = sprintf('which effect');
- u = spm_input(str,'+1','m',Uname);
-
- % bin size
- %--------------------------------------------------------------
- dt = SPM.xBF.dt;
-
-end
-
-switch Cplot
-
-% plot parameter estimates
-%----------------------------------------------------------------------
-case 'Contrast estimates and 90% C.I.'
-
- % compute contrast of parameter estimates and 90% C.I.
- %--------------------------------------------------------------
- cbeta = SPM.xCon(Ic).c'*beta;
- CI = CI*sqrt(diag(SPM.xCon(Ic).c'*Bcov*SPM.xCon(Ic).c));
-
- % bar chart
- %--------------------------------------------------------------
- figure(Fgraph)
- subplot(2,1,2)
- cla
- hold on
-
- % estimates
- %--------------------------------------------------------------
- h = bar(cbeta);
- set(h,'FaceColor',Col(2,:))
-
- % standard error
- %--------------------------------------------------------------
- for j = 1:length(cbeta)
- line([j j],([CI(j) 0 - CI(j)] + cbeta(j)),...
- 'LineWidth',6,'Color',Col(3,:))
- end
-
- title(TITLE,'FontSize',12)
- xlabel('contrast')
- ylabel(['contrast estimate',XYZstr])
- set(gca,'XLim',[0.4 (length(cbeta) + 0.6)])
- hold off
-
- % set Y to empty so outputs are assigned
- %-------------------------------------------------------------
- Y = [];
-
-% all fitted effects or selected effects
-%-----------------------------------------------------------------------
-case 'Fitted responses'
-
- % predicted or adjusted response
- %---------------------------------------------------------------
- str = 'predicted or adjusted response?';
- if spm_input(str,'!+1','b',{'predicted','adjusted'},[1 0]);
-
- % fitted (predicted) data (Y = X1*beta)
- %--------------------------------------------------------
- Y = SPM.xX.X*SPM.xCon(Ic).c*pinv(SPM.xCon(Ic).c)*beta;
- else
-
- % fitted (corrected) data (Y = X1o*beta)
- %-------------------------------------------------------
- Y = spm_FcUtil('Yc',SPM.xCon(Ic),SPM.xX.xKXs,beta);
-
- end
-
- % adjusted data
- %---------------------------------------------------------------
- y = Y + R;
-
- % get ordinates
- %---------------------------------------------------------------
- Xplot = { 'an explanatory variable',...
- 'scan or time',...
- 'a user specified ordinate'};
- Cx = spm_input('plot against','!+1','m',Xplot);
-
- % an explanatory variable
- %---------------------------------------------------------------
- if Cx == 1
-
- str = 'Which explanatory variable?';
- i = spm_input(str,'!+1','m',SPM.xX.name);
- x = SPM.xX.xKXs.X(:,i);
- XLAB = SPM.xX.name{i};
-
- % scan or time
- %---------------------------------------------------------------
- elseif Cx == 2
-
- if isfield(SPM.xY,'RT')
- x = SPM.xY.RT*[1:size(Y,1)]';
- XLAB = 'time {seconds}';
- else
- x = [1:size(Y,1)]';
- XLAB = 'scan number';
- end
-
- % user specified
- %---------------------------------------------------------------
- elseif Cx == 3
-
- x = spm_input('enter ordinate','!+1','e','',size(Y,1));
- XLAB = 'ordinate';
-
- end
-
- % plot
- %---------------------------------------------------------------
- figure(Fgraph)
- subplot(2,1,2)
- cla
- hold on
- [p q] = sort(x);
- if all(diff(x(q)))
- plot(x(q),Y(q),'LineWidth',4,'Color',Col(2,:));
- plot(x(q),y(q),':','Color',Col(1,:));
- plot(x(q),y(q),'.','MarkerSize',8, 'Color',Col(3,:));
-
- else
- plot(x(q),Y(q),'.','MarkerSize',16,'Color',Col(1,:));
- plot(x(q),y(q),'.','MarkerSize',8, 'Color',Col(2,:));
- xlim = get(gca,'XLim');
- xlim = [-1 1]*diff(xlim)/4 + xlim;
- set(gca,'XLim',xlim)
-
- end
- title(TITLE,'FontSize',12)
- xlabel(XLAB)
- ylabel(['response',XYZstr])
- legend('fitted','plus error')
- hold off
-
-% modeling evoked responses based on Sess
-%----------------------------------------------------------------------
-case 'Event-related responses'
-
- % get plot type
- %--------------------------------------------------------------
- Rplot = { 'fitted response and PSTH',...
- 'fitted response and 90% C.I.',...
- 'fitted response and adjusted data'};
-
- if isempty(y)
- TITLE = Rplot{2};
- else
- TITLE = Rplot{spm_input('plot in terms of','+1','m',Rplot)};
- end
-
- % plot
- %--------------------------------------------------------------
- switch TITLE
- case 'fitted response and PSTH'
-
-
- % build a simple FIR model subpartition (X); bin size = TR
- %------------------------------------------------------
- str = 'bin size (secs)';
- BIN = sprintf('%0.2f',SPM.xY.RT);
- BIN = spm_input(str,'!+1','r',BIN);
- xBF = SPM.xBF;
- U = Sess(s).U(u);
- U.u = U.u(:,1);
- xBF.name = 'Finite Impulse Response';
- xBF.order = round(32/BIN);
- xBF.length = xBF.order*BIN;
- xBF = pr_spm_get_bf(xBF);
- BIN = xBF.length/xBF.order;
- X = pr_spm_volterra(U,xBF.bf,1);
- k = SPM.nscan(s);
- X = X([0:(k - 1)]*SPM.xBF.T + SPM.xBF.T0 + 32,:);
-
- % place X in SPM.xX.X
- %------------------------------------------------------
- jX = Sess(s).row;
- iX = Sess(s).col(Sess(s).Fc(u).i);
- iX0 = [1:size(SPM.xX.X,2)];
- iX0(iX) = [];
- X = [X SPM.xX.X(jX,iX0)];
- X = SPM.xX.W(jX,jX)*X;
- X = [X SPM.xX.K(s).X0];
-
- % Re-estimate to get PSTH and CI
- %------------------------------------------------------
- j = xBF.order;
- xX = spm_sp('Set',X);
- pX = spm_sp('x-',xX);
- PSTH = pX*y(jX);
- res = spm_sp('r',xX,y(jX));
- df = size(X,1) - size(X,2);
- bcov = pX*pX'*sum(res.^2)/df;
- PSTH = PSTH(1:j)/dt;
- PST = [1:j]*BIN - BIN/2;
- PCI = CI*sqrt(diag(bcov(1:j,(1:j))))/dt;
- end
-
- % basis functions and parameters
- %--------------------------------------------------------------
- X = SPM.xBF.bf/dt;
- x = ([1:size(X,1)] - 1)*dt;
- j = Sess(s).col(Sess(s).Fc(u).i(1:size(X,2)));
- B = beta(j);
-
- % fitted responses with standard error
- %--------------------------------------------------------------
- Y = X*B;
- CI = CI*sqrt(diag(X*Bcov(j,j)*X'));
-
- % peristimulus times and adjusted data (y = Y + R)
- %--------------------------------------------------------------
- pst = Sess(s).U(u).pst;
- bin = round(pst/dt);
- q = find((bin >= 0) & (bin < size(X,1)));
- y = R(Sess(s).row(:));
- pst = pst(q);
- y = y(q) + Y(bin(q) + 1);
-
- % plot
- %--------------------------------------------------------------
- figure(Fgraph)
- subplot(2,1,2)
- hold on
- switch TITLE
-
- case 'fitted response and PSTH'
- %------------------------------------------------------
- errorbar(PST,PSTH,PCI)
- plot(PST,PSTH,'LineWidth',4,'Color',Col(2,:))
- plot(x,Y,'-.','Color',Col(3,:))
-
- case 'fitted response and 90% C.I.'
- %------------------------------------------------------
- plot(x,Y,'Color',Col(2,:),'LineWidth',4)
- plot(x,Y + CI,'-.',x,Y - CI,'-.','Color',Col(1,:))
-
- case 'fitted response and adjusted data'
- %------------------------------------------------------
- plot(x,Y,'Color',Col(2,:),'LineWidth',4)
- plot(pst,y,'.','Color',Col(3,:))
-
- end
-
- % label
- %-------------------------------------------------------------
- [i j] = max(Y);
- text(ceil(1.1*x(j)),i,Sess(s).Fc(u).name,'FontSize',8);
- title(TITLE,'FontSize',12)
- xlabel('peristimulus time {secs}')
- ylabel(['response',XYZstr])
- hold off
-
-
-% modeling evoked responses based on Sess
-%----------------------------------------------------------------------
-case 'Parametric responses'
-
-
- % return gracefully if no parameters
- %--------------------------------------------------------------
- if ~Sess(s).U(u).P(1).h, return, end
-
- % basis functions
- %--------------------------------------------------------------
- bf = SPM.xBF.bf;
- pst = ([1:size(bf,1)] - 1)*dt;
-
- % orthogonalised expansion of parameteric variable
- %--------------------------------------------------------------
- str = 'which parameter';
- p = spm_input(str,'+1','m',{Sess(s).U(u).P.name});
- P = Sess(s).U(u).P(p).P;
- q = [];
- for i = 0:Sess(s).U(u).P(p).h;
- q = [q spm_en(P).^i];
- end
- q = spm_orth(q);
-
-
- % parameter estimates for this effect
- %--------------------------------------------------------------
- j = Sess(s).col(Sess(s).Fc(u).i);
- B = beta(j);
-
- % reconstruct trial-specific responses
- %--------------------------------------------------------------
- Y = zeros(size(bf,1),size(q,1));
- uj = Sess(s).U(u).P(p).i;
- for i = 1:size(P,1)
- U = sparse(1,uj,q(i,:),1,size(Sess(s).U(u).u,2));
- X = kron(U,bf);
- Y(:,i) = X*B;
- end
- [P j] = sort(P);
- Y = Y(:,j);
-
- % plot
- %--------------------------------------------------------------
- figure(Fgraph)
- subplot(2,2,3)
- surf(pst,P,Y')
- shading flat
- title(Sess(s).U(u).name{1},'FontSize',12)
- xlabel('PST {secs}')
- ylabel(Sess(s).U(u).P(p).name)
- zlabel(['responses',XYZstr])
- axis square
-
- % plot
- %--------------------------------------------------------------
- subplot(2,2,4)
- [j i] = max(mean(Y,2));
- plot(P,Y(i,:),'LineWidth',4,'Color',Col(2,:))
- str = sprintf('response at %0.1fs',i*dt);
- title(str,'FontSize',12)
- xlabel(Sess(s).U(u).P(p).name)
- axis square
- grid on
-
-
-% modeling evoked responses based on Sess
-%----------------------------------------------------------------------
-case 'Volterra Kernels'
-
- % Parameter estimates and basis functions
- %------------------------------------------------------
- bf = SPM.xBF.bf/dt;
- pst = ([1:size(bf,1)] - 1)*dt;
-
- % second order kernel
- %--------------------------------------------------------------
- if u > length(Sess(s).U)
-
- % Parameter estimates and kernel
- %------------------------------------------------------
- j = Sess(s).col(Sess(s).Fc(u).i);
- B = beta(j);
- i = 1;
- Y = 0;
- for p = 1:size(bf,2)
- for q = 1:size(bf,2)
- Y = Y + B(i)*bf(:,p)*bf(:,q)';
- i = i + 1;
- end
- end
-
- % plot
- %------------------------------------------------------
- figure(Fgraph)
- subplot(2,2,3)
- imagesc(pst,pst,Y)
- axis xy
- axis image
-
- title('2nd order Kernel','FontSize',12);
- xlabel('perstimulus time {secs}')
- ylabel('perstimulus time {secs}')
-
- subplot(2,2,4)
- plot(pst,Y)
- axis square
- grid on
-
- title(Sess(s).Fc(u).name,'FontSize',12);
- xlabel('perstimulus time {secs}')
-
-
- % first order kernel
- %--------------------------------------------------------------
- else
- j = Sess(s).col(Sess(s).Fc(u).i(1:size(bf,2)));
- B = beta(j);
- Y = bf*B;
-
- % plot
- %------------------------------------------------------
- figure(Fgraph)
- subplot(2,1,2)
- plot(pst,Y)
- grid on
- axis square
-
- title({'1st order Volterra Kernel' Sess(s).Fc(u).name},...
- 'FontSize',12);
- xlabel('perstimulus time {secs}')
- ylabel(['impluse response',XYZstr])
- end
-
-end
-
-
-%-call Plot UI
-%----------------------------------------------------------------------
-spm_results_ui('PlotUi',gca)
-
-% Complete return values
-r_st = mars_struct('fillafromb', def_r_st, struct(...
- 'Y', Y, 'y', y, 'beta', beta, 'Bcov', Bcov, ...
- 'cbeta', cbeta, 'PSTH', PSTH));
diff --git a/lib/marsbar-0.44/@mardo_2/modality.m b/lib/marsbar-0.44/@mardo_2/modality.m
deleted file mode 100644
index b4b7a05..0000000
--- a/lib/marsbar-0.44/@mardo_2/modality.m
+++ /dev/null
@@ -1,12 +0,0 @@
-function mod_str = modality(D)
-% method returns modality of design
-%
-% $Id$
-
-SPM = des_struct(D);
-try
- SPM.Sess(1);
- mod_str = 'fmri';
-catch
- mod_str = 'pet';
-end
diff --git a/lib/marsbar-0.44/@mardo_2/private/my_design.m b/lib/marsbar-0.44/@mardo_2/private/my_design.m
deleted file mode 100644
index 96abe80..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/my_design.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function tf = my_design(des)
-% returns 1 if design looks like it is of SPM99 type
-%
-% $Id$
-
-tf = 0;
-if isfield(des, 'SPM'), des = des.SPM; end
-if isfield(des, 'SPMid')
- tf = ~isempty(strmatch('SPM2', des.SPMid));
-end
diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_estimate.m b/lib/marsbar-0.44/@mardo_2/private/pr_estimate.m
deleted file mode 100644
index aeddcd0..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/pr_estimate.m
+++ /dev/null
@@ -1,399 +0,0 @@
-function SPM = pr_estimate(SPM, marsY)
-% Estimation of a General Linear Model
-% FORMAT SPM = pr_estimate(SPM, marsY)
-% Inputs
-% SPM - SPM design structure
-% marsY - marsY data object, or 2D data (Y) matrix
-%
-% Outputs
-% SPM - modified estimated design structure, with data contained as
-% field marsY
-%
-% Based on spm_spm from spm2:
-% @(#)spm_spm.m 2.66 Andrew Holmes, Jean-Baptiste Poline, Karl Friston 03/03/27
-%
-% There are some changes in this version
-% 1) The specified Vi field, can contain either
-% a cell array, in which case it is standard SPM covariance components,
-% or a struct array, in which case it can specify other methods of
-% estimating the covariance, in particular, real AR(n) estimation
-%
-% 2) The design will specify if the covariance should be calculated from
-% the summarized time course(s), or from the component voxels, then
-% averaged. Voxel time courses are used by default, and if
-% SPM.xVi.cov_calc is set to 'vox', but summary time
-% courses can be used by setting SPM.xVi.cov_calc to 'summary'.
-%
-% 3) Normally, if the W matrix is present, the V matrix should also be
-% present. Because it is boring to calculate the V matrix and then WVW,
-% if we know WVW is I, V can be present, but empty, in which case WVW is
-% assumed to be I. It just saves time.
-%
-% $Id$
-
-%-Say hello
-%-----------------------------------------------------------------------
-Finter = spm('FigName','Stats: estimation...'); spm('Pointer','Watch')
-
-%=======================================================================
-% - A N A L Y S I S P R E L I M I N A R I E S
-%=======================================================================
-
-%-Initialise
-%=======================================================================
-fprintf('%-40s: %30s','Initialising parameters','...computing') %-#
-xX = SPM.xX;
-[nScan nBeta] = size(xX.X);
-
-%-Check confounds (xX.K) and non-sphericity (xVi)
-%-----------------------------------------------------------------------
-if ~isfield(xX,'K')
- xX.K = 1;
-end
-try
- %-If covariance components are specified use them
- %---------------------------------------------------------------
- xVi = SPM.xVi;
-catch
-
- %-otherwise assume i.i.d.
- %---------------------------------------------------------------
- xVi = struct( 'form', 'i.i.d.',...
- 'V', speye(nScan,nScan));
-
-end
-
-% Work out what we are going to do
-have_W = isfield(xX, 'W');
-have_V = isfield(xVi, 'V');
-
-% Work out type of covariance modelling. We get Vi, cov_type (as a string):
-% one of 'SPM' or 'fmristat' and cov_vox, which is a flag set to 1 if all
-% the voxel time courses should be used to calculate the resdiduals and
-% covariance.
-if ~have_V
- if ~isfield(xVi, 'Vi')
- error('No covariance specified, and no priors to calculate it');
- end
- Vi = xVi.Vi;
- if iscell(Vi)
- cov_type = 'SPM';
- elseif ~isstruct(Vi)
- error('Vi field should be cell or struct type')
- elseif ~isfield(Vi, 'type')
- error('Vi should have field specifying type');
- else
- cov_type = Vi.type;
- end
-
- % Covariance calculated on summary or voxel time courses
- cov_vox = 1;
- if isfield(xVi, 'cov_calc')
- cov_vox = strcmpi(xVi.cov_calc, 'vox');
- end
-else cov_vox = 0; end
-
-%-Get non-sphericity V
-%=======================================================================
-if have_V
- %-If xVi.V is specified proceed directly to parameter estimation
- %---------------------------------------------------------------
- V = xVi.V;
- str = 'parameter estimation';
-else
- % otherwise invoke ReML selecting voxels under i.i.d assumptions
- %---------------------------------------------------------------
- V = speye(nScan,nScan);
- str = '[hyper]parameter estimation';
-end
-
-%-Get whitening/Weighting matrix: If xX.W exists we will save WLS
-% estimates. Get WVW also, which can be assumed if W is a whitening
-% matrix
-%-----------------------------------------------------------------------
-if have_W
- %-If W is specified, use it
- %-------------------------------------------------------
- W = xX.W;
- if isempty(V) % V is only inv(W*W')
- WVW = eye(nScan);
- else
- WVW = W*V*W';
- end
-else
- if have_V
- % otherwise make W a whitening filter W*W' = inv(V)
- %-------------------------------------------------------
- [u s] = pr_spm_svd(xVi.V);
- s = spdiags(1./sqrt(diag(s)),0,nScan,nScan);
- W = u*s*u';
- W = W.*(abs(W) > 1e-6);
- xX.W = W;
- WVW = eye(nScan);
- else
- % unless xVi.V has not been estimated - requiring 2 passes
- %-------------------------------------------------------
- W = eye(nScan);
- str = 'hyperparameter estimation (1st pass)';
- end
-end
-
-%-Design space and projector matrix [pseudoinverse] for WLS
-%=======================================================================
-xX.xKXs = spm_sp('Set',pr_spm_filter(xX.K,W*xX.X)); % KWX
-xX.pKX = spm_sp('x-',xX.xKXs); % projector
-
-%-If xVi.V is not defined compute Hsqr
-%-----------------------------------------------------------------------
-if ~isfield(xVi,'V')
- Fcname = 'effects of interest';
- iX0 = [SPM.xX.iB SPM.xX.iG];
- xCon = spm_FcUtil('Set',Fcname,'F','iX0',iX0,xX.xKXs);
- X1o = spm_FcUtil('X1o', xCon(1),xX.xKXs);
- Hsqr = spm_FcUtil('Hsqr',xCon(1),xX.xKXs);
- trRV = spm_SpUtil('trRV',xX.xKXs);
- trMV = spm_SpUtil('trMV',X1o);
-end
-
-fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-#
-
-%=======================================================================
-% - F I T M O D E L & W R I T E P A R A M E T E R I M A G E S
-%=======================================================================
-
-% Select whether to work with all voxel data in ROIs, or summary data
-% Using all data only makes sense for intial estimation of whitening
-if ~have_W & cov_vox
- str = 'voxelwise';
- Y = region_data(marsY);
- Y = [Y{:}];
-else
- str = 'pooled';
- Y = summary_data(marsY);
-end
-
-% Eliminate columns with zero variance
-in_cols = any(diff(Y));
-if ~any(in_cols), error('No variance to estimate model'); end
-Y = Y(:, in_cols);
-
-fprintf('%-40s: %30s\n','Covariance estimate',['...' str]) %-#
-fprintf('%-40s: %30s','Model','...start') %-#
-
-n_roi = n_regions(marsY);
-
-%-Intialise variables used in the loop
-%=======================================================================
-[n S] = size(Y); % no of time courses
-Cy = 0; % spatially whitened
-CY = 0; % for ReML
-EY = 0; % for ReML
-%-Whiten/Weight data and remove filter confounds
-%-------------------------------------------------------
-fprintf('%s%30s',repmat(sprintf('\b'),1,30),'filtering') %-#
-
-KWY = pr_spm_filter(xX.K,W*Y);
-
-%-General linear model: Weighted least squares estimation
-%------------------------------------------------------
-fprintf('%s%30s',repmat(sprintf('\b'),1,30),'estimation') %-#
-
-beta = xX.pKX*KWY; %-Parameter estimates
-res = spm_sp('r',xX.xKXs,KWY); %-Residuals
-ResSS = sum(res.^2); %-Residual SSQ
-clear KWY %-Clear to save memory
-
-
-%-If ReML hyperparameters are needed for xVi.V
-%-------------------------------------------------------
-if ~have_V
- if n_roi > 1
- wstr = {'Pooling covariance estimate across ROIs',...
- 'This is unlikely to be valid; A better approach',...
- 'is to run estimation separately for each ROI'};
- fprintf('\n');
- warning(sprintf('%s\n', wstr{:}));
- end
- % Cy is whitened covariance matrix; only needed for SPM REML method
- if strcmp(cov_type, 'SPM')
- q = diag(sqrt(trRV./ResSS'),0); % spatial whitening
- Y = Y * q;
- Cy = Y*Y';
- end
-end % have_V
-
-%-if we are saving the WLS parameters
-%-------------------------------------------------------
-if have_W
-
- %-sample covariance and mean of Y (all voxels)
- %-----------------------------------------------
- CY = Y*Y';
- EY = sum(Y,2);
-
-end % have_W
-clear Y %-Clear to save memory
-
-fprintf('\n') %-#
-spm_progress_bar('Clear')
-
-%=======================================================================
-% - P O S T E S T I M A T I O N C L E A N U P
-%=======================================================================
-if S == 0, warning('No time courses - empty analysis!'), end
-
-%-average sample covariance and mean of Y (over voxels)
-%-----------------------------------------------------------------------
-CY = CY/S;
-EY = EY/S;
-CY = CY - EY*EY';
-
-%-If not defined, compute non-sphericity V using ReML Hyperparameters
-%=======================================================================
-if ~have_V
-
- %-Estimate of residual correlations through hyperparameters
- %---------------------------------------------------------------
- str = 'Temporal non-sphericity (over voxels)';
- fprintf('%-40s: %30s\n',str,'...estimation') %-#
- Cy = Cy/S;
-
- % Estimate for separable designs and covariance components
- %---------------------------------------------------------------
- if isstruct(xX.K)
-
- switch cov_type
- case 'SPM'
- % Store hyperparameters
- m = length(Vi);
- h = zeros(m,1);
- case 'fmristat'
- % Store AR coefficients
- h = zeros(length(xX.K), Vi.order);
- otherwise
- error(['Did not recognize covariance type: ' cov_type]);
- end
-
- V = sparse(nScan,nScan);
- for i = 1:length(xX.K)
-
- % extract blocks from bases
- %-----------------------------------------------
- q = xX.K(i).row;
-
- % design space for estimation (with confounds in filter)
- %-----------------------------------------------
- Xp = xX.X(q,:);
- try
- Xp = [Xp xX.K(i).X0];
- end
-
- switch cov_type
- case 'SPM'
- % REML: extract blocks from bases
- %-----------------------------------------------
- p = [];
- Qp = {};
- for j = 1:m
- if nnz(xVi.Vi{j}(q,q))
- Qp{end + 1} = xVi.Vi{j}(q,q);
- p = [p j];
- end
- end
-
- % ReML itself
- %-----------------------------------------------
- fprintf('%-30s- %i\n',' ReML Block',i);
- [Vp,hp] = pr_spm_reml(Cy(q,q),Xp,Qp);
- V(q,q) = V(q,q) + Vp;
- h(p) = hp;
-
- case 'fmristat'
- % AR estimation
- [h(i,:) W(q,q)] = pr_fmristat_ar(res(q,:),Xp,Vi.order);
-
- end
- end
- else
- [V,h] = pr_spm_reml(Cy,xX.X,xVi.Vi);
- end
-
- switch cov_type
- case 'SPM'
- % normalize non-sphericity and save hyperparameters
- %---------------------------------------------------------------
- V = V*nScan/trace(V);
- case 'fmristat'
- % Set covariance matrix to empty, we have already calculated W
- %---------------------------------------------------------------
- V = [];
- SPM.xX.W = W;
- end
-
- xVi.h = h;
- xVi.V = V; % Save non-sphericity xVi.V
- xVi.Cy = Cy; %-spatially whitened
- SPM.xVi = xVi; % non-sphericity structure
-
- % If xX.W is not specified use W*W' = inv(V) to give ML estimators
- %---------------------------------------------------------------
- if ~have_W
- % clear everything except SPM, marsY;
- vnames = who;
- vnames = vnames(~ismember(vnames, {'SPM','marsY'}));
- clear(vnames{:});
- SPM = pr_estimate(SPM,marsY);
- return
- end
-end
-
-
-%-Use non-sphericity xVi.V to compute [effective] degrees of freedom
-%=======================================================================
-xX.V = pr_spm_filter(xX.K,pr_spm_filter(xX.K,WVW)'); % KWVW'K'
-[trRV trRVRV] = spm_SpUtil('trRV',xX.xKXs,xX.V); % trRV (for X)
-xX.trRV = trRV; %
-xX.trRVRV = trRVRV; %-Satterthwaite
-xX.erdf = trRV^2/trRVRV; % approximation
-xX.Bcov = xX.pKX*xX.V*xX.pKX'; % Cov(beta)
-
-
-%-scale ResSS by 1/trRV
-%-----------------------------------------------------------------------
-ResMS = ResSS/xX.trRV;
-
-%-Create 1st contrast for 'effects of interest' (all if not specified)
-%=======================================================================
-Fcname = 'effects of interest';
-try
- iX0 = [xX.iB xX.iG];
-catch
- iX0 = [];
-end
-xCon = spm_FcUtil('Set',Fcname,'F','iX0',iX0,xX.xKXs);
-
-%-Compute scaled design matrix for display purposes
-%-----------------------------------------------------------------------
-xX.nKX = spm_DesMtx('sca',xX.xKXs.X,xX.name);
-
-%-place fields in SPM
-%-----------------------------------------------------------------------
-SPM.betas = ones(nBeta, n_roi) + NaN;
-SPM.betas(:, in_cols) = beta;
-SPM.ResidualMS = ones(1, n_roi) + NaN;
-SPM.ResidualMS(in_cols) = ResMS;
-
-SPM.xVi = xVi; % non-sphericity structure
-SPM.xVi.CY = CY; %-<(Y - )*(Y - )'>
-
-SPM.xX = xX; %-design structure
-
-SPM.xCon = xCon; %-contrast structure
-
-%=======================================================================
-%- E N D: Cleanup GUI
-%=======================================================================
-fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-#
-spm('FigName','Stats: done',Finter); spm('Pointer','Arrow')
-fprintf('%-40s: %30s\n','Completed',spm('time')) %-#
-fprintf('...use the results section for assessment\n\n') %-#
diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_fmri_design.m b/lib/marsbar-0.44/@mardo_2/private/pr_fmri_design.m
deleted file mode 100644
index 6dc547d..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/pr_fmri_design.m
+++ /dev/null
@@ -1,201 +0,0 @@
-function [SPM] = pr_fmri_design(SPM)
-% MarsBaR version of spm_fMRI design - asssembles a design for fMRI studies
-% FORMAT [SPM] = pr_fmri_design(SPM)
-%
-% This file is a hardly edited version of:
-% @(#)spm_fMRI_design.m 2.34 Karl Friston 03/01/30
-% See that (SPM2) version for comments etc
-%
-% $Id$
-
-%-GUI setup
-%-----------------------------------------------------------------------
-SPMid = spm('SFnBanner',mfilename,marsbar('ver'));
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','fMRI stats model setup',0);
-spm_help('!ContextHelp',mfilename)
-
-% construct Design matrix {X} - cycle over sessions
-%=======================================================================
-
-% global parameters
-%-----------------------------------------------------------------------
-try
- fMRI_T = SPM.xBF.T;
- fMRI_T0 = SPM.xBF.T0;
-catch
- global defaults
- d_fmri = mars_struct('getifthere', defaults, 'stats', 'fmri');
- if mars_struct('isthere', d_fmri, 't')
- fMRI_T = d_fmri.t;
- fMRI_T0 = d_fmri.t0;
- else,
- fMRI_T = 16;
- fMRI_T0 = 1;
- end;
- SPM.xBF.T = fMRI_T;
- SPM.xBF.T0 = fMRI_T0;
-end
-
-
-% get nscan and RT if not in SPM
-%-----------------------------------------------------------------------
-try
- SPM.xY.RT;
-catch
- spm_input('Basic parameters...',1,'d',mfilename)
- SPM.xY.RT = spm_input('Interscan interval {secs}','+1','r',[],1);
-end
-try
- SPM.nscan;
-catch
- SPM.nscan = spm_input(['scans per session e.g. 64 64 64'],'+1');
-end
-
-% time units, dt = time bin {secs}
-%-----------------------------------------------------------------------
-SPM.xBF.dt = SPM.xY.RT/SPM.xBF.T;
-try
- SPM.xBF.UNITS;
-catch
- str = 'specify design in';
- SPM.xBF.UNITS = spm_input(str,'+1','scans|secs');
-end
-
-% separate specifications for non-relicated sessions
-%-----------------------------------------------------------------------
-rep = 0;
-if length(SPM.nscan) > 1 & ~any(diff(SPM.nscan)) & ~isfield(SPM,'Sess')
- str = 'are sessions replications';
- rep = spm_input(str,'+1','yes|no',[1 0]);
-end
-
-% Get basis functions
-%-----------------------------------------------------------------------
-try
- bf = SPM.xBF.bf;
-catch
- SPM.xBF = pr_spm_get_bf(SPM.xBF);
- bf = SPM.xBF.bf;
-end
-
-% 1st or 2nd order Volterra expansion?
-%-----------------------------------------------------------------------
-try
- V = SPM.xBF.Volterra;
-catch
- str = 'model interactions (Volterra)';
- V = spm_input(str,'+1','y/n',[2 1]);
- SPM.xBF.Volterra = V;
-end
-
-
-% get session specific design parameters
-%=======================================================================
-Xx = [];
-Xb = [];
-Xname = {};
-Bname = {};
-for s = 1:length(SPM.nscan)
-
- % number of scans for this session
- %---------------------------------------------------------------
- k = SPM.nscan(s);
-
- if (s == 1) | ~rep
-
- % create convolved stimulus functions or inputs
- %=======================================================
-
- % Get inputs, neuronal causes or stimulus functions U
- %-------------------------------------------------------
- U = pr_spm_get_ons(SPM,s);
-
- % Convolve stimulus functions with basis functions
- %-------------------------------------------------------
- [X,Xn,Fc] = pr_spm_volterra(U,bf,V);
-
- % Resample regressors at acquisition times (32 bin offset)
- %-------------------------------------------------------
- try
- X = X([0:(k - 1)]*fMRI_T + fMRI_T0 + 32,:);
- end
-
-
- % get user specified regressors
- %=======================================================
- try
- C = SPM.Sess(s).C.C;
- Cname = SPM.Sess(s).C.name;
- catch
-
- % covariates - C
- %-----------------------------------------------
- str = sprintf('Session %d',s);
- spm_input('Other regressors',1,'d',str)
- C = [];
- c = spm_input('user specified','+1','w1',0);
- while size(C,2) < c
- str = sprintf('regressor %i',size(C,2) + 1);
- C = [C spm_input(str,2,'e',[],[k Inf])];
- end
-
- % and their names - Cnames
- %-----------------------------------------------
- Cname = {};
- for i = 1:size(C,2)
- str = sprintf('regressor %i',i);
- Cname{i} = spm_input('name of','+0','s',str);
- end
- end
-
- % append mean-corrected regressors and names
- %-------------------------------------------------------
- X = [X spm_detrend(C)];
- Xn = {Xn{:} Cname{:}};
-
- % Confounds: Session effects
- %=======================================================
- B = ones(k,1);
- Bn{1} = sprintf('constant');
-
- end
-
- % Session structure array
- %---------------------------------------------------------------
- SPM.Sess(s).U = U;
- SPM.Sess(s).C.C = C;
- SPM.Sess(s).C.name = Cname;
- SPM.Sess(s).row = size(Xx,1) + [1:k];
- SPM.Sess(s).col = size(Xx,2) + [1:size(X,2)];
- SPM.Sess(s).Fc = Fc;
-
- % Append names
- %---------------------------------------------------------------
- for i = 1:length(Xn)
- Xname{end + 1} = [sprintf('Sn(%i) ',s) Xn{i}];
- end
- for i = 1:length(Bn)
- Bname{end + 1} = [sprintf('Sn(%i) ',s) Bn{i}];
- end
-
- % append into Xx and Xb
- %===============================================================
- Xx = blkdiag(Xx,X);
- Xb = blkdiag(Xb,B);
-
-end %- for s
-
-
-% finished
-%-----------------------------------------------------------------------
-SPM.xX.X = [Xx Xb];
-SPM.xX.iH = [];
-SPM.xX.iC = [1:size(Xx,2)];
-SPM.xX.iB = [1:size(Xb,2)] + size(Xx,2);
-SPM.xX.iG = [];
-SPM.xX.name = {Xname{:} Bname{:}};
-
-
-%-End
-%-----------------------------------------------------------------------
-spm_input('!DeleteInputObj')
diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_fmristat_ar.m b/lib/marsbar-0.44/@mardo_2/private/pr_fmristat_ar.m
deleted file mode 100644
index 93d4e4a..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/pr_fmristat_ar.m
+++ /dev/null
@@ -1,79 +0,0 @@
-function [rho,Vmhalf,V] = pr_fmristat_ar(res,X,nlags)
-% function returns estimated AR coefficients using fmristat algorithm
-% FORMAT [rho,Vmhalf,V] = pr_fmristat_ar(res,X,nlags)
-%
-% See http://www.math.mcgill.ca/keith/fmristat/ and
-% fmrilm.m in fmristat package for code, and
-% Worsley, K.J., Liao, C., Aston, J., Petre, V., Duncan, G.H., Morales,
-% F., Evans, A.C. (2002). A general statistical analysis for fMRI
-% data. NeuroImage, 15:1-15 - for description of the algorithm
-%
-% $Id$
-
-% This is the copyright notice from fmrilm:
-%############################################################################
-% COPYRIGHT: Copyright 2002 K.J. Worsley
-% Department of Mathematics and Statistics,
-% McConnell Brain Imaging Center,
-% Montreal Neurological Institute,
-% McGill University, Montreal, Quebec, Canada.
-% worsley@math.mcgill.ca, liao@math.mcgill.ca
-%
-% Permission to use, copy, modify, and distribute this
-% software and its documentation for any purpose and without
-% fee is hereby granted, provided that the above copyright
-% notice appear in all copies. The author and McGill University
-% make no representations about the suitability of this
-% software for any purpose. It is provided "as is" without
-% express or implied warranty.
-%############################################################################
-
-if nargin < 2
- error('Need covariance and design');
-end
-if nargin < 3
- nlags = 1;
-end
-
-sX = spm_sp('Set', X);
-R = spm_sp('r', sX);
-
-nlp1 = nlags+1;
-[n nvox] = size(res);
-
-% Bias reduction
-M=zeros(nlp1);
-for i=1:(nlp1)
- for j=1:(nlp1)
- Di=(diag(ones(1,n-i+1),i-1)+diag(ones(1,n-i+1),-i+1))/(1+(i==1));
- Dj=(diag(ones(1,n-j+1),j-1)+diag(ones(1,n-j+1),-j+1))/(1+(j==1));
- M(i,j)=trace(R*Di*R*Dj)/(1+(i>1));
- end
-end
-invM = inv(M);
-
-a = zeros(nlp1,nvox);
-for lag = 0:nlags
- a(lag+1,:)= sum(res(1:(n-lag),:).*res((lag+1):n,:));
-end
-
-vhat = invM*a;
-rho = vhat(2:end,:) ./ (ones(nlags, 1) * vhat(1,:));
-rho = mean(rho,2)';
-
-if nargout > 1
- % Whitening matrix; Appendix A3 Worsley et al (2002)
- % Modified according to fmrilm code
- [Ainvt posdef] = chol(toeplitz([1 rho]));
- nl=size(Ainvt,1);
- A=inv(Ainvt');
- Vmhalf = zeros(n,n);
- B=ones(n-nl,1)*A(nl,:);
- Vmhalf(nl+1:end,:) = spdiags(B,1:nl,n-nl,n);
- Vmhalf(1:nl,1:nl) = A;
-end
-
-if nargout > 2
- % Estimated covariance
- V = inv(Vmhalf*Vmhalf');
-end
diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_get_filter.m b/lib/marsbar-0.44/@mardo_2/private/pr_get_filter.m
deleted file mode 100644
index 7cc850a..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/pr_get_filter.m
+++ /dev/null
@@ -1,51 +0,0 @@
-function [K, str] = pr_get_filter(RT, row)
-% gets filter using spm_fmri_spm_ui routines
-% FORMAT [K, str]= pr_get_filter(RT, row)
-% or
-% FORMAT [K, str]= pr_get_filter(RT, Sess)
-%
-% $Id$
-
-if nargin < 2
- error('Need TR, row / Sess matrix');
-end
-
-% number of sessions
-nsess = length(row);
-
-% rows from Sess
-if isfield(row(1), 'row')
- Sess = row;
- row = {};
- for s = 1:nsess
- row{s} = Sess(s).row;
- end
-else
- Sess = [];
-end
-
-switch spm_input('High-pass filter?','+1','b','none|specify');
-
- case 'specify'
- % default 128 seconds
- %-------------------------------------------------------
- HParam = 128*ones(1,nsess);
- p_str = 'cutoff period (secs)';
- HParam = spm_input(p_str,'+1','e',HParam,[1 nsess]);
- str = sprintf('Cutoff: %d {s}', HParam);
-
- case 'none'
- % Inf seconds (i.e. constant term only)
- %-------------------------------------------------------
- HParam = Inf*ones(1,nsess);
- str = 'none';
-end
-
-% create and set filter struct
-%---------------------------------------------------------------
-for i = 1:nsess
- K(i) = struct( 'HParam', HParam(i),...
- 'row', row{i},...
- 'RT', RT);
-end
-K = pr_spm_filter(K);
diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_ce.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_ce.m
deleted file mode 100644
index 6e28257..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_ce.m
+++ /dev/null
@@ -1,49 +0,0 @@
-function [C] = pr_spm_ce(v,a)
-% return error covariance constraints for serially correlated data
-% FORMAT [C] = spm_Ce(v,a)
-% v - (1 x l) v(i) = number of obervations for ith block
-% a - AR coeficient expansion point (default a = [])
-%
-% C{1} = h(1)*AR(a)
-% C{2} = h(1)*AR(a) + h(2)*dAR(a)/da(1);
-% C{3} = h(1)*AR(a) + h(2)*dAR(a)/da(1) + h(3)*dAR(a)/da(2);
-%
-% See also; spm_Q.m
-%___________________________________________________________________________
-% @(#)spm_Ce.m 2.7 Karl Friston 03/03/15
-
-
-% defaults
-%---------------------------------------------------------------------------
-if nargin == 1
- a = [];
-end
-
-
-% create blocks
-%---------------------------------------------------------------------------
-C = {};
-l = length(v);
-n = sum(v);
-k = 0;
-if l > 1
- for i = 1:l
- dCda = spm_Ce(v(i),a);
- for j = 1:length(dCda)
- [x y q] = find(dCda{j});
- x = x + k;
- y = y + k;
- C{end + 1} = sparse(x,y,q,n,n);
- end
- k = v(i) + k;
- end
-else
- % dCda
- %==================================================================
- C{1} = pr_spm_q(a,v);
- dCda = pr_spm_diff('pr_spm_q',a,v,1);
- for i = 1:length(a)
- C{i + 1} = reshape(dCda(:,i),v,v);
- end
-
-end
diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_diff.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_diff.m
deleted file mode 100644
index 9b24924..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_diff.m
+++ /dev/null
@@ -1,45 +0,0 @@
-function [J] = pr_spm_diff(varargin)
-% matrix differential
-% FORMAT [dfdx] = pr_spm_diff(f,x,...,P,n)
-%
-% f - [inline] function f(x,P)
-% x - argument[s]
-% P - parameter[s]
-% n - argument or parameter to differentiate w.r.t.
-%
-% dfdx - df(x,P)/dx{n}
-%___________________________________________________________________________
-% @(#)pr_spm_diff.m 2.1 Karl Friston 03/03/03
-
-
-% create inline object
-%---------------------------------------------------------------------------
-f = fcnchk(varargin{1});
-x = varargin(2:(end - 1));
-n = varargin{end};
-dx = 1e-6;
-
-if length(n) == 1
-
- % dfdx
- %------------------------------------------------------------------
- f0 = feval(f,x{:});
- J = sparse(length(f0(:)),length(x{n}(:)));
- for i = 1:length(x{n}(:))
- xi = x;
- xi{n}(i) = xi{n}(i) + dx;
- dfdx = (feval(f,xi{:}) - f0)/dx;
- J(:,i) = sparse(dfdx(:));
- end
-else
- % dfdxdx
- %------------------------------------------------------------------
- f0 = pr_spm_diff(f,x{:},n(1));
- J = cell(1,length(x{n(2)}(:)));
- for i = 1:length(x{n(2)}(:))
- xi = x;
- xi{n(2)}(i) = xi{n(2)}(i) + dx;
- dfdx = (pr_spm_diff(f,xi{:},n(1)) - f0)/dx;
- J{i} = sparse(dfdx);
- end
-end
diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_filter.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_filter.m
deleted file mode 100644
index c7759de..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_filter.m
+++ /dev/null
@@ -1,136 +0,0 @@
-function [vargout] = pr_spm_filter(K,Y)
-% Removes low frequency confounds X0
-% FORMAT [Y] = pr_spm_filter(K,Y)
-% FORMAT [K] = pr_spm_filter(K)
-%
-% K - filter matrix or:
-% K(s) - struct array containing partition-specific specifications
-%
-% K(s).RT - observation interval in seconds
-% K(s).row - row of Y constituting block/partition s
-% K(s).LChoice - Low-pass filtering {'hrf' 'Gaussian' 'none'}
-% K(s).LParam - Gaussian parameter in seconds
-% K(s).HParam - cut-off period in seconds
-%
-% K(s).X0 - low frequencies to be removed (DCT)
-%
-% Y - data matrix
-%
-% K - filter structure
-% Y - filtered data
-%___________________________________________________________________________
-%
-% pr_spm_filter implements high-pass filtering in an efficient way by
-% using the residual forming matrix of X0 - low frequency confounds
-%.pr_spm_filter also configures the filter structure in accord with the
-% specification fields if called with one argument
-%___________________________________________________________________________
-% @(#)pr_spm_filter.m 2.10 Karl Friston 03/03/04
-
-
-% set or apply
-%---------------------------------------------------------------------------
-if nargin == 1 & isstruct(K)
-
- % set K.X0
- %-------------------------------------------------------------------
- for s = 1:length(K)
-
- % make high pass filter
- %-----------------------------------------------------------
- k = length(K(s).row);
- n = fix(2*(k*K(s).RT)/K(s).HParam + 1);
- X0 = spm_dctmtx(k,n);
- K(s).X0 = X0(:,2:end);
-
- % make low pass filter
- %-----------------------------------------------------------
- if isfield(K(s), 'LChoice')
- switch K(s).LChoice
-
- case 'none'
- %---------------------------------------------------
- h = 1;
- d = 0;
-
- case 'hrf'
- %---------------------------------------------------
- h = spm_hrf(K(s).RT);
- h = [h; zeros(size(h))];
- g = abs(fft(h));
- h = real(ifft(g));
- h = fftshift(h)';
- n = length(h);
- d = [1:n] - n/2 - 1;
-
- case 'Gaussian'
- %---------------------------------------------------
- sigma = K(s).LParam/K(s).RT;
- h = round(4*sigma);
- h = exp(-[-h:h].^2/(2*sigma^2));
- n = length(h);
- d = [1:n] - (n + 1)/2;
- if n == 1, h = 1; end
-
- otherwise
- %---------------------------------------------------
- error('Low pass Filter option unknown');
- return
- end
- % create and normalize low pass filter
- %-----------------------------------------------------------
- K(s).KL = spdiags(ones(k,1)*h,d,k,k);
- K(s).KL = spdiags(1./sum(K(s).KL')',0,k,k)*K(s).KL;
-
- end
- end
-
- % return structure
- %-------------------------------------------------------------------
- vargout = K;
-
-else
- % apply
- %-------------------------------------------------------------------
- if isstruct(K)
-
- % ensure requisite feilds are present
- %-----------------------------------------------------------
- if ~isfield(K(1),'X0') | ...
- (isfield(K(1),'LChoice') & ~isfield(K(1), 'KL'))
- K = pr_spm_filter(K);
- end
-
- for s = 1:length(K)
-
- % select data
- %---------------------------------------------------
- y = Y(K(s).row,:);
-
- % apply low pass filter
- %---------------------------------------------------
- if isfield(K(s), 'KL')
- y = K(s).KL*y;
- end
-
- % apply high pass filter
- %---------------------------------------------------
- y = y - K(s).X0*(K(s).X0'*y);
-
- % reset filtered data in Y
- %---------------------------------------------------
- Y(K(s).row,:) = y;
-
- end
-
- % K is simply a filter matrix
- %-------------------------------------------------------------------
- else
- Y = K*Y;
- end
-
- % return filtered data
- %-------------------------------------------------------------------
- vargout = Y;
-
-end
diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_get_bf.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_get_bf.m
deleted file mode 100644
index 9f2cc0b..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_get_bf.m
+++ /dev/null
@@ -1,180 +0,0 @@
-function [xBF] = pr_spm_get_bf(xBF)
-% fills in basis function structure
-% FORMAT [xBF] = spm_get_bf(xBF);
-%
-% xBF.dt - time bin length {seconds}
-% xBF.name - description of basis functions specified
-% xBF.length - window length (secs)
-% xBF.order - order
-% xBF.bf - Matrix of basis functions
-%
-% xBF.name 'hrf'
-% 'hrf (with time derivative)'
-% 'hrf (with time and dispersion derivatives)'
-% 'Fourier set'
-% 'Fourier set (Hanning)'
-% 'Gamma functions'
-% 'Finite Impulse Response'};
-%
-% (any other specifiaction will default to hrf)
-%_______________________________________________________________________
-%
-% spm_get_bf prompts for basis functions to model event or epoch-related
-% responses. The basis functions returned are unitary and orthonormal
-% when defined as a function of peri-stimulus time in time-bins.
-% It is at this point that the distinction between event and epoch-related
-% responses enters.
-%_______________________________________________________________________
-% @(#)spm_get_bf.m 2.22 Karl Friston 02/04/19
-
-%-GUI setup
-%-----------------------------------------------------------------------
-spm_help('!ContextHelp',mfilename)
-
-% length of time bin
-%-----------------------------------------------------------------------
-if ~nargin
- str = 'time bin for basis functions {secs}';
- xBF.dt = spm_input(str,'+1','r',1/16,1);
-end
-dt = xBF.dt;
-
-
-% assemble basis functions
-%=======================================================================
-
-% model event-related responses
-%-----------------------------------------------------------------------
-if ~isfield(xBF,'name')
- spm_input('Hemodynamic Basis functions...',1,'d')
- Ctype = {
- 'hrf',...
- 'hrf (with time derivative)',...
- 'hrf (with time and dispersion derivatives)',...
- 'Fourier set',...
- 'Fourier set (Hanning)',...
- 'Gamma functions',...
- 'Finite Impulse Response'};
- str = 'Select basis set';
- Sel = spm_input(str,2,'m',Ctype);
- xBF.name = Ctype{Sel};
-end
-
-% get order and length parameters
-%-----------------------------------------------------------------------
-switch xBF.name
-
- case { 'Fourier set','Fourier set (Hanning)',...
- 'Gamma functions','Finite Impulse Response'}
- %---------------------------------------------------------------
- try, l = xBF.length;
- catch, l = spm_input('window length {secs}',3,'e',32);
- xBF.length = l;
- end
- try, h = xBF.order;
- catch, h = spm_input('order',4,'e',4);
- xBF.order = h;
- end
-end
-
-
-
-% create basis functions
-%-----------------------------------------------------------------------
-switch xBF.name
-
- case {'Fourier set','Fourier set (Hanning)'}
- %---------------------------------------------------------------
- pst = [0:dt:l]';
- pst = pst/max(pst);
-
- % hanning window
- %---------------------------------------------------------------
- if strcmp(xBF.name,'Fourier set (Hanning)')
- g = (1 - cos(2*pi*pst))/2;
- else
- g = ones(size(pst));
- end
-
- % zeroth and higher Fourier terms
- %---------------------------------------------------------------
- bf = g;
- for i = 1:h
- bf = [bf g.*sin(i*2*pi*pst)];
- bf = [bf g.*cos(i*2*pi*pst)];
- end
-
- case {'Gamma functions'}
- %---------------------------------------------------------------
- pst = [0:dt:l]';
- bf = spm_gamma_bf(pst,h);
-
- case {'Finite Impulse Response'}
- %---------------------------------------------------------------
- bin = l/h;
- bf = kron(eye(h),ones(round(bin/dt),1));
-
- case {'NONE'} % innovation from SPM5
- %---------------------------------------------------------------
- bf = 1;
-
-otherwise
-
- % canonical hemodynaic response function
- %---------------------------------------------------------------
- [bf p] = pr_spm_hrf(dt);
-
- % add time derivative
- %---------------------------------------------------------------
- if findstr(xBF.name,'time')
-
- dp = 1;
- p(6) = p(6) + dp;
- D = (bf(:,1) - pr_spm_hrf(dt,p))/dp;
- bf = [bf D(:)];
- p(6) = p(6) - dp;
-
- % add dispersion derivative
- %--------------------------------------------------------
- if findstr(xBF.name,'dispersion')
-
- dp = 0.01;
- p(3) = p(3) + dp;
- D = (bf(:,1) - pr_spm_hrf(dt,p))/dp;
- bf = [bf D(:)];
- end
- end
-
- % length and order
- %---------------------------------------------------------------
- xBF.length = size(bf,1)*dt;
- xBF.order = size(bf,2);
-
-end
-
-
-% Orthogonalize and fill in basis function structure
-%------------------------------------------------------------------------
-xBF.bf = pr_spm_orth(bf);
-
-
-%=======================================================================
-%- S U B - F U N C T I O N S
-%=======================================================================
-
-% compute Gamma functions functions
-%-----------------------------------------------------------------------
-function bf = spm_gamma_bf(u,h)
-% returns basis functions used for Volterra expansion
-% FORMAT bf = spm_gamma_bf(u,h);
-% u - times {seconds}
-% h - order
-% bf - basis functions (mixture of Gammas)
-%_______________________________________________________________________
-u = u(:);
-bf = [];
-for i = 2:(1 + h)
- m = 2^i;
- s = sqrt(m);
- bf = [bf pr_spm_gpdf(u,(m/s)^2,m/s^2)];
-end
diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_get_ons.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_get_ons.m
deleted file mode 100644
index 8643d76..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_get_ons.m
+++ /dev/null
@@ -1,255 +0,0 @@
-function [U] = pr_spm_get_ons(SPM,s)
-% returns input [designed effects] structures
-% FORMAT [U] = spm_get_ons(SPM,s)
-%
-% s - session number (used by batch system)
-%
-% U - (1 x n) struct array of (n) trial-specific structures
-%
-% U(i).name - cell of names for each input or cause
-% U(i).u - inputs or stimulus function matrix
-% U(i).dt - time bin (seconds)
-% U(i).ons - onsets (in SPM.xBF.UNITS)
-% U(i).dur - durations (in SPM.xBF.UNITS)
-% U(i).P - parameter struct.
-%
-% U(i).P(p).name - parameter name
-% U(i).P(p).P - parameter vector
-% U(i).P(p).h - order of polynomial expansion
-% U(i).P(p).i - sub-indices of u pertaining to P
-%_______________________________________________________________________
-%
-%
-% SLICE TIMIING
-%
-% With longs TRs you may want to shift the regressors so that they are
-% aligned to a particular slice. This is effected by resetting the
-% values of defaults.stats.fmri.t and defaults.stats.fmri.t0 in
-% spm_defaults. defaults.stats.fmri.t is the number of time-bins per
-% scan used when building regressors. Onsets are defined
-% in temporal units of scans starting at 0. defaults.stats.fmri.t0 is
-% the first time-bin at which the regressors are resampled to coincide
-% with data acquisition. If defaults.stats.fmri.t0 = 1 then the
-% regressors will be appropriate for the first slice. If you want to
-% temporally realign the regressors so that they match responses in the
-% middle slice then make defaults.stats.fmri.t0 =
-% defaults.stats.fmri.t/2 (assuming there is a negligible gap between
-% volume acquisitions. Default values are defaults.stats.fmri.t = 16
-% and defaults.stats.fmri.t0 = 1.
-%
-%
-%_______________________________________________________________________
-% @(#)spm_get_ons.m 2.40 Karl Friston 03/07/03
-
-%-GUI setup
-%-----------------------------------------------------------------------
-spm_help('!ContextHelp',mfilename)
-
-% time units
-%-----------------------------------------------------------------------
-k = SPM.nscan(s);
-T = SPM.xBF.T;
-dt = SPM.xBF.dt;
-try
- UNITS = SPM.xBF.UNITS;
-catch
- UNITS = 'scans';
-end
-switch UNITS
-
- case 'scans'
- %----------------------------------------------------------------
- TR = T*dt;
-
- case 'secs'
- %----------------------------------------------------------------
- TR = 1;
-end
-
-% get inputs and names (try SPM.Sess(s).U first)
-%=======================================================================
-try
- U = SPM.Sess(s).U;
- v = length(U);
-catch
-
- %-prompt string
- %---------------------------------------------------------------
- str = sprintf('Session %d: trial specification in %s',s,UNITS);
- spm_input(str,1,'d')
-
- U = {};
- v = spm_input('number of conditions/trials',2,'w1');
-end
-
-% get trials
-%-----------------------------------------------------------------------
-for i = 1:v
-
- % get names
- %---------------------------------------------------------------
- try
- Uname = U(i).name(1);
- catch
- str = sprintf('name for condition/trial %d ?',i);
- Uname = {spm_input(str,3,'s',sprintf('trial %d',i))};
- U(i).name = Uname;
- end
-
- % get main [trial] effects
- %================================================================
-
- % onsets
- %---------------------------------------------------------------
- try
- ons = U(i).ons;
- ons = ons(:);
- catch
- ons = [];
- end
- if ~length(ons)
- str = ['vector of onsets - ' Uname{1}];
- ons = spm_input(str,4,'r',' ',[Inf 1]);
- U(i).ons = ons(:);
-
- end
-
- % durations
- %---------------------------------------------------------------
- try
- dur = U(i).dur;
- dur = dur(:);
- catch
- dur = [];
- end
- if ~length(dur)
- str = 'duration[s] (events = 0)';
- while 1
- dur = spm_input(str,5,'r',' ',[Inf 1]);
- if length(dur) == 1
- dur = dur*ones(size(ons));
- end
- if length(dur) == length(ons), break, end
- str = sprintf('enter a scalar or [%d] vector',...
- length(ons));
- end
- U(i).dur = dur;
- end
-
- % peri-stimulus times {seconds}
- %---------------------------------------------------------------
- pst = [1:k]*T*dt - ons(1)*TR;
- for j = 1:length(ons)
- w = [1:k]*T*dt - ons(j)*TR;
- v = find(w >= -1);
- pst(v) = w(v);
- end
-
-
- % add parameters x trial interactions
- %================================================================
-
- % get parameter stucture xP
- %----------------------------------------------------------------
- try
- xP = U(i).P;
- Pname = xP(1).name;
-
- switch Pname
-
- case 'none'
- %------------------------------------------------
- xP.name = 'time';
- xP.h = 0;
-
- end
-
- catch
-
- Pname = {'none','time','other'};
- Pname = spm_input('parametric modulation',6,'b',Pname);
-
- switch Pname
-
- case 'none'
- %--------------------------------------------------------
- xP(1).name = 'none';
- xP(1).P = ons*TR;
- xP(1).h = 0;
-
- case 'time'
- %--------------------------------------------------------
- xP(1).name = 'time';
- xP(1).P = ons*TR;
- xP(1).h = spm_input('polynomial order',8,'n1',1);
-
- case 'other'
- %--------------------------------------------------------
- str = ['# parameters (' Uname{1} ')'];
- for q = 1:spm_input(str,7,'n1',1);
-
- % get names and parametric variates
- %------------------------------------------------
- str = sprintf('parameter %d name',q);
- Pname = spm_input(str,7,'s');
- P = spm_input(Pname,7,'r',[],[length(ons),1]);
-
- % order of polynomial expansion h
- %------------------------------------------------
- h = spm_input('polynomial order',8,'n1',1);
-
- % sub-indices and inputs
- %------------------------------------------------
- xP(q).name = Pname;
- xP(q).P = P(:);
- xP(q).h = h;
-
- end
- end % switch
-
- end % try
-
- % interaction with causes (u) - 1st = main effects
- %----------------------------------------------------------------
- u = ons.^0;
- for q = 1:length(xP)
- xP(q).i = [1, ([1:xP(q).h] + size(u,2))];
- for j = 1:xP(q).h
- P = spm_en(xP(q).P);
- u = [u P.^j];
- str = sprintf('%sx%s^%d',Uname{1},xP.name,j);
- Uname{end + 1} = str;
- end
- end
-
- % orthogonalize inputs
- %---------------------------------------------------------------
- u = pr_spm_orth(u);
-
- % and scale so sum(u*dt) = number of events, if event-related
- %---------------------------------------------------------------
- if ~any(dur)
- u = u/dt;
- end
-
- % create stimulus functions (32 bin offset)
- %===============================================================
- ton = round(ons*TR/dt) + 32; % onsets
- tof = round(dur*TR/dt) + ton + 1; % offset
- sf = sparse((k*T + 128),size(u,2));
- for j = 1:length(ton)
- sf(ton(j),:) = sf(ton(j),:) + u(j,:);
- sf(tof(j),:) = sf(tof(j),:) - u(j,:);
- end
- sf = cumsum(sf); % integrate
- sf = sf(1:(k*T + 32),:); % stimulus
-
- % place in ouputs structure
- %---------------------------------------------------------------
- U(i).name = Uname; % - input names
- U(i).dt = dt; % - time bin {seconds}
- U(i).u = sf; % - stimulus function matrix
- U(i).pst = pst; % - pst (seconds)
- U(i).P = xP; % - parameter struct
-
-end % (v)
diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_gpdf.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_gpdf.m
deleted file mode 100644
index 6fb81e0..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_gpdf.m
+++ /dev/null
@@ -1,94 +0,0 @@
-function f = spm_Gpdf(x,h,l)
-% Probability Density Function (PDF) of Gamma distribution
-% FORMAT f = spm_Gpdf(g,h,l)
-%
-% x - Gamma-variate (Gamma has range [0,Inf) )
-% h - Shape parameter (h>0)
-% l - Scale parameter (l>0)
-% f - PDF of Gamma-distribution with shape & scale parameters h & l
-%_______________________________________________________________________
-%
-% spm_Gpdf implements the Probability Density Function of the Gamma
-% distribution.
-%
-% Definition:
-%-----------------------------------------------------------------------
-% The PDF of the Gamma distribution with shape parameter h and scale l
-% is defined for h>0 & l>0 and for x in [0,Inf) by: (See Evans et al.,
-% Ch18, but note that this reference uses the alternative
-% parameterisation of the Gamma with scale parameter c=1/l)
-%
-% l^h * x^(h-1) exp(-lx)
-% f(x) = ---------------------
-% gamma(h)
-%
-% Variate relationships: (Evans et al., Ch18 & Ch8)
-%-----------------------------------------------------------------------
-% For natural (strictly +ve integer) shape h this is an Erlang distribution.
-%
-% The Standard Gamma distribution has a single parameter, the shape h.
-% The scale taken as l=1.
-%
-% The Chi-squared distribution with v degrees of freedom is equivalent
-% to the Gamma distribution with scale parameter 1/2 and shape parameter v/2.
-%
-% Algorithm:
-%-----------------------------------------------------------------------
-% Direct computation using logs to avoid roundoff errors.
-%
-% References:
-%-----------------------------------------------------------------------
-% Evans M, Hastings N, Peacock B (1993)
-% "Statistical Distributions"
-% 2nd Ed. Wiley, New York
-%
-% Abramowitz M, Stegun IA, (1964)
-% "Handbook of Mathematical Functions"
-% US Government Printing Office
-%
-% Press WH, Teukolsky SA, Vetterling AT, Flannery BP (1992)
-% "Numerical Recipes in C"
-% Cambridge
-%_______________________________________________________________________
-% @(#)spm_Gpdf.m 2.2 Andrew Holmes 99/04/26
-
-%-Format arguments, note & check sizes
-%-----------------------------------------------------------------------
-if nargin<3, error('Insufficient arguments'), end
-
-ad = [ndims(x);ndims(h);ndims(l)];
-rd = max(ad);
-as = [ [size(x),ones(1,rd-ad(1))];...
- [size(h),ones(1,rd-ad(2))];...
- [size(l),ones(1,rd-ad(3))] ];
-rs = max(as);
-xa = prod(as,2)>1;
-if sum(xa)>1 & any(any(diff(as(xa,:)),1))
- error('non-scalar args must match in size'), end
-
-%-Computation
-%-----------------------------------------------------------------------
-%-Initialise result to zeros
-f = zeros(rs);
-
-%-Only defined for strictly positive h & l. Return NaN if undefined.
-md = ( ones(size(x)) & h>0 & l>0 );
-if any(~md(:)), f(~md) = NaN;
- warning('Returning NaN for out of range arguments'), end
-
-%-Degenerate cases at x==0: h<1 => f=Inf; h==1 => f=l; h>1 => f=0
-ml = ( md & x==0 & h<1 );
-f(ml) = Inf;
-ml = ( md & x==0 & h==1 ); if xa(3), mll=ml; else mll=1; end
-f(ml) = l(mll);
-
-%-Compute where defined and x>0
-Q = find( md & x>0 );
-if isempty(Q), return, end
-if xa(1), Qx=Q; else Qx=1; end
-if xa(2), Qh=Q; else Qh=1; end
-if xa(3), Ql=Q; else Ql=1; end
-
-%-Compute
-f(Q) = exp( (h(Qh)-1).*log(x(Qx)) +h(Qh).*log(l(Ql)) - l(Ql).*x(Qx)...
- -gammaln(h(Qh)) );
diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_hrf.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_hrf.m
deleted file mode 100644
index c1c4041..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_hrf.m
+++ /dev/null
@@ -1,44 +0,0 @@
-function [hrf,p] = pr_spm_hrf(RT,P);
-% returns a hemodynamic response function
-% FORMAT [hrf,p] = pr_spm_hrf(RT,[p]);
-% RT - scan repeat time
-% p - parameters of the response function (two gamma functions)
-%
-% defaults
-% (seconds)
-% p(1) - delay of response (relative to onset) 6
-% p(2) - delay of undershoot (relative to onset) 16
-% p(3) - dispersion of response 1
-% p(4) - dispersion of undershoot 1
-% p(5) - ratio of response to undershoot 6
-% p(6) - onset (seconds) 0
-% p(7) - length of kernel (seconds) 32
-%
-% hrf - hemodynamic response function
-% p - parameters of the response function
-%_______________________________________________________________________
-% @(#)spm_hrf.m 2.8 Karl Friston 02/07/31
-
-% global parameter
-%-----------------------------------------------------------------------
-global defaults
-if ~isempty(defaults),
- fMRI_T = defaults.stats.fmri.t;
-else,
- fMRI_T = 16;
-end;
-
-% default parameters
-%-----------------------------------------------------------------------
-p = [6 16 1 1 6 0 32];
-if nargin > 1
- p(1:length(P)) = P;
-end
-
-% modelled hemodynamic response function - {mixture of Gammas}
-%-----------------------------------------------------------------------
-dt = RT/fMRI_T;
-u = [0:(p(7)/dt)] - p(6)/dt;
-hrf = spm_Gpdf(u,p(1)/p(3),dt/p(3)) - spm_Gpdf(u,p(2)/p(4),dt/p(4))/p(5);
-hrf = hrf([0:(p(7)/RT)]*fMRI_T + 1);
-hrf = hrf'/sum(hrf);
diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_orth.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_orth.m
deleted file mode 100644
index 7c2d4da..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_orth.m
+++ /dev/null
@@ -1,16 +0,0 @@
-function x = spm_orth(X)
-% recursive orthogonalization of basis functions
-% FORMAT x = spm_orth(X)
-%
-% serial orthogionalization starting with the first column
-%_______________________________________________________________________
-% @(#)spm_orth.m 2.1 Karl Friston 02/02/07
-
-x = X(:,1);
-for i = 2:size(X,2)
- D = X(:,i);
- D = D - x*(pinv(x)*D);
- if any(D)
- x = [x D];
- end
-end
diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_q.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_q.m
deleted file mode 100644
index 94584d1..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_q.m
+++ /dev/null
@@ -1,19 +0,0 @@
-function [Q] = pr_spm_q(A,n)
-% returns an (n x n) autocorrelation matrix for an AR(p) process
-% FORMAT [Q] = spm_Q(A,n)
-%
-% A - vector pf p AR coeficients
-% n - size of Q
-%___________________________________________________________________________
-% @(#)spm_Q.m 2.2 Karl Friston 03/03/03
-
-% compute Q
-%---------------------------------------------------------------------------
-p = length(A);
-A = [1 -A(:)'];
-K = inv(spdiags(ones(n,1)*A,-[0:p],n,n));
-K = K.*(abs(K) > 1e-4);
-Q = K*K';
-D = spdiags(sqrt(1./diag(Q)),0,n,n);
-Q = D*Q*D;
-Q = Q.*(abs(Q) > 1e-4);
diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_reml.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_reml.m
deleted file mode 100644
index c0d0bf9..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_reml.m
+++ /dev/null
@@ -1,135 +0,0 @@
-function [Ce,h,W,u] = spm_reml(Cy,X,Q,TOL);
-% REML estimation of covariance components from Cov{y}
-% FORMAT [Ce,h,W,u] = spm_reml(Cy,X,Q,TOL);
-%
-% Cy - (m x m) data covariance matrix y*y' {y = (m x n) data matrix}
-% X - (m x p) design matrix
-% Q - {1 x q} covariance components
-% TOL - Tolerance {default = 1e-6}
-%
-% Ce - (m x m) estimated errors = h(1)*Q{1} + h(2)*Q{2} + ...
-% h - (q x 1) hyperparameters
-% W - (q x q) W*n = precision of hyperparameter estimates
-% u - {1 x p} estimable components C{i} = u(1,i)*Q{1} + u(2,i)*Q{2} +...
-%___________________________________________________________________________
-% @(#)spm_reml.m 2.22 John Ashburner, Karl Friston 03/03/26
-
-% set tolerance if not specified
-%---------------------------------------------------------------------------
-if nargin < 4, TOL = 1e-6; end
-
-% ensure X is not rank deficient
-%---------------------------------------------------------------------------
-X = full(X);
-X = orth(X);
-X = sparse(X);
-
-% find estimable components (encoded in the precision matrix W)
-%---------------------------------------------------------------------------
-m = length(Q);
-n = length(Cy);
-W = zeros(m,m);
-for i = 1:m
- RQ{i} = Q{i} - X*(X'*Q{i});
-end
-for i = 1:m
-for j = i:m
- dFdhh = sum(sum(RQ{i}.*RQ{j}'));
- W(i,j) = dFdhh;
- W(j,i) = dFdhh;
-end
-end
-
-% eliminate inestimable components
-% NB: The threshold for normalized eigenvalues is 1e-6 in spm_svd
-%---------------------------------------------------------------------------
-u = pr_spm_svd(W);
-for i = 1:size(u,2)
- C{i} = sparse(n,n);
- for j = 1:m
- C{i} = C{i} + Q{j}*u(j,i);
- end
-end
-Q = C;
-
-% initialize hyperparameters (assuming Cov{e} = 1}
-%---------------------------------------------------------------------------
-m = length(Q);
-dFdh = zeros(m,1);
-W = zeros(m,m);
-C = [];
-for i = 1:m
- C = [C Q{i}(:)];
-end
-I = speye(n,n);
-h = inv(C'*C)*(C'*I(:));
-
-% Iterative EM
-%---------------------------------------------------------------------------
-for k = 1:32
-
- % Q are variance components
- %------------------------------------------------------------------
- Ce = sparse(n,n);
- for i = 1:m
- Ce = Ce + h(i)*Q{i};
- end
- iCe = inv(Ce);
-
- % E-step: conditional covariance cov(B|y) {Cby}
- %===================================================================
- iCeX = iCe*X;
- Cby = inv(X'*iCeX);
-
- % M-step: ReML estimate of hyperparameters
- %===================================================================
-
- % Gradient dFd/h (first derivatives)
- %-------------------------------------------------------------------
- P = iCe - iCeX*Cby*iCeX';
- PCy = Cy*P'- speye(n,n);
- for i = 1:m
-
- % dF/dh = -trace(dF/diCe*iCe*Q{i}*iCe) =
- %---------------------------------------------------
- PQ{i} = P*Q{i};
- dFdh(i) = sum(sum(PCy.*PQ{i}))/2;
-
- end
-
- % Expected curvature E{ddF/dhh} (second derivatives)
- %-------------------------------------------------------------------
- for i = 1:m
- for j = i:m
-
- % ddF/dhh = -trace{P*Q{i}*P*Q{j}}
- %---------------------------------------------------
- dFdhh = sum(sum(PQ{i}.*PQ{j}))/2;
- W(i,j) = dFdhh;
- W(j,i) = dFdhh;
- end
- end
-
- % Fisher scoring: update dh = -inv(ddF/dhh)*dF/dh
- %-------------------------------------------------------------------
- dh = inv(W)*dFdh;
- h = h + dh;
-
- % Convergence (or break if there is only one hyperparameter)
- %===================================================================
- w = dFdh'*dFdh;
- if w < TOL | m == 1, break, end
- fprintf('%-30s: %i %30s%e\n',' ReML Iteration',k,'...',full(w));
-end
-
-% estimate of cov{e}
-%---------------------------------------------------------------------------
-Ce = sparse(n,n);
-for i = 1:m
- Ce = Ce + h(i)*Q{i};
-end
-
-% rotate hyperparameter esimates and precision back
-%---------------------------------------------------------------------------
-h = u*h;
-W = u*W*u';
diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_svd.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_svd.m
deleted file mode 100644
index c5af26a..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_svd.m
+++ /dev/null
@@ -1,94 +0,0 @@
-function [U,S,V] = spm_svd(X,U)
-% computationally efficient SVD (that can handle sparse arguments)
-% FORMAT [U,S,V] = spm_svd(X,u);
-% X - {m x n} matrix
-% u - threshold for normalized eigenvalues (default = 1e-6)
-%
-% U - {m x p} singular vectors
-% V - {m x p} singular variates
-% S - {p x p} singular values
-%___________________________________________________________________________
-% @(#)spm_svd.m 2.2 Karl Friston 00/10/10
-
-
-% default threshold
-%---------------------------------------------------------------------------
-if nargin < 2
- U = 1e-6;
-end
-
-% deal with sparse matrices
-%---------------------------------------------------------------------------
-[M N] = size(X);
-p = find(any(X,2));
-q = find(any(X,1));
-X = X(p,q);
-
-% SVD
-%---------------------------------------------------------------------------
-[i j s] = find(X);
-[m n] = size(X);
-if any(i - j)
-
- % off-leading diagonal elements - full SVD
- %-------------------------------------------------------------------
- X = full(X);
- if m > n
-
- [v S v] = svd(spm_atranspa(X),0);
- S = sparse(S);
- s = diag(S);
- s = s*length(s)/sum(s);
- j = find(s >= U);
- v = v(:,j);
- u = spm_en(X*v);
- S = sqrt(S(j,j));
-
- elseif m < n
-
- [u S u] = svd(spm_atranspa(X'),0);
- S = sparse(S);
- s = diag(S);
- s = s*length(s)/sum(s);
- j = find(s >= U);
- u = u(:,j);
- v = spm_en(X'*u);
- S = sqrt(S(j,j));
-
- else
-
- [u S v] = svd(X,0);
- S = sparse(S);
- s = diag(S).^2;
- s = s*length(s)/sum(s);
- j = find(s >= U);
- v = v(:,j);
- u = u(:,j);
- S = S(j,j);
- end
-
-else
- S = sparse(1:n,1:n,s,m,n);
- u = speye(m,n);
- v = speye(m,n);
- [i j] = sort(-s);
- S = S(j,j);
- v = v(:,j);
- u = u(:,j);
-
- s = diag(S).^2;
- s = s*length(s)/sum(s);
- j = find(s >= U);
- v = v(:,j);
- u = u(:,j);
- S = S(j,j);
-
-end
-
-% replace in full matrices
-%---------------------------------------------------------------------------
-j = length(j);
-U = sparse(M,j);
-V = sparse(N,j);
-U(p,:) = u;
-V(q,:) = v;
diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_ui.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_ui.m
deleted file mode 100644
index cfd2f92..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_ui.m
+++ /dev/null
@@ -1,1393 +0,0 @@
-function varargout = pr_spm_ui(varargin)
-% MarsBaR: setting up the general linear model for independent data
-%
-% MarsBaR version copied with minor edits from:
-% @(#)spm_spm_ui.m 2.49 Andrew Holmes 03/03/20
-% See that (SPM2) file for comments and help
-%
-% $Id$
-
-%-Condition arguments
-%-----------------------------------------------------------------------
-if (nargin==0), Action = 'CFG'; else, Action = varargin{1}; end
-
-% For selecting images, later
-img_flt = mars_veropts('get_img_ext');
-
-switch lower(Action), case 'cfg'
-%=======================================================================
-% - C O N F I G U R E D E S I G N
-%=======================================================================
-% pr_spm_ui('CFG',D)
-if nargin<2, D = []; else, D = varargin{2}; end
-
-%-GUI setup
-%-----------------------------------------------------------------------
-SPMid = spm('SFnBanner',mfilename,marsbar('ver'));
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Stats: Setup analysis',0);
-spm_help('!ContextHelp',mfilename)
-
-%-Option definitions
-%-----------------------------------------------------------------------
-%-Generic factor names
-sF = {'sF1','sF2','sF3','sF4'};
-
-%-Covariate by factor interaction options
-sCFI = {'';... %-1
- 'with sF1';'with sF2';'with sF3';'with sF4';... %-2:5
- 'with sF2 (within sF4)';'with sF3 (within sF4)'}; %-6,7
-
-%-DesMtx argument components for covariate by factor interaction options
-% (Used for CFI's Covariate Centering (CC), GMscale & Global normalisation)
-CFIforms = { '[]', 'C', '{}';... %-1
- 'I(:,1)', 'FxC', '{D.sF{1}}';... %-2
- 'I(:,2)', 'FxC', '{D.sF{2}}';... %-3
- 'I(:,3)', 'FxC', '{D.sF{3}}';... %-4
- 'I(:,4)', 'FxC', '{D.sF{4}}';... %-5
- 'I(:,[4,2])', 'FxC', '{D.sF{4},D.sF{2}}';... %-6
- 'I(:,[4,3])', 'FxC', '{D.sF{4},D.sF{3}}' }; %-7
-
-%-Centre (mean correction) options for covariates & globals (CC)
-% (options 9-12 are for centering of global when using AnCova GloNorm) (GC)
-sCC = { 'around overall mean';... %-1
- 'around sF1 means';... %-2
- 'around sF2 means';... %-3
- 'around sF3 means';... %-4
- 'around sF4 means';... %-5
- 'around sF2 (within sF4) means';... %-6
- 'around sF3 (within sF4) means';... %-7
- '';... %-8
- 'around user specified value';... %-9
- '(as implied by AnCova)';... %-10
- 'GM';... %-11
- '(redundant: not doing AnCova)'}'; %-12
-%-DesMtx I forms for covariate centering options
-CCforms = {'ones(nScan,1)',CFIforms{2:end,1},''}';
-
-
-%-Global normalization options (options 1-7 match CFIforms) (GloNorm)
-sGloNorm = { 'AnCova';... %-1
- 'AnCova by sF1';... %-2
- 'AnCova by sF2';... %-3
- 'AnCova by sF3';... %-4
- 'AnCova by sF4';... %-5
- 'AnCova by sF2 (within sF4)';... %-6
- 'AnCova by sF3 (within sF4)';... %-7
- 'proportional scaling';... %-8
- ''}; %-9
-
-%-Grand mean scaling options (GMsca)
-sGMsca = { 'scaling of overall grand mean';... %-1
- 'scaling of sF1 grand means';... %-2
- 'scaling of sF2 grand means';... %-3
- 'scaling of sF3 grand means';... %-4
- 'scaling of sF4 grand means';... %-5
- 'scaling of sF2 (within sF4) grand means';... %-6
- 'scaling of sF3 (within sF4) grand means';... %-7
- '(implicit in PropSca global normalisation)';... %-8
- '' }; %-9
-%-NB: Grand mean scaling by subject is redundent for proportional scaling
-
-
-%-Global calculation options (GXcalc)
-sGXcalc = { 'omit';... %-1
- 'user specified';... %-2
- 'mean voxel value (within per image fullmean/8 mask)'}; %-3
-
-
-
-%=======================================================================
-%-D E S I G N P A R A M E T E R S
-%=======================================================================
-%-Get design type
-%-----------------------------------------------------------------------
-if isempty(D)
-
- D = pr_spm_ui( ...
- char(spm_input('Select design class...','+1','m',...
- {'Basic stats','Standard PET designs','SPM96 PET designs'},...
- {'DesDefs_Stats','DesDefs_PET','DesDefs_PET96'},2)));
-end
-
-D = D(spm_input('Select design type...','+1','m',{D.DesName}'));
-
-
-%-Set factor names for this design
-%-----------------------------------------------------------------------
-sCC = sf_estrrep(sCC,[sF',D.sF']);
-sCFI = sf_estrrep(sCFI,[sF',D.sF']);
-sGloNorm = sf_estrrep(sGloNorm,[sF',D.sF']);
-sGMsca = sf_estrrep(sGMsca,[sF',D.sF']);
-
-%-Get filenames & factor indicies
-%-----------------------------------------------------------------------
-[P,I] = pr_spm_ui('Files&Indices',D.sF,D.n,D.b.aTime);
-nScan = size(I,1); %-#obs
-
-%-Additional design parameters
-%-----------------------------------------------------------------------
-bL = any(diff(I,1),1); %-Multiple factor levels?
- % NB: bL(2) might be thrown by user specified f1 levels
- % (D.b.aTime & D.n(2)>1) - assumme user is consistent?
-bFI = [bL(1),bL(2:3)&~bL(4),bL(4),bL([2,3])&bL(4)];
- %-Allowable interactions for covariates
- %-Only offer interactions with multi-level factors, and
- % don't offer by F2|F3 if bL(4)!
-
-%-Build Condition (H) and Block (B) partitions
-%=======================================================================
-eval(['[H,Hnames] = spm_DesMtx(',D.Hform,');'])
-if rank(H)==nScan, error('unestimable condition effects'), end
-eval(['[B,Bnames] = spm_DesMtx(',D.Bform,');'])
-if rank(B)==nScan, error('unestimable block effects'), end
-
-%-Drop a constant H partition if B partition can model constant
-if size(H,2)>0 & all(H(:)==1) & (rank([H B])==rank(B))
- H = []; Hnames = {};
- warning('Dropping redundant constant H partition')
-end
-
-
-%-Covariate partition(s): interest (C) & nuisance (G) excluding global
-%=======================================================================
-nC = D.nC; %-Default #covariates
-C = {[],[]}; Cnames = {{},{}}; %-Covariate DesMtx partitions & names
-xC = []; %-Struct array to hold raw covariates
-
-
-dcname = {'CovInt','NusCov'}; %-Default root names for covariates
-dstr = {'covariate','nuisance variable'};
-
-GUIpos = spm_input('!NextPos');
-nc = [0,0];
-for i = 1:2 % 1:covariates of interest, 2:nuisance variables
-
- if isinf(nC(i)), nC(i)=spm_input(['# ',dstr{i},'s'],GUIpos,'w1'); end
-
- while nc(i) < nC(i)
-
- %-Create prompt, get covariate, get covariate name
- %---------------------------------------------------------------
- if nC(i)==1, str=dstr{i}; else, str=sprintf('%s %d',dstr{i},nc(i)+1); end
- c = spm_input(str,GUIpos,'r',[],[nScan,Inf]);
- if any(isnan(c(:))), break, end %-NaN is dummy value to exit
- nc(i) = nc(i)+1; %-#Covariates (so far)
- if nC(i)>1, tstr = sprintf('%s^{%d}',dcname{i},nc(i));
- else, tstr = dcname{i}; end
- cname = spm_input([str,' name?'],'+1','s',tstr);
- rc = c; %-Save covariate value
- rcname = cname; %-Save covariate name
-
- %-Interaction option? (if single covariate vector entered)?
- %---------------------------------------------------------------
- if size(c,2) == 1
- if length(D.iCFI{i})>1
- %-User choice of interaction options, default is negative
- %-Only offer interactions for appropriate factor combinations
- iCFI = intersect(abs(D.iCFI{i}),find([1,bFI]));
- dCFI = max([1,intersect(iCFI,-D.iCFI{i}(D.iCFI{i}<0))]);
- iCFI = spm_input([str,': interaction?'],'+1','m',...
- sCFI(iCFI),iCFI,find(iCFI==dCFI));
- else
- iCFI = abs(D.iCFI{i}); %-AutoSelect default option
- end
- else
- iCFI = 1;
- end
-
- %-Centre covariate(s)? (Default centring to correspond to CFI)
- % Always offer "no centering" as default for design matrix blocks
- %---------------------------------------------------------------
- DiCC = D.iCC{i};
- if size(c,2)>1, DiCC = union(DiCC,-8); end
- if length(DiCC)>1
- %-User has a choice of centering options
- %-Only offer factor specific for appropriate factor combinations
- iCC = intersect(abs(DiCC),find([1,bFI,1]) );
- %-Default is max -ve option in D, overridden by iCFI if CFI
- if iCFI == 1, dCC = -DiCC(DiCC<0); else, dCC = iCFI; end
- dCC = max([1,intersect(iCC,dCC)]);
- iCC = spm_input([str,': centre?'],'+1','m',...
- sCC(iCC),iCC,find(iCC==dCC));
- else
- iCC = abs(DiCC); %-AutoSelect default option
- end
- %-Centre within factor levels as appropriate
- if any(iCC == [1:7]), c = c - spm_meanby(c,eval(CCforms{iCC})); end
-
- %-Do any interaction (only for single covariate vectors)
- %---------------------------------------------------------------
- if iCFI > 1 %-(NB:iCFI=1 if size(c,2)>1)
- tI = [eval(CFIforms{iCFI,1}),c];
- tConst = CFIforms{iCFI,2};
- tFnames = [eval(CFIforms{iCFI,3}),{cname}];
- [c,cname] = spm_DesMtx(tI,tConst,tFnames);
- elseif size(c,2)>1 %-Design matrix block
- [null,cname] = spm_DesMtx(c,'X',cname);
- else
- cname = {cname};
- end
-
- %-Store raw covariate details in xC struct for reference
- %-Pack c into appropriate DesMtx partition
- %---------------------------------------------------------------
- %-Construct description string for covariate
- str = {sprintf('%s: %s',str,rcname)};
- if size(rc,2)>1, str = {sprintf('%s (block of %d covariates)',...
- str{:},size(rc,2))}; end
- if iCC < 8, str=[str;{['used centered ',sCC{iCC}]}]; end
- if iCFI> 1, str=[str;{['fitted as interaction ',sCFI{iCFI}]}]; end
-
- tmp = struct( 'rc',rc, 'rcname',rcname,...
- 'c',c, 'cname',{cname},...
- 'iCC',iCC, 'iCFI',iCFI,...
- 'type',i,...
- 'cols',[1:size(c,2)] + ...
- size([H,C{1}],2) + ...
- size([B,C{2}],2)*(i-1),...
- 'descrip',{str} );
- if isempty(xC), xC = tmp; else, xC = [xC,tmp]; end
- C{i} = [C{i},c];
- Cnames{i} = [Cnames{i}; cname];
-
- end % (while)
-
-end % (for)
-clear c tI tConst tFnames
-spm_input('!SetNextPos',GUIpos);
-
-%-Unpack into C & G design matrix sub-partitions
-G = C{2}; Gnames = Cnames{2};
-C = C{1}; Cnames = Cnames{1};
-
-
-%-Options...
-%=======================================================================
-%-Global normalization options (GloNorm)
-%-----------------------------------------------------------------------
-if length(D.iGloNorm)>1
- %-User choice of global normalisation options, default is negative
- %-Only offer factor specific for appropriate factor combinations
- iGloNorm = intersect(abs(D.iGloNorm),find([1,bFI,1,1]));
- dGloNorm = max([0,intersect(iGloNorm,-D.iGloNorm(D.iGloNorm<0))]);
- iGloNorm = spm_input('GloNorm: Select global normalisation','+1','m',...
- sGloNorm(iGloNorm),iGloNorm,find(iGloNorm==dGloNorm));
-else
- iGloNorm = abs(D.iGloNorm);
-end
-
-
-%-Grand mean scaling options (GMsca)
-%-----------------------------------------------------------------------
-if iGloNorm==8
- iGMsca=8; %-grand mean scaling implicit in PropSca GloNorm
-elseif length(D.iGMsca)==1
- iGMsca = abs(D.iGMsca);
-else
- %-User choice of grand mean scaling options
- %-Only offer factor specific for appropriate factor combinations
- iGMsca = intersect(abs(D.iGMsca),find([1,bFI,0,1]));
- %-Default is max -ve option in D, overridden by iGloNorm if AnCova
- if iGloNorm==9, dGMsca=-D.iGMsca(D.iGMsca<0); else, dGMsca=iGloNorm; end
- dGMsca = max([0,intersect(iGMsca,dGMsca)]);
- iGMsca = spm_input('GMsca: grand mean scaling','+1','m',...
- sGMsca(iGMsca),iGMsca,find(iGMsca==dGMsca));
-end
-
-
-%-Value for PropSca / GMsca (GM)
-%-----------------------------------------------------------------------
-if iGMsca == 9 %-Not scaling (GMsca or PropSca)
- GM = 0; %-Set GM to zero when not scaling
-else %-Ask user value of GM
- if iGloNorm==8
- str = 'PropSca global mean to';
- else
- str = [strrep(sGMsca{iGMsca},'scaling of','scale'),' to'];
- end
- GM = spm_input(str,'+1','r',D.GM,1);
- %-If GM is zero then don't GMsca! or PropSca GloNorm
- if GM==0, iGMsca=9; if iGloNorm==8, iGloNorm=9; end, end
-end
-
-%-Sort out description strings for GloNorm and GMsca
-%-----------------------------------------------------------------------
-sGloNorm = sGloNorm{iGloNorm};
-sGMsca = sGMsca{iGMsca};
-if iGloNorm==8
- sGloNorm = sprintf('%s to %-4g',sGloNorm,GM);
-elseif iGMsca<8
- sGMsca = sprintf('%s to %-4g',sGMsca,GM);
-end
-
-
-%-Global centering (for AnCova GloNorm) (GC)
-%-----------------------------------------------------------------------
-%-Specify the centering option for the global covariate for AnCova
-%-Basically, if 'GMsca'ling then should centre to GM (iGC=11). Otherwise,
-% should centre in similar fashion to AnCova (i.e. by the same factor(s)),
-% such that models are seperable (iGC=10). This is particularly important
-% for subject specific condition effects if then passed on to a second-level
-% model. (See also spm_adjmean_ui.m) SPM96 (& earlier) used to just centre
-% GX around its (overall) mean (iGC=1).
-
-%-This code allows more general options to be specified (but is a bit complex)
-%-Setting D.iGC=[-10,-11] gives the standard choices above
-
-%-If not doing AnCova then GC is irrelevant
-if ~any(iGloNorm == [1:7])
- iGC = 12;
- gc = [];
-else
- %-Annotate options 10 & 11 with specific details
- %---------------------------------------------------------------
- %-Tag '(as implied by AnCova)' with actual AnCova situation
- sCC{10} = [sCC{iGloNorm},' (<= ',sGloNorm,')'];
- %-Tag 'GM' case with actual GM & GMsca case
- sCC{11} = sprintf('around GM=%g (i.e. %s after grand mean scaling)',...
- GM,strrep(sCC{iGMsca},'around ',''));
-
- %-Constuct vector of allowable iGC
- %---------------------------------------------------------------
- %-Weed out redundent factor combinations from pre-set allowable options
- iGC = intersect(abs(D.iGC),find([1,bFI,1,1,1,1]));
- %-Omit 'GM' option if didn't GMsca (iGMsca~=8 'cos doing AnCova)
- if any(iGMsca==[8,9]), iGC = setdiff(iGC,11); end
- %-Omit 'GM' option if same as '(as implied by AnCova)'
- if iGloNorm==iGMsca, iGC = setdiff(iGC,11); end
-
- %-If there's a choice, set defaults (if any), & get answer
- %---------------------------------------------------------------
- if length(iGC)>1
- dGC = max([0,intersect(iGC,-D.iGC(D.iGC<0))]);
- str = 'Centre global covariate';
- if iGMsca<8, str = [str,' (after grand mean scaling)']; end
- iGC = spm_input(str,'+1','m',sCC(iGC),iGC,find(iGC==dGC));
- elseif isempty(iGC)
- error('Configuration error: empty iGC')
- end
-
- %-If 'user specified' then get value
- %---------------------------------------------------------------
- if iGC==9
- gc = spm_input('Centre globals around','+0','r',D.GM,1);
- sCC{9} = sprintf('%s of %g',sCC{iGC},gc);
- else
- gc = 0;
- end
-end
-
-
-%-Thresholds & masks defining voxels to analyse (MASK)
-%=======================================================================
-GUIpos = spm_input('!NextPos');
-
-%-Analysis threshold mask
-%-----------------------------------------------------------------------
-%-Work out available options:
-% -Inf=>None, real=>absolute, complex=>proportional, (i.e. times global)
-M_T = D.M_.T; if isempty(M_T), M_T = [-Inf, 100, 0.8*sqrt(-1)]; end
-M_T = { 'none', M_T(min(find(isinf(M_T))));...
- 'absolute', M_T(min(find(isfinite(M_T)&(M_T==real(M_T)))));...
- 'relative', M_T(min(find(isfinite(M_T)&(M_T~=real(M_T))))) };
-
-%-Work out available options
-%-If there's a choice between proportional and absolute then ask
-%-----------------------------------------------------------------------
-q = ~[isempty(M_T{1,2}), isempty(M_T{2,2}), isempty(M_T{3,2})];
-
-if all(q(2:3))
- tmp = spm_input('Threshold masking',GUIpos,'b',M_T(q,1),find(q));
- q(setdiff([1:3],tmp))=0;
-end
-
-%-Get mask value - note that at most one of q(2:3) is true
-%-----------------------------------------------------------------------
-if ~any(q) %-Oops - nothing specified!
- M_T = -Inf;
-elseif all(q==[1,0,0]) %-no threshold masking
- M_T = -Inf;
-else %-get mask value
- if q(1), args = {'br1','None',-Inf,abs(M_T{1+find(q(2:3)),2})};
- else, args = {'r',abs(M_T{1+find(q(2:3)),2})}; end
- if q(2)
- M_T = spm_input('threshold',GUIpos,args{:});
- elseif q(3)
- M_T = spm_input('threshold (relative to global)',GUIpos,...
- args{:});
- if isfinite(M_T) & isreal(M_T), M_T=M_T*sqrt(-1); end
- else
- error('Shouldn''t get here!')
- end
-end
-
-%-Make a description string
-%-----------------------------------------------------------------------
-if isinf(M_T)
- xsM.Analysis_threshold = 'None (-Inf)';
-elseif isreal(M_T)
- xsM.Analysis_threshold = sprintf('images thresholded at %6g',M_T);
-else
- xsM.Analysis_threshold = sprintf(['images thresholded at %6g ',...
- 'times global'],imag(M_T));
-end
-
-
-%-Implicit masking: Ignore zero voxels in low data-types?
-%-----------------------------------------------------------------------
-% (Implicit mask is NaN in higher data-types.)
-type = mars_vol_utils('type', spm_vol(P{1,1}));
-if ~spm_type(type,'nanrep')
- switch D.M_.I
- case Inf, M_I = spm_input('Implicit mask (ignore zero''s)?',...
- '+1','y/n',[1,0],1); %-Ask
- case {0,1}, M_I = D.M_.I; %-Pre-specified
- otherwise, error('unrecognised D.M_.I type')
- end
-
- if M_I, xsM.Implicit_masking = 'Yes: zero''s treated as missing';
- else, xsm.Implicit_masking = 'No'; end
-else
- M_I = 1;
- xsM.Implicit_masking = 'Yes: NaN''s treated as missing';
-end
-
-
-%-Explicit mask images (map them later...)
-%-----------------------------------------------------------------------
-switch(D.M_.X)
-case Inf, M_X = spm_input('explicitly mask images?','+1','y/n',[1,0],2);
-case {0,1}, M_X = D.M_.X;
-otherwise, error('unrecognised D.M_.X type')
-end
-if M_X, M_P = spm_get(Inf,img_flt,{'select mask images'}); else, M_P = {}; end
-
-
-%-Global calculation (GXcalc)
-%=======================================================================
-iGXcalc = abs(D.iGXcalc);
-%-Only offer "omit" option if not doing any GloNorm, GMsca or PropTHRESH
-if ~(iGloNorm==9 & iGMsca==9 & (isinf(M_T)|isreal(M_T)))
- iGXcalc = intersect(iGXcalc,[2:size(sGXcalc,1)]);
-end
-if isempty(iGXcalc)
- error('no GXcalc options')
-elseif length(iGXcalc)>1
- %-User choice of global calculation options, default is negative
- dGXcalc = max([1,intersect(iGXcalc,-D.iGXcalc(D.iGXcalc<0))]);
- iGXcalc = spm_input('Global calculation','+1','m',...
- sGXcalc(iGXcalc),iGXcalc,find(iGXcalc==dGXcalc));
-else
- iGXcalc = abs(D.iGXcalc);
-end
-
-if iGXcalc==2 %-Get user specified globals
- g = spm_input('globals','+0','r',[],[nScan,1]);
-end
-sGXcalc = sGXcalc{iGXcalc};
-
-
-% Non-sphericity correction
-%=======================================================================
-
-% if there are multilevel factors, ask for correction
-%-----------------------------------------------------------------------
-if length(find(max(I) > 1)) > 1
- xVi.iid = spm_input('non-sphericity correction?','+1','y/n',[0,1],1);
-else
- xVi.iid = 1;
-end
-
-
-if xVi.iid
-
- % i.i.d. assumptions where xVi.V = 1
- %---------------------------------------------------------------
- xVi.V = speye(nScan);
-
-else
- % otherwise, we have repeated measures design
- %===============================================================
- nL = max(I); % number of levels
- mL = find(nL > 1); % multilevel factors
- xVi.I = I;
- xVi.sF = D.sF;
- xVi.var = sparse(1,4);
- xVi.dep = sparse(1,4);
-
-
- % eliminate replication factor from mL
- %---------------------------------------------------------------
- for i = 1:4
- mstr{i} = sprintf('%s (%i)',D.sF{i},nL(i));
- end
- str = 'replications are over?';
- rep = spm_input(str,'+1','m',mstr(mL),1:length(mL));
-
- % and ask whether repeated measures are independent
- %---------------------------------------------------------------
- str = 'correlated repeated measures';
- dep = spm_input(str,'+1','b',{'yes','no'},[1 0],1);
-
-
- %-Place covariance components Q{:} in xVi.Vi
- %---------------------------------------------------------------
- mL(rep) = [];
- xVi.var(mL) = 1;
- xVi.dep(mL) = dep;
- xVi = spm_non_sphericity(xVi);
-
-end
-
-
-%=======================================================================
-% - C O N F I G U R E D E S I G N
-%=======================================================================
-spm('FigName','Stats: configuring',Finter,CmdLine);
-spm('Pointer','Watch');
-
-
-%-Images & image info: Map Y image files and check consistency of
-% dimensions and orientation / voxel size
-%=======================================================================
-fprintf('%-40s: ','Mapping files') %-#
-VY = spm_vol(char(P));
-
-
-%-Check compatability of images
-%-----------------------------------------------------------------------
-[samef msg] = mars_vol_check(VY);
-if ~samef, disp(char(msg)),error('Cannot use images'),end;
-
-fprintf('%30s\n','...done') %-#
-
-
-%-Global values, scaling and global normalisation
-%=======================================================================
-%-Compute global values
-%-----------------------------------------------------------------------
-switch iGXcalc, case 1
- %-Don't compute => no GMsca (iGMsca==9) or GloNorm (iGloNorm==9)
- g = [];
-case 2
- %-User specified globals
-case 3
- %-Compute as mean voxel value (within per image fullmean/8 mask)
- g = zeros(nScan,1 );
- fprintf('%-40s: %30s','Calculating globals',' ') %-#
- for i = 1:nScan
- str = sprintf('%3d/%-3d',i,nScan);
- fprintf('%s%30s',repmat(sprintf('\b'),1,30),str)%-#
- g(i) = spm_global(VY(i));
- end
- fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-#
-otherwise
- error('illegal iGXcalc')
-end
-rg = g;
-
-
-fprintf('%-40s: ','Design configuration') %-#
-
-
-%-Scaling: compute global scaling factors gSF required to implement proportional
-% scaling global normalisation (PropSca) or grand mean scaling (GMsca),
-% as specified by iGMsca (& iGloNorm)
-%-----------------------------------------------------------------------
-switch iGMsca, case 8
- %-Proportional scaling global normalisation
- if iGloNorm~=8, error('iGloNorm-iGMsca(8) mismatch for PropSca'), end
- gSF = GM./g;
- g = GM*ones(nScan,1);
-case {1,2,3,4,5,6,7}
- %-Grand mean scaling according to iGMsca
- gSF = GM./spm_meanby(g,eval(CCforms{iGMsca}));
- g = g.*gSF;
-case 9
- %-No grand mean scaling
- gSF = ones(nScan,1);
-otherwise
- error('illegal iGMsca')
-end
-
-
-%-Apply gSF to memory-mapped scalefactors to implement scaling
-%-----------------------------------------------------------------------
-for i = 1:nScan
- VY(i).pinfo(1:2,:) = VY(i).pinfo(1:2,:)*gSF(i);
-end
-
-
-%-AnCova: Construct global nuisance covariates partition (if AnCova)
-%-----------------------------------------------------------------------
-if any(iGloNorm == [1:7])
-
- %-Centre global covariate as requested
- %---------------------------------------------------------------
- switch iGC, case {1,2,3,4,5,6,7} %-Standard sCC options
- gc = spm_meanby(g,eval(CCforms{iGC}));
- case 8 %-No centering
- gc = 0;
- case 9 %-User specified centre
- %-gc set above
- case 10 %-As implied by AnCova option
- gc = spm_meanby(g,eval(CCforms{iGloNorm}));
- case 11 %-Around GM
- gc = GM;
- otherwise %-unknown iGC
- error('unexpected iGC value')
- end
-
-
- %-AnCova - add scaled centred global to DesMtx `G' partition
- %---------------------------------------------------------------
- rcname = 'global';
- tI = [eval(CFIforms{iGloNorm,1}),g - gc];
- tConst = CFIforms{iGloNorm,2};
- tFnames = [eval(CFIforms{iGloNorm,3}),{rcname}];
- [f,gnames] = spm_DesMtx(tI,tConst,tFnames);
- clear tI tConst tFnames
-
- %-Save GX info in xC struct for reference
- %---------------------------------------------------------------
- str = {sprintf('%s: %s',dstr{2},rcname)};
- if any(iGMsca==[1:7]), str=[str;{['(after ',sGMsca,')']}]; end
- if iGC ~= 8, str=[str;{['used centered ',sCC{iGC}]}]; end
- if iGloNorm > 1
- str=[str;{['fitted as interaction ',sCFI{iGloNorm}]}];
- end
- tmp = struct( 'rc',rg.*gSF, 'rcname',rcname,...
- 'c',f, 'cname' ,{gnames},...
- 'iCC',iGC, 'iCFI' ,iGloNorm,...
- 'type', 3,...
- 'cols',[1:size(f,2)] + size([H C B G],2),...
- 'descrip', {str} );
-
- G = [G,f]; Gnames = [Gnames; gnames];
- if isempty(xC), xC = tmp; else, xC = [xC,tmp]; end
-
-
-elseif iGloNorm==8 | iGXcalc>1
-
- %-Globals calculated, but not AnCova: Make a note of globals
- %---------------------------------------------------------------
- if iGloNorm==8
- str = { 'global values: (used for proportional scaling)';...
- '("raw" unscaled globals shown)'};
- elseif isfinite(M_T) & ~isreal(M_T)
- str = { 'global values: (used to compute analysis threshold)'};
- else
- str = { 'global values: (computed but not used)'};
- end
-
- rcname ='global';
- tmp = struct( 'rc',rg, 'rcname',rcname,...
- 'c',{[]}, 'cname' ,{{}},...
- 'iCC',0, 'iCFI' ,0,...
- 'type', 3,...
- 'cols', {[]},...
- 'descrip', {str} );
-
- if isempty(xC), xC = tmp; else, xC = [xC,tmp]; end
-end
-
-
-%-Save info on global calculation in xGX structure
-%-----------------------------------------------------------------------
-xGX = struct(...
- 'iGXcalc',iGXcalc, 'sGXcalc',sGXcalc, 'rg',rg,...
- 'iGMsca',iGMsca, 'sGMsca',sGMsca, 'GM',GM,'gSF',gSF,...
- 'iGC', iGC, 'sGC', sCC{iGC}, 'gc', gc,...
- 'iGloNorm',iGloNorm, 'sGloNorm',sGloNorm);
-
-
-
-%-Construct masking information structure and compute actual analysis
-% threshold using scaled globals (rg.*gSF)
-%-----------------------------------------------------------------------
-if isreal(M_T), M_TH = M_T * ones(nScan,1); %-NB: -Inf is real
-else, M_TH = imag(M_T) * (rg.*gSF); end
-
-if ~isempty(M_P)
- VM = spm_vol(char(M_P));
- xsM.Explicit_masking = [{'Yes: mask images :'};{VM.fname}'];
-else
- VM = [];
- xsM.Explicit_masking = 'No';
-end
-xM = struct('T',M_T, 'TH',M_TH, 'I',M_I, 'VM',{VM}, 'xs',xsM);
-
-
-%-Construct full design matrix (X), parameter names and structure (xX)
-%=======================================================================
-X = [H C B G];
-tmp = cumsum([size(H,2), size(C,2), size(B,2), size(G,2)]);
-xX = struct( 'X', X,...
- 'iH', [1:size(H,2)],...
- 'iC', [1:size(C,2)] + tmp(1),...
- 'iB', [1:size(B,2)] + tmp(2),...
- 'iG', [1:size(G,2)] + tmp(3),...
- 'name', {[Hnames; Cnames; Bnames; Gnames]},...
- 'I', I,...
- 'sF', {D.sF});
-
-
-%-Design description (an nx2 cellstr) - for saving and display
-%=======================================================================
-tmp = { sprintf('%d condition, +%d covariate, +%d block, +%d nuisance',...
- size(H,2),size(C,2),size(B,2),size(G,2));...
- sprintf('%d total, having %d degrees of freedom',...
- size(X,2),rank(X));...
- sprintf('leaving %d degrees of freedom from %d images',...
- size(X,1)-rank(X),size(X,1)) };
-xsDes = struct( 'Design', {D.DesName},...
- 'Global_calculation', {sGXcalc},...
- 'Grand_mean_scaling', {sGMsca},...
- 'Global_normalisation', {sGloNorm},...
- 'Parameters', {tmp} );
-
-
-fprintf('%30s\n','...done') %-#
-
-
-
-%-Assemble SPM structure
-%=======================================================================
-SPM.xY.P = P; % filenames
-SPM.xY.VY = VY; % mapped data
-SPM.nscan = size(xX.X,1); % scan number
-SPM.xX = xX; % design structure
-SPM.xC = xC; % covariate structure
-SPM.xGX = xGX; % global structure
-SPM.xVi = xVi; % non-sphericity structure
-SPM.xM = xM; % mask structure
-SPM.xsDes = xsDes; % description
-SPM.SPMid = SPMid; % version
-
-varargout = {SPM};
-
-%-End: Cleanup GUI
-%=======================================================================
-spm_clf(Finter)
-spm('Pointer','Arrow')
-fprintf('%-40s: %30s\n','Completed',spm('time')) %-#
-spm('FigName','Stats: configured',Finter,CmdLine);
-spm('Pointer','Arrow')
-fprintf('\n\n')
-
-
-
-case 'files&indices'
-%=======================================================================
-% - Get files and factor indices
-%=======================================================================
-% [P,I] = pr_spm_ui('Files&Indices',DsF,Dn,DbaTime,nV)
-% DbaTime=D.b.aTime; Dn=D.n; DsF=D.sF;
-if nargin<5, nV = 1; else, nV = varargin{5}; end
-if nargin<4, DbaTime = 1; else, DbaTime = varargin{4}; end
-if nargin<3, Dn = [Inf,Inf,Inf,Inf]; else, Dn=varargin{3}; end
-if nargin<2, DsF = {'Fac1','Fac2','Fac3','Fac4'}; else, DsF=varargin{2}; end
-
-%-Initialise variables
-%-----------------------------------------------------------------------
-i4 = []; % factor 4 index (usually group)
-i3 = []; % factor 3 index (usually subject), per f4
-i2 = []; % factor 2 index (usually condition), per f3/f4
-i1 = []; % factor 1 index (usually replication), per f2/f3/f4
-P = {}; % cell array of string filenames
-
-%-Accrue filenames and factor level indicator vectors
-%-----------------------------------------------------------------------
-bMV = nV>1;
-if isinf(Dn(4)), n4 = spm_input(['#',DsF{4},'''s'],'+1','n1');
- else, n4 = Dn(4); end
-bL4 = n4>1;
-
-ti2 = '';
-GUIpos = spm_input('!NextPos');
-for j4 = 1:n4
- spm_input('!SetNextPos',GUIpos);
- sF4P=''; if bL4, sF4P=[DsF{4},' ',int2str(j4),': ']; end
- if isinf(Dn(3)), n3=spm_input([sF4P,'#',DsF{3},'''s'],'+1','n1');
- else, n3 = Dn(3); end
- bL3 = n3>1;
-
- if DbaTime & Dn(2)>1
- %disp('NB:selecting in time order - manually specify conditions')
- %-NB: This means f2 levels might not be 1:n2
- GUIpos2 = spm_input('!NextPos');
- for j3 = 1:n3
- sF3P=''; if bL3, sF3P=[DsF{3},' ',int2str(j3),': ']; end
- str = [sF4P,sF3P];
- tP = {};
- n21 = Dn(2)*Dn(1);
- for v=1:nV
- vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end
- ttP = spm_get(n21,img_flt,{[str,'select images',vstr]});
- n21 = length(ttP);
- tP = [tP,ttP];
- end
- ti2 = spm_input([str,' ',DsF{2},'?'],GUIpos2,'c',ti2',n21,Dn(2));
- %-Work out i1 & check
- [tl2,null,j] = unique(ti2);
- tn1 = zeros(size(tl2)); ti1 = zeros(size(ti2));
- for i=1:length(tl2)
- tn1(i)=sum(j==i); ti1(ti2==tl2(i))=1:tn1(i); end
- if isfinite(Dn(1)) & any(tn1~=Dn(1))
- %-#i1 levels mismatches specification in Dn(1)
- error(sprintf('#%s not %d as pre-specified',DsF{1},Dn(1)))
- end
- P = [P;tP];
- i4 = [i4; j4*ones(n21,1)];
- i3 = [i3; j3*ones(n21,1)];
- i2 = [i2; ti2];
- i1 = [i1; ti1];
- end
-
- else
-
- if isinf(Dn(2))
- n2 = spm_input([sF4P,'#',DsF{2},'''s'],'+1','n1');
- else
- n2 = Dn(2);
- end
- bL2 = n2>1;
-
- if n2==1 & Dn(1)==1 %-single scan per f3 (subj)
- %disp('NB:single scan per f3')
- str = [sF4P,'select images, ',DsF{3},' 1-',int2str(n3)];
- tP = {};
- for v=1:nV
- vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end
- ttP = spm_get(n3,img_flt,{[str,vstr]});
- tP = [tP,ttP];
- end
- P = [P;tP];
- i4 = [i4; j4*ones(n3,1)];
- i3 = [i3; [1:n3]'];
- i2 = [i2; ones(n3,1)];
- i1 = [i1; ones(n3,1)];
- else
- %-multi scan per f3 (subj) case
- %disp('NB:multi scan per f3')
- for j3 = 1:n3
- sF3P=''; if bL3, sF3P=[DsF{3},' ',int2str(j3),': ']; end
- if Dn(1)==1
- %-No f1 (repl) within f2 (cond)
- %disp('NB:no f1 within f2')
- str = [sF4P,sF3P,'select images: ',DsF{2},...
- ' 1-',int2str(n2)];
- tP = {};
- for v=1:nV
- vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end
- ttP = spm_get(n2,img_flt,{[str,vstr]});
- tP = [tP,ttP];
- end
- P = [P;tP];
- i4 = [i4; j4*ones(n2,1)];
- i3 = [i3; j3*ones(n2,1)];
- i2 = [i2; [1:n2]'];
- i1 = [i1; ones(n2,1)];
- else
- %-multi f1 (repl) within f2 (cond)
- %disp('NB:f1 within f2')
- for j2 = 1:n2
- sF2P='';
- if bL2, sF2P=[DsF{2},' ',int2str(j2),': ']; end
- str = [sF4P,sF3P,sF2P,' select images...'];
- tP = {};
- n1 = Dn(1);
- for v=1:nV
- vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end
- ttP = spm_get(n1,img_flt,{[str,vstr]});
- n1 = length(ttP);
- tP = [tP,ttP];
- end
- P = [P;tP];
- i4 = [i4; j4*ones(n1,1)];
- i3 = [i3; j3*ones(n1,1)];
- i2 = [i2; j2*ones(n1,1)];
- i1 = [i1; [1:n1]'];
- end % (for j2)
- end % (if Dn(1)==1)
- end % (for j3)
- end % (if n2==1 &...)
- end % (if DbaTime & Dn(2)>1)
-end % (for j4)
-varargout = {P,[i1,i2,i3,i4]};
-
-
-case 'desdefs_stats'
-%=======================================================================
-% - Basic Stats Design definitions...
-%=======================================================================
-% D = pr_spm_ui('DesDefs_Stats');
-% These are the basic Stats design definitions...
-
-%-Note: struct expands cell array values to give multiple records:
-% => must embed cell arrays within another cell array!
-%-Negative indices indicate defaults (first used)
-
-D = struct(...
- 'DesName','One sample t-test',...
- 'n', [Inf 1 1 1], 'sF',{{'obs','','',''}},...
- 'Hform', 'I(:,2),''-'',''mean''',...
- 'Bform', '[]',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',-Inf,'I',Inf,'X',Inf),...
- 'b',struct('aTime',0));
-
-D = [D, struct(...
- 'DesName','Two sample t-test',...
- 'n', [Inf 2 1 1], 'sF',{{'obs','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',1))];
-
-D = [D, struct(...
- 'DesName','Paired t-test',...
- 'n', [1 2 Inf 1], 'sF',{{'','cond','pair',''}},...
- 'Hform', 'I(:,2),''-'',''condition''',...
- 'Bform', 'I(:,3),''-'',''\gamma''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','One way Anova',...
- 'n', [Inf Inf 1 1], 'sF',{{'repl','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', '[]',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','One way Anova (with constant)',...
- 'n', [Inf Inf 1 1], 'sF',{{'repl','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','One way Anova (Within-subjects)',...
- 'n', [1 Inf Inf 1],'sF',{{'repl','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','Simple regression (correlation)',...
- 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,2),''-'',''\mu''',...
- 'nC',[1,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
-
-D = [D, struct(...
- 'DesName','Multiple regression',...
- 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},...
- 'Hform', '[]',...
- 'Bform', '[]',...
- 'nC',[Inf,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','Multiple regression (with constant)',...
- 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,2),''-'',''\mu''',...
- 'nC',[Inf,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','AnCova',...
- 'n', [Inf Inf 1 1], 'sF',{{'repl','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,1],'iCC',{{8,1}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
-varargout = {D};
-
-
-case 'desdefs_pet'
-%=======================================================================
-% - Standard (SPM99) PET/SPECT Design definitions...
-%=======================================================================
-% D = pr_spm_ui('DesDefs_PET');
-% These are the standard PET design definitions...
-
-%-Single subject
-%-----------------------------------------------------------------------
-D = struct(...
- 'DesName','Single-subject: conditions & covariates',...
- 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[Inf,Inf],'iCC',{{[-1,3,8],[-1,8]}},'iCFI',{{[1,3],1}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',1));
-
-D = [D, struct(...
- 'DesName','Single-subject: covariates only',...
- 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[Inf,Inf],'iCC',{{[-1,8],[-1,8]}},'iCFI',{{1,1}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',1))];
-
-%-Multi-subject
-%-----------------------------------------------------------------------
-D = [D, struct(...
- 'DesName','Multi-subj: conditions & covariates',...
- 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[Inf,Inf],'iCC',{{[1,3,4,8],[1,4,8]}},'iCFI',{{[1,3,-4],[1,-4]}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,...
- 'iGloNorm',[4,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',1))];
-
-D = [D, struct(...
- 'DesName','Multi-subj: cond x subj interaction & covariates',...
- 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},...
- 'Hform', 'I(:,[3,2]),''-'',{''subj'',''cond''}',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[Inf,Inf],'iCC',{{[1,3,4,8],[1,4,8]}},'iCFI',{{[1,3,-4],[1,-4]}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,...
- 'iGloNorm',[4,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',1))];
-
-D = [D, struct(...
- 'DesName','Multi-subj: covariates only',...
- 'n',[Inf 1 Inf 1], 'sF',{{'repl','','subject',''}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[Inf,Inf],'iCC',{{[1,4,8],[1,4,8]}},'iCFI',{{[1,-4],[1,-4]}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,...
- 'iGloNorm',[4,8:9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-%-Multi-group
-%-----------------------------------------------------------------------
-D = [D, struct(...
- 'DesName','Multi-group: conditions & covariates',...
- 'n',[Inf Inf Inf Inf], 'sF',{{'repl','condition','subject','group'}},...
- 'Hform', 'I(:,[4,2]),''-'',{''stud'',''cond''}',...
- 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',...
- 'nC',[Inf,Inf],'iCC',{{[5:8],[5,7,8]}},'iCFI',{{[1,5,6,-7],[1,5,-7]}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-7,9],'GM',50,...
- 'iGloNorm',[7,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',1))];
-
-D = [D, struct(...
- 'DesName','Multi-group: covariates only',...
- 'n',[Inf 1 Inf Inf], 'sF',{{'repl','','subject','group'}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',...
- 'nC',[Inf,Inf],'iCC',{{[5,7,8],[5,7,8]}},'iCFI',{{[1,5,-7],[1,5,-7]}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-7,9],'GM',50,...
- 'iGloNorm',[7,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-%-Population comparisons
-%-----------------------------------------------------------------------
-D = [D, struct(...
- 'DesName',...
- 'Population main effect: 2 cond''s, 1 scan/cond (paired t-test)',...
- 'n',[1 2 Inf 1], 'sF',{{'','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
- 'iGloNorm',[8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName',...
- 'Dodgy population main effect: >2 cond''s, 1 scan/cond',...
- 'n',[1 Inf Inf 1], 'sF',{{'','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
- 'iGloNorm',[8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','Compare-populations: 1 scan/subject (two sample t-test)',...
- 'n',[Inf 2 1 1], 'sF',{{'subject','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
- 'iGloNorm',[8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','Compare-populations: 1 scan/subject (AnCova)',...
- 'n',[Inf 2 1 1], 'sF',{{'subject','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,Inf],'iCC',{{8,1}},'iCFI',{{1,1}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-%-The Full Monty!
-%-----------------------------------------------------------------------
-D = [D, struct(...
- 'DesName','The Full Monty...',...
- 'n',[Inf Inf Inf Inf], 'sF',{{'repl','cond','subj','group'}},...
- 'Hform', 'I(:,[4,2]),''-'',{''stud'',''cond''}',...
- 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',...
- 'nC',[Inf,Inf],'iCC',{{[1:8],[1:8]}},'iCFI',{{[1:7],[1:7]}},...
- 'iGXcalc',[1,2,3],'iGMsca',[1:7],'GM',50,...
- 'iGloNorm',[1:9],'iGC',[1:11],...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',1))];
-
-
-varargout = {D};
-
-case 'desdefs_pet96'
-%=======================================================================
-% - SPM96 PET/SPECT Design definitions...
-%=======================================================================
-% D = pr_spm_ui('DesDefs_PET96');
-
-%-Single subject
-%-----------------------------------------------------------------------
-D = struct(...
- 'DesName','SPM96:Single-subject: replicated conditions',...
- 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0));
-
-D = [D, struct(...
- 'DesName','SPM96:Single-subject: replicated conditions & covariates',...
- 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','SPM96:Single-subject: covariates only',...
- 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-%-Multi-subject
-%-----------------------------------------------------------------------
-D = [D, struct(...
- 'DesName','SPM96:Multi-subject: different conditions',...
- 'n', [1 Inf Inf 1], 'sF',{{'','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''scancond''',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,4,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','SPM96:Multi-subject: replicated conditions',...
- 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,4,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','SPM96:Multi-subject: different conditions & covariates',...
- 'n', [1 Inf Inf 1], 'sF',{{'','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,4],[1,4]}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,4,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','SPM96:Multi-subject: replicated conditions & covariates',...
- 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''condition''',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,3,4],[1,4]}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,4,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','SPM96:Multi-subject: covariates only',...
- 'n',[Inf 1 Inf 1], 'sF',{{'repl','','subject',''}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[Inf,Inf],'iCC',{{[1,4,8],[1,4,8]}},'iCFI',{{[1,4],[1,4]}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,4,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-%-Multi-study
-%-----------------------------------------------------------------------
-D = [D, struct(...
- 'DesName','SPM96:Multi-study: different conditions',...
- 'n',[1 Inf Inf Inf], 'sF',{{'','cond','subj','study'}},...
- 'Hform', 'I(:,[4,2]),''-'',{''study'',''cond''}',...
- 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
- 'iGloNorm',[1,5,7,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','SPM96:Multi-study: replicated conditions',...
- 'n',[Inf Inf Inf Inf], 'sF',{{'repl','cond','subj','study'}},...
- 'Hform', 'I(:,[4,2]),''-'',{''study'',''condition''}',...
- 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
- 'iGloNorm',[1,5,7,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','SPM96:Multi-study: different conditions & covariates',...
- 'n',[1 Inf Inf Inf], 'sF',{{'','cond','subj','study'}},...
- 'Hform', 'I(:,[4,2]),''-'',{''study'',''cond''}',...
- 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,6,7],[1,5,7]}},...
- 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
- 'iGloNorm',[1,5,7,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','SPM96:Multi-study: replicated conditions & covariates',...
- 'n',[Inf Inf Inf Inf], 'sF',{{'','cond','subj','study'}},...
- 'Hform', 'I(:,[4,2]),''-'',{''study'',''condition''}',...
- 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,6,7],[1,5,7]}},...
- 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
- 'iGloNorm',[1,5,7,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','SPM96:Multi-study: covariates only',...
- 'n',[Inf 1 Inf Inf], 'sF',{{'repl','','subj','study'}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,7],[1,5,7]}},...
- 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
- 'iGloNorm',[1,5,7,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-%-Group comparisons
-%-----------------------------------------------------------------------
-D = [D, struct(...
- 'DesName','SPM96:Compare-groups: 1 scan per subject',...
- 'n',[Inf Inf 1 1], 'sF',{{'subject','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', '[]',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-varargout = {D};
-
-
-otherwise
-%=======================================================================
-% - U N K N O W N A C T I O N
-%=======================================================================
-warning(['Illegal Action string: ',Action])
-
-
-%=======================================================================
-% - E N D
-%=======================================================================
-end
-
-
-
-
-%=======================================================================
-%- S U B - F U N C T I O N S
-%=======================================================================
-
-function str = sf_estrrep(str,srstr)
-%=======================================================================
-for i = 1:size(srstr,1)
- str = strrep(str,srstr{i,1},srstr{i,2});
-end
diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_spm_volterra.m b/lib/marsbar-0.44/@mardo_2/private/pr_spm_volterra.m
deleted file mode 100644
index 2ed9fb5..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/pr_spm_volterra.m
+++ /dev/null
@@ -1,91 +0,0 @@
-function [X,Xname,Fc] = spm_Volterra(U,bf,V)
-% generalized convolution of inputs (U) with basis set (bf)
-% FORMAT [X,Xname,Fc] = spm_Volterra(U,bf,V);
-% U - input structure array
-% bf - Basis functions
-% V - [1 or 2] order of Volterra expansion [default = 1]
-%
-% X - Design Matrix
-% Xname - names of regressors [columns] in X
-% Fc(j).i - indices pertaining to input i (and interactions)
-% Fc(j).name - names pertaining to input i (and interactions)
-%___________________________________________________________________________
-%
-% For first order expansions spm_Volterra simply convolves the causes
-% (e.g. stick functions) in U.u by the basis functions in bf to create
-% a design matrix X. For second order expansions new entries appear
-% in ind, bf and name that correspond to the interaction among the
-% orginal causes. The basis functions for these efects are two dimensional
-% and are used to assemble the second order kernel in spm_graph.m.
-% Second order effects are computed for only the first column of U.u.
-%___________________________________________________________________________
-% @(#)spm_Volterra.m 2.3 Karl Friston 02/04/19
-
-
-% 1st order terms
-%---------------------------------------------------------------------------
-if nargin == 2, V == 1; end
-
-% Construct X
-%===========================================================================
-
-% 1st order terms
-%---------------------------------------------------------------------------
-X = [];
-Xname = {};
-ind = {};
-Uname = {};
-Fc = {};
-for i = 1:length(U)
- ind = [];
- for k = 1:size(U(i).u,2)
- for p = 1:size(bf,2)
- x = U(i).u(:,k);
- d = 1:length(x);
- x = conv(full(x),bf(:,p));
- x = x(d);
- X = [X x];
-
- % indices and regressor names
- %-----------------------------------------------------------
- str = sprintf('%s*bf(%i)',U(i).name{k},p);
- Xname{end + 1} = str;
- ind(end + 1) = size(X,2);
- end
- end
- Fc(end + 1).i = ind;
- Fc(end).name = U(i).name{1};
-end
-
-% return if first order
-%---------------------------------------------------------------------------
-if V == 1, return, end
-
-% 2nd order terms
-%---------------------------------------------------------------------------
-for i = 1:length(U)
-for j = i:length(U)
- ind = [];
- for p = 1:size(bf,2)
- for q = 1:size(bf,2)
- x = U(i).u(:,1);
- y = U(j).u(:,1);
- x = conv(full(x),bf(:,p));
- y = conv(full(y),bf(:,q));
- x = x(d);
- y = y(d);
- X = [X x.*y];
-
- % indices and regressor names
- %-----------------------------------------------------------
- str = sprintf('%s*bf(%i)x%s*bf(%i)',...
- U(i).name{1},p,...
- U(j).name{1},q);
- Xname{end + 1} = str;
- ind(end + 1) = size(X,2);
- end
- end
- Fc(end + 1).i = ind;
- Fc(end).name = [U(i).name{1} 'x' U(j).name{1}];
-end
-end
diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_stat_compute.m b/lib/marsbar-0.44/@mardo_2/private/pr_stat_compute.m
deleted file mode 100644
index dcc2247..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/pr_stat_compute.m
+++ /dev/null
@@ -1,81 +0,0 @@
-function [con,stat,Ps,Pc] = pr_stat_compute(SPM,Ic)
-% private function to compute statistics for SPM2 design
-% FORMAT [con stat Ps Pc] = pr_stat_compute(SPM,Ic)
-%
-% Input
-% SPM - SPM design structure
-% Ic - indices into contrast structure (xCon in SPM)
-%
-% Output
-% con - contrast value (ess for F test)
-% stat - statistic value
-% Ps - uncorrected p value
-% Pc - P value Bonferroni corrected for number of columns analyzed
-%
-% Based on:
-% @(#)spm_contrasts.m 2.3 Andrew Holmes, Karl Friston & Jean-Baptiste Poline 02/12/30
-%
-% $Id$
-
-%-Get contrast definitions (if available)
-%-----------------------------------------------------------------------
-try
- xCon = SPM.xCon;
-catch
- xCon = [];
-end
-
-%-set all contrasts by default
-%-----------------------------------------------------------------------
-if nargin < 2
- Ic = 1:length(xCon);
-end
-if any(Ic > length(xCon))
- error('Indices too large for contrast structure');
-end
-
-% OLS estimators and error variance estimate
-%----------------------------------------------------------------
-betas = SPM.betas;
-Hp = SPM.ResidualMS;
-
-%-Compute contrast and statistic parameters
-%=======================================================================
-df = [NaN SPM.xX.erdf];
-for i = 1:length(Ic)
-
- %-Canonicalise contrast structure with required fields
- %-------------------------------------------------------------------
- ic = Ic(i);
- X1o = spm_FcUtil('X1o',xCon(ic),SPM.xX.xKXs);
- [trMV,trMVMV] = spm_SpUtil('trMV',X1o,SPM.xX.V);
- df(1) = trMV^2/trMVMV; % eidf
-
- switch(xCon(ic).STAT)
-
- case {'T'} %-Implement contrast as sum of betas
-
- con(i,:) = xCon(ic).c'*betas;
- VcB = xCon(ic).c'*SPM.xX.Bcov*xCon(ic).c;
- stat(i,:) = con(i,:)./sqrt(Hp*VcB);
- Ps(i,:) = 1 - spm_Tcdf(stat(i,:),df(2));
-
- case 'F' %-Implement ESS
-
- %-Residual (in parameter space) forming mtx
- %-----------------------------------------------------------
- h = spm_FcUtil('Hsqr',xCon(ic),SPM.xX.xKXs);
- con(i,:) = sum((h * betas).^2, 1);
- stat(i,:) = con(i,:) ./ Hp / trMV;
- Ps(i,:) = (1 - spm_Fcdf(stat(i,:),df));
-
- otherwise
- %---------------------------------------------------------------
- error(['unknown STAT "',xCon(ic).STAT,'"'])
-
- end % (switch(xCon...)
-end
-
-% Compute corrected Bonferroni (corrected for number of regions)
-n = size(betas, 2);
-Pc = 1-(1-Ps).^n;
diff --git a/lib/marsbar-0.44/@mardo_2/private/pr_stat_compute_mv.m b/lib/marsbar-0.44/@mardo_2/private/pr_stat_compute_mv.m
deleted file mode 100644
index 8726e26..0000000
--- a/lib/marsbar-0.44/@mardo_2/private/pr_stat_compute_mv.m
+++ /dev/null
@@ -1,153 +0,0 @@
-function [MVres] = pr_stat_compute_mv(SPM,Ic)
-% private function to compute mutlivariate statistics across ROIs
-% FORMAT [MVres] = pr_stat_compute_mv(SPM,Ic)
-%
-% Input
-% SPM - SPM design structure
-% Ic - indices into contrast structure (xCon in SPM)
-%
-% Output
-% MVres - mulitvariate result structure
-%
-% $Id$
-
-%-Get contrast definitions (if available)
-%-----------------------------------------------------------------------
-try
- xCon = SPM.xCon;
-catch
- xCon = [];
-end
-
-%-set all contrasts by default
-%-----------------------------------------------------------------------
-if nargin < 2
- Ic = 1:length(xCon);
-end
-if any(Ic > length(xCon))
- error('Indices too large for contrast structure');
-end
-
-
-% Get relevant fields from design
-xCon = xCon(Ic);
-Xs = SPM.xX.xKXs;
-V = SPM.xX.V;
-betas = SPM.betas;
-ResidualMS = SPM.ResidualMS;
-Y = summary_data(SPM.marsY);
-
-% setup calculation
-[nBetas nROI] = size(betas);
-nCon = length(xCon);
-[trRV trRVRV] = spm_SpUtil('trRV',Xs,V);
-erdf = trRV^2/trRVRV;
-RMS = sqrt(ResidualMS);
-
-%--------------------------------------------------------------------
-%- Multivariate analysis
-%--------------------------------------------------------------------
-
-MVres = struct('y_pre',[], 'y_obs', [], 'Pf', [], 'u', [], 'ds', [] );
-
-if nCon == 1, return, end
-
-YpY = Y'*Y;
-
-for ii = 1:nCon
-
- xC = xCon(ii);
-
- %--------------------------------------------------------------------
- [NF, nu, h, d, M12, XG, sXG] = sf_model_mlm(Xs, V, nROI, xC, erdf);
-
- %--------------------------------------------------------------------
- %- Compute svd
- %--------------------------------------------------------------------
- %- fprintf('%-40s\n','Computing Principal Components')
-
- Z = ((NF*betas)./(ones(size(NF,1),1)*RMS));
- S = Z*Z';
- S = S/sum(nROI);
- [u s u] = svd(S,0);
- ds = diag(s);
- clear s;
-
-
- %--------------------------------------------------------------------
- %- STATISTICS if any ...
- %--------------------------------------------------------------------
- %- Fq : F values for the last q eigein values.
- %- P : P values.for the last q eigein values.
-
- Fq = zeros(1,h);
- for q = 0:h-1;
- nu1 = d*(h-q);
- nu2 = d*nu - (d-1)*(4*(h-q)+2*nu)/(h-q+2);
- Fq(q+1) = ((nu-2)/nu) * nu2/(nu2-2)*sum(ds(q+1:h))/(h-q);
- end
- Pf = 1 - spm_Fcdf(Fq,nu1,nu2);
-
-
- %- fprintf('%-40s\n','Computing predicted and observed temporal reponse')
-%keyboard
-
- y_pre = (pinv(XG)'* M12 * u)*diag(sqrt(ds)); % predicted temporal reponse
-
- gV = (diag(1./sqrt(ds))*Z)'*u;
- y_obs = (Y./(ones(size(Y,1),1)*RMS)/nROI)*gV;
-
- %- save results for this constrast
- MVres(ii).y_pre = y_pre;
- MVres(ii).y_obs = y_obs;
- MVres(ii).Pf = Pf;
- MVres(ii).u = u;
- MVres(ii).ds = ds;
- MVres(ii).df = [nu1 nu2];
-
-end
-
-
-
-
-
-
-%===================================================================
-function [NF,nu,h,d,M12,XG,sXG] = sf_model_mlm(Xs, V, nROI, xC, erdf);
-% Set sub-space of interest and the related matrix of normalisation.
-% FORMAT [NF,nu,h,d,M12,XG] = mm_model();
-%- nu, h, d : degrees of freedom
-%- NF : matrix of normalisation
-%===================================================================
-
-
-%--------------------------------------------------------------------
-%- SET, COMPUTE,NORMALIZE SPACES OF INTEREST
-%--------------------------------------------------------------------
-%- set X10 and XG
-%- XG= X -PG(X), PG projection operator on XG (cf. eq 1, 2)
-%--------------------------------------------------------------------
-sX1o = spm_sp('set',spm_FcUtil('X1o',xC,Xs));
-sXG = spm_sp('set',spm_FcUtil('X0',xC,Xs));
-X1o = spm_sp('oP',sX1o,Xs.X);
-XG = spm_sp('r',sXG,Xs.X);
-
-%- Compute Normalized effexts : M1/2=X'G*V*XG (cf eq 3)
-%--------------------------------------------------------------------
-% warning off;
-up = spm_sp('ox',sX1o); ; %- PG=up*up'
-qi = up'*Xs.X;
-sigma = up'*V*up;
-M12 = (chol(sigma)*qi)';
-M_12 = pinv(M12);
-
-%- Compute NF : normalise factor (cf eq 4)
-%--------------------------------------------------------------------
-NF = M_12*spm_sp('X',Xs)'*spm_sp('r',sXG,spm_sp('X',Xs));
-
-%- degrees of freedom
-%- nROI : number of ROI (corresponds to the number of Resels)
-%--------------------------------------------------------------------
-d = nROI*(4*log(2)/pi)^(3/2);
-h = sX1o.rk; %-rank of the sub-space of interest.
-nu = erdf;
diff --git a/lib/marsbar-0.44/@mardo_2/save_spm.m b/lib/marsbar-0.44/@mardo_2/save_spm.m
deleted file mode 100644
index d93e2fd..0000000
--- a/lib/marsbar-0.44/@mardo_2/save_spm.m
+++ /dev/null
@@ -1,42 +0,0 @@
-function tf = save_spm(D, fname);
-% method to save design as SPM format design structure
-% FORMAT tf = save_spm(D, fname);
-%
-% Inputs
-% D - design object
-% fname - filename
-%
-% Outputs
-% tf - flag ==1 if successful
-%
-% $Id$
-
-if nargin < 2
- fname = 'SPM.mat';
-end
-
-% Convert vols to native format
-D = convert_vols(D, native_vol_ver(D));
-
-SPM = des_struct(D);
-if ~mars_utils('isabspath', fname)
- Swd = mars_struct('getifthere', SPM, 'swd');
- if isempty(Swd)
- error('No path passed, and none in design');
- end
- fname = fullfile(Swd, fname);
-else
- SPM.swd = fileparts(fname);
-end
-
-
-try
- if verbose(D)
- fprintf('Saving design to file %s\n', fname);
- end
- save(fname, 'SPM');
- tf = 1;
-catch
- warning(lasterr);
- tf = 0;
-end
diff --git a/lib/marsbar-0.44/@mardo_2/savestruct.m b/lib/marsbar-0.44/@mardo_2/savestruct.m
deleted file mode 100644
index c167474..0000000
--- a/lib/marsbar-0.44/@mardo_2/savestruct.m
+++ /dev/null
@@ -1,28 +0,0 @@
-function savestruct(obj, filename)
-% saves data in def_struct into .mat file with variable name SPM
-% FORMAT savestruct(object, matname)
-%
-% $Id$
-
-if nargin ~= 2
- error('Need matfile name');
-end
-
-% allow args to be in reverse order
-if ischar(obj)
- tmp = obj;
- obj = filename;
- filename = tmp;
-end
-
-% Convert vols to native format
-obj = convert_vols(obj, native_vol_ver(obj));
-
-% unobjectify marsy object before save
-SPM = des_struct(obj);
-if isfield(SPM, 'marsY')
- SPM.marsY = y_struct(SPM.marsY);
-end
-
-save(filename,'SPM');
-return
diff --git a/lib/marsbar-0.44/@mardo_2/set_images.m b/lib/marsbar-0.44/@mardo_2/set_images.m
deleted file mode 100644
index e0e0b42..0000000
--- a/lib/marsbar-0.44/@mardo_2/set_images.m
+++ /dev/null
@@ -1,12 +0,0 @@
-function marsD = set_images(marsD, VY)
-% method to set image vols to design
-%
-% $Id%
-
-if nargin < 2
- error('Need image volumes');
-end
-D = des_struct(marsD);
-D.xY.VY = VY;
-D.xY.P = strvcat(VY(:).fname);
-marsD = des_struct(marsD, D);
diff --git a/lib/marsbar-0.44/@mardo_2/tr.m b/lib/marsbar-0.44/@mardo_2/tr.m
deleted file mode 100644
index d57c08f..0000000
--- a/lib/marsbar-0.44/@mardo_2/tr.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function t = tr(o)
-% method returns TR in seconds, or empty if not available
-%
-% $Id$
-
-t = [];
-SPM = des_struct(o);
-if mars_struct('isthere', SPM, 'xY', 'RT')
- t = SPM.xY.RT;
-end
diff --git a/lib/marsbar-0.44/@mardo_2/type.m b/lib/marsbar-0.44/@mardo_2/type.m
deleted file mode 100644
index 38dd59e..0000000
--- a/lib/marsbar-0.44/@mardo_2/type.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function str = type(o)
-% returns SPM version string corresponding to design type
-%
-% $Id$
-
-str = 'SPM2';
diff --git a/lib/marsbar-0.44/@mardo_2/ui_build.m b/lib/marsbar-0.44/@mardo_2/ui_build.m
deleted file mode 100644
index d3c8ff6..0000000
--- a/lib/marsbar-0.44/@mardo_2/ui_build.m
+++ /dev/null
@@ -1,27 +0,0 @@
-function D = ui_build(D, dtype)
-% method to create / fill design via GUI
-% FORMAT D = ui_build(D, dtype)
-%
-% D - design object
-% dtype - one of 'PET', 'FMRI', 'Basic')
-%
-% Returns
-% D - design object with new design
-%
-% $Id$
-
-if nargin < 2
- error('Need design type');
-end
-
-switch lower(dtype)
- case 'pet'
- SPM = pr_spm_ui('cfg',spm_spm_ui('DesDefs_PET'));
- case 'basic'
- SPM = pr_spm_ui('cfg',spm_spm_ui('DesDefs_Stats'));
- case 'fmri'
- SPM = pr_fmri_design;
- otherwise
- error(['Did not recognize design type: ' dtype]);
-end
-D = des_struct(D, SPM);
diff --git a/lib/marsbar-0.44/@mardo_2/ui_get_event.m b/lib/marsbar-0.44/@mardo_2/ui_get_event.m
deleted file mode 100644
index 41c344b..0000000
--- a/lib/marsbar-0.44/@mardo_2/ui_get_event.m
+++ /dev/null
@@ -1,39 +0,0 @@
-function [e_spec, e_name] = ui_get_event(D)
-% method to select an event
-% FORMAT [e_spec, e_name] = ui_get_event(D)
-% D - design
-%
-% Returns
-% e_spec - 2 by 1 matrix with
-% e_epec(1) - session number
-% e_spec(2) - event number in session
-% e_name - name of event
-%
-% $Id$
-
-if ~is_fmri(D)
- error('Need FMRI design');
-end
-SPM = des_struct(D);
-Sess = SPM.Sess;
-
-% get session
-%--------------------------------------------------------------
-s = length(Sess);
-if s > 1
- s = spm_input('which session','+1','n1',1,s);
-end
-
-u = length(Sess(s).U);
-Uname = {};
-for i = 1:u
- Uname{i} = Sess(s).Fc(i).name;
-end
-
-% get effect
-%--------------------------------------------------------------
-str = sprintf('which effect');
-u = spm_input(str,'+1','m',Uname);
-
-e_spec = [s u]';
-e_name = Uname{u};
diff --git a/lib/marsbar-0.44/@mardo_2/ui_get_filter.m b/lib/marsbar-0.44/@mardo_2/ui_get_filter.m
deleted file mode 100644
index ba1e37a..0000000
--- a/lib/marsbar-0.44/@mardo_2/ui_get_filter.m
+++ /dev/null
@@ -1,23 +0,0 @@
-function [D,descrip] = ui_get_filter(D)
-% method to get filter via GUI
-% FORMAT [D,descrip] = ui_get_filter(D)
-%
-% Input
-% D - design
-%
-% Returns
-% D - design with modified filter
-% descrip - cell array of strings describing filter
-%
-% $Id$
-
-SPM = des_struct(D);
-[SPM.xX.K str] = pr_get_filter(SPM.xY.RT, SPM.Sess);
-if ~isfield(SPM, 'xsDes')
- SPM.xsDes = [];
-end
-SPM.xsDes.High_pass_Filter = str;
-
-% return args
-D = des_struct(D, SPM);
-descrip = {str};
diff --git a/lib/marsbar-0.44/@mardo_2/ui_report.m b/lib/marsbar-0.44/@mardo_2/ui_report.m
deleted file mode 100644
index 5a7b6f2..0000000
--- a/lib/marsbar-0.44/@mardo_2/ui_report.m
+++ /dev/null
@@ -1,960 +0,0 @@
-function varargout = ui_report(D, varargin)
-% method for SPM2 design reporting
-%
-% Copied with minor edits from:
-% @(#)spm_DesRep.m 2.31 Andrew Holmes 03/03/28
-%
-% See that file for detailed commentary
-%
-% $Id$
-
-%-Format arguments
-%-----------------------------------------------------------------------
-if nargin < 2
- action = 'desrepui';
-else
- action = varargin{1};
-end
-
-%-Generic CallBack code
-%-----------------------------------------------------------------------
-cb = 'tmp = get(findobj(''Tag'', ''DesRepUI''),''UserData''); ';
-
-% simplify access to design
-SPM = des_struct(D);
-
-% Add empty fields where necessary
-try
- SPM.xC;
-catch
- SPM.xC = {};
-end
-try
- SPM.xsDes;
-catch
- SPM.xsDes = [];
-end
-
-switch lower(action)
-
-%=======================================================================
-case 'desrepui' %-Design reporting UI
-%=======================================================================
-% h = ui_report(D, 'DesRepUI')
-% h = ui_report(D, 'DesRepUI',SPM)
-
-%-Add a scaled design matrix to the design data structure
-%-----------------------------------------------------------------------
-if ~isfield(SPM.xX,'nKX')
- SPM.xX.nKX = spm_DesMtx('Sca',SPM.xX.X,SPM.xX.name);
-end
-
-% put back into design object
-D = des_struct(D, SPM);
-
-%-Draw menu
-%=======================================================================
-
-%-Get Interactive window and delete any previous DesRepUI menu
-%-----------------------------------------------------------------------
-Finter = spm_figure('GetWin','Interactive');
-delete(findobj(get(Finter,'Children'),'flat','Tag','DesRepUI'))
-
-%-Draw top level menu
-%-----------------------------------------------------------------------
-hC = uimenu(Finter,'Label','Design',...
- 'Separator','on',...
- 'Tag','DesRepUI',...
- 'UserData',D,...
- 'HandleVisibility','on');
-
-%-DesMtx
-%-----------------------------------------------------------------------
-hDesMtx = uimenu(hC,'Label','Design Matrix','Accelerator','D',...
- 'CallBack',[cb,...
- 'ui_report(tmp, ''DesMtx'')'],...
- 'UserData',hC,...
- 'HandleVisibility','off');
-
-%-Design matrix orthogonality
-%-----------------------------------------------------------------------
-h = uimenu(hC,'Label','Design orthogonality','Accelerator','O',...
- 'CallBack',[cb,...
- 'ui_report(tmp, ''DesOrth'')'],...
- 'UserData',hC,...
- 'HandleVisibility','off');
-
-%-Explore design
-%-----------------------------------------------------------------------
-hExplore = uimenu(hC,'Label','Explore','HandleVisibility','off');
-
-switch modality(D)
-case 'pet'
- hFnF = uimenu(hExplore,'Label','Files and factors','Accelerator','F',...
- 'CallBack',[cb,...
- 'ui_report(tmp, ''Files&Factors'')'],...
- 'UserData',hC,...
- 'HandleVisibility','off');
- hCovs = uimenu(hExplore,'Label','Covariates','Accelerator','C',...
- 'CallBack',[cb,...
- 'ui_report(tmp, ''Covs'')'],...
- 'UserData',hC,...
- 'HandleVisibility','off');
- if isempty(SPM.xC), set(hCovs,'Enable','off'), end
-case 'fmri'
- for j = 1:length(SPM.Sess)
- h = uimenu(hExplore,'Label',sprintf('Session %.0f ',j),...
- 'HandleVisibility','off');
- for k = 1:length(SPM.Sess(j).Fc)
- uimenu(h,'Label',SPM.Sess(j).Fc(k).name,...
- 'CallBack',[cb,...
- sprintf('ui_report_fmri(tmp,%d,%d);',j,k)],...
- 'UserData',hC,...
- 'HandleVisibility','off')
- end
- end
-end
-
-
-%-Clear, Quit, Help
-%-----------------------------------------------------------------------
-uimenu(hC,'Label','Clear','Accelerator','L','Separator','on',...
- 'CallBack','spm_results_ui(''Clear'')',...
- 'HandleVisibility','off');
-uimenu(hC,'Label','Help','Separator','on',...
- 'CallBack','spm_help(''spm_DesRep'')',...
- 'HandleVisibility','off');
-
-%-Pop open 'Interactive' window
-%-----------------------------------------------------------------------
-figure(Finter)
-
-%-Return handle of menu
-%-----------------------------------------------------------------------
-varargout = {hC};
-
-
-%=======================================================================
-case 'files&factors' %-Summarise files & factors
-%=======================================================================
-% ui_report(D, 'Files&Factors',fnames,I,xC,sF,xs)
-fnames = image_names(D);
-if isempty(fnames)
- fnames = cell(size(SPM.xX.X, 1), 1);
-end
-
-I = SPM.xX.I;
-xC = SPM.xC;
-sF = SPM.xX.sF;
-xs = SPM.xsDes; %-Structure of description strings
-
-[fnames,CPath] = spm_str_manip(fnames,'c'); %-extract common path component
-nScan = size(I,1); %-#images
-bL = any(diff(I,1),1); %-Multiple factor levels?
-
-%-Get graphics window & window scaling
-Fgraph = spm_figure('GetWin','Graphics');
-spm_results_ui('Clear',Fgraph,0)
-FS = spm('FontSizes');
-
-%-Display header information
-%-----------------------------------------------------------------------
-hTax = axes('Position',[0.03,0.85,0.94,0.1],...
- 'DefaultTextFontSize',FS(9),...
- 'XLim',[0,1],'YLim',[0,1],...
- 'Visible','off');
-
-text(0.5,1,'Statistical analysis: Image files & covariates...',...
- 'Fontsize',FS(14),'Fontweight','Bold',...
- 'HorizontalAlignment','center')
-
-dx1 = 0.05;
-dx2 = 0.08;
-
-x = 0; text(x+.02,.1,'image #','Rotation',90)
-if bL(4), x=x+dx1; text(x+.01,.1,sF{4},'Rotation',90), end
-if bL(3), x=x+dx1; text(x+.01,.1,sF{3},'Rotation',90), end
-if bL(2), x=x+dx1; text(x+.01,.1,sF{2},'Rotation',90), end
-if bL(1), x=x+dx1; text(x+.01,.1,sF{1},'Rotation',90), end
-
-for j = 1:length(xC)
- n = size(xC(j).rc,2);
- if n>1, tmp=xC(j).cname; else, tmp={xC(j).rcname}; end
- for k=1:n
- x=x+dx2;
- text(x,.1,tmp{k},'Rotation',90,'Interpreter','TeX')
- end
-end
-
-x=x+dx2;
-text(x,0.65,'Base directory:','FontWeight','Bold')
-text(x,0.5,CPath,'FontSize',FS(8))
-text(x,0.2,'filename tails...')
-
-line('XData',[0 1],'YData',[0 0],'LineWidth',3,'Color','r')
-
-%-Tabulate file & covariate information
-%-----------------------------------------------------------------------
-hAx = axes('Position',[0.03,0.05,0.94,0.8],...
- 'DefaultTextFontSize',FS(8),...
- 'Units','points',...
- 'Visible','off');
-AxPos = get(hAx,'Position'); set(hAx,'YLim',[0,AxPos(4)])
-
-dy = FS(9); y0 = floor(AxPos(4)) -dy; y = y0;
-
-for i = 1:nScan
-
- %-Scan indices
- x = 0; text(x,y,sprintf('%03d',i))
- if bL(4), x=x+dx1; text(x,y,sprintf('%02d',I(i,4))), end
- if bL(3), x=x+dx1; text(x,y,sprintf('%02d',I(i,3))), end
- if bL(2), x=x+dx1; text(x,y,sprintf('%02d',I(i,2))), end
- if bL(1), x=x+dx1; text(x,y,sprintf('%02d',I(i,1))), end
-
- %-Covariates
- for j = 1:length(xC)
- for k=1:size(xC(j).rc,2)
- x=x+dx2;
- text(x,y,sprintf('%6g',xC(j).rc(i,k)),...
- 'HorizontalAlignment','Center')
- end
- end
-
- %-Filename tail(s) - could be multivariate
- x=x+dx2;
- text(x,y,fnames{i})
- y=y-dy;
-
- %-Paginate if necessary
- if y1
- text(0.5,0,sprintf('Page %d/%d',spm_figure('#page')*[1,1]),...
- 'FontSize',FS(8),'FontAngle','italic')
- spm_figure('NewPage',[hAx;get(hAx,'Children')])
-end
-
-%-Pop up the Graphics window
-%-----------------------------------------------------------------------
-figure(Fgraph)
-
-
-
-%=======================================================================
-case {'desmtx','desorth'} %-Display design matrix / design orthogonality
-%=======================================================================
-% ui_report(D, 'DesMtx',xX,fnames,xs)
-% ui_report(D, 'DesOrth',xX)
-
-xX = SPM.xX;
-fnames = image_names(D);
-xs = SPM.xsDes; %-Structure of description strings
-
-desmtx = strcmp(lower(varargin{1}),'desmtx');
-
-
-%-Locate DesMtx (X), scaled DesMtx (nX) & get parameter names (Xnames)
-%-----------------------------------------------------------------------
-if isfield(xX,'xKXs') & ...
- ~isempty(xX.xKXs) & isstruct(xX.xKXs)
- iX = 1;
- [nScan,nPar] = size(xX.xKXs.X);
-elseif isfield(xX,'X') & ~isempty(xX.X)
- iX = 0;
- [nScan,nPar] = size(xX.X);
-else
- error('Can''t find DesMtx in this structure!')
-end
-
-if isfield(xX,'nKX') & ~isempty(xX.nKX)
- inX = 1; else, inX = 0; end
-
-if isfield(xX,'name') & ~isempty(xX.name)
- Xnames = xX.name; else, Xnames = {}; end
-
-
-%-Compute design orthogonality matrix if DesOrth
-%-----------------------------------------------------------------------
-if ~desmtx
- if iX
- tmp = sqrt(sum(xX.xKXs.X.^2));
- O = xX.xKXs.X'*xX.xKXs.X./kron(tmp',tmp);
- tmp = sum(xX.xKXs.X);
- else
- tmp = sqrt(sum(xX.X.^2));
- O = xX.X'*xX.X./kron(tmp',tmp);
- tmp = sum(xX.X);
- end
- tmp = abs(tmp)1
- ColorOrder = get(hAx,'ColorOrder');
- text(0.3,y,'Key :',...
- 'HorizontalAlignment','Right',...
- 'FontWeight','Bold','FontSize',FS(9))
- for j = 1:size(xC(i).rc,2)
- color = ColorOrder(mod(j-1,size(ColorOrder,1))+1,:);
- if size(xC(i).rc,2)==length(xC(i).cname)
- str = xC(i).cname{j};
- else
- str = sprintf('column %d',j);
- end
- text(0.31,y,str,'FontSize',FS(9),...
- 'Color',color)
- text(0.5,xC(i).rc(1,j),[str,' \rightarrow'],...
- 'Parent',hAx,...
- 'FontSize',FS(8),'FontWeight','Bold',...
- 'HorizontalAlignment','Right',...
- 'Interpreter','TeX',...
- 'Color',color)
- y=y-dy;
- end
- y=y-dy;
- end
-
-
- %-Associated parameters
- %---------------------------------------------------------------
- text(0.3,y,'Design matrix columns :',...
- 'HorizontalAlignment','Right',...
- 'FontWeight','Bold','FontSize',FS(9))
- if isempty(xC(i).cols)
- text(0.31,y,'(none)','FontSize',FS(9))
- else
- for j = xC(i).cols
- text(0.31,y,sprintf('%d : %s',j,Xnames{j}),...
- 'FontSize',FS(9),'Interpreter','TeX')
- y=y-dy;
- end
- end
- y=y-dy;
-
-
- %-Highlight parameter names
- %---------------------------------------------------------------
- hCurPNames = hPNames(xC(i).cols);
- set(hCurPNames,'Color','r','FontWeight','Bold','FontSize',FS(8))
-
-
- %-Paginate (if more than one covariate)
- %---------------------------------------------------------------
- if length(xC)>1
- spm_figure('NewPage',[hSTitle; hAx; get(hAx,'Children');...
- hCurPNames; hDAx; get(hDAx,'Children')]);
- end
-
-end
-
-%-Pop up the Graphics window
-%-----------------------------------------------------------------------
-figure(Fgraph)
-
-
-%=======================================================================
-case 'scantick'
-%=======================================================================
-% ui_report(D, 'ScanTick',nScan,lim)
-% ( Show at most 32, showing every 2nd/3rd/4th/... as necessary to pair )
-% ( down to <32 items. Always show last item so #images is indicated. )
-if nargin<3, lim=32; else, lim=varargin{3}; end
-if nargin<2, error('insufficient arguments'), end
-nScan = varargin{2};
-
-p = max(1,ceil(nScan/lim));
-s = 1:p:nScan; s(end)=nScan;
-
-varargout = {s,lim};
-
-
-%=======================================================================
-case {'surfdesmtx_cb','surfdesmtxmo_cb','surfdesmtxup_cb'} %-Surf DesMtx
-%=======================================================================
-% ui_report(D, 'SurfDesMtx_CB')
-% ui_report(D, 'SurfDesMtxMo_CB')
-% ui_report(D, 'SurfDesMtxUp_CB')
-
-h = get(gca,'Xlabel');
-
-if strcmp(lower(varargin{1}),'surfdesmtxup_cb')
- UD = get(h,'UserData');
- set(h,'String',UD.String,'Interpreter',UD.Interpreter,...
- 'UserData',UD.UserData)
- set(gcbf,'WindowButtonMotionFcn','','WindowButtonUpFcn','')
- return
-end
-
-
-if strcmp(lower(varargin{1}),'surfdesmtx_cb')
- UD = struct( 'String', get(h,'String'),...
- 'Interpreter', get(h,'Interpreter'),...
- 'UserData', get(h,'UserData'));
- set(h,'UserData',UD)
- set(gcbf,'WindowButtonMotionFcn',[cb 'ui_report(tmp, ''SurfDesMtxMo_CB'')'],...
- 'WindowButtonUpFcn', [cb 'ui_report(tmp, ''SurfDesMtxUp_CB'')'])
-end
-
-mm = [get(gca,'YLim')',get(gca,'XLim')']+[.5,.5;-.5,-.5];
-ij = get(gca,'CurrentPoint');
-ij = round(min(max(ij(1,[2,1]),mm(1,:)),mm(2,:)));
-
-istr = 'none';
-switch get(gcbf,'SelectionType')
-case 'normal'
- try, str = sprintf('X(%d,%d) = %g',ij(1),ij(2),...
- subsref(get(gco,'UserData'),...
- struct('type',{'.','()'},'subs',{'X',{ij(1),ij(2)}})));
- catch, str='(no cached design matrix to surf)'; end
-case 'extend'
- try, str = sprintf('Image %d: %s',ij(1),...
- spm_str_manip(...
- subsref(get(gco,'UserData'),...
- struct('type',{'.','()'},...
- 'subs',{'fnames',{ij(1),':'}})),'Ca40'));
- catch, str='(no cached image filenames to surf)'; end
-case 'alt'
- try, str = sprintf('Parameter %d: %s',ij(2),...
- subsref(get(gco,'UserData'),...
- struct('type',{'.','{}'},'subs',{'Xnames',{ij(2)}})));
- istr = 'tex';
- catch, str='(no cached parameter names to surf)'; end
-case 'open'
- try, assignin('base','ans',subsref(get(gco,'UserData'),...
- struct('type',{'.'},'subs',{'X'})))
- evalin('base','ans')
- catch, fprintf('%s GUI: can''t find design matrix\n',mfilename)
- end
- return
-end
-
-set(h,'String',str,'Interpreter',istr)
-
-
-%=======================================================================
-case {'surfestim_cb','surfestimmo_cb','surfestimup_cb'} %-Surf ParEstIm
-%=======================================================================
-% ui_report(D, 'SurfEstIm_CB')
-% ui_report(D, 'SurfEstImMo_CB')
-% ui_report(D, 'SurfEstImUp_CB')
-
-h = get(gca,'Xlabel');
-
-if strcmp(lower(varargin{1}),'surfestimup_cb')
- UD = get(h,'UserData');
- set(h,'String',UD.String,'Interpreter',UD.Interpreter,...
- 'UserData',UD.UserData)
- set(gcbf,'WindowButtonMotionFcn','','WindowButtonUpFcn','')
- return
-end
-
-if strcmp(lower(varargin{1}),'surfestim_cb')
- UD = struct( 'String', get(h,'String'),...
- 'Interpreter', get(h,'Interpreter'),...
- 'UserData', get(h,'UserData'));
- set(h,'UserData',UD)
- set(gcbf,'WindowButtonMotionFcn',[cb 'ui_report(tmp, ''SurfEstImMo_CB'')'],...
- 'WindowButtonUpFcn', [cb 'ui_report(tmp, ''SurfEstImUp_CB'')'])
-end
-
-mm = [get(gca,'XLim')]+[.5,-.5];
-i = get(gca,'CurrentPoint');
-i = round(min(max(i(1,1),mm(1)),mm(2)));
-
-istr = 'none';
-switch get(gcbf,'SelectionType')
-case 'normal'
- try, tmp = {' (not unique)',' (unique)'};
- str = sprintf('Parameter %d : %s%s',...
- i,...
- subsref(get(gco,'UserData'),...
- struct('type',{'.','{}'},'subs',{'Xnames',{i}})),...
- tmp{subsref(get(gco,'UserData'),...
- struct('type',{'.','()'},'subs',{'est',{i}}))+1});
- istr = 'tex';
- catch, str='(no cached data to surf)'; end
-case {'extend','alt'}
- return
-case 'open'
- try, UD = get(gco,'UserData');
- assignin('base','ans',...
- subsref(get(gco,'UserData'),...
- struct('type',{'.'},'subs',{'est'})))
- evalin('base','ans')
- catch, fprintf('%s GUI: can''t find design orthogonality\n',mfilename)
- end
- return
-end
-
-set(h,'String',str,'Interpreter',istr)
-
-
-
-%=======================================================================
-case {'surfdeso_cb','surfdesomo_cb','surfdesoup_cb'} %-Surf DesOrthIm
-%=======================================================================
-% ui_report(D, 'SurfDesO_CB')
-% ui_report(D, 'SurfDesOMo_CB')
-% ui_report(D, 'SurfDesOUp_CB')
-
-h = get(gca,'Xlabel');
-
-if strcmp(lower(varargin{1}),'surfdesoup_cb')
- UD = get(h,'UserData');
- set(h,'String',UD.String,'Interpreter',UD.Interpreter,...
- 'UserData',UD.UserData)
- set(gcbf,'WindowButtonMotionFcn','','WindowButtonUpFcn','')
- return
-end
-
-if strcmp(lower(varargin{1}),'surfdeso_cb')
- UD = struct( 'String', get(h,'String'),...
- 'Interpreter', get(h,'Interpreter'),...
- 'UserData', get(h,'UserData'));
- set(h,'UserData',UD)
- set(gcbf,'WindowButtonMotionFcn',[cb 'ui_report(tmp, ''SurfDesOMo_CB'')'],...
- 'WindowButtonUpFcn', [cb 'ui_report(tmp, ''SurfDesOUp_CB'')'])
-end
-
-mm = [get(gca,'YLim')',get(gca,'XLim')']+[.5,.5;-.5,-.5];
-ij = get(gca,'CurrentPoint');
-ij = round(min(max(ij(1,[2,1]),mm(1,:)),mm(2,:)));
-if ij(1)>ij(2), return, end
-
-istr = 'none';
-switch get(gcbf,'SelectionType')
-case 'normal'
- try
- UD = get(gco,'UserData');
- if abs(abs(UD.O(ij(1),ij(2)))-1) < eps*1e1
- str = '{\bf colinear}';
- elseif abs(UD.O(ij(1),ij(2))) < eps*1e1
- str = '{\bf orthogonal}';
- else
- str = '{\bf not orthogonal}';
- end
- if ~diff(ij), str=[str,' {\it(same column)}']; end
- if UD.bC(ij(1),ij(2)), tmp=' ={\it r}'; else, tmp=''; end
- str = { sprintf('{\\bf %s} (col %d) & {\\bf %s} (col %d)',...
- UD.Xnames{ij(1)},ij(1),...
- UD.Xnames{ij(2)},ij(2)),...
- sprintf('cos(\\theta)%s = %1.2f',...
- tmp,UD.O(ij(1),ij(2))),...
- ['\rightarrow ',str]};
- istr = 'tex';
- catch, str='(no cached data to surf)'; end
-case {'extend','alt'}
- return
-case 'open'
- try, UD = get(gco,'UserData');
- assignin('base','ans',UD.O)
- evalin('base','ans')
- catch, fprintf('%s GUI: can''t find design orthogonality\n',mfilename)
- end
- return
-end
-
-set(h,'String',str,'Interpreter',istr)
-
-
-%=======================================================================
-case {'surfcon_cb','surfconmo_cb','surfconup_cb'} %-Surf Contrast
-%=======================================================================
-% ui_report(D, 'SurfCon_CB')
-% ui_report(D, 'SurfConOMo_CB')
-% ui_report(D, 'SurfConOUp_CB')
-
-cUD = get(gco,'UserData');
-if ~isstruct(cUD) | ~isfield(cUD,'h')
- warning('contrast GUI objects setup incorrectly'), return
-end
-h = cUD.h;
-
-if strcmp(lower(varargin{1}),'surfconup_cb')
- UD = get(h,'UserData');
- set(h,'String',UD.String,'Interpreter',UD.Interpreter,...
- 'UserData',UD.UserData)
- set(gcbf,'WindowButtonMotionFcn','','WindowButtonUpFcn','')
- return
-end
-
-if strcmp(lower(varargin{1}),'surfcon_cb')
- UD = struct( 'String', get(h,'String'),...
- 'Interpreter', get(h,'Interpreter'),...
- 'UserData', get(h,'UserData'));
- set(h,'UserData',UD)
- set(gcbf,'WindowButtonMotionFcn',[cb 'ui_report(tmp, ''SurfConMo_CB'')'],...
- 'WindowButtonUpFcn', [cb 'ui_report(tmp, ''SurfConUp_CB'')'])
-end
-
-mm = [get(gca,'YLim')',get(gca,'XLim')']+[.5,.5;-.5,-.5];
-ij = get(gca,'CurrentPoint');
-ij = round(min(max(ij(1,[2,1]),mm(1,:)),mm(2,:)));
-
-istr = 'none';
-switch get(gcbf,'SelectionType')
-case 'normal'
- try
- if cUD.i>0, str = sprintf('%d',cUD.i); else, str = ''; end
- switch get(gco,'Type')
- case 'image'
- str = sprintf('%s\\{F\\}: {\\bf%s} (%d,%d) = %.2f',...
- str,cUD.xCon.name,ij(2),ij(1),...
- cUD.xCon.c(ij(2),ij(1)));
- case 'patch'
- str = sprintf('%s\\{T\\}: {\\bf%s} (%d) = %.2f',...
- str,cUD.xCon.name,ij(2),...
- cUD.xCon.c(ij(2)));
- otherwise, error('unexpected object type')
- end
- istr = 'TeX';
- catch, str='(no cached data to surf)'; end
-case {'alt','extend'}
- return
-case 'open'
- try, assignin('base','ans',cUD.xCon.c')
- evalin('base','ans')
- catch, fprintf('%s GUI: can''t find contrast\n',mfilename)
- end
- return
-end
-
-set(h,'String',str,'Interpreter',istr)
-
-
-%=======================================================================
-otherwise %-Unknown action string
-%=======================================================================
-error(['Unknown action string: ',varargin{1}])
-
-
-
-%=======================================================================
-end
diff --git a/lib/marsbar-0.44/@mardo_2/ui_report_fmri.m b/lib/marsbar-0.44/@mardo_2/ui_report_fmri.m
deleted file mode 100644
index c0148a7..0000000
--- a/lib/marsbar-0.44/@mardo_2/ui_report_fmri.m
+++ /dev/null
@@ -1,135 +0,0 @@
-function ui_report_fmri(D,s,i)
-% Interactive review of fMRI design matrix
-% FORMAT ui_report_fmri(D,s,i)
-%
-% Copied with minor edits from:
-% @(#)spm_fMRI_design_show.m 2.22 Karl Friston 03/02/21
-%
-% $Id$
-
-SPM = des_struct(D);
-Sess = SPM.Sess;
-
-% Do not proceed unless there are trials specified
-%-----------------------------------------------------------------------
-for j = 1:length(Sess)
- if ~length(Sess(j).U)
- spm('alert*','User-specifed regressors only!',mfilename,sqrt(-1));
- return
- end
-end
-
-%-Defaults: Setup GUI if not called by spm_DesRep (with s and i)
-%-----------------------------------------------------------------------
-if nargin < 3
- s = 1;
- i = 1;
-
- %-Get Interactive window and delete any previous DesRepUI menu
- %---------------------------------------------------------------
- Finter = spm_figure('GetWin','Interactive');
- delete(findobj(get(Finter,'Children'),'flat','Tag','DesRepUI'))
-
- %-Create menu
- %---------------------------------------------------------------
- hC = uimenu(Finter,'Label','Explore fMRI design',...
- 'Separator','on',...
- 'Tag','DesRepUI',...
- 'UserData',D,...
- 'HandleVisibility','on');
- for j = 1:length(Sess)
- h = uimenu(hC,'Label',sprintf('Session %.0f ',j),...
- 'HandleVisibility','off');
- for k = 1:length(Sess(j).Fc)
- cb = ['tmp = get(get(gcbo,''UserData''),',...
- '''UserData''); ',...
- sprintf(['ui_report_fmri(',...
- 'tmp,%d,%d);'],j,k)];
- uimenu(h,'Label',Sess(j).Fc(k).name,...
- 'CallBack',cb,...
- 'UserData',hC,...
- 'HandleVisibility','off')
- end
- end
-end
-
-
-%-Graphics...
-%=======================================================================
-
-%-Get Graphics window
-%-----------------------------------------------------------------------
-Fgraph = spm_figure('GetWin','Graphics');
-spm_results_ui('Clear',Fgraph,0)
-
-
-% Trial-specific regressors - time domain
-%-----------------------------------------------------------------------
-sX = SPM.xX.X(Sess(s).row,Sess(s).col);
-rX = sX(:,Sess(s).Fc(i).i);
-subplot(2,2,1)
-plot(Sess(s).row,rX)
-xlabel('scan')
-ylabel('regressor[s]')
-title({'Time domain',['regressors for ' Sess(s).Fc(i).name]})
-grid on
-axis tight
-
-% Trial-specific regressors - frequency domain
-%-----------------------------------------------------------------------
-subplot(2,2,2)
-gX = abs(fft(rX)).^2;
-gX = gX*diag(1./sum(gX));
-q = size(gX,1);
-Hz = [0:(q - 1)]/(q*SPM.xY.RT);
-q = 2:fix(q/2);
-plot(Hz(q),gX(q,:))
-patch([0 1 1 0]/128,[0 0 1 1]*max(max(gX)),[1 1 1]*.9)
-xlabel('Frequency (Hz)')
-ylabel('relative spectral density')
-title({'Frequency domain','128 second High-pass filter'})
-grid on
-axis tight
-
-
-% if trial (as opposed to trial x trial interaction)
-%-----------------------------------------------------------------------
-if length(Sess(s).U) >= i
-
- % Basis set and peristimulus sampling
- %---------------------------------------------------------------
- subplot(2,2,3)
- dt = Sess(s).U(i).dt;
- RT = SPM.xY.RT;
- t = [1:size(SPM.xBF.bf,1)]*dt;
- pst = Sess(s).U(i).pst;
- plot(t,SPM.xBF.bf,pst,0*pst,'.','MarkerSize',16)
- str = sprintf('TR = %0.2fsecs',RT);
- xlabel({'time (secs)' str sprintf('%0.0fms time bins',1000*dt)})
- title({'Basis set and peristimulus sampling' SPM.xBF.name})
- axis tight
- grid on
-
- % if a paramteric variate is specified
- %---------------------------------------------------------------
- for p = 1:length(Sess(s).U(i).P)
-
- if Sess(s).U(i).P(p).h
-
- % onsets and parametric modulation
- %-------------------------------------------------------
- subplot(2,2,4)
- ons = Sess(s).U(i).ons;
- plot(ons,Sess(s).U(i).P(p).P,'.','MarkerSize',8)
- xlabel('time {secs}')
- title('parameters')
- grid on
- hold on
-
- end
- end
-end
-
-%-Pop up Graphics figure window
-%-----------------------------------------------------------------------
-figure(Fgraph);
diff --git a/lib/marsbar-0.44/@mardo_5/autocorr.m b/lib/marsbar-0.44/@mardo_5/autocorr.m
deleted file mode 100644
index 2f73c16..0000000
--- a/lib/marsbar-0.44/@mardo_5/autocorr.m
+++ /dev/null
@@ -1,98 +0,0 @@
-function D = autocorr(D, autocorr_type, varargin)
-% method to set autocorrelation types for design
-% FORMAT D = autocorr(D, autocorr_type, varargin)
-%
-% D - design object
-% autocorr_type - autocorrelation type specification, one of
-% 'SPM'
-% 'fmristat'
-% 'none'
-% varargin - parameters defining autocorrelation model.
-% If autocorr type is 'SPM':
-% varargin{1} should be vector with estimated AR
-% coefficients (default is [0.2])
-% varargin{2} is optional, and is flag; non-zero value
-% specifies voxel-wise covariance estimates (default 1)
-% If autocorr type is 'fmristat'
-% varargin{1} is scalar value for order of fmristat
-% model (default is 1);
-%
-% $Id: autocorr.m 539 2004-12-02 18:46:37Z matthewbrett $
-
-if nargin < 2
- error('Need autocorr type');
-end
-
-if ~is_fmri(D)
- warning('Can only set autocorrelation for FMRI design types');
- return
-end
-
-% Get design, put into some useful variables
-v_f = verbose(D);
-SPM = des_struct(D);
-nscan = SPM.nscan;
-
-SPM.xVi.cov_calc = 'summary';
-
-switch lower(autocorr_type)
- case 'fmristat'
- % Fit fmristat model AR(n)
- if nargin < 3, varargin{1} = 1; end
- cVi = varargin{1};
- if prod(size(cVi)) > 1
- error('Expecting scalar for fmristat order');
- end
- SPM.xVi.Vi = struct('type', 'fmristat', 'order', cVi);
- cVi = sprintf('fmristat AR(%d)',cVi);
- f2cl = 'V'; % Field to CLear
-
- case 'spm'
- % SPM AR coefficient(s) to be specified
- if nargin < 3, varargin{1} = 0.2; end
- if nargin < 4, varargin{2} = 1; end
- cVi = varargin{1};
- if any(cVi > 1 | cVi < 0)
- error('Rho estimates should be > 0 and < 1');
- end
- SPM.xVi.Vi = pr_spm_ce(nscan, cVi);
- cVi = sprintf('AR(%0.1f)',cVi(1));
- f2cl = 'V';
- if varargin{2}
- SPM.xVi.cov_calc = 'vox';
- end
-
- case 'none'
- % xVi.V is i.i.d
- %---------------------------------------------------------------
- SPM.xVi.V = speye(sum(nscan));
- cVi = 'i.i.d';
- f2cl = 'Vi';
-
- otherwise
- error(['Eccentric autocorr type ' autocorr_type]);
-end
-
-% If we've set V, need to clear Vi, because the
-% estimate method takes the presence of Vi to mean that
-% V can be cleared, with 'redo_covar' flag
-% Conversely V needs to be cleared if Vi was estimated
-if isfield(SPM.xVi, f2cl)
- SPM.xVi = rmfield(SPM.xVi, f2cl);
- if v_f, fprintf('Clearing previous %s matrix\n', f2cl); end
-end
-
-% Also: remove previous W matrices
-% Either will need to be recalculated or won't be used
-if isfield(SPM.xX, 'W')
- SPM.xX = rmfield(SPM.xX, 'W');
- if v_f, fprintf('Clearing previous W matrix\n'); end
-end
-
-% fill into design
-SPM.xVi.form = cVi;
-xsDes = struct('Serial_correlations', SPM.xVi.form);
-SPM.xsDes = mars_struct('ffillmerge', SPM.xsDes, xsDes);
-
-% put stuff into object
-D = des_struct(D,SPM);
diff --git a/lib/marsbar-0.44/@mardo_5/convert_vols.m b/lib/marsbar-0.44/@mardo_5/convert_vols.m
deleted file mode 100644
index f3b26fe..0000000
--- a/lib/marsbar-0.44/@mardo_5/convert_vols.m
+++ /dev/null
@@ -1,51 +0,0 @@
-function o = convert_vols(o, ver)
-% method that converts vol structs in design and converts to format 'ver'
-% FORMAT o = convert_fo(o, ver)
-%
-% Input
-% o - design object
-% ver - optional version for vols from '99' or '5'
-% Defaults to version for current SPM version
-%
-% Output
-% o - object with converted vols
-%
-% Example
-% % Convert vols to current format
-% o = convert_vols(o);
-%
-% % Convert to native format for SPM99 designs
-% o = convert_vols(o, native_vol_ver(o));
-%
-% $Id$
-
-if nargin < 2
- ver = mars_vol_utils('current_ver');
-end
-
-SPM = des_struct(o);
-SPM = sf_conv(SPM, ver, 'xY', 'VY');
-SPM = sf_conv(SPM, ver, 'xM', 'VM');
-SPM = sf_conv(SPM, ver, 'xVol', 'VRpv');
-SPM = sf_conv(SPM, ver, 'Vbeta');
-SPM = sf_conv(SPM, ver, 'VResMS');
-SPM = sf_conv(SPM, ver, 'VM');
-o = des_struct(o, SPM);
-
-xCon = get_contrasts(o);
-if ~isempty(xCon)
- for i = 1:length(xCon)
- xCon(i) = sf_conv(xCon(i), ver, 'Vcon');
- xCon(i) = sf_conv(xCon(i), ver, 'Vspm');
- end
-end
-o = set_contrasts(o, xCon, 0);
-return
-
-function S = sf_conv(S, ver, varargin)
-V = mars_struct('getifthere', S, varargin{:});
-if ~isempty(V)
- V = mars_vol_utils('convert', V, ver);
- S = setfield(S, varargin{:}, V);
-end
-return
diff --git a/lib/marsbar-0.44/@mardo_5/estimate.m b/lib/marsbar-0.44/@mardo_5/estimate.m
deleted file mode 100644
index d6e6f85..0000000
--- a/lib/marsbar-0.44/@mardo_5/estimate.m
+++ /dev/null
@@ -1,103 +0,0 @@
-function [marsD] = estimate(marsD, marsY, params)
-% estimate method - estimates GLM for SPM2 model
-%
-% marsD - SPM design object
-% marsY - MarsBaR data object or 2D data matrix
-% params - struct containing options, as fields
-% redo_covar - if 1, remodels covariance
-% redo_whitening - if 1, recalcalates whitening
-% (by default, both are set to 1)
-%
-% e.g.
-% % Estimate model on design D and data Y, using original covariance and
-% % whitening
-% E = estimate(D, Y, struct('reco_covar', 0, ...
-% 'redo_whitening', 0);
-%
-% $Id: estimate.m 515 2004-11-17 02:04:34Z matthewbrett $
-
-def_params = struct(...
- 'redo_covar', 1, ...
- 'redo_whitening', 1);
-
-if nargin < 2
- error('Need data to estimate');
-end
-if nargin < 3
- params = [];
-end
-
-% Replicate original behaviour calling with cell array of strings
-params = sf_call_compat(params);
-
-% Fill with defaults
-params = mars_struct('ffillmerge', def_params, params);
-
-% ensure we have a data object
-marsY = marsy(marsY);
-
-% check design is complete
-if ~can_mars_estimate(marsD)
- error('This design needs more information before it can be estimated');
-end
-
-% Check data and design dimensions
-if n_time_points(marsY) ~= n_time_points(marsD)
- error('The data and design must have the same number of rows');
-end
-
-% get SPM design structure
-SPM = des_struct(marsD);
-
-% process params
-if params.redo_covar
- if isfield(SPM, 'xVi')
- if isfield(SPM.xVi, 'V') & isfield(SPM.xVi, 'Vi')
- SPM.xVi = rmfield(SPM.xVi, 'V');
- if verbose(marsD)
- disp('Re-estimating covariance');
- end
- end
- end
-end
-if params.redo_whitening
- if isfield(SPM.xX, 'W')
- SPM.xX = rmfield(SPM.xX, 'W');
- if verbose(marsD)
- disp('Re-estimating whitening filter');
- end
- end
-end
-
-SPM = pr_estimate(SPM, marsY);
-SPM.marsY = marsY;
-SPM.SPMid = sprintf('SPM2: MarsBaR estimation. mardo_2 version %s', ...
- marsD.cvs_version);
-
-% return modified structure
-marsD = des_struct(marsD, SPM);
-
-return
-
-function params = sf_call_compat(params)
-% Replicates old calling behaviour, for backwards compatibility
-
-% Replicate result of passing empty cell array, but warn that this
-% will be removed soon
-if ischar(params) | iscell(params)
- warning(['Cell / char form of params deprecated, ' ...
- 'please use struct form instead']);
-end
-if iscell(params) & isempty(params)
- warning(['Empty cell array changes default options; '...
- 'This behaviour will change for future versions']);
- params = struct(...
- 'redo_covar', 0, ...
- 'redo_whitening', 0);
-end
-if ischar(params)params = {params}; end
-if iscell(params)
- params = params(:);
- params = cell2struct(num2cell(ones(size(params))), params, 1);
-end
-return
diff --git a/lib/marsbar-0.44/@mardo_5/fill.m b/lib/marsbar-0.44/@mardo_5/fill.m
deleted file mode 100644
index 5b178fe..0000000
--- a/lib/marsbar-0.44/@mardo_5/fill.m
+++ /dev/null
@@ -1,291 +0,0 @@
-function D = fill(D, actions)
-% fills missing entries from SPM FMRI design matrix
-% FORMAT D = fill(D, actions)
-%
-% D - mardo object containing spm design
-% actions - string or cell array of strings with actions:
-% 'defaults' - fills empty parts of design with defaults
-% (in fact this is always done)
-% 'filter' - asks for and fills filter
-% 'autocorr' - asks for and fills autocorrelation
-% 'for_estimation' fill filter &| autocorr if not present
-% 'images' - asks for and fills with images, mask, scaling
-%
-% Returns
-% D - returned mardo SPM design
-%
-% Copied/pasted then rearranged from SPM2 spm_fmri_spm_ui
-% Matthew Brett - 17/11/01 - MRS2TH
-%
-% $Id: fill.m 543 2004-12-14 08:58:05Z matthewbrett $
-
-if nargin < 2
- actions = '';
-end
-if ~is_fmri(D), return, end
-if isempty(actions), actions = {'defaults'}; end
-if ischar(actions), actions = {actions}; end
-fe = find(ismember(actions, 'for_estimation'));
-if ~isempty(fe)
- A = [];
- if is_fmri(D)
- if ~has_filter(D), A = {'filter'}; end
- if ~has_autocorr(D), A = [A {'autocorr'}]; end
- end
- actions(fe) = [];
- actions = [actions(1:fe(1)-1) A actions(fe(1):end)];
-end
-actions = [{'defaults'}, actions];
-
-% Get design, put into some useful variables
-v_f = verbose(D);
-SPM = des_struct(D);
-xX = SPM.xX;
-have_sess = isfield(SPM, 'Sess');
-if have_sess, Sess = SPM.Sess; end
-
-% get file indices
-%---------------------------------------------------------------
-row = block_rows(D);
-nsess = length(row);
-nscan = zeros(1,nsess);
-for i = 1:nsess
- nscan(i) = length(row{i});
-end
-
-done_list = {};
-for a = 1:length(actions)
- if ismember(actions{a}, done_list), continue, end
- done_list = [actions(a) done_list];
- switch lower(actions{a})
- case 'defaults'
-
- % prepare various default settings, offer to design
- xM = []; % masking
- xGX = []; % globals
- sGXcalc = 'none'; % global calculation description
- sGMsca = 'none'; % grand mean scaling description
- Global = 'none'; % proportional scaling or no
-
- BFstr = ''; DSstr = ''; ntr = [];
- if have_sess
- % Number of trial types per session
- for i = 1:nsess, ntr(i) = length(SPM.Sess(i).U); end
- BFstr = SPM.xBF.name;
- end
-
- xsDes = struct(...
- 'Basis_functions', BFstr,...
- 'Number_of_sessions', sprintf('%d',nsess),...
- 'Trials_per_session', sprintf('%-3d',ntr),...
- 'Global_calculation', sGXcalc,...
- 'Grand_mean_scaling', sGMsca,...
- 'Global_normalisation', Global);
-
- if isfield(SPM, 'xsDes')
- xsDes = mars_struct('fillafromb', SPM.xsDes, xsDes);
- end
-
- SPM.xsDes = xsDes;
- SPM = mars_struct('merge', SPM, ...
- struct('xGX', xGX,...
- 'xM', xM));
-
- case 'images'
- [Finter,Fgraph,CmdLine] = spm('FnUIsetup','fMRI stats model setup',0);
- % get filenames
- %---------------------------------------------------------------
- P = [];
- for i = 1:nsess
- str = sprintf('select scans for session %0.0f',i);
- q = spm_get(nscan(i),mars_veropts('get_img_ext'),str);
- P = strvcat(P,q);
- end
-
- % place in data field
- %---------------------------------------------------------------
- SPM.xY.P = P;
-
- % Assemble remaining design parameters
- %=======================================================================
-
- % Global normalization
- %-----------------------------------------------------------------------
- spm_input('Global intensity normalisation...',1,'d',mfilename)
- str = 'remove Global effects';
- SPM.xGX.iGXcalc = spm_input(str,'+1','scale|none',{'Scaling' 'None'});
- SPM.xGX.sGXcalc = 'mean voxel value';
- SPM.xGX.sGMsca = 'session specific';
-
- % Assemble other design parameters
- %=======================================================================
- spm_help('!ContextHelp',mfilename)
- spm_input('Global intensity normalisation...',1,'d',mfilename);
-
- % get file identifiers and Global values
- %=======================================================================
- fprintf('%-40s: ','Mapping files') %-#
- VY = spm_vol(SPM.xY.P);
- fprintf('%30s\n','...done') %-#
-
- %-Check compatability of images
- %-----------------------------------------------------------------------
- [samef msg] = mars_vol_check(VY);
- if ~samef, disp(char(msg)),error('Cannot use images'),end;
-
- %-place in xY
- %-----------------------------------------------------------------------
- SPM.xY.VY = VY;
-
- %-Compute Global variate
- %=======================================================================
- GM = 100;
- q = length(VY);
- g = zeros(q,1);
- fprintf('%-40s: %30s','Calculating globals',' ') %-#
- for i = 1:q
- fprintf('%s%30s',repmat(sprintf('\b'),1,30),sprintf('%4d/%-4d',i,q)) %-#
- g(i) = spm_global(VY(i));
- end
- fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-#
-
- % scale if specified (otherwise session specific grand mean scaling)
- %-----------------------------------------------------------------------
- gSF = GM./g;
- if strcmp(SPM.xGX.iGXcalc,'None')
- for i = 1:nsess
- gSF(SPM.Sess(i).row) = GM./mean(g(SPM.Sess(i).row));
- end
- end
-
- %-Apply gSF to memory-mapped scalefactors to implement scaling
- %-----------------------------------------------------------------------
- for i = 1:q
- SPM.xY.VY(i).pinfo(1:2,:) = SPM.xY.VY(i).pinfo(1:2,:)*gSF(i);
- end
-
- %-place global variates in global structure
- %-----------------------------------------------------------------------
- SPM.xGX.rg = g;
- SPM.xGX.GM = GM;
- SPM.xGX.gSF = gSF;
-
-
- %-Masking structure
- %---------------------------------------------------------------
- SPM.xM = struct('T', ones(q,1),...
- 'TH', g.*gSF,...
- 'I', 0,...
- 'VM', {[]},...
- 'xs', struct('Masking','analysis threshold'));
-
- xsDes = struct(...
- 'Global_calculation', SPM.xGX.sGXcalc,...
- 'Grand_mean_scaling', SPM.xGX.sGMsca,...
- 'Global_normalisation', SPM.xGX.iGXcalc);
-
- SPM.xsDes = mars_struct('ffillmerge',...
- SPM.xsDes,...
- xsDes);
-
- case 'filter'
- % Get filter
- if ~have_sess, return, end
-
- [Finter,Fgraph,CmdLine] = spm('FnUIsetup', 'FMRI model filter', 0);
-
- % TR if not set (it should be)
- if ~mars_struct('isthere', SPM, 'xY', 'RT')
- SPM.xY.RT = spm_input('Interscan interval {secs}','+1');
- end
- SPM.xsDes.Interscan_interval = sprintf('%0.2f {s}',SPM.xY.RT);
-
- spm_input('High pass filter','+1','d',mfilename)
- [SPM.xX.K SPM.xsDes.High_pass_Filter] = ...
- pr_get_filter(SPM.xY.RT, SPM.Sess);
-
- case 'autocorr'
- [Finter,Fgraph,CmdLine] = ...
- spm('FnUIsetup','FMRI autocorrelation options',0);
-
- % Contruct Vi structure for non-sphericity ReML estimation
- %===============================================================
- str = 'Correct for serial correlations?';
- cVi = {'none', 'SPM AR(0.2)','SPM AR (specify)', 'fmristat AR(n)'};
- cVi = spm_input(str,'+1','m',cVi, cVi);
-
- % create Vi struct
- %-----------------------------------------------------------------------
- vox_cov_possible = 0;
- switch lower(cVi{1})
-
- case 'fmristat ar(n)'
- % Fit fmristat model AR(n)
- %---------------------------------------------------------------
- cVi = spm_input('fmristat AR model order', '+1', 'e', 2);
- SPM.xVi.Vi = struct('type', 'fmristat', 'order', cVi);
- cVi = sprintf('fmristat AR(%d)',cVi);
- f2cl = 'V'; % Field to CLear
-
- case 'spm ar (specify)'
- % SPM AR coefficient(s) to be specified
- %---------------------------------------------------------------
- cVi = spm_input('AR rho parameter(s)', '+1', 'e', 0.2);
- SPM.xVi.Vi = pr_spm_ce(nscan,cVi);
- cVi = sprintf('AR(%0.1f)',cVi(1));
- f2cl = 'V';
- vox_cov_possible = 1;
-
- case 'none'
- % xVi.V is i.i.d
- %---------------------------------------------------------------
- SPM.xVi.V = speye(sum(nscan));
- cVi = 'i.i.d';
- f2cl = 'Vi';
-
- otherwise
- % otherwise assume AR(0.2) in xVi.Vi
- %---------------------------------------------------------------
- SPM.xVi.Vi = pr_spm_ce(nscan,0.2);
- cVi = 'AR(0.2)';
- f2cl = 'V';
- vox_cov_possible = 1;
-
- end
-
- % If we've set V, need to clear Vi, because the
- % estimate method takes the presence of Vi to mean that
- % V can be cleared, with 'redo_covar' flag
- % Conversely V needs to be cleared if Vi was estimated
- if isfield(SPM.xVi, f2cl)
- SPM.xVi = rmfield(SPM.xVi, f2cl);
- if v_f, fprintf('Clearing previous %s matrix\n', f2cl); end
- end
-
- % Also: remove previous W matrices
- % Either will need to be recalculated or won't be used
- if isfield(SPM.xX, 'W')
- SPM.xX = rmfield(SPM.xX, 'W');
- if v_f, fprintf('Clearing previous W matrix\n'); end
- end
-
- % Whether to average covariance estimates over voxels
- SPM.xVi.cov_calc = 'summary';
- if vox_cov_possible
- if spm_input('Use voxel data for covariance','+1','y/n', [1 0], 1);
- SPM.xVi.cov_calc = 'vox';
- end
- end
-
- % fill into design
- SPM.xVi.form = cVi;
- xsDes = struct('Serial_correlations', SPM.xVi.form);
- SPM.xsDes = mars_struct('ffillmerge', SPM.xsDes, xsDes);
-
- otherwise
- error(['Unpredictable: ' actions{a}]);
- end
-end
-
-% put stuff into object
-D = des_struct(D,SPM);
diff --git a/lib/marsbar-0.44/@mardo_5/mardo_5.m b/lib/marsbar-0.44/@mardo_5/mardo_5.m
deleted file mode 100644
index 57f3f3c..0000000
--- a/lib/marsbar-0.44/@mardo_5/mardo_5.m
+++ /dev/null
@@ -1,104 +0,0 @@
-function [o, others] = mardo_5(params, others, varargin)
-% class constructor for SPM5 MarsBaR design object
-% FORMAT [o, others] = mardo_5(params, others, varargin)
-% Inputs
-% params - structure,containing fields, or SPM/MarsBaR design
-% others - structure, containing other fields to define
-%
-% Outputs
-% o - mardo_5 object (unless disowned)
-% others - any unrecognized fields from params, for processing by
-% children
-%
-% This object is called from the mardo object contructor
-% with a mardo object as input. mardo_5 checks to see
-% if the contained design is an SPM5 design, returns
-% the object unchanged if not. If it is an SPM5
-% design, it claims ownership of the passed object.
-%
-% The constructor can also be called to give class functions, where the
-% name of the class function is a character string which is one of:
-% 'spm_filter' - applies spm_filter routine to passed args
-%
-% $Id: mardo_5.m 607 2006-03-30 20:54:55Z matthewbrett $
-
-myclass = 'mardo_5';
-cvs_v = marsbar('ver'); % was CVS version; now marsbar version
-
-% Default object structure
-defstruct = [];
-
-if nargin < 1
- defstruct.cvs_version = cvs_v;
- o = class(defstruct, myclass, mardo_2);
- others = [];
- return
-end
-if nargin < 2
- others = [];
-end
-
-% parse out string action calls (class functions)
-if ischar(params)
- switch params
- case 'spm_filter'
- if nargin < 2
- error('Need filter');
- elseif nargin < 3
- o = pr_spm_filter(others);
- else
- o = pr_spm_filter(others, varargin{1});
- end
- return
- otherwise
- error(sprintf('Is "%s" a filename? Use ``mardo`` to load from files',...
- params));
- end
-end
-
-% Deal with passed objects of this (or child) class
-if isa(params, myclass)
- o = params;
- % Check for simple form of call
- if isempty(others), return, end
-
- % Otherwise, we are being asked to set fields of object
- % (Moot at the moment, as there are no fields specific for this object)
- [p others] = mars_struct('split', others, defstruct);
- return
-end
-
-% normal call is via mardo constructor
-if isa(params, 'mardo')
- % Check to see if this is a suitable design, return if not
- des = des_struct(params);
- if ~my_design(des), o = params; return, end
- % own, by making mardo_2 object for design
- [uo others] = mardo_2(params, others, 1);
- params = [];
-else
- uo = [];
-end
-
-if ~isa(uo, 'mardo') % mardo object not passed
- % umbrella object, parse out fields for (this object and children)
- % third argument of 0 prevents recursive call back to here
- [uo, params] = mardo_2(params, others, 0);
-else
- % fill params with other parameters
- params = mars_struct('ffillmerge', params, others);
-end
-
-% parse parameters into those for this object, children
-[params, others] = mars_struct('ffillsplit', defstruct, params);
-
-% add cvs tag
-params.cvs_version = cvs_v;
-
-% set the mardo object
-o = class(params, myclass, uo);
-
-% convert vols to current format
-o = convert_vols(o);
-
-return
diff --git a/lib/marsbar-0.44/@mardo_5/native_vol_ver.m b/lib/marsbar-0.44/@mardo_5/native_vol_ver.m
deleted file mode 100644
index 16a5c20..0000000
--- a/lib/marsbar-0.44/@mardo_5/native_vol_ver.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function res = native_vol_ver(obj)
-% return string specifying native vol type
-%
-% $Id: verbose.m 87 2004-01-06 01:48:35Z matthewbrett $
-
-res = '5';
diff --git a/lib/marsbar-0.44/@mardo_5/private/my_design.m b/lib/marsbar-0.44/@mardo_5/private/my_design.m
deleted file mode 100644
index eba95c3..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/my_design.m
+++ /dev/null
@@ -1,12 +0,0 @@
-function tf = my_design(des)
-% returns 1 if design looks like it is of SPM5 / 8 type
-%
-% $Id: my_design.m 328 2004-03-03 01:56:03Z matthewbrett $
-
-tf = 0;
-if isfield(des, 'SPM'), des = des.SPM; end
-if isfield(des, 'SPMid')
- tf = ~isempty(strmatch('SPM5', des.SPMid)) | ...
- ~isempty(strmatch('SPM8', des.SPMid)) | ...
- ~isempty(strmatch('SPM12', des.SPMid));
-end
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_estimate.m b/lib/marsbar-0.44/@mardo_5/private/pr_estimate.m
deleted file mode 100644
index e791a29..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_estimate.m
+++ /dev/null
@@ -1,399 +0,0 @@
-function SPM = pr_estimate(SPM, marsY)
-% Estimation of a General Linear Model
-% FORMAT SPM = pr_estimate(SPM, marsY)
-% Inputs
-% SPM - SPM design structure
-% marsY - marsY data object, or 2D data (Y) matrix
-%
-% Outputs
-% SPM - modified estimated design structure, with data contained as
-% field marsY
-%
-% Based on spm_spm from spm2:
-% @(#)spm_spm.m 2.66 Andrew Holmes, Jean-Baptiste Poline, Karl Friston 03/03/27
-%
-% There are some changes in this version
-% 1) The specified Vi field, can contain either
-% a cell array, in which case it is standard SPM covariance components,
-% or a struct array, in which case it can specify other methods of
-% estimating the covariance, in particular, real AR(n) estimation
-%
-% 2) The design will specify if the covariance should be calculated from
-% the summarized time course(s), or from the component voxels, then
-% averaged. Voxel time courses are used by default, and if
-% SPM.xVi.cov_calc is set to 'vox', but summary time
-% courses can be used by setting SPM.xVi.cov_calc to 'summary'.
-%
-% 3) Normally, if the W matrix is present, the V matrix should also be
-% present. Because it is boring to calculate the V matrix and then WVW,
-% if we know WVW is I, V can be present, but empty, in which case WVW is
-% assumed to be I. It just saves time.
-%
-% $Id: pr_estimate.m 543 2004-12-14 08:58:05Z matthewbrett $
-
-%-Say hello
-%-----------------------------------------------------------------------
-Finter = spm('FigName','Stats: estimation...'); spm('Pointer','Watch')
-
-%=======================================================================
-% - A N A L Y S I S P R E L I M I N A R I E S
-%=======================================================================
-
-%-Initialise
-%=======================================================================
-fprintf('%-40s: %30s','Initialising parameters','...computing') %-#
-xX = SPM.xX;
-[nScan nBeta] = size(xX.X);
-
-%-Check confounds (xX.K) and non-sphericity (xVi)
-%-----------------------------------------------------------------------
-if ~isfield(xX,'K')
- xX.K = 1;
-end
-try
- %-If covariance components are specified use them
- %---------------------------------------------------------------
- xVi = SPM.xVi;
-catch
-
- %-otherwise assume i.i.d.
- %---------------------------------------------------------------
- xVi = struct( 'form', 'i.i.d.',...
- 'V', speye(nScan,nScan));
-
-end
-
-% Work out what we are going to do
-have_W = isfield(xX, 'W');
-have_V = isfield(xVi, 'V');
-
-% Work out type of covariance modelling. We get Vi, cov_type (as a string):
-% one of 'SPM' or 'fmristat' and cov_vox, which is a flag set to 1 if all
-% the voxel time courses should be used to calculate the resdiduals and
-% covariance.
-if ~have_V
- if ~isfield(xVi, 'Vi')
- error('No covariance specified, and no priors to calculate it');
- end
- Vi = xVi.Vi;
- if iscell(Vi)
- cov_type = 'SPM';
- elseif ~isstruct(Vi)
- error('Vi field should be cell or struct type')
- elseif ~isfield(Vi, 'type')
- error('Vi should have field specifying type');
- else
- cov_type = Vi.type;
- end
-
- % Covariance calculated on summary or voxel time courses
- cov_vox = 1;
- if isfield(xVi, 'cov_calc')
- cov_vox = strcmpi(xVi.cov_calc, 'vox');
- end
-else cov_vox = 0; end
-
-%-Get non-sphericity V
-%=======================================================================
-if have_V
- %-If xVi.V is specified proceed directly to parameter estimation
- %---------------------------------------------------------------
- V = xVi.V;
- str = 'parameter estimation';
-else
- % otherwise invoke ReML selecting voxels under i.i.d assumptions
- %---------------------------------------------------------------
- V = speye(nScan,nScan);
- str = '[hyper]parameter estimation';
-end
-
-%-Get whitening/Weighting matrix: If xX.W exists we will save WLS
-% estimates. Get WVW also, which can be assumed if W is a whitening
-% matrix
-%-----------------------------------------------------------------------
-if have_W
- %-If W is specified, use it
- %-------------------------------------------------------
- W = xX.W;
- if isempty(V) % V is only inv(W*W')
- WVW = eye(nScan);
- else
- WVW = W*V*W';
- end
-else
- if have_V
- % otherwise make W a whitening filter W*W' = inv(V)
- %-------------------------------------------------------
- [u s] = pr_spm_svd(xVi.V);
- s = spdiags(1./sqrt(diag(s)),0,nScan,nScan);
- W = u*s*u';
- W = W.*(abs(W) > 1e-6);
- xX.W = W;
- WVW = eye(nScan);
- else
- % unless xVi.V has not been estimated - requiring 2 passes
- %-------------------------------------------------------
- W = eye(nScan);
- str = 'hyperparameter estimation (1st pass)';
- end
-end
-
-%-Design space and projector matrix [pseudoinverse] for WLS
-%=======================================================================
-xX.xKXs = spm_sp('Set',pr_spm_filter(xX.K,W*xX.X)); % KWX
-xX.pKX = spm_sp('x-',xX.xKXs); % projector
-
-%-If xVi.V is not defined compute Hsqr
-%-----------------------------------------------------------------------
-if ~isfield(xVi,'V')
- Fcname = 'effects of interest';
- iX0 = [SPM.xX.iB SPM.xX.iG];
- xCon = spm_FcUtil('Set',Fcname,'F','iX0',iX0,xX.xKXs);
- X1o = spm_FcUtil('X1o', xCon(1),xX.xKXs);
- Hsqr = spm_FcUtil('Hsqr',xCon(1),xX.xKXs);
- trRV = spm_SpUtil('trRV',xX.xKXs);
- trMV = spm_SpUtil('trMV',X1o);
-end
-
-fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-#
-
-%=======================================================================
-% - F I T M O D E L & W R I T E P A R A M E T E R I M A G E S
-%=======================================================================
-
-% Select whether to work with all voxel data in ROIs, or summary data
-% Using all data only makes sense for intial estimation of whitening
-if ~have_W & cov_vox
- str = 'voxelwise';
- Y = region_data(marsY);
- Y = [Y{:}];
-else
- str = 'pooled';
- Y = summary_data(marsY);
-end
-
-% Eliminate columns with zero variance
-in_cols = any(diff(Y));
-if ~any(in_cols), error('No variance to estimate model'); end
-Y = Y(:, in_cols);
-
-fprintf('%-40s: %30s\n','Covariance estimate',['...' str]) %-#
-fprintf('%-40s: %30s','Model','...start') %-#
-
-n_roi = n_regions(marsY);
-
-%-Intialise variables used in the loop
-%=======================================================================
-[n S] = size(Y); % no of time courses
-Cy = 0; % spatially whitened
-CY = 0; % for ReML
-EY = 0; % for ReML
-%-Whiten/Weight data and remove filter confounds
-%-------------------------------------------------------
-fprintf('%s%30s',repmat(sprintf('\b'),1,30),'filtering') %-#
-
-KWY = pr_spm_filter(xX.K,W*Y);
-
-%-General linear model: Weighted least squares estimation
-%------------------------------------------------------
-fprintf('%s%30s',repmat(sprintf('\b'),1,30),'estimation') %-#
-
-beta = xX.pKX*KWY; %-Parameter estimates
-res = spm_sp('r',xX.xKXs,KWY); %-Residuals
-ResSS = sum(res.^2); %-Residual SSQ
-clear KWY %-Clear to save memory
-
-
-%-If ReML hyperparameters are needed for xVi.V
-%-------------------------------------------------------
-if ~have_V
- if n_roi > 1
- wstr = {'Pooling covariance estimate across ROIs',...
- 'This is unlikely to be valid; A better approach',...
- 'is to run estimation separately for each ROI'};
- fprintf('\n');
- warning(sprintf('%s\n', wstr{:}));
- end
- % Cy is whitened covariance matrix; only needed for SPM REML method
- if strcmp(cov_type, 'SPM')
- q = diag(sqrt(trRV./ResSS'),0); % spatial whitening
- Y = Y * q;
- Cy = Y*Y';
- end
-end % have_V
-
-%-if we are saving the WLS parameters
-%-------------------------------------------------------
-if have_W
-
- %-sample covariance and mean of Y (all voxels)
- %-----------------------------------------------
- CY = Y*Y';
- EY = sum(Y,2);
-
-end % have_W
-clear Y %-Clear to save memory
-
-fprintf('\n') %-#
-spm_progress_bar('Clear')
-
-%=======================================================================
-% - P O S T E S T I M A T I O N C L E A N U P
-%=======================================================================
-if S == 0, warning('No time courses - empty analysis!'), end
-
-%-average sample covariance and mean of Y (over voxels)
-%-----------------------------------------------------------------------
-CY = CY/S;
-EY = EY/S;
-CY = CY - EY*EY';
-
-%-If not defined, compute non-sphericity V using ReML Hyperparameters
-%=======================================================================
-if ~have_V
-
- %-Estimate of residual correlations through hyperparameters
- %---------------------------------------------------------------
- str = 'Temporal non-sphericity (over voxels)';
- fprintf('%-40s: %30s\n',str,'...estimation') %-#
- Cy = Cy/S;
-
- % Estimate for separable designs and covariance components
- %---------------------------------------------------------------
- if isstruct(xX.K)
-
- switch cov_type
- case 'SPM'
- % Store hyperparameters
- m = length(Vi);
- h = zeros(m,1);
- case 'fmristat'
- % Store AR coefficients
- h = zeros(length(xX.K), Vi.order);
- otherwise
- error(['Did not recognize covariance type: ' cov_type]);
- end
-
- V = sparse(nScan,nScan);
- for i = 1:length(xX.K)
-
- % extract blocks from bases
- %-----------------------------------------------
- q = xX.K(i).row;
-
- % design space for estimation (with confounds in filter)
- %-----------------------------------------------
- Xp = xX.X(q,:);
- try
- Xp = [Xp xX.K(i).X0];
- end
-
- switch cov_type
- case 'SPM'
- % REML: extract blocks from bases
- %-----------------------------------------------
- p = [];
- Qp = {};
- for j = 1:m
- if nnz(xVi.Vi{j}(q,q))
- Qp{end + 1} = xVi.Vi{j}(q,q);
- p = [p j];
- end
- end
-
- % ReML itself
- %-----------------------------------------------
- fprintf('%-30s- %i\n',' ReML Block',i);
- [Vp,hp] = pr_spm_reml(Cy(q,q),Xp,Qp);
- V(q,q) = V(q,q) + Vp;
- h(p) = hp;
-
- case 'fmristat'
- % AR estimation
- [h(i,:) W(q,q)] = pr_fmristat_ar(res(q,:),Xp,Vi.order);
-
- end
- end
- else
- [V,h] = pr_spm_reml(Cy,xX.X,xVi.Vi);
- end
-
- switch cov_type
- case 'SPM'
- % normalize non-sphericity and save hyperparameters
- %---------------------------------------------------------------
- V = V*nScan/trace(V);
- case 'fmristat'
- % Set covariance matrix to empty, we have already calculated W
- %---------------------------------------------------------------
- V = [];
- SPM.xX.W = W;
- end
-
- xVi.h = h;
- xVi.V = V; % Save non-sphericity xVi.V
- xVi.Cy = Cy; %-spatially whitened
- SPM.xVi = xVi; % non-sphericity structure
-
- % If xX.W is not specified use W*W' = inv(V) to give ML estimators
- %---------------------------------------------------------------
- if ~have_W
- % clear everything except SPM, marsY;
- vnames = who;
- vnames = vnames(~ismember(vnames, {'SPM','marsY'}));
- clear(vnames{:});
- SPM = pr_estimate(SPM,marsY);
- return
- end
-end
-
-
-%-Use non-sphericity xVi.V to compute [effective] degrees of freedom
-%=======================================================================
-xX.V = pr_spm_filter(xX.K,pr_spm_filter(xX.K,WVW)'); % KWVW'K'
-[trRV trRVRV] = spm_SpUtil('trRV',xX.xKXs,xX.V); % trRV (for X)
-xX.trRV = trRV; %
-xX.trRVRV = trRVRV; %-Satterthwaite
-xX.erdf = trRV^2/trRVRV; % approximation
-xX.Bcov = xX.pKX*xX.V*xX.pKX'; % Cov(beta)
-
-
-%-scale ResSS by 1/trRV
-%-----------------------------------------------------------------------
-ResMS = ResSS/xX.trRV;
-
-%-Create 1st contrast for 'effects of interest' (all if not specified)
-%=======================================================================
-Fcname = 'effects of interest';
-try
- iX0 = [xX.iB xX.iG];
-catch
- iX0 = [];
-end
-xCon = spm_FcUtil('Set',Fcname,'F','iX0',iX0,xX.xKXs);
-
-%-Compute scaled design matrix for display purposes
-%-----------------------------------------------------------------------
-xX.nKX = spm_DesMtx('sca',xX.xKXs.X,xX.name);
-
-%-place fields in SPM
-%-----------------------------------------------------------------------
-SPM.betas = ones(nBeta, n_roi) + NaN;
-SPM.betas(:, in_cols) = beta;
-SPM.ResidualMS = ones(1, n_roi) + NaN;
-SPM.ResidualMS(in_cols) = ResMS;
-
-SPM.xVi = xVi; % non-sphericity structure
-SPM.xVi.CY = CY; %-<(Y - )*(Y - )'>
-
-SPM.xX = xX; %-design structure
-
-SPM.xCon = xCon; %-contrast structure
-
-%=======================================================================
-%- E N D: Cleanup GUI
-%=======================================================================
-fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-#
-spm('FigName','Stats: done',Finter); spm('Pointer','Arrow')
-fprintf('%-40s: %30s\n','Completed',spm('time')) %-#
-fprintf('...use the results section for assessment\n\n') %-#
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_fmri_design.m b/lib/marsbar-0.44/@mardo_5/private/pr_fmri_design.m
deleted file mode 100644
index 7c83f75..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_fmri_design.m
+++ /dev/null
@@ -1,206 +0,0 @@
-function [SPM] = pr_fmri_design(SPM)
-% MarsBaR version of spm_fMRI design - asssembles a design for fMRI studies
-% FORMAT [SPM] = pr_fmri_design(SPM)
-%
-% This file is a hardly edited version of:
-% @(#)spm_fMRI_design.m 2.34 Karl Friston 03/01/30
-% See that (SPM2) version for comments etc
-%
-% $Id: pr_fmri_design.m 607 2006-03-30 20:54:55Z matthewbrett $
-
-%-GUI setup
-%-----------------------------------------------------------------------
-SPMid = spm('SFnBanner',mfilename,marsbar('ver'));
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','fMRI stats model setup',0);
-spm_help('!ContextHelp',mfilename)
-
-% construct Design matrix {X} - cycle over sessions
-%=======================================================================
-
-% global parameters
-%-----------------------------------------------------------------------
-try
- fMRI_T = SPM.xBF.T;
- fMRI_T0 = SPM.xBF.T0;
-catch
- global defaults
- d_fmri = mars_struct('getifthere', defaults, 'stats', 'fmri');
- if mars_struct('isthere', d_fmri, 't')
- fMRI_T = d_fmri.t;
- fMRI_T0 = d_fmri.t0;
- else,
- fMRI_T = 16;
- fMRI_T0 = 1;
- end;
- SPM.xBF.T = fMRI_T;
- SPM.xBF.T0 = fMRI_T0;
-end
-
-
-% get nscan and RT if not in SPM
-%-----------------------------------------------------------------------
-try
- SPM.xY.RT;
-catch
- spm_input('Basic parameters...',1,'d',mfilename)
- SPM.xY.RT = spm_input('Interscan interval {secs}','+1','r',[],1);
-end
-try
- SPM.nscan;
-catch
- SPM.nscan = spm_input(['scans per session e.g. 64 64 64'],'+1');
-end
-
-% time units, dt = time bin {secs}
-%-----------------------------------------------------------------------
-SPM.xBF.dt = SPM.xY.RT/SPM.xBF.T;
-try
- SPM.xBF.UNITS;
-catch
- str = 'specify design in';
- SPM.xBF.UNITS = spm_input(str,'+1','scans|secs');
-end
-
-% separate specifications for non-relicated sessions
-%-----------------------------------------------------------------------
-rep = 0;
-if length(SPM.nscan) > 1 & ~any(diff(SPM.nscan)) & ~isfield(SPM,'Sess')
- str = 'are sessions replications';
- rep = spm_input(str,'+1','yes|no',[1 0]);
-end
-
-% Get basis functions
-%-----------------------------------------------------------------------
-try
- bf = SPM.xBF.bf;
-catch
- SPM.xBF = pr_spm_get_bf(SPM.xBF);
- bf = SPM.xBF.bf;
-end
-
-% 1st or 2nd order Volterra expansion?
-%-----------------------------------------------------------------------
-try
- V = SPM.xBF.Volterra;
-catch
- str = 'model interactions (Volterra)';
- V = spm_input(str,'+1','y/n',[2 1]);
- SPM.xBF.Volterra = V;
-end
-
-
-% get session specific design parameters
-%=======================================================================
-Xx = [];
-Xb = [];
-Xname = {};
-Bname = {};
-for s = 1:length(SPM.nscan)
-
- % number of scans for this session
- %---------------------------------------------------------------
- k = SPM.nscan(s);
-
- if (s == 1) | ~rep
-
- % create convolved stimulus functions or inputs
- %=======================================================
-
- % Get inputs, neuronal causes or stimulus functions U
- %-------------------------------------------------------
- U = pr_spm_get_ons(SPM,s);
-
- % Convolve stimulus functions with basis functions
- %-------------------------------------------------------
- [X,Xn,Fc] = pr_spm_volterra(U,bf,V);
-
- % Resample regressors at acquisition times (32 bin offset)
- %-------------------------------------------------------
- try
- X = X([0:(k - 1)]*fMRI_T + fMRI_T0 + 32,:);
- end
-
- % and orthonalise (within trial type)
- %-------------------------------------------------------
- for i = 1:length(Fc)
- X(:,Fc(i).i) = pr_spm_orth(X(:,Fc(i).i));
- end
-
- % get user specified regressors
- %=======================================================
- try
- C = SPM.Sess(s).C.C;
- Cname = SPM.Sess(s).C.name;
- catch
-
- % covariates - C
- %-----------------------------------------------
- str = sprintf('Session %d',s);
- spm_input('Other regressors',1,'d',str)
- C = [];
- c = spm_input('user specified','+1','w1',0);
- while size(C,2) < c
- str = sprintf('regressor %i',size(C,2) + 1);
- C = [C spm_input(str,2,'e',[],[k Inf])];
- end
-
- % and their names - Cnames
- %-----------------------------------------------
- Cname = {};
- for i = 1:size(C,2)
- str = sprintf('regressor %i',i);
- Cname{i} = spm_input('name of','+0','s',str);
- end
- end
-
- % append mean-corrected regressors and names
- %-------------------------------------------------------
- X = [X spm_detrend(C)];
- Xn = {Xn{:} Cname{:}};
-
- % Confounds: Session effects
- %=======================================================
- B = ones(k,1);
- Bn{1} = sprintf('constant');
-
- end
-
- % Session structure array
- %---------------------------------------------------------------
- SPM.Sess(s).U = U;
- SPM.Sess(s).C.C = C;
- SPM.Sess(s).C.name = Cname;
- SPM.Sess(s).row = size(Xx,1) + [1:k];
- SPM.Sess(s).col = size(Xx,2) + [1:size(X,2)];
- SPM.Sess(s).Fc = Fc;
-
- % Append names
- %---------------------------------------------------------------
- for i = 1:length(Xn)
- Xname{end + 1} = [sprintf('Sn(%i) ',s) Xn{i}];
- end
- for i = 1:length(Bn)
- Bname{end + 1} = [sprintf('Sn(%i) ',s) Bn{i}];
- end
-
- % append into Xx and Xb
- %===============================================================
- Xx = blkdiag(Xx,X);
- Xb = blkdiag(Xb,B);
-
-end %- for s
-
-
-% finished
-%-----------------------------------------------------------------------
-SPM.xX.X = [Xx Xb];
-SPM.xX.iH = [];
-SPM.xX.iC = [1:size(Xx,2)];
-SPM.xX.iB = [1:size(Xb,2)] + size(Xx,2);
-SPM.xX.iG = [];
-SPM.xX.name = {Xname{:} Bname{:}};
-
-
-%-End
-%-----------------------------------------------------------------------
-spm_input('!DeleteInputObj')
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_fmristat_ar.m b/lib/marsbar-0.44/@mardo_5/private/pr_fmristat_ar.m
deleted file mode 100644
index 081b0ad..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_fmristat_ar.m
+++ /dev/null
@@ -1,79 +0,0 @@
-function [rho,Vmhalf,V] = pr_fmristat_ar(res,X,nlags)
-% function returns estimated AR coefficients using fmristat algorithm
-% FORMAT [rho,Vmhalf,V] = pr_fmristat_ar(res,X,nlags)
-%
-% See http://www.math.mcgill.ca/keith/fmristat/ and
-% fmrilm.m in fmristat package for code, and
-% Worsley, K.J., Liao, C., Aston, J., Petre, V., Duncan, G.H., Morales,
-% F., Evans, A.C. (2002). A general statistical analysis for fMRI
-% data. NeuroImage, 15:1-15 - for description of the algorithm
-%
-% $Id: pr_fmristat_ar.m 301 2004-02-04 03:53:23Z matthewbrett $
-
-% This is the copyright notice from fmrilm:
-%############################################################################
-% COPYRIGHT: Copyright 2002 K.J. Worsley
-% Department of Mathematics and Statistics,
-% McConnell Brain Imaging Center,
-% Montreal Neurological Institute,
-% McGill University, Montreal, Quebec, Canada.
-% worsley@math.mcgill.ca, liao@math.mcgill.ca
-%
-% Permission to use, copy, modify, and distribute this
-% software and its documentation for any purpose and without
-% fee is hereby granted, provided that the above copyright
-% notice appear in all copies. The author and McGill University
-% make no representations about the suitability of this
-% software for any purpose. It is provided "as is" without
-% express or implied warranty.
-%############################################################################
-
-if nargin < 2
- error('Need covariance and design');
-end
-if nargin < 3
- nlags = 1;
-end
-
-sX = spm_sp('Set', X);
-R = spm_sp('r', sX);
-
-nlp1 = nlags+1;
-[n nvox] = size(res);
-
-% Bias reduction
-M=zeros(nlp1);
-for i=1:(nlp1)
- for j=1:(nlp1)
- Di=(diag(ones(1,n-i+1),i-1)+diag(ones(1,n-i+1),-i+1))/(1+(i==1));
- Dj=(diag(ones(1,n-j+1),j-1)+diag(ones(1,n-j+1),-j+1))/(1+(j==1));
- M(i,j)=trace(R*Di*R*Dj)/(1+(i>1));
- end
-end
-invM = inv(M);
-
-a = zeros(nlp1,nvox);
-for lag = 0:nlags
- a(lag+1,:)= sum(res(1:(n-lag),:).*res((lag+1):n,:));
-end
-
-vhat = invM*a;
-rho = vhat(2:end,:) ./ (ones(nlags, 1) * vhat(1,:));
-rho = mean(rho,2)';
-
-if nargout > 1
- % Whitening matrix; Appendix A3 Worsley et al (2002)
- % Modified according to fmrilm code
- [Ainvt posdef] = chol(toeplitz([1 rho]));
- nl=size(Ainvt,1);
- A=inv(Ainvt');
- Vmhalf = zeros(n,n);
- B=ones(n-nl,1)*A(nl,:);
- Vmhalf(nl+1:end,:) = spdiags(B,1:nl,n-nl,n);
- Vmhalf(1:nl,1:nl) = A;
-end
-
-if nargout > 2
- % Estimated covariance
- V = inv(Vmhalf*Vmhalf');
-end
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_get_filter.m b/lib/marsbar-0.44/@mardo_5/private/pr_get_filter.m
deleted file mode 100644
index c0256f9..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_get_filter.m
+++ /dev/null
@@ -1,51 +0,0 @@
-function [K, str] = pr_get_filter(RT, row)
-% gets filter using spm_fmri_spm_ui routines
-% FORMAT [K, str]= pr_get_filter(RT, row)
-% or
-% FORMAT [K, str]= pr_get_filter(RT, Sess)
-%
-% $Id: pr_get_filter.m 77 2003-12-25 09:00:03Z matthewbrett $
-
-if nargin < 2
- error('Need TR, row / Sess matrix');
-end
-
-% number of sessions
-nsess = length(row);
-
-% rows from Sess
-if isfield(row(1), 'row')
- Sess = row;
- row = {};
- for s = 1:nsess
- row{s} = Sess(s).row;
- end
-else
- Sess = [];
-end
-
-switch spm_input('High-pass filter?','+1','b','none|specify');
-
- case 'specify'
- % default 128 seconds
- %-------------------------------------------------------
- HParam = 128*ones(1,nsess);
- p_str = 'cutoff period (secs)';
- HParam = spm_input(p_str,'+1','e',HParam,[1 nsess]);
- str = sprintf('Cutoff: %d {s}', HParam);
-
- case 'none'
- % Inf seconds (i.e. constant term only)
- %-------------------------------------------------------
- HParam = Inf*ones(1,nsess);
- str = 'none';
-end
-
-% create and set filter struct
-%---------------------------------------------------------------
-for i = 1:nsess
- K(i) = struct( 'HParam', HParam(i),...
- 'row', row{i},...
- 'RT', RT);
-end
-K = pr_spm_filter(K);
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_cat.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_cat.m
deleted file mode 100644
index cb20d73..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_cat.m
+++ /dev/null
@@ -1,96 +0,0 @@
-function [x] = pr_spm_cat(x,d)
-% converts a cell array into a matrix
-% FORMAT [x] = pr_spm_cat(x,d);
-% x - cell array
-% d - dimension over which to concatenate [default - both]
-%__________________________________________________________________________
-% Empty array elements are replaced by sparse zero partitions
-% and single 0 entries are expanded to conform to the non-empty
-% non zero elements.
-%
-% e.g.:
-% > x = pr_spm_cat({eye(2) []; 0 [1 1; 1 1]})
-% > full(x) =
-%
-% 1 0 0 0
-% 0 1 0 0
-% 0 0 1 1
-% 0 0 1 1
-%__________________________________________________________________________
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% Karl Friston
-% $Id: spm_cat.m 258 2005-10-18 18:21:07Z karl $
-
-% check x is not already a matrix
-%--------------------------------------------------------------------------
-if ~iscell(x), return, end
-
-% if concatenation over a specific dimension
-%--------------------------------------------------------------------------
-[n m] = size(x);
-if nargin > 1
-
- % concatenate over first dimension
- %----------------------------------------------------------------------
- if d == 1
- y = cell(1,m);
- for i = 1:m
- y{i} = pr_spm_cat(x(:,i));
- end
-
- % concatenate over second
- %----------------------------------------------------------------------
- elseif d == 2
-
- y = cell(n,1);
- for i = 1:n
- y{i} = pr_spm_cat(x(i,:));
- end
-
- % only viable for 2-D arrays
- %----------------------------------------------------------------------
- else
- error('uknown option')
- end
- x = y;
- return
-
-end
-
-% find dimensions to fill in empty partitions
-%--------------------------------------------------------------------------
-for i = 1:n
-for j = 1:m
- if iscell(x{i,j})
- x{i,j} = pr_spm_cat(x{i,j});
- end
- [u v] = size(x{i,j});
- I(i,j) = u;
- J(i,j) = v;
-end
-end
-I = max(I,[],2);
-J = max(J,[],1);
-
-% sparse and empty partitions
-%--------------------------------------------------------------------------
-[n m] = size(x);
-for i = 1:n
-for j = 1:m
- if isempty(x{i,j})
- x{i,j} = zeros(I(i),J(j));
- elseif ~x{i,j}
- x{i,j} = zeros(I(i),J(j));
- else
- x{i,j} = full(x{i,j});
- end
-end
-end
-
-% concatenate
-%--------------------------------------------------------------------------
-for i = 1:n
- y{i,1} = cat(2,x{i,:});
-end
-x = sparse(cat(1,y{:}));
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_ce.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_ce.m
deleted file mode 100644
index 7d7c1ec..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_ce.m
+++ /dev/null
@@ -1,57 +0,0 @@
-function [C] = pr_spm_ce(v,a)
-% return error covariance constraints for serially correlated data
-% FORMAT [C] = pr_spm_ce(v,a)
-% v - (1 x l) v(i) = number of observations for ith block
-% a - AR coefficient expansion point (default a = [])
-%
-% C{1} = h(1)*AR(a)
-% C{2} = h(1)*AR(a) + h(2)*dAR(a)/da(1);
-% C{3} = h(1)*AR(a) + h(2)*dAR(a)/da(1) + h(3)*dAR(a)/da(2);
-%
-% See also: spm_Q.m
-%___________________________________________________________________________
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% Karl Friston
-% $Id: spm_Ce.m 190 2005-06-20 07:04:35Z klaas $
-
-
-
-% defaults
-%---------------------------------------------------------------------------
-if nargin == 1
- a = [];
-end
-
-
-% create blocks
-%---------------------------------------------------------------------------
-C = {};
-l = length(v);
-n = sum(v);
-k = 0;
-if l > 1
- for i = 1:l
- dCda = pr_spm_ce(v(i),a);
- for j = 1:length(dCda)
- [x y q] = find(dCda{j});
- x = x + k;
- y = y + k;
- C{end + 1} = sparse(x,y,q,n,n);
- end
- k = v(i) + k;
- end
-else
- % dCda
- %==================================================================
- C{1} = pr_spm_q(a,v);
- dCda = pr_spm_diff('pr_spm_q',a,v,1);
- for i = 1:length(a)
- try
- C{i + 1} = dCda{i};
- catch
- C{i + 1} = dCda;
- end
- end
-
-end
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_diff.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_diff.m
deleted file mode 100644
index 0d26b51..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_diff.m
+++ /dev/null
@@ -1,115 +0,0 @@
-function [J] = pr_spm_diff(varargin)
-% matrix high-order differentials
-% FORMAT [dfdx] = pr_spm_diff(f,x,...,n)
-%
-% f - [inline] function f(x{1},...)
-% x - input argument[s]
-% n - arguments to differentiate w.r.t.
-%
-% dfdx - df/dx{i} ; n = i
-% dfdx{p}...{q} - df/dx{i}dx{j}(q)...dx{k}(p) ; n = [i j ... k]
-%
-% - a cunning recursive routine
-%__________________________________________________________________________
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% Karl Friston
-% $Id: spm_diff.m 417 2006-02-01 13:50:14Z karl $
-
-% create inline object
-%--------------------------------------------------------------------------
-f = fcnchk(varargin{1});
-x = varargin(2:(end - 1));
-n = varargin{end};
-m = n(end);
-xm = pr_spm_vec(x{m});
-dx = exp(-8);
-J = cell(1,length(xm));
-
-% proceed to derivatives
-%==========================================================================
-if length(n) == 1
-
- % dfdx
- %----------------------------------------------------------------------
- f0 = feval(f,x{:});
- for i = 1:length(J)
- xi = x;
- xmi = xm;
- xmi(i) = xmi(i) + dx;
- xi{n} = pr_spm_unvec(xmi,xi{n});
- fi = feval(f,xi{:});
- J{i} = pr_spm_dfdx(fi,f0,dx);
- end
-
-else
-
- % dfdxdxdx....
- %----------------------------------------------------------------------
- f0 = pr_spm_diff(f,x{:},n(1:end - 1));
- for i = 1:length(J)
- xi = x;
- xmi = xm;
- xmi(i) = xmi(i) + dx;
- xi{m} = pr_spm_unvec(xmi,xi{m});
- fi = pr_spm_diff(f,xi{:},n(1:end - 1));
- J{i} = pr_spm_dfdx(fi,f0,dx);
- end
- return
-
-end
-
-% return numeric array for first order derivatives
-%==========================================================================
-
-% vectorise f
-%--------------------------------------------------------------------------
-f = pr_spm_vec(f0);
-
-% if there are no arguments to differentiate w.r.t. ...
-%--------------------------------------------------------------------------
-if ~length(xm)
- J = sparse(length(f),0);
- return
-end
-
-% if there are no arguments to differentiate
-%--------------------------------------------------------------------------
-if ~length(f)
- J = sparse(0,length(xm));
- return
-end
-
-% if f is a scalar
-%--------------------------------------------------------------------------
-if length(f) == 1
- J = pr_spm_cat(J);
- return
-end
-
-% if x{n} is a scalar
-%--------------------------------------------------------------------------
-if length(xm) == 1
- J = pr_spm_cat(J);
- return
-end
-
-% else f and xm are vectors return numeric array
-%--------------------------------------------------------------------------
-for i = 1:length(J)
- J{i} = pr_spm_vec(J{i});
-end
-J = pr_spm_cat(J);
-return
-
-function dfdx = pr_spm_dfdx(f,f0,dx)
-% cell subtraction
-%--------------------------------------------------------------------------
-if iscell(f)
- dfdx = f;
- for i = 1:length(f(:))
- dfdx{i} = pr_spm_dfdx(f{i},f0{i},dx);
- end
-else
- dfdx = (f - f0)/dx;
-end
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_en.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_en.m
deleted file mode 100644
index 1b91afa..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_en.m
+++ /dev/null
@@ -1,18 +0,0 @@
-function [X] = pr_spm_en(X)
-% Euclidean normalization
-% FORMAT [X] = pr_spm_en(X);
-% X - matrix
-%_______________________________________________________________________
-%
-% spm_en performs a Euclidean normalization setting column-wise sum of
-% squares to unity
-%_______________________________________________________________________
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% Karl Friston
-% $Id: spm_en.m 112 2005-05-04 18:20:52Z john $
-
-
-for i = 1:size(X,2)
- X(:,i) = X(:,i)/sqrt(sum(X(:,i).^2));
-end
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_fileparts.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_fileparts.m
deleted file mode 100644
index cdb45a5..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_fileparts.m
+++ /dev/null
@@ -1,23 +0,0 @@
-function [pth,nam,ext,num] = spm_fileparts(fname)
-% Like fileparts, but separates off a comma separated list at the end
-% FORMAT [pth,nam,ext,num] = spm_fileparts(fname)
-% fname - original filename
-% pth - path
-% nam - filename
-% ext - extension
-% num - comma separated list of values
-%
-%_______________________________________________________________________
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% John Ashburner
-% $Id: spm_fileparts.m 112 2005-05-04 18:20:52Z john $
-
-
-num = '';
-[pth,nam,ext] = fileparts(fname);
-ind = find(ext==',');
-if ~isempty(ind),
- num = ext(ind(1):end);
- ext = ext(1:(ind(1)-1));
-end;
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_filter.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_filter.m
deleted file mode 100644
index a3f756d..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_filter.m
+++ /dev/null
@@ -1,90 +0,0 @@
-function [argout] = pr_spm_filter(K,Y)
-% Removes low frequency confounds X0
-% FORMAT [Y] = pr_spm_filter(K,Y)
-% FORMAT [K] = pr_spm_filter(K)
-%
-% K - filter matrix or:
-% K(s) - struct array containing partition-specific specifications
-%
-% K(s).RT - observation interval in seconds
-% K(s).row - row of Y constituting block/partition s
-% K(s).HParam - cut-off period in seconds
-%
-% K(s).X0 - low frequencies to be removed (DCT)
-%
-% Y - data matrix
-%
-% K - filter structure
-% Y - filtered data
-%___________________________________________________________________________
-%
-% spm_filter implements high-pass filtering in an efficient way by
-% using the residual forming matrix of X0 - low frequency confounds
-%.spm_filter also configures the filter structure in accord with the
-% specification fields if called with one argument
-%___________________________________________________________________________
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% Karl Friston
-% $Id: spm_filter.m 184 2005-05-31 13:23:32Z john $
-
-
-
-% set or apply
-%---------------------------------------------------------------------------
-if nargin == 1 && isstruct(K)
-
- % set K.X0
- %-------------------------------------------------------------------
- for s = 1:length(K)
-
- % make high pass filter
- %-----------------------------------------------------------
- k = length(K(s).row);
- n = fix(2*(k*K(s).RT)/K(s).HParam + 1);
- X0 = spm_dctmtx(k,n);
- K(s).X0 = X0(:,2:end);
- end
-
- % return structure
- %-------------------------------------------------------------------
- argout = K;
-
-else
- % apply
- %-------------------------------------------------------------------
- if isstruct(K)
-
- % ensure requisite feilds are present
- %-----------------------------------------------------------
- if ~isfield(K(1),'X0')
- K = pr_spm_filter(K);
- end
-
- for s = 1:length(K)
-
- % select data
- %---------------------------------------------------
- y = Y(K(s).row,:);
-
- % apply high pass filter
- %---------------------------------------------------
- y = y - K(s).X0*(K(s).X0'*y);
-
- % reset filtered data in Y
- %---------------------------------------------------
- Y(K(s).row,:) = y;
-
- end
-
- % K is simply a filter matrix
- %-------------------------------------------------------------------
- else
- Y = K*Y;
- end
-
- % return filtered data
- %-------------------------------------------------------------------
- %if any(~isfinite(Y)), warning('Found non-finite values in Y (could be the data).'); end;
- argout = Y;
-end
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_get_bf.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_get_bf.m
deleted file mode 100644
index 9f2cc0b..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_get_bf.m
+++ /dev/null
@@ -1,180 +0,0 @@
-function [xBF] = pr_spm_get_bf(xBF)
-% fills in basis function structure
-% FORMAT [xBF] = spm_get_bf(xBF);
-%
-% xBF.dt - time bin length {seconds}
-% xBF.name - description of basis functions specified
-% xBF.length - window length (secs)
-% xBF.order - order
-% xBF.bf - Matrix of basis functions
-%
-% xBF.name 'hrf'
-% 'hrf (with time derivative)'
-% 'hrf (with time and dispersion derivatives)'
-% 'Fourier set'
-% 'Fourier set (Hanning)'
-% 'Gamma functions'
-% 'Finite Impulse Response'};
-%
-% (any other specifiaction will default to hrf)
-%_______________________________________________________________________
-%
-% spm_get_bf prompts for basis functions to model event or epoch-related
-% responses. The basis functions returned are unitary and orthonormal
-% when defined as a function of peri-stimulus time in time-bins.
-% It is at this point that the distinction between event and epoch-related
-% responses enters.
-%_______________________________________________________________________
-% @(#)spm_get_bf.m 2.22 Karl Friston 02/04/19
-
-%-GUI setup
-%-----------------------------------------------------------------------
-spm_help('!ContextHelp',mfilename)
-
-% length of time bin
-%-----------------------------------------------------------------------
-if ~nargin
- str = 'time bin for basis functions {secs}';
- xBF.dt = spm_input(str,'+1','r',1/16,1);
-end
-dt = xBF.dt;
-
-
-% assemble basis functions
-%=======================================================================
-
-% model event-related responses
-%-----------------------------------------------------------------------
-if ~isfield(xBF,'name')
- spm_input('Hemodynamic Basis functions...',1,'d')
- Ctype = {
- 'hrf',...
- 'hrf (with time derivative)',...
- 'hrf (with time and dispersion derivatives)',...
- 'Fourier set',...
- 'Fourier set (Hanning)',...
- 'Gamma functions',...
- 'Finite Impulse Response'};
- str = 'Select basis set';
- Sel = spm_input(str,2,'m',Ctype);
- xBF.name = Ctype{Sel};
-end
-
-% get order and length parameters
-%-----------------------------------------------------------------------
-switch xBF.name
-
- case { 'Fourier set','Fourier set (Hanning)',...
- 'Gamma functions','Finite Impulse Response'}
- %---------------------------------------------------------------
- try, l = xBF.length;
- catch, l = spm_input('window length {secs}',3,'e',32);
- xBF.length = l;
- end
- try, h = xBF.order;
- catch, h = spm_input('order',4,'e',4);
- xBF.order = h;
- end
-end
-
-
-
-% create basis functions
-%-----------------------------------------------------------------------
-switch xBF.name
-
- case {'Fourier set','Fourier set (Hanning)'}
- %---------------------------------------------------------------
- pst = [0:dt:l]';
- pst = pst/max(pst);
-
- % hanning window
- %---------------------------------------------------------------
- if strcmp(xBF.name,'Fourier set (Hanning)')
- g = (1 - cos(2*pi*pst))/2;
- else
- g = ones(size(pst));
- end
-
- % zeroth and higher Fourier terms
- %---------------------------------------------------------------
- bf = g;
- for i = 1:h
- bf = [bf g.*sin(i*2*pi*pst)];
- bf = [bf g.*cos(i*2*pi*pst)];
- end
-
- case {'Gamma functions'}
- %---------------------------------------------------------------
- pst = [0:dt:l]';
- bf = spm_gamma_bf(pst,h);
-
- case {'Finite Impulse Response'}
- %---------------------------------------------------------------
- bin = l/h;
- bf = kron(eye(h),ones(round(bin/dt),1));
-
- case {'NONE'} % innovation from SPM5
- %---------------------------------------------------------------
- bf = 1;
-
-otherwise
-
- % canonical hemodynaic response function
- %---------------------------------------------------------------
- [bf p] = pr_spm_hrf(dt);
-
- % add time derivative
- %---------------------------------------------------------------
- if findstr(xBF.name,'time')
-
- dp = 1;
- p(6) = p(6) + dp;
- D = (bf(:,1) - pr_spm_hrf(dt,p))/dp;
- bf = [bf D(:)];
- p(6) = p(6) - dp;
-
- % add dispersion derivative
- %--------------------------------------------------------
- if findstr(xBF.name,'dispersion')
-
- dp = 0.01;
- p(3) = p(3) + dp;
- D = (bf(:,1) - pr_spm_hrf(dt,p))/dp;
- bf = [bf D(:)];
- end
- end
-
- % length and order
- %---------------------------------------------------------------
- xBF.length = size(bf,1)*dt;
- xBF.order = size(bf,2);
-
-end
-
-
-% Orthogonalize and fill in basis function structure
-%------------------------------------------------------------------------
-xBF.bf = pr_spm_orth(bf);
-
-
-%=======================================================================
-%- S U B - F U N C T I O N S
-%=======================================================================
-
-% compute Gamma functions functions
-%-----------------------------------------------------------------------
-function bf = spm_gamma_bf(u,h)
-% returns basis functions used for Volterra expansion
-% FORMAT bf = spm_gamma_bf(u,h);
-% u - times {seconds}
-% h - order
-% bf - basis functions (mixture of Gammas)
-%_______________________________________________________________________
-u = u(:);
-bf = [];
-for i = 2:(1 + h)
- m = 2^i;
- s = sqrt(m);
- bf = [bf pr_spm_gpdf(u,(m/s)^2,m/s^2)];
-end
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_get_ons.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_get_ons.m
deleted file mode 100644
index 1b08001..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_get_ons.m
+++ /dev/null
@@ -1,263 +0,0 @@
-function [U] = pr_spm_get_ons(SPM,s)
-% returns input [designed effects] structures
-% FORMAT [U] = spm_get_ons(SPM,s)
-%
-% s - session number (used by batch system)
-%
-% U - (1 x n) struct array of (n) trial-specific structures
-%
-% U(i).name - cell of names for each input or cause
-% U(i).u - inputs or stimulus function matrix
-% U(i).dt - time bin (seconds)
-% U(i).ons - onsets (in SPM.xBF.UNITS)
-% U(i).dur - durations (in SPM.xBF.UNITS)
-% U(i).P - parameter struct.
-%
-% U(i).P(p).name - parameter name
-% U(i).P(p).P - parameter vector
-% U(i).P(p).h - order of polynomial expansion
-% U(i).P(p).i - sub-indices of u pertaining to P
-%_______________________________________________________________________
-%
-%
-% SLICE TIMIING
-%
-% With longs TRs you may want to shift the regressors so that they are
-% aligned to a particular slice. This is effected by resetting the
-% values of defaults.stats.fmri.t and defaults.stats.fmri.t0 in
-% spm_defaults. defaults.stats.fmri.t is the number of time-bins per
-% scan used when building regressors. Onsets are defined
-% in temporal units of scans starting at 0. defaults.stats.fmri.t0 is
-% the first time-bin at which the regressors are resampled to coincide
-% with data acquisition. If defaults.stats.fmri.t0 = 1 then the
-% regressors will be appropriate for the first slice. If you want to
-% temporally realign the regressors so that they match responses in the
-% middle slice then make defaults.stats.fmri.t0 =
-% defaults.stats.fmri.t/2 (assuming there is a negligible gap between
-% volume acquisitions. Default values are defaults.stats.fmri.t = 16
-% and defaults.stats.fmri.t0 = 1.
-%
-%
-%_______________________________________________________________________
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% Karl Friston
-% $Id: spm_get_ons.m 444 2006-02-17 19:43:17Z klaas $
-
-
-%-GUI setup
-%-----------------------------------------------------------------------
-spm_help('!ContextHelp',mfilename)
-
-% time units
-%-----------------------------------------------------------------------
-k = SPM.nscan(s);
-T = SPM.xBF.T;
-dt = SPM.xBF.dt;
-try
- UNITS = SPM.xBF.UNITS;
-catch
- UNITS = 'scans';
-end
-switch UNITS
-
- case 'scans'
- %----------------------------------------------------------------
- TR = T*dt;
-
- case 'secs'
- %----------------------------------------------------------------
- TR = 1;
-end
-
-% get inputs and names (try SPM.Sess(s).U first)
-%=======================================================================
-try
- U = SPM.Sess(s).U;
- v = length(U);
-catch
-
- %-prompt string
- %---------------------------------------------------------------
- str = sprintf('Session %d: trial specification in %s',s,UNITS);
- spm_input(str,1,'d')
-
- U = {};
- v = spm_input('number of conditions/trials',2,'w1');
-end
-
-% get trials
-%-----------------------------------------------------------------------
-for i = 1:v
-
- % get names
- %---------------------------------------------------------------
- try
- Uname = U(i).name(1);
- catch
- str = sprintf('name for condition/trial %d ?',i);
- Uname = {spm_input(str,3,'s',sprintf('trial %d',i))};
- U(i).name = Uname;
- end
-
- % get main [trial] effects
- %================================================================
-
- % onsets
- %---------------------------------------------------------------
- try
- ons = U(i).ons;
- ons = ons(:);
- catch
- ons = [];
- end
- if ~length(ons)
- str = ['vector of onsets - ' Uname{1}];
- ons = spm_input(str,4,'r',' ',[Inf 1]);
- U(i).ons = ons(:);
-
- end
-
- % durations
- %---------------------------------------------------------------
- try
- dur = U(i).dur;
- dur = dur(:);
- catch
- dur = [];
- end
- if ~length(dur)
- str = 'duration[s] (events = 0)';
- while 1
- dur = spm_input(str,5,'r',' ',[Inf 1]);
- if length(dur) == 1
- dur = dur*ones(size(ons));
- end
- if length(dur) == length(ons), break, end
- str = sprintf('enter a scalar or [%d] vector',...
- length(ons));
- end
- U(i).dur = dur;
- end
-
- % peri-stimulus times {seconds}
- %---------------------------------------------------------------
- pst = [1:k]*T*dt - ons(1)*TR;
- for j = 1:length(ons)
- w = [1:k]*T*dt - ons(j)*TR;
- v = find(w >= -1);
- pst(v) = w(v);
- end
-
-
- % add parameters x trial interactions
- %================================================================
-
- % get parameter stucture xP
- %----------------------------------------------------------------
- try
- xP = U(i).P;
- Pname = xP(1).name;
-
- switch Pname
-
- case 'none'
- %------------------------------------------------
- xP.name = 'none';
- xP.h = 0;
-
- end
-
- catch
-
- Pname = {'none','time','other'};
- Pname = spm_input('parametric modulation',6,'b',Pname);
-
- switch Pname
-
- case 'none'
- %--------------------------------------------------------
- xP(1).name = 'none';
- xP(1).h = 0;
-
- case 'time'
- %--------------------------------------------------------
- xP(1).name = 'time';
- xP(1).P = ons*TR;
- xP(1).h = spm_input('polynomial order',8,'n1',1);
-
- case 'other'
- %--------------------------------------------------------
- str = ['# parameters (' Uname{1} ')'];
- for q = 1:spm_input(str,7,'n1',1);
-
- % get names and parametric variates
- %------------------------------------------------
- str = sprintf('parameter %d name',q);
- Pname = spm_input(str,7,'s');
- P = spm_input(Pname,7,'r',[],[length(ons),1]);
-
- % order of polynomial expansion h
- %------------------------------------------------
- h = spm_input('polynomial order',8,'n1',1);
-
- % sub-indices and inputs
- %------------------------------------------------
- xP(q).name = Pname;
- xP(q).P = P(:);
- xP(q).h = h;
-
- end
- end % switch
-
- end % try
-
- % interaction with causes (u) - 1st = main effects
- %----------------------------------------------------------------
- u = ons.^0;
- for q = 1:length(xP)
- xP(q).i = [1, ([1:xP(q).h] + size(u,2))];
- for j = 1:xP(q).h
- u = [u xP(q).P.^j];
- str = sprintf('%sx%s^%d',Uname{1},xP(q).name,j);
- Uname{end + 1} = str;
- end
- end
-
- % orthogonalize inputs
- %---------------------------------------------------------------
- u = pr_spm_orth(u);
-
- % and scale so sum(u*dt) = number of events, if event-related
- %---------------------------------------------------------------
- if ~any(dur)
- u = u/dt;
- end
-
- % create stimulus functions (32 bin offset)
- %===============================================================
- ton = round(ons*TR/dt) + 32; % onsets
- tof = round(dur*TR/dt) + ton + 1; % offset
- sf = sparse((k*T + 128),size(u,2));
- ton = max(ton,1);
- tof = max(tof,1);
- for j = 1:length(ton)
- if numel(sf)>ton(j),
- sf(ton(j),:) = sf(ton(j),:) + u(j,:);
- end;
- if numel(sf)>tof(j),
- sf(tof(j),:) = sf(tof(j),:) - u(j,:);
- end;
- end
- sf = cumsum(sf); % integrate
- sf = sf(1:(k*T + 32),:); % stimulus
-
- % place in ouputs structure
- %---------------------------------------------------------------
- U(i).name = Uname; % - input names
- U(i).dt = dt; % - time bin {seconds}
- U(i).u = sf; % - stimulus function matrix
- U(i).pst = pst; % - pst (seconds)
- U(i).P = xP; % - parameter struct
-
-end % (v)
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_gpdf.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_gpdf.m
deleted file mode 100644
index 9732df3..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_gpdf.m
+++ /dev/null
@@ -1,98 +0,0 @@
-function f = pr_spm_gpdf(x,h,l)
-% Probability Density Function (PDF) of Gamma distribution
-% FORMAT f = pr_spm_Gpdf(g,h,l)
-%
-% x - Gamma-variate (Gamma has range [0,Inf) )
-% h - Shape parameter (h>0)
-% l - Scale parameter (l>0)
-% f - PDF of Gamma-distribution with shape & scale parameters h & l
-%_______________________________________________________________________
-%
-% spm_Gpdf implements the Probability Density Function of the Gamma
-% distribution.
-%
-% Definition:
-%-----------------------------------------------------------------------
-% The PDF of the Gamma distribution with shape parameter h and scale l
-% is defined for h>0 & l>0 and for x in [0,Inf) by: (See Evans et al.,
-% Ch18, but note that this reference uses the alternative
-% parameterisation of the Gamma with scale parameter c=1/l)
-%
-% l^h * x^(h-1) exp(-lx)
-% f(x) = ---------------------
-% gamma(h)
-%
-% Variate relationships: (Evans et al., Ch18 & Ch8)
-%-----------------------------------------------------------------------
-% For natural (strictly +ve integer) shape h this is an Erlang distribution.
-%
-% The Standard Gamma distribution has a single parameter, the shape h.
-% The scale taken as l=1.
-%
-% The Chi-squared distribution with v degrees of freedom is equivalent
-% to the Gamma distribution with scale parameter 1/2 and shape parameter v/2.
-%
-% Algorithm:
-%-----------------------------------------------------------------------
-% Direct computation using logs to avoid roundoff errors.
-%
-% References:
-%-----------------------------------------------------------------------
-% Evans M, Hastings N, Peacock B (1993)
-% "Statistical Distributions"
-% 2nd Ed. Wiley, New York
-%
-% Abramowitz M, Stegun IA, (1964)
-% "Handbook of Mathematical Functions"
-% US Government Printing Office
-%
-% Press WH, Teukolsky SA, Vetterling AT, Flannery BP (1992)
-% "Numerical Recipes in C"
-% Cambridge
-%_______________________________________________________________________
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% Andrew Holmes
-% $Id: spm_Gpdf.m 112 2005-05-04 18:20:52Z john $
-
-
-%-Format arguments, note & check sizes
-%-----------------------------------------------------------------------
-if nargin<3, error('Insufficient arguments'), end
-
-ad = [ndims(x);ndims(h);ndims(l)];
-rd = max(ad);
-as = [ [size(x),ones(1,rd-ad(1))];...
- [size(h),ones(1,rd-ad(2))];...
- [size(l),ones(1,rd-ad(3))] ];
-rs = max(as);
-xa = prod(as,2)>1;
-if sum(xa)>1 & any(any(diff(as(xa,:)),1))
- error('non-scalar args must match in size'), end
-
-%-Computation
-%-----------------------------------------------------------------------
-%-Initialise result to zeros
-f = zeros(rs);
-
-%-Only defined for strictly positive h & l. Return NaN if undefined.
-md = ( ones(size(x)) & h>0 & l>0 );
-if any(~md(:)), f(~md) = NaN;
- warning('Returning NaN for out of range arguments'), end
-
-%-Degenerate cases at x==0: h<1 => f=Inf; h==1 => f=l; h>1 => f=0
-ml = ( md & x==0 & h<1 );
-f(ml) = Inf;
-ml = ( md & x==0 & h==1 ); if xa(3), mll=ml; else mll=1; end
-f(ml) = l(mll);
-
-%-Compute where defined and x>0
-Q = find( md & x>0 );
-if isempty(Q), return, end
-if xa(1), Qx=Q; else Qx=1; end
-if xa(2), Qh=Q; else Qh=1; end
-if xa(3), Ql=Q; else Ql=1; end
-
-%-Compute
-f(Q) = exp( (h(Qh)-1).*log(x(Qx)) +h(Qh).*log(l(Ql)) - l(Ql).*x(Qx)...
- -gammaln(h(Qh)) );
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_hrf.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_hrf.m
deleted file mode 100644
index 7054602..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_hrf.m
+++ /dev/null
@@ -1,48 +0,0 @@
-function [hrf,p] = pr_spm_hrf(RT,P);
-% returns a hemodynamic response function
-% FORMAT [hrf,p] = pr_spm_hrf(RT,[p]);
-% RT - scan repeat time
-% p - parameters of the response function (two gamma functions)
-%
-% defaults
-% (seconds)
-% p(1) - delay of response (relative to onset) 6
-% p(2) - delay of undershoot (relative to onset) 16
-% p(3) - dispersion of response 1
-% p(4) - dispersion of undershoot 1
-% p(5) - ratio of response to undershoot 6
-% p(6) - onset (seconds) 0
-% p(7) - length of kernel (seconds) 32
-%
-% hrf - hemodynamic response function
-% p - parameters of the response function
-%_______________________________________________________________________
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% Karl Friston
-% $Id: spm_hrf.m 387 2005-12-17 18:31:23Z klaas $
-
-
-% global parameter
-%-----------------------------------------------------------------------
-global defaults
-try
- fMRI_T = defaults.stats.fmri.t;
-catch
- fMRI_T = 16;
-end;
-
-% default parameters
-%-----------------------------------------------------------------------
-p = [6 16 1 1 6 0 32];
-if nargin > 1
- p(1:length(P)) = P;
-end
-
-% modelled hemodynamic response function - {mixture of Gammas}
-%-----------------------------------------------------------------------
-dt = RT/fMRI_T;
-u = [0:(p(7)/dt)] - p(6)/dt;
-hrf = pr_spm_gpdf(u,p(1)/p(3),dt/p(3)) - pr_spm_gpdf(u,p(2)/p(4),dt/p(4))/p(5);
-hrf = hrf([0:(p(7)/RT)]*fMRI_T + 1);
-hrf = hrf'/sum(hrf);
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_justify.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_justify.m
deleted file mode 100644
index 47e5299..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_justify.m
+++ /dev/null
@@ -1,161 +0,0 @@
-function out = pr_spm_justify(n,varargin)
-% Justify text
-% FORMAT out = justify(n,txt)
-% out - a cell array of lines of text
-% n - line length
-% txt - a text string or a cell array of text strings
-%
-% If txt is a cell array, then each element is treated
-% as a paragraph and justified, otherwise the string is
-% treated as a paragraph and is justified.
-% Non a-z or A-Z characters at the start of a paragraph
-% are used to define any indentation required (such as
-% for enumeration, bullets etc. If less than one line
-% of text is returned, then no formatting is done.
-%
-% Example usage:
-%
-% out = pr_spm_justify(40,{['Statistical Parametric ',...
-% 'Mapping refers to the construction and ',...
-% 'assessment of spatially extended ',...
-% 'statistical process used to test hypotheses ',...
-% 'about [neuro]imaging data from SPECT/PET & ',...
-% 'fMRI. These ideas have been instantiated ',...
-% 'in software that is called SPM']});
-% strvcat(out{:})
-%
-%------------------------------------------------------------------------
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% John Ashburner
-% $Id: spm_justify.m 232 2005-09-15 19:02:59Z john $
-
-out = {};
-for i=1:nargin-1,
- if iscell(varargin{i}),
- for j=1:numel(varargin{i}),
- para = justify_paragraph(n,varargin{i}{j});
- out = {out{:},para{:}};
- end;
- else
- para = justify_paragraph(n,varargin{i});
- out = {out{:},para{:}};
- end;
-end;
-
-function out = justify_paragraph(n,txt)
-if numel(txt)>1 && txt(1)=='%',
- txt = txt(2:end);
-end;
-%txt = regexprep(txt,'/\*([^(/\*)]*)\*/','');
-st1 = findstr(txt,'/*');
-en1 = findstr(txt,'*/');
-st = [];
-en = [];
-for i=1:numel(st1),
- en1 = en1(en1>st1(i));
- if ~isempty(en1),
- st = [st st1(i)];
- en = [en en1(1)];
- en1 = en1(2:end);
- end;
-end;
-
-str = [];
-pen = 1;
-for i=1:numel(st),
- str = [str txt(pen:st(i)-1)];
- pen = en(i)+2;
-end;
-str = [str txt(pen:numel(txt))];
-txt = str;
-
-off = find((txt'>='a' & txt'<='z') | (txt'>='A' & txt'<='Z'));
-off = off(off1,
- out{1} = [txt(1:(off-1)) para{1}];
- for j=2:numel(para),
- out{j} = [repmat(' ',1,off-1) para{j}];
- end;
- else
- out{1} = txt;
- end;
-end;
-return;
-
-function out = justify_para(n,varargin)
-% Collect varargs into a single string
-str = varargin{1};
-for i=2:length(varargin),
- str = [str ' ' varargin{i}];
-end;
-
-if isempty(str), out = {''}; return; end;
-
-% Remove repeats
-sp = find(str==' ');
-rep = sp(diff(sp)==1);
-str(rep) = [];
-if str(1) ==' ', str(1) = ''; end;
-if str(end)==' ', str(end) = ''; end;
-
-out = {};
-while length(str)>n,
-
- % Break the string into lines
- sp = find(str==' ');
- brk = sp(sp<=n);
- if isempty(brk),
- if isempty(sp),
- brk = length(str)+1;
- else
- brk = sp(1);
- end;
- else
- brk = brk(end);
- end;
-
- % Pad the line to n characters wide
- current = str(1:(brk-1));
- % l = length(current);
- % l = n-l;
- sp = find(current==' ');
- if ~isempty(sp),
-
- % Break into words
- sp = [sp length(current)+1];
- words = {current(1:(sp(1)-1))};
- for i=1:(length(sp)-1),
- words = {words{:}, current((sp(i)+1):(sp(i+1)-1))};
- end;
-
- % Figure out how much padding on average
- nsp = length(sp)-1;
- pad = (n-(length(current)-nsp))/nsp;
-
- % Pad all spaces by the same integer amount
- sp = repmat(floor(pad),1,nsp);
-
- % Pad a random selection of spaces by one
- pad = round((pad-floor(pad))*nsp);
- [unused,ind] = sort(rand(pad,1));
- ind = ind(1:pad);
- sp(ind) = sp(ind)+1;
-
- % Re-construct line from individual words
- current = words{1};
- for i=2:length(words),
- current = [current repmat(' ',1,sp(i-1)) words{i}];
- end;
- end;
-
- out = {out{:},current};
- str = str((brk+1):end);
-end;
-
-out = {out{:},str};
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_logdet.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_logdet.m
deleted file mode 100644
index 52a0ea5..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_logdet.m
+++ /dev/null
@@ -1,40 +0,0 @@
-function [H] = pr_spm_logdet(C)
-% returns the log of the determinant of positive semi-definite matrix C
-% FORMAT [H] = pr_spm_logdet(C)
-% H = log(det(C))
-%
-% spm_logdet is a computationally efficient operator that can deal with
-% sparse matrices
-%_______________________________________________________________________
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% Karl Friston
-% $Id: spm_logdet.m 309 2005-11-24 16:24:04Z karl $
-
-% assume diagonal form
-%-----------------------------------------------------------------------
-TOL = 1e-8; % c.f. n*max(s)*eps
-n = length(C);
-s = diag(C);
-i = find(s > TOL & s < 1/TOL);
-C = C(i,i);
-H = sum(log(diag(C)));
-
-% invoke det if non-diagonal
-%-----------------------------------------------------------------------
-w = warning;
-warning off
-[i j] = find(C);
-if any(i ~= j)
- n = length(C);
- a = exp(H/n);
- H = H + log(det(C/a));
-end
-warning(w)
-
-% invoke svd is rank deficient
-%-----------------------------------------------------------------------
-if imag(H) | isinf(H)
- s = svd(full(C));
- H = sum(log(s(s > TOL & s < 1/TOL)));
-end
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_non_sphericity.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_non_sphericity.m
deleted file mode 100644
index aef5930..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_non_sphericity.m
+++ /dev/null
@@ -1,112 +0,0 @@
-function [xVi] = pr_spm_non_sphericity(xVi)
-% return error covariance constraints for basic ANOVA designs
-% FORMAT [xVi] = pr_spm_non_sphericity(xVi)
-%
-% required fields:
-% xVi.I - n x 4 matrix of factor level indicators
-% I(n,i) is the level of factor i for observation n
-% xVi.var - 1 x 4 vector of flags
-% var(i) = 1; different variance among levels of factor i
-% xVi.dep - 1 x 4 vector of flags
-% dep(i) = 1; dependencies within levels of factor i
-%
-% Output:
-% xVi.Vi - cell of covariance components
-% or
-% xVi.V - speye(n,n)
-%
-% See also; pr_spm_Ce.m & pr_spm_ui.m
-%___________________________________________________________________________
-% Non-sphericity specification
-% =========================
-%
-% In some instances the i.i.d. assumptions about the errors do not hold:
-%
-% Identity assumption:
-% The identity assumption, of equal error variance (homoscedasticity), can
-% be violated if the levels of a factor do not have the same error variance.
-% For example, in a 2nd-level analysis of variance, one contrast may be scaled
-% differently from another. Another example would be the comparison of
-% qualitatively different dependant variables (e.g. normals vs. patients). If
-% You say no to identity assumptions, you will be asked whether the error
-% variance is the same over levels of each factor. Different variances
-% (heteroscedasticy) induce different error covariance components that
-% are estimated using restricted maximum likelihood (see below).
-%
-% Independence assumption.
-% In some situations, certain factors may contain random effects. These induce
-% dependencies or covariance components in the error terms. If you say no
-% to independence assumptions, you will be asked whether random effects
-% should be modelled for each factor. A simple example of this would be
-% modelling the random effects of subject. These cause correlations among the
-% error terms of observation from the same subject. For simplicity, it is
-% assumed that the random effects of each factor are i.i.d.
-%
-% ReML
-% The ensuing covariance components will be estimated using ReML in spm_spm
-% (assuming the same for all responsive voxels) and used to adjust the
-% statistics and degrees of freedom during inference. By default spm_spm
-% will use weighted least squares to produce Gauss-Markov or Maximum
-% likelihood estimators using the non-sphericity structure specified at this
-% stage. The components will be found in xX.xVi and enter the estimation
-% procedure exactly as the serial correlations in fMRI models.
-%
-%___________________________________________________________________________
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% Karl Friston
-% $Id: spm_non_sphericity.m 112 2005-05-04 18:20:52Z john $
-
-
-% create covariance components Q{:}
-%===========================================================================
-[n f] = size(xVi.I); % # observations, % # Factors
-l = max(xVi.I); % levels
-
-% if var(i): add variance component for each level of factor i,
-%---------------------------------------------------------------------------
-Q = {};
-for i = find(xVi.var)
- for j = 1:l(i)
- u = xVi.I(:,i) == j;
- q = spdiags(u,0,n,n);
- Q{end + 1} = q;
- end
-end
-
-% effects (discounting factors with dependencies) as defined by interactions
-%---------------------------------------------------------------------------
-X = ones(n,1);
-for i = find(~xVi.dep & (l > 1))
- Xi = sparse(1:n,xVi.I(:,i),1,n,l(i));
- Xj = X;
- X = sparse(n,0);
- for j = 1:size(Xi,2)
- for k = 1:size(Xj,2)
- X(:,end + 1) = Xi(:,j) & Xj(:,k);
- end
- end
-end
-
-% dependencies among repeated measures created by the hadamrad product %---------------------------------------------------------------------------
-for i = find(xVi.dep)
- q = sparse(1:n,xVi.I(:,i),1,n,l(i));
- P = q*q';
- for j = 1:size(X,2)
- for k = (j + 1):size(X,2)
- Q{end + 1} = (X(:,j)*X(:,k)' + X(:,k)*X(:,j)').*P;
- end
- end
-end
-
-% set Q in non-sphericity structure
-%---------------------------------------------------------------------------
-
-
-% if i.i.d nonsphericity (V) is known otherwise there are components {Vi}
-%---------------------------------------------------------------------------
-if length(Q) > 1
- xVi.Vi = Q;
-else
- xVi.V = speye(n,n);
-end
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_orth.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_orth.m
deleted file mode 100644
index 9bd86a9..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_orth.m
+++ /dev/null
@@ -1,20 +0,0 @@
-function x = pr_spm_orth(X)
-% recursive orthogonalization of basis functions
-% FORMAT x = pr_spm_orth(X)
-%
-% serial orthogionalization starting with the first column
-%_______________________________________________________________________
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% Karl Friston
-% $Id: spm_orth.m 112 2005-05-04 18:20:52Z john $
-
-
-x = X(:,1);
-for i = 2:size(X,2)
- D = X(:,i);
- D = D - x*(pinv(x)*D);
- if any(D)
- x = [x D];
- end
-end
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_q.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_q.m
deleted file mode 100644
index 267c4cf..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_q.m
+++ /dev/null
@@ -1,41 +0,0 @@
-function [Q] = pr_spm_q(A,n)
-% returns an (n x n) autocorrelation matrix for an AR(p) process
-% FORMAT [Q] = pr_spm_q(A,n)
-%
-% A - vector pf p AR coeficients
-% n - size of Q
-%__________________________________________________________________________
-% spm_Q uses a Yule-Walker device to compute K where:
-%
-% y = K*z
-%
-% such that y is an AR(n) process generated from an i.i.d innovation
-% z. This means
-%
-% cov(y) = = K*K'
-%
-% Critically, this is not the correlation because if cov(z) = eye(n)
-% then trace(cov(y)) ~= n. This is why the normalization is required
-%
-% corr(y) = D*K*K'*D';
-%
-% The reason the diagonals of corr(y) are not constant is that we
-% are modeling finite length AR sequences, which incur boundary effects
-% at the beginning and end of the sequence.
-%__________________________________________________________________________
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% Karl Friston
-% $Id: spm_Q.m 372 2005-12-08 17:12:13Z karl $
-
-
-% compute Q
-%--------------------------------------------------------------------------
-p = length(A);
-A = [1 -A(:)'];
-K = inv(spdiags(ones(n,1)*A,-[0:p],n,n));
-K = K.*(abs(K) > 1e-4);
-Q = K*K';
-D = spdiags(sqrt(1./diag(Q)),0,n,n);
-Q = D*Q*D;
-Q = Q.*(abs(Q) > 1e-4);
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_reml.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_reml.m
deleted file mode 100644
index bf75d59..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_reml.m
+++ /dev/null
@@ -1,172 +0,0 @@
-function [C,h,Ph,F] = pr_spm_reml(YY,X,Q,N,OPT);
-% ReML estimation of covariance components from y*y'
-% FORMAT [C,h,Ph,F] = pr_spm_reml(YY,X,Q,N,[OPT]);
-%
-% YY - (m x m) sample covariance matrix Y*Y' {Y = (m x N) data matrix}
-% X - (m x p) design matrix
-% Q - {1 x q} covariance components
-% N - number of samples
-%
-% OPT = 1 : log-normal hyper-parameterisation (with hyperpriors)
-%
-% C - (m x m) estimated errors = h(1)*Q{1} + h(2)*Q{2} + ...
-% h - (q x 1) ReML hyperparameters h
-% Ph - (q x q) conditional precision of h [or log(h), if OPT(1)]
-%
-% F - [-ve] free energy F = log evidence = p(Y|X,Q) = ReML objective
-%
-% Performs a Fisher-Scoring ascent on F to find ReML variance parameter
-% estimates.
-%__________________________________________________________________________
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% John Ashburner & Karl Friston
-% $Id: spm_reml.m 456 2006-02-22 18:46:29Z karl $
-
-% assume a single sample if not specified
-%--------------------------------------------------------------------------
-try
- N;
-catch
- N = 1;
-end
-
-% assume OPT = [0 0]
-%--------------------------------------------------------------------------
-try
- OPT;
-catch
- OPT = 0;
-end
-
-% ortho-normalise X
-%--------------------------------------------------------------------------
-if isempty(X)
- X = sparse(length(Q{1}),1);
-end
-X = orth(full(X));
-[n p] = size(X);
-
-% initialise h
-%--------------------------------------------------------------------------
-m = length(Q);
-h = zeros(m,1);
-dh = zeros(m,1);
-dFdh = zeros(m,1);
-dFdhh = zeros(m,m);
-
-
-% initialise and specify hyperpriors
-%--------------------------------------------------------------------------
-if OPT
- hP = eye(m,m)/32;
- hE = h - 32;
- for i = 1:m
- h(i) = -log(normest(Q{i}));
- end
-else
- hE = zeros(m,1);
- hP = zeros(m,m);
- for i = 1:m
- h(i) = any(diag(Q{i}));
- end
-end
-
-
-% ReML (EM/VB)
-%--------------------------------------------------------------------------
-for k = 1:64
-
- % compute current estimate of covariance
- %----------------------------------------------------------------------
- C = sparse(n,n);
- for i = 1:m
- if OPT
- C = C + Q{i}*exp(h(i));
- else
- C = C + Q{i}*h(i);
- end
- end
- iC = inv(C);
-
- % E-step: conditional covariance cov(B|y) {Cq}
- %======================================================================
- iCX = iC*X;
- Cq = pinv(X'*iCX);
- XCXiC = X*Cq*iCX';
-
- % M-step: ReML estimate of hyperparameters
- %======================================================================
-
- % Gradient dF/dh (first derivatives)
- %----------------------------------------------------------------------
- P = iC - iC*XCXiC;
- U = speye(n) - P*YY/N;
- for i = 1:m
-
- % dF/dh = -trace(dF/diC*iC*Q{i}*iC)
- %------------------------------------------------------------------
- PQ{i} = P*Q{i};
- if OPT
- PQ{i} = PQ{i}*exp(h(i));
- end
- dFdh(i) = -trace(PQ{i}*U)*N/2;
-
- end
-
- % Expected curvature E{dF/dhh} (second derivatives)
- %----------------------------------------------------------------------
- for i = 1:m
- for j = i:m
-
- % dF/dhh = -trace{P*Q{i}*P*Q{j}}
- %--------------------------------------------------------------
- dFdhh(i,j) = -trace(PQ{i}*PQ{j})*N/2;
- dFdhh(j,i) = dFdhh(i,j);
-
- end
- end
-
- % add hyperpriors
- %----------------------------------------------------------------------
- dFdh = dFdh - hP*(h - hE);
- dFdhh = dFdhh - hP;
-
- % Fisher scoring: update dh = -inv(ddF/dhh)*dF/dh
- %----------------------------------------------------------------------
- Ph = -dFdhh;
- dh = -pinv(dFdhh)*dFdh;
-
- % preclude numerical overflow
- %----------------------------------------------------------------------
- if OPT
- dh = min(dh, 8);
- dh = max(dh,-8);
- end
- h = h + dh;
-
- % Convergence (1% change in log-evidence)
- %======================================================================
- w = dFdh'*dh;
- fprintf('%-30s: %i %30s%e\n',' ReML Iteration',k,'...',full(w));
- if w < 1e-2, break, end
-
-end
-
-% log evidence = ln p(y|X,Q) = ReML objective = F = trace(R'*iC*R*YY)/2 ...
-%--------------------------------------------------------------------------
-if nargout > 3
-
- F = - trace(C*P*YY*P)/2 ...
- - N*n*log(2*pi)/2 ...
- - N*pr_spm_logdet(C)/2 ...
- + N*pr_spm_logdet(Cq)/2 ...
- - pr_spm_logdet(Ph)/2 ...
- + pr_spm_logdet(hP)/2;
-end
-
-% return exp(h) if log-normal hyperpriors
-%--------------------------------------------------------------------------
-if OPT
- h = exp(h);
-end
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_select.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_select.m
deleted file mode 100644
index f448346..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_select.m
+++ /dev/null
@@ -1,1151 +0,0 @@
-function [t,sts] = pr_spm_select(varargin)
-% File selector
-% FORMAT [t,sts] = pr_spm_select(n,typ,mesg,sel,wd,filt,frames)
-% n - Number of files
-% A single value or a range. e.g.
-% 1 - Select one file
-% Inf - Select any number of files
-% [1 Inf] - Select 1 to Inf files
-% [0 1] - select 0 or 1 files
-% [10 12] - select from 10 to 12 files
-% typ - file type
-% 'any' - all files
-% 'image' - Image files (".img" and ".nii")
-% Note that it gives the option to select
-% individual volumes of the images.
-% 'xml' - XML files
-% 'mat' - Matlab .mat files
-% 'batch' - SPM batch files (.mat and XML)
-% 'dir' - select a directory
-% Other strings act as a filter to regexp. This means
-% that e.g. DCM*.mat files should have a typ of '^DCM.*\.mat$'
-% mesg - a prompt (default 'Select files...')
-% sel - list of already selected files
-% wd - Directory to start off in
-% filt - value for user-editable filter (default '.*')
-% frames - Image frame numbers to include (default '1')
-%
-% t - selected files
-% sts - status (1 means OK, 0 means window quit)
-%
-% Files can be selected from disk, but "virtual" files can also be selected.
-% Virtual filenames are passed by
-% pr_spm_select('addvfiles',list)
-% where list is a cell array of filenames
-% The list can be cleared by
-% pr_spm_select('clearvfiles')
-%
-% FORMAT cpath = pr_spm_select('CPath',path,cwd)
-% function to canonicalise paths: Prepends cwd to relative paths, processes
-% '..' & '.' directories embedded in path.
-% path - string matrix containing path name
-% cwd - current working directory [defaut '.']
-% cpath - conditioned paths, in same format as input path argument
-%
-% FORMAT [files,dirs]=pr_spm_select('List',direc,filt)
-% Returns files matching the filter (filt) and directories within dire
-% direc - directory to search
-% filt - filter to select files with (see regexp) e.g. '^w.*\.img$'
-% files - files matching 'filt' in directory 'direc'
-% dirs - subdirectories of 'direc'
-%____________________________________________________________________________
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% John Ashburner
-% $Id: spm_select.m 400 2006-01-11 18:41:15Z john $
-
-if nargin > 0 && ischar(varargin{1})
- switch lower(varargin{1})
- case 'addvfiles'
- error(nargchk(2,Inf,nargin));
- vfiles('add',varargin{2:end});
- case 'clearvfiles'
- error(nargchk(1,1,nargin));
- vfiles('clear');
- case 'vfiles'
- error(nargchk(1,1,nargin));
- t = vfiles('all');
- case 'cpath'
- error(nargchk(2,Inf,nargin));
- t = cpath(varargin{2:end});
- case 'list'
- filt = struct('code',0,'frames',[],'ext',{{'.*'}},...
- 'filt',{{varargin{3}}});
- [t,sts] = listfiles(varargin{2},filt);
- otherwise
- error('Inappropriate usage.');
- end
-else
- [t,sts] = selector(varargin{:});
-end
-%=======================================================================
-
-%=======================================================================
-function [t,ok] = selector(n,typ,mesg,already,wd,filt,frames,varargin)
-if nargin<7, frames = '1'; end;
-if nargin<6, filt = '.*'; end;
-if nargin<5, wd = pwd; end;
-if nargin<4, already = {''}; end;
-if nargin<3, mesg = 'Select files...'; end;
-if nargin<2, typ = 'any'; end;
-if nargin<1, n = [0 Inf]; end;
-ok = 0;
-if numel(n)==1, n = [n n]; end;
-if n(1)>n(2), n = n([2 1]); end;
-if ~isfinite(n(1)), n(1) = 0; end;
-if numel(already)>n(2), already = already(1:n(2)); end
-already = strvcat(already);
-
-t = '';
-switch lower(typ),
-case {'any','*'}, code = 0; ext = {'.*'};
-case {'image'}, code = 1; ext = {'.*\.nii$','.*\.img$','.*\.NII$','.*\.IMG$'};
-case {'xml'}, code = 0; ext = {'.*\.xml$','.*\.XML$'};
-case {'mat'}, code = 0; ext = {'.*\.mat$','.*\.MAT$'};
-case {'batch'}, code = 0; ext = {'.*\.mat$','.*\.MAT$','.*\.xml$','.*\.XML$'};
-case {'dir'}, code =-1; ext = {'.*'};
-otherwise, code = 0; ext = {typ};
-end;
-
-[col1,col2,col3,fs] = colours;
-
-fg = figure('IntegerHandle','off',...
- 'Tag','Select',...
- 'Name',strvcat(mesg),...
- 'NumberTitle','off',...
- 'Units','Pixels',...
- 'MenuBar','none',...
- 'DefaultTextInterpreter','none',...
- 'DefaultUicontrolInterruptible','on',...
- 'ResizeFcn',@resize_fun,...
- 'KeyPressFcn',@hitkey);
-
-% Code from Brian Lenoski for dealing with multiple monitors
-if str2double(version('-release'))>=14,
- S = get(0, 'MonitorPosition');
- Rect = get(fg,'Position');
- pointer_loc = get(0,'PointerLocation');
-
- for i = 1:size(S,1), % Loop over monitors
- h_min = S(i,1);
- h_width = S(i,3);
- h_max = h_width + h_min - 1;
- v_min = S(i,2);
- v_len = S(i,4);
- v_max = v_min + v_len;
-
- % Use the monitor containing the pointer
- if pointer_loc(1) >= h_min && pointer_loc(1) < h_max && ...
- pointer_loc(2) >= v_min && pointer_loc(2) < v_max,
- hor_min = h_min;
- hor_width = h_width;
- hor_max = h_max;
- ver_min = v_min;
- ver_len = v_len;
- ver_max = v_max;
- end
- end
- Rect(1) = (hor_max - 0.5*hor_width) - 0.5*Rect(3); % Horizontal
- Rect(2) = (ver_max - 0.5*ver_len) - 0.5*Rect(4); % Vertical
- set(fg,'Position',Rect);
-end
-
-
-fh = 0.05;
-%fs = 10;
-
-sbh = 0.03; % Scroll-bar height. This should be worked out properly
-h1 = (0.96-4*fh-5*0.01)/2;
-if n(2)*fh+sbh=n(1) && size(already,1)<=n(2),
- set(dne,'Enable','on');
-end;
-
-% Filter Button
-uicontrol(fg,...
- 'Style','pushbutton',...
- 'units','normalized',...
- 'Position',[0.51 hp 0.1 fh],...
- 'FontSize',fs,...
- 'ForegroundColor',col3,...
- 'BackgroundColor',col1,...
- 'Callback',@clearfilt,...
- 'String','Filt',...
- 'FontSize',fs);
-
-% Filter
-ud = struct('ext',{ext},'code',code);
-uicontrol(fg,...
- 'style','edit',...
- 'units','normalized',...
- 'Position',[0.61 hp 0.37 fh],...
- 'ForegroundColor',col3,...
- 'BackgroundColor',col1,...
- 'FontSize',fs,...
- 'Callback',@update,...
- 'tag','regexp',...
- 'String',filt,...
- 'UserData',ud);
-
-% Directories
-hp = hp + fh+0.01;
-db = uicontrol(fg,...
- 'style','listbox',...
- 'units','normalized',...
- 'Position',[0.02 hp 0.47 h2],...
- 'FontSize',fs,...
- 'Callback',@click_dir_box,...
- 'tag','dirs',...
- 'BackgroundColor',col1,...
- 'ForegroundColor',col3,...
- 'Max',1,...
- 'Min',0,...
- 'String','',...
- 'UserData',wd,...
- 'Value',1);
-
-% Files
-tmp = uicontrol(fg,...
- 'style','listbox',...
- 'units','normalized',...
- 'Position',[0.51 hp 0.47 h2],...
- 'FontSize',fs,...
- 'Callback',@click_file_box,...
- 'tag','files',...
- 'BackgroundColor',col1,...
- 'ForegroundColor',col3,...
- 'UserData',n,...
- 'Max',10240,...
- 'Min',0,...
- 'String','',...
- 'Value',1);
-c0 = uicontextmenu('Parent',fg);
-set(tmp,'uicontextmenu',c0);
-uimenu('Label','Select All', 'Parent',c0,'Callback',@select_all);
-
-% Drives
-if strcmpi(computer,'PCWIN'),
- dr = spm_platform('drives');
- drivestr = cell(1,numel(dr));
- for i=1:numel(dr),
- drivestr{i} = [dr(i) ':'];
- end;
- %drivestr = {'A:','B:','C:','D:'};
- sz = get(db,'Position');
- sz(4) = sz(4)-fh-2*0.01;
- set(db,'Position',sz);
- uicontrol(fg,...
- 'style','text',...
- 'units','normalized',...
- 'Position',[0.02 hp+h2-fh-0.01 0.10 fh],...
- 'FontSize',fs,...
- 'BackgroundColor',get(fg,'Color'),...
- 'ForegroundColor',col3,...
- 'String','Drive');
- uicontrol(fg,...
- 'style','popupmenu',...
- 'units','normalized',...
- 'Position',[0.12 hp+h2-fh-0.01 0.37 fh],...
- 'FontSize',fs,...
- 'Callback',@setdrive,...
- 'tag','drive',...
- 'BackgroundColor',col1,...
- 'ForegroundColor',col3,...
- 'String',drivestr,...
- 'Value',1);
-end;
-
-% Previous dirs
-hp = hp+h2+0.01;
-uicontrol(fg,...
- 'style','popupmenu',...
- 'units','normalized',...
- 'Position',[0.12 hp 0.86 fh],...
- 'FontSize',fs,...
- 'Callback',@click_dir_list,...
- 'tag','previous',...
- 'BackgroundColor',col1,...
- 'ForegroundColor',col3,...
- 'String',pd,...
- 'Value',vl);
-uicontrol(fg,...
- 'style','text',...
- 'units','normalized',...
- 'Position',[0.02 hp 0.10 fh],...
- 'FontSize',fs,...
- 'BackgroundColor',get(fg,'Color'),...
- 'ForegroundColor',col3,...
- 'String','Prev');
-
-% Directory
-hp = hp + fh+0.01;
-uicontrol(fg,...
- 'style','edit',...
- 'units','normalized',...
- 'Position',[0.12 hp 0.86 fh],...
- 'FontSize',fs,...
- 'Callback',@edit_dir,...
- 'tag','edit',...
- 'BackgroundColor',col1,...
- 'ForegroundColor',col3,...
- 'String','');
-uicontrol(fg,...
- 'style','text',...
- 'units','normalized',...
- 'Position',[0.02 hp 0.10 fh],...
- 'FontSize',fs,...
- 'BackgroundColor',get(fg,'Color'),...
- 'ForegroundColor',col3,...
- 'String','Dir');
-
-resize_fun(fg);
-update(sel,wd)
-
-waitfor(dne);
-if ishandle(sel),
- t = get(sel,'String');
- ok = 1;
-end;
-if ishandle(fg), delete(fg); end;
-return;
-%=======================================================================
-
-%=======================================================================
-function null(varargin)
-%=======================================================================
-
-%=======================================================================
-function msg(ob,str)
-ob = sib(ob,'msg');
-set(ob,'String',str);
-if nargin>=3,
- set(ob,'ForegroundColor',[1 0 0],'FontWeight','bold');
-else
- set(ob,'ForegroundColor',[0 0 0],'FontWeight','normal');
-end;
-drawnow;
-return;
-%=======================================================================
-
-%=======================================================================
-function setdrive(ob,varargin)
-st = get(ob,'String');
-vl = get(ob,'Value');
-update(ob,st{vl});
-return;
-%=======================================================================
-
-%=======================================================================
-function resize_fun(fg,varargin)
-ob = findobj(fg,'String','Filt','Style','pushbutton');
-if ~isempty(ob),
- ofs = get(ob,'FontSize');
- ex = get(ob,'Extent');
- ps = get(ob,'Position');
- fs = floor(ofs*min(ps(4)./ex(4))+1);
- fs = max(min(fs,30),4);
- ob = findobj(fg,'Fontsize',ofs);
- set(ob,'FontSize',fs);
-end;
-return;
-%=======================================================================
-
-%=======================================================================
-function [d,mch] = prevdirs(d)
-persistent pd
-if ~iscell(pd), pd = {}; end;
-d = deblank(d);
-mch = find(strcmp(d,pd));
-if isempty(mch),
- pd = {pd{:},d};
- mch = length(pd);
-end;
-d = pd;
-return;
-%=======================================================================
-
-%=======================================================================
-function clearfilt(ob,varargin)
-set(sib(ob,'regexp'),'String','.*');
-update(ob);
-return;
-%=======================================================================
-
-%=======================================================================
-function click_dir_list(ob,varargin)
-vl = get(ob,'Value');
-ls = get(ob,'String');
-update(ob,deblank(ls{vl}));
-return;
-%=======================================================================
-
-%=======================================================================
-function edit_dir(ob,varargin)
-update(ob,get(ob,'String'));
-return;
-%=======================================================================
-
-%=======================================================================
-function click_dir_box(lb,varargin)
-update(lb,current_dir(lb));
-return;
-%=======================================================================
-
-%=======================================================================
-function dr = current_dir(lb,varargin)
-vl = get(lb,'Value');
-str = get(lb,'String');
-pd = get(sib(lb,'edit'),'String');
-while ~isempty(pd) & strcmp(pd(end),filesep)
- pd=pd(1:end-1); % Remove any trailing fileseps
-end
-sel = deblank(str(vl,:));
-if strcmp(sel,'..'), % Parent directory
- dr = fileparts(pd);
-elseif strcmp(sel,'.'), % Current directory
- dr = pd;
-else
- dr = fullfile(pd,sel);
-end;
-return;
-%=======================================================================
-
-%=======================================================================
-function re = getfilt(ob)
-ob = sib(ob,'regexp');
-ud = get(ob,'UserData');
-re = struct('code',ud.code,...
- 'frames',get(sib(ob,'frame'),'UserData'),...
- 'ext',{ud.ext},...
- 'filt',get(sib(ob,'regexp'),'String'));
-return;
-%=======================================================================
-
-%=======================================================================
-function update(lb,dr)
-lb = sib(lb,'dirs');
-if nargin<2 || isempty(dr),
- dr = get(lb,'UserData');
-end;
-if ~strcmpi(computer,'PCWIN')
- dr = [filesep dr filesep];
-else
- dr = [dr filesep];
-end;
-dr(findstr([filesep filesep],dr)) = [];
-[f,d] = listfiles(dr,getfilt(lb));
-if isempty(d),
- dr = get(lb,'UserData');
- [f,d] = listfiles(dr,getfilt(lb));
-else
- set(lb,'UserData',dr);
-end;
-set(lb,'Value',1,'String',d);
-set(sib(lb,'files'),'Value',1,'String',f);
-[ls,mch] = prevdirs(dr);
-set(sib(lb,'previous'),'String',ls,'Value',mch);
-set(sib(lb,'edit'),'String',dr);
-
-if numel(dr)>1 && dr(2)==':',
- str = get(sib(lb,'drive'),'String');
- str = cat(1,char(str));
- mch = find(lower(str(:,1))==lower(dr(1)));
- if ~isempty(mch),
- set(sib(lb,'drive'),'Value',mch);
- end;
-end;
-return;
-%=======================================================================
-
-%=======================================================================
-function update_frames(lb,varargin)
-str = get(lb,'String');
-%r = get(lb,'UserData');
-try
- r = eval(['[',str,']']);
-catch
- msg(lb,['Failed to evaluate "' str '".'],'r');
- beep;
- return;
-end;
-if ~isnumeric(r),
- msg(lb,['Expression non-numeric "' str '".'],'r');
- beep;
-else
- set(lb,'UserData',r);
- msg(lb,'');
- update(lb);
-end;
-%=======================================================================
-
-%=======================================================================
-function select_all(ob,varargin)
-lb = findobj(get(get(ob,'Parent'),'Parent'),'Tag','files');
-str = get(lb,'String');
-set(lb,'Value',1:size(str,1));
-drawnow;
-click_file_box(lb);
-return;
-%=======================================================================
-
-%=======================================================================
-function click_file_box(lb,varargin)
-lim = get(lb,'UserData');
-ob = sib(lb,'selected');
-str3 = get(ob,'String');
-
-str = get(lb,'String');
-vlo = get(lb,'Value');
-lim1 = min(max(lim(2)-size(str3,1),0),length(vlo));
-if isempty(vlo),
- msg(lb,'Nothing selected');
- return;
-end;
-if lim1==0,
- msg(lb,['Selected ' num2str(size(str3,1)) '/' num2str(lim(2)) ' already.']);
- beep;
- set(sib(lb,'D'),'Enable','on');
- return;
-end;
-
-vl = vlo(1:lim1);
-msk = false(size(str,1),1);
-if vl>0, msk(vl) = true; else msk = []; end;
-str1 = str( msk,:);
-str2 = str(~msk,:);
-dr = [current_dir(sib(lb,'dirs')) filesep];
-str1 = [repmat(dr,size(str1,1),1) str1];
-
-set(lb,'Value',min(vl(1),size(str2,1)),'String',str2);
-r = (1:size(str1,1))+size(str3,1);
-str3 = deblank(strvcat(str3,str1));
-set(ob,'String',str3,'Value',r);
-if length(vlo)>lim1,
- msg(lb,['Retained ' num2str(lim1) '/' num2str(length(vlo))...
- ' of selection.']);
- beep;
-elseif isfinite(lim(2))
- if lim(1)==lim(2),
- msg(lb,['Selected ' num2str(size(str3,1)) '/' num2str(lim(2)) ' files.']);
- else
- msg(lb,['Selected ' num2str(size(str3,1)) '/' num2str(lim(1)) '-' num2str(lim(2)) ' files.']);
- end;
-else
- if size(str3,1) == 1, ss = ''; else ss = 's'; end;
- msg(lb,['Selected ' num2str(size(str3,1)) ' file' ss '.']);
-end;
-if ~isfinite(lim(1)) || size(str3,1)>=lim(1),
- set(sib(lb,'D'),'Enable','on');
-end;
-
-return;
-%=======================================================================
-
-%=======================================================================
-function obj = sib(ob,tag)
-obj = findobj(get(ob,'Parent'),'Tag',tag);
-return;
-%if isempty(obj),
-% error(['Can''t find object with tag "' tag '".']);
-%elseif length(obj)>1,
-% error(['Found ' num2str(length(obj)) ' objects with tag "' tag '".']);
-%end;
-%return;
-%=======================================================================
-
-%=======================================================================
-function unselect(lb,varargin)
-vl = get(lb,'Value');
-if isempty(vl), return; end;
-str = get(lb,'String');
-msk = ones(size(str,1),1);
-if vl~=0, msk(vl) = 0; end;
-str2 = str(logical(msk),:);
-set(lb,'Value',min(vl(1),size(str2,1)),'String',str2);
-lim = get(sib(lb,'files'),'UserData');
-if size(str2,1)>= lim(1) && size(str2,1)<= lim(2),
- set(sib(lb,'D'),'Enable','on');
-else
- set(sib(lb,'D'),'Enable','off');
-end;
-
-%if size(str2,1) == 1, ss = ''; else ss = 's'; end;
-%msg(lb,[num2str(size(str2,1)) ' file' ss ' remaining.']);
-if numel(vl) == 1, ss = ''; else ss = 's'; end;
-msg(lb,['Unselected ' num2str(numel(vl)) ' file' ss '.']);
-return;
-%=======================================================================
-
-%=======================================================================
-function unselect_all(ob,varargin)
-lb = findobj(get(get(ob,'Parent'),'Parent'),'Tag','selected');
-set(lb,'Value',[],'String','','ListBoxTop',1);
-msg(lb,'Unselected all files.');
-lim = get(sib(lb,'files'),'UserData');
-if lim(1)>0, set(sib(lb,'D'),'Enable','off'); end;
-return;
-%=======================================================================
-
-%=======================================================================
-function varargout = vfiles(option,varargin)
-persistent vfs
-if isempty(vfs),
- vfs = newvfs;
-end;
-
-switch option,
-case {'clear'}
- vfs = newvfs;
-case {'add'}
- for j=1:numel(varargin),
- if ischar(varargin{j}),
- for i=1:size(varargin{j},1),
- fle = deblank(varargin{j}(i,:));
- vfs = addvfile(vfs,fle);
- end;
- elseif iscell(varargin{j}),
- for i=1:numel(varargin{j}),
- fle = deblank(varargin{j}{i});
- vfs = addvfile(vfs,fle);
- end;
- end;
- end;
-case {'list'}
- [varargout{1:3}] = listvfiles(vfs,varargin{:});
-case {'all'}
- varargout{1} = vfs;
-otherwise
- error('Unknown option.');
-end;
-return;
-%=======================================================================
-
-%=======================================================================
-function vfs = newvfs(nam)
-if nargin==0, nam = ''; end;
-vfs = struct('name',nam,'dirs',struct('name',{},'dirs',{},'files',{}),'files',struct('name',{},'ind',{}));
-return;
-%=======================================================================
-
-%=======================================================================
-function vfs = addvfile(vfs,fle)
-ind = find(fle==filesep);
-if any(ind==1),
- ind = ind(2:end)-1;
- fle = fle(2:end);
-end;
-if isempty(ind),
- [unused,nam,ext,num] = pr_spm_fileparts(fle);
- if ~isempty(num),
- ind = [str2num(num) 1 1];
- ind = ind(1);
- else
- ind = [];
- end;
- fname = [nam ext];
- mch = strcmp(fname,{vfs.files.name});
- if any(mch),
- mch = find(mch);
- vfs.files(mch).ind = [vfs.files(mch).ind ind];
- else
- vfs.files(end+1).name = fname;
- vfs.files(end).ind = ind;
- end;
-else
- dr = fle(1:(ind(1)-1));
- fle = fle((ind(1)+1):end);
- mch = strcmp(dr,{vfs.dirs.name});
- if any(mch),
- mch = find(mch);
- else
- mch = numel(vfs.dirs)+1;
- vfs.dirs(mch) = newvfs(dr);
- end;
- vfs.dirs(mch) = addvfile(vfs.dirs(mch),fle);
-end;
-return;
-%=======================================================================
-
-%=======================================================================
-function [f,d] = listfiles(dr,filt)
-ob = gco;
-msg(ob,'Listing directory...');
-if nargin<2, filt = ''; end;
-if nargin<1, dr = '.'; end;
-de = dir(dr);
-if ~isempty(de),
- d = {de([de.isdir]).name};
- if filt.code~=-1,
- f = {de(~[de.isdir]).name};
- else
- % f = d(3:end);
- f = d;
- end;
-else
- d = {'.','..'};
- f = {};
-end;
-
-msg(ob,['Filtering ' num2str(numel(f)) ' files...']);
-f = do_filter(f,filt.ext);
-f = do_filter(f,{filt.filt});
-ii = cell(1,numel(f));
-if filt.code==1 && (numel(filt.frames)~=1 || filt.frames(1)~=1),
- msg(ob,['Reading headers of ' num2str(numel(f)) ' images...']);
- for i=1:numel(f),
- try
- ni = nifti(fullfile(dr,f{i}));
- dm = [ni.dat.dim 1 1 1 1 1];
- d4 = (1:dm(4))';
- catch
- d4 = 1;
- end;
- msk = false(size(filt.frames));
- for j=1:numel(msk), msk(j) = any(d4==filt.frames(j)); end;
- ii{i} = filt.frames(msk);
- end;
-elseif filt.code==1 && (numel(filt.frames)==1 && filt.frames(1)==1),
- for i=1:numel(f),
- ii{i} = 1;
- end;
-end;
-
-msg(ob,'Listing virtual files...');
-[fv,dv,iv] = vfiles('list',dr);
-if filt.code==-1,
- fv = dv;
- iv = cell(size(fv));
-end;
-msg(ob,['Filtering ' num2str(numel(fv)) ' virtual files...']);
-[fv,ind] = do_filter(fv,filt.ext);
-iv = iv(ind);
-[fv,ind] = do_filter(fv,{filt.filt});
-iv = iv(ind);
-if filt.code==1,
- for i=1:numel(iv),
- msk = false(size(filt.frames));
- for j=1:numel(msk), msk(j) = any(iv{i}==filt.frames(j)); end;
- iv{i} = filt.frames(msk);
- end;
-end;
-
-d = { d{:},dv{:}};
-f = { f{:},fv{:}};
-ii = {ii{:},iv{:}};
-
-msg(ob,['Listing ' num2str(numel(f)) ' files...']);
-
-[f,ind] = sortrows(f(:));
-ii = ii(ind);
-msk = true(1,numel(f));
-if ~isempty(f), f{1} = deblank(f{1}); end;
-for i=2:numel(f),
- f{i} = deblank(f{i});
- if strcmp(f{i-1},f{i}),
- if filt.code==1,
- tmp = sort([ii{i}(:) ; ii{i-1}(:)]);
- tmp(~diff(tmp,1)) = [];
- ii{i} = tmp;
- end;
- msk(i-1) = false;
- end;
-end;
-f = f(msk);
-if filt.code==1,
- ii = ii(msk);
- c = cell(size(f));
- for i=1:numel(f),
- c{i} = [repmat([f{i} ','],numel(ii{i}),1) num2str(ii{i}(:)) ];
- end;
- f = strvcat(c{:});
-elseif filt.code==-1,
- fs = filesep;
- for i=1:numel(f),
- f{i} = [f{i} fs];
- end;
- f = strvcat(f{:});
-else
- f = strvcat(f{:});
-end;
-
-d = sortrows(d(:));
-d = strvcat(d);
-sam = find(~any(diff(d+0,1),2));
-d(sam,:) = [];
-msg(ob,'');
-return;
-%=======================================================================
-
-%=======================================================================
-function [f,ind] = do_filter(f,filt)
-t2 = false(numel(f),1);
-for j=1:numel(filt),
- t1 = regexp(f,filt{j});
- if numel(f)==1, t1 = {t1}; end;
- for i=1:numel(t1),
- t2(i) = t2(i) || ~isempty(t1{i});
- end;
-end;
-ind = find(t2);
-f = f(ind);
-return;
-%=======================================================================
-
-%=======================================================================
-function [f,d,ii] = listvfiles(vfs,dr)
-f = {};
-d = {};
-ii = {};
-if isempty(dr),
- f = {vfs.files.name};
- ii = {vfs.files.ind};
- d = {vfs.dirs.name};
-else
- if dr(1)==filesep, dr = dr(2:end); end;
- ind = find(dr==filesep);
- if isempty(ind),
- d1 = dr;
- d2 = '';
- else
- d1 = dr(1:(ind(1)-1));
- d2 = dr((ind(1)+1):end);
- end;
- for i=1:length(vfs.dirs),
- if strcmp(d1,vfs.dirs(i).name),
- [f,d,ii] = listvfiles(vfs.dirs(i),d2);
- break;
- end;
- end;
-end;
-return;
-%=======================================================================
-
-%=======================================================================
-function heelp(ob,varargin)
-[col1,col2,col3,fs] = colours;
-fg = get(ob,'Parent');
-t = uicontrol(fg,...
- 'style','listbox',...
- 'units','normalized',...
- 'Position',[0.01 0.01 0.98 0.98],...
- 'FontSize',fs,...
- 'FontName','FixedWidthFont',...
- 'BackgroundColor',col2,...
- 'ForegroundColor',col3,...
- 'Max',0,...
- 'Min',0,...
- 'tag','HelpWin',...
- 'String',' ');
-c0 = uicontextmenu('Parent',fg);
-set(t,'uicontextmenu',c0);
-uimenu('Label','Done', 'Parent',c0,'Callback',@helpclear);
-
-ext = get(t,'Extent');
-pw = floor(0.98/ext(3)*20-4);
-str = pr_spm_justify(pw,{[...
-'File Selection help. You can return to selecting files via the right mouse button (the "Done" option). ',...
-'Because of a bug in Matlab (on some machines), don''t resize this window when viewing the help.'],...
-'',[...
-'The panel at the bottom shows files that are already selected. ',...
-'Clicking a selected file will un-select it. To un-select several, you can ',...
-'drag the cursor over the files, and they will be gone on release. ',...
-'You can use the right mouse button to un-select everything.'],...
-'',[...
-'Directories are navigated by editing the name of the current directory (where it says "Dir"), ',...
-'by going to one of the previously entered directories ("Prev"), or by navigating around ',...
-'the parent or subdirectories listed in the left side panel.'],...
-'',[...
-'Files matching the filter ("Filt") are shown in the panel on the right. ',...
-'These can be selected by clicking or dragging. Use the right mouse button if ',...
-'you would like to select all files. Note that when selected, the files disappear ',...
-'from this panel. They can be made to reappear by re-specifying the directory ',...
-'or the filter. ',...
-'Note that the syntax of the filter differs from that used by previous versions of ',...
-'SPM. The following is a list of symbols with special meaning for filtering the filenames:'],...
-' ^ start of string',...
-' $ end of string',...
-' . any character',...
-' \ quote next character',...
-' * match zero or more',...
-' + match one or more',...
-' ? match zero or one, or match minimally',...
-' {} match a range of occurrances',...
-' [] set of characters',...
-' [^] exclude a set of characters',...
-' () group subexpression',...
-' \w match word [a-z_A-Z0-9]',...
-' \W not a word [^a-z_A-Z0-9]',...
-' \d match digit [0-9]',...
-' \D not a digit [^0-9]',...
-' \s match white space [ \t\r\n\f]',...
-' \S not a white space [^ \t\r\n\f]',...
-' \ exact word match',...
-'',[...
-'Individual time frames of image files can also be selected. The frame filter ',...
-'allows specified frames to be shown, which is useful for image files that ',...
-'contain multiple time points. If your images are only single time point, then ',...
-'reading all the image headers can be avoided by specifying a frame filter of "1". ',...
-'The filter should contain a list of integers indicating the frames to be used. ',...
-'This can be generated by e.g. "1:100", or "1:2:100".'],...
-'',[...
-'There is also an edit button (Ed), which allows you to edit your selection of files. ',...
-'When you are done, then use the menu-button of your mouse to either cancel or accept your changes'],''});
-pad = cellstr(char(zeros(max(0,floor(1.2/ext(4) - numel(str))),1)));
-str = {str{:}, pad{:}};
-set(t,'String',str);
-return;
-%=======================================================================
-
-%=======================================================================
-function helpclear(ob,varargin)
-ob = get(ob,'Parent');
-ob = get(ob,'Parent');
-ob = findobj(ob,'Tag','HelpWin');
-delete(ob);
-%=======================================================================
-
-%=======================================================================
-function hitkey(fg,varargin)
-ch = get(fg,'CurrentCharacter');
-if isempty(ch), return; end;
-
-ob = findobj(fg,'Tag','files');
-if ~isempty(ob),
- f = get(ob,'String');
- f = f(:,1);
- fset = find(f>=ch);
- if ~isempty(fset),
- fset = fset(1);
- %cb = get(ob,'Callback');
- %set(ob,'Callback',[]);
- set(ob,'ListboxTop',fset);
- %set(ob,'Callback',cb);
- else
- set(ob,'ListboxTop',length(f));
- end;
-end;
-return;
-%=======================================================================
-
-%=======================================================================
-function t = cpath(t,d)
-
-switch spm_platform('filesys'),
-case 'unx',
- mch = '^/';
- fs = '/';
- fs1 = '/';
-case 'win',
- mch = '^.:\\';
- fs = '\';
- fs1 = '\\';
-otherwise;
- error('What is this filesystem?');
-end
-
-if isempty(regexp(t,mch,'once')),
- if nargin<2, d = pwd; end;
- t = [d fs t];
-end;
-
-% Replace occurences of '/./' by '/' (problems with e.g. /././././././')
-re = [fs1 '\.' fs1];
-while ~isempty(regexp(t,re)),
- t = regexprep(t,re,fs);
-end;
-t = regexprep(t,[fs1 '\.' '$'], fs);
-
-% Replace occurences of '/abc/../' by '/'
-re = [fs1 '[^' fs1 ']+' fs1 '\.\.' fs1];
-while ~isempty(regexp(t,re)),
- t = regexprep(t,re,fs,'once');
-end;
-t = regexprep(t,[fs1 '[^' fs1 ']+' fs1 '\.\.' '$'],fs,'once');
-
-% Replace '//'
-t = regexprep(t,[fs1 '+'], fs);
-%=======================================================================
-
-%=======================================================================
-function editwin(ob,varargin)
-[col1,col2,col3,fs] = colours;
-fg = get(ob,'Parent');
-lb = findobj(fg,'Tag','selected');
-str = get(lb,'String');
-str = cellstr(str);
-h = uicontrol(fg,'Style','Edit',...
- 'units','normalized',...
- 'String',str,...
- 'FontSize',16,...
- 'Max',2,...
- 'Tag','EditWindow',...
- 'HorizontalAlignment','Left',...
- 'ForegroundColor',col3,...
- 'BackgroundColor',col1,...
- 'Position',[0.01 0.01 0.98 0.98]);
-c0 = uicontextmenu('Parent',fg);
-set(h,'uicontextmenu',c0);
-uimenu('Label','Cancel', 'Parent',c0,'Callback',@editclear);
-uimenu('Label','Accept', 'Parent',c0,'Callback',@editdone);
-%=======================================================================
-
-%=======================================================================
-function editdone(ob,varargin)
-ob = get(ob,'Parent');
-ob = sib(ob,'EditWindow');
-str = get(ob,'String');
-str = deblank(cellstr(strvcat(str)));
-if isempty(str{1}), str = {}; end;
-
-lim = get(sib(ob,'files'),'UserData');
-if numel(str)>lim(2),
- msg(ob,['Retained ' num2str(lim(2)) ' of the ' num2str(numel(str)) ' files.']);
- beep;
- str = str(1:lim(2));
-elseif isfinite(lim(2)),
- if lim(1)==lim(2),
- msg(ob,['Specified ' num2str(numel(str)) '/' num2str(lim(2)) ' files.']);
- else
- msg(ob,['Selected ' num2str(numel(str)) '/' num2str(lim(1)) '-' num2str(lim(2)) ' files.']);
- end;
-else
- if numel(str) == 1, ss = ''; else ss = 's'; end;
- msg(ob,['Specified ' num2str(numel(str)) ' file' ss '.']);
-end;
-if ~isfinite(lim(1)) || numel(str)>=lim(1),
- set(sib(ob,'D'),'Enable','on');
-else
- set(sib(ob,'D'),'Enable','off');
-end;
-set(sib(ob,'selected'),'String',strvcat(str),'Value',[]);
-delete(ob);
-%=======================================================================
-
-%=======================================================================
-function editclear(ob,varargin)
-ob = get(ob,'Parent');
-ob = get(ob,'Parent');
-ob = findobj(ob,'Tag','EditWindow');
-delete(ob);
-%=======================================================================
-
-%=======================================================================
-function [c1,c2,c3,fs] = colours
-global defaults
-c1 = [1 1 1];
-c2 = [1 1 1];
-c3 = [0 0 0];
-fs = 14;
-if isfield(defaults,'ui'),
- ui = defaults.ui;
- if isfield(ui,'colour1'), c1 = ui.colour1; end;
- if isfield(ui,'colour2'), c2 = ui.colour2; end;
- if isfield(ui,'colour3'), c3 = ui.colour3; end;
- if isfield(ui,'fs'), fs = ui.fs; end;
-end;
-%=======================================================================
-
-%=======================================================================
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_svd.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_svd.m
deleted file mode 100644
index 3ad7961..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_svd.m
+++ /dev/null
@@ -1,100 +0,0 @@
-function [U,S,V] = pr_spm_svd(X,U,T)
-% computationally efficient SVD (that can handle sparse arguments)
-% FORMAT [U,S,V] = pr_spm_svd(X,u,t);
-% X - {m x n} matrix
-% u - threshold for normalized eigenvalues (default = 1e-6)
-% t - threshold for raw eigenvalues (default = 0)
-%
-% U - {m x p} singular vectors
-% V - {m x p} singular variates
-% S - {p x p} singular values
-%___________________________________________________________________________
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% Karl Friston
-% $Id: spm_svd.m 112 2005-05-04 18:20:52Z john $
-
-
-
-% default thresholds
-%---------------------------------------------------------------------------
-if nargin < 2
- U = 1e-6;
-end
-
-if nargin < 3
- T = 0;
-end
-
-% deal with sparse matrices
-%---------------------------------------------------------------------------
-[M N] = size(X);
-p = find(any(X,2));
-q = find(any(X,1));
-X = X(p,q);
-
-% SVD
-%---------------------------------------------------------------------------
-[i j s] = find(X);
-[m n] = size(X);
-if any(i - j)
-
- % off-leading diagonal elements - full SVD
- %-------------------------------------------------------------------
- X = full(X);
- if m > n
-
- [v S v] = svd(spm_atranspa(X),0);
- S = sparse(S);
- s = diag(S);
- j = find(s*length(s)/sum(s) >= U & s >= T);
- v = v(:,j);
- u = pr_spm_en(X*v);
- S = sqrt(S(j,j));
-
- elseif m < n
-
- [u S u] = svd(spm_atranspa(X'),0);
- S = sparse(S);
- s = diag(S);
- j = find(s*length(s)/sum(s) >= U & s >= T);
- u = u(:,j);
- v = pr_spm_en(X'*u);
- S = sqrt(S(j,j));
-
- else
-
- [u S v] = svd(X,0);
- S = sparse(S);
- s = diag(S).^2;
- j = find(s*length(s)/sum(s) >= U & s >= T);
- v = v(:,j);
- u = u(:,j);
- S = S(j,j);
- end
-
-else
- S = sparse(1:n,1:n,s,m,n);
- u = speye(m,n);
- v = speye(m,n);
- [i j] = sort(-s);
- S = S(j,j);
- v = v(:,j);
- u = u(:,j);
- s = diag(S).^2;
- j = find(s*length(s)/sum(s) >= U & s >= T);
- v = v(:,j);
- u = u(:,j);
- S = S(j,j);
-
-end
-
-% replace in full matrices
-%---------------------------------------------------------------------------
-j = length(j);
-U = sparse(M,j);
-V = sparse(N,j);
-if j
- U(p,:) = u;
- V(q,:) = v;
-end
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_ui.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_ui.m
deleted file mode 100644
index fecb66b..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_ui.m
+++ /dev/null
@@ -1,1412 +0,0 @@
-function varargout = pr_spm_ui(varargin)
-% MarsBaR: Setting up the general linear model for independent data
-%
-% MarsBaR version copied with minor edits from:
-% $Id: spm_spm_ui.m 372 2005-12-08 17:12:13Z karl $
-% See that (SPM5) file for comments and help
-
-%-Condition arguments
-%-----------------------------------------------------------------------
-if (nargin==0), Action = 'CFG'; else, Action = varargin{1}; end
-
-
-switch lower(Action)
-case 'cfg'
- %===================================================================
- % - C O N F I G U R E D E S I G N
- %===================================================================
- % pr_spm_ui('CFG',D)
- if nargin<2, D = []; else, D = varargin{2}; end
-
- %-GUI setup
- %-------------------------------------------------------------------
- SPMid = spm('FnBanner',mfilename, marsbar('ver'));
- [Finter,Fgraph,CmdLine] = spm('FnUIsetup','Stats: Setup analysis',0);
- spm_help('!ContextHelp',mfilename)
-
-
- %-Ask about overwriting files from previous analyses...
- %-------------------------------------------------------------------
- if exist(fullfile('.','SPM.mat'))
- str = { 'Current directory contains existing SPM file:',...
- 'Continuing will overwrite existing file!'};
- if spm_input(str,1,'bd','stop|continue',[1,0],1,mfilename);
- fprintf('%-40s: %30s\n\n',...
- 'Abort... (existing SPM file)',spm('time'))
- spm_clf(Finter)
- return
- end
- end
-
-
-
- %-Option definitions
- %-------------------------------------------------------------------
- %-Generic factor names
- sF = {'sF1','sF2','sF3','sF4'};
-
- %-Covariate by factor interaction options
- sCFI = {'';... %-1
- 'with sF1';'with sF2';'with sF3';'with sF4';... %-2:5
- 'with sF2 (within sF4)';'with sF3 (within sF4)'}; %-6,7
-
- %-DesMtx argument components for covariate by factor interaction options
- % (Used for CFI's Covariate Centering (CC), GMscale & Global normalisation)
- CFIforms = { '[]', 'C', '{}';... %-1
- 'I(:,1)', 'FxC', '{D.sF{1}}';... %-2
- 'I(:,2)', 'FxC', '{D.sF{2}}';... %-3
- 'I(:,3)', 'FxC', '{D.sF{3}}';... %-4
- 'I(:,4)', 'FxC', '{D.sF{4}}';... %-5
- 'I(:,[4,2])', 'FxC', '{D.sF{4},D.sF{2}}';... %-6
- 'I(:,[4,3])', 'FxC', '{D.sF{4},D.sF{3}}' }; %-7
-
- %-Centre (mean correction) options for covariates & globals (CC)
- % (options 9-12 are for centering of global when using AnCova GloNorm) (GC)
- sCC = { 'around overall mean';... %-1
- 'around sF1 means';... %-2
- 'around sF2 means';... %-3
- 'around sF3 means';... %-4
- 'around sF4 means';... %-5
- 'around sF2 (within sF4) means';... %-6
- 'around sF3 (within sF4) means';... %-7
- '';... %-8
- 'around user specified value';... %-9
- '(as implied by AnCova)';... %-10
- 'GM';... %-11
- '(redundant: not doing AnCova)'}'; %-12
- %-DesMtx I forms for covariate centering options
- CCforms = {'ones(nScan,1)',CFIforms{2:end,1},''}';
-
-
- %-Global normalization options (options 1-7 match CFIforms) (GloNorm)
- sGloNorm = { 'AnCova';... %-1
- 'AnCova by sF1';... %-2
- 'AnCova by sF2';... %-3
- 'AnCova by sF3';... %-4
- 'AnCova by sF4';... %-5
- 'AnCova by sF2 (within sF4)';... %-6
- 'AnCova by sF3 (within sF4)';... %-7
- 'proportional scaling';... %-8
- ''}; %-9
-
- %-Grand mean scaling options (GMsca)
- sGMsca = { 'scaling of overall grand mean';... %-1
- 'scaling of sF1 grand means';... %-2
- 'scaling of sF2 grand means';... %-3
- 'scaling of sF3 grand means';... %-4
- 'scaling of sF4 grand means';... %-5
- 'scaling of sF2 (within sF4) grand means';... %-6
- 'scaling of sF3 (within sF4) grand means';... %-7
- '(implicit in PropSca global normalisation)';... %-8
- '' }; %-9
- %-NB: Grand mean scaling by subject is redundent for proportional scaling
-
-
- %-Global calculation options (GXcalc)
- sGXcalc = { 'omit';... %-1
- 'user specified';... %-2
- 'mean voxel value (within per image fullmean/8 mask)'}; %-3
-
-
-
- %===================================================================
- %-D E S I G N P A R A M E T E R S
- %===================================================================
- %-Get design type
- %-------------------------------------------------------------------
- if isempty(D)
-
- D = pr_spm_ui( ...
- char(spm_input('Select design class...','+1','m',...
- {'Basic stats','Standard PET designs','SPM96 PET designs'},...
- {'DesDefs_Stats','DesDefs_PET','DesDefs_PET96'},2)));
- end
-
- D = D(spm_input('Select design type...','+1','m',{D.DesName}'));
-
-
- %-Set factor names for this design
- %-------------------------------------------------------------------
- sCC = sf_estrrep(sCC,[sF',D.sF']);
- sCFI = sf_estrrep(sCFI,[sF',D.sF']);
- sGloNorm = sf_estrrep(sGloNorm,[sF',D.sF']);
- sGMsca = sf_estrrep(sGMsca,[sF',D.sF']);
-
- %-Get filenames & factor indicies
- %-------------------------------------------------------------------
- [P,I] = pr_spm_ui('Files&Indices',D.sF,D.n,D.b.aTime);
- nScan = size(I,1); %-#obs
-
- %-Additional design parameters
- %-------------------------------------------------------------------
- bL = any(diff(I,1),1); %-Multiple factor levels?
- % NB: bL(2) might be thrown by user specified f1 levels
- % (D.b.aTime & D.n(2)>1) - assumme user is consistent?
- bFI = [bL(1),bL(2:3)&~bL(4),bL(4),bL([2,3])&bL(4)];
- %-Allowable interactions for covariates
- %-Only offer interactions with multi-level factors, and
- % don't offer by F2|F3 if bL(4)!
-
- %-Build Condition (H) and Block (B) partitions
- %===================================================================
- H=[];Hnames=[];
- B=[];Bnames=[];
- eval(['[H,Hnames] = spm_DesMtx(',D.Hform,');'])
- if rank(H)==nScan, error('unestimable condition effects'), end
- eval(['[B,Bnames] = spm_DesMtx(',D.Bform,');'])
- if rank(B)==nScan, error('unestimable block effects'), end
-
- %-Drop a constant H partition if B partition can model constant
- if size(H,2)>0 & all(H(:)==1) & (rank([H B])==rank(B))
- H = []; Hnames = {};
- warning('Dropping redundant constant H partition')
- end
-
-
- %-Covariate partition(s): interest (C) & nuisance (G) excluding global
- %===================================================================
- nC = D.nC; %-Default #covariates
- C = {[],[]}; Cnames = {{},{}}; %-Covariate DesMtx partitions & names
- xC = []; %-Struct array to hold raw covariates
-
-
- dcname = {'CovInt','NusCov'}; %-Default root names for covariates
- dstr = {'covariate','nuisance variable'};
-
- GUIpos = spm_input('!NextPos');
- nc = [0,0];
- for i = 1:2 % 1:covariates of interest, 2:nuisance variables
-
- if isinf(nC(i)), nC(i)=spm_input(['# ',dstr{i},'s'],GUIpos,'w1'); end
-
- while nc(i) < nC(i)
-
- %-Create prompt, get covariate, get covariate name
- %-----------------------------------------------------------
- if nC(i)==1
- str=dstr{i};
- else
- str=sprintf('%s %d',dstr{i},nc(i)+1);
- end
- c = spm_input(str,GUIpos,'r',[],[nScan,Inf]);
- if any(isnan(c(:))), break, end %-NaN is dummy value to exit
- nc(i) = nc(i)+1; %-#Covariates (so far)
- if nC(i)>1, tstr = sprintf('%s^{%d}',dcname{i},nc(i));
- else, tstr = dcname{i}; end
- cname = spm_input([str,' name?'],'+1','s',tstr);
- rc = c; %-Save covariate value
- rcname = cname; %-Save covariate name
-
- %-Interaction option? (if single covariate vector entered)?
- %-----------------------------------------------------------
- if size(c,2) == 1
- %-User choice of interaction options, default is negative
- %-Only offer interactions for appropriate factor combinations
- if length(D.iCFI{i})>1
- iCFI = intersect(abs(D.iCFI{i}),find([1,bFI]));
- dCFI = max([1,intersect(iCFI,-D.iCFI{i}(D.iCFI{i}<0))]);
- iCFI = spm_input([str,': interaction?'],'+1','m',...
- sCFI(iCFI),iCFI,find(iCFI==dCFI));
- else
- iCFI = abs(D.iCFI{i}); %-AutoSelect default option
- end
- else
- iCFI = 1;
- end
-
- %-Centre covariate(s)? (Default centring to correspond to CFI)
- % Always offer "no centering" as default for design matrix blocks
- %-----------------------------------------------------------
- DiCC = D.iCC{i};
- if size(c,2)>1, DiCC = union(DiCC,-8); end
- if length(DiCC)>1
- %-User has a choice of centering options
- %-Only offer factor specific for appropriate factor combinations
- iCC = intersect(abs(DiCC),find([1,bFI,1]) );
- %-Default is max -ve option in D, overridden by iCFI if CFI
- if iCFI == 1, dCC = -DiCC(DiCC<0); else, dCC = iCFI; end
- dCC = max([1,intersect(iCC,dCC)]);
- iCC = spm_input([str,': centre?'],'+1','m',...
- sCC(iCC),iCC,find(iCC==dCC));
- else
- iCC = abs(DiCC); %-AutoSelect default option
- end
- %-Centre within factor levels as appropriate
- if any(iCC == [1:7]), c = c - spm_meanby(c,eval(CCforms{iCC})); end
-
- %-Do any interaction (only for single covariate vectors)
- %-----------------------------------------------------------
- if iCFI > 1 %-(NB:iCFI=1 if size(c,2)>1)
- tI = [eval(CFIforms{iCFI,1}),c];
- tConst = CFIforms{iCFI,2};
- tFnames = [eval(CFIforms{iCFI,3}),{cname}];
- [c,cname] = spm_DesMtx(tI,tConst,tFnames);
- elseif size(c,2)>1 %-Design matrix block
- [null,cname] = spm_DesMtx(c,'X',cname);
- else
- cname = {cname};
- end
-
- %-Store raw covariate details in xC struct for reference
- %-Pack c into appropriate DesMtx partition
- %-----------------------------------------------------------
- %-Construct description string for covariate
- str = {sprintf('%s: %s',str,rcname)};
- if size(rc,2)>1, str = {sprintf('%s (block of %d covariates)',...
- str{:},size(rc,2))}; end
- if iCC < 8, str=[str;{['used centered ',sCC{iCC}]}]; end
- if iCFI> 1, str=[str;{['fitted as interaction ',sCFI{iCFI}]}]; end
-
- tmp = struct( 'rc',rc, 'rcname',rcname,...
- 'c',c, 'cname',{cname},...
- 'iCC',iCC, 'iCFI',iCFI,...
- 'type',i,...
- 'cols',[1:size(c,2)] + ...
- size([H,C{1}],2) + ...
- size([B,C{2}],2)*(i-1),...
- 'descrip',{str} );
- if isempty(xC), xC = tmp; else, xC = [xC,tmp]; end
- C{i} = [C{i},c];
- Cnames{i} = [Cnames{i}; cname];
-
- end % (while)
-
- end % (for)
- clear c tI tConst tFnames
- spm_input('!SetNextPos',GUIpos);
-
- %-Unpack into C & G design matrix sub-partitions
- G = C{2}; Gnames = Cnames{2};
- C = C{1}; Cnames = Cnames{1};
-
-
- %-Options...
- %===================================================================
- %-Global normalization options (GloNorm)
- %-------------------------------------------------------------------
- if length(D.iGloNorm)>1
- %-User choice of global normalisation options, default is negative
- %-Only offer factor specific for appropriate factor combinations
- iGloNorm = intersect(abs(D.iGloNorm),find([1,bFI,1,1]));
- dGloNorm = max([0,intersect(iGloNorm,-D.iGloNorm(D.iGloNorm<0))]);
- iGloNorm = spm_input('GloNorm: Select global normalisation','+1','m',...
- sGloNorm(iGloNorm),iGloNorm,find(iGloNorm==dGloNorm));
- else
- iGloNorm = abs(D.iGloNorm);
- end
-
-
- %-Grand mean scaling options (GMsca)
- %-------------------------------------------------------------------
- if iGloNorm==8
- iGMsca=8; %-grand mean scaling implicit in PropSca GloNorm
- elseif length(D.iGMsca)==1
- iGMsca = abs(D.iGMsca);
- else
- %-User choice of grand mean scaling options
- %-Only offer factor specific for appropriate factor combinations
- iGMsca = intersect(abs(D.iGMsca),find([1,bFI,0,1]));
- %-Default is max -ve option in D, overridden by iGloNorm if AnCova
- if iGloNorm==9, dGMsca=-D.iGMsca(D.iGMsca<0); else, dGMsca=iGloNorm; end
- dGMsca = max([0,intersect(iGMsca,dGMsca)]);
- iGMsca = spm_input('GMsca: grand mean scaling','+1','m',...
- sGMsca(iGMsca),iGMsca,find(iGMsca==dGMsca));
- end
-
-
- %-Value for PropSca / GMsca (GM)
- %-------------------------------------------------------------------
- if iGMsca == 9 %-Not scaling (GMsca or PropSca)
- GM = 0; %-Set GM to zero when not scaling
- else %-Ask user value of GM
- if iGloNorm==8
- str = 'PropSca global mean to';
- else
- str = [strrep(sGMsca{iGMsca},'scaling of','scale'),' to'];
- end
- GM = spm_input(str,'+1','r',D.GM,1);
- %-If GM is zero then don't GMsca! or PropSca GloNorm
- if GM==0, iGMsca=9; if iGloNorm==8, iGloNorm=9; end, end
- end
-
- %-Sort out description strings for GloNorm and GMsca
- %-------------------------------------------------------------------
- sGloNorm = sGloNorm{iGloNorm};
- sGMsca = sGMsca{iGMsca};
- if iGloNorm==8
- sGloNorm = sprintf('%s to %-4g',sGloNorm,GM);
- elseif iGMsca<8
- sGMsca = sprintf('%s to %-4g',sGMsca,GM);
- end
-
-
- %-Global centering (for AnCova GloNorm) (GC)
- %-------------------------------------------------------------------
- %-Specify the centering option for the global covariate for AnCova
- %-Basically, if 'GMsca'ling then should centre to GM (iGC=11). Otherwise,
- % should centre in similar fashion to AnCova (i.e. by the same factor(s)),
- % such that models are seperable (iGC=10). This is particularly important
- % for subject specific condition effects if then passed on to a second-level
- % model. (See also spm_adjmean_ui.m) SPM96 (& earlier) used to just centre
- % GX around its (overall) mean (iGC=1).
-
- %-This code allows more general options to be specified (but is complex)
- %-Setting D.iGC=[-10,-11] gives the standard choices above
-
- %-If not doing AnCova then GC is irrelevant
- if ~any(iGloNorm == [1:7])
- iGC = 12;
- gc = [];
- else
- %-Annotate options 10 & 11 with specific details
- %---------------------------------------------------------------
- %-Tag '(as implied by AnCova)' with actual AnCova situation
- sCC{10} = [sCC{iGloNorm},' (<= ',sGloNorm,')'];
- %-Tag 'GM' case with actual GM & GMsca case
- sCC{11} = sprintf('around GM=%g (i.e. %s after grand mean scaling)',...
- GM,strrep(sCC{iGMsca},'around ',''));
-
- %-Constuct vector of allowable iGC
- %---------------------------------------------------------------
- %-Weed out redundent factor combinations from pre-set allowable options
- iGC = intersect(abs(D.iGC),find([1,bFI,1,1,1,1]));
- %-Omit 'GM' option if didn't GMsca (iGMsca~=8 'cos doing AnCova)
- if any(iGMsca==[8,9]), iGC = setdiff(iGC,11); end
- %-Omit 'GM' option if same as '(as implied by AnCova)'
- if iGloNorm==iGMsca, iGC = setdiff(iGC,11); end
-
- %-If there's a choice, set defaults (if any), & get answer
- %---------------------------------------------------------------
- if length(iGC)>1
- dGC = max([0,intersect(iGC,-D.iGC(D.iGC<0))]);
- str = 'Centre global covariate';
- if iGMsca<8, str = [str,' (after grand mean scaling)']; end
- iGC = spm_input(str,'+1','m',sCC(iGC),iGC,find(iGC==dGC));
- elseif isempty(iGC)
- error('Configuration error: empty iGC')
- end
-
- %-If 'user specified' then get value
- %---------------------------------------------------------------
- if iGC==9
- gc = spm_input('Centre globals around','+0','r',D.GM,1);
- sCC{9} = sprintf('%s of %g',sCC{iGC},gc);
- else
- gc = 0;
- end
- end
-
-
- %-Thresholds & masks defining voxels to analyse (MASK)
- %===================================================================
- GUIpos = spm_input('!NextPos');
-
- %-Analysis threshold mask
- %-------------------------------------------------------------------
- %-Work out available options:
- % -Inf=>None, real=>absolute, complex=>proportional, (i.e. times global)
- M_T = D.M_.T; if isempty(M_T), M_T = [-Inf, 100, 0.8*sqrt(-1)]; end
- M_T = { 'none', M_T(min(find(isinf(M_T))));...
- 'absolute', M_T(min(find(isfinite(M_T)&(M_T==real(M_T)))));...
- 'relative', M_T(min(find(isfinite(M_T)&(M_T~=real(M_T))))) };
-
- %-Work out available options
- %-If there's a choice between proportional and absolute then ask
- %-------------------------------------------------------------------
- q = ~[isempty(M_T{1,2}), isempty(M_T{2,2}), isempty(M_T{3,2})];
-
- if all(q(2:3))
- tmp = spm_input('Threshold masking',GUIpos,'b',M_T(q,1),find(q));
- q(setdiff([1:3],tmp))=0;
- end
-
- %-Get mask value - note that at most one of q(2:3) is true
- %-------------------------------------------------------------------
- if ~any(q) %-Oops - nothing specified!
- M_T = -Inf;
- elseif all(q==[1,0,0]) %-no threshold masking
- M_T = -Inf;
- else %-get mask value
- if q(1), args = {'br1','None',-Inf,abs(M_T{1+find(q(2:3)),2})};
- else, args = {'r',abs(M_T{1+find(q(2:3)),2})}; end
- if q(2)
- M_T = spm_input('threshold',GUIpos,args{:});
- elseif q(3)
- M_T = spm_input('threshold (relative to global)',GUIpos,...
- args{:});
- if isfinite(M_T) & isreal(M_T), M_T=M_T*sqrt(-1); end
- else
- error('Shouldn''t get here!')
- end
- end
-
- %-Make a description string
- %-------------------------------------------------------------------
- if isinf(M_T)
- xsM.Analysis_threshold = 'None (-Inf)';
- elseif isreal(M_T)
- xsM.Analysis_threshold = sprintf('images thresholded at %6g',M_T);
- else
- xsM.Analysis_threshold = sprintf(['images thresholded at %6g ',...
- 'times global'],imag(M_T));
- end
-
-
- %-Implicit masking: Ignore zero voxels in low data-types?
- %-------------------------------------------------------------------
- % (Implicit mask is NaN in higher data-types.)
- type = mars_vol_utils('type', spm_vol(P{1,1}));
- if ~spm_type(type,'nanrep')
- switch D.M_.I
- case Inf, M_I = spm_input('Implicit mask (ignore zero''s)?',...
- '+1','y/n',[1,0],1); %-Ask
- case {0,1}, M_I = D.M_.I; %-Pre-specified
- otherwise, error('unrecognised D.M_.I type')
- end
-
- if M_I, xsM.Implicit_masking = 'Yes: zero''s treated as missing';
- else, xsm.Implicit_masking = 'No'; end
- else
- M_I = 1;
- xsM.Implicit_masking = 'Yes: NaN''s treated as missing';
- end
-
-
- %-Explicit mask images (map them later...)
- %-------------------------------------------------------------------
- switch(D.M_.X)
- case Inf, M_X = spm_input('explicitly mask images?','+1','y/n',[1,0],2);
- case {0,1}, M_X = D.M_.X;
- otherwise, error('unrecognised D.M_.X type')
- end
- if M_X, M_P = pr_spm_select(Inf,'image','select mask images'); else, M_P = {}; end
-
-
- %-Global calculation (GXcalc)
- %===================================================================
- iGXcalc = abs(D.iGXcalc);
- %-Only offer "omit" option if not doing any GloNorm, GMsca or PropTHRESH
- if ~(iGloNorm==9 & iGMsca==9 & (isinf(M_T)|isreal(M_T)))
- iGXcalc = intersect(iGXcalc,[2:size(sGXcalc,1)]);
- end
- if isempty(iGXcalc)
- error('no GXcalc options')
- elseif length(iGXcalc)>1
- %-User choice of global calculation options, default is negative
- dGXcalc = max([1,intersect(iGXcalc,-D.iGXcalc(D.iGXcalc<0))]);
- iGXcalc = spm_input('Global calculation','+1','m',...
- sGXcalc(iGXcalc),iGXcalc,find(iGXcalc==dGXcalc));
- else
- iGXcalc = abs(D.iGXcalc);
- end
-
- if iGXcalc==2 %-Get user specified globals
- g = spm_input('globals','+0','r',[],[nScan,1]);
- end
- sGXcalc = sGXcalc{iGXcalc};
-
-
- % Non-sphericity correction (set xVi.var and .dep)
- %===================================================================
- xVi.I = I;
- nL = max(I); % number of levels
- mL = find(nL > 1); % multilevel factors
- xVi.var = sparse(1,4); % unequal variances
- xVi.dep = sparse(1,4); % dependencies
-
- if length(mL) > 1
-
- % repeated measures design
- %---------------------------------------------------------------
- if spm_input('non-sphericity correction?','+1','y/n',[1,0],0)
-
- % make menu strings
- %-----------------------------------------------------------
- for i = 1:4
- mstr{i} = sprintf('%s (%i levels)',D.sF{i},nL(i));
- end
- mstr = mstr(mL);
-
- % are errors identical
- %-----------------------------------------------------------
- if spm_input('are errors identical','+1','y/n',[0,1],0)
- str = 'unequal variances are between';
- [i j] = min(nL(mL));
- i = spm_input(str,'+0','m',mstr,[],j);
-
- % set in xVi and eliminate from dependency option
- %-------------------------------------------------------
- xVi.var(mL(i)) = 1;
- mL(i) = [];
- mstr(i) = [];
- end
-
- % are errors independent
- %-----------------------------------------------------------
- if spm_input('are errors independent','+1','y/n',[0,1],0)
- str = ' dependencies are within';
- [i j] = max(nL(mL));
- i = spm_input(str,'+0','m',mstr,[],j);
-
- % set in xVi
- %-------------------------------------------------------
- xVi.dep(mL(i)) = 1;
- end
-
- end
- end
-
- %-Place covariance components Q{:} in xVi.Vi
- %-------------------------------------------------------------------
- xVi = pr_spm_non_sphericity(xVi);
-
- %===================================================================
- % - C O N F I G U R E D E S I G N
- %===================================================================
- spm('FigName','Stats: configuring',Finter,CmdLine);
- spm('Pointer','Watch');
-
-
- %-Images & image info: Map Y image files and check consistency of
- % dimensions and orientation / voxel size
- %===================================================================
- fprintf('%-40s: ','Mapping files') %-#
- VY = spm_vol(char(P));
-
-
- %-Check compatability of images (Bombs for single image)
- %-------------------------------------------------------------------
- [samef msg] = mars_vol_check(VY);
- if ~samef, disp(char(msg)),error('Cannot use images'),end;
-
- fprintf('%30s\n','...done') %-#
-
-
- %-Global values, scaling and global normalisation
- %===================================================================
- %-Compute global values
- %-------------------------------------------------------------------
- switch iGXcalc, case 1
- %-Don't compute => no GMsca (iGMsca==9) or GloNorm (iGloNorm==9)
- g = [];
- case 2
- %-User specified globals
- case 3
- %-Compute as mean voxel value (within per image fullmean/8 mask)
- g = zeros(nScan,1 );
- fprintf('%-40s: %30s','Calculating globals',' ') %-#
- for i = 1:nScan
- str = sprintf('%3d/%-3d',i,nScan);
- fprintf('%s%30s',repmat(sprintf('\b'),1,30),str)%-#
- g(i) = spm_global(VY(i));
- end
- fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-#
- otherwise
- error('illegal iGXcalc')
- end
- rg = g;
-
-
- fprintf('%-40s: ','Design configuration') %-#
-
-
- %-Scaling: compute global scaling factors gSF required to implement
- % proportional scaling global normalisation (PropSca) or grand mean
- % scaling (GMsca), as specified by iGMsca (& iGloNorm)
- %-------------------------------------------------------------------
- switch iGMsca, case 8
- %-Proportional scaling global normalisation
- if iGloNorm~=8, error('iGloNorm-iGMsca(8) mismatch for PropSca'), end
- gSF = GM./g;
- g = GM*ones(nScan,1);
- case {1,2,3,4,5,6,7}
- %-Grand mean scaling according to iGMsca
- gSF = GM./spm_meanby(g,eval(CCforms{iGMsca}));
- g = g.*gSF;
- case 9
- %-No grand mean scaling
- gSF = ones(nScan,1);
- otherwise
- error('illegal iGMsca')
- end
-
-
- %-Apply gSF to memory-mapped scalefactors to implement scaling
- %-------------------------------------------------------------------
- for i = 1:nScan
- VY(i).pinfo(1:2,:) = VY(i).pinfo(1:2,:)*gSF(i);
- end
-
-
- %-AnCova: Construct global nuisance covariates partition (if AnCova)
- %-------------------------------------------------------------------
- if any(iGloNorm == [1:7])
-
- %-Centre global covariate as requested
- %---------------------------------------------------------------
- switch iGC, case {1,2,3,4,5,6,7} %-Standard sCC options
- gc = spm_meanby(g,eval(CCforms{iGC}));
- case 8 %-No centering
- gc = 0;
- case 9 %-User specified centre
- %-gc set above
- case 10 %-As implied by AnCova option
- gc = spm_meanby(g,eval(CCforms{iGloNorm}));
- case 11 %-Around GM
- gc = GM;
- otherwise %-unknown iGC
- error('unexpected iGC value')
- end
-
-
- %-AnCova - add scaled centred global to DesMtx `G' partition
- %---------------------------------------------------------------
- rcname = 'global';
- tI = [eval(CFIforms{iGloNorm,1}),g - gc];
- tConst = CFIforms{iGloNorm,2};
- tFnames = [eval(CFIforms{iGloNorm,3}),{rcname}];
- [f,gnames] = spm_DesMtx(tI,tConst,tFnames);
- clear tI tConst tFnames
-
- %-Save GX info in xC struct for reference
- %---------------------------------------------------------------
- str = {sprintf('%s: %s',dstr{2},rcname)};
- if any(iGMsca==[1:7]), str=[str;{['(after ',sGMsca,')']}]; end
- if iGC ~= 8, str=[str;{['used centered ',sCC{iGC}]}]; end
- if iGloNorm > 1
- str=[str;{['fitted as interaction ',sCFI{iGloNorm}]}];
- end
- tmp = struct( 'rc',rg.*gSF, 'rcname',rcname,...
- 'c',f, 'cname' ,{gnames},...
- 'iCC',iGC, 'iCFI' ,iGloNorm,...
- 'type', 3,...
- 'cols',[1:size(f,2)] + size([H C B G],2),...
- 'descrip', {str} );
-
- G = [G,f]; Gnames = [Gnames; gnames];
- if isempty(xC), xC = tmp; else, xC = [xC,tmp]; end
-
-
- elseif iGloNorm==8 | iGXcalc>1
-
- %-Globals calculated, but not AnCova: Make a note of globals
- %---------------------------------------------------------------
- if iGloNorm==8
- str = { 'global values: (used for proportional scaling)';...
- '("raw" unscaled globals shown)'};
- elseif isfinite(M_T) & ~isreal(M_T)
- str = { 'global values: (used to compute analysis threshold)'};
- else
- str = { 'global values: (computed but not used)'};
- end
-
- rcname ='global';
- tmp = struct( 'rc',rg, 'rcname',rcname,...
- 'c',{[]}, 'cname' ,{{}},...
- 'iCC',0, 'iCFI' ,0,...
- 'type', 3,...
- 'cols', {[]},...
- 'descrip', {str} );
-
- if isempty(xC), xC = tmp; else, xC = [xC,tmp]; end
- end
-
-
- %-Save info on global calculation in xGX structure
- %-------------------------------------------------------------------
- xGX = struct(...
- 'iGXcalc',iGXcalc, 'sGXcalc',sGXcalc, 'rg',rg,...
- 'iGMsca',iGMsca, 'sGMsca',sGMsca, 'GM',GM,'gSF',gSF,...
- 'iGC', iGC, 'sGC', sCC{iGC}, 'gc', gc,...
- 'iGloNorm',iGloNorm, 'sGloNorm',sGloNorm);
-
-
-
- %-Construct masking information structure and compute actual analysis
- % threshold using scaled globals (rg.*gSF)
- %-------------------------------------------------------------------
- if isreal(M_T), M_TH = M_T * ones(nScan,1); %-NB: -Inf is real
- else, M_TH = imag(M_T) * (rg.*gSF); end
-
- if ~isempty(M_P)
- VM = spm_vol(char(M_P));
- xsM.Explicit_masking = [{'Yes: mask images :'};{VM.fname}'];
- else
- VM = [];
- xsM.Explicit_masking = 'No';
- end
- xM = struct('T',M_T, 'TH',M_TH, 'I',M_I, 'VM',{VM}, 'xs',xsM);
-
-
- %-Construct full design matrix (X), parameter names and structure (xX)
- %===================================================================
- X = [H C B G];
- tmp = cumsum([size(H,2), size(C,2), size(B,2), size(G,2)]);
- xX = struct( 'X', X,...
- 'iH', [1:size(H,2)],...
- 'iC', [1:size(C,2)] + tmp(1),...
- 'iB', [1:size(B,2)] + tmp(2),...
- 'iG', [1:size(G,2)] + tmp(3),...
- 'name', {[Hnames; Cnames; Bnames; Gnames]},...
- 'I', I,...
- 'sF', {D.sF});
-
-
- %-Design description (an nx2 cellstr) - for saving and display
- %===================================================================
- tmp = { sprintf('%d condition, +%d covariate, +%d block, +%d nuisance',...
- size(H,2),size(C,2),size(B,2),size(G,2));...
- sprintf('%d total, having %d degrees of freedom',...
- size(X,2),rank(X));...
- sprintf('leaving %d degrees of freedom from %d images',...
- size(X,1)-rank(X),size(X,1)) };
- xsDes = struct( 'Design', {D.DesName},...
- 'Global_calculation', {sGXcalc},...
- 'Grand_mean_scaling', {sGMsca},...
- 'Global_normalisation', {sGloNorm},...
- 'Parameters', {tmp} );
-
-
- fprintf('%30s\n','...done') %-#
-
-
-
- %-Assemble SPM structure
- %===================================================================
- SPM.xY.P = P; % filenames
- SPM.xY.VY = VY; % mapped data
- SPM.nscan = size(xX.X,1); % scan number
- SPM.xX = xX; % design structure
- SPM.xC = xC; % covariate structure
- SPM.xGX = xGX; % global structure
- SPM.xVi = xVi; % non-sphericity structure
- SPM.xM = xM; % mask structure
- SPM.xsDes = xsDes; % description
- SPM.SPMid = SPMid; % version
-
- % set output argument
- %-------------------------------------------------------------------
- varargout = {SPM};
-
- %-End: Cleanup GUI
- %===================================================================
- spm_clf(Finter)
- spm('Pointer','Arrow')
- fprintf('%-40s: %30s\n','Completed',spm('time')) %-#
- spm('FigName','Stats: configured',Finter,CmdLine);
- spm('Pointer','Arrow')
- fprintf('\n\n')
-
-
-
-case 'files&indices'
- %===================================================================
- % - Get files and factor indices
- %===================================================================
- % [P,I] = pr_spm_ui('Files&Indices',DsF,Dn,DbaTime,nV)
- % DbaTime=D.b.aTime; Dn=D.n; DsF=D.sF;
- if nargin<5, nV = 1; else, nV = varargin{5}; end
- if nargin<4, DbaTime = 1; else, DbaTime = varargin{4}; end
- if nargin<3, Dn = [Inf,Inf,Inf,Inf]; else, Dn=varargin{3}; end
- if nargin<2, DsF = {'Fac1','Fac2','Fac3','Fac4'}; else, DsF=varargin{2}; end
-
- %-Initialise variables
- %-------------------------------------------------------------------
- i4 = []; % factor 4 index (usually group)
- i3 = []; % factor 3 index (usually subject), per f4
- i2 = []; % factor 2 index (usually condition), per f3/f4
- i1 = []; % factor 1 index (usually replication), per f2/f3/f4
- P = {}; % cell array of string filenames
-
- %-Accrue filenames and factor level indicator vectors
- %-------------------------------------------------------------------
- bMV = nV>1;
- if isinf(Dn(4)), n4 = spm_input(['#',DsF{4},'''s'],'+1','n1');
- else, n4 = Dn(4); end
- bL4 = n4>1;
-
- ti2 = '';
- GUIpos = spm_input('!NextPos');
- for j4 = 1:n4
- spm_input('!SetNextPos',GUIpos);
- sF4P=''; if bL4, sF4P=[DsF{4},' ',int2str(j4),': ']; end
- if isinf(Dn(3)), n3=spm_input([sF4P,'#',DsF{3},'''s'],'+1','n1');
- else, n3 = Dn(3); end
- bL3 = n3>1;
-
- if DbaTime & Dn(2)>1
- %disp('NB:selecting in time order - manually specify conditions')
- %-NB: This means f2 levels might not be 1:n2
- GUIpos2 = spm_input('!NextPos');
- for j3 = 1:n3
- sF3P=''; if bL3, sF3P=[DsF{3},' ',int2str(j3),': ']; end
- str = [sF4P,sF3P];
- tP = {};
- n21 = Dn(2)*Dn(1);
- for v=1:nV
- vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end
- ttP = cellstr(pr_spm_select(n21,'image',[str,'select images',vstr]));
- n21 = length(ttP);
- tP = [tP,ttP];
- end
- ti2 = spm_input([str,' ',DsF{2},'?'],GUIpos2,'c',ti2',n21,Dn(2));
- %-Work out i1 & check
- [tl2,null,j] = unique(ti2);
- tn1 = zeros(size(tl2)); ti1 = zeros(size(ti2));
- for i=1:length(tl2)
- tn1(i)=sum(j==i); ti1(ti2==tl2(i))=1:tn1(i); end
- if isfinite(Dn(1)) & any(tn1~=Dn(1))
- %-#i1 levels mismatches specification in Dn(1)
- error(sprintf('#%s not %d as pre-specified',DsF{1},Dn(1)))
- end
- P = [P;tP];
- i4 = [i4; j4*ones(n21,1)];
- i3 = [i3; j3*ones(n21,1)];
- i2 = [i2; ti2];
- i1 = [i1; ti1];
- end
-
- else
-
- if isinf(Dn(2))
- n2 = spm_input([sF4P,'#',DsF{2},'''s'],'+1','n1');
- else
- n2 = Dn(2);
- end
- bL2 = n2>1;
-
- if n2==1 & Dn(1)==1 %-single scan per f3 (subj)
- %disp('NB:single scan per f3')
- str = [sF4P,'select images, ',DsF{3},' 1-',int2str(n3)];
- tP = {};
- for v=1:nV
- vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end
- ttP = cellstr(pr_spm_select(n3,'image',[str,vstr]));
- tP = [tP,ttP];
- end
- P = [P;tP];
- i4 = [i4; j4*ones(n3,1)];
- i3 = [i3; [1:n3]'];
- i2 = [i2; ones(n3,1)];
- i1 = [i1; ones(n3,1)];
- else
- %-multi scan per f3 (subj) case
- %disp('NB:multi scan per f3')
- for j3 = 1:n3
- sF3P=''; if bL3, sF3P=[DsF{3},' ',int2str(j3),': ']; end
- if Dn(1)==1
- %-No f1 (repl) within f2 (cond)
- %disp('NB:no f1 within f2')
- str = [sF4P,sF3P,'select images: ',DsF{2},...
- ' 1-',int2str(n2)];
- tP = {};
- for v=1:nV
- vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end
- ttP = cellstr(pr_spm_select(n2,'image',[str,vstr]));
- tP = [tP,ttP];
- end
- P = [P;tP];
- i4 = [i4; j4*ones(n2,1)];
- i3 = [i3; j3*ones(n2,1)];
- i2 = [i2; [1:n2]'];
- i1 = [i1; ones(n2,1)];
- else
- %-multi f1 (repl) within f2 (cond)
- %disp('NB:f1 within f2')
- for j2 = 1:n2
- sF2P='';
- if bL2, sF2P=[DsF{2},' ',int2str(j2),': ']; end
- str = [sF4P,sF3P,sF2P,' select images...'];
- tP = {};
- n1 = Dn(1);
- for v=1:nV
- vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end
- ttP = cellstr(pr_spm_select(n1,'image',[str,vstr]));
- n1 = length(ttP);
- tP = [tP,ttP];
- end
- P = [P;tP];
- i4 = [i4; j4*ones(n1,1)];
- i3 = [i3; j3*ones(n1,1)];
- i2 = [i2; j2*ones(n1,1)];
- i1 = [i1; [1:n1]'];
- end % (for j2)
- end % (if Dn(1)==1)
- end % (for j3)
- end % (if n2==1 &...)
- end % (if DbaTime & Dn(2)>1)
- end % (for j4)
- varargout = {P,[i1,i2,i3,i4]};
-
-
-case 'desdefs_stats'
-
- %===================================================================
- % - Basic Stats Design definitions...
- %===================================================================
- % D = pr_spm_ui('DesDefs_Stats');
- % These are the basic Stats design definitions...
-
- %-Note: struct expands cell array values to give multiple records:
- % => must embed cell arrays within another cell array!
- %-Negative indices indicate defaults (first used)
-
- D = struct(...
- 'DesName','One sample t-test',...
- 'n', [Inf 1 1 1], 'sF',{{'obs','','',''}},...
- 'Hform', 'I(:,2),''-'',''mean''',...
- 'Bform', '[]',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',-Inf,'I',Inf,'X',Inf),...
- 'b',struct('aTime',0));
-
- D = [D, struct(...
- 'DesName','Two sample t-test',...
- 'n', [Inf 2 1 1], 'sF',{{'obs','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',1))];
-
- D = [D, struct(...
- 'DesName','Paired t-test',...
- 'n', [1 2 Inf 1], 'sF',{{'','cond','pair',''}},...
- 'Hform', 'I(:,2),''-'',''condition''',...
- 'Bform', 'I(:,3),''-'',''\gamma''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
- D = [D, struct(...
- 'DesName','One way Anova',...
- 'n', [Inf Inf 1 1], 'sF',{{'repl','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', '[]',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
- D = [D, struct(...
- 'DesName','One way Anova (with constant)',...
- 'n', [Inf Inf 1 1], 'sF',{{'repl','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
- D = [D, struct(...
- 'DesName','One way Anova (Within-subjects)',...
- 'n', [1 Inf Inf 1],'sF',{{'repl','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
- D = [D, struct(...
- 'DesName','Simple regression (correlation)',...
- 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,2),''-'',''\mu''',...
- 'nC',[1,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
-
- D = [D, struct(...
- 'DesName','Multiple regression',...
- 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},...
- 'Hform', '[]',...
- 'Bform', '[]',...
- 'nC',[Inf,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
- D = [D, struct(...
- 'DesName','Multiple regression (with constant)',...
- 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,2),''-'',''\mu''',...
- 'nC',[Inf,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
- D = [D, struct(...
- 'DesName','AnCova',...
- 'n', [Inf Inf 1 1], 'sF',{{'repl','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,1],'iCC',{{8,1}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
- varargout = {D};
-
-
-case 'desdefs_pet'
- %===================================================================
- % - Standard (SPM99) PET/SPECT Design definitions...
- %===================================================================
- % D = pr_spm_ui('DesDefs_PET');
- % These are the standard PET design definitions...
-
- %-Single subject
- %-------------------------------------------------------------------
- D = struct(...
- 'DesName','Single-subject: conditions & covariates',...
- 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[Inf,Inf],'iCC',{{[-1,3,8],[-1,8]}},'iCFI',{{[1,3],1}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',1));
-
- D = [D, struct(...
- 'DesName','Single-subject: covariates only',...
- 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[Inf,Inf],'iCC',{{[-1,8],[-1,8]}},'iCFI',{{1,1}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',1))];
-
- %-Multi-subject
- %-------------------------------------------------------------------
- D = [D, struct(...
- 'DesName','Multi-subj: conditions & covariates',...
- 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[Inf,Inf],'iCC',{{[1,3,4,8],[1,4,8]}},'iCFI',{{[1,3,-4],[1,-4]}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,...
- 'iGloNorm',[4,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',1))];
-
- D = [D, struct(...
- 'DesName','Multi-subj: cond x subj interaction & covariates',...
- 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},...
- 'Hform', 'I(:,[3,2]),''-'',{''subj'',''cond''}',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[Inf,Inf],'iCC',{{[1,3,4,8],[1,4,8]}},'iCFI',{{[1,3,-4],[1,-4]}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,...
- 'iGloNorm',[4,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',1))];
-
- D = [D, struct(...
- 'DesName','Multi-subj: covariates only',...
- 'n',[Inf 1 Inf 1], 'sF',{{'repl','','subject',''}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[Inf,Inf],'iCC',{{[1,4,8],[1,4,8]}},'iCFI',{{[1,-4],[1,-4]}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,...
- 'iGloNorm',[4,8:9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
- %-Multi-group
- %-------------------------------------------------------------------
- D = [D, struct(...
- 'DesName','Multi-group: conditions & covariates',...
- 'n',[Inf Inf Inf Inf], 'sF',{{'repl','condition','subject','group'}},...
- 'Hform', 'I(:,[4,2]),''-'',{''stud'',''cond''}',...
- 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',...
- 'nC',[Inf,Inf],'iCC',{{[5:8],[5,7,8]}},'iCFI',{{[1,5,6,-7],[1,5,-7]}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-7,9],'GM',50,...
- 'iGloNorm',[7,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',1))];
-
- D = [D, struct(...
- 'DesName','Multi-group: covariates only',...
- 'n',[Inf 1 Inf Inf], 'sF',{{'repl','','subject','group'}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',...
- 'nC',[Inf,Inf],'iCC',{{[5,7,8],[5,7,8]}},'iCFI',{{[1,5,-7],[1,5,-7]}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-7,9],'GM',50,...
- 'iGloNorm',[7,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
- %-Population comparisons
- %-------------------------------------------------------------------
- D = [D, struct(...
- 'DesName',...
- 'Population main effect: 2 cond''s, 1 scan/cond (paired t-test)',...
- 'n',[1 2 Inf 1], 'sF',{{'','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
- 'iGloNorm',[8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
- D = [D, struct(...
- 'DesName',...
- 'Dodgy population main effect: >2 cond''s, 1 scan/cond',...
- 'n',[1 Inf Inf 1], 'sF',{{'','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
- 'iGloNorm',[8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
- D = [D, struct(...
- 'DesName','Compare-populations: 1 scan/subject (two sample t-test)',...
- 'n',[Inf 2 1 1], 'sF',{{'subject','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
- 'iGloNorm',[8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
- D = [D, struct(...
- 'DesName','Compare-populations: 1 scan/subject (AnCova)',...
- 'n',[Inf 2 1 1], 'sF',{{'subject','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,Inf],'iCC',{{8,1}},'iCFI',{{1,1}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
- %-The Full Monty!
- %-------------------------------------------------------------------
- D = [D, struct(...
- 'DesName','The Full Monty...',...
- 'n',[Inf Inf Inf Inf], 'sF',{{'repl','cond','subj','group'}},...
- 'Hform', 'I(:,[4,2]),''-'',{''stud'',''cond''}',...
- 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',...
- 'nC',[Inf,Inf],'iCC',{{[1:8],[1:8]}},'iCFI',{{[1:7],[1:7]}},...
- 'iGXcalc',[1,2,3],'iGMsca',[1:7],'GM',50,...
- 'iGloNorm',[1:9],'iGC',[1:11],...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',1))];
-
-
- varargout = {D};
-
-case 'desdefs_pet96'
- %===================================================================
- % - SPM96 PET/SPECT Design definitions...
- %===================================================================
- % D = pr_spm_ui('DesDefs_PET96');
-
- %-Single subject
- %-------------------------------------------------------------------
- D = struct(...
- 'DesName','SPM96:Single-subject: replicated conditions',...
- 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0));
-
- D = [D, struct(...
- 'DesName','SPM96:Single-subject: replicated conditions & covariates',...
- 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
- D = [D, struct(...
- 'DesName','SPM96:Single-subject: covariates only',...
- 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
- %-Multi-subject
- %-------------------------------------------------------------------
- D = [D, struct(...
- 'DesName','SPM96:Multi-subject: different conditions',...
- 'n', [1 Inf Inf 1], 'sF',{{'','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''scancond''',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,4,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
- D = [D, struct(...
- 'DesName','SPM96:Multi-subject: replicated conditions',...
- 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,4,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
- D = [D, struct(...
- 'DesName','SPM96:Multi-subject: different conditions & covariates',...
- 'n', [1 Inf Inf 1], 'sF',{{'','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,4],[1,4]}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,4,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
- D = [D, struct(...
- 'DesName','SPM96:Multi-subject: replicated conditions & covariates',...
- 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''condition''',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,3,4],[1,4]}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,4,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
- D = [D, struct(...
- 'DesName','SPM96:Multi-subject: covariates only',...
- 'n',[Inf 1 Inf 1], 'sF',{{'repl','','subject',''}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[Inf,Inf],'iCC',{{[1,4,8],[1,4,8]}},'iCFI',{{[1,4],[1,4]}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,4,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
- %-Multi-study
- %-------------------------------------------------------------------
- D = [D, struct(...
- 'DesName','SPM96:Multi-study: different conditions',...
- 'n',[1 Inf Inf Inf], 'sF',{{'','cond','subj','study'}},...
- 'Hform', 'I(:,[4,2]),''-'',{''study'',''cond''}',...
- 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
- 'iGloNorm',[1,5,7,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
- D = [D, struct(...
- 'DesName','SPM96:Multi-study: replicated conditions',...
- 'n',[Inf Inf Inf Inf], 'sF',{{'repl','cond','subj','study'}},...
- 'Hform', 'I(:,[4,2]),''-'',{''study'',''condition''}',...
- 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
- 'iGloNorm',[1,5,7,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
- D = [D, struct(...
- 'DesName','SPM96:Multi-study: different conditions & covariates',...
- 'n',[1 Inf Inf Inf], 'sF',{{'','cond','subj','study'}},...
- 'Hform', 'I(:,[4,2]),''-'',{''study'',''cond''}',...
- 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,6,7],[1,5,7]}},...
- 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
- 'iGloNorm',[1,5,7,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
- D = [D, struct(...
- 'DesName','SPM96:Multi-study: replicated conditions & covariates',...
- 'n',[Inf Inf Inf Inf], 'sF',{{'','cond','subj','study'}},...
- 'Hform', 'I(:,[4,2]),''-'',{''study'',''condition''}',...
- 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,6,7],[1,5,7]}},...
- 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
- 'iGloNorm',[1,5,7,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
- D = [D, struct(...
- 'DesName','SPM96:Multi-study: covariates only',...
- 'n',[Inf 1 Inf Inf], 'sF',{{'repl','','subj','study'}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,7],[1,5,7]}},...
- 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
- 'iGloNorm',[1,5,7,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
- %-Group comparisons
- %-------------------------------------------------------------------
- D = [D, struct(...
- 'DesName','SPM96:Compare-groups: 1 scan per subject',...
- 'n',[Inf Inf 1 1], 'sF',{{'subject','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', '[]',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
- varargout = {D};
-
-
-otherwise
- %===================================================================
- % - U N K N O W N A C T I O N
- %===================================================================
- warning(['Illegal Action string: ',Action])
-
- %===================================================================
- % - E N D
- %===================================================================
-end
-
-%=======================================================================
-%- S U B - F U N C T I O N S
-%=======================================================================
-
-function str = sf_estrrep(str,srstr)
-%=======================================================================
-for i = 1:size(srstr,1)
- str = strrep(str,srstr{i,1},srstr{i,2});
-end
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_unvec.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_unvec.m
deleted file mode 100644
index 3c01ac9..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_unvec.m
+++ /dev/null
@@ -1,64 +0,0 @@
-function [varargout] = pr_spm_unvec(vX,varargin)
-% unvectorises a vectorised array
-% FORMAT [X] = pr_spm_unvec(vX,X);
-% X - numeric, cell or stucture array
-% vX - pr_spm_vec(X)
-%
-% i.e. X = pr_spm_unvec(pr_spm_vec(X),X)
-% [X{:}] = pr_spm_unvec(pr_spm_vec(X{:}),X{:})
-% - (i.e. can also deal)
-%
-% see pr_spm_vec
-%__________________________________________________________________________
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% Karl Friston
-% $Id: spm_vec.m 184 2005-05-31 13:23:32Z karl $
-
-% deal to multiple outputs if necessary
-%--------------------------------------------------------------------------
-if nargout > 1
- varargout = pr_spm_unvec(vX,varargin);
- return
-end
-if length(varargin) == 1
- X = varargin{1};
-else
- X = varargin;
-end
-
-% fill in structure arrays
-%--------------------------------------------------------------------------
-if isstruct(X)
- f = fieldnames(X);
- for i = 1:length(f)
- c = {X.(f{i})};
- n = length(pr_spm_vec(c));
- c = pr_spm_unvec(vX(1:n),c);
- [X.(f{i})] = deal(c{:});
- vX = vX(n + 1:end);
- end
- varargout = {X};
- return
-end
-
-% fill in cells arrays
-%--------------------------------------------------------------------------
-if iscell(X)
- for i = 1:length(X(:))
- n = length(pr_spm_vec(X{i}));
- X{i} = pr_spm_unvec(vX(1:n),X{i});
- vX = vX(n + 1:end);
- end
- varargout = {X};
- return
-end
-
-% reshape numerical arrays
-%--------------------------------------------------------------------------
-if isnumeric(X)
- X(:) = vX;
-else
- X = [];
-end
-varargout = {X};
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_vec.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_vec.m
deleted file mode 100644
index d7d53a8..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_vec.m
+++ /dev/null
@@ -1,49 +0,0 @@
-function [vX] = pr_spm_vec(varargin)
-% vectorises a numeric, cell or structure array
-% FORMAT [vX] = pr_spm_vec(X);
-% X - numeric, cell or stucture array[s]
-% vX - vec(X)
-%__________________________________________________________________________
-%
-% e.g.:
-% spm_vec({eye(2) 3}) = [1 0 0 1 3]'
-%__________________________________________________________________________
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% Karl Friston
-% $Id: spm_vec.m 279 2005-11-08 19:11:28Z karl $
-
-% initialise X and vX
-%--------------------------------------------------------------------------
-X = varargin;
-if length(X) == 1
- X = X{1};
-end
-vX = [];
-
-% vectorise structure into cell arrays
-%--------------------------------------------------------------------------
-if isstruct(X)
- f = fieldnames(X);
- X = X(:);
- for i = 1:length(f)
- vX = cat(1,vX,pr_spm_vec({X.(f{i})}));
- end
- return
-end
-
-% vectorise cells into numerical arrays
-%--------------------------------------------------------------------------
-if iscell(X)
- X = X(:);
- for i = 1:length(X)
- vX = cat(1,vX,pr_spm_vec(X{i}));
- end
- return
-end
-
-% vectorise numerical arrays
-%--------------------------------------------------------------------------
-if isnumeric(X)
- vX = X(:);
-end
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_spm_volterra.m b/lib/marsbar-0.44/@mardo_5/private/pr_spm_volterra.m
deleted file mode 100644
index 3f1437c..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_spm_volterra.m
+++ /dev/null
@@ -1,95 +0,0 @@
-function [X,Xname,Fc] = pr_spm_volterra(U,bf,V)
-% generalized convolution of inputs (U) with basis set (bf)
-% FORMAT [X,Xname,Fc] = pr_spm_volterra(U,bf,V);
-% U - input structure array
-% bf - Basis functions
-% V - [1 or 2] order of Volterra expansion [default = 1]
-%
-% X - Design Matrix
-% Xname - names of regressors [columns] in X
-% Fc(j).i - indices pertaining to input i (and interactions)
-% Fc(j).name - names pertaining to input i (and interactions)
-%___________________________________________________________________________
-%
-% For first order expansions spm_Volterra simply convolves the causes
-% (e.g. stick functions) in U.u by the basis functions in bf to create
-% a design matrix X. For second order expansions new entries appear
-% in ind, bf and name that correspond to the interaction among the
-% orginal causes. The basis functions for these efects are two dimensional
-% and are used to assemble the second order kernel in spm_graph.m.
-% Second order effects are computed for only the first column of U.u.
-%___________________________________________________________________________
-% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
-
-% Karl Friston
-% $Id: spm_Volterra.m 112 2005-05-04 18:20:52Z john $
-
-
-
-% 1st order terms
-%---------------------------------------------------------------------------
-if nargin == 2, V = 1; end
-
-% Construct X
-%===========================================================================
-
-% 1st order terms
-%---------------------------------------------------------------------------
-X = [];
-Xname = {};
-ind = {};
-Uname = {};
-Fc = {};
-for i = 1:length(U)
- ind = [];
- for k = 1:size(U(i).u,2)
- for p = 1:size(bf,2)
- x = U(i).u(:,k);
- d = 1:length(x);
- x = conv(full(x),bf(:,p));
- x = x(d);
- X = [X x];
-
- % indices and regressor names
- %-----------------------------------------------------------
- str = sprintf('%s*bf(%i)',U(i).name{k},p);
- Xname{end + 1} = str;
- ind(end + 1) = size(X,2);
- end
- end
- Fc(end + 1).i = ind;
- Fc(end).name = U(i).name{1};
-end
-
-% return if first order
-%---------------------------------------------------------------------------
-if V == 1, return, end
-
-% 2nd order terms
-%---------------------------------------------------------------------------
-for i = 1:length(U)
-for j = i:length(U)
- ind = [];
- for p = 1:size(bf,2)
- for q = 1:size(bf,2)
- x = U(i).u(:,1);
- y = U(j).u(:,1);
- x = conv(full(x),bf(:,p));
- y = conv(full(y),bf(:,q));
- x = x(d);
- y = y(d);
- X = [X x.*y];
-
- % indices and regressor names
- %-----------------------------------------------------------
- str = sprintf('%s*bf(%i)x%s*bf(%i)',...
- U(i).name{1},p,...
- U(j).name{1},q);
- Xname{end + 1} = str;
- ind(end + 1) = size(X,2);
- end
- end
- Fc(end + 1).i = ind;
- Fc(end).name = [U(i).name{1} 'x' U(j).name{1}];
-end
-end
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_stat_compute.m b/lib/marsbar-0.44/@mardo_5/private/pr_stat_compute.m
deleted file mode 100644
index 211fd68..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_stat_compute.m
+++ /dev/null
@@ -1,81 +0,0 @@
-function [con,stat,Ps,Pc] = pr_stat_compute(SPM,Ic)
-% private function to compute statistics for SPM2 design
-% FORMAT [con stat Ps Pc] = pr_stat_compute(SPM,Ic)
-%
-% Input
-% SPM - SPM design structure
-% Ic - indices into contrast structure (xCon in SPM)
-%
-% Output
-% con - contrast value (ess for F test)
-% stat - statistic value
-% Ps - uncorrected p value
-% Pc - P value Bonferroni corrected for number of columns analyzed
-%
-% Based on:
-% @(#)spm_contrasts.m 2.3 Andrew Holmes, Karl Friston & Jean-Baptiste Poline 02/12/30
-%
-% $Id: pr_stat_compute.m 214 2004-01-22 20:23:58Z matthewbrett $
-
-%-Get contrast definitions (if available)
-%-----------------------------------------------------------------------
-try
- xCon = SPM.xCon;
-catch
- xCon = [];
-end
-
-%-set all contrasts by default
-%-----------------------------------------------------------------------
-if nargin < 2
- Ic = 1:length(xCon);
-end
-if any(Ic > length(xCon))
- error('Indices too large for contrast structure');
-end
-
-% OLS estimators and error variance estimate
-%----------------------------------------------------------------
-betas = SPM.betas;
-Hp = SPM.ResidualMS;
-
-%-Compute contrast and statistic parameters
-%=======================================================================
-df = [NaN SPM.xX.erdf];
-for i = 1:length(Ic)
-
- %-Canonicalise contrast structure with required fields
- %-------------------------------------------------------------------
- ic = Ic(i);
- X1o = spm_FcUtil('X1o',xCon(ic),SPM.xX.xKXs);
- [trMV,trMVMV] = spm_SpUtil('trMV',X1o,SPM.xX.V);
- df(1) = trMV^2/trMVMV; % eidf
-
- switch(xCon(ic).STAT)
-
- case {'T'} %-Implement contrast as sum of betas
-
- con(i,:) = xCon(ic).c'*betas;
- VcB = xCon(ic).c'*SPM.xX.Bcov*xCon(ic).c;
- stat(i,:) = con(i,:)./sqrt(Hp*VcB);
- Ps(i,:) = 1 - spm_Tcdf(stat(i,:),df(2));
-
- case 'F' %-Implement ESS
-
- %-Residual (in parameter space) forming mtx
- %-----------------------------------------------------------
- h = spm_FcUtil('Hsqr',xCon(ic),SPM.xX.xKXs);
- con(i,:) = sum((h * betas).^2, 1);
- stat(i,:) = con(i,:) ./ Hp / trMV;
- Ps(i,:) = (1 - spm_Fcdf(stat(i,:),df));
-
- otherwise
- %---------------------------------------------------------------
- error(['unknown STAT "',xCon(ic).STAT,'"'])
-
- end % (switch(xCon...)
-end
-
-% Compute corrected Bonferroni (corrected for number of regions)
-n = size(betas, 2);
-Pc = 1-(1-Ps).^n;
diff --git a/lib/marsbar-0.44/@mardo_5/private/pr_stat_compute_mv.m b/lib/marsbar-0.44/@mardo_5/private/pr_stat_compute_mv.m
deleted file mode 100644
index c94b6da..0000000
--- a/lib/marsbar-0.44/@mardo_5/private/pr_stat_compute_mv.m
+++ /dev/null
@@ -1,153 +0,0 @@
-function [MVres] = pr_stat_compute_mv(SPM,Ic)
-% private function to compute mutlivariate statistics across ROIs
-% FORMAT [MVres] = pr_stat_compute_mv(SPM,Ic)
-%
-% Input
-% SPM - SPM design structure
-% Ic - indices into contrast structure (xCon in SPM)
-%
-% Output
-% MVres - mulitvariate result structure
-%
-% $Id: pr_stat_compute_mv.m 92 2004-01-07 08:37:16Z matthewbrett $
-
-%-Get contrast definitions (if available)
-%-----------------------------------------------------------------------
-try
- xCon = SPM.xCon;
-catch
- xCon = [];
-end
-
-%-set all contrasts by default
-%-----------------------------------------------------------------------
-if nargin < 2
- Ic = 1:length(xCon);
-end
-if any(Ic > length(xCon))
- error('Indices too large for contrast structure');
-end
-
-
-% Get relevant fields from design
-xCon = xCon(Ic);
-Xs = SPM.xX.xKXs;
-V = SPM.xX.V;
-betas = SPM.betas;
-ResidualMS = SPM.ResidualMS;
-Y = summary_data(SPM.marsY);
-
-% setup calculation
-[nBetas nROI] = size(betas);
-nCon = length(xCon);
-[trRV trRVRV] = spm_SpUtil('trRV',Xs,V);
-erdf = trRV^2/trRVRV;
-RMS = sqrt(ResidualMS);
-
-%--------------------------------------------------------------------
-%- Multivariate analysis
-%--------------------------------------------------------------------
-
-MVres = struct('y_pre',[], 'y_obs', [], 'Pf', [], 'u', [], 'ds', [] );
-
-if nCon == 1, return, end
-
-YpY = Y'*Y;
-
-for ii = 1:nCon
-
- xC = xCon(ii);
-
- %--------------------------------------------------------------------
- [NF, nu, h, d, M12, XG, sXG] = sf_model_mlm(Xs, V, nROI, xC, erdf);
-
- %--------------------------------------------------------------------
- %- Compute svd
- %--------------------------------------------------------------------
- %- fprintf('%-40s\n','Computing Principal Components')
-
- Z = ((NF*betas)./(ones(size(NF,1),1)*RMS));
- S = Z*Z';
- S = S/sum(nROI);
- [u s u] = svd(S,0);
- ds = diag(s);
- clear s;
-
-
- %--------------------------------------------------------------------
- %- STATISTICS if any ...
- %--------------------------------------------------------------------
- %- Fq : F values for the last q eigein values.
- %- P : P values.for the last q eigein values.
-
- Fq = zeros(1,h);
- for q = 0:h-1;
- nu1 = d*(h-q);
- nu2 = d*nu - (d-1)*(4*(h-q)+2*nu)/(h-q+2);
- Fq(q+1) = ((nu-2)/nu) * nu2/(nu2-2)*sum(ds(q+1:h))/(h-q);
- end
- Pf = 1 - spm_Fcdf(Fq,nu1,nu2);
-
-
- %- fprintf('%-40s\n','Computing predicted and observed temporal reponse')
-%keyboard
-
- y_pre = (pinv(XG)'* M12 * u)*diag(sqrt(ds)); % predicted temporal reponse
-
- gV = (diag(1./sqrt(ds))*Z)'*u;
- y_obs = (Y./(ones(size(Y,1),1)*RMS)/nROI)*gV;
-
- %- save results for this constrast
- MVres(ii).y_pre = y_pre;
- MVres(ii).y_obs = y_obs;
- MVres(ii).Pf = Pf;
- MVres(ii).u = u;
- MVres(ii).ds = ds;
- MVres(ii).df = [nu1 nu2];
-
-end
-
-
-
-
-
-
-%===================================================================
-function [NF,nu,h,d,M12,XG,sXG] = sf_model_mlm(Xs, V, nROI, xC, erdf);
-% Set sub-space of interest and the related matrix of normalisation.
-% FORMAT [NF,nu,h,d,M12,XG] = mm_model();
-%- nu, h, d : degrees of freedom
-%- NF : matrix of normalisation
-%===================================================================
-
-
-%--------------------------------------------------------------------
-%- SET, COMPUTE,NORMALIZE SPACES OF INTEREST
-%--------------------------------------------------------------------
-%- set X10 and XG
-%- XG= X -PG(X), PG projection operator on XG (cf. eq 1, 2)
-%--------------------------------------------------------------------
-sX1o = spm_sp('set',spm_FcUtil('X1o',xC,Xs));
-sXG = spm_sp('set',spm_FcUtil('X0',xC,Xs));
-X1o = spm_sp('oP',sX1o,Xs.X);
-XG = spm_sp('r',sXG,Xs.X);
-
-%- Compute Normalized effexts : M1/2=X'G*V*XG (cf eq 3)
-%--------------------------------------------------------------------
-% warning off;
-up = spm_sp('ox',sX1o); ; %- PG=up*up'
-qi = up'*Xs.X;
-sigma = up'*V*up;
-M12 = (chol(sigma)*qi)';
-M_12 = pinv(M12);
-
-%- Compute NF : normalise factor (cf eq 4)
-%--------------------------------------------------------------------
-NF = M_12*spm_sp('X',Xs)'*spm_sp('r',sXG,spm_sp('X',Xs));
-
-%- degrees of freedom
-%- nROI : number of ROI (corresponds to the number of Resels)
-%--------------------------------------------------------------------
-d = nROI*(4*log(2)/pi)^(3/2);
-h = sX1o.rk; %-rank of the sub-space of interest.
-nu = erdf;
diff --git a/lib/marsbar-0.44/@mardo_5/type.m b/lib/marsbar-0.44/@mardo_5/type.m
deleted file mode 100644
index 9528374..0000000
--- a/lib/marsbar-0.44/@mardo_5/type.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function str = type(o)
-% returns SPM version string corresponding to design type
-%
-% $Id: type.m 76 2003-12-25 08:19:13Z matthewbrett $
-
-str = 'SPM5';
diff --git a/lib/marsbar-0.44/@mardo_5/ui_build.m b/lib/marsbar-0.44/@mardo_5/ui_build.m
deleted file mode 100644
index cfff637..0000000
--- a/lib/marsbar-0.44/@mardo_5/ui_build.m
+++ /dev/null
@@ -1,27 +0,0 @@
-function D = ui_build(D, dtype)
-% method to create / fill design via GUI
-% FORMAT D = ui_build(D, dtype)
-%
-% D - design object
-% dtype - one of 'PET', 'FMRI', 'Basic')
-%
-% Returns
-% D - design object with new design
-%
-% $Id: ui_build.m 263 2004-01-31 07:19:35Z matthewbrett $
-
-if nargin < 2
- error('Need design type');
-end
-
-switch lower(dtype)
- case 'pet'
- SPM = pr_spm_ui('cfg',spm_spm_ui('DesDefs_PET'));
- case 'basic'
- SPM = pr_spm_ui('cfg',spm_spm_ui('DesDefs_Stats'));
- case 'fmri'
- SPM = pr_fmri_design;
- otherwise
- error(['Did not recognize design type: ' dtype]);
-end
-D = des_struct(D, SPM);
diff --git a/lib/marsbar-0.44/@mardo_99/add_trial_f.m b/lib/marsbar-0.44/@mardo_99/add_trial_f.m
deleted file mode 100644
index 0f856e6..0000000
--- a/lib/marsbar-0.44/@mardo_99/add_trial_f.m
+++ /dev/null
@@ -1,54 +0,0 @@
-function [D, changef] = add_trial_f(D)
-% method to add trial-specific F contrasts
-%
-% D - design to put contrasts into
-%
-% Returns
-% D - design with any added contrasts
-% changef - set to 1 if any contrasts have been added
-%
-% The routine only adds contrasts that are not already present
-%
-% $Id$
-
-if ~strcmp(modality(D), 'fmri')
- error('Can only set trial-specific F contrasts for FMRI designs');
-end
-SPM = des_struct(D);
-xX = SPM.xX;
-
-%-Append contrasts for fMRI - specified by SPM.Sess(s).Fc(i)
-%-----------------------------------------------------------------------
-if ~isfield(SPM,'Sess')
- changef = 0;
- return;
-end
-
-Sess = SPM.Sess;
-xCon = [];
-if (Sess{1}.rep)
- for t = 1:length(Sess{1}.name)
- u = [];
- for s = 1:length(Sess)
- u = [u Sess{s}.col(Sess{s}.ind{t})];
- end
- q = 1:size(xX.X,2);
- q(u) = [];
- Fcname = Sess{s}.name{t};
- xcon = spm_FcUtil('Set',Fcname,'F','iX0',q,xX.xKXs);
- xCon = [xCon xcon];
- end
-else % Sessions are not repeated
- for s = 1:length(Sess)
- str = sprintf('Session %d: ',s);
- for t = 1:length(Sess{s}.name)
- q = 1:size(xX.X,2);
- q(Sess{s}.col(Sess{s}.ind{t})) = [];
- Fcname = [str Sess{s}.name{t}];
- xcon = spm_FcUtil('Set',Fcname,'F','iX0',q,xX.xKXs);
- xCon = [xCon xcon];
- end
- end
-end
-
-[D Ic changef] = add_contrasts(D, xCon);
diff --git a/lib/marsbar-0.44/@mardo_99/apply_filter.m b/lib/marsbar-0.44/@mardo_99/apply_filter.m
deleted file mode 100644
index 8bdd815..0000000
--- a/lib/marsbar-0.44/@mardo_99/apply_filter.m
+++ /dev/null
@@ -1,63 +0,0 @@
-function Y = apply_filter(D, Y, flags)
-% applies filter in design to data
-% FORMAT Y = apply_filter(D, Y, flags)
-%
-% D - design, which includes a filter
-% Y - data to filter (2D matrix or marsy data object)
-% flags - string specifying one option, or cell array specifying more
-% than one option, or struct with fields specifying options.
-% Values for strings, cell contents or field names are
-% 'sessions' - when used as struct field, value for field
-% specifies sessions to apply filter for. The
-% data size must match the length of the
-% included sessions.
-%
-% Returns
-% Y - filtered data
-%
-% $Id$
-
-if nargin < 2
- error('Need data to filter');
-end
-if nargin < 3
- flags = [];
-end
-if ~isempty(flags)
- if ischar(flags), flags = {flags}; end
- if iscell(flags)
- flags = cell2struct(repmat({''}, size(flags)), flags, 1);
- end
-end
-if ~is_fmri(D)
- return
-end
-if ~has_filter(D)
- error('This FMRI design does not contain a filter');
-end
-
-SPM = des_struct(D);
-K = SPM.xX.K;
-
-% Filtering from subset of sessions
-if isfield(flags, 'sessions')
- ss = flags.sessions;
- if ~isempty(ss)
- blk_rows = block_rows(D);
- if any(ss < 1 | ss > length(blk_rows))
- error('Sessions appear to be out of range');
- end
- K = K(ss);
- K{1}.row = blk_rows{ss} - blk_rows{ss}(1) + 1;
- end
-end
-
-if isa(Y, 'marsy') % marsy object
- rd = region_data(Y);
- for r = 1:length(rd)
- rd{r} = pr_spm_filter('apply', K, rd{r});
- end
- Y = region_data(Y, [], rd);
-else % 2D matrix
- Y = pr_spm_filter('apply', K, Y);
-end
diff --git a/lib/marsbar-0.44/@mardo_99/autocorr.m b/lib/marsbar-0.44/@mardo_99/autocorr.m
deleted file mode 100644
index 4a9f6b9..0000000
--- a/lib/marsbar-0.44/@mardo_99/autocorr.m
+++ /dev/null
@@ -1,11 +0,0 @@
-function D = autocorr(D, varargin)
-% method to report lack of autocorrelation options for SPM99
-% FORMAT D = autocorr(D, varargin)
-%
-% D - design object
-% varargin - any other parameters that may have been passed
-%
-% $Id$
-
-warning('There are no SPM99 autocorrelation options');
-return
diff --git a/lib/marsbar-0.44/@mardo_99/bf_dt.m b/lib/marsbar-0.44/@mardo_99/bf_dt.m
deleted file mode 100644
index 45e8791..0000000
--- a/lib/marsbar-0.44/@mardo_99/bf_dt.m
+++ /dev/null
@@ -1,7 +0,0 @@
-function d = bf_dt(D)
-% method returns length of time bin for basis functions
-%
-% $Id$
-
-SPM = des_struct(D);
-d = mars_struct('getifthere', SPM, 'xX', 'dt');
diff --git a/lib/marsbar-0.44/@mardo_99/block_cols.m b/lib/marsbar-0.44/@mardo_99/block_cols.m
deleted file mode 100644
index 66f34d8..0000000
--- a/lib/marsbar-0.44/@mardo_99/block_cols.m
+++ /dev/null
@@ -1,17 +0,0 @@
-function cols = block_cols(D)
-% method gets design columns for block (session / subject)
-% FORMAT cols = block_cols(D)
-%
-% Returns cell array of column indices (one per session)
-%
-% $Id$
-
-if ~is_fmri(D)
- error('Needs FMRI design');
-end
-
-SPM = des_struct(D);
-Sess = SPM.Sess;
-for i = 1:length(Sess)
- cols{i} = Sess{i}.col;
-end
diff --git a/lib/marsbar-0.44/@mardo_99/block_rows.m b/lib/marsbar-0.44/@mardo_99/block_rows.m
deleted file mode 100644
index 53a9b71..0000000
--- a/lib/marsbar-0.44/@mardo_99/block_rows.m
+++ /dev/null
@@ -1,22 +0,0 @@
-function rows = block_rows(D)
-% returns cell array of rows for each (subject/session) block
-%
-% $Id$
-
-SPM = des_struct(D);
-if strcmp(modality(D), 'fmri')
- Sess = SPM.Sess;
- for i = 1:length(Sess)
- rows{i} = Sess{i}.row;
- end
-else % PET I guess
- xX = SPM.xX;
- if ~isfield(xX, 'I')
- error('Expecting I field in SPM design');
- end
- scol = xX.I(:, 3); % the subject column
- subjnos = unique(scol);
- for s = 1:length(subjnos);
- rows{s} = find(scol == subjnos(s));
- end
-end
diff --git a/lib/marsbar-0.44/@mardo_99/can_mars_estimate.m b/lib/marsbar-0.44/@mardo_99/can_mars_estimate.m
deleted file mode 100644
index 4ae446e..0000000
--- a/lib/marsbar-0.44/@mardo_99/can_mars_estimate.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function tf = can_mars_estimate(D)
-% method returns 1 if design can be estimated in MarsBaR
-%
-% $Id$
-
-tf = ~is_fmri(D) | has_filter(D);
diff --git a/lib/marsbar-0.44/@mardo_99/compute_contrasts.m b/lib/marsbar-0.44/@mardo_99/compute_contrasts.m
deleted file mode 100644
index aa2131a..0000000
--- a/lib/marsbar-0.44/@mardo_99/compute_contrasts.m
+++ /dev/null
@@ -1,55 +0,0 @@
-function [marsS] = compute_contrasts(marsDe, Ic)
-% compute and return stats
-% FORMAT marsS = compute_contrasts(marsDe, Ic)
-%
-% marsDe - design object
-% Ic - indices into contrast structure
-%
-% Output
-% marsS - statistic result structure
-%
-% For the 'con', 'stat' 'P' 'Pc' fields below, the results are matrices
-% with one row per contrast, one column per ROI estimated
-%
-% The statistics results structure has fields
-% 'con' - contrast value (numerator of t statistic, or ESS for F)
-% 'stat' - t or F statistic value
-% 'P' - uncorrected P value
-% 'Pc' - P values corrected for number of ROIs
-% 'MVres' - multivariate results structure with fields
-% 'y_pre' - predicted temporal response
-% 'y_obs' - observerd temporal response
-% 'Pf' - probabability for last (rank of subspace)
-% eigenvalues
-% 'u' - principle components
-% 'ds' - component weights (diag(S))
-% 'df' - degrees of freedom for Pf
-% 'columns' - names of regions
-% 'rows' - cell array of structs, one per contrast calculated,
-% with fields:
-% 'name' - contrast name
-% 'stat' - statistic type (T|F)
-%
-% $Id$
-
-SPM = des_struct(marsDe);
-xCon = SPM.xCon;
-
-if nargin < 2
- Ic = 1:length(xCon);
-end
-
-%- results
-
-[marsS.con marsS.stat, marsS.P, marsS.Pc] = ...
- pr_stat_compute(xCon(Ic), SPM.xX.xKXs, SPM.xX.V, ...
- SPM.betas, SPM.ResidualMS);
-marsS.MVres = pr_stat_compute_mv(xCon(Ic), SPM.xX.xKXs, SPM.xX.V, ...
- SPM.betas, SPM.ResidualMS, ...
- summary_data(SPM.marsY));
-
-marsS.columns = region_name(SPM.marsY);
-for i = 1:length(Ic)
- marsS.rows{i}.name = xCon(Ic(i)).name;
- marsS.rows{i}.stat = xCon(Ic(i)).STAT;
-end
diff --git a/lib/marsbar-0.44/@mardo_99/convert_vols.m b/lib/marsbar-0.44/@mardo_99/convert_vols.m
deleted file mode 100644
index fd9c896..0000000
--- a/lib/marsbar-0.44/@mardo_99/convert_vols.m
+++ /dev/null
@@ -1,39 +0,0 @@
-function o = convert_vols(o, ver)
-% method that converts vol structs in design and converts to format 'ver'
-% FORMAT o = convert_fo(o, ver)
-%
-% Input
-% o - design object
-% ver - optional version for vols from '99' or '5'
-% Defaults to version for current SPM version
-%
-% Output
-% o - object with converted vols
-%
-% Example
-% % Convert vols to current format
-% o = convert_vols(o);
-%
-% % Convert to native format for SPM99 designs
-% o = convert_vols(o, native_vol_ver(o));
-%
-% $Id$
-
-if nargin < 2
- ver = mars_vol_utils('current_ver');
-end
-
-SPM = des_struct(o);
-SPM = sf_conv(SPM, ver, 'VY');
-SPM = sf_conv(SPM, ver, 'xM', 'VM');
-o = des_struct(o, SPM);
-
-return
-
-function S = sf_conv(S, ver, varargin)
-V = mars_struct('getifthere', S, varargin{:});
-if ~isempty(V)
- V = mars_vol_utils('convert', V, ver);
- S = setfield(S, varargin{:}, V);
-end
-return
diff --git a/lib/marsbar-0.44/@mardo_99/design_vol.m b/lib/marsbar-0.44/@mardo_99/design_vol.m
deleted file mode 100644
index fd3e39d..0000000
--- a/lib/marsbar-0.44/@mardo_99/design_vol.m
+++ /dev/null
@@ -1,28 +0,0 @@
-function V = design_vol(D, imgs)
-% returns vols in appropriate format for saving in design
-% FORMAT V = design_vol(D, imgs)
-%
-% Input
-% D - mardo design object
-% imgs - image names or vol structs
-%
-% Output
-% V - paths relative to swd
-%
-% $Id$
-
-if nargin < 2
- error('Need image information');
-end
-
-if isstruct(imgs) % vol struct, check for absolute path name
- imgs = strvcat(imgs(:).fname);
-end
-if iscell(imgs)
- imgs = char(imgs);
-end
-if ischar(imgs)
- V = spm_str_manip(imgs, 't');
-else
- error('Odd input format for images');
-end
diff --git a/lib/marsbar-0.44/@mardo_99/estimate.m b/lib/marsbar-0.44/@mardo_99/estimate.m
deleted file mode 100644
index a00b906..0000000
--- a/lib/marsbar-0.44/@mardo_99/estimate.m
+++ /dev/null
@@ -1,48 +0,0 @@
-function [marsD] = estimate(marsD, marsY, params)
-% estimate method - estimates GLM for SPM99 model
-%
-% marsD - SPM design object
-% marsY - MarsBaR data object, or 2D matrix
-% param - struct containing options
-% (not currently used)
-%
-% e.g.
-% % Estimate model on design D and data Y
-% E = estimate(D, Y);
-%
-% $Id$
-
-if nargin < 2
- error('Need data to estimate');
-end
-if nargin < 3
- params = [];
-end
-
-% ensure we have a data object
-marsY = marsy(marsY);
-
-% check design is complete
-if ~can_mars_estimate(marsD)
- error('This design needs more information before it can be estimated');
-end
-
-% Check data and design dimensions
-if n_time_points(marsY) ~= n_time_points(marsD)
- error('The data and design must have the same number of rows');
-end
-
-% get SPM design structure
-SPM = des_struct(marsD);
-
-% do estimation
-SPM = pr_estimate(SPM, marsY);
-SPM.marsY = marsY;
-
-% We must set SPMid to contain SPM99 string in order for the mardo_99 to
-% recognize this as an SPM99 design
-SPM.SPMid = sprintf('SPM99: MarsBaR estimation. mardo_99 version %s', ...
- marsD.cvs_version);
-
-% return modified structure
-marsD = des_struct(marsD, SPM);
diff --git a/lib/marsbar-0.44/@mardo_99/event_cols.m b/lib/marsbar-0.44/@mardo_99/event_cols.m
deleted file mode 100644
index 7d68245..0000000
--- a/lib/marsbar-0.44/@mardo_99/event_cols.m
+++ /dev/null
@@ -1,19 +0,0 @@
-function I = event_cols(D, e_spec)
-% method gets design columns for single event
-%
-% $Id$
-
-if nargin < 2
- error('Need design and event spec');
-end
-if ~is_fmri(D)
- error('Needs FMRI design');
-end
-
-SPM = des_struct(D);
-Sess = SPM.Sess;
-ss = e_spec(1);
-en = e_spec(2);
-
-j = 1:size(Sess{ss}.sf{en},2):length(Sess{ss}.ind{en});
-I = Sess{ss}.col(Sess{ss}.ind{en}(j));
diff --git a/lib/marsbar-0.44/@mardo_99/event_onsets.m b/lib/marsbar-0.44/@mardo_99/event_onsets.m
deleted file mode 100644
index b11212a..0000000
--- a/lib/marsbar-0.44/@mardo_99/event_onsets.m
+++ /dev/null
@@ -1,60 +0,0 @@
-function [onsets, durations] = event_onsets(D, e_spec)
-% method gets (estimated) onsets and durations for event/session
-% FORMAT [onsets durations] = event_onsets(D, e_spec)
-%
-% D - design object
-% e_spec - event specification (see event_fitted for details)
-%
-% Returns
-% onsets - onset times in TRs
-% durations - duration of events in TRs
-%
-% $Id$
-
-if nargin < 2
- error('Need design and event spec');
-end
-if ~is_fmri(D)
- error('Needs FMRI design');
-end
-if prod(size(e_spec)) > 2
- error('Can only deal with one event at a time');
-end
-dt = bf_dt(D);
-TR = tr(D);
-
-s={'SPM99 design: attempting dodgy reconstruction of onsets/durations', ...
- 'Reconstruction assumes that:',...
- 'Events of this trial type never overlap in time (before convolution)', ...
- '(if they do, your SPM99 model will be badly messed up in any case)',...
- 'and:', ...
- 'The gap between the end of one event and beginning of the next ', ...
- sprintf('is always more than %3.2f seconds', dt)};
-if verbose(D), warning(sprintf('%s\n', s{:})); end
-
-s = e_spec(1);
-e = e_spec(2);
-SPM = des_struct(D);
-sf = SPM.Sess{s}.sf{e}(:,1);
-
-sfi = find(sf);
-dsfi = [1; diff(sfi) > 1];
-onsets = sfi(logical(dsfi));
-durations = zeros(size(onsets));
-
-for oi = 1:length(onsets)
- pos = onsets(oi);
- durations(oi) = 0;
- while(sf(pos))
- durations(oi) = durations(oi) + 1;
- pos = pos + 1;
- if pos > length(sf), break, end
- end
-end
-
-sc = dt / TR;
-onsets = (onsets - 1) * sc;
-durations = (durations - 1) * sc;
-
-% In fact, the above is durations, as entered by the users. The durations
-% as expressed in the design matrix are given by (durations) * sc
diff --git a/lib/marsbar-0.44/@mardo_99/event_regressor.m b/lib/marsbar-0.44/@mardo_99/event_regressor.m
deleted file mode 100644
index 769e9ce..0000000
--- a/lib/marsbar-0.44/@mardo_99/event_regressor.m
+++ /dev/null
@@ -1,57 +0,0 @@
-function [X, dt] = event_regressor(D, e_spec, dur)
-% method gets estimated regressor for single event
-% FORMAT [X dt] = event_regressor(D, e_spec, dur)
-%
-% D - design object
-% e_spec - event specification (see event_fitted for details)
-% dur - event duration in seconds (default = 0)
-%
-% Returns
-% X - event regressor for single event
-% (one column per basis function used to model event)
-% dt - time units (seconds per row in X)
-%
-% $Id$
-
-if nargin < 2
- error('Need design and event spec');
-end
-if nargin < 3
- dur = 0;
-end
-if ~is_fmri(D)
- error('Needs FMRI design');
-end
-
-if size(e_spec, 1) == 1, e_spec = e_spec'; end
-
-SPM = des_struct(D);
-Sess = SPM.Sess;
-xX = SPM.xX;
-dt = xX.dt;
-ss = e_spec(1);
-en = e_spec(2);
-bf = full(Sess{ss}.bf{en});
-
-if ~dur
- % SPM99 uses one time bin for events with no duration
- sf = 1;
-else
- sf = ones(round(dur/dt), 1);
-end
-X = [];
-
-for b = 1:size(bf,2)
- X = [X conv(sf, bf(:,b))];
-end
-
-return
-
-% In SPM99 spm_graph, we also apply the filter
-K{1} = struct('HChoice', 'none',...
- 'HParam', [],...
- 'LChoice', xX.K{ss}.LChoice,...
- 'LParam', xX.K{ss}.LParam,...
- 'row', 1:size(X,1),...
- 'RT', dt);
-X = pr_spm_filter('apply',K,X);
diff --git a/lib/marsbar-0.44/@mardo_99/event_specs.m b/lib/marsbar-0.44/@mardo_99/event_specs.m
deleted file mode 100644
index 579655a..0000000
--- a/lib/marsbar-0.44/@mardo_99/event_specs.m
+++ /dev/null
@@ -1,31 +0,0 @@
-function [e_specs, e_names] = event_specs(D)
-% method to return event specifications for all event in model
-% FORMAT [e_specs e_names] = event_specs(D)
-%
-% D - design object
-%
-% Returns
-% e_specs - event specification 2 by N matrix where row 1 is the
-% session number of the event, row 2 is the event number in
-% the session
-%
-% e_names - names of each event
-%
-% $Id$
-
-if ~is_fmri(D)
- error('Needs FMRI design');
-end
-
-SPM = des_struct(D);
-Sess = SPM.Sess;
-nsess = length(Sess);
-
-e_specs = [];
-e_names = {};
-e_ctr = 1;
-for ss = 1:nsess
- nevs = length(Sess{ss}.name);
- e_specs = [e_specs [ones(1, nevs) * ss; 1:nevs]];
- e_names = [e_names Sess{ss}.name];
-end
diff --git a/lib/marsbar-0.44/@mardo_99/event_x_fir.m b/lib/marsbar-0.44/@mardo_99/event_x_fir.m
deleted file mode 100644
index d744f87..0000000
--- a/lib/marsbar-0.44/@mardo_99/event_x_fir.m
+++ /dev/null
@@ -1,95 +0,0 @@
-function Xn = event_x_fir(D, e_spec, bin_length, bin_no, opts)
-% method to return FIR design matrix columns for session
-% FORMAT Xn = event_x_fir(D, e_spec, bin_length, bin_no, opts)
-%
-% D - design object
-% e_spec - event specification for single event
-% [session no; event no]
-% bin_length - bin length in seconds
-% bin_no - number of bins for FIR
-% opts - structure, containing fields with options
-% 'single' - if field present, gives single FIR
-% This option removes any duration information, and
-% returns a simple per onset FIR model, where ones in the
-% design matrix corresponds to 1 event at the given
-% offset. See event_fitted_fir.m for more details.
-%
-% Returns
-% Xn - columns in design matrix for FIR model
-%
-% Note that we have a problem, in that the assumed start bin is not saved
-% in the SPM99 design format, so we have to hope it has not changed from
-% the current defaults.
-%
-% $Id$
-
-% global parameters
-global fMRI_T;
-global fMRI_T0;
-if isempty(fMRI_T), fMRI_T = 16; end;
-if isempty(fMRI_T0), fMRI_T0 = 1; end;
-
-if nargin < 2
- error('Need event specfication');
-end
-if nargin < 3
- bin_length = [];
-end
-if nargin < 4
- bin_no = [];
-end
-if nargin < 5
- opts = [];
-end
-
-s = e_spec(1);
-e = e_spec(2);
-if isempty(bin_length)
- bin_length = tr(D);
-end
-if isempty(bin_no)
- bin_no = round(25/bin_length);
-end
-
-SPM = des_struct(D);
-Sess = SPM.Sess{s};
-dt = SPM.xX.dt;
-
-% Check dt against fMRI_T, warn if it differs
-recorded_fMRI_T = round(SPM.xX.RT / dt);
-if recorded_fMRI_T ~= fMRI_T & verbose(D)
- warning(sprintf([...
- 'fMRI_T (%d) does not match recorded dt, using recorded dt (%d).\n' ...
- 'The original fMRI_T0 has not been recorded, assuming %d.'],...
- fMRI_T, recorded_fMRI_T, fMRI_T0));
-end
-T = recorded_fMRI_T;
-bf = kron(eye(bin_no),ones(round(bin_length/dt),1));
-bf = pr_spm_orth(bf);
-
-% Reset columns to 1 after orthogonalization
-BF{1} = bf / bf(1);
-
-k = length(Sess.row);
-
-if isfield(opts, 'single')
- [onsets durations] = event_onsets(D, e_spec);
- ons = sparse(k*T,1);
- for p = 1:length(onsets)
- q = round(onsets(p)*T + 1);
- ons(q) = 1;
- end
- SF{1} = ons(1:(k*T));
- if verbose(D) & any(diff(durations))
- warning(['Apparently there were different event durations; ' ...
- 'single FIR model likely to be invalid']);
- end
-else
- SF{1} = Sess.sf{e}(:,1);
-end
-
-Xn = pr_spm_volterra(SF,BF,{'FIR'},1);
-
-% Resample design matrix {X} at acquisition times
-%-----------------------------------------------
-Xn = Xn([0:k-1]*T + fMRI_T0,:);
diff --git a/lib/marsbar-0.44/@mardo_99/fill.m b/lib/marsbar-0.44/@mardo_99/fill.m
deleted file mode 100644
index e6b5f31..0000000
--- a/lib/marsbar-0.44/@mardo_99/fill.m
+++ /dev/null
@@ -1,248 +0,0 @@
-function D = fill(D, actions)
-% fills missing entries from SPM FMRI design matrix
-% FORMAT D = fill(D, actions)
-%
-% D - mardo object containing spm design
-% actions - string or cell array of strings with actions:
-% 'defaults' - fills empty parts of design with defaults
-% (in fact this is always done)
-% 'filter' - asks for and fills filter, autocorrelation
-% 'for_estimation - fills ready for estimation -> 'filter'
-% if there is no filter
-% 'images' - asks for and fills with images, mask, scaling
-%
-% Returns
-% D - returned mardo SPM design
-%
-% Copied/pasted then rearranged from SPM99 spm_fmri_spm_ui
-% Matthew Brett - 17/11/01 - MRS2TH
-%
-% $Id$
-
-if nargin < 2
- actions = '';
-end
-if ~is_fmri(D), return, end
-if isempty(actions), actions = {'defaults'}; end
-if ischar(actions), actions = {actions}; end
-fe = find(ismember(actions, 'for_estimation'));
-if ~isempty(fe)
- A = [];
- if is_fmri(D)
- if ~has_filter(D), A = {'filter'}; end
- end
- actions(fe) = [];
- actions = [actions(1:fe(1)-1) A actions(fe(1):end)];
-end
-actions = [{'defaults'}, actions];
-
-% Get design, put into some useful variables
-spmD = des_struct(D);
-xX = spmD.xX;
-if isfield(spmD, 'Sess')
- have_sess = 1;
- Sess = spmD.Sess;
-else
- have_sess = 0;
-end
-
-% get file indices
-%---------------------------------------------------------------
-row = block_rows(D);
-nsess = length(row);
-nscan = zeros(1,nsess);
-for i = 1:nsess
- nscan(i) = length(row{i});
-end
-
-done_list = {};
-for a = 1:length(actions)
- if ismember(actions{a}, done_list), continue, end
- done_list = [actions(a) done_list];
- switch lower(actions{a})
- case 'defaults'
-
- % prepare various default settings, offer to design
- xM = []; % masking
- xGX = []; % globals
- sGXcalc = 'none'; % global calculation description
- sGMsca = 'none'; % grand mean scaling description
- Global = 'None'; % proportional scaling or no
-
- BFstr = ''; DSstr = ''; ntr = [];
- if have_sess
- BFstr = Sess{1}.BFstr;
- DSstr = Sess{1}.DSstr;
- if ~length(xX.iC)
- DSstr = 'Block [session] effects only';
- end
-
- % Number of trial types per session
- for i = 1:length(Sess)
- ntr(i) = length(Sess{i}.name);
- end
- end
-
- xsDes = struct( 'Design', DSstr,...
- 'Basis_functions', BFstr,...
- 'Number_of_sessions', sprintf('%d',nsess),...
- 'Conditions_per_session', sprintf('%-3d',ntr),...
- 'Global_calculation', sGXcalc,...
- 'Grand_mean_scaling', sGMsca,...
- 'Global_normalisation', Global);
-
- if isfield(spmD, 'xsDes')
- xsDes = mars_struct('fillafromb', spmD.xsDes, xsDes);
- end
-
- spmD.xsDes = xsDes;
- spmD = mars_struct('merge', spmD, ...
- struct('xGX', xGX,...
- 'xM', xM));
-
- case 'images'
- [Finter,Fgraph,CmdLine] = spm('FnUIsetup','fMRI stats model setup',0);
- % select images into matrix P
- P = '';
- if nsess < 16
- for i = 1:nsess
- str = sprintf('select scans for session %0.0f',i);
- q = spm_get(nscan(i),mars_veropts('get_img_ext'),str);
- P = strvcat(P,q);
- end
- else
- str = sprintf('select scans for this study');
- P = spm_get(sum(nscan),mars_veropts('get_img_ext'),str);
- end
-
- % Assemble other design parameters
- %=======================================================================
- spm_help('!ContextHelp',mfilename)
- spm_input('Global intensity normalisation...',1,'d',mfilename);
-
- % Global normalization
- %-----------------------------------------------------------------------
- str = 'remove Global effects';
- Global = spm_input(str,'+1','scale|none',{'Scaling' 'None'});
- if ischar(Global),
- Global = {Global};
- end
-
- % get file identifiers and Global values
- %=======================================================================
- fprintf('%-40s: ','Mapping files') %-#
- VY = spm_vol(P);
- fprintf('%30s\n','...done') %-#
-
- %-Check compatability of images
- %-----------------------------------------------------------------------
- [samef msg] = mars_vol_check(VY);
- if ~samef, disp(char(msg)),error('Cannot use images'),end;
-
- %-Compute Global variate
- %-------------------------------------------------------------------
- GM = 100;
- q = sum(nscan);
- g = zeros(q,1);
- fprintf('%-40s: %30s','Calculating globals',' ');
- for i = 1:q
- fprintf('%s%30s',repmat(sprintf('\b'),1,30),sprintf('%4d/%-4d',i,q));
- g(i) = spm_global(VY(i));
- end
- fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done')
-
- % scale if specified (otherwise session specific grand mean scaling)
- %------------------------------------------------------------------
- gSF = GM./g;
- if strcmp(Global,'None')
- for i = 1:nsess
- j = row{i};
- gSF(j) = GM./mean(g(j));
- end
- end
-
- %-Apply gSF to memory-mapped scalefactors to implement scaling
- %---------------------------------------------------------------
- for i = 1:q, VY(i).pinfo(1:2,:) = VY(i).pinfo(1:2,:)*gSF(i); end
-
- sGXcalc = 'mean voxel value';
- sGMsca = 'session specific';
-
- %-Masking structure
- %---------------------------------------------------------------
- xM = struct('T', ones(q,1),...
- 'TH', g.*gSF,...
- 'I', 0,...
- 'VM', {[]},...
- 'xs', struct('Masking','analysis threshold'));
-
- % Global structure
- xGX.iGXcalc = Global{1};
- xGX.sGXcalc = sGXcalc;
- xGX.rg = g;
- xGX.sGMsca = sGMsca;
- xGX.GM = GM;
- xGX.gSF = gSF;
-
- xsDes = struct(...
- 'Global_calculation', sGXcalc,...
- 'Grand_mean_scaling', sGMsca,...
- 'Global_normalisation', Global);
-
- spmD.xsDes = mars_struct('ffillmerge',...
- spmD.xsDes,...
- xsDes);
- spmD = mars_struct('ffillmerge', ...
- spmD,...
- struct('xGX', xGX,...
- 'VY', VY,...
- 'xM', xM));
-
- case 'filter'
- % Get filter and autocorrelation options
- if ~have_sess, return, end
-
- [Finter,Fgraph,CmdLine] = spm('FnUIsetup','Set FMRI filter',0);
-
- % TR if not set (it should be)
- if ~isfield(xX, 'RT')
- spmD.xX.RT = spm_input('Interscan interval {secs}','+1');
- end
-
- spm_input('High and low pass filter','+1','d',mfilename)
- [spmD.xX.K HFstr LFstr] = pr_get_filter(spmD.xX.RT, Sess);
- xsDes = struct(...
- 'Interscan_interval', sprintf('%0.2f',spmD.xX.RT),...
- 'High_pass_Filter', LFstr,...
- 'Low_pass_Filter', HFstr);
- spmD.xsDes = mars_struct('ffillmerge',...
- spmD.xsDes,...
- xsDes);
-
- case 'autocorr'
- [Finter,Fgraph,CmdLine] = spm('FnUIsetup','FMRI autocorrelation model',0);
- % intrinsic autocorrelations (Vi)
- %-----------------------------------------------------------------------
- str = 'Model intrinsic correlations?';
- cVimenu = {'none','AR(1)'};
- cVi = spm_input(str,'+1','b',cVimenu);
-
- % create Vi struct
- %-----------------------------------------------------------------------
- Vi = speye(sum(nscan));
- xVi = struct('Vi',Vi,'Form',cVi);
- for i = 1:nsess
- xVi.row{i} = row{i};
- end
-
- % fill into design
- spmD.xX.xVi = xVi;
- spmD.xsDes.Intrinsic_correlations = cVi;
-
- otherwise
- error(['Unpredictable: ' actions{a}]);
- end
-end
-
-% put stuff into object
-D = des_struct(D,spmD);
diff --git a/lib/marsbar-0.44/@mardo_99/fwhm.m b/lib/marsbar-0.44/@mardo_99/fwhm.m
deleted file mode 100644
index e8598d2..0000000
--- a/lib/marsbar-0.44/@mardo_99/fwhm.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function f = fwhm(o)
-% method returns FWHM, or empty if not available
-%
-% $Id: tr.m,v 1.1 2004/01/26 22:08:55 matthewbrett Exp $
-
-f = [];
-SPM = des_struct(o);
-if mars_struct('isthere', SPM, 'FWHM')
- f = SPM.FWHM;
-end
diff --git a/lib/marsbar-0.44/@mardo_99/get_images.m b/lib/marsbar-0.44/@mardo_99/get_images.m
deleted file mode 100644
index b6494fd..0000000
--- a/lib/marsbar-0.44/@mardo_99/get_images.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function VY = get_images(marsD)
-% method to get image vols from design
-% FORMAT VY = get_images(marsD)
-%
-% $Id$
-
-D = des_struct(marsD);
-VY = D.VY;
diff --git a/lib/marsbar-0.44/@mardo_99/has_autocorr.m b/lib/marsbar-0.44/@mardo_99/has_autocorr.m
deleted file mode 100644
index c7c25ee..0000000
--- a/lib/marsbar-0.44/@mardo_99/has_autocorr.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function tf = has_autocorr(o)
-% returns 1 if object contains autocorrelation specification
-%
-% $Id$
-
-tf = 0;
diff --git a/lib/marsbar-0.44/@mardo_99/has_filter.m b/lib/marsbar-0.44/@mardo_99/has_filter.m
deleted file mode 100644
index bdbd733..0000000
--- a/lib/marsbar-0.44/@mardo_99/has_filter.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function tf = has_filter(o)
-% returns 1 if object contains filter
-%
-% $Id$
-
-tf = 0;
-des = des_struct(o);
-if isfield(des, 'xX')
- tf = isfield(des.xX, 'K');
-end
diff --git a/lib/marsbar-0.44/@mardo_99/has_images.m b/lib/marsbar-0.44/@mardo_99/has_images.m
deleted file mode 100644
index 66726a5..0000000
--- a/lib/marsbar-0.44/@mardo_99/has_images.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function tf = has_images(o)
-% returns 1 if design contains images
-%
-% $Id$
-
-tf = isfield(des_struct(o), 'VY');
diff --git a/lib/marsbar-0.44/@mardo_99/mardo_2.m b/lib/marsbar-0.44/@mardo_99/mardo_2.m
deleted file mode 100644
index 2bea93b..0000000
--- a/lib/marsbar-0.44/@mardo_99/mardo_2.m
+++ /dev/null
@@ -1,301 +0,0 @@
-function o = mardo_2(o)
-% method to convert SPM2 design to SPM99 design
-%
-% Heavily based with thanks on work by Jeff Cooper:
-% Written June 2003 by Jeff Cooper (jcooper@stanford.edu)
-%
-% $Id$
-
-% Process design
-params = paramfields(o);
-SPM99 = params.des_struct;
-xX = SPM99.xX;
-
-SPM.xY = struct('P', char(image_names(o)), ...
- 'VY', get_images(o));
-RT = mars_struct('getifthere', SPM99, 'xX', 'RT');
-if ~isempty(RT), SPM.xY.RT = RT; end
-
-SPM = mars_struct('merge', SPM, ...
- mars_struct('split', SPM99, {'xM', 'xGX'}));
-SPM.xCon = mars_struct('getifthere', SPM99, 'xCon');
-
-% This is the first substructure that we have to do some
-% actual work to assemble. Much of the details of the
-% condition structures (U) can be gleaned from the SPM99
-% Sess variable - onset vectors, stick functions, etc. - but
-% not quite everything. Trial durations are difficult to figure out, but
-% we'll give it a go here with the event_onsets method
-
-if isfield(SPM99, 'Sess'), Sess = SPM99.Sess; else Sess = []; end
-for i = 1:length(Sess)
- currsess = Sess{i};
-
- % indices for this session's row in design matrix
- SPM.Sess(i).row = currsess.row;
-
- % indices for this session's cols in design matrix
- SPM.Sess(i).col = currsess.col;
-
- % number of scans in this session
- SPM.nscan(i) = length(currsess.row);
-
- % We can use the length of the onset cell array as an
- % effective number of conditions variable - only 'true'
- % conditions have onset vectors, not Volterra items or
- % user-specified covariates.
- for j = 1:length(currsess.ons)
-
- % Try getting onsets and durations from design
- [ons dur] = event_onsets(D, [i j]);
-
- % time bin length in seconds
- SPM.Sess(i).U(j).dt = xX.dt;
-
- % name of trial type
- SPM.Sess(i).U(j).name = {currsess.name{j}};
-
- % vector of onsets
- SPM.Sess(i).U(j).ons = ons;
-
- % duration of trials
- SPM.Sess(i).U(j).dur = dur;
-
- % actual stick functions - SPM2 uses 32-bin offset.
- SPM.Sess(i).U(j).u = [zeros(32,1); currsess.sf{j}];
-
- % peristimulus time course (seconds)
- SPM.Sess(i).U(j).pst = currsess.pst{j};
-
- % parameter name
- SPM.Sess(i).U(j).P.name = currsess.Pname{j};
- if isempty(currsess.Pname{j})
- % SPM2 includes these values for 'none'
- % parameters - just mimicking what they do...
- SPM.Sess(i).U(j).P.name = 'none';
- SPM.Sess(i).U(j).P.P = currsess.ons{j}; % values of parameter
- SPM.Sess(i).U(j).P.h = 0; % order of polynomial expansion
- else
- SPM.Sess(i).U(j).P.name = currsess.Pname{j}; % parameter name
- SPM.Sess(i).U(j).P.P = currsess.Pv{j}; % parameter values
- % leave h and i blank for now...
- end
- end
- % SPM99 doesn't save regressors in independent
- % structures as SPM2 does, but it does always append
- % them to the end of the session and append 'user
- % specified covariates' to the description string of the
- % session if they exist, which we can use.
- %
- % First check and see if there are any:
- if ~(isempty(strfind(lower(currsess.DSstr), 'user specified covariates')))
- % i.e., some are in here, so find out what their indices
- % are - all the columns that don't correspond to
- % specified conditions with onsets and such.
- % Note that Volterra items aren't included in
- % onsets, either, but they are included in 'the 'name'
- % field - so we want to use that as our chopping
- % point for finding covariate columns - everything
- % after name is a covariate.
- reg_indices = currsess.col((length(currsess.name)+1):end);
- % extract values from design matrix
- SPM.Sess(i).C.C = xX.X(currsess.row, reg_indices); % user-specified covariate values
- SPM.Sess(i).name = xX.Xnames(reg_indices); % user-specified covariate names
- else
- % there are no user specified covariates
- SPM.Sess(i).C.C = [];
- SPM.Sess(i).C.name = {};
- end
- % Everything which is in the 'name' field is either an
- % actual condition or a Volterra item, so that's our
- % effective number for the Fc array.
- for j = 1:length(currsess.name)
- SPM.Sess(i).Fc(j).i = currsess.ind{j}; % index for input j and interactions
- SPM.Sess(i).Fc(j).name = char(currsess.name(j)); % name for input j and interactions
- end
-end % Session loop
-
-if ~isempty(Sess)
- %%%%%%%%%%
- % SPM.xBF - basis function structure
- %%%%%%%%%%
-
- % NOTE on the BF structure - where SPM99 allows the
- % individual specification of basis functions for each trial
- % type, SPM2 just has one basis function set for the whole
- % experiment. Since it's difficult to figure out which of
- % the various SPM99 basis functions to use on any kind of
- % reasoned basis, this program takes the arbitrary step of
- % just taking the first one from the first session. This
- % should work fine for most experiments, but those with
- % mixed basis functions that want to select a different one
- % among the ones save are encouraged to modify the lines
- % below to get the one to their liking...
- sess_idx_for_bf = 1;
- cond_idx_for_bf = 1;
-
- SPM.xBF.T = xX.RT / xX.dt;
-
- % # of time bins per scan
- % T0 - the reference time bin - isn't saved by SPM99, and
- % it's not extractable from the design matrix in any way I
- % can figure out. So we'll take a stab at loading it from
- % the site's defaults, and if you re-set it, you'd better be
- % paying attention...
- % first run local defaults file - that'll pull something
- % up uniquely.
- spm_defaults;
- global defaults; %SPM2-style
- global fMRI_T0; %SPM99-style
- if ~isempty(defaults)
- SPM.xBF.T0 = defaults.stats.fmri.t0; % reference time bin
- elseif ~isempty(fMRI_T0)
- SPM.xBF.T0 = fMRI_T0;
- else
- % shouldn't get here - there should be some defaults on
- % this system - but not a killer error. One they should
- % know about, though...
- disp('Warning: Defaults don''t contain reference slice value!');
- SPM.xBF.T0 = 1;
- end
- % SPM99 onsets were reconstructed in scan units
- % units that onsets are in ['scans', 'seconds']
- SPM.xBF.UNITS = 'scans';
- if length(SPM.Sess(1).U) < length(SPM.Sess(1).Fc)
- % Volterra flag [1=no Volterra, 2=Volterra modeled]
- SPM.xBF.Volterra = 2;
- else
- SPM.xBF.Volterra = 1;
- end
- SPM.xBF.dt = xX.dt; % time bin length in seconds
- SPM.xBF.name = ''; % string: type of basis function - not saved by SPM99 batching
- SPM.xBF.bf = Sess{sess_idx_for_bf}.bf(cond_idx_for_bf);
- % the actual basis function matrix
- % SPM99 doesn't explicitly save length or order of basis
- % functions, but this below should work for all non-Fourier,
- % non-Gamma basis fns, and maybe even some of them...
- SPM.xBF.length = xX.dt*size(SPM.xBF.bf, 1); % window length of basis fn in secs
- SPM.xBF.order = size(SPM.xBF.bf,2); % order of basis fn
-
-end
-
-%%%%%%%%%%
-% SPM.xVi - temporal non-sphericity struct
-%%%%%%%%%%
-
-% We'll be assuming that SPM99 results, in general, made the
-% i.i.d. assumption. Estimation of results with the AR(1)
-% option specified proceeds very differently in SPM2 than in
-% SPM99, and so those that used AR(1) in SPM99 are warned
-% that their results will not translate perfectly to SPM2,
-% as the whitening matrix W will always be set to identity
-% in importing these results.
-
-switch xX.xVi.Form
- case 'none'
- SPM.xVi.form = 'i.i.d'; % string description of xVi
- % covariance constraints - sparse identity matrix in this option for both SPM99 and SPM2.
- SPM.xVi.Vi = {xX.xVi.Vi};
- SPM.xVi.V = speye(size(xX.xVi)); % estimated non-sphericity itself.
- case 'AR(1)'
- SPM.xVi.form = 'AR(0.2)'; % string description of xVi - this is parallel to what SPM2 does
- SPM.xVi.Vi = {xX.xVi.Vi} % covariance constraints
-
- % I don't think this will actually make a
- % difference, as the whitening matrix W is always
- % going to be identity. But it may be useful to
- % have. True SPM2 results will also have xVi.V and
- % so forth, but not these imported ones...
-end
-
-%%%%%%%%%%
-% SPM.xX - design matrix structure
-%%%%%%%%%%
-
-% Here's the big 'un. Much of this stuff will be translated
-% directly from the SPM99 results, and it remains to be seen
-% how well that's going to work. We will assume that
-% ordinary least squares estimation has been used in SPM99,
-% and therefore set W to the identity matrix.
-
-SPM.xX = mars_struct('split', xX, ...
- {'X','iH', 'iC', 'iB', 'iG', 'V', 'I' ...
- 'xKXs', 'pKX', 'Bcov', 'trRV', 'trRVRV', 'erdf', 'nKX'});
-SPM.xX.name = xX.Xnames;
-if isfield(xX, 'K')
- if iscell(xX.K)
- for i = 1:length(xX.K)
- SPM.xX.K(i).RT = SPM.xY.RT; % experimental RT
- SPM.xX.K(i).row = xX.K{i}.row; % row indices in design matrix for this filter
- SPM.xX.K(i).HParam = xX.K{i}.HParam; % high-pass cutoff period in secs
- SPM.xX.K(i).X0 = full(xX.K{i}.KH); % frequencies to be removed by filter.
- end
- else
- SPM.xX.K = xX.K;
- end
-end
-SPM.xX.W = speye(size(xX.X,1)); % whitening matrix - identity for ordinary least squares estimates
-
-if isfield(SPM99, 'M')
- SPM.xVol = mars_struct('split', SPM99, ...
- {'M', 'DIM', 'XYZ', 'S', 'R', 'FWHM'});
- SPM.xVol.iM = inv(SPM.xVol.M); % inverse of M
- % We will deal with the RPV image later on...
-end
-
-%%%%%%%%%%
-% SPM.miscellaneous stuff
-%%%%%%%%%%
-
-% various string descriptions of experimental design
-SPM.xsDes = SPM99.xsDes;
-if isfield(SPM.xsDes, 'Conditions_per_session')
- SPM.xsDes.Trials_per_session = SPM.xsDes.Conditions_per_session;
- rmfield(SPM.xsDes, 'Conditions_per_session');
-end
-SPM.xsDes.Serial_correlations = SPM.xVi.form;
-
-SPM.SPMid = ['SPM2: Results imported from SPM99 design: ' SPM99.SPMid];
-
-% Try and deal with estimated result volumes
-if isfield(SPM99, 'swd')
- SPM.swd = SPM99.swd;
- if ~exist(SPM99.swd, 'dir')
- warning(['Could not find directory: ' SPM.swd]);
- else
- o_pwd = pwd;
- cd(SPM99.swd);
- if isfield(SPM99, 'Vbeta')
- for i = 1:length(SPM99.Vbeta)
- SPM.Vbeta(i) = spm_vol(SPM99.Vbeta{i});
- end
- SPM.VResMS = spm_vol(SPM99.VResMS);
- SPM.VM = spm_vol(SPM99.VM);
- end
- for i = 1:length(SPM.xCon)
- if ~isempty(SPM.xCon(i).Vcon)
- SPM.xCon(i).Vcon = spm_vol(SPM.xCon(i).Vcon);
- end
- if ~isempty(SPM.xCon(i).Vspm)
- SPM.xCon(i).Vspm = spm_vol(SPM.xCon(i).Vspm);
- end
- end
- if isfield(SPM99, 'M')
- % Now deal with RPV image
- if exist('RPV.img', 'file')
- % filehandle of resels per voxel image
- SPM.xVol.VRpv = spm_vol('RPV.img');
- else
- % Don't really understand this one...
- SPM.xVol.VRpv.fname = ['../' SPM.xVol.VRpv.fname];
- end
- end
- cd(o_pwd);
- end
-end
-
-% put into parent object
-params.des_struct = SPM;
-o = mardo_2(params);
-
-return
diff --git a/lib/marsbar-0.44/@mardo_99/mardo_99.m b/lib/marsbar-0.44/@mardo_99/mardo_99.m
deleted file mode 100644
index 4966f65..0000000
--- a/lib/marsbar-0.44/@mardo_99/mardo_99.m
+++ /dev/null
@@ -1,113 +0,0 @@
-function [o, others] = mardo_99(params, others, varargin)
-% class constructor for SPM99 MarsBaR design object
-% FORMAT [o, others] = mardo_99(params, others, varargin)
-% Inputs
-% params - structure,containing fields, or SPM/MarsBaR design
-% others - structure, containing other fields to define
-%
-% Outputs
-% o - mardo_99 object (unless disowned)
-% others - any unrecognized fields from params, for processing by
-% children
-%
-% This object is called from the mardo object contructor
-% with a mardo object as input. mardo_99 checks to see
-% if the contained design is an SPM99 design, returns
-% the object unchanged if not. If it is an SPM99
-% design, it claims ownership of the passed object.
-%
-% The constructor can also be called to give class functions, where the
-% name of the class function is a character string which is one of:
-% 'spm_filter' - applies spm_filter routine to passed args
-%
-% $Id$
-
-myclass = 'mardo_99';
-cvs_v = marsbar('ver'); % was CVS version; now marsbar version
-
-% Default object structure
-defstruct = [];
-
-if nargin < 1
- defstruct.cvs_version = cvs_v;
- o = class(defstruct, myclass, mardo);
- others = [];
- return
-end
-if nargin < 2
- others = [];
-end
-
-% parse out string action calls (class functions)
-if ischar(params)
- switch params
- case 'spm_filter'
- if nargin < 2
- error('Need filter');
- elseif nargin < 3
- error('Need action string');
- elseif nargin < 4
- o = pr_spm_filter(others, varargin{1});
- else
- o = pr_spm_filter(others, varargin{1:2});
- end
- return
- otherwise
- error(sprintf('Is "%s" a filename? Use ``mardo`` to load from files',...
- params));
- end
-end
-
-% Deal with passed objects of this (or child) class
-if isa(params, myclass)
- o = params;
- % Check for simple form of call
- if isempty(others), return, end
-
- % Otherwise, we are being asked to set fields of object
- % (Moot at the moment, as there are no fields specific for this object)
- [p others] = mars_struct('split', others, defstruct);
- return
-end
-
-% normal call is via mardo constructor
-if isa(params, 'mardo')
- % Check to see if this is a suitable design, return if not
- des = des_struct(params);
- if ~my_design(des), o = params; return, end
- uo = params;
- params = [];
-else
- uo = [];
-end
-
-if ~isa(uo, 'mardo') % mardo object not passed
- % umbrella object, parse out fields for (this object and children)
- % third argument of 0 prevents recursive call back to here
- [uo, params] = mardo(params, others, 0);
-else
- % fill params with other parameters
- params = mars_struct('ffillmerge', params, others);
-end
-
-% parse parameters into those for this object, children
-[params, others] = mars_struct('ffillsplit', defstruct, params);
-
-% add cvs tag
-params.cvs_version = cvs_v;
-
-% set the mardo object
-o = class(params, myclass, uo);
-
-% set filter (to allow sparse->full trick to work for spm_spm.m)
-SPM = des_struct(o);
-K = mars_struct('getifthere', SPM, 'xX', 'K');
-if iscell(K);
- SPM.xX.K = pr_spm_filter('set', K);
- o = des_struct(o, SPM);
-end
-
-% convert vols to current format
-o = convert_vols(o);
-
-return
diff --git a/lib/marsbar-0.44/@mardo_99/mars_spm_graph.m b/lib/marsbar-0.44/@mardo_99/mars_spm_graph.m
deleted file mode 100644
index dc945a0..0000000
--- a/lib/marsbar-0.44/@mardo_99/mars_spm_graph.m
+++ /dev/null
@@ -1,560 +0,0 @@
-function [r_st,marsD,changef] = mars_spm_graph(marsD,rno,Ic)
-% Graphical display of adjusted data
-% FORMAT [r_st,marsD,changef] = mars_spm_graph(marsD,rno,Ic)
-%
-% marsD - SPM design object
-% required fields in des_struct are:
-% xX - Design Matrix structure
-% - (see spm_spm.m for structure)
-% betas - the betas!
-% ResidualMS - the residual mean square
-% xCon - contrast definitions
-% - required fields are:
-% .c - contrast vector/matrix
-% (see spm_FcUtil.m for details of contrast structure... )
-% marsY - the data itself (as a data object)
-%
-% rno - region number (index for marsD.marsY)
-% Ic - contrast number (optional)
-%
-% Returns
-% r_st - return structure, with fields
-% Y - fitted data for the selected voxel
-% y - adjusted data for the selected voxel
-% beta - parameter estimates
-% SE - standard error of parameter estimates
-% cbeta = betas multiplied by contrast
-% marsD - design structure, with possibly added contrasts
-% changef - set to 1 if design has changed
-%
-% see spm99 version of spm_graph for details
-%_______________________________________________________________________
-% @(#)spm_graph.m 2.29 Karl Friston 00/09/14
-% Modified for MarsBar - Matthew Brett 1/11/01 NRN
-% Added return of cbetas at some point before 28/1/03
-%
-% $Id$
-
-if ~is_mars_estimated(marsD)
- error('Need estimated design for plot');
-end
-if nargin < 2
- rno = [];
-end
-if nargin < 3
- Ic = [];
-end
-changef = 0;
-
-% make values ready for return
-def_r_st = struct(...
- 'Y', [],...
- 'y', [],...
- 'beta', [],...
- 'SE', [],...
- 'cbeta',[]);
-cbeta = [];
-
-% get stuff from object
-mRes = des_struct(marsD);
-xCon = mRes.xCon;
-
-% Check if we want to, and can, assume region no is 1
-if isempty(rno)
- if n_regions(mRes.marsY) > 1
- error('Need to specify region number');
- end
- rno = 1;
-end
-
-%-Get Graphics figure handle
-%-----------------------------------------------------------------------
-Fgraph = spm_figure('GetWin','Graphics');
-
-%-Delete previous axis and their pagination controls (if any)
-%-----------------------------------------------------------------------
-spm_results_ui('Clear',Fgraph,2);
-
-% Get required data
-sY = summary_data(mRes.marsY);
-y = apply_filter(marsD, sY(:, rno));
-
-% Get design matrix for convenience
-xX = mRes.xX;
-
-% Label for region
-XYZstr = region_name(mRes.marsY, rno);
-XYZstr = XYZstr{1};
-
-%-Get parameter estimates, ResidualMS, (compute) fitted data & residuals
-%=======================================================================
-
-%-Parameter estimates: beta = xX.pKX*xX.K*y;
-%-----------------------------------------------------------------------
-beta = mRes.betas(:, rno);
-
-%-Compute residuals
-%-----------------------------------------------------------------------
-R = spm_sp('r',xX.xKXs,pr_spm_filter('apply',xX.K,y));
-
-%-Residual mean square: ResidualMS = sum(R.^2)/xX.trRV;
-%-----------------------------------------------------------------------
-ResidualMS = mRes.ResidualMS(rno);
-Bcov = xX.Bcov;
-SE = sqrt(ResidualMS*diag(Bcov));
-COL = ['r','b','g','c','y','m','r','b','g','c','y','m'];
-
-
-%-Plot
-%=======================================================================
-
-% find out what to plot
-%-----------------------------------------------------------------------
-Cplot = { 'Contrast of parameter estimates',...
- 'Fitted and adjusted responses',...
- 'Event/epoch-related responses',...
- 'Plots of parametric responses',...
- 'Volterra Kernels'};
-
-
-% ensure options are appropriate
-%-----------------------------------------------------------------------
-if ~isfield(mRes,'Sess')
-
- Cplot = Cplot(1:2);
-else
- Sess = mRes.Sess;
-end
-Cp = spm_input('Plot',-1,'m',Cplot);
-Cplot = Cplot{Cp};
-
-switch Cplot
-
-% select contrast to plot and compute fitted and adjusted data
-%----------------------------------------------------------------------
-case {'Contrast of parameter estimates','Fitted and adjusted responses'}
-
- % determine current contrasts
- %---------------------------------------------------------------
- if isempty(Ic)
- % determine which contrast
- %---------------------------------------------------------------
- [Ic marsD changef] = ui_get_contrasts(...
- marsD, 'T|F',1, 'Select contrast...', ' for plot', 1);
- if changef, xCon = get_contrasts(marsD); end
- end
- TITLE = {Cplot xCon(Ic).name};
-
- % fitted (corrected) data (Y = X1o*beta)
- %---------------------------------------------------------------
- Y = spm_FcUtil('Yc',xCon(Ic),xX.xKXs,beta);
-
- % adjusted data
- %---------------------------------------------------------------
- y = Y + R;
-
-end
-
-switch Cplot
-
-% plot parameter estimates
-%----------------------------------------------------------------------
-case 'Contrast of parameter estimates'
-
- % comute contrast of parameter estimates and standard error
- %--------------------------------------------------------------
- c = xCon(Ic).c;
- cbeta = c'*beta;
- SE = sqrt(ResidualMS*diag(c'*Bcov*c));
-
- % bar chart
- %--------------------------------------------------------------
- figure(Fgraph)
- subplot(2,1,2)
- h = bar(cbeta);
- set(h,'FaceColor',[1 1 1]*.8)
- for j = 1:length(cbeta)
- line([j j],([SE(j) 0 - SE(j)] + cbeta(j)),...
- 'LineWidth',3,'Color','r')
- end
- set(gca,'XLim',[0.4 (length(cbeta) + 0.6)])
- XLAB = 'effect';
- YLAB = ['size of effect',XYZstr];
-
-
-% all fitted effects or selected effects
-%-----------------------------------------------------------------------
-case 'Fitted and adjusted responses'
-
- % get ordinates
- %---------------------------------------------------------------
- Xplot = { 'an explanatory variable',...
- 'scan or time',...
- 'a user specified ordinate'};
-
- Cx = spm_input('plot against','!+1','m',Xplot);
-
- if Cx == 1
-
- str = 'Which column or effect?';
- i = spm_input(str,'!+1','m',xX.Xnames);
- x = xX.xKXs.X(:,i);
- XLAB = xX.Xnames{i};
-
- elseif Cx == 2
-
- if isfield(xX,'RT') & ~isempty(xX.RT)
- x = xX.RT*[1:size(Y,1)]';
- XLAB = 'time {seconds}';
- else
- x = [1:size(Y,1)]';
- XLAB = 'scan number';
- end
-
- elseif Cx == 3
-
- x = spm_input('enter ordinate','!+1','e','',size(Y,1));
- XLAB = 'ordinate';
-
- end
-
- % plot
- %---------------------------------------------------------------
- figure(Fgraph)
- subplot(2,1,2)
- [p q] = sort(x);
- if all(diff(x(q)))
- plot(x(q),y(q),':b'); hold on
- plot(x(q),y(q),'.b','MarkerSize',8); hold on
- plot(x(q),Y(q),'r' ); hold off
-
- else
- plot(x(q),y(q),'.b','MarkerSize',8); hold on
- plot(x(q),Y(q),'.r','MarkerSize',16); hold off
- xlim = get(gca,'XLim');
- xlim = [-1 1]*diff(xlim)/4 + xlim;
- set(gca,'XLim',xlim)
-
- end
- YLAB = ['response',XYZstr];
-
-
-% modeling evoked responses based on Sess
-%----------------------------------------------------------------------
-case 'Event/epoch-related responses'
-
-
- % average over sessions?
- %--------------------------------------------------------------
- ss = length(Sess);
- if ss > 1
-
- % determine if the same basis functions have been used
- %------------------------------------------------------
- for s = 1:ss
- rep = length(Sess{s}.bf) == length(Sess{1}.bf);
- if ~rep, break, end
- for t = 1:length(Sess{s}.bf)
- rep = all(size(Sess{s}.bf{t}) == size(Sess{1}.bf{t}));
- if ~rep, break, end
- rep = all(all( Sess{s}.bf{t} == Sess{1}.bf{t} ));
- if ~rep, break, end
- end
- if ~rep, break, end
- end
-
- % average over sessions?
- %------------------------------------------------------
- if rep
- str = 'average over sessions?';
- rep = spm_input(str,'+1','y/n',[1 0]);
- end
-
- % selected sessions
- %------------------------------------------------------
- if rep
- ss = 1:ss;
- else
- str = sprintf('which session (1 to %d)',ss);
- ss = spm_input(str,'+1','n','1',1,ss);
- end
- end
-
- % get plot type
- %--------------------------------------------------------------
- Rplot = { 'fitted response',...
- 'fitted response and PSTH',...
- 'fitted response +/- standard error',...
- 'fitted response and adjusted data'};
-
- if isempty(y), Rplot = Rplot([1 3]); end
- Cr = spm_input('plot in terms of','+1','m',Rplot);
- TITLE = Rplot{Cr};
- YLAB = ['response',XYZstr];
- XLAB{1} = 'peri-stimulus time {secs}';
-
-
- % get selected trials
- %--------------------------------------------------------------
- tr = length(Sess{ss(1)}.pst);
- if tr > 1
- str = sprintf('which trials or conditions (1 to %d)',tr);
- tr = spm_input(str,'+1','n');
- end
-
-
- % plot
- %--------------------------------------------------------------
- switch TITLE
- case 'fitted response and PSTH'
- str = 'bin size for PSTH {secs}';
- BIN = spm_input(str,'+1','r','2',1);
-
- otherwise, BIN = 2; end
-
- % reconstruct response with filtering
- %--------------------------------------------------------------
- figure(Fgraph)
- subplot(2,1,2)
- hold on
- dx = xX.dt;
- XLim = 0;
- u = 1;
- for t = tr
-
- for s = ss
-
- % basis functions, filter and parameters
- %----------------------------------------------
- j = 1:size(Sess{s}.sf{t},2):length(Sess{s}.ind{t});
- j = Sess{s}.col(Sess{s}.ind{t}(j));
- B = beta(j);
- X = Sess{s}.bf{t};
- q = 1:size(X,1);
- x = (q - 1)*dx;
- K{1} = struct( 'HChoice', 'none',...
- 'HParam', [],...
- 'LChoice', xX.K{s}.LChoice,...
- 'LParam', xX.K{s}.LParam,...
- 'row', q,...
- 'RT', dx);
-
- % fitted responses with standard error
- %----------------------------------------------
- KX = pr_spm_filter('apply',K,X);
- Y(q,s) = KX*B;
- se(:,s) = sqrt(diag(X*Bcov(j,j)*X')*ResidualMS);
- end
-
- % average over sessions
- %------------------------------------------------------
- Y = sum(Y,2)/length(ss);
-
- % peristimulus times and adjusted data (Y + R)
- %------------------------------------------------------
- pst = [];
- y = [];
- for s = ss
- p = Sess{s}.pst{t}(:);
- bin = round(p/dx);
- q = find((bin >= 0) & (bin < size(X,1)));
- pst = [pst; p];
- p = R(Sess{s}.row(:));
- p(q) = p(q) + Y(bin(q) + 1);
- y = [y; p];
- end
-
-
- % PSTH
- %------------------------------------------------------
- INT = -BIN:BIN:max(pst);
- PSTH = [];
- SEM = [];
- PST = [];
- for k = 1:(length(INT) - 1)
- q = find(pst > INT(k) & pst <= INT(k + 1));
- n = length(q);
- if n
- PSTH = [PSTH mean(y(q))];
- SEM = [SEM std(y(q))/sqrt(n)];
- PST = [PST mean(pst(q))];
- end
- end
-
- % plot
- %------------------------------------------------------
- switch TITLE
-
- case 'fitted response'
- %----------------------------------------------
- plot(x,Y,COL(u))
-
- case 'fitted response and PSTH'
- %----------------------------------------------
- errorbar(PST,PSTH,SEM,[':' COL(u)])
- plot(PST,PSTH,['.' COL(u)],'MarkerSize',16)
- plot(PST,PSTH,COL(u),'LineWidth',2)
- plot(x,Y,['-.' COL(u)])
-
- case 'fitted response +/- standard error'
- %----------------------------------------------
- plot(x,Y,COL(u))
- plot(x,Y + se,['-.' COL(u)],x,Y - se,['-.' COL(u)])
-
- case 'fitted response and adjusted data'
- %----------------------------------------------
- plot(x,Y,COL(u),pst,y,['.' COL(u)],'MarkerSize',8)
-
- end
-
- % xlabel
- %------------------------------------------------------
- XLAB{end + 1} = [Sess{s}.name{t} ' - ' COL(u)];
- u = u + 1;
- XLim = max([XLim max(x)]);
-
- end
-
- hold off; axis on
- set(gca,'XLim',[-4 XLim])
-
-% modeling evoked responses based on Sess
-%----------------------------------------------------------------------
-case 'Plots of parametric responses'
-
- % Get session
- %--------------------------------------------------------------
- s = length(Sess);
- if s > 1
- s = spm_input('which session','+1','n1',[],s);
- end
-
- % Get [parametric] trial
- %--------------------------------------------------------------
- Vname = {};
- j = [];
- for i = 1:length(Sess{s}.Pv)
- if length(Sess{s}.Pv{i})
- Vname{end + 1} = Sess{s}.name{i};
- j = [j i];
- end
- end
- if isempty(Vname)
- warning('No parametric responses specified');
- end
- t = j(spm_input('which effect','+1','m',Vname));
-
- % parameter estimates and fitted response
- %-------------------------------------------------------------
- B = beta(Sess{s}.col(Sess{s}.ind{t}));
- Q = Sess{s}.Pv{t};
- SF = Sess{s}.sf{t};
- SF = SF(find(SF(:,1)),:);
- X = Sess{s}.bf{t};
- q = 1:size(X,1);
- x = q*xX.dt;
- K{1} = struct( 'HChoice', 'none',...
- 'HParam', [],...
- 'LChoice', xX.K{s}.LChoice,...
- 'LParam', xX.K{s}.LParam,...
- 'row', q,...
- 'RT', xX.dt);
-
- KX = pr_spm_filter('apply',K,X);
- p = size(SF,2);
- b = [];
- for i = 1:size(KX,2)
- b = [b SF*B([1:p] + (i - 1)*p)];
- end
- Y = KX*b';
-
- % plot
- %-------------------------------------------------------------
- figure(Fgraph)
- subplot(2,1,2)
- surf(x',Q',Y')
- shading flat
- TITLE = Sess{s}.name{t};
- XLAB = 'perstimulus time (secs)';
- YLAB = Sess{s}.Pname{t};
- zlabel(['responses',XYZstr]);
-
-
-% modeling evoked responses based on Sess
-%----------------------------------------------------------------------
-case 'Volterra Kernels'
-
-
- % Get session
- %--------------------------------------------------------------
- s = length(Sess);
- if s > 1
- s = spm_input('which session','+1','n1',[],s);
- end
-
- % Get [non-parametric] trial
- %--------------------------------------------------------------
- Vname = {};
- j = [];
- for i = 1:length(Sess{s}.name)
- Vname{end + 1} = Sess{s}.name{i};
- end
- t = spm_input('which effect','+1','m',Vname);
-
- % Parameter estimates
- %--------------------------------------------------------------
- B = beta(Sess{s}.col(Sess{s}.ind{t}));
-
- % plot
- %--------------------------------------------------------------
- figure(Fgraph)
- subplot(2,1,2)
-
- % second order kernel
- %--------------------------------------------------------------
- if iscell(Sess{s}.bf{t})
-
- Y = 0;
- for i = 1:length(Sess{s}.bf{t})
- Y = Y + B(i)*Sess{s}.bf{t}{i};
- end
- p = ([1:size(Y,2)] - 1)*xX.dt;
- q = ([1:size(Y,1)] - 1)*xX.dt;
- imagesc(p,q,Y)
- axis xy
-
- TITLE = {'Second order Volterra Kernel' Sess{s}.name{t}};
- XLAB = 'perstimulus time (secs)';
- YLAB = 'perstimulus time (secs)';
-
- % first order kernel
- %--------------------------------------------------------------
- else
- j = 1:size(Sess{s}.sf{t},2):length(Sess{s}.ind{t});
- Y = Sess{s}.bf{t}*B(j);
- p = ([1:length(Y)] - 1)*xX.dt;
- plot(p,Y)
- grid on
-
- TITLE = {'First order Volterra Kernel' Sess{s}.name{t}};
- XLAB = 'perstimulus time (secs)';
- YLAB = ['responses',XYZstr];
-
- end
-end
-
-%-Label and call Plot UI
-%----------------------------------------------------------------------
-axis square
-if strcmp(get(get(gca,'Children'),'type'),'image')
- axis image
-end
-xlabel(XLAB,'FontSize',10)
-ylabel(YLAB,'FontSize',10)
-title(TITLE,'FontSize',16)
-
-spm_results_ui('PlotUi',gca)
-
-% Complete return values
-r_st = mars_struct('fillafromb', def_r_st, struct(...
- 'Y', Y, 'y', y, 'beta', beta, 'SE', SE, 'cbeta', cbeta));
diff --git a/lib/marsbar-0.44/@mardo_99/modality.m b/lib/marsbar-0.44/@mardo_99/modality.m
deleted file mode 100644
index abf2b3b..0000000
--- a/lib/marsbar-0.44/@mardo_99/modality.m
+++ /dev/null
@@ -1,12 +0,0 @@
-function mod_str = modality(D)
-% method returns modality of design
-%
-% $Id$
-
-SPM = des_struct(D);
-try
- SPM.Sess{1};
- mod_str = 'fmri';
-catch
- mod_str = 'pet';
-end
diff --git a/lib/marsbar-0.44/@mardo_99/private/my_design.m b/lib/marsbar-0.44/@mardo_99/private/my_design.m
deleted file mode 100644
index f355cc0..0000000
--- a/lib/marsbar-0.44/@mardo_99/private/my_design.m
+++ /dev/null
@@ -1,12 +0,0 @@
-function tf = my_design(des)
-% returns 1 if design looks like it is of SPM99 type
-%
-% $Id$
-
-tf = 0;
-if isfield(des, 'SPMid')
- % Can be SPM99 design with SPM99 tag or MarsBaR tag
- % (MarsBaR tag used only by MarsBaR <= 0.23)
- tf = ~isempty(strmatch('SPM99', des.SPMid)) | ...
- ~isempty(strmatch('MarsBar', des.SPMid));
-end
diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_estimate.m b/lib/marsbar-0.44/@mardo_99/private/pr_estimate.m
deleted file mode 100644
index f5462a9..0000000
--- a/lib/marsbar-0.44/@mardo_99/private/pr_estimate.m
+++ /dev/null
@@ -1,169 +0,0 @@
-function SPM = pr_estimate(SPM, marsY)
-% Estimation of a General Linear Model
-% FORMAT SPM = pr_estimate(SPM, marsY)
-% Inputs
-% SPM - SPM design structure
-% marsY - marsY data object, or 2D data (Y) matrix
-%
-% Outputs
-% SPM - modified estimated design structure, with data contained as
-% field marsY
-%
-% Originally written by Jean-Baptiste Poline
-% $Id$
-
-%-Say hello
-%-----------------------------------------------------------------------
-Finter = spm('FigName','Stats: estimation...'); spm('Pointer','Watch');
-
-%-------------------------------------------------------------------------
-%- set the methods
-
-COV_estim = 'assumed'; % covariance is assumed to be imposed by filter K
-GLM_resol = 'OLS'; % ordinary least square
-
-
-%-------------------------------------------------------------------------
-%- get the design structure, the filter and the data
-xX = SPM.xX;
-if ~isfield(xX,'X'),
- error('The design does not contain a design matrix');
-end
-
-% allow matrix or object to be passed as input data
-marsY = marsy(marsY);
-Y = summary_data(marsY);
-n_roi = size(Y,2); %- Y is a time by n_roi matrix
-
-% Remove columns with no variance
-in_cols = any(diff(Y));
-if ~any(in_cols), error('No variance to estimate model'); end
-Y = Y(:, in_cols);
-
-% We are going to ignore AR(1) options
-if mars_struct('isthere', xX, 'xVi', 'Form')
- if ~strcmp(xX.xVi.Form, 'none')
- warning(['Sorry, we are going to ignore autocorrelation option: ' ...
- xX.xVi.Form]);
- end
-end
-
-%----------------------------------------------------------------------------------
-%- Estimation of the covariance structure of the Ys
-fprintf('\nEstimating covariance...');
-switch COV_estim
-
- case {'AR(p)'}
- %- compute the temporal cov of Y (V) with AR(p)
- if ~isfield(xX,'xVi')
- xX.xVi = struct( 'Vi', speye(size(xX.X,1)),...
- 'Form', 'AR(p)');
- end
- % xX.xVi = estimate_cov(Y,xX);
-
-
- case {'assumed'}
- if ~isfield(xX,'xVi')
- xX.xVi = struct( 'Vi', speye(size(xX.X,1)),...
- 'Form', 'none');
- end
- %- else, the covariance structure is supposed to be
- %- stored in xX.xVi
-
- otherwise
- warning('COV_estim does not exist');
-end
-fprintf('Done\n');
-
-switch GLM_resol
-
- case {'OLS'}
- fprintf('Using OLS\n');
- %- no filter already defined
- if ~isfield(xX,'K')
- xX.K = speye(size(xX.X,1));
- end
- % else assume that the filter is xX.K
-
- KVi = pr_spm_filter('apply', xX.K, xX.xVi.Vi);
- V = pr_spm_filter('apply', xX.K, KVi');
- Y = pr_spm_filter('apply', xX.K, Y);
- fprintf('Setting filter...');
- KXs = spm_sp('Set', pr_spm_filter('apply', xX.K, xX.X));
- fprintf('Done.\n');
- clear KVi;
-
- case {'MaxLik'}
- 'MaxLik'
- %- compute the inverse filter - put it in K ?
- %- filter data and design
- %- V = speye(size(xX.X,1));
-
- otherwise
- warning('GLM_resol does not exist');
-end
-
-%- compute GLM
-fprintf('Computing estimates...');
-if ~spm_sp('isspc',KXs), Xs = spm_sp('set',KXs); else Xs = KXs; end
-
-[trRV trRVRV] = spm_SpUtil('trRV',Xs,V);
-beta = spm_sp('x-', Xs, Y); %-Parameter estimates
-res = spm_sp('r', Xs, Y); %-Residuals
-ResMS = sum(res.^2)./trRV; %-Res variance estimation
-xX.erdf = trRV^2/trRVRV;
-
-fprintf('Done.\n');
-
-% fill up design related stuff
-xX.V = V; %-V matrix
-xX.xKXs = KXs; %-Filtered design matrix
-xX.pKX = spm_sp('x-',xX.xKXs);
-xX.pKXV = xX.pKX*xX.V; %-for contrast variance weight
-xX.Bcov = xX.pKXV*xX.pKX'; %-Variance of est. param.
-[xX.trRV,xX.trRVRV] ... %-Variance expectations
- = spm_SpUtil('trRV',xX.xKXs,xX.V);
-xX.nKX = spm_DesMtx('sca',xX.xKXs.X,xX.Xnames);% scaled design matrix for display
-
-% Put back into design
-nBeta = size(xX.X, 2);
-SPM.betas = ones(nBeta, n_roi) + NaN;
-SPM.betas(:, in_cols) = beta;
-SPM.ResidualMS = ones(1, n_roi) + NaN;
-SPM.ResidualMS(in_cols) = ResMS;
-
-SPM.xX = xX;
-SPM.marsY = marsY;
-
-%-Default F-contrasts (in contrast structure)
-%=======================================================================
-F_iX0 = [];
-if isfield(SPM, 'F_iX0')
- F_iX0 = SPM.F_iX0;
-end
-if isempty(F_iX0)
- F_iX0 = struct( 'iX0', [],...
- 'name', 'all effects');
-elseif ~isstruct(F_iX0)
- F_iX0 = struct( 'iX0', F_iX0,...
- 'name', 'effects of interest');
-end
-
-%-Create Contrast structure array
-%-----------------------------------------------------------------------
-xCon = spm_FcUtil('Set',F_iX0(1).name,'F','iX0',F_iX0(1).iX0,xX.xKXs);
-for i = 2:length(F_iX0)
- xcon = spm_FcUtil('Set',F_iX0(i).name,'F','iX0',F_iX0(i).iX0,xX.xKXs);
- xCon = [xCon xcon];
-end
-SPM.xCon = xCon;
-
-%=======================================================================
-%- E N D: Cleanup GUI
-%=======================================================================
-spm_progress_bar('Clear')
-spm('FigName','Stats: done',Finter); spm('Pointer','Arrow')
-fprintf('%-40s: %30s\n','Completed',spm('time')) %-#
-fprintf('...use the results section for assessment\n\n') %-#
-
-return
diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_fmri_design.m b/lib/marsbar-0.44/@mardo_99/private/pr_fmri_design.m
deleted file mode 100644
index 3659659..0000000
--- a/lib/marsbar-0.44/@mardo_99/private/pr_fmri_design.m
+++ /dev/null
@@ -1,242 +0,0 @@
-function [SPM] = pr_fmri_design(SPM)
-% MarsBaR version of spm_fMRI design - asssembles a design for fMRI studies
-% FORMAT [SPM] = pr_fmri_design(SPM)
-%
-% This file is a hardly edited version of:
-% @(#)spm_fMRI_design.m 2.27 Karl Friston 99/09/29
-% See that (SPM99) version for comments etc
-%
-% $Id$
-
-%-GUI setup
-%-----------------------------------------------------------------------
-SPMid = spm('SFnBanner',mfilename,marsbar('ver'));
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','fMRI stats model setup',0);
-spm_help('!ContextHelp',mfilename)
-
-% construct Design matrix {X} - cycle over sessions
-%=======================================================================
-
-% Initialize variables
-%-----------------------------------------------------------------------
-STOC = 0;
-
-% global parameters
-%-----------------------------------------------------------------------
-global fMRI_T;
-global fMRI_T0;
-if isempty(fMRI_T), fMRI_T = 16; end;
-if isempty(fMRI_T0), fMRI_T0 = 1; end;
-
-% get nscan and RT
-%-----------------------------------------------------------------------
-spm_input('Basic parameters...',1,'d',mfilename)
-RT = spm_input('Interscan interval {secs}','+1','r',[],1);
-nscan = spm_input(['scans per session e.g. 64 64 64'],'+1');
-STOC = 1;
-nsess = length(nscan);
-dt = RT/fMRI_T; % time bin {secs}
-
-% separate specifications for non-relicated sessions
-%-----------------------------------------------------------------------
-rep = 0;
-tim = 0;
-if nsess > 1
- str = 'are conditions replicated';
- rep = spm_input(str,'+1','yes|no',[1 0])
- if rep & ~any(nscan - nscan(1))
- str = ['are timing/parameters the same'];
- tim = spm_input(str,'+1','yes|no',[1 0]);
- end
-end
-Xx = [];
-Xb = [];
-Xname = {};
-Bname = {};
-Sess = {};
-for s = 1:nsess
-
- % set prompt string
- %---------------------------------------------------------------
- if tim
- Fstr = 'All sessions';
- else
- Fstr = sprintf('Session %d/%d',s,nsess);
- end
-
- % Event/epoch related responses
- %===============================================================
- k = nscan(s);
-
- % specify event/epoch onsets {SF} for this session
- %---------------------------------------------------------------
- if (s == 1) | ~rep
-
- [SF,Cname,Pv,Pname,DSstr] = ...
- pr_spm_get_ons(k,fMRI_T,dt,STOC,Fstr,[],[],s);
- ntrial = size(SF,2);
-
- elseif ~tim
-
- [SF,Cname,Pv,Pname,DSstr] = ...
- pr_spm_get_ons(k,fMRI_T,dt,STOC,Fstr,ntrial,Cname,s);
- end
-
- % get basis functions for this session
- %---------------------------------------------------------------
- if (s == 1) | ~rep
-
- % get basis functions for responses
- %-------------------------------------------------------
- [BF BFstr] = pr_spm_get_bf(Cname,fMRI_T,dt,Fstr,s);
- end
-
-
-
-
- % complete design matrix partition for this session
- %---------------------------------------------------------------
- if (s == 1) | ~tim
-
-
- %-Reset ContextHelp
- %-------------------------------------------------------
- spm_help('!ContextHelp',mfilename)
- spm_input('Design matrix options...',1,'d',mfilename)
-
- if ~ntrial
-
- % declare variables
- %-----------------------------------------------
- ONS = {}; % onset times
- PST = {}; % Peri-stimulus times
- X = []; % design matrix
- Xn = {}; % regressor names
- IND = {}; % design matrix indices
- name = {}; % condition names
-
- else
-
- % peri-stimulus {PST} and onset {ONS} (seconds)
- %-----------------------------------------------
- for i = 1:ntrial
- on = find(SF{i}(:,1))*dt;
- pst = [1:k]*RT - on(1);
- for j = 1:length(on)
- u = [1:k]*RT - on(j);
- v = find(u >= -1);
- pst(v) = u(v);
- end
- ONS{i} = on;
- PST{i} = pst;
- end
-
-
- % convolve with basis functions
- %-----------------------------------------------
- str = 'interactions among trials (Volterra)';
- if spm_input(str,'+1','y/n',[1 0])
-
- [X Xn IND BF name] = pr_spm_volterra(SF,BF,Cname,2);
-
- else
- [X Xn IND BF name] = pr_spm_volterra(SF,BF,Cname,1);
- end
-
-
- % Resample design matrix {X} at acquisition times
- %-----------------------------------------------
- X = X([0:k-1]*fMRI_T + fMRI_T0,:);
- end
-
-
- % get user specified regressors
- %=======================================================
- spm_input('Other regressors',1,'d',Fstr)
- D = [];
- c = spm_input('user specified regressors','+1','w1',0);
- while size(D,2) < c
- str = sprintf('regressor %i',size(D,2) + 1);
- D = [D spm_input(str,2,'e',[],[k Inf])];
- end
- if c & length(DSstr)
- DSstr = [DSstr '& user specified covariates '];
- elseif c
- DSstr = 'User specified covariates ';
- end
-
- % append regressors and names
- %-------------------------------------------------------
- for i = 1:size(D,2)
- X = [X D(:,i)];
- str = sprintf('regressor: %i',i);
- Xn{end + 1} = spm_input(['name of ' str],'+0','s',str);
- end
-
-
-
- % Confounds: Session effects
- %=======================================================
- B = ones(k,1);
- Bn{1} = sprintf('constant');
-
- end
-
- % Session structure
- %---------------------------------------------------------------
- Sess{s}.BFstr = BFstr;
- Sess{s}.DSstr = DSstr;
- Sess{s}.rep = tim;
- Sess{s}.row = size(Xx,1) + [1:k];
- Sess{s}.col = size(Xx,2) + [1:size(X,2)];
- Sess{s}.name = name;
- Sess{s}.ind = IND;
- Sess{s}.bf = BF;
- Sess{s}.sf = SF;
- Sess{s}.pst = PST;
- Sess{s}.ons = ONS;
- Sess{s}.Pv = Pv;
- Sess{s}.Pname = Pname;
-
- % Append names
- %---------------------------------------------------------------
- q = length(Xname);
- for i = 1:length(Xn)
- Xname{q + i} = [sprintf('Sn(%i) ',s) Xn{i}];
- end
- q = length(Bname);
- for i = 1:length(Bn)
- Bname{q + i} = [sprintf('Sn(%i) ',s) Bn{i}];
- end
-
- % append into Xx and Xb
- %===============================================================
- [x y] = size(Xx);
- [i j] = size(X);
- Xx(([1:i] + x),([1:j] + y)) = spm_detrend(X);
- [x y] = size(Xb);
- [i j] = size(B);
- Xb(([1:i] + x),([1:j] + y)) = B;
-
-end %- for s = 1:nsess
-
-% finished
-%-----------------------------------------------------------------------
-xX = struct( 'X', [Xx Xb],...
- 'dt', dt,...
- 'RT', RT,...
- 'iH', [],...
- 'iC', [1:size(Xx,2)],...
- 'iB', [1:size(Xb,2)] + size(Xx,2),...
- 'iG', [],...
- 'Xnames', {[Xname Bname]});
-
-
-%-End
-%-----------------------------------------------------------------------
-fprintf('\t%-32s: ','Saving fMRI design') %-#
-SPM = struct('SPMid', SPMid, ...
- 'xX', xX,...
- 'Sess', {Sess});
-fprintf('%30s\n\n','...saved') %-#
-spm_input('!DeleteInputObj')
diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_get_filter.m b/lib/marsbar-0.44/@mardo_99/private/pr_get_filter.m
deleted file mode 100644
index 9e2c29c..0000000
--- a/lib/marsbar-0.44/@mardo_99/private/pr_get_filter.m
+++ /dev/null
@@ -1,107 +0,0 @@
-function [K, LFstr, HFstr] = pr_get_filter(RT, row)
-% gets filter using spm_fmri_spm_ui routines
-% FORMAT [K, LFstr, HFstr]= pr_get_filter(RT, row)
-% or
-% FORMAT [K, LFstr, HFstr]= pr_get_filter(RT, Sess)
-%
-% $Id$
-
-if nargin < 2
- error('Need TR, row / Sess matrix');
-end
-
-% number of sessions
-nsess = length(row);
-
-% rows from Sess
-if isfield(row{1}, 'row')
- Sess = row;
- for s = 1:nsess
- row{s} = Sess{s}.row;
- end
-else
- Sess = [];
-end
-
-% copied from spm_fmri_spm_ui
-BM = 0;
-
-% High-pass filtering
-%-----------------------------------------------------------------------
-if BM
- cLF = 'none';
-else
- cLF = spm_input('High-pass filter?','+1','b','none|specify');
-end
-switch cLF
-
- case 'specify'
-
- if ~isempty(Sess)
- % default based on peristimulus time
- % param = cut-off period (max = 512, min = 32)
- %---------------------------------------------------------------
- HParam = 512*ones(1,nsess);
- for i = 1:nsess
- for j = 1:length(Sess{i}.pst)
- HParam(i) = min([HParam(i) 2*max(RT + Sess{i}.pst{j})]);
- end
- end
- HParam = ceil(HParam);
- HParam(HParam < 32) = 32;
- else % don't have SPM to work from
- HParam = 120 * ones(1,nsess);
- end
- str = 'session cutoff period (secs)';
- HParam = spm_input(str,'+1','e',HParam,[1 nsess]);
-
- % LF description
- %---------------------------------------------------------------
- LFstr = sprintf('[min] Cutoff period %d seconds',min(HParam));
-
- case 'none'
- %---------------------------------------------------------------
- HParam = cell(1,nsess);
- LFstr = cLF;
-
-end
-
-
-% Low-pass filtering
-%-----------------------------------------------------------------------
-if BM
- cHF = 'none';
-else
- cHF = spm_input('Low-pass filter?','+1','none|Gaussian|hrf');
-
-
-end
-switch cHF
-
- case 'Gaussian'
- %---------------------------------------------------------------
- LParam = spm_input('Gaussian FWHM (secs)','+1','r',4);
- HFstr = sprintf('Gaussian FWHM %0.1f seconds',LParam);
- LParam = LParam/sqrt(8*log(2));
-
- case {'hrf', 'none'}
- %---------------------------------------------------------------
- LParam = [];
- HFstr = cHF;
-
-end
-
-% create filter struct and band-pass specification
-%-----------------------------------------------------------------------
-for i = 1:nsess
- K{i} = struct( 'HChoice', cLF,...
- 'HParam', HParam(i),...
- 'LChoice', cHF,...
- 'LParam', LParam,...
- 'row', row{i},...
- 'RT', RT);
-end
-
-% Construct K struct
-%=======================================================================
-K = pr_spm_filter('set',K);
diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_spm_filter.m b/lib/marsbar-0.44/@mardo_99/private/pr_spm_filter.m
deleted file mode 100644
index 4e77315..0000000
--- a/lib/marsbar-0.44/@mardo_99/private/pr_spm_filter.m
+++ /dev/null
@@ -1,180 +0,0 @@
-function [vargout] = pr_spm_filter(Action,K,Y)
-% contruct and/or apply high and/or low pass filter
-% Copied from spm_filter.m for SPM99.
-% FORMAT [K] = spm_filter('set' ,K)
-% FORMAT [Y] = spm_filter('apply',K,Y)
-% FORMAT [Y] = spm_filter('high' ,K,Y)
-% FORMAT [Y] = spm_filter('low' ,K,Y)
-%
-% Action - 'set' fills in filter structure K
-% Action - 'apply' applies K to Y = K*Y
-% Action - 'high' only high-pass component
-% Action - 'low ' only low-pass component
-% K - filter convolution matrix or:
-% K{s} - cell of structs containing session-specific specifications
-%
-% K{s}.RT - repeat time in seconds
-% K{s}.row - row of Y constituting session s
-% K{s}.LChoice - Low-pass filtering {'hrf' 'Gaussian' 'none'}
-% K{s}.LParam - Gaussian parameter in seconds
-% K{s}.HChoice - High-pass filtering {'specify' 'none'}
-% K{s}.HParam - cut-off period in seconds
-%
-% K{s}.HP - low frequencies to be removed
-% K{s}.LP - sparse toepltz low-pass convolution matrix
-%
-% Y - data matrix
-%
-% K - filter structure
-% Y - filtered data K.K*Y
-%___________________________________________________________________________
-%
-% spm_filter implements band pass filtering in an efficient way by
-% using explicitly the projector matrix form of the High pass
-% component. spm_filter also configures the filter structure in
-% accord with the specification fields if required
-%___________________________________________________________________________
-% @(#)spm_filter.m 2.5 Karl Friston 00/10/04
-
-
-% set or apply
-%---------------------------------------------------------------------------
-switch Action
-
- case 'set'
- %-------------------------------------------------------------------
- for s = 1:length(K)
-
- % matrix order
- %-----------------------------------------------------------
- k = length(K{s}.row);
-
- % make low pass filter
- %-----------------------------------------------------------
- switch K{s}.LChoice
-
- case 'none'
- %---------------------------------------------------
- h = 1;
- d = 0;
-
- case 'hrf'
- %---------------------------------------------------
- h = pr_spm_hrf(K{s}.RT);
- h = [h; zeros(size(h))];
- g = abs(fft(h));
- h = real(ifft(g));
- h = fftshift(h)';
- n = length(h);
- d = [1:n] - n/2 - 1;
-
- case 'Gaussian'
- %---------------------------------------------------
- sigma = K{s}.LParam/K{s}.RT;
- h = round(4*sigma);
- h = exp(-[-h:h].^2/(2*sigma^2));
- n = length(h);
- d = [1:n] - (n + 1)/2;
- if n == 1, h = 1; end
-
- otherwise
- %---------------------------------------------------
- error('Low pass Filter option unknown');
- return
-
- end
-
- % create and normalize low pass filter
- %-----------------------------------------------------------
- K{s}.KL = spdiags(ones(k,1)*h,d,k,k);
- K{s}.KL = spdiags(1./sum(K{s}.KL')',0,k,k)*K{s}.KL;
-
-
- % make high pass filter
- %-----------------------------------------------------------
- switch K{s}.HChoice
-
- case 'none'
- %---------------------------------------------------
- K{s}.KH = [];
-
- case 'specify'
- %---------------------------------------------------
- n = fix(2*(k*K{s}.RT)/K{s}.HParam + 1);
- X = spm_dctmtx(k,n);
- K{s}.KH = sparse(X(:,[2:n]));
-
- otherwise
- %---------------------------------------------------
- error('High pass Filter option unknown');
- return
-
- end
-
- end
-
- % return structure
- %-------------------------------------------------------------------
- vargout = K;
-
-
- case {'apply','high','low'}
- %-------------------------------------------------------------------
- if iscell(K)
-
-
- % ensure requisite feild are present
- %-----------------------------------------------------------
- if ~isfield(K{1},'KL')
- K = pr_spm_filter('set',K);
- end
-
- for s = 1:length(K)
-
- % select data
- %---------------------------------------------------
- y = Y(K{s}.row,:);
-
- % apply low pass filter
- %---------------------------------------------------
- if ~strcmp(Action,'high')
- KL = K{s}.KL;
- if issparse(KL), KL = full(KL); end
- y = KL*y;
- end
-
- % apply high pass filter
- %---------------------------------------------------
- if ~isempty(K{s}.KH) & ~strcmp(Action,'low')
- KH = K{s}.KH;
- if issparse(KH), KH = full(KH); end
- y = y - KH*(KH'*y);
- end
-
- % reset filtered data in Y
- %---------------------------------------------------
- Y(K{s}.row,:) = y;
-
- end
-
- % K is simply a convolution matrix
- %-------------------------------------------------------------------
- else
- if issparse(K), K = full(K); end
- Y = K*Y;
- end
-
- % return filtered data
- %-------------------------------------------------------------------
- vargout = Y;
-
- case 'none'
- %-------------------------------------------------------------------
- vargout = Y;
-
- otherwise
- %-------------------------------------------------------------------
- warning('Filter option unknown');
-
-
-end
diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_spm_get_bf.m b/lib/marsbar-0.44/@mardo_99/private/pr_spm_get_bf.m
deleted file mode 100644
index fb60ed5..0000000
--- a/lib/marsbar-0.44/@mardo_99/private/pr_spm_get_bf.m
+++ /dev/null
@@ -1,301 +0,0 @@
-function [BF,BFstr] = pr_spm_get_bf(name,T,dt,Fstr,n_s,n_c)
-% creates basis functions for each trial type {i} in struct BF{i}
-% FORMAT [BF BFstr] = spm_get_bf(name,T,dt,Fstr,n_s [,n_c])
-%
-% name - name{1 x n} name of trials or conditions
-% T - time bins per scan
-% dt - time bin length {seconds}
-% Fstr - Prompt string (usually indicates session)
-% n_s - Session number
-% n_c - Condition number (optional)
-%
-% BF{i} - Array of basis functions for trial type {i}
-% BFstr - description of basis functions specified
-%_______________________________________________________________________
-%
-% spm_get_bf prompts for basis functions to model event or epoch-related
-% responses. The basis functions returned are unitary and orthonormal
-% when defined as a function of peri-stimulus time in time-bins.
-% It is at this point that the distinction between event and epoch-related
-% responses enters.
-%_______________________________________________________________________
-% @(#)spm_get_bf.m 2.20 Karl Friston 01/08/22
-%
-% $Id$
-
-
-%-GUI setup
-%-----------------------------------------------------------------------
-spm_help('!ContextHelp',mfilename)
-
-%-Condition arguments
-%-----------------------------------------------------------------------
-if nargin < 6, n_c = []; end
-
-
-% if no trials
-%-----------------------------------------------------------------------
-n = length(name);
-if ~n
- BF = {};
- BFstr = 'none';
- return
-end
-
-% determine sort of basis functions
-%-----------------------------------------------------------------------
-Rtype = {'events',...
- 'epochs',...
- 'mixed'};
-if n == 1
- Rtype = Rtype(1:2);
- spm_input(name{1},1,'d',Fstr)
-else
- spm_input(Fstr,1,'d')
-end
-
-Rov = spm_input('are these trials',2,'b',Rtype);
-Fstr='';
-
-switch Rov
-
- % assemble basis functions {bf}
- %===============================================================
- case 'events'
-
- % model event-related responses
- %---------------------------------------------------------------
- Ctype = {
- 'hrf (alone)',...
- 'hrf (with time derivative)',...
- 'hrf (with time and dispersion derivatives)',...
- 'basis functions (Fourier set)',...
- 'basis functions (Fourier set with Hanning)',...
- 'basis functions (Gamma functions)',...
- 'basis functions (Gamma functions with derivatives)',...
- 'basis functions (Finite Impulse Response)'};
- str = 'Select basis set';
- Cov = spm_input(str,2,'m',Ctype);
- BFstr = Ctype{Cov};
-
-
- % create basis functions
- %---------------------------------------------------------------
- if Cov == 4 | Cov == 5
-
- % Windowed (Hanning) Fourier set
- %-------------------------------------------------------
- str = 'window length {secs}';
- pst = spm_input(str,3,'e',32);
- pst = [0:dt:pst]';
- pst = pst/max(pst);
- h = spm_input('order',4,'e',4);
-
-
- % hanning window
- %-------------------------------------------------------
- if Cov == 4
- g = ones(size(pst));
- else
- g = (1 - cos(2*pi*pst))/2;
- end
-
- % zeroth and higher terms
- %-------------------------------------------------------
- bf = g;
- for i = 1:h
- bf = [bf g.*sin(i*2*pi*pst)];
- bf = [bf g.*cos(i*2*pi*pst)];
- end
-
- elseif Cov == 6 | Cov == 7
-
-
- % Gamma functions alone
- %-------------------------------------------------------
- pst = [0:dt:32]';
- dx = 0.01;
- bf = spm_gamma_bf(pst);
-
- % Gamma functions and derivatives
- %-------------------------------------------------------
- if Cov == 7
- bf = [bf (spm_gamma_bf(pst - dx) - bf)/dx];
- end
-
-
- elseif Cov == 8
-
-
- % Finite Impulse Response
- %-------------------------------------------------------
- bin = spm_input('bin size (seconds)',3,'e',2);
- nb = spm_input('number of bins',4,'e',8);
-
- bf = kron(eye(nb),ones(round(bin/dt),1));
-
-
- elseif Cov == 1 | Cov == 2 | Cov == 3
-
-
- % hrf and derivatives
- %-------------------------------------------------------
- [bf p] = pr_spm_hrf(dt);
-
- % add time derivative
- %-------------------------------------------------------
- if Cov == 2 | Cov == 3
-
- dp = 1;
- p(6) = p(6) + dp;
- D = (bf(:,1) - pr_spm_hrf(dt,p))/dp;
- bf = [bf D(:)];
- p(6) = p(6) - dp;
-
- % add dispersion derivative
- %-----------------------------------------------
- if Cov == 3
-
- dp = 0.01;
- p(3) = p(3) + dp;
- D = (bf(:,1) - pr_spm_hrf(dt,p))/dp;
- bf = [bf D(:)];
- end
- end
- end
-
-
- % Orthogonalize and fill in basis function structure
- %---------------------------------------------------------------
- bf = pr_spm_orth(bf);
- for i = 1:n
- BF{i} = bf;
- end
-
-
- % assemble basis functions {bf}
- %===============================================================
- case 'epochs'
-
-
- % covariates of interest - Type
- %---------------------------------------------------------------
- Ctype = {'basis functions (Discrete Cosine Set)',...
- 'basis functions (Mean & exponential decay)',...
- 'fixed response (Half-sine)',...
- 'fixed response (Box-car)'};
- str = 'Select type of response';
- Cov = spm_input(str,2,'m',Ctype);
-
- BFstr = Ctype{Cov};
-
- % convolve with HRF?
- %---------------------------------------------------------------
- if Cov == 1
- str = 'number of basis functions';
- h = spm_input(str,3,'e',2);
- end
-
- % convolve with HRF?
- %---------------------------------------------------------------
- HRF = spm_input('convolve with hrf',3,'b','yes|no',[1 0]);
-
- % ask for temporal differences
- %---------------------------------------------------------------
- str = 'add temporal derivatives';
- TD = spm_input(str,4,'b','yes|no',[1 0]);
-
-
- % Assemble basis functions for each trial type
- %---------------------------------------------------------------
- for i = 1:n
-
- str = ['epoch length {scans} for ' name{i}];
- W = spm_input(str,'+1','r','',1);
- pst = [1:W*T]' - 1;
- pst = pst/max(pst);
-
- % Discrete cosine set
- %-------------------------------------------------------
- if Cov == 1
-
- bf = [];
- for j = 0:(h - 1)
- bf = [bf cos(j*pi*pst)];
- end
-
- % Mean and exponential
- %-------------------------------------------------------
- elseif Cov == 2
-
- bf = [ones(size(pst)) exp(-pst/4)];
-
- % Half sine wave
- %-------------------------------------------------------
- elseif Cov == 3
-
- bf = sin(pi*pst);
-
- % Box car
- %-------------------------------------------------------
- elseif Cov == 4
-
- bf = ones(size(pst));
-
- end
-
- % convolve with hemodynamic response function - hrf
- %-------------------------------------------------------
- if HRF
- hrf = pr_spm_hrf(dt);
- [p q] = size(bf);
- D = [];
- for j = 1:q
- D = [D conv(bf(:,j),hrf)];
- end
- bf = D;
- end
-
- % add temporal differences if specified
- %-------------------------------------------------------
- if TD
- bf = [bf [diff(bf); zeros(1,size(bf,2))]/dt];
- end
-
- % Orthogonalize and fill in Sess structure
- %-------------------------------------------------------
- BF{i} = pr_spm_orth(bf);
- end
-
-
- % mixed event and epoch model
- %===============================================================
- case 'mixed'
- for i = 1:n
- BF(i) = pr_spm_get_bf(name(i),T,dt,'',n_s,i);
- end
- BFstr = 'mixed';
-end
-
-
-
-%=======================================================================
-%- S U B - F U N C T I O N S
-%=======================================================================
-
-
-% compute Gamma functions functions
-%-----------------------------------------------------------------------
-function bf = spm_gamma_bf(u)
-% returns basis functions used for Volterra expansion
-% FORMAT bf = spm_gamma_bf(u);
-% u - times {seconds}
-% bf - basis functions (mixture of Gammas)
-%_______________________________________________________________________
-u = u(:);
-bf = [];
-for i = 2:4
- m = 2^i;
- s = sqrt(m);
- bf = [bf spm_Gpdf(u,(m/s)^2,m/s^2)];
-end
diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_spm_get_ons.m b/lib/marsbar-0.44/@mardo_99/private/pr_spm_get_ons.m
deleted file mode 100644
index e0a75df..0000000
--- a/lib/marsbar-0.44/@mardo_99/private/pr_spm_get_ons.m
+++ /dev/null
@@ -1,437 +0,0 @@
-function [sf,Cname,Pv,Pname,DSstr] = pr_spm_get_ons(k,T,dt,STOC,Fstr,v,Cname,s)
-% returns onset times for events
-% FORMAT [sf,Cname,Pv,Pname,DSstr] = spm_get_ons(k,T,dt,STOC,Fstr,v,Cname,s)
-%
-% k - number of scans
-% T - time bins per scan
-% dt - time bin length (secs)
-% STOC - flag to enable stochastic designs [0 or 1]
-% Fstr - Prompt string (usually indicates session)
-% v - number of conditions or trials : can be empty
-% Cname - {1 x v} cell of names for each condition : can be empty
-% s - session number (used by batch system)
-%
-% sf - {1 x n} cell of stick function matrices
-% Cname - {1 x n} cell of names for each condition
-% Pv - {1 x n} cell of parametric vectors
-% Pname - {1 x n} cell of names for each parameter
-% DSstr - Design string
-%_______________________________________________________________________
-%
-% spm_get_ons contructs a cell of sparse delta functions specifying the
-% onset of events or epochs (or both). These are convolved with a basis set
-% at a later stage to give regressors that enter into the design matrix.
-% Interactions of evoked responses with some parameter (time or a specified
-% variate Pv) enter at this stage as additional columns in sf with each delta
-% function multiplied by the [expansion of the] trial-specific parameter.
-% If parametric modulation is modeled, P contains the original variate and
-% Pname is its name. Otherwise Pv{i} = [] and Pname{i} = '';
-%
-% Notes on responding to questions:
-%
-% 'number of conditions or trials': The number of conditions, trials,
-% events or epochs in the design. Generally the baseline condition
-% (epoch-related) or null event (event-related) should not be included
-% e.g. for a simple ABABAB.. design enter 1
-%
-% STOCHASTIC DESIGNS
-%
-% 'stochastic design': If you want a random design select yes. The ensuing
-% design matrix and onset times in Sess are then used in
-% subsequent analysis of the data and stimulus design respectively.
-%
-% 'include a null event': for stochastic designs a null event should
-% be included if you want to estimate responses common to
-% all trial types
-%
-% 'SOA (scans)': Stimulus onset asynchrony for the sucessive occurrence
-% of trials. This is the time (in scans) between the onset
-% of sucessive stimuli or trials (usually a fraction of a scan)
-%
-% 'relative frequency [trial 1,..n null]': Enter a vector with a
-% relative frequency of presentation for each trial type
-% (and the null event if included). The null event is last.
-% The most efficient designs are given when all the frequencies
-% are equal.
-%
-% 'stationary|modulated': If the occurence probabilities are
-% the same for all scans then choose 'stationary'. Modulated
-% designs are more efficient but entail 'runs' of the
-% same trial type.
-%
-% NON STOCHASTIC DESIGNS
-%
-% 'Fixed|Variable': If the event of epoch starts with a fixed
-% SOA choose 'Fixed'. If the SOA changes within any trial type
-% choose variable.
-%
-% 'vector of onsets (scans) for trial n': If the SOA are variable
-% you have to enter a vector of onet times for each event or
-% epoch. Time is specified in terms of scans, where the
-% start of the session begins at 0.
-%
-% 'variable durations'. If you want to model trains of
-% onsets then select 'yes'. You will then be prompted for
-% a vector of durations for each onset. This is useful when
-% modeling short epochs of variable duration.
-%
-% 'SOA (scans)' and 'first trial (scans)': If the SOA is fixed you
-% only have to specify what it is and when the first condition
-%ses in terms of an interaction with the specified
-% variate.
-%
-% SLCIE TIMIING
-%
-% With longs TRs you may want to shift the regressors so that they are
-% aligned to a particular slice. This is effected by resetting the
-% values of fMRI_T and fMRI_T0 in som_defaults. fMRI_T is the number of
-% time-bins per scan used when building regressors. Onsets are defined
-% in temporal units of scans starting at 0. fMRI_T0 is the first
-% time-bin at which the regressors are resampled to coincide with data
-% acquisition. If fMRI_T0 = 1 then the regressors will be appropriate
-% for the first slice. If you want to temporally realign the regressors
-% so that they match responses in the middle slice then make fMRI_T0 =
-% fMRI_T/2 (assuming there is a negligible gap between volume
-% acquisitions. Default values are fMRI_T = 16 and fMRI_T0 = 1.
-%
-%
-%_______________________________________________________________________
-% @(#)spm_get_ons.m 2.30 Karl Friston 01/03/22
-
-%-GUI setup
-%-----------------------------------------------------------------------
-spm_help('!ContextHelp',mfilename)
-
-
-%-Condition arguments
-%-----------------------------------------------------------------------
-if nargin < 5, Fstr = ''; end
-spm_input(Fstr,1,'d')
-
-
-% initialize variables
-%-----------------------------------------------------------------------
-sf = {};
-Pv = {};
-Pname = {};
-DSstr = '';
-%--------
-sillyvar=0;
-
-
-% get stick functions {ons} and names
-%=======================================================================
-
-
-% get trials
-%-----------------------------------------------------------------------
-if isempty(v)
- v = spm_input('number of conditions or trials',2,'w1');
-end
-if isempty(Cname)
- Cname = {};
- for i = 1:v
- % get names
- %---------------------------------------------------------------
- str = sprintf('name for condition/trial %d ?',i);
- Cname{i} = spm_input(str,3,'s',sprintf('trial %d',i));
- end
-end
-
-
-
-% event/epoch-related responses
-%-----------------------------------------------------------------------
-if v
-
-
- % stochastic designs
- %---------------------------------------------------------------
- spm_input('Trial specification...',1,'d',Fstr)
- if STOC
- STOC = spm_input('stochastic design','+1','y/n',[1 0]);
- end
- if STOC
-
-
- % minimum SOA
- %-------------------------------------------------------
- ne = spm_input('include a null event','+1','y/n',[1 0]);
- soa = spm_input('SOA (scans)','+1','r',2)*T;
- on = fix(1:soa:(k*T));
- ns = length(on);
- DSstr = [DSstr sprintf('Stochastic: %.2fsec SOA ',soa*dt)];
-
-
- % occurence probabilities - stationary
- %-------------------------------------------------------
- if ne
- str = sprintf('relative frequency [trial 1,..%d null]',v);
- else
- str = sprintf('relative frequency [trial 1,..%d]',v);
- end
- P = ones(1,(v + ne));
- P = spm_input(str,'+1','r',P,[1 (v + ne)]);
- str = 'occurence probability';
- if spm_input(str,'+1','stationary|modulated',[1 0])
- DSstr = [DSstr '(stationary) '];
- P = P(:)*ones(1,ns);
-
- % occurence probabilities - modulated (32 sec period)
- %-------------------------------------------------------
- else
- DSstr = [DSstr '(modulated) '];
- p = ones((v + ne),ns);
- dc = 32/dt;
- for i = 1:(v + ne);
- q = sin(2*pi*(on/dc + (i - 1)/(v + ne)));
- p(i,:) = 1 + q;
- end
- P = diag(P)*p;
- end
-
-
- % assign trials
- %-------------------------------------------------------
- P = [zeros(1,ns); cumsum(P)];
- P = P*diag(1./max(P));
- q = zeros(size(on));
- Q = rand(size(on));
- for i = 1:(v + ne);
- j = find(Q >= P(i,:) & Q < P(i + 1,:));
- q(j) = i;
- end
-
-
- % create stick functions
- %-------------------------------------------------------
- ons = sparse(on,q,1,k*T,v + ne);
-
-
- % stick function array (and delete null event)
- %-------------------------------------------------------
- for i = 1:v
- sf{i} = full(ons(:,i));
- end
-
-
- % non-stochastic designs
- %---------------------------------------------------------------
- else
-
-
- % get onsets
- %-----------------------------------------------------------
- Sstr = spm_input('SOA',2,'Fixed|Variable');
- DSstr = [DSstr Sstr ' SOA '];
- i = 1;
- while i <= v
-
-
- % get onsets
- %-------------------------------------------------------
- switch Sstr
-
-
- case 'Fixed'
- %- In batch mode, Sstr is always 'Variable'
- %-----------------------------------------------
- str = ['SOA (scans) for ' Cname{i}];
- soa = spm_input(str,3,'r');
- on = spm_input('time to 1st trial (scans)',4,'r',0);
- on = {on:soa:k};
- dur = {zeros(size(on{1}))};
-
-
- case 'Variable'
- %-----------------------------------------------
- str = ['vector of onsets (scans) - ' Cname{i}];
- on = spm_input(str,3);
- if ~iscell(on), on = {on}; end
-
- % get durationa
- %-----------------------------------------------
- dur = {};
- for j = 1:length(on)
- dur{j} = zeros(size(on{j}));
- if length(on) == 1
- str = 'variable durations';
- if spm_input(str,'+1','y/n',[1 0],2)
- dur{j} = spm_input('durations (scans)',...
- '+1','e',[],[1 length(on{j})]);
- dur{j} = round(dur{j}*T);
- end
- end
- end
-
-
- end
-
-
- % create stick functions
- %-----------------------------------------------
- for j = 1:length(on)
- ons = sparse(k*T,1);
- for p = 1:length(on{j})
- q = round(on{j}(p)*T + 1);
- ons(q:(q + dur{j}(p))) = 1;
- end
- sf{i} = ons(1:(k*T));
- i = i + 1;
- end
-
-
- end
- end
-
-
-
- % get parameters, contruct interactions and append
- %================================================================
- spm_input('Parametric specification...','+1','d',Fstr)
-
-
- % paramteric representation of causes - defaults for main effects
- %----------------------------------------------------------------
- for i = 1:v
- Pv{i} = [];
- Pname{i} = '';
- end
-
-
- % get parameter type
- %----------------------------------------------------------------
- Ptype = {'none',...
- 'time',...
- 'other'};
- Ptype = spm_input('parametric modulation','+1','b',Ptype);
- switch Ptype
-
-
- case 'none'
- %--------------------------------------------------------
- return
-
-
- case 'other'
- %--------------------------------------------------------
- Pstr = spm_input('name of parameter','+1','s');
-
-
- case 'time'
- %--------------------------------------------------------
- Pstr = Ptype;
- end
-
-
- % get parameters of expansion
- %----------------------------------------------------------------
- Etype = {'linear',...
- 'exponen',...
- 'polynom'};
- Etype = spm_input('expansion','+1','b',Etype);
- DSstr = [DSstr '[ x ' Pstr ' (' Etype ')] '];
- switch Etype
-
-
- case 'exponen'
- %--------------------------------------------------------
- if strcmp(Ptype,'time')
- h = round(k*T*dt/4);
- h = spm_input('time constant {secs}','+1','r',h);
-
-
- else
- h = spm_input('decay constant','+1','r');
- end
-
-
- case 'polynom'
- %--------------------------------------------------------
- str = 'order of polynomial expansion';
- h = spm_input(str,'+1','r',2);
-
-
- end
-
-
-
- % cycle over selected trial types
- %----------------------------------------------------------------
- str = sprintf('which trial[s] 1 to %d',v);
- Ypos = spm_input('!NextPos');
-
-
- for i = spm_input(str,'+1','e',1)
- %-----------------
- sillyvar=sillyvar+1;
- spm_input(Cname{i},Ypos,'d',Fstr);
- on = find(sf{i}(:,1));
- ns = length(on);
-
-
- % get parameters
- %-------------------------------------------------------
- switch Ptype
-
-
- case 'other'
- %-----------------------------------------------
- str = ['parameters for ' Cname{i}];
- p = spm_input(str,'+1','r',[],[ns,1]);
-
-
- case 'time'
- %-----------------------------------------------
- p = on*dt;
-
-
- end
-
-
- % expansion
- %--------------------------------------------------------
- switch Etype
-
-
-
- case 'polynom'
- %------------------------------------------------
- u = spm_detrend(p(:));
- v = zeros(size(u,1),h + 1);
- q = sparse(size(sf{i},1),h);
- for j = 0:h
- v(:,(j + 1)) = (u.^j) - v*(pinv(v)*(u.^j));
- end
- for j = 1:h
- u = v(:,(j + 1));
- q(:,j) = sparse(on,1,u,size(sf{i},1),1);
- end
-
-
- case 'exponen'
- %------------------------------------------------
- q = exp(-p/h);
- q = spm_detrend(q(:));
- q = sparse(on,1,q,size(sf{i},1),1);
-
-
- case 'linear'
- %------------------------------------------------
- q = spm_detrend(p(:));
- q = sparse(on,1,q,size(sf{i},1),1);
-
-
-
- end
-
-
- % append as modulated stick functions
- %--------------------------------------------------------
- sf{i} = [sf{i} q];
- Pv{i} = p;
- Pname{i} = Pstr;
-
-
- end
-end
diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_spm_hrf.m b/lib/marsbar-0.44/@mardo_99/private/pr_spm_hrf.m
deleted file mode 100644
index 43bb900..0000000
--- a/lib/marsbar-0.44/@mardo_99/private/pr_spm_hrf.m
+++ /dev/null
@@ -1,40 +0,0 @@
-function [hrf,p] = pr_spm_hrf(RT,P);
-% returns a hemodynamic response function
-% FORMAT [hrf,p] = pr_spm_hrf(RT,[p]);
-% RT - scan repeat time
-% p - parameters of the response function (two gamma functions)
-%
-% defaults
-% (seconds)
-% p(1) - delay of response (relative to onset) 6
-% p(2) - delay of undershoot (relative to onset) 16
-% p(3) - dispersion of response 1
-% p(4) - dispersion of undershoot 1
-% p(5) - ratio of response to undershoot 6
-% p(6) - onset (seconds) 0
-% p(7) - length of kernel (seconds) 32
-%
-% hrf - hemodynamic response function
-% p - parameters of the response function
-%_______________________________________________________________________
-% @(#)spm_hrf.m 2.7 Karl Friston 99/05/17
-
-% global parameter
-%-----------------------------------------------------------------------
-global fMRI_T;
-if isempty(fMRI_T), fMRI_T = 16; end;
-
-% default parameters
-%-----------------------------------------------------------------------
-p = [6 16 1 1 6 0 32];
-if nargin > 1
- p(1:length(P)) = P;
-end
-
-% modelled hemodynamic response function - {mixture of Gammas}
-%-----------------------------------------------------------------------
-dt = RT/fMRI_T;
-u = [0:(p(7)/dt)] - p(6)/dt;
-hrf = spm_Gpdf(u,p(1)/p(3),dt/p(3)) - spm_Gpdf(u,p(2)/p(4),dt/p(4))/p(5);
-hrf = hrf([0:(p(7)/RT)]*fMRI_T + 1);
-hrf = hrf'/sum(hrf);
diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_spm_orth.m b/lib/marsbar-0.44/@mardo_99/private/pr_spm_orth.m
deleted file mode 100644
index 99f657a..0000000
--- a/lib/marsbar-0.44/@mardo_99/private/pr_spm_orth.m
+++ /dev/null
@@ -1,21 +0,0 @@
-function bf = pr_spm_orth(BF)
-% recursive orthogonalization of basis functions
-% FORMAT bf = pr_spm_orth(bf)
-%
-% From spm_get_bf.m, see that file for credits
-%
-% $Id$
-
-if nargin < 1
- error('Need BF');
-end
-
-bf = BF(:,1);
-bf = bf/sqrt(mean(bf.^2));
-for i = 2:size(BF,2)
- D = BF(:,i);
- D = D - bf*(pinv(bf)*D);
- if any(D)
- bf = [bf D/sqrt(mean(D.^2))];
- end
-end
diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_spm_ui.m b/lib/marsbar-0.44/@mardo_99/private/pr_spm_ui.m
deleted file mode 100644
index c4a13af..0000000
--- a/lib/marsbar-0.44/@mardo_99/private/pr_spm_ui.m
+++ /dev/null
@@ -1,1329 +0,0 @@
-function varargout=pr_spm_ui(varargin)
-% MarsBaR: setting up the general linear model for independent data
-%
-% MarsBaR version copied with minor edits from:
-% 99/11/15 Andrew Holmes @(#)spm_spm_ui.m 2.33
-% See that file for comments and help
-%
-% $Id$
-
-%-Condition arguments
-%-----------------------------------------------------------------------
-if (nargin==0), Action = 'CFG'; else, Action = varargin{1}; end
-
-% For selecting images, later
-img_flt = mars_veropts('get_img_ext');
-
-switch lower(Action), case 'cfg'
-%=======================================================================
-% - C O N F I G U R E D E S I G N
-%=======================================================================
-% pr_spm_ui('CFG',D)
-if nargin<2, D = []; else, D = varargin{2}; end
-
-%-GUI setup
-%-----------------------------------------------------------------------
-SPMid = spm('SFnBanner',mfilename,marsbar('ver'));
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Stats: Setup analysis',0);
-spm_help('!ContextHelp',mfilename)
-
-%-Option definitions
-%-----------------------------------------------------------------------
-%-Generic factor names
-sF = {'sF1','sF2','sF3','sF4'};
-
-%-Covariate by factor interaction options
-sCFI = {'';... %-1
- 'with sF1';'with sF2';'with sF3';'with sF4';... %-2:5
- 'with sF2 (within sF4)';'with sF3 (within sF4)'}; %-6,7
-
-%-DesMtx argument components for covariate by factor interaction options
-% (Used for CFI's Covariate Centering (CC), GMscale & Global normalisation)
-CFIforms = { '[]', 'C', '{}';... %-1
- 'I(:,1)', 'FxC', '{D.sF{1}}';... %-2
- 'I(:,2)', 'FxC', '{D.sF{2}}';... %-3
- 'I(:,3)', 'FxC', '{D.sF{3}}';... %-4
- 'I(:,4)', 'FxC', '{D.sF{4}}';... %-5
- 'I(:,[4,2])', 'FxC', '{D.sF{4},D.sF{2}}';... %-6
- 'I(:,[4,3])', 'FxC', '{D.sF{4},D.sF{3}}' }; %-7
-
-%-Centre (mean correction) options for covariates & globals (CC)
-% (options 9-12 are for centering of global when using AnCova GloNorm) (GC)
-sCC = { 'around overall mean';... %-1
- 'around sF1 means';... %-2
- 'around sF2 means';... %-3
- 'around sF3 means';... %-4
- 'around sF4 means';... %-5
- 'around sF2 (within sF4) means';... %-6
- 'around sF3 (within sF4) means';... %-7
- '';... %-8
- 'around user specified value';... %-9
- '(as implied by AnCova)';... %-10
- 'GM';... %-11
- '(redundant: not doing AnCova)'}'; %-12
-%-DesMtx I forms for covariate centering options
-CCforms = {'ones(nScan,1)',CFIforms{2:end,1},''}';
-
-
-%-Global normalization options (options 1-7 match CFIforms) (GloNorm)
-sGloNorm = { 'AnCova';... %-1
- 'AnCova by sF1';... %-2
- 'AnCova by sF2';... %-3
- 'AnCova by sF3';... %-4
- 'AnCova by sF4';... %-5
- 'AnCova by sF2 (within sF4)';... %-6
- 'AnCova by sF3 (within sF4)';... %-7
- 'proportional scaling';... %-8
- ''}; %-9
-
-%-Grand mean scaling options (GMsca)
-sGMsca = { 'scaling of overall grand mean';... %-1
- 'scaling of sF1 grand means';... %-2
- 'scaling of sF2 grand means';... %-3
- 'scaling of sF3 grand means';... %-4
- 'scaling of sF4 grand means';... %-5
- 'scaling of sF2 (within sF4) grand means';... %-6
- 'scaling of sF3 (within sF4) grand means';... %-7
- '(implicit in PropSca global normalisation)';... %-8
- '' }; %-9
-%-NB: Grand mean scaling by subject is redundent for proportional scaling
-
-
-%-Global calculation options (GXcalc)
-sGXcalc = { 'omit';... %-1
- 'user specified';... %-2
- 'mean voxel value (within per image fullmean/8 mask)'}; %-3
-
-
-
-%=======================================================================
-%-D E S I G N P A R A M E T E R S
-%=======================================================================
-%-Get design type
-%-----------------------------------------------------------------------
-nVar = 1;
-if isempty(D)
-
- %-Multivariate repsonse variable?
- %---------------------------------------------------------------
- if spm_input('Multivariate analysis?','+1','y/n',[1,0],2)
- nVar = spm_input('number of variates?','+1','n1');
- end
-
- D = pr_spm_ui( ...
- char(spm_input('Select design class...','+1','m',...
- {'Basic stats','Standard PET designs','SPM96 PET designs'},...
- {'DesDefs_Stats','DesDefs_PET','DesDefs_PET96'},2)));
-end
-
-D = D(spm_input('Select design type...','+1','m',{D.DesName}'));
-
-
-%-Set factor names for this design
-%-----------------------------------------------------------------------
-sCC = sf_estrrep(sCC,[sF',D.sF']);
-sCFI = sf_estrrep(sCFI,[sF',D.sF']);
-sGloNorm = sf_estrrep(sGloNorm,[sF',D.sF']);
-sGMsca = sf_estrrep(sGMsca,[sF',D.sF']);
-
-%-Get filenames & factor indicies
-%-----------------------------------------------------------------------
-[P,I] = pr_spm_ui('Files&Indices',D.sF,D.n,D.b.aTime,nVar);
-nScan = size(I,1); %-#obs
-
-%-Additional design parameters
-%-----------------------------------------------------------------------
-bL = any(diff(I,1),1); %-Multiple factor levels?
- % NB: bL(2) might be thrown by user specified f1 levels
- % (D.b.aTime & D.n(2)>1) - assumme user is consistent?
-bFI = [bL(1),bL(2:3)&~bL(4),bL(4),bL([2,3])&bL(4)];
- %-Allowable interactions for covariates
- %-Only offer interactions with multi-level factors, and
- % don't offer by F2|F3 if bL(4)!
-
-%-Build Condition (H) and Block (B) partitions
-%=======================================================================
-eval(['[H,Hnames] = spm_DesMtx(',D.Hform,');'])
-if rank(H)==nScan, error('unestimable condition effects'), end
-eval(['[B,Bnames] = spm_DesMtx(',D.Bform,');'])
-if rank(B)==nScan, error('unestimable block effects'), end
-
-%-Drop a constant H partition if B partition can model constant
-if size(H,2)>0 & all(H(:)==1) & (rank([H B])==rank(B))
- H = []; Hnames = {};
- warning('Dropping redundant constant H partition')
-end
-
-
-%-Covariate partition(s): interest (C) & nuisance (G) excluding global
-%=======================================================================
-nC = D.nC; %-Default #covariates
-C = {[],[]}; Cnames = {{},{}}; %-Covariate DesMtx partitions & names
-xC = []; %-Struct array to hold raw covariates
-
-
-dcname = {'CovInt','NusCov'}; %-Default root names for covariates
-dstr = {'covariate','nuisance variable'};
-
-GUIpos = spm_input('!NextPos');
-nc = [0,0];
-for i=1:2 % 1:covariates of interest, 2:nuisance variables
- if isinf(nC(i)), nC(i)=spm_input(['# ',dstr{i},'s'],GUIpos,'w1'); end
-
- while nc(i) < nC(i)
-
- %-Create prompt, get covariate, get covariate name
- %---------------------------------------------------------------
- if nC(i)==1, str=dstr{i}; else, str=sprintf('%s %d',dstr{i},nc(i)+1); end
- c = spm_input(str,GUIpos,'r',[],[nScan,Inf]);
- if any(isnan(c(:))), break, end %-NaN is dummy value to exit
- nc(i) = nc(i)+1; %-#Covariates (so far)
- if nC(i)>1, tstr = sprintf('%s^{%d}',dcname{i},nc(i));
- else, tstr = dcname{i}; end
- cname = spm_input([str,' name?'],'+1','s',tstr);
- rc = c; %-Save covariate value
- rcname = cname; %-Save covariate name
-
- %-Interaction option? (if single covariate vector entered)?
- %---------------------------------------------------------------
- if size(c,2) == 1
- if length(D.iCFI{i})>1
- %-User choice of interaction options, default is negative
- %-Only offer interactions for appropriate factor combinations
- iCFI = intersect(abs(D.iCFI{i}),find([1,bFI]));
- dCFI = max([1,intersect(iCFI,-D.iCFI{i}(D.iCFI{i}<0))]);
- iCFI = spm_input([str,': interaction?'],'+1','m',...
- sCFI(iCFI),iCFI,find(iCFI==dCFI));
- else
- iCFI = abs(D.iCFI{i}); %-AutoSelect default option
- end
- else
- iCFI = 1;
- end
-
- %-Centre covariate(s)? (Default centring to correspond to CFI)
- % Always offer "no centering" as default for design matrix blocks
- %---------------------------------------------------------------
- DiCC = D.iCC{i};
- if size(c,2)>1, DiCC = union(DiCC,-8); end
- if length(DiCC)>1
- %-User has a choice of centering options
- %-Only offer factor specific for appropriate factor combinations
- iCC = intersect(abs(DiCC),find([1,bFI,1]) );
- %-Default is max -ve option in D, overridden by iCFI if CFI
- if iCFI==1, dCC=-DiCC(DiCC<0); else, dCC=iCFI; end
- dCC = max([1,intersect(iCC,dCC)]);
- iCC = spm_input([str,': centre?'],'+1','m',...
- sCC(iCC),iCC,find(iCC==dCC));
- else
- iCC = abs(DiCC); %-AutoSelect default option
- end
- %-Centre within factor levels as appropriate
- if any(iCC==[1:7]), c = c - spm_meanby(c,eval(CCforms{iCC})); end
-
- %-Do any interaction (only for single covariate vectors)
- %---------------------------------------------------------------
- if iCFI>1 %-(NB:iCFI=1 if size(c,2)>1)
- tI = [eval(CFIforms{iCFI,1}),c];
- tConst = CFIforms{iCFI,2};
- tFnames = [eval(CFIforms{iCFI,3}),{cname}];
- [c,cname] = spm_DesMtx(tI,tConst,tFnames);
- elseif size(c,2)>1 %-Design matrix block
- [null,cname] = spm_DesMtx(c,'X',cname);
- else
- cname = {cname};
- end
-
- %-Store raw covariate details in xC struct for reference
- %-Pack c into appropriate DesMtx partition
- %---------------------------------------------------------------
- %-Construct description string for covariate
- str = {sprintf('%s: %s',str,rcname)};
- if size(rc,2)>1, str = {sprintf('%s (block of %d covariates)',...
- str{:},size(rc,2))};
- end
- if iCC<8, str=[str;{['used centered ',sCC{iCC}]}]; end
- if iCFI>1, str=[str;{['fitted as interaction ',sCFI{iCFI}]}]; end
-
- tmp = struct( 'rc',rc, 'rcname',rcname,...
- 'c',c, 'cname',{cname},...
- 'iCC',iCC, 'iCFI',iCFI,...
- 'type',i,...
- 'cols',[1:size(c,2)] + ...
- size([H,C{1}],2) + ...
- size([B,C{2}],2)*(i-1),...
- 'descrip',{str} );
- if isempty(xC), xC=tmp; else, xC=[xC,tmp]; end
- C{i} = [C{i},c];
- Cnames{i} = [Cnames{i}; cname];
-
- end % (while)
-
-end % (for)
-clear c tI tConst tFnames
-spm_input('!SetNextPos',GUIpos);
-
-%-Unpack into C & G design matrix sub-partitions
-G = C{2}; Gnames = Cnames{2};
-C = C{1}; Cnames = Cnames{1};
-
-
-%-Options...
-%=======================================================================
-%-Global normalization options (GloNorm)
-%-----------------------------------------------------------------------
-if length(D.iGloNorm)>1
- %-User choice of global normalisation options, default is negative
- %-Only offer factor specific for appropriate factor combinations
- iGloNorm = intersect(abs(D.iGloNorm),find([1,bFI,1,1]));
- dGloNorm = max([0,intersect(iGloNorm,-D.iGloNorm(D.iGloNorm<0))]);
- iGloNorm = spm_input('GloNorm: Select global normalisation','+1','m',...
- sGloNorm(iGloNorm),iGloNorm,find(iGloNorm==dGloNorm));
-else
- iGloNorm = abs(D.iGloNorm);
-end
-
-
-%-Grand mean scaling options (GMsca)
-%-----------------------------------------------------------------------
-if iGloNorm==8
- iGMsca=8; %-grand mean scaling implicit in PropSca GloNorm
-elseif length(D.iGMsca)==1
- iGMsca = abs(D.iGMsca);
-else
- %-User choice of grand mean scaling options
- %-Only offer factor specific for appropriate factor combinations
- iGMsca = intersect(abs(D.iGMsca),find([1,bFI,0,1]));
- %-Default is max -ve option in D, overridden by iGloNorm if AnCova
- if iGloNorm==9, dGMsca=-D.iGMsca(D.iGMsca<0); else, dGMsca=iGloNorm; end
- dGMsca = max([0,intersect(iGMsca,dGMsca)]);
- iGMsca = spm_input('GMsca: grand mean scaling','+1','m',...
- sGMsca(iGMsca),iGMsca,find(iGMsca==dGMsca));
-end
-
-
-%-Value for PropSca / GMsca (GM)
-%-----------------------------------------------------------------------
-if iGMsca == 9 %-Not scaling (GMsca or PropSca)
- GM = 0; %-Set GM to zero when not scaling
-else %-Ask user value of GM
- if iGloNorm==8
- str = 'PropSca global mean to';
- else
- str = [strrep(sGMsca{iGMsca},'scaling of','scale'),' to'];
- end
- GM = spm_input(str,'+1','r',D.GM,1);
- %-If GM is zero then don't GMsca! or PropSca GloNorm
- if GM==0, iGMsca=9; if iGloNorm==8, iGloNorm=9; end, end
-end
-
-%-Sort out description strings for GloNorm and GMsca
-%-----------------------------------------------------------------------
-sGloNorm = sGloNorm{iGloNorm};
-sGMsca = sGMsca{iGMsca};
-if iGloNorm==8
- sGloNorm = sprintf('%s to %-4g',sGloNorm,GM);
-elseif iGMsca<8
- sGMsca = sprintf('%s to %-4g',sGMsca,GM);
-end
-
-
-%-Global centering (for AnCova GloNorm) (GC)
-%-----------------------------------------------------------------------
-%-Specify the centering option for the global covariate for AnCova
-%-Basically, if 'GMsca'ling then should centre to GM (iGC=11). Otherwise,
-% should centre in similar fashion to AnCova (i.e. by the same factor(s)),
-% such that models are seperable (iGC=10). This is particularly important
-% for subject specific condition effects if then passed on to a second-level
-% model. (See also spm_adjmean_ui.m) SPM96 (& earlier) used to just centre
-% GX around its (overall) mean (iGC=1).
-
-%-This code allows more general options to be specified (but is a bit complex)
-%-Setting D.iGC=[-10,-11] gives the standard choices above
-
-%-If not doing AnCova then GC is irrelevant
-if ~any(iGloNorm==[1:7])
- iGC = 12;
- gc = [];
-else
- %-Annotate options 10 & 11 with specific details
- %---------------------------------------------------------------
- %-Tag '(as implied by AnCova)' with actual AnCova situation
- sCC{10} = [sCC{iGloNorm},' (<= ',sGloNorm,')'];
- %-Tag 'GM' case with actual GM & GMsca case
- sCC{11} = sprintf('around GM=%g (i.e. %s after grand mean scaling)',...
- GM,strrep(sCC{iGMsca},'around ',''));
-
- %-Constuct vector of allowable iGC
- %---------------------------------------------------------------
- %-Weed out redundent factor combinations from pre-set allowable options
- iGC = intersect(abs(D.iGC),find([1,bFI,1,1,1,1]));
- %-Omit 'GM' option if didn't GMsca (iGMsca~=8 'cos doing AnCova)
- if any(iGMsca==[8,9]), iGC = setdiff(iGC,11); end
- %-Omit 'GM' option if same as '(as implied by AnCova)'
- if iGloNorm==iGMsca, iGC = setdiff(iGC,11); end
-
- %-If there's a choice, set defaults (if any), & get answer
- %---------------------------------------------------------------
- if length(iGC)>1
- dGC = max([0,intersect(iGC,-D.iGC(D.iGC<0))]);
- str = 'Centre global covariate';
- if iGMsca<8, str = [str,' (after grand mean scaling)']; end
- iGC = spm_input(str,'+1','m',sCC(iGC),iGC,find(iGC==dGC));
- elseif isempty(iGC)
- error('Configuration error: empty iGC')
- end
-
- %-If 'user specified' then get value
- %---------------------------------------------------------------
- if iGC==9
- gc = spm_input('Centre globals around','+0','r',D.GM,1);
- sCC{9} = sprintf('%s of %g',sCC{iGC},gc);
- else
- gc = 0;
- end
-end
-
-
-%-Thresholds & masks defining voxels to analyse (MASK)
-%=======================================================================
-GUIpos = spm_input('!NextPos');
-
-%-Analysis threshold mask
-%-----------------------------------------------------------------------
-%-Work out available options:
-% -Inf=>None, complex=>proportional, real=>absolute (i.e. times global)
-M_T = D.M_.T; if isempty(M_T), M_T = [-Inf, 100, 0.8*sqrt(-1)]; end
-M_T = { 'none', M_T(min(find(isinf(M_T))));...
- 'absolute', M_T(min(find(isfinite(M_T)&(M_T==real(M_T)))));...
- 'prop''nal', M_T(min(find(isfinite(M_T)&(M_T~=real(M_T))))) };
-
-%-Work out available options
-%-If there's a choice between proportional and absolute then ask
-%-----------------------------------------------------------------------
-q = ~[isempty(M_T{1,2}), isempty(M_T{2,2}), isempty(M_T{3,2})];
-
-if all(q(2:3))
- tmp = spm_input('Threshold masking',GUIpos,'b',M_T(q,1),find(q));
- q(setdiff([1:3],tmp))=0;
-end
-
-%-Get mask value - note that at most one of q(2:3) is true
-%-----------------------------------------------------------------------
-if ~any(q) %-Oops - nothing specified!
- M_T = -Inf;
-elseif all(q==[1,0,0]) %-no threshold masking
- M_T = -Inf;
-else %-get mask value
- if q(1), args = {'br1','None',-Inf,abs(M_T{1+find(q(2:3)),2})};
- else, args = {'r',abs(M_T{1+find(q(2:3)),2})}; end
- if q(2)
- M_T = spm_input('analysis threshold',GUIpos,args{:});
- elseif q(3)
- M_T = spm_input('analysis thresh (prop''n of global)',GUIpos,...
- args{:});
- if isfinite(M_T) & isreal(M_T), M_T=M_T*sqrt(-1); end
- else
- error('Shouldn''t get here!')
- end
-end
-
-%-Make a description string
-%-----------------------------------------------------------------------
-if isinf(M_T)
- xsM.Analysis_threshold = 'None (-Inf)';
-elseif isreal(M_T)
- xsM.Analysis_threshold = sprintf('images thresholded at %6g',M_T);
-else
- xsM.Analysis_threshold = sprintf(['images thresholded at %6g ',...
- 'times global'],imag(M_T));
-end
-
-
-%-Implicit masking: Ignore zero voxels in low data-types?
-%-----------------------------------------------------------------------
-% (Implicit mask is NaN in higher data-types.)
-type = mars_vol_utils('type', spm_vol(P{1,1}));
-if ~spm_type(type,'nanrep')
- switch D.M_.I
- case Inf, M_I = spm_input('Implicit mask (ignore zero''s)?',...
- '+1','y/n',[1,0],1); %-Ask
- case {0,1}, M_I = D.M_.I; %-Pre-specified
- otherwise, error('unrecognised D.M_.I type')
- end
-
- if M_I, xsM.Implicit_masking = 'Yes: zero''s treated as missing';
- else, xsm.Implicit_masking = 'No'; end
-else
- M_I = 1;
- xsM.Implicit_masking = 'Yes: NaN''s treated as missing';
-end
-
-
-%-Explicit mask images (map them later...)
-%-----------------------------------------------------------------------
-switch(D.M_.X)
-case Inf, M_X = spm_input('explicitly mask images?','+1','y/n',[1,0],2);
-case {0,1}, M_X = D.M_.X;
-otherwise, error('unrecognised D.M_.X type')
-end
-if M_X, M_P = spm_get(Inf,img_flt,{'select mask images'}); else, M_P = {}; end
-
-
-%-Global calculation (GXcalc)
-%=======================================================================
-iGXcalc = abs(D.iGXcalc);
-%-Only offer "omit" option if not doing any GloNorm, GMsca or PropTHRESH
-if ~(iGloNorm==9 & iGMsca==9 & (isinf(M_T)|isreal(M_T)))
- iGXcalc = intersect(iGXcalc,[2:size(sGXcalc,1)]);
-end
-if isempty(iGXcalc)
- error('no GXcalc options')
-elseif length(iGXcalc)>1
- %-User choice of global calculation options, default is negative
- dGXcalc = max([1,intersect(iGXcalc,-D.iGXcalc(D.iGXcalc<0))]);
- iGXcalc = spm_input('Global calculation','+1','m',...
- sGXcalc(iGXcalc),iGXcalc,find(iGXcalc==dGXcalc));
-else
- iGXcalc = abs(D.iGXcalc);
-end
-
-if iGXcalc==2 %-Get user specified globals
- g = spm_input('globals','+0','r',[],[nScan,nVar]);
-end
-sGXcalc = sGXcalc{iGXcalc};
-
-
-%=======================================================================
-% - C O N F I G U R E D E S I G N
-%=======================================================================
-spm('FigName','Stats: configuring',Finter,CmdLine);
-spm('Pointer','Watch');
-
-
-%-Images & image info: Map Y image files and check consistency of
-% dimensions and orientation / voxel size
-%=======================================================================
-fprintf('%-40s: ','Mapping files') %-#
-for i = 1:nVar
- VY(:,i) = spm_vol(char(P{:,i}));
-end
-
-%-Check compatability of images
-%-----------------------------------------------------------------------
-[samef msg] = mars_vol_check(VY);
-if ~samef, disp(char(msg)),error('Cannot use images'),end;
-
-fprintf('%30s\n','...done') %-#
-
-
-%-Global values, scaling and global normalisation
-%=======================================================================
-%-Compute global values
-%-----------------------------------------------------------------------
-switch iGXcalc, case 1
- %-Don't compute => no GMsca (iGMsca==9) or GloNorm (iGloNorm==9)
- g = [];
-case 2
- %-User specified globals
-case 3
- %-Compute as mean voxel value (within per image fullmean/8 mask)
- g = zeros(nScan,nVar);
- fprintf('%-40s: %30s','Calculating globals',' ') %-#
- for i = 1:nScan
- for j = 1:nVar
- if nVar>1
- str = sprintf('%3d(%02d)/%d(%d)',i,j,nScan,nVar);
- else
- str = sprintf('%3d/%-3d',i,nScan);
- end
- fprintf('%s%30s',repmat(sprintf('\b'),1,30),str)%-#
- g(i,j) = spm_global(VY(i,j));
- end
- end
- fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-#
-otherwise
- error('illegal iGXcalc')
-end
-rg = g;
-
-
-fprintf('%-40s: ','Design configuration') %-#
-
-
-%-Scaling: compute global scaling factors gSF required to implement proportional
-% scaling global normalisation (PropSca) or grand mean scaling (GMsca),
-% as specified by iGMsca (& iGloNorm)
-%-----------------------------------------------------------------------
-switch iGMsca, case 8
- %-Proportional scaling global normalisation
- if iGloNorm~=8, error('iGloNorm-iGMsca(8) mismatch for PropSca'), end
- gSF = GM./g;
- g = GM*ones(nScan,nVar);
-case {1,2,3,4,5,6,7}
- %-Grand mean scaling according to iGMsca
- gSF = GM./spm_meanby(g,eval(CCforms{iGMsca}));
- g = g.*gSF;
-case 9
- %-No grand mean scaling
- gSF = ones(nScan,nVar);
-otherwise
- error('illegal iGMsca')
-end
-
-
-%-Apply gSF to memory-mapped scalefactors to implement scaling
-%-----------------------------------------------------------------------
-for i=1:nScan
- for j = 1:nVar
- VY(i,j).pinfo(1:2,:) = VY(i,j).pinfo(1:2,:)*gSF(i,j);
- end
-end
-
-
-%-AnCova: Construct global nuisance covariates partition (if AnCova)
-%-----------------------------------------------------------------------
-if any(iGloNorm==[1:7])
-
- %-Centre global covariate as requested
- %---------------------------------------------------------------
- switch iGC, case {1,2,3,4,5,6,7} %-Standard sCC options
- gc = spm_meanby(g,eval(CCforms{iGC}));
- case 8 %-No centering
- gc = 0;
- case 9 %-User specified centre
- %-gc set above
- case 10 %-As implied by AnCova option
- gc = spm_meanby(g,eval(CCforms{iGloNorm}));
- case 11 %-Around GM
- gc = GM;
- otherwise %-unknown iGC
- error('unexpected iGC value')
- end
-
- for i = 1:nVar
-
- %-AnCova - add scaled centred global to DesMtx `G' partition
- %-------------------------------------------------------
- rcname='global'; if nVar>1, rcname=sprintf('global-%d',i); end
- tI = [eval(CFIforms{iGloNorm,1}),g(:,i)-gc(:,i)];
- tConst = CFIforms{iGloNorm,2};
- tFnames = [eval(CFIforms{iGloNorm,3}),{rcname}];
- [f,gname] = spm_DesMtx(tI,tConst,tFnames);
- clear tI tConst tFnames
-
- %-Save GX info in xC struct for reference
- str = {sprintf('%s: %s',dstr{2},rcname)};
- if any(iGMsca==[1:7]), str=[str;{['(after ',sGMsca,')']}]; end
- if iGC~=8, str=[str;{['used centered ',sCC{iGC}]}]; end
- if iGloNorm > 1
- str=[str;{['fitted as interaction ',sCFI{iGloNorm}]}];
- end
- tmp = struct( 'rc',rg(:,i).*gSF(:,i), 'rcname',rcname,...
- 'c',f, 'cname' ,{gname},...
- 'iCC',iGC, 'iCFI' ,iGloNorm,...
- 'type', 3,...
- 'cols',[1:size(f,2)]+size([H C B G],2),...
- 'descrip', {str} );
-
- G = [G,f]; Gnames = [Gnames; gname];
- if isempty(xC), xC = tmp; else, xC = [xC,tmp]; end
-
- end
-
-elseif iGloNorm==8 | iGXcalc>1
-
- %-Globals calculated, but not AnCova: Make a note of globals
- %---------------------------------------------------------------
- if iGloNorm==8
- str = { 'global values: (used for proportional scaling)';...
- '("raw" unscaled globals shown)'};
- elseif isfinite(M_T) & ~isreal(M_T)
- str = { 'global values: (used to compute analysis threshold)'};
- else
- str = { 'global values: (computed but not used)'};
- end
-
- for i = 1:nVar
- rcname='global'; if nVar>1, rcname=sprintf('global-%d',i); end
- tmp = struct( 'rc',rg(:,i), 'rcname',rcname,...
- 'c',{[]}, 'cname' ,{{}},...
- 'iCC',0, 'iCFI' ,0,...
- 'type', 3,...
- 'cols', {[]},...
- 'descrip', {str} );
- if isempty(xC), xC = tmp; else, xC = [xC,tmp]; end
- end
-end
-
-
-%-Save info on global calculation in xGX structure
-%-----------------------------------------------------------------------
-xGX = struct(...
- 'iGXcalc',iGXcalc, 'sGXcalc',sGXcalc, 'rg',rg,...
- 'iGMsca',iGMsca, 'sGMsca',sGMsca, 'GM',GM,'gSF',gSF,...
- 'iGC', iGC, 'sGC', sCC{iGC}, 'gc', gc,...
- 'iGloNorm',iGloNorm, 'sGloNorm',sGloNorm);
-
-
-
-%-Construct masking information structure and compute actual analysis
-% threshold using scaled globals (rg.*gSF)
-%-----------------------------------------------------------------------
-if isreal(M_T), M_TH = M_T * ones(nScan,nVar); %-NB: -Inf is real
-else, M_TH = imag(M_T) * (rg.*gSF); end
-
-if ~isempty(M_P)
- VM = spm_vol(char(M_P));
- xsM.Explicit_masking = [{'Yes: mask images :'};{VM.fname}'];
-else
- VM=[];
- xsM.Explicit_masking = 'No';
-end
-xM = struct('T',M_T, 'TH',M_TH, 'I',M_I, 'VM',{VM}, 'xs',xsM);
-
-
-
-%-Construct full design matrix (X), parameter names (Xnames),
-% and design information structure (xX)
-%=======================================================================
-X = [H C B G];
-Xnames = [Hnames; Cnames; Bnames; Gnames];
-tmp = cumsum([size(H,2), size(C,2), size(B,2), size(G,2)]);
-xX = struct( 'I', I,...
- 'sF', {D.sF},...
- 'X', X,...
- 'sigma', 0,...
- 'iH', [1:size(H,2)],...
- 'iC', [1:size(C,2)] + tmp(1),...
- 'iB', [1:size(B,2)] + tmp(2),...
- 'iG', [1:size(G,2)] + tmp(3),...
- 'Xnames', {Xnames});
-
-
-
-%-Pre-specified contrast for F-test on effects of interest
-%=======================================================================
-if ~isempty([H,C])
- %-Some effects designated "of interest"
- F_iX0 = (size(H,2)+size(C,2)) + [1:size(B,2)+size(G,2)];
-else
- %-No effects designated "of interest" - F-test for B=0
- F_iX0 = [];
-end
-
-
-%-Design description (an nx2 cellstr) - for saving and display
-%=======================================================================
-tmp = { sprintf('%d condition, +%d covariate, +%d block, +%d nuisance',...
- size(H,2),size(C,2),size(B,2),size(G,2));...
- sprintf('%d total, having %d degrees of freedom',...
- size(X,2),rank(X));...
- sprintf('leaving %d degrees of freedom from %d images',...
- size(X,1)-rank(X),size(X,1)) };
-xsDes = struct( 'Design', {D.DesName},...
- 'Global_calculation', {sGXcalc},...
- 'Grand_mean_scaling', {sGMsca},...
- 'Global_normalisation', {sGloNorm},...
- 'Parameters', {tmp} );
-
-
-fprintf('%30s\n','...done') %-#
-
-SPM = struct('xX', xX,...
- 'VY', VY,...
- 'xM', xM,...
- 'F_iX0', F_iX0,...
- 'xC', xC,...
- 'xsDes', xsDes,...
- 'SPMid', SPMid,...
- 'cfg', 'SPMcfg');
-varargout = {SPM};
-
-%-End
-%=======================================================================
-spm('Pointer','Arrow')
-fprintf('%-40s: %30s\n','Completed',spm('time')) %-#
-fprintf('\n\n')
-
-case 'files&indices'
-%=======================================================================
-% - Get files and factor indices
-%=======================================================================
-% [P,I] = pr_spm_ui('Files&Indices',DsF,Dn,DbaTime,nV)
-% DbaTime=D.b.aTime; Dn=D.n; DsF=D.sF;
-if nargin<5, nV = 1; else, nV = varargin{5}; end
-if nargin<4, DbaTime = 1; else, DbaTime = varargin{4}; end
-if nargin<3, Dn = [Inf,Inf,Inf,Inf]; else, Dn=varargin{3}; end
-if nargin<2, DsF = {'Fac1','Fac2','Fac3','Fac4'}; else, DsF=varargin{2}; end
-
-%-Initialise variables
-%-----------------------------------------------------------------------
-i4 = []; % factor 4 index (usually group)
-i3 = []; % factor 3 index (usually subject), per f4
-i2 = []; % factor 2 index (usually condition), per f3/f4
-i1 = []; % factor 1 index (usually replication), per f2/f3/f4
-P = {}; % cell array of string filenames
-
-%-Accrue filenames and factor level indicator vectors
-%-----------------------------------------------------------------------
-bMV = nV>1;
-if isinf(Dn(4)), n4 = spm_input(['#',DsF{4},'''s'],'+1','n1');
- else, n4 = Dn(4); end
-bL4 = n4>1;
-
-ti2 = '';
-GUIpos = spm_input('!NextPos');
-for j4 = 1:n4
- spm_input('!SetNextPos',GUIpos);
- sF4P=''; if bL4, sF4P=[DsF{4},' ',int2str(j4),': ']; end
- if isinf(Dn(3)), n3=spm_input([sF4P,'#',DsF{3},'''s'],'+1','n1');
- else, n3 = Dn(3); end
- bL3 = n3>1;
-
- if DbaTime & Dn(2)>1
- %disp('NB:selecting in time order - manually specify conditions')
- %-NB: This means f2 levels might not be 1:n2
- GUIpos2 = spm_input('!NextPos');
- for j3 = 1:n3
- sF3P=''; if bL3, sF3P=[DsF{3},' ',int2str(j3),': ']; end
- str = [sF4P,sF3P];
- tP = {};
- n21 = Dn(2)*Dn(1);
- for v=1:nV
- vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end
- ttP = spm_get(n21,img_flt,{[str,'select images',vstr]});
- n21 = length(ttP);
- tP = [tP,ttP];
- end
- ti2 = spm_input([str,' ',DsF{2},'?'],GUIpos2,'c',ti2',n21,Dn(2));
- %-Work out i1 & check
- [tl2,null,j] = unique(ti2);
- tn1 = zeros(size(tl2)); ti1 = zeros(size(ti2));
- for i=1:length(tl2)
- tn1(i)=sum(j==i); ti1(ti2==tl2(i))=1:tn1(i); end
- if isfinite(Dn(1)) & any(tn1~=Dn(1))
- %-#i1 levels mismatches specification in Dn(1)
- error(sprintf('#%s not %d as pre-specified',DsF{1},Dn(1)))
- end
- P = [P;tP];
- i4 = [i4; j4*ones(n21,1)];
- i3 = [i3; j3*ones(n21,1)];
- i2 = [i2; ti2];
- i1 = [i1; ti1];
- end
-
- else
-
- if isinf(Dn(2))
- n2 = spm_input([sF4P,'#',DsF{2},'''s'],'+1','n1');
- else
- n2 = Dn(2);
- end
- bL2 = n2>1;
-
- if n2==1 & Dn(1)==1 %-single scan per f3 (subj)
- %disp('NB:single scan per f3')
- str = [sF4P,'select images, ',DsF{3},' 1-',int2str(n3)];
- tP = {};
- for v=1:nV
- vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end
- ttP = spm_get(n3,img_flt,{[str,vstr]});
- tP = [tP,ttP];
- end
- P = [P;tP];
- i4 = [i4; j4*ones(n3,1)];
- i3 = [i3; [1:n3]'];
- i2 = [i2; ones(n3,1)];
- i1 = [i1; ones(n3,1)];
- else
- %-multi scan per f3 (subj) case
- %disp('NB:multi scan per f3')
- for j3 = 1:n3
- sF3P=''; if bL3, sF3P=[DsF{3},' ',int2str(j3),': ']; end
- if Dn(1)==1
- %-No f1 (repl) within f2 (cond)
- %disp('NB:no f1 within f2')
- str = [sF4P,sF3P,'select images: ',DsF{2},...
- ' 1-',int2str(n2)];
- tP = {};
- for v=1:nV
- vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end
- ttP = spm_get(n2,img_flt,{[str,vstr]});
- tP = [tP,ttP];
- end
- P = [P;tP];
- i4 = [i4; j4*ones(n2,1)];
- i3 = [i3; j3*ones(n2,1)];
- i2 = [i2; [1:n2]'];
- i1 = [i1; ones(n2,1)];
- else
- %-multi f1 (repl) within f2 (cond)
- %disp('NB:f1 within f2')
- for j2 = 1:n2
- sF2P='';
- if bL2, sF2P=[DsF{2},' ',int2str(j2),': ']; end
- str = [sF4P,sF3P,sF2P,' select images...'];
- tP = {};
- n1 = Dn(1);
- for v=1:nV
- vstr=''; if bMV, vstr=sprintf(' (var-%d)',v); end
- ttP = spm_get(n1,img_flt,{[str,vstr]});
- n1 = length(ttP);
- tP = [tP,ttP];
- end
- P = [P;tP];
- i4 = [i4; j4*ones(n1,1)];
- i3 = [i3; j3*ones(n1,1)];
- i2 = [i2; j2*ones(n1,1)];
- i1 = [i1; [1:n1]'];
- end % (for j2)
- end % (if Dn(1)==1)
- end % (for j3)
- end % (if n2==1 &...)
- end % (if DbaTime & Dn(2)>1)
-end % (for j4)
-varargout = {P,[i1,i2,i3,i4]};
-
-
-case 'desdefs_stats'
-%=======================================================================
-% - Basic Stats Design definitions...
-%=======================================================================
-% D = pr_spm_ui('DesDefs_Stats');
-% These are the basic Stats design definitions...
-
-%-Note: struct expands cell array values to give multiple records:
-% => must embed cell arrays within another cell array!
-%-Negative indices indicate defaults (first used)
-
-D = struct(...
- 'DesName','One sample t-test',...
- 'n', [Inf 1 1 1], 'sF',{{'obs','','',''}},...
- 'Hform', 'I(:,2),''-'',''mean''',...
- 'Bform', '[]',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',-Inf,'I',Inf,'X',Inf),...
- 'b',struct('aTime',0));
-
-D = [D, struct(...
- 'DesName','Two sample t-test',...
- 'n', [Inf 2 1 1], 'sF',{{'obs','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',1))];
-
-D = [D, struct(...
- 'DesName','Paired t-test',...
- 'n', [1 2 Inf 1], 'sF',{{'','cond','pair',''}},...
- 'Hform', 'I(:,2),''-'',''condition''',...
- 'Bform', 'I(:,3),''-'',''\gamma''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','One way Anova',...
- 'n', [Inf Inf 1 1], 'sF',{{'repl','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','Simple regression (correlation)',...
- 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,2),''-'',''\mu''',...
- 'nC',[1,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','Multiple regression',...
- 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,2),''-'',''\mu''',...
- 'nC',[Inf,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','AnCova',...
- 'n', [Inf Inf 1 1], 'sF',{{'repl','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,1],'iCC',{{8,1}},'iCFI',{{1,1}},...
- 'iGXcalc',[-1,2,3],'iGMsca',[1,-9],'GM',[],...
- 'iGloNorm',9,'iGC',12,...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',0))];
-
-varargout = {D};
-
-
-case 'desdefs_pet'
-%=======================================================================
-% - Standard (SPM99) PET/SPECT Design definitions...
-%=======================================================================
-% D = pr_spm_ui('DesDefs_PET');
-% These are the standard PET design definitions...
-
-%-Single subject
-%-----------------------------------------------------------------------
-D = struct(...
- 'DesName','Single-subject: conditions & covariates',...
- 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[Inf,Inf],'iCC',{{[-1,3,8],[-1,8]}},'iCFI',{{[1,3],1}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',1));
-
-D = [D, struct(...
- 'DesName','Single-subject: covariates only',...
- 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[Inf,Inf],'iCC',{{[-1,8],[-1,8]}},'iCFI',{{1,1}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',1))];
-
-%-Multi-subject
-%-----------------------------------------------------------------------
-D = [D, struct(...
- 'DesName','Multi-subj: conditions & covariates',...
- 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[Inf,Inf],'iCC',{{[1,3,4,8],[1,4,8]}},'iCFI',{{[1,3,-4],[1,-4]}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,...
- 'iGloNorm',[4,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',1))];
-
-D = [D, struct(...
- 'DesName','Multi-subj: cond x subj interaction & covariates',...
- 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},...
- 'Hform', 'I(:,[3,2]),''-'',{''subj'',''cond''}',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[Inf,Inf],'iCC',{{[1,3,4,8],[1,4,8]}},'iCFI',{{[1,3,-4],[1,-4]}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,...
- 'iGloNorm',[4,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',1))];
-
-D = [D, struct(...
- 'DesName','Multi-subj: covariates only',...
- 'n',[Inf 1 Inf 1], 'sF',{{'repl','','subject',''}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[Inf,Inf],'iCC',{{[1,4,8],[1,4,8]}},'iCFI',{{[1,-4],[1,-4]}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-4,9],'GM',50,...
- 'iGloNorm',[4,8:9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-%-Multi-group
-%-----------------------------------------------------------------------
-D = [D, struct(...
- 'DesName','Multi-group: conditions & covariates',...
- 'n',[Inf Inf Inf Inf], 'sF',{{'repl','condition','subject','group'}},...
- 'Hform', 'I(:,[4,2]),''-'',{''stud'',''cond''}',...
- 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',...
- 'nC',[Inf,Inf],'iCC',{{[5:8],[5,7,8]}},'iCFI',{{[1,5,6,-7],[1,5,-7]}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-7,9],'GM',50,...
- 'iGloNorm',[7,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',1))];
-
-D = [D, struct(...
- 'DesName','Multi-group: covariates only',...
- 'n',[Inf 1 Inf Inf], 'sF',{{'repl','','subject','group'}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',...
- 'nC',[Inf,Inf],'iCC',{{[5,7,8],[5,7,8]}},'iCFI',{{[1,5,-7],[1,5,-7]}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-7,9],'GM',50,...
- 'iGloNorm',[7,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-%-Population comparisons
-%-----------------------------------------------------------------------
-D = [D, struct(...
- 'DesName',...
- 'Population main effect: 2 cond''s, 1 scan/cond (paired t-test)',...
- 'n',[1 2 Inf 1], 'sF',{{'','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
- 'iGloNorm',[8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName',...
- 'Dodgy population main effect: >2 cond''s, 1 scan/cond',...
- 'n',[1 Inf Inf 1], 'sF',{{'','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
- 'iGloNorm',[8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','Compare-populations: 1 scan/subject (two sample t-test)',...
- 'n',[Inf 2 1 1], 'sF',{{'subject','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
- 'iGloNorm',[8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','Compare-populations: 1 scan/subject (AnCova)',...
- 'n',[Inf 2 1 1], 'sF',{{'subject','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,Inf],'iCC',{{8,1}},'iCFI',{{1,1}},...
- 'iGXcalc',[1,2,-3],'iGMsca',[-1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0,0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-%-The Full Monty!
-%-----------------------------------------------------------------------
-D = [D, struct(...
- 'DesName','The Full Monty...',...
- 'n',[Inf Inf Inf Inf], 'sF',{{'repl','cond','subj','group'}},...
- 'Hform', 'I(:,[4,2]),''-'',{''stud'',''cond''}',...
- 'Bform', 'I(:,[4,3]),''-'',{''stud'',''subj''}',...
- 'nC',[Inf,Inf],'iCC',{{[1:8],[1:8]}},'iCFI',{{[1:7],[1:7]}},...
- 'iGXcalc',[1,2,3],'iGMsca',[1:7],'GM',50,...
- 'iGloNorm',[1:9],'iGC',[1:11],...
- 'M_',struct('T',[-Inf,0,0.8*sqrt(-1)],'I',Inf,'X',Inf),...
- 'b',struct('aTime',1))];
-
-
-varargout = {D};
-
-case 'desdefs_pet96'
-%=======================================================================
-% - SPM96 PET/SPECT Design definitions...
-%=======================================================================
-% D = pr_spm_ui('DesDefs_PET96');
-
-%-Single subject
-%-----------------------------------------------------------------------
-D = struct(...
- 'DesName','SPM96:Single-subject: replicated conditions',...
- 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0));
-
-D = [D, struct(...
- 'DesName','SPM96:Single-subject: replicated conditions & covariates',...
- 'n', [Inf Inf 1 1], 'sF',{{'repl','condition','',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','SPM96:Single-subject: covariates only',...
- 'n', [Inf 1 1 1], 'sF',{{'repl','','',''}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,3),''-'',''\mu''',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-%-Multi-subject
-%-----------------------------------------------------------------------
-D = [D, struct(...
- 'DesName','SPM96:Multi-subject: different conditions',...
- 'n', [1 Inf Inf 1], 'sF',{{'','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''scancond''',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,4,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','SPM96:Multi-subject: replicated conditions',...
- 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,4,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','SPM96:Multi-subject: different conditions & covariates',...
- 'n', [1 Inf Inf 1], 'sF',{{'','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''cond''',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,4],[1,4]}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,4,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','SPM96:Multi-subject: replicated conditions & covariates',...
- 'n',[Inf Inf Inf 1], 'sF',{{'repl','condition','subject',''}},...
- 'Hform', 'I(:,2),''-'',''condition''',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,3,4],[1,4]}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,4,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','SPM96:Multi-subject: covariates only',...
- 'n',[Inf 1 Inf 1], 'sF',{{'repl','','subject',''}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,3),''-'',''subj''',...
- 'nC',[Inf,Inf],'iCC',{{[1,4,8],[1,4,8]}},'iCFI',{{[1,4],[1,4]}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,4,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-%-Multi-study
-%-----------------------------------------------------------------------
-D = [D, struct(...
- 'DesName','SPM96:Multi-study: different conditions',...
- 'n',[1 Inf Inf Inf], 'sF',{{'','cond','subj','study'}},...
- 'Hform', 'I(:,[4,2]),''-'',{''study'',''cond''}',...
- 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
- 'iGloNorm',[1,5,7,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','SPM96:Multi-study: replicated conditions',...
- 'n',[Inf Inf Inf Inf], 'sF',{{'repl','cond','subj','study'}},...
- 'Hform', 'I(:,[4,2]),''-'',{''study'',''condition''}',...
- 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
- 'iGloNorm',[1,5,7,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','SPM96:Multi-study: different conditions & covariates',...
- 'n',[1 Inf Inf Inf], 'sF',{{'','cond','subj','study'}},...
- 'Hform', 'I(:,[4,2]),''-'',{''study'',''cond''}',...
- 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,6,7],[1,5,7]}},...
- 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
- 'iGloNorm',[1,5,7,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','SPM96:Multi-study: replicated conditions & covariates',...
- 'n',[Inf Inf Inf Inf], 'sF',{{'','cond','subj','study'}},...
- 'Hform', 'I(:,[4,2]),''-'',{''study'',''condition''}',...
- 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,6,7],[1,5,7]}},...
- 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
- 'iGloNorm',[1,5,7,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-D = [D, struct(...
- 'DesName','SPM96:Multi-study: covariates only',...
- 'n',[Inf 1 Inf Inf], 'sF',{{'repl','','subj','study'}},...
- 'Hform', '[]',...
- 'Bform', 'I(:,[4,3]),''-'',{''study'',''subj''}',...
- 'nC',[Inf,Inf],'iCC',{{1,1}},'iCFI',{{[1,5,7],[1,5,7]}},...
- 'iGXcalc',3,'iGMsca',[1,5,9],'GM',50,...
- 'iGloNorm',[1,5,7,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-%-Group comparisons
-%-----------------------------------------------------------------------
-D = [D, struct(...
- 'DesName','SPM96:Compare-groups: 1 scan per subject',...
- 'n',[Inf Inf 1 1], 'sF',{{'subject','group','',''}},...
- 'Hform', 'I(:,2),''-'',''group''',...
- 'Bform', '[]',...
- 'nC',[0,0],'iCC',{{8,8}},'iCFI',{{1,1}},...
- 'iGXcalc',3,'iGMsca',[1,9],'GM',50,...
- 'iGloNorm',[1,8,9],'iGC',10,...
- 'M_',struct('T',[0.8*sqrt(-1)],'I',0,'X',0),...
- 'b',struct('aTime',0))];
-
-varargout = {D};
-
-
-otherwise
-%=======================================================================
-% - U N K N O W N A C T I O N
-%=======================================================================
-warning(['Illegal Action string: ',Action])
-
-
-%=======================================================================
-% - E N D
-%=======================================================================
-end
-
-
-
-
-%=======================================================================
-%- S U B - F U N C T I O N S
-%=======================================================================
-
-function str = sf_estrrep(str,srstr)
-%=======================================================================
-for i = 1:size(srstr,1)
- str = strrep(str,srstr{i,1},srstr{i,2});
-end
-return
diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_spm_volterra.m b/lib/marsbar-0.44/@mardo_99/private/pr_spm_volterra.m
deleted file mode 100644
index 462d1d9..0000000
--- a/lib/marsbar-0.44/@mardo_99/private/pr_spm_volterra.m
+++ /dev/null
@@ -1,97 +0,0 @@
-function [X,Xn,IND,BF,name] = spm_Volterra(SF,BF,name,N)
-% returns [design] matrix of explanatory variables
-% FORMAT [X Xn IND BF name] = spm_Volterra(SF,BF,name,N);
-% SF{i} - multivariate causes: SF{i}(:,j) = casue i, expansion j
-% BF{i} - Basis functions: BF{i} = basis set for cause i
-% name{i} - name of cause i
-% N - [1 or 2] order of Volterra expansion
-%
-% X - Design Matrix
-% Xn{i} - name of cause i (now including interactions among causes)
-% IND{i} - indices pertaining to cause i (and interactions)
-%___________________________________________________________________________
-%
-% For first order expansions spm_Volterra simply convolves the causes
-% (e.g. stick functions) in SF by the basis functions in BF to create
-% a design matrix X. For second order expansions new entries appear
-% in IND, BF and name that correspond to the interaction among the
-% orginal causes (if the events are sufficiently close in time).
-% The basis functions for these are two dimensional and are used to
-% assemble the second order kernel in spm_graph.m. Second order effects
-% are computed for only the first column of SF.
-%___________________________________________________________________________
-% @(#)spm_Volterra.m 2.1 Karl Friston 99/05/11
-
-
-% Construct X
-%===========================================================================
-
-% 1st order terms
-%---------------------------------------------------------------------------
-X = [];
-Xn = {};
-IND = cell(1,size(SF,2));
-for i = 1:size(SF,2)
- for j = 1:size(BF{i},2)
- for k = 1:size(SF{i},2)
- x = SF{i}(:,k);
- d = 1:length(x);
- x = conv(full(x),BF{i}(:,j));
- x = x(d);
- X = [X x];
- IND{i} = [IND{i} size(X,2)];
- if size(SF{i},2) > 1
- str = [name{i} sprintf('(%i)[%i]',j,(k - 1))];
- else
- str = [name{i} sprintf('(%i)',j)];
- end
- Xn{end + 1} = str;
- end
- end
-end
-
-% return if first order
-%---------------------------------------------------------------------------
-if N == 1, return, end
-
-% 2nd order terms
-%---------------------------------------------------------------------------
-k = length(name);
-for i = 1:size(SF,2)
- for j = i:size(SF,2)
-
- % ensure events can interact
- %-----------------------------------------------------------
- skip = 0;
- if i == j
- p = diff(find(SF{i}(:,1)));
- skip = (size(BF{i},1) <= min(p)) | ~any(diff(p));
- end
-
- if ~skip
-
- k = k + 1;
- ind = [];
- bf = {};
- for p = 1:size(BF{i},2)
- for q = 1:size(BF{j},2)
- ni = [name{i} sprintf('(%i)',p)];
- nj = [name{j} sprintf('(%i)',q)];
- x = SF{i}(:,1);
- y = SF{j}(:,1);
- x = conv(full(x),BF{i}(:,p));
- y = conv(full(y),BF{j}(:,q));
- x = x(d);
- y = y(d);
- X = [X x.*y];
- ind = [ind size(X,2)];
- Xn{end + 1} = [ni ' x ' nj];
- bf = [bf {BF{i}(:,p)*BF{j}(:,q)'}];
- end
- end
- name{k} = [name{i} ' x ' name{j}];
- IND{k} = ind;
- BF{k} = bf;
- end
- end
-end
diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_stat_compute.m b/lib/marsbar-0.44/@mardo_99/private/pr_stat_compute.m
deleted file mode 100644
index e836b99..0000000
--- a/lib/marsbar-0.44/@mardo_99/private/pr_stat_compute.m
+++ /dev/null
@@ -1,83 +0,0 @@
-function [Num, Stat, P, Pc] = pr_stat_compute(xCon, Xs, V, betas, ResidualMS);
-% calculates contrast value, stats and p values for contrasts
-% FORMAT [Num, Stat, P, Pc] = pr_stat_compute(xCon, Xs, V, betas, ResidualMS);
-%
-% xCon - contrast structure
-% Xs - design matrix
-% V - covariance matrix
-% betas - parameter estimates
-% ResidualMS - root mean square of residuals
-%
-% Output
-% Num - contrast value (ess for F test)
-% Stat - statistic value
-% P - uncorrected p value
-% Pc - P value corrected for number of columns analyzed
-%--------------------------------------------------------------------
-%
-% $Id$
-
-nROI = size(betas,2);
-nCon = length(xCon);
-
-xpxm = spm_sp('xpx-',Xs);
-xpVx = Xs.X'*V*Xs.X;
-Bcov = xpxm*xpVx*xpxm;
-
-[trRV trRVRV] = spm_SpUtil('trRV',Xs,V);
-erdf = trRV^2/trRVRV;
-RMS = sqrt(ResidualMS);
-
-T_indices = [];
-F_indices = [];
-dfnum = [];
-
-Stat = zeros(nCon, nROI);
-P = zeros(nCon, nROI);
-check_Tvalue = zeros(nCon, nROI);
-
-for ii = 1:nCon
-
-% [edf_tsp edf_Xsp] = spm_FcUtil('FconEdf', xCon(ii), Xs, V);
-
- switch(xCon(ii).STAT)
- case 'T'
- %----------- to check calculation with h -----------
- h = spm_FcUtil('Hsqr', xCon(ii), Xs);
- [trMV trMVMV]= spm_SpUtil('trMV', ...
- spm_FcUtil('X1o',xCon(ii),Xs), V);
-
- check_Tvalue(ii,:) = ((h*betas)/trMV)./RMS;
- check_dfnum(ii) = trMV;
-
- %----------- t value -----------
-
- Num(ii,:) = xCon(ii).c'*betas;
- Stat(ii,:) = Num(ii,:) ./ ...
- (RMS .* sqrt((xCon(ii).c'*Bcov*xCon(ii).c)));
- P(ii,:) = 1 - spm_Tcdf(Stat(ii,:), erdf);
- T_indices = [T_indices ii];
-
-
- case 'F'
- [trMV trMVMV]= spm_SpUtil('trMV', ...
- spm_FcUtil('X1o',xCon(ii),Xs), V);
- dfnum = [dfnum trMV^2/trMVMV];
- h = spm_FcUtil('Hsqr', xCon(ii), Xs);
-
- Num(ii,:) = sum( (h*betas).^2, 1 );
- Stat(ii,:) = (Num(ii,:)/trMV) ./ (RMS.^2);
- check_Tvalue(ii,:) = Stat(ii,:) ;
- P(ii,:) = 1 - spm_Fcdf(Stat(ii,:), ...
- [dfnum(end) erdf]);
- F_indices = [F_indices ii];
-
-
- otherwise
- error(['unknown STAT "',xCon(ii).STAT,'"'])
- end
-end
-
-%- corrected P value for the number of ROI
-%--------------------------------------------------------------------
-Pc = ones(nCon, nROI) - (ones(nCon, nROI) - P).^nROI;
diff --git a/lib/marsbar-0.44/@mardo_99/private/pr_stat_compute_mv.m b/lib/marsbar-0.44/@mardo_99/private/pr_stat_compute_mv.m
deleted file mode 100644
index 8d88c88..0000000
--- a/lib/marsbar-0.44/@mardo_99/private/pr_stat_compute_mv.m
+++ /dev/null
@@ -1,128 +0,0 @@
-function [MVres]= pr_stat_compute_mv(xCon, Xs, V, betas, ResidualMS, Y)
-% compute multivariate statistics across ROIs
-% FORMAT [MVres]= pr_stat_compute_mv(xCon, Xs, V, betas, ResidualMS, Y)
-%
-% xCon - contrast structure
-% Xs - design matrix
-% V - covariance matrix
-% betas - parameter estimates
-% ResidialMS - mean sum of squares of residuals
-% Y - data natrix
-%
-% Output
-% MVres - result structure
-%
-% $Id$
-
-[nBetas nROI] = size(betas);
-nCon = length(xCon);
-[trRV trRVRV] = spm_SpUtil('trRV',Xs,V);
-erdf = trRV^2/trRVRV;
-RMS = sqrt(ResidualMS);
-%--------------------------------------------------------------------
-%- Multivariate analysis
-%--------------------------------------------------------------------
-
-MVres = struct('y_pre',[], 'y_obs', [], 'Pf', [], 'u', [], 'ds', [] );
-
-if nCon == 1, return, end
-
-YpY = Y'*Y;
-
-for ii = 1:nCon
-
- xC = xCon(ii);
-
- %--------------------------------------------------------------------
- [NF, nu, h, d, M12, XG, sXG] = sf_model_mlm(Xs, V, nROI, xC, erdf);
-
- %--------------------------------------------------------------------
- %- Compute svd
- %--------------------------------------------------------------------
- %- fprintf('%-40s\n','Computing Principal Components')
-
- Z = ((NF*betas)./(ones(size(NF,1),1)*RMS));
- S = Z*Z';
- S = S/sum(nROI);
- [u s u] = svd(S,0);
- ds = diag(s);
- clear s;
-
-
- %--------------------------------------------------------------------
- %- STATISTICS if any ...
- %--------------------------------------------------------------------
- %- Fq : F values for the last q eigein values.
- %- P : P values.for the last q eigein values.
-
- Fq = zeros(1,h);
- for q = 0:h-1;
- nu1 = d*(h-q);
- nu2 = d*nu - (d-1)*(4*(h-q)+2*nu)/(h-q+2);
- Fq(q+1) = ((nu-2)/nu) * nu2/(nu2-2)*sum(ds(q+1:h))/(h-q);
- end
- Pf = 1 - spm_Fcdf(Fq,nu1,nu2);
-
-
- %- fprintf('%-40s\n','Computing predicted and observed temporal reponse')
-%keyboard
-
- y_pre = (pinv(XG)'* M12 * u)*diag(sqrt(ds)); % predicted temporal reponse
-
- gV = (diag(1./sqrt(ds))*Z)'*u;
- y_obs = (Y./(ones(size(Y,1),1)*RMS)/nROI)*gV;
-
- %- save results for this constrast
- MVres(ii).y_pre = y_pre;
- MVres(ii).y_obs = y_obs;
- MVres(ii).Pf = Pf;
- MVres(ii).u = u;
- MVres(ii).ds = ds;
- MVres(ii).df = [nu1 nu2];
-
-end
-
-
-
-
-
-
-%===================================================================
-function [NF,nu,h,d,M12,XG,sXG] = sf_model_mlm(Xs, V, nROI, xC, erdf);
-% Set sub-space of interest and the related matrix of normalisation.
-% FORMAT [NF,nu,h,d,M12,XG] = mm_model();
-%- nu, h, d : degrees of freedom
-%- NF : matrix of normalisation
-%===================================================================
-
-
-%--------------------------------------------------------------------
-%- SET, COMPUTE,NORMALIZE SPACES OF INTEREST
-%--------------------------------------------------------------------
-%- set X10 and XG
-%- XG= X -PG(X), PG projection operator on XG (cf. eq 1, 2)
-%--------------------------------------------------------------------
-sX1o = spm_sp('set',spm_FcUtil('X1o',xC,Xs));
-sXG = spm_sp('set',spm_FcUtil('X0',xC,Xs));
-X1o = spm_sp('oP',sX1o,Xs.X);
-XG = spm_sp('r',sXG,Xs.X);
-
-%- Compute Normalized effexts : M1/2=X'G*V*XG (cf eq 3)
-%--------------------------------------------------------------------
-% warning off;
-up = spm_sp('ox',sX1o); ; %- PG=up*up'
-qi = up'*Xs.X;
-sigma = up'*V*up;
-M12 = (chol(sigma)*qi)';
-M_12 = pinv(M12);
-
-%- Compute NF : normalise factor (cf eq 4)
-%--------------------------------------------------------------------
-NF = M_12*spm_sp('X',Xs)'*spm_sp('r',sXG,spm_sp('X',Xs));
-
-%- degrees of freedom
-%- nROI : number of ROI (corresponds to the number of Resels)
-%--------------------------------------------------------------------
-d = nROI*(4*log(2)/pi)^(3/2);
-h = sX1o.rk; %-rank of the sub-space of interest.
-nu = erdf;
diff --git a/lib/marsbar-0.44/@mardo_99/save_spm.m b/lib/marsbar-0.44/@mardo_99/save_spm.m
deleted file mode 100644
index 86f8b48..0000000
--- a/lib/marsbar-0.44/@mardo_99/save_spm.m
+++ /dev/null
@@ -1,49 +0,0 @@
-function tf = save_spm(D, fname);
-% method to save design as SPM format design structure
-% FORMAT tf = save_spm(D, fname);
-%
-% Inputs
-% D - design object
-% fname - filename
-%
-% Outputs
-% tf - flag ==1 if successful
-%
-% $Id$
-
-if nargin < 2
- if is_spm_estimated(D)
- fname = 'SPM.mat';
- elseif has_images(D)
- fname = 'SPMcfg.mat';
- elseif is_fmri(D)
- fname = 'SPM_fMRIDesMtx.mat';
- else
- error('Cannot work out design type for default filename');
- end
-end
-
-% Convert vols to native format
-D = convert_vols(D, native_vol_ver(D));
-
-SPM = des_struct(D);
-if ~mars_utils('isabspath', fname)
- Swd = mars_struct('getifthere', SPM, 'swd');
- if isempty(Swd)
- error('No path passed, and none in design');
- end
- fname = fullfile(Swd, fname);
-else
- SPM.swd = fileparts(fname);
-end
-
-try
- if verbose(D)
- fprintf('Saving design to file %s\n', fname);
- end
- savestruct(SPM, fname);
- tf = 1;
-catch
- warning(lasterr);
- tf = 0;
-end
diff --git a/lib/marsbar-0.44/@mardo_99/set_images.m b/lib/marsbar-0.44/@mardo_99/set_images.m
deleted file mode 100644
index 413a4b4..0000000
--- a/lib/marsbar-0.44/@mardo_99/set_images.m
+++ /dev/null
@@ -1,11 +0,0 @@
-function marsD = set_images(marsD, VY)
-% method to set image vols into design
-%
-% $Id$
-
-if nargin < 2
- error('Need image volumes');
-end
-D = des_struct(marsD);
-D.VY = VY;
-marsD = des_struct(marsD, D);
diff --git a/lib/marsbar-0.44/@mardo_99/tr.m b/lib/marsbar-0.44/@mardo_99/tr.m
deleted file mode 100644
index 5cd3309..0000000
--- a/lib/marsbar-0.44/@mardo_99/tr.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function t = tr(o)
-% method returns TR in seconds, or empty if not available
-%
-% $Id$
-
-t = [];
-SPM = des_struct(o);
-if mars_struct('isthere', SPM, 'xX', 'RT')
- t = SPM.xX.RT;
-end
diff --git a/lib/marsbar-0.44/@mardo_99/type.m b/lib/marsbar-0.44/@mardo_99/type.m
deleted file mode 100644
index 260949b..0000000
--- a/lib/marsbar-0.44/@mardo_99/type.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function str = type(o)
-% returns SPM version string corresponding to design type
-%
-% $Id$
-
-str = 'SPM99';
diff --git a/lib/marsbar-0.44/@mardo_99/ui_build.m b/lib/marsbar-0.44/@mardo_99/ui_build.m
deleted file mode 100644
index d3c8ff6..0000000
--- a/lib/marsbar-0.44/@mardo_99/ui_build.m
+++ /dev/null
@@ -1,27 +0,0 @@
-function D = ui_build(D, dtype)
-% method to create / fill design via GUI
-% FORMAT D = ui_build(D, dtype)
-%
-% D - design object
-% dtype - one of 'PET', 'FMRI', 'Basic')
-%
-% Returns
-% D - design object with new design
-%
-% $Id$
-
-if nargin < 2
- error('Need design type');
-end
-
-switch lower(dtype)
- case 'pet'
- SPM = pr_spm_ui('cfg',spm_spm_ui('DesDefs_PET'));
- case 'basic'
- SPM = pr_spm_ui('cfg',spm_spm_ui('DesDefs_Stats'));
- case 'fmri'
- SPM = pr_fmri_design;
- otherwise
- error(['Did not recognize design type: ' dtype]);
-end
-D = des_struct(D, SPM);
diff --git a/lib/marsbar-0.44/@mardo_99/ui_get_event.m b/lib/marsbar-0.44/@mardo_99/ui_get_event.m
deleted file mode 100644
index 43c2c1e..0000000
--- a/lib/marsbar-0.44/@mardo_99/ui_get_event.m
+++ /dev/null
@@ -1,39 +0,0 @@
-function [e_spec, e_name] = ui_get_event(D)
-% method to select an event
-% FORMAT [e_spec, e_name] = ui_get_event(D)
-% D - design
-%
-% Returns
-% e_spec - 2 by 1 matrix with
-% e_epec(1) - session number
-% e_spec(2) - event number in session
-% e_name - name of event
-%
-% $Id$
-
-if ~is_fmri(D)
- error('Need FMRI design');
-end
-SPM = des_struct(D);
-Sess = SPM.Sess;
-
-% get session
-%--------------------------------------------------------------
-s = length(Sess);
-if s > 1
- s = spm_input('which session','+1','n1',1,s);
-end
-
-u = length(Sess{s}.name);
-Uname = {};
-for i = 1:u
- Uname{i} = Sess{s}.name{i};
-end
-
-% get effect
-%--------------------------------------------------------------
-str = sprintf('which effect');
-u = spm_input(str,'+1','m',Uname);
-
-e_spec = [s u]';
-e_name = Uname{u};
diff --git a/lib/marsbar-0.44/@mardo_99/ui_get_filter.m b/lib/marsbar-0.44/@mardo_99/ui_get_filter.m
deleted file mode 100644
index 530657c..0000000
--- a/lib/marsbar-0.44/@mardo_99/ui_get_filter.m
+++ /dev/null
@@ -1,27 +0,0 @@
-function [D,descrip] = ui_get_filter(D)
-% method to get filter via GUI
-% FORMAT [D,descrip] = ui_get_filter(D)
-%
-% Input
-% D - design
-%
-% Returns
-% D - design with modified filter
-% descrip - cell array of strings describing filter
-%
-% $Id$
-
-SPM = des_struct(D);
-[K Hf Lf] = pr_get_filter(SPM.xX.RT, SPM.Sess);
-SPM.xX.K = K;
-if ~isfield(SPM, 'xsDes')
- SPM.xsDes = [];
-end
-SPM.xsDes.High_pass_Filter = Lf;
-SPM.xsDes.Low_pass_Filter = Hf;
-
-% return args
-D = des_struct(D, SPM);
-
-descrip = {['High_pass_Filter:\t%s', Lf],...
- ['Low_pass_Filter: \t%s', Hf]};
diff --git a/lib/marsbar-0.44/@mardo_99/ui_report.m b/lib/marsbar-0.44/@mardo_99/ui_report.m
deleted file mode 100644
index 26c5562..0000000
--- a/lib/marsbar-0.44/@mardo_99/ui_report.m
+++ /dev/null
@@ -1,971 +0,0 @@
-function varargout = ui_report(D, varargin)
-% mathod for SPM99 design reporting
-%
-% Copied with minor edits from:
-% @(#)spm_DesRep.m 2.22 Andrew Holmes 01/03/14
-%
-% See that file for detailed commentary
-%
-% $Id$
-
-%-Format arguments
-%-----------------------------------------------------------------------
-if nargin < 2
- action = 'desrepui';
-else
- action = varargin{1};
-end
-
-%-Generic CallBack code
-%-----------------------------------------------------------------------
-cb = 'tmp = get(findobj(''Tag'', ''DesRepUI''),''UserData''); ';
-
-% simplify access to design
-SPM = des_struct(D);
-
-% Add empty fields where necessary
-try
- SPM.xC;
-catch
- SPM.xC = {};
-end
-try
- SPM.xsDes;
-catch
- SPM.xsDes = [];
-end
-
-switch lower(action)
-
-%=======================================================================
-case 'desrepui' %-Design reporting UI
-%=======================================================================
-% h = spm_DesRep('DesRepUI')
-% h = spm_DesRep('DesRepUI',D)
-
-%-Table of variable availability
-%-----------------------------------------------------------------------
-% SPM_fMRIDesMtx.mat SPMcfg.mat SPM.mat
-% .xX v/ v/ v/
-% .VY x v/ v/
-% .xM x v/ v/
-% .F_iX0 x v/ v/
-% .xC x / [] v/(p) v/(p)
-% .Sess v/ v/(f) v/(f)
-% .xsDes x v/ v/
-%
-% .SPMid
-%
-% .cfg
-
-%-Add a scaled design matrix to the design data structure
-%-----------------------------------------------------------------------
-if ~isfield(SPM.xX,'nKX'), SPM.xX.nKX = spm_DesMtx('Sca',SPM.xX.X,SPM.xX.Xnames); end
-
-% put back into design object
-D = des_struct(D, SPM);
-
-%-Draw menu
-%=======================================================================
-
-%-Get Interactive window and delete any previous DesRepUI menu
-%-----------------------------------------------------------------------
-Finter = spm_figure('GetWin','Interactive');
-delete(findobj(get(Finter,'Children'),'flat','Tag','DesRepUI'))
-
-%-Draw top level menu
-%-----------------------------------------------------------------------
-hC = uimenu(Finter,'Label','Design',...
- 'Separator','on',...
- 'Tag','DesRepUI',...
- 'UserData',D,...
- 'HandleVisibility','on');
-
-%-DesMtx (SPM & SPMcfg)
-%-----------------------------------------------------------------------
-hDesMtx = uimenu(hC,'Label','Design Matrix','Accelerator','D',...
- 'CallBack',[cb,...
- 'ui_report(tmp, ''DesMtx'')'],...
- 'UserData',hC,...
- 'HandleVisibility','off');
-
-%-Design matrix orthogonality
-%-----------------------------------------------------------------------
-h = uimenu(hC,'Label','Design orthogonality','Accelerator','O',...
- 'CallBack',[cb,...
- 'ui_report(tmp, ''DesOrth'')'],...
- 'UserData',hC,...
- 'HandleVisibility','off');
-
-%-Explore design
-%-----------------------------------------------------------------------
-hExplore = uimenu(hC,'Label','Explore','HandleVisibility','off');
-
-switch modality(D)
-case 'pet'
- hFnF = uimenu(hExplore,'Label','Files and factors','Accelerator','F',...
- 'CallBack',[cb,...
- 'ui_report(tmp, ''Files&Factors'')'],...
- 'UserData',hC,...
- 'HandleVisibility','off');
- hCovs = uimenu(hExplore,'Label','Covariates','Accelerator','C',...
- 'CallBack',[cb,...
- 'ui_report(tmp, ''Covs'')'],...
- 'UserData',hC,...
- 'HandleVisibility','off');
- if isempty(SPM.xC), set(hCovs,'Enable','off'), end
-case 'fmri'
- for j = 1:length(SPM.Sess)
- h = uimenu(hExplore,'Label',sprintf('Session %.0f ',j),...
- 'HandleVisibility','off');
- for k = 1:length(SPM.Sess{j}.name)
- uimenu(h,'Label',SPM.Sess{j}.name{k},...
- 'CallBack',[cb,...
- sprintf('ui_report_fmri(tmp,%d,%d);',j,k)],...
- 'UserData',hC,...
- 'HandleVisibility','off')
- end
- end
-end
-
-
-%-Clear, Quit, Help
-%-----------------------------------------------------------------------
-uimenu(hC,'Label','Clear','Accelerator','L','Separator','on',...
- 'CallBack','spm_results_ui(''Clear'')',...
- 'HandleVisibility','off');
-uimenu(hC,'Label','Help','Separator','on',...
- 'CallBack','spm_help(''spm_DesRep'')',...
- 'HandleVisibility','off');
-
-%-Pop open 'Interactive' window
-%-----------------------------------------------------------------------
-figure(Finter)
-
-%-Return handle of menu
-%-----------------------------------------------------------------------
-varargout = {hC};
-
-
-%=======================================================================
-case 'files&factors' %-Summarise files & factors
-%=======================================================================
-% ui_report(D, 'Files&Factors',fnames,I,xC,sF,xs)
-
-fnames = image_names(D);
-I = SPM.xX.I;
-xC = SPM.xC;
-sF = SPM.xX.sF;
-xs = SPM.xsDes; %-Structure of description strings
-
-if isempty(fnames)
- fnames = cell(size(SPM.xX.X, 1), 1);
-else
- [fnames,CPath] = spm_str_manip(fnames,'c'); %-extract common path
-end
-nScan = size(I,1); %-#images
-nVar = size(fnames,2); %-Variates
-bL = any(diff(I,1),1); %-Multiple factor levels?
-
-%-Get graphics window & window scaling
-Fgraph = spm_figure('GetWin','Graphics');
-spm_results_ui('Clear',Fgraph,0)
-FS = spm('FontSizes');
-
-%-Display header information
-%-----------------------------------------------------------------------
-hTax = axes('Position',[0.03,0.85,0.94,0.1],...
- 'DefaultTextFontSize',FS(9),...
- 'XLim',[0,1],'YLim',[0,1],...
- 'Visible','off');
-
-text(0.5,1,'Statistical analysis: Image files & covariates...',...
- 'Fontsize',FS(14),'Fontweight','Bold',...
- 'HorizontalAlignment','center')
-
-dx1 = 0.05;
-dx2 = 0.08;
-
-x = 0; text(x+.02,.1,'image #','Rotation',90)
-if bL(4), x=x+dx1; text(x+.01,.1,sF{4},'Rotation',90), end
-if bL(3), x=x+dx1; text(x+.01,.1,sF{3},'Rotation',90), end
-if bL(2), x=x+dx1; text(x+.01,.1,sF{2},'Rotation',90), end
-if bL(1), x=x+dx1; text(x+.01,.1,sF{1},'Rotation',90), end
-
-for j = 1:length(xC)
- n = size(xC(j).rc,2);
- if n>1, tmp=xC(j).cname; else, tmp={xC(j).rcname}; end
- for k=1:n
- x=x+dx2;
- text(x,.1,tmp{k},'Rotation',90,'Interpreter','TeX')
- end
-end
-
-x=x+dx2;
-text(x,0.65,'Base directory:','FontWeight','Bold')
-text(x,0.5,CPath,'FontSize',FS(8))
-text(x,0.2,'filename tails...')
-
-line('XData',[0 1],'YData',[0 0],'LineWidth',3,'Color','r')
-
-%-Tabulate file & covariate information
-%-----------------------------------------------------------------------
-hAx = axes('Position',[0.03,0.05,0.94,0.8],...
- 'DefaultTextFontSize',FS(8),...
- 'Units','points',...
- 'Visible','off');
-AxPos = get(hAx,'Position'); set(hAx,'YLim',[0,AxPos(4)])
-
-dy = FS(9); y0 = floor(AxPos(4)) -dy; y = y0;
-
-for i = 1:nScan
-
- %-Scan indices
- x = 0; text(x,y,sprintf('%03d',i))
- if bL(4), x=x+dx1; text(x,y,sprintf('%02d',I(i,4))), end
- if bL(3), x=x+dx1; text(x,y,sprintf('%02d',I(i,3))), end
- if bL(2), x=x+dx1; text(x,y,sprintf('%02d',I(i,2))), end
- if bL(1), x=x+dx1; text(x,y,sprintf('%02d',I(i,1))), end
-
- %-Covariates
- for j = 1:length(xC)
- for k=1:size(xC(j).rc,2)
- x=x+dx2;
- text(x,y,sprintf('%6g',xC(j).rc(i,k)),...
- 'HorizontalAlignment','Center')
- end
- end
-
- %-Filename tail(s) - could be multivariate
- x=x+dx2;
- for j = 1:nVar
- text(x,y,fnames{i,j})
- y=y-dy;
- end
-
- %-Paginate if necessary
- if y1
- text(0.5,0,sprintf('Page %d/%d',spm_figure('#page')*[1,1]),...
- 'FontSize',FS(8),'FontAngle','italic')
- spm_figure('NewPage',[hAx;get(hAx,'Children')])
-end
-
-%-Pop up the Graphics window
-%-----------------------------------------------------------------------
-figure(Fgraph)
-
-
-
-%=======================================================================
-case {'desmtx','desorth'} %-Display design matrix / design orthogonality
-%=======================================================================
-% ui_report(D, 'DesMtx',xX,fnames,xs)
-% ui_report(D, 'DesOrth',xX,fnames)
-
-xX = SPM.xX;
-fnames = image_names(D);
-
-xs = SPM.xsDes; %-Structure of description strings
-
-desmtx = strcmp(lower(varargin{1}),'desmtx');
-
-
-%-Locate DesMtx (X), scaled DesMtx (nX) & get parameter names (Xnames)
-%-----------------------------------------------------------------------
-if isfield(xX,'xKXs') & ...
- ~isempty(xX.xKXs) & isstruct(xX.xKXs)
- iX = 1;
- [nScan,nPar] = size(xX.xKXs.X);
-elseif isfield(xX,'X') & ~isempty(xX.X)
- iX = 0;
- [nScan,nPar] = size(xX.X);
-else
- error('Can''t find DesMtx in this structure!')
-end
-
-if isfield(xX,'nKX') & ~isempty(xX.nKX)
- inX = 1; else, inX = 0; end
-
-if isfield(xX,'Xnames') & ~isempty(xX.Xnames)
- Xnames = xX.Xnames; else, Xnames = {}; end
-
-
-%-Compute design orthogonality matrix if DesOrth
-%-----------------------------------------------------------------------
-if ~desmtx
- if iX
- tmp = sqrt(sum(xX.xKXs.X.^2));
- O = xX.xKXs.X'*xX.xKXs.X./kron(tmp',tmp);
- tmp = sum(xX.xKXs.X);
- else
- tmp = sqrt(sum(xX.X.^2));
- O = xX.X'*xX.X./kron(tmp',tmp);
- tmp = sum(xX.X);
- end
- tmp = abs(tmp)1
- ColorOrder = get(hAx,'ColorOrder');
- text(0.3,y,'Key :',...
- 'HorizontalAlignment','Right',...
- 'FontWeight','Bold','FontSize',FS(9))
- for j = 1:size(xC(i).rc,2)
- color = ColorOrder(mod(j-1,size(ColorOrder,1))+1,:);
- if size(xC(i).rc,2)==length(xC(i).cname)
- str = xC(i).cname{j};
- else
- str = sprintf('column %d',j);
- end
- text(0.31,y,str,'FontSize',FS(9),...
- 'Color',color)
- text(0.5,xC(i).rc(1,j),[str,' \rightarrow'],...
- 'Parent',hAx,...
- 'FontSize',FS(8),'FontWeight','Bold',...
- 'HorizontalAlignment','Right',...
- 'Interpreter','TeX',...
- 'Color',color)
- y=y-dy;
- end
- y=y-dy;
- end
-
-
- %-Associated parameters
- %---------------------------------------------------------------
- text(0.3,y,'Design matrix columns :',...
- 'HorizontalAlignment','Right',...
- 'FontWeight','Bold','FontSize',FS(9))
- if isempty(xC(i).cols)
- text(0.31,y,'(none)','FontSize',FS(9))
- else
- for j = xC(i).cols
- text(0.31,y,sprintf('%d : %s',j,Xnames{j}),...
- 'FontSize',FS(9),'Interpreter','TeX')
- y=y-dy;
- end
- end
- y=y-dy;
-
-
- %-Highlight parameter names
- %---------------------------------------------------------------
- hCurPNames = hPNames(xC(i).cols);
- set(hCurPNames,'Color','r','FontWeight','Bold','FontSize',FS(8))
-
-
- %-Paginate (if more than one covariate)
- %---------------------------------------------------------------
- if length(xC)>1
- spm_figure('NewPage',[hSTitle; hAx; get(hAx,'Children');...
- hCurPNames; hDAx; get(hDAx,'Children')]);
- end
-
-end
-
-%-Pop up the Graphics window
-%-----------------------------------------------------------------------
-figure(Fgraph)
-
-
-%=======================================================================
-case 'scantick'
-%=======================================================================
-% ui_report(D, 'ScanTick',nScan,lim)
-% ( Show at most 32, showing every 2nd/3rd/4th/... as necessary to pair )
-% ( down to <32 items. Always show last item so #images is indicated. )
-if nargin<4, lim=32; else, lim=varargin{3}; end
-if nargin<3, error('insufficient arguments'), end
-nScan = varargin{2};
-
-p = max(1,ceil(nScan/lim));
-s = 1:p:nScan; s(end)=nScan;
-
-varargout = {s,lim};
-
-
-%=======================================================================
-case {'surfdesmtx_cb','surfdesmtxmo_cb','surfdesmtxup_cb'} %-Surf DesMtx
-%=======================================================================
-% ui_report(D, 'SurfDesMtx_CB')
-% ui_report(D, 'SurfDesMtxMo_CB')
-% ui_report(D, 'SurfDesMtxUp_CB')
-
-h = get(gca,'Xlabel');
-
-if strcmp(lower(varargin{1}),'surfdesmtxup_cb')
- UD = get(h,'UserData');
- set(h,'String',UD.String,'Interpreter',UD.Interpreter,...
- 'UserData',UD.UserData)
- set(gcbf,'WindowButtonMotionFcn','','WindowButtonUpFcn','')
- return
-end
-
-
-if strcmp(lower(varargin{1}),'surfdesmtx_cb')
- UD = struct( 'String', get(h,'String'),...
- 'Interpreter', get(h,'Interpreter'),...
- 'UserData', get(h,'UserData'));
- set(h,'UserData',UD)
- set(gcbf,'WindowButtonMotionFcn',[cb 'ui_report(tmp, ''SurfDesMtxMo_CB'')'],...
- 'WindowButtonUpFcn', [cb 'ui_report(tmp, ''SurfDesMtxUp_CB'')'])
-end
-
-mm = [get(gca,'YLim')',get(gca,'XLim')']+[.5,.5;-.5,-.5];
-ij = get(gca,'CurrentPoint');
-ij = round(min(max(ij(1,[2,1]),mm(1,:)),mm(2,:)));
-
-istr = 'none';
-switch get(gcbf,'SelectionType')
-case 'normal'
- try, str = sprintf('X(%d,%d) = %g',ij(1),ij(2),...
- subsref(get(gco,'UserData'),...
- struct('type',{'.','()'},'subs',{'X',{ij(1),ij(2)}})));
- catch, str='(no cached design matrix to surf)'; end
-case 'extend'
- try, str = sprintf('Image %d: %s',ij(1),...
- spm_str_manip(...
- subsref(get(gco,'UserData'),...
- struct('type',{'.','()'},...
- 'subs',{'fnames',{ij(1),':'}})),'Ca40'));
- catch, str='(no cached image filenames to surf)'; end
-case 'alt'
- try, str = sprintf('Parameter %d: %s',ij(2),...
- subsref(get(gco,'UserData'),...
- struct('type',{'.','{}'},'subs',{'Xnames',{ij(2)}})));
- istr = 'tex';
- catch, str='(no cached parameter names to surf)'; end
-case 'open'
- try, assignin('base','ans',subsref(get(gco,'UserData'),...
- struct('type',{'.'},'subs',{'X'})))
- evalin('base','ans')
- catch, fprintf('%s GUI: can''t find design matrix\n',mfilename)
- end
- return
-end
-
-set(h,'String',str,'Interpreter',istr)
-
-
-%=======================================================================
-case {'surfestim_cb','surfestimmo_cb','surfestimup_cb'} %-Surf ParEstIm
-%=======================================================================
-% ui_report(D, 'SurfEstIm_CB')
-% ui_report(D, 'SurfEstImMo_CB')
-% ui_report(D, 'SurfEstImUp_CB')
-
-h = get(gca,'Xlabel');
-
-if strcmp(lower(varargin{1}),'surfestimup_cb')
- UD = get(h,'UserData');
- set(h,'String',UD.String,'Interpreter',UD.Interpreter,...
- 'UserData',UD.UserData)
- set(gcbf,'WindowButtonMotionFcn','','WindowButtonUpFcn','')
- return
-end
-
-if strcmp(lower(varargin{1}),'surfestim_cb')
- UD = struct( 'String', get(h,'String'),...
- 'Interpreter', get(h,'Interpreter'),...
- 'UserData', get(h,'UserData'));
- set(h,'UserData',UD)
- set(gcbf,'WindowButtonMotionFcn',[cb 'ui_report(tmp, ''SurfEstImMo_CB'')'],...
- 'WindowButtonUpFcn', [cb 'ui_report(tmp, ''SurfEstImUp_CB'')'])
-end
-
-mm = [get(gca,'XLim')]+[.5,-.5];
-i = get(gca,'CurrentPoint');
-i = round(min(max(i(1,1),mm(1)),mm(2)));
-
-istr = 'none';
-switch get(gcbf,'SelectionType')
-case 'normal'
- try, tmp = {' (not unique)',' (unique)'};
- str = sprintf('Parameter %d : %s%s',...
- i,...
- subsref(get(gco,'UserData'),...
- struct('type',{'.','{}'},'subs',{'Xnames',{i}})),...
- tmp{subsref(get(gco,'UserData'),...
- struct('type',{'.','()'},'subs',{'est',{i}}))+1});
- istr = 'tex';
- catch, str='(no cached data to surf)'; end
-case {'extend','alt'}
- return
-case 'open'
- try, UD = get(gco,'UserData');
- assignin('base','ans',...
- subsref(get(gco,'UserData'),...
- struct('type',{'.'},'subs',{'est'})))
- evalin('base','ans')
- catch, fprintf('%s GUI: can''t find design orthogonality\n',mfilename)
- end
- return
-end
-
-set(h,'String',str,'Interpreter',istr)
-
-
-
-%=======================================================================
-case {'surfdeso_cb','surfdesomo_cb','surfdesoup_cb'} %-Surf DesOrthIm
-%=======================================================================
-% ui_report(D, 'SurfDesO_CB')
-% ui_report(D, 'SurfDesOMo_CB')
-% ui_report(D, 'SurfDesOUp_CB')
-
-h = get(gca,'Xlabel');
-
-if strcmp(lower(varargin{1}),'surfdesoup_cb')
- UD = get(h,'UserData');
- set(h,'String',UD.String,'Interpreter',UD.Interpreter,...
- 'UserData',UD.UserData)
- set(gcbf,'WindowButtonMotionFcn','','WindowButtonUpFcn','')
- return
-end
-
-if strcmp(lower(varargin{1}),'surfdeso_cb')
- UD = struct( 'String', get(h,'String'),...
- 'Interpreter', get(h,'Interpreter'),...
- 'UserData', get(h,'UserData'));
- set(h,'UserData',UD)
- set(gcbf,'WindowButtonMotionFcn',[cb 'ui_report(tmp, ''SurfDesOMo_CB'')'],...
- 'WindowButtonUpFcn', [cb 'ui_report(tmp, ''SurfDesOUp_CB'')'])
-end
-
-mm = [get(gca,'YLim')',get(gca,'XLim')']+[.5,.5;-.5,-.5];
-ij = get(gca,'CurrentPoint');
-ij = round(min(max(ij(1,[2,1]),mm(1,:)),mm(2,:)));
-if ij(1)>ij(2), return, end
-
-istr = 'none';
-switch get(gcbf,'SelectionType')
-case 'normal'
- try
- UD = get(gco,'UserData');
- if abs(abs(UD.O(ij(1),ij(2)))-1) < eps*1e1
- str = '{\bf colinear}';
- elseif abs(UD.O(ij(1),ij(2))) < eps*1e1
- str = '{\bf orthogonal}';
- else
- str = '{\bf not orthogonal}';
- end
- if ~diff(ij), str=[str,' {\it(same column)}']; end
- if UD.bC(ij(1),ij(2)), tmp=' ={\it r}'; else, tmp=''; end
- str = { sprintf('{\\bf %s} (col %d) & {\\bf %s} (col %d)',...
- UD.Xnames{ij(1)},ij(1),...
- UD.Xnames{ij(2)},ij(2)),...
- sprintf('cos(\\theta)%s = %1.2f',...
- tmp,UD.O(ij(1),ij(2))),...
- ['\rightarrow ',str]};
- istr = 'tex';
- catch, str='(no cached data to surf)'; end
-case {'extend','alt'}
- return
-case 'open'
- try, UD = get(gco,'UserData');
- assignin('base','ans',UD.O)
- evalin('base','ans')
- catch, fprintf('%s GUI: can''t find design orthogonality\n',mfilename)
- end
- return
-end
-
-set(h,'String',str,'Interpreter',istr)
-
-
-%=======================================================================
-case {'surfcon_cb','surfconmo_cb','surfconup_cb'} %-Surf Contrast
-%=======================================================================
-% ui_report(D, 'SurfCon_CB')
-% ui_report(D, 'SurfConOMo_CB')
-% ui_report(D, 'SurfConOUp_CB')
-
-cUD = get(gco,'UserData');
-if ~isstruct(cUD) | ~isfield(cUD,'h')
- warning('contrast GUI objects setup incorrectly'), return
-end
-h = cUD.h;
-
-if strcmp(lower(varargin{1}),'surfconup_cb')
- UD = get(h,'UserData');
- set(h,'String',UD.String,'Interpreter',UD.Interpreter,...
- 'UserData',UD.UserData)
- set(gcbf,'WindowButtonMotionFcn','','WindowButtonUpFcn','')
- return
-end
-
-if strcmp(lower(varargin{1}),'surfcon_cb')
- UD = struct( 'String', get(h,'String'),...
- 'Interpreter', get(h,'Interpreter'),...
- 'UserData', get(h,'UserData'));
- set(h,'UserData',UD)
- set(gcbf,'WindowButtonMotionFcn',[cb 'ui_report(tmp, ''SurfConMo_CB'')'],...
- 'WindowButtonUpFcn', [cb 'ui_report(tmp, ''SurfConUp_CB'')'])
-end
-
-mm = [get(gca,'YLim')',get(gca,'XLim')']+[.5,.5;-.5,-.5];
-ij = get(gca,'CurrentPoint');
-ij = round(min(max(ij(1,[2,1]),mm(1,:)),mm(2,:)));
-
-istr = 'none';
-switch get(gcbf,'SelectionType')
-case 'normal'
- try
- if cUD.i>0, str = sprintf('%d',cUD.i); else, str = ''; end
- switch get(gco,'Type')
- case 'image'
- str = sprintf('%s\\{F\\}: {\\bf%s} (%d,%d) = %.2f',...
- str,cUD.xCon.name,ij(2),ij(1),...
- cUD.xCon.c(ij(2),ij(1)));
- case 'patch'
- str = sprintf('%s\\{T\\}: {\\bf%s} (%d) = %.2f',...
- str,cUD.xCon.name,ij(2),...
- cUD.xCon.c(ij(2)));
- otherwise, error('unexpected object type')
- end
- istr = 'TeX';
- catch, str='(no cached data to surf)'; end
-case {'alt','extend'}
- return
-case 'open'
- try, assignin('base','ans',cUD.xCon.c')
- evalin('base','ans')
- catch, fprintf('%s GUI: can''t find contrast\n',mfilename)
- end
- return
-end
-
-set(h,'String',str,'Interpreter',istr)
-
-
-%=======================================================================
-otherwise %-Unknown action string
-%=======================================================================
-error(['Unknown action string: ',varargin{1}])
-
-
-
-%=======================================================================
-end
diff --git a/lib/marsbar-0.44/@mardo_99/ui_report_fmri.m b/lib/marsbar-0.44/@mardo_99/ui_report_fmri.m
deleted file mode 100644
index 2d27138..0000000
--- a/lib/marsbar-0.44/@mardo_99/ui_report_fmri.m
+++ /dev/null
@@ -1,184 +0,0 @@
-function ui_report_fmri(D,s,i)
-% Interactive review of fMRI design matrix
-% FORMAT ui_report_fmri(D,s,i)
-%
-% Copied with minor edits from:
-% @(#)spm_fMRI_design_show.m 2.17 2.16 Karl Friston 99/09/20
-% see that file for comments
-%
-% $Id$
-
-SPM = des_struct(D);
-xX = SPM.xX;
-Sess = SPM.Sess;
-
-%-Generic CallBack code
-%-----------------------------------------------------------------------
-cb = 'tmp = get(findobj(''Tag'', ''DesRepUI''),''UserData''); ';
-
-% Do not proceed unless there are trials specified
-%-----------------------------------------------------------------------
-for j = 1:length(Sess)
- if ~length(Sess{j}.name)
- spm('alert*','User-specifed regressors only!',mfilename,sqrt(-1));
- return
- end
-end
-
-
-%-Defaults: Setup GUI
-%-----------------------------------------------------------------------
-if nargin < 3
- s = 1;
- i = 1;
-
- %-Get Interactive window and delete any previous DesRepUI menu
- %---------------------------------------------------------------
- Finter = spm_figure('GetWin','Interactive');
- delete(findobj(get(Finter,'Children'),'flat','Tag','DesRepUI'))
-
- %-Add a scaled design matrix to the design data structure
- %---------------------------------------------------------------
- if ~isfield(xX,'nKX'), xX.nKX = spm_DesMtx('Sca',xX.X,xX.Xnames); end
-
- %-Draw menu
- %---------------------------------------------------------------
- hC = uimenu(Finter,'Label','Explore fMRI design',...
- 'Separator','on',...
- 'Tag','DesRepUI',...
- 'UserData',D,...
- 'HandleVisibility','on');
- for j = 1:length(Sess)
- h = uimenu(hC,'Label',sprintf('Session %.0f ',j),...
- 'HandleVisibility','off');
- for k = 1:length(Sess{j}.name)
- cb = ['tmp = get(get(gcbo,''UserData''),',...
- '''UserData''); ',...
- sprintf(['ui_report_fmri(',...
- 'tmp,%d,%d);'],j,k)];
- uimenu(h,'Label',Sess{j}.name{k},...
- 'CallBack',cb,...
- 'UserData',hC,...
- 'HandleVisibility','off')
- end
- end
-end
-
-
-%-Graphics...
-%=======================================================================
-
-%-Get Graphics window
-%-----------------------------------------------------------------------
-Fgraph = spm_figure('GetWin','Graphics');
-spm_results_ui('Clear',Fgraph,0)
-
-
-% Display design matrix X
-%-----------------------------------------------------------------------
-axes('Position',[0.125,0.700,0.155,0.225])
-if isfield(xX,'nKX')
- hDesMtxIm = image(xX.nKX*32+32);
-else
- hDesMtxIm = imagesc(spm_en(xX.X));
-end
-xlabel('effect')
-ylabel('scan')
-title('Design Matrix','FontSize',16)
-
-%-Setup callbacks to allow interrogation of design matrix
-%-----------------------------------------------------------------------
-set(hDesMtxIm,'UserData',struct('X',xX.X,'Xnames',{xX.Xnames}))
-set(hDesMtxIm,'ButtonDownFcn',[cb 'ui_report(tmp, ''SurfDesMtx_CB'')'])
-
-
-
-% Session subpartition
-%-----------------------------------------------------------------------
-axes('Position',[0.550,0.700,0.155,0.225])
-sX = xX.X(Sess{s}.row,Sess{s}.col);
-imagesc(spm_en(sX)')
-set(gca,'YTick',[1:size(sX,1)])
-set(gca,'YTickLabel',xX.Xnames(Sess{s}.col)')
-title({sprintf('Session %d',s) Sess{s}.DSstr})
-
-% Collinearity
-%-----------------------------------------------------------------------
-tmp = sqrt(sum(sX.^2));
-O = sX'*sX./kron(tmp',tmp);
-tmp = abs(sum(sX))= i
-
- % Basis set and peristimulus sampling
- %---------------------------------------------------------------
- axes('Position',[0.125,0.110,0.325,0.225])
- t = [1:size(Sess{s}.bf{i},1)]*xX.dt;
- pst = Sess{s}.pst{i};
- plot(t,Sess{s}.bf{i},pst,0*pst,'.','MarkerSize',16)
- str = sprintf('TR = %0.0fsecs',xX.RT);
- xlabel({'time (secs)' str sprintf('%0.0fms time bins',1000*xX.dt)})
- title({'Basis set and peristimulus sampling' Sess{s}.BFstr})
- axis tight
- grid on
-
- % if a paramteric variate is specified
- %---------------------------------------------------------------
- if length(Sess{s}.Pv{i})
-
- % onsets and parametric modulation
- %-------------------------------------------------------
- axes('Position',[0.580,0.110,0.325,0.225])
- plot(Sess{s}.ons{i},Sess{s}.Pv{i},'.','MarkerSize',8)
- title({'trial specific parameters' Sess{s}.Pname{i}})
- xlabel('time (secs}')
- ylabel(Sess{s}.Pname{i})
- grid on
- end
-end
-
-%-Pop up Graphics figure window
-%-----------------------------------------------------------------------
-figure(Fgraph);
diff --git a/lib/marsbar-0.44/@marmoire/add_if_absent.m b/lib/marsbar-0.44/@marmoire/add_if_absent.m
deleted file mode 100644
index f78704d..0000000
--- a/lib/marsbar-0.44/@marmoire/add_if_absent.m
+++ /dev/null
@@ -1,14 +0,0 @@
-function o = add_if_absent(o, item, data)
-% Adds item only if not already present
-%
-% $Id$
-
-if nargin < 2
- error('Need name of item to add');
-end
-if nargin < 3
- error('Need data to put into item');
-end
-if ~item_exists(o, item)
- o = add_item(o, item, data);
-end
diff --git a/lib/marsbar-0.44/@marmoire/add_item.m b/lib/marsbar-0.44/@marmoire/add_item.m
deleted file mode 100644
index 67bbdb9..0000000
--- a/lib/marsbar-0.44/@marmoire/add_item.m
+++ /dev/null
@@ -1,27 +0,0 @@
-function o = add_item(o, item_name, item_contents)
-% add item to armoire
-% FORMAT o = add_item(o, item, I)
-%
-% o - object
-% item_name - item name
-% item_contents = item ... contents
-%
-% $Id $
-
-if nargin < 2
- error('Need item name to add');
-end
-if nargin < 3
- item_contents = [];
-end
-I = default_item(o);
-if isempty(item_contents)
- item_contents = I;
-else
- def_fns = fieldnames(I);
- new_fns = def_fns(~ismember(def_fns, fieldnames(item_contents)));
- for fn = new_fns'
- item_contents = setfield(item_contents, fn{1}, getfield(I, fn{1}));
- end
-end
-o = set_item_struct(o, item_name, item_contents);
diff --git a/lib/marsbar-0.44/@marmoire/clear_item_data.m b/lib/marsbar-0.44/@marmoire/clear_item_data.m
deleted file mode 100644
index d16f253..0000000
--- a/lib/marsbar-0.44/@marmoire/clear_item_data.m
+++ /dev/null
@@ -1,18 +0,0 @@
-function [o, errf] = clear_item_data(o, item)
-% sets data for item to empty
-% FORMAT [o errf] = clear_item_data(o, item);
-%
-% o - object
-% item - name of item to clear data for
-%
-% Returns
-% o - object with data cleared for this item
-% errf - flag is 1 if data was not cleared for some reason
-%
-% $Id$
-
-if nargin < 2
- error('Need item to clear data');
-end
-
-[o errf] = do_set(o, item, 'clear', [], '');
diff --git a/lib/marsbar-0.44/@marmoire/default_item.m b/lib/marsbar-0.44/@marmoire/default_item.m
deleted file mode 100644
index 6bb2f35..0000000
--- a/lib/marsbar-0.44/@marmoire/default_item.m
+++ /dev/null
@@ -1,19 +0,0 @@
-function I = default_item(o)
-% returns default item
-%
-% $Id$
-
-I = struct('data', [],...
- 'file_name', '',...
- 'default_file_name','',...
- 'has_changed', 0,...
- 'leave_as_file', 0,...
- 'save_if_changed', 1,...
- 'file_type', 'mat',...
- 'char_is_filename',1,...
- 'set_action_if_update', 0 ,...
- 'set_action_if_clear', 0 ,...
- 'verbose', 1,...
- 'title', 'file',...
- 'filter_spec', '',...
- 'set_action', '');
diff --git a/lib/marsbar-0.44/@marmoire/do_save.m b/lib/marsbar-0.44/@marmoire/do_save.m
deleted file mode 100644
index 0408690..0000000
--- a/lib/marsbar-0.44/@marmoire/do_save.m
+++ /dev/null
@@ -1,93 +0,0 @@
-function [res, o] = do_save(o, item, flags, filename)
-% method to save data for item
-% FORMAT [res, o] = do_save(o, item, flags, filename)
-%
-% o - object
-% item - item name
-% flags - flags for save (see save_item_data.m for details)
-% filename - (maybe) filename for save
-%
-% Returns
-% saved_f - flag set to 1 if save done, 0 not done, -1 if cancel
-% o - possibly modified object
-%
-% The function is written like this so that, in the future, we can use
-% callbacks in this code to manipulate all the objects in the armoire
-%
-% $Id$
-
-if nargin < 2
- error('Need item');
-end
-if nargin < 3
- flags = NaN;
-end
-if nargin < 4
- filename = NaN;
-end
-
-% Get item
-item_struct = get_item_struct(o, item);
-
-% process flags
-if ~isstruct(flags), flags = []; end
-if pr_is_nix(filename), filename = item_struct.file_name; end
-if pr_is_nix(filename), filename = item_struct.default_file_name; end
-
-if pr_needs_save(item_struct) || isfield(flags, 'force') % force flag
- % prompt for filename if UI
- if isfield(flags, 'ui')
- % warn if empty, and warn_empty flag (we must be forcing to get here)
- if pr_isempty(item_struct)
- if isfield(flags, 'warn_empty')
- msgbox('Nothing to save', ...
- [item_struct.title ' is not set'], 'warn');
- end
- res = 0;
- return
- end
- % Work out prompt
- if isfield(flags, 'prompt')
- prompt = flags.prompt;
- else
- prompt = item_struct.title;
- end
- if isfield(flags, 'prompt_prefix')
- prompt = [flags.prompt_prefix prompt];
- end
- if isfield(flags, 'prompt_suffix')
- prompt = [prompt flags.prompt_suffix];
- end
- if isfield(flags, 'ync')
- save_yn = questdlg(['Save ' prompt '?'],...
- 'Save', 'Yes', 'No', 'Cancel', 'Yes');
- if strcmp(save_yn, 'Cancel'), res = -1; return, end
- if strcmp(save_yn, 'No')
- if isfield(flags, 'no_no_save')
- o = set_item_param(o, item, 'has_changed', 0);
- end
- res = 0;
- return
- end
- end
- pr = ['Filename to save ' prompt];
- [f p] = mars_uifile('put', item_struct.filter_spec, pr, filename);
- if all(f==0), res = -1; return, end
- filename = fullfile(p, f);
- end
- savestruct(item_struct.data, filename);
- if item_struct.verbose
- fprintf('%s saved to %s\n', item_struct.title, filename);
- end
- item_struct.file_name = filename;
- item_struct.has_changed = 0;
- if item_struct.leave_as_file
- % maintain only on file, as it has beed saved
- item_struct.data = [];
- end
- o = set_item_struct(o, item, item_struct);
- res = 1;
-else
- res = 0;
-end
-return
diff --git a/lib/marsbar-0.44/@marmoire/do_set.m b/lib/marsbar-0.44/@marmoire/do_set.m
deleted file mode 100644
index a3d31b5..0000000
--- a/lib/marsbar-0.44/@marmoire/do_set.m
+++ /dev/null
@@ -1,145 +0,0 @@
-function [o, errf] = do_set(o, item, flags, data, filename)
-% private function to set data into item
-% FORMAT [o, errf] = do_set(o, item, flags, data, filename)
-%
-% o - object
-% item - name of item to set to
-% flags - containing fields:
-% action: one of: 'set' 'set_ui' 'get' 'clear' 'update'
-% data - the data to set into this item
-% filename - (possibly) filename for these data
-%
-% Returns
-% o - returned object, probably modified
-% errf - flag set to 1 if error, meaning object was not modified
-%
-% The flags argument at the moment is a bit redundant, as it only
-% contains one field, but allows for future expansion, and is more
-% compatible with the do_save method.
-%
-% $Id$
-
-if nargin < 2
- error('Need item');
-end
-if nargin < 3
- error('Need calling flags');
-end
-if nargin < 4
- data = NaN;
-end
-if nargin < 5
- filename = NaN;
-end
-
-% Errf for return
-errf = 0;
-
-% process flags
-if ischar(flags) % can be string, with action
- if ~isempty(flags)
- flags = struct('action', flags);
- end
-end
-if ~isstruct(flags), flags = []; end
-if ~isfield(flags, 'action'), flags.action = 'set'; end
-action = flags.action;
-
-% get item to work on
-item_struct = get_item_struct(o, item);
-
-% get filename for data if set_ui
-if strcmp(action, 'set_ui')
- [fn pn] = mars_uifile('get', ...
- item_struct.filter_spec, ...
- ['Select ' item_struct.title '...']);
- if isequal(fn,0) | isequal(pn,0), errf = 1;, return, end
- filename = fullfile(pn, fn);
- data = [];
-end
-
-% Keep copy of passed filename for set_action call
-passed_filename = filename;
-
-% optionally, treat char data as filename
-% but passed filename overrides char data
-if item_struct.char_is_filename & ischar(data)
- if ~pr_is_nix(filename)
- warning(sprintf(...
- 'Passed filename %s overrides data filename %s\n',...
- filename, data));
- else
- filename = data;
- end
- data = [];
-end
-
-if pr_is_nix(filename) % may need to save if no associated filename
- item_struct.has_changed = 1;
-else % don't need to save, but may need to load from file
- item_struct.has_changed = 0;
- if isempty(data)
- data = load(filename, ['-' item_struct.file_type]);
- end
-end
-item_struct.data = data;
-
-% If no filename passed:
-% if new set, filename is empty
-% if an update, filename stays
-is_update = strcmp(action, 'update');
-if pr_is_nan(filename)
- if ~is_update
- filename = '';
- end
-end
-item_struct.file_name = filename;
-
-% If this was a clear, don't flag for save
-if pr_isempty(item_struct), item_struct.has_changed = 0; end
-
-% Put processed stuff into object, and copy old object
-% This so we can pass the candidate new object to the set_action routines
-% for checking and/or changing, but still roll back if we need to.
-old_o = o;
-o = set_item_struct(o, item, item_struct);
-
-% and here is where we do the rules stuff
-is_clear = strcmp(action, 'clear');
-if ~isempty(item_struct.set_action) & ...
- (ismember(action, {'get','set','set_ui'}) | ...
- (is_update & item_struct.set_action_if_update) | ...
- (is_clear & item_struct.set_action_if_clear))
- [tmp errf msg] = eval(item_struct.set_action);
- if errf
- o = old_o;
- warning(['Data not set: ' msg]);
- return
- end
- % work out what has been returned. It can be:
- % object, item_struct, or data; we much prefer the object, to be
- % consistent
- if isa(tmp, 'marmoire') % object
- o = tmp;
- item_struct = get_item_struct(o, item);
- elseif isstruct(tmp) & isfield(tmp, 'set_action') % item struct
- item_struct = tmp;
- else % it's just the data
- item_struct.data = tmp;
- end
-end
-
-% set has_changed, if update
-if strcmp(action, 'update')
- item_struct.has_changed = 1;
-end
-
-% possibly remove data from structure
-if ~item_struct.has_changed & item_struct.leave_as_file
- item_struct.data = [];
-end
-
-% return object with data set
-o = set_item_struct(o, item, item_struct);
-
-return
diff --git a/lib/marsbar-0.44/@marmoire/get_item_data.m b/lib/marsbar-0.44/@marmoire/get_item_data.m
deleted file mode 100644
index 5574d05..0000000
--- a/lib/marsbar-0.44/@marmoire/get_item_data.m
+++ /dev/null
@@ -1,29 +0,0 @@
-function [res, o, errf] = get_item_data(o, item)
-% get data for item
-% FORMAT [res o errf] = get_item_data(o, item);
-%
-% o - object
-% item - name of item to get data for
-%
-% If the item contains no data, GUI set is assumed
-% data is loaded from data filename if empty.
-%
-% Returns
-% res - data for item
-% o - object, which may have been modified if has done GUI set
-% errf - flag is 1 if data modification was attempted but failed
-%
-% $Id$
-
-if nargin < 2
- error('Need item');
-end
-errf = 0;
-if isempty_item_data(o, item)
- [o errf] = do_set(o, item, 'set_ui');
-end
-I = get_item_struct(o, item);
-res = I.data;
-if isempty(res) & ~isempty(I.file_name)
- res = load(I.file_name, ['-' I.file_type]);
-end
diff --git a/lib/marsbar-0.44/@marmoire/get_item_param.m b/lib/marsbar-0.44/@marmoire/get_item_param.m
deleted file mode 100644
index 43317d8..0000000
--- a/lib/marsbar-0.44/@marmoire/get_item_param.m
+++ /dev/null
@@ -1,31 +0,0 @@
-function value = get_item_param(o, item, param)
-% method to get item parameters
-% FORMAT value = get_item_param(o, item, param)
-%
-% o - object
-% item - item name
-% param - parameter name
-%
-% Returns
-% value - value for parameter
-%
-% $Id$
-
-if nargin < 2
- error('Need item name');
-end
-if nargin < 3
- error('Need parameter name');
-end
-
-I = get_item_struct(o, item);
-
-fns = fieldnames(I);
-tmp = strmatch('data', fns, 'exact');
-fns(tmp) = [];
-
-if ~ismember(param, fns)
- error(['There is no parameter callled: ' param]);
-end
-
-value = getfield(I, param);
diff --git a/lib/marsbar-0.44/@marmoire/get_item_struct.m b/lib/marsbar-0.44/@marmoire/get_item_struct.m
deleted file mode 100644
index 41b47c4..0000000
--- a/lib/marsbar-0.44/@marmoire/get_item_struct.m
+++ /dev/null
@@ -1,19 +0,0 @@
-function I = get_item_struct(o, item)
-% get whole item structure, including parameters
-% FORMAT I = get_item_struct(o, item)
-%
-% This is used internally, and might be useful for debugging
-%
-% o - object
-% item - item name
-%
-% Returns
-% I - item structure, with data in field 'data' and/or specified in
-% field 'filename'
-%
-% $Id$
-
-if ~item_exists(o, item)
- error('Item does not exist');
-end
-I = getfield(o.items, item);
diff --git a/lib/marsbar-0.44/@marmoire/isempty_item_data.m b/lib/marsbar-0.44/@marmoire/isempty_item_data.m
deleted file mode 100644
index bdf0523..0000000
--- a/lib/marsbar-0.44/@marmoire/isempty_item_data.m
+++ /dev/null
@@ -1,16 +0,0 @@
-function tf = isempty_item_data(o, item)
-% returns 1 if no data for this item
-% FORMAT tf = sjjs(o, item)
-%
-% o - object
-% item - item name
-%
-% tf - flag, 1 if not empty
-%
-% $Id$
-
-if nargin < 2
- error('Need item')
-end
-I = get_item_struct(o, item);
-tf = pr_isempty(I);
diff --git a/lib/marsbar-0.44/@marmoire/item_exists.m b/lib/marsbar-0.44/@marmoire/item_exists.m
deleted file mode 100644
index c793f6b..0000000
--- a/lib/marsbar-0.44/@marmoire/item_exists.m
+++ /dev/null
@@ -1,9 +0,0 @@
-function tf = item_exists(o, item)
-% returns true if there is an item of this name
-%
-% $Id$
-
-tf = 0;
-if ~isempty(o.items)
- tf = ismember(item, fieldnames(o.items));
-end
diff --git a/lib/marsbar-0.44/@marmoire/item_needs_save.m b/lib/marsbar-0.44/@marmoire/item_needs_save.m
deleted file mode 100644
index 4f7430b..0000000
--- a/lib/marsbar-0.44/@marmoire/item_needs_save.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function tf = item_needs_save(o, item)
-% return 1 if item requires a save
-% FORMAT tf = item_needs_save(o, item)
-%
-% $Id$
-
-if nargin < 2
- error('Need item')
-end
-tf = pr_needs_save(get_item_struct(o, item));
diff --git a/lib/marsbar-0.44/@marmoire/marmoire.m b/lib/marsbar-0.44/@marmoire/marmoire.m
deleted file mode 100644
index 61036d6..0000000
--- a/lib/marsbar-0.44/@marmoire/marmoire.m
+++ /dev/null
@@ -1,130 +0,0 @@
-function [o, others] = marmoire(params, varargin)
-% marmoire - class constructor for marmoire container type
-% FORMAT [o, others] = marmoire(params, varargin)
-%
-% the marmoire object is to store various bits of stuff
-% (armoire is the French for cupboard).
-% This cupboard is to put items which I will want to fish out
-% from time to time.
-%
-% The items may well be associated with a filename
-% If they are associated with a filename when set, they
-% are assumed to have been saved already.
-% If not, they are flagged as awaiting a save
-%
-% If the data changes, you can indicate this with the
-% update method, which changes the data, and flags for a save
-%
-% The permissable actions are:
-%
-% add_item - add an item to the armoire
-% item_exists - ask if there an exists an item of given name
-% add_if_absent - adds item if it does not yet exist
-% set_item_data - sets data for item
-% get_item_data - gets data from item
-% set_item_data_ui - sets data, getting via UI
-% save_item_data - save data for item, if required
-% save_item_data_ui - saves, using GUI to ask for filename
-% update_item_data - updates data, sets flag to show change
-% clear_item_data - clears data for item
-% isempty_item_data - returns 1 if no data for item
-% item_needs_save - returns 1 if this item needs a save
-%
-% Each item is stored in a field 'items' in the object
-%
-% The name of item is the same as the name of the field in the items field
-% of the object, and this is the 'item' argument to the various methods.
-%
-% Each item field cotains a structure, widh the data contained in a field
-% 'data'. The rest of the fields in the structure are parameters telling
-% the object how to deal with the various manipulations of the data. So,
-% each item requires the following fields:
-%
-% data - the data
-% (or a filename which loads as the data - see the
-% char_is_filename field)
-% has_changed - flag, if set, means data has changed since first set
-% save_if_changed - flag, if set, will try to save changed data when a
-% save is requested. Saves can also be forced.
-% leave_as_file - flag, if set, will attempt to leave the data, defined
-% by the filename, on the disk, not in memory, and only
-% load the data for a 'get'.
-% Otherwise, if a set occurs, and the data field is
-% empty, will load data into the global variable when
-% 'set'ing field and leave it there.
-% If the data changes, and requires a save, this field
-% has no function, until the next save.
-% file_name - file name of .mat file containing data
-% If data is empty, and file_name is not,
-% an attempt to 'get' data will load contents of
-% file_name
-% default_file_name - default filename offered for save
-% file_type - type of file to load ('mat' or 'ascii')
-% char_is_filename - flag, if set, char data is assumed to be a filename
-% filter_spec - filter spec for uigetfile (see help uigetfile)
-% prompt - prompt for uigetfile
-% verbose - flag, if set, displays more information during
-% processing
-% set_action - actions to perform when item is set
-% in form of callback string. This is executed
-% in the 'i_set' subfunction, and can use all
-% variables functions defined therein. See programmers
-% notes in the function for callback format
-% set_action_if_update - flag, if set, applied set_action for 'update' as
-% well as 'set'
-% set_action_if_clear - flag, if set, applied set_action for 'clear' as
-% well as 'set'
-%
-% $Id$
-
-% Programmers' notes
-% ------------------
-% set_action callbacks
-% callbacks should in the following formats;
-%
-% [o errf msg] = my_function(args)
-%
-% The return argument 'o' is the modified whole object. If
-% 'errf' is set, the routine warns, and aborts the set action with the
-% 'msg'.
-%
-% The preferred args will give a format of are:
-% [o errf msg] = my_function(o, item, old_o)
-%
-% where o is the object after the data has been set, item is the name of
-% the item which has just been set, and old_o is the object before the
-% data was set.
-%
-% The available args are:
-% o - the whole object with new data set
-% item - the name of the item which has been set
-% old_o - the object before the data was set.
-%
-% as well as:
-%
-% item_struct - proposed whole item field contents
-% data - proposed data to be inserted
-% passed_filename - filename passed to function
-%
-% and anything else you can see in context, for the line containing the
-% 'eval' statement in the do_set method
-
-myclass = 'marmoire';
-defstruct = struct('items', []);
-
-if nargin < 1
- params = [];
-end
-if isa(params, myclass)
- o = params;
- return
-end
-
-% fill with defaults, parse into fields for this object, children
-[pparams, others] = mars_struct('ffillsplit', defstruct, params);
-
-% add version tag (was CVS; now marsbar version)
-pparams.cvs_version = marsbar('ver');
-
-% Set as object
-o = class(pparams, myclass);
diff --git a/lib/marsbar-0.44/@marmoire/private/pr_is_nan.m b/lib/marsbar-0.44/@marmoire/private/pr_is_nan.m
deleted file mode 100644
index fedeebd..0000000
--- a/lib/marsbar-0.44/@marmoire/private/pr_is_nan.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function res = pr_is_nan(v)
-res = 0;
-if isnumeric(v) && ~isempty(v)
- res = isnan(v);
-end
-return
diff --git a/lib/marsbar-0.44/@marmoire/private/pr_is_nix.m b/lib/marsbar-0.44/@marmoire/private/pr_is_nix.m
deleted file mode 100644
index e035262..0000000
--- a/lib/marsbar-0.44/@marmoire/private/pr_is_nix.m
+++ /dev/null
@@ -1,3 +0,0 @@
-function res = pr_is_nix(v)
-res = isempty(v) | pr_is_nan(v);
-return
diff --git a/lib/marsbar-0.44/@marmoire/private/pr_isempty.m b/lib/marsbar-0.44/@marmoire/private/pr_isempty.m
deleted file mode 100644
index d227bf0..0000000
--- a/lib/marsbar-0.44/@marmoire/private/pr_isempty.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function res = pr_isempty(I)
-% private function returns 1 if there is no data, or filename
-%
-% $Id$
-
-res = isempty(I.data) & isempty(I.file_name);
diff --git a/lib/marsbar-0.44/@marmoire/private/pr_needs_save.m b/lib/marsbar-0.44/@marmoire/private/pr_needs_save.m
deleted file mode 100644
index 0a1159a..0000000
--- a/lib/marsbar-0.44/@marmoire/private/pr_needs_save.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function res = pr_needs_save(I)
-% private function returning 1 if item data needs save
-%
-% $Id$
-
-res = ~pr_isempty(I) & I.has_changed & I.save_if_changed;
diff --git a/lib/marsbar-0.44/@marmoire/save_item_data.m b/lib/marsbar-0.44/@marmoire/save_item_data.m
deleted file mode 100644
index 6da0cae..0000000
--- a/lib/marsbar-0.44/@marmoire/save_item_data.m
+++ /dev/null
@@ -1,70 +0,0 @@
-function [saved_f, o] = save_item_data(o, item, flags, filename)
-% save data for item to file
-% FORMAT [saved_f o] = save_item_data(o, item, flags, filename)
-%
-% o - object
-% item - name of item
-% flags - flags for save; fields in flag structure can be
-% 'force' - force save even if not flagged as needed
-% 'warn_empty' - GUI warn if no data to save
-% 'ync' - start save with save y/n/cancel dialog
-% 'prompt' - prompt for save;
-% 'prompt_suffix - suffix for prompt
-% 'prompt_prefix - prefix for prompt
-% 'ui' - use UI prompts for save - forced if save_ui
-% 'no_no_save' - if 'no' is chosen in the save dialog,
-% contents are flagged as not needing a save in
-% the future (has_changed flag set to 0)
-% filename - filename for save
-%
-% Returns
-% saved_f - flag set to 1 if save done, 0 not done, -1 if cancel
-% Note that, if saving with more than one item, then the value
-% is from the last value saved/not saved. Cancel aborts the
-% attempt to save.
-% o - possibly modified object (changed filename, maybe data is
-% left as a file, and data field made empty)
-%
-% $Id$
-
-if nargin < 2
- error('Need item');
-end
-if nargin < 3
- flags = NaN;
-end
-if nargin < 4
- filename = NaN;
-end
-
-if ~isstruct(flags), flags = []; end
-
-if strcmp(item, 'all')
- item_list = fieldnames(o.items);
- if ~pr_is_nix(filename)
- warning('Ignoring passed filename for multiple save');
- filename = NaN;
- end
-else
- item_list = {item};
-end
-
-n_items = length(item_list);
-saved_f = 0;
-for i_no = 1:n_items
- item = item_list{i_no};
- I = get_item_struct(o, item);
- tmp_flags = flags;
-
- % If there is no valid filename, do UI save
- if pr_is_nix(filename) && ...
- isempty(I.file_name)
- tmp_flags.ui = 1;
- end
-
- % Try save
- [saved_f o] = do_save(o, item, tmp_flags, filename);
-
- % Stop if cancel
- if saved_f == -1, return, end
-end
diff --git a/lib/marsbar-0.44/@marmoire/save_item_data_ui.m b/lib/marsbar-0.44/@marmoire/save_item_data_ui.m
deleted file mode 100644
index 322d6b1..0000000
--- a/lib/marsbar-0.44/@marmoire/save_item_data_ui.m
+++ /dev/null
@@ -1,33 +0,0 @@
-function [saved_f, o] = save_item_data_ui(o, item, flags, filename)
-% save data for item to file using GUI
-% FORMAT [saved_f o] = save_item_data_ui(o, item, flags, filename)
-%
-% o - object
-% item - name of item
-% flags - flags for save; see save_item_data.m for details
-% filename - filename for save
-%
-% Returns
-% saved_f - flag set to 1 if save done, 0 not done, -1 if cancel
-% Note that, if saving with more than one item, then the value
-% is from the last value saved/not saved. Cancel aborts the
-% attempt to save.
-% o - possibly modified object (changed filename, maybe data is
-% left as a file, and data field made empty)
-%
-% $Id$
-
-if nargin < 2
- error('Need item');
-end
-if nargin < 3
- flags = NaN;
-end
-if nargin < 4
- filename = NaN;
-end
-
-if ~isstruct(flags), flags = []; end
-flags.ui = 1;
-
-[saved_f o] = save_item_data(o, item, flags, filename);
diff --git a/lib/marsbar-0.44/@marmoire/set_item_data.m b/lib/marsbar-0.44/@marmoire/set_item_data.m
deleted file mode 100644
index 1c39d10..0000000
--- a/lib/marsbar-0.44/@marmoire/set_item_data.m
+++ /dev/null
@@ -1,33 +0,0 @@
-function [o, errf] = set_item_data(o, item, data, filename)
-% sets data for item
-% FORMAT [o errf] = set_item_data(o, item, data, filename)
-%
-% o - object
-% item - name of item to set for
-% data - data to set
-% filename - filename for data
-%
-% If neither data nor filename are set, then GUI set is assumed
-%
-% Returns
-% o - object with data set
-% errf - flag is 1 if data was not set
-%
-% $Id$
-
-if nargin < 2
- error('Need item to set to');
-end
-if nargin < 3
- data = NaN;
-end
-if nargin < 4
- filename = NaN;
-end
-
-if pr_is_nan(data) & pr_is_nan(filename)
- action = 'set_ui';
-else
- action = 'set';
-end
-[o errf] = do_set(o, item, action, data, filename);
diff --git a/lib/marsbar-0.44/@marmoire/set_item_data_ui.m b/lib/marsbar-0.44/@marmoire/set_item_data_ui.m
deleted file mode 100644
index d39c145..0000000
--- a/lib/marsbar-0.44/@marmoire/set_item_data_ui.m
+++ /dev/null
@@ -1,18 +0,0 @@
-function [o, errf] = set_item_data_ui(o, item)
-% sets data for item using GUI
-% FORMAT [o, errf] = set_item_data_ui(o, item)
-%
-% o - object
-% item - name of item to set for
-%
-% Returns
-% o - object with data set (probably)
-% errf - flag is 1 if data was not set
-%
-% $Id$
-
-if nargin < 2
- error('Need item to set to');
-end
-
-[o errf] = do_set(o, item, 'set_ui');
diff --git a/lib/marsbar-0.44/@marmoire/set_item_param.m b/lib/marsbar-0.44/@marmoire/set_item_param.m
deleted file mode 100644
index f9f1986..0000000
--- a/lib/marsbar-0.44/@marmoire/set_item_param.m
+++ /dev/null
@@ -1,36 +0,0 @@
-function o = set_item_param(o, item, param, value)
-% method to set item parameters
-% FORMAT o = set_item_param(o, item, param, value)
-%
-% o - object
-% item - item name
-% param - parameter name
-% value - value to set
-%
-% Returns
-% o - object
-%
-% $Id$
-
-if nargin < 2
- error('Need item name');
-end
-if nargin < 3
- error('Need parameter name');
-end
-if nargin < 4
- error('Need value to set')
-end
-
-I = get_item_struct(o, item);
-
-fns = fieldnames(I);
-tmp = strmatch('data', fns, 'exact');
-fns(tmp) = [];
-
-if ~ismember(param, fns)
- error(['There is no parameter callled: ' param]);
-end
-
-I = setfield(I, param, value);
-o = set_item_struct(o, item, I);
diff --git a/lib/marsbar-0.44/@marmoire/set_item_struct.m b/lib/marsbar-0.44/@marmoire/set_item_struct.m
deleted file mode 100644
index 95039d7..0000000
--- a/lib/marsbar-0.44/@marmoire/set_item_struct.m
+++ /dev/null
@@ -1,15 +0,0 @@
-function o = set_item_struct(o, item, item_struct)
-% set whole item structure, including parameters
-% FORMAT I = get_item_struct(o, item, item_struct)
-%
-% o - object
-% item - item name
-% item_struct - item structure
-%
-% Returns
-% o - object with item structure set
-%
-% $Id$
-
-% We might consider error checking here. But hey.
-o.items = setfield(o.items, item, item_struct);
diff --git a/lib/marsbar-0.44/@marmoire/update_item_data.m b/lib/marsbar-0.44/@marmoire/update_item_data.m
deleted file mode 100644
index 79f4ebf..0000000
--- a/lib/marsbar-0.44/@marmoire/update_item_data.m
+++ /dev/null
@@ -1,26 +0,0 @@
-function [o, errf] = update_item_data(o, item, data, filename)
-% updates data for item (sets data, flags change)
-% FORMAT [o, errf] = update_item_data(o, item, data, filename)
-%
-% o - object
-% item - name of item to update for
-% data - data to set
-% filename - filename for data
-%
-% Returns
-% o - object with data (probably) updated
-% errf - flag is 1 if data was not updated for some reason
-%
-% $Id$
-
-if nargin < 2
- error('Need item to set to');
-end
-if nargin < 3
- data = NaN;
-end
-if nargin < 4
- filename = NaN;
-end
-
-[o errf] = do_set(o, item, 'update', data, filename);
diff --git a/lib/marsbar-0.44/@maroi/and.m b/lib/marsbar-0.44/@maroi/and.m
deleted file mode 100644
index c871576..0000000
--- a/lib/marsbar-0.44/@maroi/and.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function o = and(o1, o2)
-% overloaded add function
-%
-% $Id$
-
-if isa(o1, 'maroi'),o1 = back2base(o1);end
-if isa(o2, 'maroi'),o2 = back2base(o2);end
-o = domaths('and', o1, o2);
diff --git a/lib/marsbar-0.44/@maroi/are_same.m b/lib/marsbar-0.44/@maroi/are_same.m
deleted file mode 100644
index a7d8167..0000000
--- a/lib/marsbar-0.44/@maroi/are_same.m
+++ /dev/null
@@ -1,23 +0,0 @@
-function tf = are_same(roi1, roi2, sp)
-% returns 1 if rois are the same
-% FORMAT tf = are_same(roi1, roi2)
-%
-% $Id$
-
-if nargin < 2
- error('Need two ROIs');
-end
-if nargin < 3
- sp = native_space(roi1);
- if isempty(sp)
- sp = native_space(roi2);
- end
- if isempty(sp)
- error('Need space for comparison');
- end
-end
-
-mat1 = matrixdata(maroi_matrix(roi1, sp));
-mat2 = matrixdata(maroi_matrix(roi2, sp));
-
-tf = all(mat1(:)==mat2(:));
diff --git a/lib/marsbar-0.44/@maroi/back2base.m b/lib/marsbar-0.44/@maroi/back2base.m
deleted file mode 100644
index eb5ed69..0000000
--- a/lib/marsbar-0.44/@maroi/back2base.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function o = back2base(o)
-% back2base method - check for spacebase, transform thereto
-%
-% $Id$
-
-spb = my_classdata('spacebase');
-if isempty(spb)
- error('Cannot do arithmetic without defined base space');
-end
-o = maroi_matrix(o, spb);
diff --git a/lib/marsbar-0.44/@maroi/binarize.m b/lib/marsbar-0.44/@maroi/binarize.m
deleted file mode 100644
index 3582ac6..0000000
--- a/lib/marsbar-0.44/@maroi/binarize.m
+++ /dev/null
@@ -1,14 +0,0 @@
-function h = binarize(obj, val)
-% binarize - returns / sets binarize value for object
-%
-% $Id$
-
-if nargin > 1
- if ~(val == 0 | val == 1)
- error('binarize is 0 or 1 flag');
- end
- obj.binarize = val;
- h = obj;
-else
- h = obj.binarize;
-end
diff --git a/lib/marsbar-0.44/@maroi/c_o_m.m b/lib/marsbar-0.44/@maroi/c_o_m.m
deleted file mode 100644
index 904aa60..0000000
--- a/lib/marsbar-0.44/@maroi/c_o_m.m
+++ /dev/null
@@ -1,21 +0,0 @@
-function pt = c_o_m(o, sp, pt_type)
-% c_o_m method - calculates unweighted centre of mass
-%
-% $Id$
-
-if nargin < 2
- sp = native_space(o);
-end
-if nargin < 3
- pt_type = 'real';
-end
-coords = voxpts(o, sp);
-switch pt_type
- case {'real','mm'}
- coords = realpts(o, sp);
- case 'vox'
- coords = voxpts(o, sp);
- otherwise
- error(['Do not recognize point type' pt_type]);
-end
-pt = mean(coords, 2);
diff --git a/lib/marsbar-0.44/@maroi/classdata.m b/lib/marsbar-0.44/@maroi/classdata.m
deleted file mode 100644
index 8144923..0000000
--- a/lib/marsbar-0.44/@maroi/classdata.m
+++ /dev/null
@@ -1,7 +0,0 @@
-function cdata = classdata(obj, varargin)
-% classdata method - sets/gets class data
-% See help for private/my_classdata for more details
-%
-% $Id$
-
-cdata = my_classdata(varargin{:});
diff --git a/lib/marsbar-0.44/@maroi/descrip.m b/lib/marsbar-0.44/@maroi/descrip.m
deleted file mode 100644
index a43c31c..0000000
--- a/lib/marsbar-0.44/@maroi/descrip.m
+++ /dev/null
@@ -1,11 +0,0 @@
-function h = descrip(obj, val)
-% name - returns / sets name value for object
-%
-% $Id$
-
-if nargin > 1
- obj.descrip = val;
- h = obj;
-else
- h = obj.descrip;
-end
diff --git a/lib/marsbar-0.44/@maroi/display.m b/lib/marsbar-0.44/@maroi/display.m
deleted file mode 100644
index df70a94..0000000
--- a/lib/marsbar-0.44/@maroi/display.m
+++ /dev/null
@@ -1,53 +0,0 @@
-function display(obj)
-% display - method
-%
-% $Id$
-
-inp_str = [inputname(1) ' ='];
-
-sz = size(obj);
-if prod(sz)>1
- arr_str = num2str(sz(1));
- for d = 2:length(sz)
- arr_str = [arr_str 'x' num2str(sz(d))];
- end
- arr_str = [arr_str ' maroi array with first element:'];
-
- if isequal(get(0,'FormatSpacing'),'compact')
- disp(inp_str);
- disp(arr_str);
- else
- disp(' ')
- disp(inp_str);
- disp(' ');
- disp(arr_str);
- end
- inp_str = [inputname(1) '(1) ='];
- obj = obj(1);
-end
-
-X = struct(obj);
-bO.label = label(obj);
-bO.source = source(obj);
-bO.binarize = binarize(obj);
-bO.roithresh = roithresh(obj);
-bO.spm_hold = spm_hold(obj);
-
-n = descrip(obj);
-if isempty(n), n = '(no descrip)';end
-src = ['[' class(obj) ' - ' n ']'];
-if isequal(get(0,'FormatSpacing'),'compact')
- disp(inp_str);
- disp(src);
- disp(bO)
- disp(X)
-else
- disp(' ')
- disp(inp_str);
- disp(' ');
- disp(src);
- disp(' ');
- disp(bO)
- disp(' ');
- disp(X)
-end
diff --git a/lib/marsbar-0.44/@maroi/eq.m b/lib/marsbar-0.44/@maroi/eq.m
deleted file mode 100644
index 1ce6edb..0000000
--- a/lib/marsbar-0.44/@maroi/eq.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function o = eq(o1, o2)
-% overloaded eq function
-%
-% $Id$
-
-if isa(o1, 'maroi'),o1 = back2base(o1);end
-if isa(o2, 'maroi'),o2 = back2base(o2);end
-o = domaths('eq', o1, o2);
diff --git a/lib/marsbar-0.44/@maroi/flip_lr.m b/lib/marsbar-0.44/@maroi/flip_lr.m
deleted file mode 100644
index eca2a31..0000000
--- a/lib/marsbar-0.44/@maroi/flip_lr.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function o = flip_lr(o)
-% flips ROI left / right
-%
-% $Id$
-
-error('Not defined for this ROI type');
diff --git a/lib/marsbar-0.44/@maroi/ge.m b/lib/marsbar-0.44/@maroi/ge.m
deleted file mode 100644
index b90d4c8..0000000
--- a/lib/marsbar-0.44/@maroi/ge.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function o = ge(o1, o2)
-% overloaded ge function
-%
-% $Id$
-
-if isa(o1, 'maroi'),o1 = back2base(o1);end
-if isa(o2, 'maroi'),o2 = back2base(o2);end
-o = domaths('ge', o1, o2);
diff --git a/lib/marsbar-0.44/@maroi/get_marsy.m b/lib/marsbar-0.44/@maroi/get_marsy.m
deleted file mode 100644
index 55ab1b6..0000000
--- a/lib/marsbar-0.44/@maroi/get_marsy.m
+++ /dev/null
@@ -1,118 +0,0 @@
-function marsY = get_marsy(varargin)
-% gets data in ROIs from images
-% FORMAT marsY = get_marsy(roi1 [, roi2 [, roi3...]], VY, sumfunc, flags)
-%
-% roi1, roi2... - ROI objects
-% This rather arcane call is needed because matlab
-% does not allow different object types in an array
-% VY - array of SPM vol structs, or image names, or SPM design
-% sumfunc - one of 'mean', 'median', 'eigen1', 'wtmean' to summarize
-% data in the ROIs
-% flags - none or more of
-% 'v' - selects verbose output to matlab console
-%
-% Returns
-% marsY - MarsBaR data object
-%
-% $Id$
-
-for r = 1:nargin
- if ~isa(varargin{r}, 'maroi')
- break
- end
-end
-rlen = r - 1;
-roi_array = varargin(1:rlen);
-
-narg_left = nargin - rlen;
-if narg_left < 1
- VY = [];
-else
- VY = varargin{r};
-end
-if isempty(VY), error('Need images to extract from'); end
-if narg_left < 2
- sumfunc = '';
-else
- sumfunc = varargin{r+1};
-end
-if isempty(sumfunc), error('Need summary function'); end
-if narg_left < 3
- flags = '';
-else
- flags = varargin{r+2};
-end
-if isempty(flags), flags = ' '; end
-vf = any(flags == 'v');
-
-% images can come from a design
-des_summary = 'None';
-if isa(VY, 'mardo')
- if ~has_images(VY)
- error('This design does not contain images');
- end
- D = VY;
- VY = get_images(VY);
-else
- D = [];
-end
-% or be filenames
-if ischar(VY)
- if vf, fprintf('%-40s: ','Mapping files'); end
- VY = spm_vol(VY);
- if vf, fprintf('%30s\n','...done'); end
-end
-
-if vf, fprintf('%-40s: %30s','Fetching data',' '); end
-rlen = length(roi_array);
-rno = 0;
-for r = 1:rlen
- if vf
- fprintf('%s%30s',...
- repmat(sprintf('\b'),1,30),...
- sprintf('%4d/%-4d',r, rlen));
- end
- o = roi_array{r};
- [y vals vXYZ mat] = getdata(o, VY);
- [ny nvals] = size(y);
- if isempty(y)
- if vf, fprintf('\n'); end
- warning(sprintf('No valid data for roi %d (%s)', r, label(o)));
- if vf & (r < rlen), fprintf('%-40s: %30s','Fetching data',' '); end
- else
- rno = rno + 1;
- % get data for regions
- if all(vals == 1)
- vals = [];
- end
- r_data{rno} = y;
- r_info{rno} = struct(...
- 'name', label(o),...
- 'descrip', descrip(o),...
- 'weights', vals,...
- 'info', struct('file', source(o)),...
- 'vXYZ', vXYZ,...
- 'mat', mat);
- if rno < 2, lbl = label(o); else lbl = [lbl ' & ' label(o)]; end
- end
-end
-if vf, fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done'); end
-
-if rno == 0
- marsY = [];
- return;
-end
-
-s_info = struct(...
- 'sumfunc', sumfunc, ...
- 'descrip', ['Data from ' lbl],...
- 'info', struct('VY', VY));
-
-% Fill any available information from design if passed
-if ~isempty(D)
- s_info.info.des_summary = summary(D);
- s_info.info.TR = tr(D);
- s_info.block_rows = block_rows(D);
-end
-
-marsY = marsy(r_data, r_info, s_info);
diff --git a/lib/marsbar-0.44/@maroi/getdata.m b/lib/marsbar-0.44/@maroi/getdata.m
deleted file mode 100644
index bf85573..0000000
--- a/lib/marsbar-0.44/@maroi/getdata.m
+++ /dev/null
@@ -1,122 +0,0 @@
-function [Y, multv, vXYZ, mat] = getdata(roiobj, data_imgs, flags)
-% getdata method - fetches time series data for ROI from images
-% FORMAT [Y multv vXYZ mat] = getdata(roiobj, data_imgs, flags)
-%
-% roiobj - an object of type maroi
-% data_imgs - images to fetch data from. These can be in the form of
-% a character array, or an array of type spm_vol (see
-% spm_vol.m)
-%
-% flags can can be none or more of
-% z - use zero masking for images without NaN represenation
-% n - nearest neighbour resampling of images
-% s - sinc resampling of images (why?)
-% (trilinear resampling is the default)
-% m - remap images
-% l - Leave in columns with missing data
-%
-% If the resampling is not set with the flags input, then we use the resampling
-% value from the ROI ``spm_hold`` value.
-%
-% default flags is empty
-%
-% Returns
-% Y - no of images x no of voxels in ROI data matrix
-% multv - weighting values from ROI (which have not been applied)
-% vXYZ - voxel coordinates of ROI from first image in series
-% mat - voxels -> mm mat file, again from first in series
-%
-% Matthew Brett 8/11/99, 2/8/01 (JBCP)
-%
-% $Id$
-
-if nargin < 2
- error('Need ROI and data images');
-end
-if nargin < 3
- flags = '';
-end
-if isempty(flags)
- flags = ' ';
-end
-
-if ischar(data_imgs)
- data_imgs = spm_vol(data_imgs);
-elseif ~isstruct(data_imgs)
- error('Input data files must be strings or structs')
-elseif any(flags == 'm')
- for i = 1:length(data_imgs)
- data_imgs(i) = spm_vol(data_imgs(i).fname);
- end
-end
-
-% resampling = set by ROI hold value by default
-if any(flags == 's')
- holdval = -11;
-elseif any(flags == 'n')
- holdval = 0;
-else % Not specified, use ROI default resampling value
- holdval = spm_hold(roiobj);
-end
-
-% NaN replacement
-if any(flags == 'z')
- zmask = 1;
-else
- zmask = 0;
-end
-
-% get real points corresponding to first image in series
-[XYZ multv] = realpts(roiobj, mars_space(data_imgs(1)));
-dlen = length(multv);
-if dlen == 0 % no points in space
- Y = [];
- return
-end
-XYZ = [XYZ; ones(size(multv))];
-
-% check for same dims etc - which could save a bag of time
-% Code a bit tricksy here to allow comparison of vector and 4x4 matrices
-% without doing loops
-%---------------------------------------------------------
-nimgs = length(data_imgs);
-dims = cat(3,data_imgs(:).dim);
-dims = dims(:, 1:3, :); % to allow for SPM2/SPM99 4 element dims
-chgflgs = any(diff(dims,1,3)) | any(any(diff(cat(3,data_imgs(:).mat),1,3)));
-chgflgs = [1; chgflgs(:)];
-
-% create return matrix
-Y = zeros(nimgs, dlen);
-
-for i = 1:nimgs
- % nan replacement
- i_type = mars_vol_utils('type', data_imgs(i));
- nanrep = spm_type(i_type, 'nanrep');
-
- if chgflgs(i) % images not the same, (re)get resample points
- ixyz = data_imgs(i).mat \ XYZ;
- end
- if i == 1; % record voxel XYZ for return
- vXYZ = ixyz(1:3,:);
- mat = data_imgs(1).mat;
- end
- % resample data at voxel centres of ROI
- data = spm_sample_vol(data_imgs(i), ixyz(1,:),ixyz(2,:),ixyz(3,:),holdval);
- % clear out missing values
- if ~nanrep & zmask
- data(data == 0) = NaN;
- end
- % return all the values
- Y(i, :) = data;
-end
-
-% strip missing data
-if ~any(flags == 'l')
- % Mask out columns with NaNs
- msk = ~any(isnan(Y),1);
- if ~all(msk)
- Y = Y(:, msk);
- multv = multv(msk);
- end
-end
-return
diff --git a/lib/marsbar-0.44/@maroi/gt.m b/lib/marsbar-0.44/@maroi/gt.m
deleted file mode 100644
index f62e078..0000000
--- a/lib/marsbar-0.44/@maroi/gt.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function o = gt(o1, o2)
-% overloaded gt (greater than) function
-%
-% $Id$
-
-if isa(o1, 'maroi'),o1 = back2base(o1);end
-if isa(o2, 'maroi'),o2 = back2base(o2);end
-o = domaths('gt', o1, o2);
diff --git a/lib/marsbar-0.44/@maroi/has_space.m b/lib/marsbar-0.44/@maroi/has_space.m
deleted file mode 100644
index 0d2b6d0..0000000
--- a/lib/marsbar-0.44/@maroi/has_space.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function tf = has_space(obj)
-% has_space method - returns true if object has a native space
-%
-% $Id$
-
-tf = 1; % default is true
diff --git a/lib/marsbar-0.44/@maroi/history.m b/lib/marsbar-0.44/@maroi/history.m
deleted file mode 100644
index 595d4b8..0000000
--- a/lib/marsbar-0.44/@maroi/history.m
+++ /dev/null
@@ -1,11 +0,0 @@
-function h = history(obj, val)
-% history - returns / sets history value for object
-%
-% $Id$
-
-if nargin > 1
- obj.history = val;
- h = obj;
-else
- h = obj.history;
-end
diff --git a/lib/marsbar-0.44/@maroi/label.m b/lib/marsbar-0.44/@maroi/label.m
deleted file mode 100644
index 3311491..0000000
--- a/lib/marsbar-0.44/@maroi/label.m
+++ /dev/null
@@ -1,11 +0,0 @@
-function h = label(obj, val)
-% label - returns / sets label value for object
-%
-% $Id$
-
-if nargin > 1
- obj.label = val;
- h = obj;
-else
- h = obj.label;
-end
diff --git a/lib/marsbar-0.44/@maroi/le.m b/lib/marsbar-0.44/@maroi/le.m
deleted file mode 100644
index ae3f954..0000000
--- a/lib/marsbar-0.44/@maroi/le.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function o = le(o1, o2)
-% overloaded le (less than or equal to) function
-%
-% $Id$
-
-if isa(o1, 'maroi'),o1 = back2base(o1);end
-if isa(o2, 'maroi'),o2 = back2base(o2);end
-o = domaths('le', o1, o2);
diff --git a/lib/marsbar-0.44/@maroi/loadobj.m b/lib/marsbar-0.44/@maroi/loadobj.m
deleted file mode 100644
index 14df6e9..0000000
--- a/lib/marsbar-0.44/@maroi/loadobj.m
+++ /dev/null
@@ -1,9 +0,0 @@
-function o = loadobj(o)
-% loadobj method - fills fields needed for backwards compatibility
-%
-% $Id$
-
-% add cvs tag
-if ~isfield(o, 'cvs_version')
- o.cvs_version = '';
-end
diff --git a/lib/marsbar-0.44/@maroi/lt.m b/lib/marsbar-0.44/@maroi/lt.m
deleted file mode 100644
index e324cd4..0000000
--- a/lib/marsbar-0.44/@maroi/lt.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function o = lt(o1, o2)
-% overloaded lt (less than) function
-%
-% $Id$
-
-if isa(o1, 'maroi'),o1 = back2base(o1);end
-if isa(o2, 'maroi'),o2 = back2base(o2);end
-o = domaths('lt', o1, o2);
diff --git a/lib/marsbar-0.44/@maroi/maroi.m b/lib/marsbar-0.44/@maroi/maroi.m
deleted file mode 100644
index 84acf41..0000000
--- a/lib/marsbar-0.44/@maroi/maroi.m
+++ /dev/null
@@ -1,169 +0,0 @@
-function [o, others] = maroi(params, varargin)
-% maroi - class constructor for umbrella ROI object
-% Can be called as a simple contructor:
-% inputs [defaults]
-% params - a structure, containing fields to construct the object
-%
-% or to load objects of this (or child) type)
-% o = maroi('load', fname);
-% or
-% o = maroi(fname);
-% (where fname is a string)
-% or
-% o_cell_arr = maroi(name_cell_arr);
-% (where
-% o_cell_arr is a cell array of ROI objects and
-% name_cell_arr is a cell array of filenames)
-% or
-% o_cell_arr = maroi('load_cell', fnames)
-% to load strings/cell array of strings into cell array of objects
-%
-% or to access class data
-% res = maroi('classdata', p1, p2); (see classdata method)
-%
-% or to process a filename to be suitable for saving an ROI
-% new_fn = maroi('filename', old_fn);
-%
-% An ROI is a definition of a region in space. As currently implemented,
-% an ROI can be of three types:
-%
-% a shape - a geometric shape defined independent of any image
-% e.g. sphere, box
-% a point list - a list of points which are within the region, maybe with
-% associated values (see below)
-% a volume - a 3D volume, containing values for the ROI at each point
-% e.g. matrix, image
-%
-% Usually, the ROI will be binary; i.e. any point that is within the
-% region will have a value of 1, and all points outside have a value of
-% 0. Because regions may be resampled into new image spaces, this
-% binaryness needs to be enforced in the resampling; this is done if the
-% 'binarize' flag is set for the object; the 'roithresh' field determines
-% the value above which a point is considered within the region, after
-% resampling.
-%
-% In addition to defining the region in space, the ROI may also define
-% values for the points within the region. If an ROI defines values then it
-% is a 'weighting' ROI (such as 0->1 probability weighting); those ROIs can
-% contain different values across the region. Because of the problem of
-% missing values when resampling an ROI (e.g sampling at the edge of a
-% volume when using anything other than nearest neighbour resampling),
-% weighting ROIs should be zero based, so that a value outside the
-% region will be considered to have the value 0 in resampling. Values of
-% NaN and 0 will always be assumed to be outside the region after
-% resampling
-%
-% At the moment, each ROI is saved as a separate mat file, with filename
-% _roi.mat
-%
-% $Id$
-
-% Programmers' notes
-%
-% maroi is the parent for all ROI objects. It can contain no useful ROI
-% itself, but implements functions for all objects of maroi type. Children
-% will generally call this parent constructor with passed arguments. This
-% constructor routine then sets fields contained in the parent maroi object,
-% and removes the relevant fields from the passed structure, then returns
-% the stripped structure to the caller, so that it can use any extra
-% arguments to set child properties, etc
-%
-% Fields are [defaults - which may well be overidden by children]:
-% source - filename for roi object ['']
-% label - 16 character label for outputting
-% descrip - (maybe) prolix description of ROI ['']
-% history - string specifying processing done to ROI ['']
-% spm_hold - defines resampling method when reslicing ROI into different
-% space (see spm_sample_vol.m) [1]
-% binarize - flag to indicate this is a binary ROI.
-% if == 1, The object will always return binary values; this is
-% enforced at object initialization, and during during
-% resampling [1]
-%
-% roithresh - absolute threshold above which a point is considered within
-% the ROI. With binarize flad set, this value
-% will usually be 0.5 (see defaults set in classdata). With
-% binarize flag unset, iw will usually be eps. These defaults
-% are set using the classdata variable
-%
-% Methods that must be defined for a maroi object are
-% [pts vals] = voxpts(obj, space)
-% [pts vals] = realpts(obj, space)
-% timeseries = getdata(obj, images, [flags]);
-% mobj = maroi_matrix(obj, [space])
-%
-% In constructor calls:
-% params passed are fields for current object, and for any parents
-% (thus there must be no overlap in field names between child and parent
-% objects, which in can in any case be confusing).
-%
-% Matthew Brett 21/9/01 (AR)
-
-myclass = 'maroi';
-defstruct = struct(...
- 'source','',...
- 'label','',...
- 'descrip', '',...
- 'history','',...
- 'spm_hold', my_classdata('def_hold'),...
- 'binarize',1,...
- 'roithresh', my_classdata('def_binthresh'));
-
-if nargin < 1
- params = [];
-end
-if isa(params, myclass)
- o = params;
- return
-end
-
-% parse out string action calls (class data, helper functions)
-if ischar(params)
- switch params
- case 'classdata'
- o = my_classdata(varargin{:});
- case 'load'
- o = my_loadroi(varargin{1});
- case 'load_cell'
- params = varargin{1};
- if ischar(params), params = cellstr(params);
- elseif ~iscell(params), params = {params}; end
- o = maroi(params);
- case 'filename'
- o = my_roifname(varargin{:});
- otherwise % single filename
- if size(params, 1) > 1
- error('Use cell form of call to load multiple objects');
- end
- o = my_loadroi(params);
- end
- return
-end
-
-% cell array - array of filenames, or objects, or something
-if iscell(params)
- sz = size(params);
- o = cell(sz);
- for r = 1:prod(sz)
- o{r} = maroi(params{r});
- end
- return
-end
-
-% fill with defaults, parse into fields for this object, children
-[pparams, others] = mars_struct('ffillsplit', defstruct, params);
-
-% Check for default thresholds according to binarize flag
-if isfield(params, 'binarize') && ~isempty(params.binarize) && ...
- params.binarize == 0 && ( ~isfield(params, 'roithresh') || ...
- isempty(params.roithresh))
- pparams.roithresh = my_classdata('def_wtthresh');
-end
-
-% add version tag (was CVS; now marsbar version)
-pparams.cvs_version = marsbar('ver');
-
-% Set as object
-o = class(pparams, myclass);
-
-return
diff --git a/lib/marsbar-0.44/@maroi/maroi_matrix.m b/lib/marsbar-0.44/@maroi/maroi_matrix.m
deleted file mode 100644
index d4436f1..0000000
--- a/lib/marsbar-0.44/@maroi/maroi_matrix.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function obj2 = maroi_matrix(obj, sp)
-% maroi_matrix method - converts roi to maroi matrix type
-% In this case, the function only checks why it has been inappropriately
-% called (if useful, it should have been overridden)
-%
-% $Id$
-
-error('Unexpected call to maroi_matrix on object with no method');
diff --git a/lib/marsbar-0.44/@maroi/minus.m b/lib/marsbar-0.44/@maroi/minus.m
deleted file mode 100644
index 42d8ebd..0000000
--- a/lib/marsbar-0.44/@maroi/minus.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function o = minus(o1, o2)
-% overloaded minus function
-%
-% $Id$
-
-if isa(o1, 'maroi'),o1 = back2base(o1);end
-if isa(o2, 'maroi'),o2 = back2base(o2);end
-o = domaths('minus', o1, o2);
diff --git a/lib/marsbar-0.44/@maroi/mrdivide.m b/lib/marsbar-0.44/@maroi/mrdivide.m
deleted file mode 100644
index 10f70ee..0000000
--- a/lib/marsbar-0.44/@maroi/mrdivide.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function o = mrdivide(o1, o2)
-% overloaded mrdivide (matrix right divide) function
-%
-% $Id$
-
-if isa(o1, 'maroi'),o1 = back2base(o1);end
-if isa(o2, 'maroi'),o2 = back2base(o2);end
-o = domaths('divide', o1, o2);
diff --git a/lib/marsbar-0.44/@maroi/mtimes.m b/lib/marsbar-0.44/@maroi/mtimes.m
deleted file mode 100644
index ca5421e..0000000
--- a/lib/marsbar-0.44/@maroi/mtimes.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function o = mtimes(o1, o2)
-% overloaded mtimes function
-%
-% $Id$
-
-if isa(o1, 'maroi'),o1 = back2base(o1);end
-if isa(o2, 'maroi'),o2 = back2base(o2);end
-o = domaths('times', o1, o2);
diff --git a/lib/marsbar-0.44/@maroi/native_space.m b/lib/marsbar-0.44/@maroi/native_space.m
deleted file mode 100644
index 51e7393..0000000
--- a/lib/marsbar-0.44/@maroi/native_space.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function sp = native_space(obj)
-% native_space method - returns native space of object
-%
-% $Id$
-
-sp = maroi('classdata', 'spacebase');
diff --git a/lib/marsbar-0.44/@maroi/ne.m b/lib/marsbar-0.44/@maroi/ne.m
deleted file mode 100644
index 2a983d7..0000000
--- a/lib/marsbar-0.44/@maroi/ne.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function o = ne(o1, o2)
-% overloaded ne function
-%
-% $Id$
-
-if isa(o1, 'maroi'),o1 = back2base(o1);end
-if isa(o2, 'maroi'),o2 = back2base(o2);end
-o = domaths('ne', o1, o2);
diff --git a/lib/marsbar-0.44/@maroi/not.m b/lib/marsbar-0.44/@maroi/not.m
deleted file mode 100644
index ad76d68..0000000
--- a/lib/marsbar-0.44/@maroi/not.m
+++ /dev/null
@@ -1,7 +0,0 @@
-function o = not(o1)
-% overloaded not function
-%
-% $Id$
-
-if isa(o1, 'maroi'),o1 = back2base(o1);end
-o = domaths('not', o1);
diff --git a/lib/marsbar-0.44/@maroi/or.m b/lib/marsbar-0.44/@maroi/or.m
deleted file mode 100644
index 407034b..0000000
--- a/lib/marsbar-0.44/@maroi/or.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function o = or(o1, o2)
-% overloaded or function
-%
-% $Id$
-
-if isa(o1, 'maroi'),o1 = back2base(o1);end
-if isa(o2, 'maroi'),o2 = back2base(o2);end
-o = domaths('or', o1, o2);
diff --git a/lib/marsbar-0.44/@maroi/paramfields.m b/lib/marsbar-0.44/@maroi/paramfields.m
deleted file mode 100644
index ff7c40a..0000000
--- a/lib/marsbar-0.44/@maroi/paramfields.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function params = paramfields(o)
-% returns struct with fields from maroi object useful for copying objects
-%
-% $Id$
-
-params = struct('spm_hold', o.spm_hold,...
- 'binarize', o.binarize,...
- 'roithresh', o.roithresh,...
- 'descrip', o.descrip,...
- 'label', o.label);
diff --git a/lib/marsbar-0.44/@maroi/plus.m b/lib/marsbar-0.44/@maroi/plus.m
deleted file mode 100644
index 8a38cb4..0000000
--- a/lib/marsbar-0.44/@maroi/plus.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function o = plus(o1, o2)
-% overloaded plus function
-%
-% $Id$
-
-if isa(o1, 'maroi'),o1 = back2base(o1);end
-if isa(o2, 'maroi'),o2 = back2base(o2);end
-o = domaths('plus', o1, o2);
diff --git a/lib/marsbar-0.44/@maroi/private/my_classdata.m b/lib/marsbar-0.44/@maroi/private/my_classdata.m
deleted file mode 100644
index cb41dec..0000000
--- a/lib/marsbar-0.44/@maroi/private/my_classdata.m
+++ /dev/null
@@ -1,66 +0,0 @@
-function cdata = my_classdata(fieldname, value)
-% my_classdata method - sets/gets class data
-% maroi class data is implemented with a persistent variable
-% CLASSDATA This is a structure containing fields
-%
-% spacebase - space in which to do ROI combination
-% fileend - filename end with extension for ROI files
-% def_binthresh - default roithresh for binarize ROIs
-% def_wtthresh - default roithresh for non-binarize ROIs
-%
-% Field values can be returned with the call
-% maroi('classdata') - which returns the whole structure
-% or maroi('classdata', fieldname) - which returns field data
-%
-% Field values can be set with the call
-% maroi('classdata', fieldname, value) OR
-% maroi('classdata', struct) where struct contains fields matching those
-% in CLASSDATA
-%
-% The same functionality results from
-% classdata(maroi_obj, fieldname) etc.
-%
-% Matthew Brett 1/8/01 (MRD+)
-%
-% $Id$
-
-persistent CLASSDATA
-if isempty(CLASSDATA)
- % default space is that of the SPM templates
- t1mat = [2 0 0 -92; ...
- 0 2 0 -128; ...
- 0 0 2 -74; ...
- 0 0 0 1];
- CLASSDATA = struct(...
- 'spacebase', mars_space([91 109 91], t1mat), ...
- 'fileend','_roi.mat',...
- 'def_hold', 1,...
- 'def_binthresh', 0.5,...
- 'def_wtthresh', eps);
-
-end
-
-if nargin < 1 % simple classdata call
- cdata = CLASSDATA;
- return
-end
-if nargin < 2 && ~isstruct(fieldname) % fieldname get call
- if isfield(CLASSDATA, fieldname)
- cdata = getfield(CLASSDATA,fieldname);
- else
- cdata = [];
- end
- return
-end
-
-% some sort of set call
-if ~isstruct(fieldname)
- fieldname = struct(struct(fieldname, value));
-end
-for field = fieldnames(fieldname)
- if isfield(CLASSDATA, field{1})
- CLASSDATA = setfield(CLASSDATA, field{1},...
- getfield(fieldname, field{1}));
- end
-end
-cdata = CLASSDATA;
diff --git a/lib/marsbar-0.44/@maroi/private/my_loadroi.m b/lib/marsbar-0.44/@maroi/private/my_loadroi.m
deleted file mode 100644
index 30ccfd5..0000000
--- a/lib/marsbar-0.44/@maroi/private/my_loadroi.m
+++ /dev/null
@@ -1,22 +0,0 @@
-function o = my_loadroi(fname)
-% my_loadroi function - loads ROI from file, sets source field
-%
-% $Id$
-
-if isa(fname, 'maroi') % already loaded
- o = fname;
- return
-end
-
-o = [];
-if iscell(fname), fname = char(fname); end
-if size(fname, 1) > 1, error('Can only load one ROI at a time'); end
-if isempty(fname), warning('Empty filename'), return, end
-fname = deblank(fname);
-F = load(fname);
-if isfield(F, 'roi') & isa(F.roi, 'maroi')
- o = F.roi;
- o = source(o, fname);
-else
- warning(['Loading file ' fname ' did not return an ROI'])'
-end
diff --git a/lib/marsbar-0.44/@maroi/private/my_roifname.m b/lib/marsbar-0.44/@maroi/private/my_roifname.m
deleted file mode 100644
index 198c41a..0000000
--- a/lib/marsbar-0.44/@maroi/private/my_roifname.m
+++ /dev/null
@@ -1,22 +0,0 @@
-function roifname = my_roifname(fname)
-% changes fname to appropriate ROI format
-%
-% $Id$
-
-if nargin < 1
- fname = [];
-end
-roifname = fname;
-if isempty(fname)
- return
-end
-gend = maroi('classdata', 'fileend');
-lg = length(gend);
-
-[p f e] = fileparts(roifname);
-f2 = [f e];
-if length(f2) 1
- if val < 0 | val > 1
- error('Value must be between 0 and 1');
- end
- obj.roithresh = val;
- h = obj;
-else
- h = obj.roithresh;
-end
diff --git a/lib/marsbar-0.44/@maroi/save_as_image.m b/lib/marsbar-0.44/@maroi/save_as_image.m
deleted file mode 100644
index 71b0cb4..0000000
--- a/lib/marsbar-0.44/@maroi/save_as_image.m
+++ /dev/null
@@ -1,13 +0,0 @@
-function v = save_as_image(o, fname, sp)
-% method save_as_image - saves ROI as image
-%
-% $Id$
-
-if nargin < 2
- error('Need ROI and filename');
-end
-if nargin < 3
- sp = [];
-end
-o = maroi_matrix(o, sp);
-v = do_write_image(o, fname);
diff --git a/lib/marsbar-0.44/@maroi/save_mricro.m b/lib/marsbar-0.44/@maroi/save_mricro.m
deleted file mode 100644
index f635e98..0000000
--- a/lib/marsbar-0.44/@maroi/save_mricro.m
+++ /dev/null
@@ -1,18 +0,0 @@
-function save_mricro(o, fname, sp)
-% saves in MRIcro format
-%
-% $Id$
-
-if nargin < 2
- error('Need filename for MRIcro save');
-end
-if nargin < 3
- sp = native_space(o);
-end
-rlem = rle(o, sp);
-fid = fopen(fname, 'wb');
-if fid == -1
- error(['Could not open file ' fname]);
-end
-fclose(fid);
-error('Come to think of it, I don''t understand the format anyhow');
diff --git a/lib/marsbar-0.44/@maroi/saveroi.m b/lib/marsbar-0.44/@maroi/saveroi.m
deleted file mode 100644
index c252199..0000000
--- a/lib/marsbar-0.44/@maroi/saveroi.m
+++ /dev/null
@@ -1,13 +0,0 @@
-function roi = saveroi(roi, fname)
-% saveroi method - checks fname, sets source field, saves object
-%
-% $Id$
-
-if nargin < 2
- fname = source(roi);
-end
-if isempty(fname)
- error('Need filename for save');
-end
-roi.source = fname;
-save(roi.source, 'roi');
diff --git a/lib/marsbar-0.44/@maroi/source.m b/lib/marsbar-0.44/@maroi/source.m
deleted file mode 100644
index b89fd53..0000000
--- a/lib/marsbar-0.44/@maroi/source.m
+++ /dev/null
@@ -1,11 +0,0 @@
-function h = source(obj, val)
-% source - returns / sets source value for object
-%
-% $Id$
-
-if nargin > 1
- obj.source = val;
- h = obj;
-else
- h = obj.source;
-end
diff --git a/lib/marsbar-0.44/@maroi/spm_hold.m b/lib/marsbar-0.44/@maroi/spm_hold.m
deleted file mode 100644
index 6e04687..0000000
--- a/lib/marsbar-0.44/@maroi/spm_hold.m
+++ /dev/null
@@ -1,11 +0,0 @@
-function h = spm_hold(obj, val)
-% hold - returns / sets hold value for object
-%
-% $Id$
-
-if nargin > 1
- obj.spm_hold = val;
- h = obj;
-else
- h = obj.spm_hold;
-end
diff --git a/lib/marsbar-0.44/@maroi/times.m b/lib/marsbar-0.44/@maroi/times.m
deleted file mode 100644
index b52f9fe..0000000
--- a/lib/marsbar-0.44/@maroi/times.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function o = times(o1, o2)
-% overloaded times function
-%
-% $Id$
-
-if isa(o1, 'maroi'),o1 = back2base(o1);end
-if isa(o2, 'maroi'),o2 = back2base(o2);end
-o = domaths('times', o1, o2);
diff --git a/lib/marsbar-0.44/@maroi/volume.m b/lib/marsbar-0.44/@maroi/volume.m
deleted file mode 100644
index cc99255..0000000
--- a/lib/marsbar-0.44/@maroi/volume.m
+++ /dev/null
@@ -1,9 +0,0 @@
-function v = volume(obj)
-% volume method - returns volume of ROI in mm
-%
-% $Id$
-
-sp = native_space(obj);
-XYZ = voxpts(obj,sp);
-vox = sqrt(sum(sp.mat(1:3,1:3)'.^2));
-v = size(XYZ,2) * prod(vox);
diff --git a/lib/marsbar-0.44/@maroi/xor.m b/lib/marsbar-0.44/@maroi/xor.m
deleted file mode 100644
index b219c54..0000000
--- a/lib/marsbar-0.44/@maroi/xor.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function o = xor(o1, o2)
-% overloaded xor function
-%
-% $Id$
-
-if isa(o1, 'maroi'),o1 = back2base(o1);end
-if isa(o2, 'maroi'),o2 = back2base(o2);end
-o = domaths('xor', o1, o2);
diff --git a/lib/marsbar-0.44/@maroi_box/centre.m b/lib/marsbar-0.44/@maroi_box/centre.m
deleted file mode 100644
index a5d21e1..0000000
--- a/lib/marsbar-0.44/@maroi_box/centre.m
+++ /dev/null
@@ -1,9 +0,0 @@
-function c = centre(obj, val)
-% centre method - sets / returns centre of ROI in mm
-%
-% $Id$
-
-if nargin > 1
- obj.centre = val;
-end
-c = obj.centre;
diff --git a/lib/marsbar-0.44/@maroi_box/flip_lr.m b/lib/marsbar-0.44/@maroi_box/flip_lr.m
deleted file mode 100644
index e86c9c3..0000000
--- a/lib/marsbar-0.44/@maroi_box/flip_lr.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function o = flip_lr(o)
-% flips ROI left / right
-%
-% $Id$
-
-o.centre(1) = o.centre(1)*-1;
diff --git a/lib/marsbar-0.44/@maroi_box/is_empty_roi.m b/lib/marsbar-0.44/@maroi_box/is_empty_roi.m
deleted file mode 100644
index c244e1e..0000000
--- a/lib/marsbar-0.44/@maroi_box/is_empty_roi.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function tf = is_empty_roi(o)
-% returns 1 if ROI contains no volume
-%
-% $Id$
-
-tf = isempty(o.centre);
diff --git a/lib/marsbar-0.44/@maroi_box/maroi_box.m b/lib/marsbar-0.44/@maroi_box/maroi_box.m
deleted file mode 100644
index f205333..0000000
--- a/lib/marsbar-0.44/@maroi_box/maroi_box.m
+++ /dev/null
@@ -1,42 +0,0 @@
-function o = maroi_box(params)
-% maroi_box - class constructor
-% inputs [defaults]
-% params - a structure containing any fields for a maroi parent and
-% .centre - a 1x3 coordinate in mm
-% .widths - 1x3 widths in X Y Z in mm
-%
-% $Id$
-
-myclass = 'maroi_box';
-defstruct = struct('centre', [0 0 0], 'widths', [0 0 0]);
-
-if nargin < 1
- params = [];
-end
-if isa(params, myclass)
- o = params;
- return
-end
-
-% fill with defaults
-pparams = mars_struct('ffillmerge', defstruct, params);
-
-% umbrella object, parse out fields for (this object and children)
-[uo, pparams] = maroi_shape(pparams);
-
-% reparse parameters into those for this object, children
-[pparams, others] = mars_struct('split', pparams, defstruct);
-
-% check resulting input
-if size(pparams.centre, 2) == 1
- pparams.centre = pparams.centre';
-end
-if size(pparams.widths, 2) == 1
- pparams.widths = pparams.widths';
-end
-if size(pparams.widths, 2) == 1
- pparams.widths = ones(1,3) * pparams.widths;
-end
-
-o = class(pparams, myclass, uo);
-return
diff --git a/lib/marsbar-0.44/@maroi_box/volume.m b/lib/marsbar-0.44/@maroi_box/volume.m
deleted file mode 100644
index f0ed306..0000000
--- a/lib/marsbar-0.44/@maroi_box/volume.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function v = volume(obj)
-% volume method - returns volume of ROI in mm
-%
-% $Id$
-
-v = prod(obj.widths);
diff --git a/lib/marsbar-0.44/@maroi_box/voxpts.m b/lib/marsbar-0.44/@maroi_box/voxpts.m
deleted file mode 100644
index ce735d1..0000000
--- a/lib/marsbar-0.44/@maroi_box/voxpts.m
+++ /dev/null
@@ -1,25 +0,0 @@
-function [pts, vals] = voxpts(obj, sp)
-% voxpts method - voxels within a box in given space
-%
-% $Id$
-
-if nargin < 2
- error('Need object and space arguments');
-end
-sp = mars_space(sp);
-
-mc = obj.centre;
-mw = obj.widths;
-
-% find voxels that are within box
-dim = sp.dim(1:3); dim = dim(:);
-vox = sqrt(sum(sp.mat(1:3,1:3)'.^2));
-vd = mw ./ vox / 2;
-vc = sp.mat \ [mc(1:3) 1]';
-vc = vc(1:3)';
-blim = [max([1 1 1; ceil(vc-vd)]); min([sp.dim(1:3); floor(vc+vd)])];
-[R,C,P]=ndgrid(...
- blim(1,1):blim(2,1),blim(1,2):blim(2,2),blim(1,3):blim(2,3));
-pts = [R(:)';C(:)';P(:)'];
-
-vals = ones(1, size(pts, 2));
diff --git a/lib/marsbar-0.44/@maroi_image/flip_lr.m b/lib/marsbar-0.44/@maroi_image/flip_lr.m
deleted file mode 100644
index acff33c..0000000
--- a/lib/marsbar-0.44/@maroi_image/flip_lr.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function o = flip_lr(o)
-% flips ROI left / right
-%
-% $Id
-
-% Requires change to ROI data -> return as maroi_matrix
-
-o = flip_lr(maroi_matrix(o));
diff --git a/lib/marsbar-0.44/@maroi_image/loadobj.m b/lib/marsbar-0.44/@maroi_image/loadobj.m
deleted file mode 100644
index 3239631..0000000
--- a/lib/marsbar-0.44/@maroi_image/loadobj.m
+++ /dev/null
@@ -1,22 +0,0 @@
-function o = loadobj(o)
-% loadobj method - reloads matrix from img file
-%
-% $Id$
-
-% Note that the image needs full processing before
-% setting into the matrix. After this, the processed
-% natrix data becomes an image snapshot for the memory
-% lifetime of the object
-
-[img errstr] = my_vol_func(o);
-if isempty(img)
- if strcmp(errstr, 'Cant open image file.')
- errstr = sprintf('%s\nHas ROI image %s been moved?\n%s\n', ...
- errstr, o.vol.fname,...
- 'Try to reattach with marsbar(''attach_image'')');
- end
- error(errstr);
-end
-
-% set using maroi_matrix object to avoid object conversion
-o.maroi_matrix = matrixdata(o.maroi_matrix,img);
diff --git a/lib/marsbar-0.44/@maroi_image/maroi_image.m b/lib/marsbar-0.44/@maroi_image/maroi_image.m
deleted file mode 100644
index 593e499..0000000
--- a/lib/marsbar-0.44/@maroi_image/maroi_image.m
+++ /dev/null
@@ -1,67 +0,0 @@
-function [o, others] = maroi_image(params)
-% maroi_image - class constructor
-% inputs [defaults]
-% params - filename, for image defining ROI
-% or spm vol struct (see spm_vol)
-%
-% This ROI type is a child of the maroi_matrix type. maroi_image ROIs are
-% static, in that they are defined by a particular image, and optionally, a
-% function to apply to the image. If the image changes, so will the ROI.
-% However, the ROI will not change the image, so, if any changes are made to
-% the ROI, such as flips, setting of the data directly using the matrixdata
-% function of maroi_matrix, etc, then the ROI automatically become a
-% maroi_matrix type, and is detached from the image.
-%
-% Note that the image is referenced by an absolute path, so if the path
-% to the image changes, loading the ROI will fail. Reassociate the image
-% with an ROI using the vol method.
-%
-% $Id$
-
-myclass = 'maroi_image';
-defstruct = struct('vol', [],'func', '');
-
-if nargin < 1
- params = [];
-end
-if isa(params, myclass)
- o = params;
- return
-end
-
-% check for filename;
-if ischar(params)
- params.vol = spm_vol(params);
-end
-% check for vol struct
-if isfield(params, 'fname')
- params.vol = params;
-end
-
-% fill with defaults
-pparams = mars_struct('ffillmerge', defstruct, params);
-
-if ~isempty(pparams.vol) % check for attempt at create empty object
-
- % check and process vol and func
- [img errstr] = my_vol_func(pparams.vol, pparams.func);
- if isempty(img), error(errstr); end
-
- % prepare for maroi_matrix creation
- pparams.dat = img;
- pparams.mat = pparams.vol.mat;
-
- % fill source information if empty
- if ~isfield(pparams, 'source') | isempty(pparams.source)
- pparams.source = maroi('filename',pparams.vol.fname);
- end
-end
-
-% umbrella object, parse out fields for (this object and children)
-[uo, pparams] = maroi_matrix(pparams);
-
-% reparse parameters into those for this object, children
-[pparams, others] = mars_struct('split', pparams, defstruct);
-
-o = class(pparams, myclass, uo);
-return
diff --git a/lib/marsbar-0.44/@maroi_image/maroi_matrix.m b/lib/marsbar-0.44/@maroi_image/maroi_matrix.m
deleted file mode 100644
index cf60b5d..0000000
--- a/lib/marsbar-0.44/@maroi_image/maroi_matrix.m
+++ /dev/null
@@ -1,9 +0,0 @@
-function o = maroi_matrix(o, sp)
-% maroi_matrix method - converts maroi_image to maroi_matrix
-%
-% $Id$
-
-o = o.maroi_matrix;
-if nargin > 1
- o = maroi_matrix(o, sp);
-end
diff --git a/lib/marsbar-0.44/@maroi_image/private/my_vol_func.m b/lib/marsbar-0.44/@maroi_image/private/my_vol_func.m
deleted file mode 100644
index 32fbf1f..0000000
--- a/lib/marsbar-0.44/@maroi_image/private/my_vol_func.m
+++ /dev/null
@@ -1,70 +0,0 @@
-function [img, errstr] = my_vol_func(vol, func)
-% checks vol and func, returns processed image matrix or error
-%
-% $Id$
-
-if nargin < 1
- error('Need object or vol struct');
-end
-if isa(vol, 'maroi_image')
- [vol def_func] = deal(vol.vol, vol.func);
-else
- def_func = '';
-end
-if nargin < 2
- func = '';
-end
-if isempty(func), func = def_func; end
-
-img = [];
-errstr = '';
-
-if ischar(vol) % filename passed?
- try
- vol = spm_vol(vol);
- catch
- errstr = lasterr;
- return
- end
-end
-
-if isempty(vol)
- errstr = 'vol is empty';
- return
-end
-if ~isstruct(vol)
- errstr = 'vol is not struct';
- return
-end
-if ~isfield(vol, 'fname')
- errstr = 'vol does not contain fname field';
- return
-end
-
-try
- % load image into matrix
- img = spm_read_vols(vol);
-catch
- errstr = lasterr;
- return
-end
-
-% apply and check function if passed
-if ~isempty(func)
- sz = size(img);
- try
- img = double(eval(func));
- catch
- errstr = lasterr;
- img = [];
- return
- end
-
- % check that the image has not changed size
- sz2 = size(img);
- if length(sz) ~= length(sz2) | any(sz ~= sz2)
- img = [];
- errstr = sprintf('Bad function "%s" - the image has changed size',...
- func);
- end
-end
diff --git a/lib/marsbar-0.44/@maroi_image/saveobj.m b/lib/marsbar-0.44/@maroi_image/saveobj.m
deleted file mode 100644
index fcaa9ca..0000000
--- a/lib/marsbar-0.44/@maroi_image/saveobj.m
+++ /dev/null
@@ -1,7 +0,0 @@
-function o = saveobj(o)
-% saveobj method - removes matrix information from parent to save space
-%
-% $Id$
-
-% set using maroi_matrix object to avoid object conversion
-o.maroi_matrix = matrixdata(o.maroi_matrix, []);
diff --git a/lib/marsbar-0.44/@maroi_image/vol.m b/lib/marsbar-0.44/@maroi_image/vol.m
deleted file mode 100644
index 3ad5288..0000000
--- a/lib/marsbar-0.44/@maroi_image/vol.m
+++ /dev/null
@@ -1,13 +0,0 @@
-function h = vol(obj, val)
-% vol - returns / sets image vol for object
-%
-% $Id$
-
-if nargin > 1
- img = my_vol_func(val, obj.func);
- obj.vol = val;
- obj = matrixdata(obj, img);
- h = obj;
-else
- h = obj.vol;
-end
diff --git a/lib/marsbar-0.44/@maroi_matrix/do_write_image.m b/lib/marsbar-0.44/@maroi_matrix/do_write_image.m
deleted file mode 100644
index 5ebdc9b..0000000
--- a/lib/marsbar-0.44/@maroi_matrix/do_write_image.m
+++ /dev/null
@@ -1,18 +0,0 @@
-function v = do_write_image(o, fname)
-% method saves matrix as image and returns spm_vol
-%
-% $Id$
-
-v = mars_vol_utils('def_vol');
-v.fname = fname;
-v.mat = o.mat;
-v.dim = size(o.dat);
-
-if binarize(o)
- v = mars_vol_utils('set_type', v, 'uint8');
-else
- v = mars_vol_utils('set_type', v, 'float');
-end
-
-v = spm_create_vol(v);
-v = spm_write_vol(v, o.dat);
diff --git a/lib/marsbar-0.44/@maroi_matrix/domaths.m b/lib/marsbar-0.44/@maroi_matrix/domaths.m
deleted file mode 100644
index 3081729..0000000
--- a/lib/marsbar-0.44/@maroi_matrix/domaths.m
+++ /dev/null
@@ -1,101 +0,0 @@
-function o = domaths(func, dat1, dat2)
-% helper function to do maths on matrix object
-% Binary operations (& | ~ xor etc) return binarize type objects
-% Other operations return not-binarize type objects
-% ROI reslicing thresholds are set from defaults
-%
-% $Id$
-
-if nargin < 2
- error('Need function and object');
-end
-if nargin < 3
- dat2 = [];
-end
-d1 = describething(dat1);
-d2 = describething(dat2);
-
-if isa(dat1, 'maroi')
- o = dat1; dat1 = dat1.dat;
-else % second must be an object
- o = dat2;
-end
-if isa(dat2, 'maroi')
- dat2 = dat2.dat;
-end
-
-if nargin < 3 % no second object
- d = sprintf('%s(%s)', func, d1);
-else % there is a second object / thing
- d = sprintf('%s(%s, %s)', func, d1, d2);
-end
-
-switch func
- case 'and'
- o.dat = dat1 & dat2;
- case 'or'
- o.dat = dat1 | dat2;
- case 'not'
- o.dat = ~dat1;
- case 'xor'
- o.dat = xor(dat1, dat2);
- case 'plus'
- o.dat = dat1 + dat2;
- case 'minus'
- o.dat = dat1 - dat2;
- case 'times'
- o.dat = dat1 .* dat2;
- case 'divide'
- o.dat = dat1 ./ dat2;
- case 'lt'
- o.dat = dat1 < dat2;
- case 'gt'
- o.dat = dat1 > dat2;
- case 'le'
- o.dat = dat1 <= dat2;
- case 'ge'
- o.dat = dat1 >= dat2;
- case 'eq'
- o.dat = dat1 == dat2;
- case 'ne'
- o.dat = dat1 ~= dat2;
- otherwise
- error(['Function ' func ' not yet defined']);
-end
-
-% convert from logical to double if necessary
-o.dat = double(o.dat);
-
-binf = ismember(func, {...
- 'and',...
- 'or',...
- 'not',...
- 'xor',...
- 'lt',...
- 'gt',...
- 'le',...
- 'ge',...
- 'eq',...
- 'ne'});
-
-o = binarize(o, binf);
-if binf
- o = roithresh(o, maroi('classdata', 'def_binthresh'));
-else
- o = roithresh(o, maroi('classdata', 'def_wtthresh'));
-end
-o = descrip(o, d);
-o = source(o, '');
-
-function d = describething(o)
-if isa(o, 'maroi')
- d = descrip(o);
-elseif isnumeric(o)
- if prod(size(o)) == 1 % scalar
- d = num2str(o);
- else
- d = '[matrix]';
- end
-else
- d = '[non numeric input]';
-end
diff --git a/lib/marsbar-0.44/@maroi_matrix/flip_lr.m b/lib/marsbar-0.44/@maroi_matrix/flip_lr.m
deleted file mode 100644
index 8eca561..0000000
--- a/lib/marsbar-0.44/@maroi_matrix/flip_lr.m
+++ /dev/null
@@ -1,7 +0,0 @@
-function o = flip_lr(o)
-% flips ROI left / right
-%
-% $Id$
-
-M = eye(4); M(1) = -1;
-o.mat = M * o.mat;
diff --git a/lib/marsbar-0.44/@maroi_matrix/is_empty_roi.m b/lib/marsbar-0.44/@maroi_matrix/is_empty_roi.m
deleted file mode 100644
index a1bf08c..0000000
--- a/lib/marsbar-0.44/@maroi_matrix/is_empty_roi.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function tf = is_empty_roi(o)
-% is_empty_roi - returns true if ROI contains no volume
-%
-% $Id$
-
-tf = ~any(o.dat(:));
diff --git a/lib/marsbar-0.44/@maroi_matrix/loadobj.m b/lib/marsbar-0.44/@maroi_matrix/loadobj.m
deleted file mode 100644
index f438aef..0000000
--- a/lib/marsbar-0.44/@maroi_matrix/loadobj.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function o = loadobj(o)
-% loadobj function - undoes run length encoding if appropriate
-%
-% $Id$
-
-m = o.dat;
-if isfield(m, 'rlem')
- dat = my_rld(m.rlem);
- o.dat = reshape(dat, m.dim);
-end
diff --git a/lib/marsbar-0.44/@maroi_matrix/maroi_matrix.m b/lib/marsbar-0.44/@maroi_matrix/maroi_matrix.m
deleted file mode 100644
index 47c9d17..0000000
--- a/lib/marsbar-0.44/@maroi_matrix/maroi_matrix.m
+++ /dev/null
@@ -1,72 +0,0 @@
-function [o, others] = maroi_matrix(params, space)
-% maroi_matrix - class constructor
-% There are two usual forms of the call:
-% 1) Constructor call: obj = maroi_matrix(params);
-% where input is [defaults]
-% params - a structure containing any fields for a maroi parent and
-% .dat - a matrix
-% .mat - mapping of matrix indices to mm
-%
-% 2) Rebase call: obj = maroi_matrix(obj, space)
-% where input is [defaults]
-% obj - a maroi_matrix object
-% space - mars_space object defining space to reslice to
-%
-% This maroi_matrix object is used for conversion between
-% different types of rois, and for combining rois
-% Much of the work is in the converter routines for other roi objects, to
-% return objects of this type
-%
-% $Id$
-
-myclass = 'maroi_matrix';
-defstruct = struct('dat', [],'mat', eye(4));
-
-if nargin < 1
- params = [];
-end
-if isa(params, myclass)
- o = params;
- if nargin < 2 % simple object return call
- return
- end
- % Rebase call
- if isempty(space)
- space = native_space(o);
- if isempty(space)
- error('Cannot define default space for object');
- end
- else
- space = mars_space(space);
- end
-
- % check if this in fact the same as object native space
- if space == native_space(o), return, end
- % if not, then rebase
- params = paramfields(o);
- params.label = [params.label '_rebased'];
- params.descrip = [params.descrip ': rebased'];
- params.dat = rebase(o,space,'i');
- params.mat = space.mat;
- o = maroi_matrix(params);
- return
-end
-
-% Constructor call
-
-% fill with defaults
-pparams = mars_struct('ffillmerge', defstruct, params);
-
-% umbrella object, parse out fields for (this object and children)
-[uo, pparams] = maroi(pparams);
-
-% reparse parameters into those for this object, children
-[pparams, others] = mars_struct('split', pparams, defstruct);
-
-% bless into object
-o = class(pparams, myclass, uo);
-
-% apply implied thresholding
-o = matrixdata(o, o.dat);
-
-return
diff --git a/lib/marsbar-0.44/@maroi_matrix/matrixdata.m b/lib/marsbar-0.44/@maroi_matrix/matrixdata.m
deleted file mode 100644
index 3cc66ba..0000000
--- a/lib/marsbar-0.44/@maroi_matrix/matrixdata.m
+++ /dev/null
@@ -1,21 +0,0 @@
-function dat = matrixdata(o, dat)
-% matrixdata method - gets matrix from ROI object
-%
-% $Id$
-
-% a warning here about empty matrices
-if nargin > 1 % call to set matrix data
- % change to maroi_matrix type before setting data
- o = maroi_matrix(o);
-
- % apply implied thresholding
- tmp = find(isnan(dat) | abs(dat) < roithresh(o));
- if binarize(o), dat(:) = 1; end
- dat(tmp) = 0;
-
- o.dat = dat;
- dat = o;
-
-else
- dat = o.dat;
-end
diff --git a/lib/marsbar-0.44/@maroi_matrix/native_space.m b/lib/marsbar-0.44/@maroi_matrix/native_space.m
deleted file mode 100644
index 7065477..0000000
--- a/lib/marsbar-0.44/@maroi_matrix/native_space.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function sp = native_space(obj)
-% native_space method - returns native space of object
-%
-% $Id$
-
-sp = mars_space(size(obj.dat), obj.mat);
diff --git a/lib/marsbar-0.44/@maroi_matrix/private/my_rld.m b/lib/marsbar-0.44/@maroi_matrix/private/my_rld.m
deleted file mode 100644
index 1ae2b32..0000000
--- a/lib/marsbar-0.44/@maroi_matrix/private/my_rld.m
+++ /dev/null
@@ -1,14 +0,0 @@
-function mat = my_rld(rlem, dim)
-% function to do run length decoding
-%
-% $Id$
-
-sz = sum(rlem(:,1));
-mat = zeros(sz, 1);
-st = 1;
-for i = 1:size(rlem, 1)
- tm = zeros(rlem(i,1),1) + rlem(i,2);
- st2 = st + rlem(i,1);
- mat(st:st2-1) = tm;
- st = st2;
-end
diff --git a/lib/marsbar-0.44/@maroi_matrix/private/my_rle.m b/lib/marsbar-0.44/@maroi_matrix/private/my_rle.m
deleted file mode 100644
index c7d925c..0000000
--- a/lib/marsbar-0.44/@maroi_matrix/private/my_rle.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function rlem = my_rle(m)
-% method to do run length encoding on matrix
-%
-% $Id$
-
-m = m(:);
-dps = [1; find(diff(m))+1];
-rlem = [diff([dps; length(m)+1]), m(dps)];
diff --git a/lib/marsbar-0.44/@maroi_matrix/rebase.m b/lib/marsbar-0.44/@maroi_matrix/rebase.m
deleted file mode 100644
index f32b863..0000000
--- a/lib/marsbar-0.44/@maroi_matrix/rebase.m
+++ /dev/null
@@ -1,54 +0,0 @@
-function [pts, vals] = rebase(obj, sp, flags)
-% rebase method - returns data from maroi_matrix in new space
-% Unless flags contains 'i', returns [pts, vals]
-% otherwise returns matrix in new space
-%
-% $Id$
-
-if nargin < 2
- error('Need space to give voxel points');
-end
-if nargin < 3
- flags = '';
-end
-if isempty(flags), flags = ' ';end
-
-sp = mars_space(sp);
-vol = obj.dat;
-mat = spm_mat(obj);
-Hold = spm_hold(obj);
-th = roithresh(obj);
-binf = binarize(obj);
-
-if any(flags == 'i')
- pts = zeros(sp.dim(1:3));
- vals = [];
-else % points call
- pts = cell(1, sp.dim(3));
- multvc = cell(1, sp.dim(3));
-end
-
-for z=1:sp.dim(3),
- M = inv(mat) * sp.mat * spm_matrix([0 0 z]);
- img = spm_slice_vol(vol,M,sp.dim(1:2),Hold);
- tmp = abs(img) >= th;
- img(~tmp) = 0;
- if any(tmp(:))
- if binf, img(tmp) = 1; end
- if any(flags == 'i') % image to return
- pts(:,:,z) = img;
- else % point list
- tmp = find(tmp);
- multvc(z) = {img(tmp)'};
- tmp = tmp-1;
- y = floor(tmp/sp.dim(1));
- x = tmp - (y*sp.dim(1));
- o = ones(1, length(x));
- pts(z) = {[[x y]'+1; o*z]};
- end
- end
-end
-if ~any(flags == 'i')
- pts = [pts{:}];
- vals = [multvc{:}];
-end
diff --git a/lib/marsbar-0.44/@maroi_matrix/saveobj.m b/lib/marsbar-0.44/@maroi_matrix/saveobj.m
deleted file mode 100644
index c6c0706..0000000
--- a/lib/marsbar-0.44/@maroi_matrix/saveobj.m
+++ /dev/null
@@ -1,12 +0,0 @@
-function o = saveobj(o)
-% saveobj function - does run length encoding if helpful
-%
-% $Id$
-
-m = o.dat;
-if isnumeric(m)
- rlem = my_rle(m);
- if prod(size(rlem)) < prod(size(m))
- o.dat = struct('rlem', rlem, 'dim', size(m));
- end
-end
diff --git a/lib/marsbar-0.44/@maroi_matrix/spm_mat.m b/lib/marsbar-0.44/@maroi_matrix/spm_mat.m
deleted file mode 100644
index 52a48aa..0000000
--- a/lib/marsbar-0.44/@maroi_matrix/spm_mat.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function M = spm_mat(obj)
-% spm_mat method - returns mat file defining orientation etc
-%
-% $Id$
-
-M = obj.mat;
diff --git a/lib/marsbar-0.44/@maroi_matrix/voxpts.m b/lib/marsbar-0.44/@maroi_matrix/voxpts.m
deleted file mode 100644
index 34be5a1..0000000
--- a/lib/marsbar-0.44/@maroi_matrix/voxpts.m
+++ /dev/null
@@ -1,9 +0,0 @@
-function [pts, vals] = voxpts(obj, sp)
-% voxpts method - returns 3xN ijk matrix in voxels
-%
-% $Id$
-
-if nargin < 2
- error('Need space to give voxel points');
-end
-[pts, vals] = rebase(obj, sp, '');
diff --git a/lib/marsbar-0.44/@maroi_pointlist/flip_lr.m b/lib/marsbar-0.44/@maroi_pointlist/flip_lr.m
deleted file mode 100644
index 68e9c90..0000000
--- a/lib/marsbar-0.44/@maroi_pointlist/flip_lr.m
+++ /dev/null
@@ -1,8 +0,0 @@
-function o = flip_lr(o)
-% flips ROI left / right
-%
-% $Id$
-
-M = eye(4); M(1) = -1;
-o.mat = M * o.mat;
-o.voxblock = my_voxblock(o.XYZ, o.mat, o.vals);
diff --git a/lib/marsbar-0.44/@maroi_pointlist/getvals.m b/lib/marsbar-0.44/@maroi_pointlist/getvals.m
deleted file mode 100644
index e50812d..0000000
--- a/lib/marsbar-0.44/@maroi_pointlist/getvals.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function v = getvals(o)
-% returns vals for pointlist object
-%
-% $Id$
-
-if ~isempty(o.vals)
- v = o.vals;
-else
- v = ones(1, size(o.XYZ,2));
-end
diff --git a/lib/marsbar-0.44/@maroi_pointlist/is_empty_roi.m b/lib/marsbar-0.44/@maroi_pointlist/is_empty_roi.m
deleted file mode 100644
index 21e437d..0000000
--- a/lib/marsbar-0.44/@maroi_pointlist/is_empty_roi.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function tf = is_empty_roi(o)
-% is_empty_roi - returns true if ROI contains no volume
-%
-% $Id$
-
-tf = isempty(o.XYZ);
diff --git a/lib/marsbar-0.44/@maroi_pointlist/loadobj.m b/lib/marsbar-0.44/@maroi_pointlist/loadobj.m
deleted file mode 100644
index ef35798..0000000
--- a/lib/marsbar-0.44/@maroi_pointlist/loadobj.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function o = loadobj(o)
-% loadobj method - creates temporary voxel block
-%
-% $Id$
-
-o.voxblock = my_voxblock(o.XYZ, o.mat, o.vals);
diff --git a/lib/marsbar-0.44/@maroi_pointlist/maroi_matrix.m b/lib/marsbar-0.44/@maroi_pointlist/maroi_matrix.m
deleted file mode 100644
index 84bc50f..0000000
--- a/lib/marsbar-0.44/@maroi_pointlist/maroi_matrix.m
+++ /dev/null
@@ -1,18 +0,0 @@
-function obj2 = maroi_matrix(obj, space)
-% maroi_matrix method - converts roi to maroi matrix type
-%
-% Without space arg, returns object in native space
-%
-% $Id$
-
-params = paramfields(obj);
-params.dat = obj.voxblock.dat;
-params.mat = obj.voxblock.mat;
-
-% put into maroi_matrix object
-obj2 = maroi_matrix(params);
-
-% rebase using maroi_matrix method if space argument passed
-if nargin > 1
- obj2 = maroi_matrix(obj2, space);
-end
diff --git a/lib/marsbar-0.44/@maroi_pointlist/maroi_pointlist.m b/lib/marsbar-0.44/@maroi_pointlist/maroi_pointlist.m
deleted file mode 100644
index 6daed84..0000000
--- a/lib/marsbar-0.44/@maroi_pointlist/maroi_pointlist.m
+++ /dev/null
@@ -1,83 +0,0 @@
-function [o, others] = maroi_pointlist(params, type)
-% maroi_pointlist - class constructor
-% FORMAT [o, others] = maroi_pointlist(params, type)
-% Inputs [defaults]
-% params - one of
-% structure containing fields XYZ, mat
-%
-% type - one of 'vox', 'real' or 'mm' ['real']
-% ('mm' is the same as 'real')
-% specifies if XYZ matrix is in real (mm) or voxel space
-%
-% $Id$
-
-myclass = 'maroi_pointlist';
-defstruct = struct('XYZ', [],...
- 'mat', eye(4),...
- 'vals',[],...
- 'voxblock',[]);
-
-if nargin < 1
- params = [];
-end
-if nargin < 2
- type = 'real';
-end
-if isa(params, myclass)
- o = params;
- return
-end
-
-% fill with defaults
-pparams = mars_struct('ffillmerge', defstruct, params);
-
-% umbrella object, parse out fields for (this object and children)
-[uo, pparams] = maroi(pparams);
-
-% reparse parameters into those for this object, children
-[pparams, others] = mars_struct('split', pparams, defstruct);
-
-% return if no points passed
-if isempty(pparams.XYZ)
- o = class(pparams, myclass, uo);
- return
-end
-
-% reset points vector if wrong size
-if size(pparams.XYZ, 1) == 1
- pparams.XYZ = pparams.XYZ';
-end
-
-if strcmp(type, 'real') | strcmp(type, 'mm')
- % point list is in real space -> convert
- pparams.XYZ = inv(pparams.mat) * ...
- [pparams.XYZ; ones(1, size(pparams.XYZ,2))];
- pparams.XYZ = pparams.XYZ(1:3,:);
-end
-
-% check that the points are in a sensible voxel space
-tiny = 0.001; % tolerance for non-integer voxel values
-if any(any((abs(pparams.XYZ - round(pparams.XYZ))) > tiny))
- error(['Non integer points in voxel space - ' ...
- 'are points really of type ''' type '''?']);
-end
-pparams.XYZ = round(pparams.XYZ);
-
-% make temporary voxel block for further resampling etc
-pparams.voxblock = my_voxblock(pparams.XYZ, pparams.mat, pparams.vals);
-
-% apply implied thresholding
-if ~isempty(pparams.vals)
- tmp = find(~isnan(pparams.vals) & ...
- abs(pparams.vals) >= roithresh(uo));
- pparams.XYZ = pparams.XYZ(:, tmp);
- if binarize(uo)
- pparams.vals = [];
- else
- pparams.vals = pparams.vals(tmp);
- end
-end
-
-% make object
-o = class(pparams, myclass, uo);
-return
diff --git a/lib/marsbar-0.44/@maroi_pointlist/native_space.m b/lib/marsbar-0.44/@maroi_pointlist/native_space.m
deleted file mode 100644
index de00457..0000000
--- a/lib/marsbar-0.44/@maroi_pointlist/native_space.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function sp = native_space(obj)
-% native_space method - returns native space of object
-%
-% $Id$
-
-sp = mars_space(size(obj.voxblock.dat), obj.voxblock.mat);
diff --git a/lib/marsbar-0.44/@maroi_pointlist/private/my_voxblock.m b/lib/marsbar-0.44/@maroi_pointlist/private/my_voxblock.m
deleted file mode 100644
index 78ea637..0000000
--- a/lib/marsbar-0.44/@maroi_pointlist/private/my_voxblock.m
+++ /dev/null
@@ -1,31 +0,0 @@
-function vblock = my_voxblock(pts, mat, vals)
-% returns voxel block and modified mat file for pointlist
-%
-% $Id$
-
-if isempty(vals)
- vals = ones(1, size(pts,2));
-end
-
-% dimensions of containing block
-st = min(pts, [], 2)';
-fn = max(pts, [], 2)';
-dsz = fn-st+1;
-
-% reset mat according to voxel block
-newM = mat * spm_matrix(st-1);
-
-% set voxels in block
-dat1 = zeros(dsz);
-dpts = pts - (st'-1) * ones(1, size(pts,2));
-dinds = dpts(1,:) + ...
- (dpts(2,:)-1) * dsz(1) + ...
- (dpts(3,:)-1) * dsz(1)*dsz(2);
-dat1(dinds) = vals;
-
-% add a shell of one voxel to isolate from interpolation 0s
-dat = zeros(dsz+2);
-dat(2:end-1,2:end-1,2:end-1) = dat1;
-mat = newM * spm_matrix([-1 -1 -1]);
-
-vblock = struct('dat', dat, 'mat', mat);
diff --git a/lib/marsbar-0.44/@maroi_pointlist/saveobj.m b/lib/marsbar-0.44/@maroi_pointlist/saveobj.m
deleted file mode 100644
index 0960854..0000000
--- a/lib/marsbar-0.44/@maroi_pointlist/saveobj.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function o = saveobj(o)
-% saveobj method - removes temporary voxblock structure
-%
-% $Id$
-
-o.voxblock = [];
diff --git a/lib/marsbar-0.44/@maroi_pointlist/voxpts.m b/lib/marsbar-0.44/@maroi_pointlist/voxpts.m
deleted file mode 100644
index c5b37be..0000000
--- a/lib/marsbar-0.44/@maroi_pointlist/voxpts.m
+++ /dev/null
@@ -1,16 +0,0 @@
-function [pts, vals] = voxpts(o, sp)
-% voxpts method - returns 3xN ijk matrix in voxels
-%
-% $Id$
-
-if nargin < 2
- error('Need space for voxpts call')
-end
-
-sp = mars_space(sp);
-
-% to maroi_matrix object
-mo = maroi_matrix(o);
-
-% and return values
-[pts, vals] = voxpts(mo, sp);
diff --git a/lib/marsbar-0.44/@maroi_shape/c_o_m.m b/lib/marsbar-0.44/@maroi_shape/c_o_m.m
deleted file mode 100644
index d4486cb..0000000
--- a/lib/marsbar-0.44/@maroi_shape/c_o_m.m
+++ /dev/null
@@ -1,23 +0,0 @@
-function pt = c_o_m(o, sp, pt_type)
-% c_o_m method - calculates centre of mass
-%
-% $Id$
-
-if nargin < 2
- sp = '';
-end
-if nargin < 3
- pt_type = 'real';
-end
-pt = centre(o);
-switch pt_type
- case {'real','mm'}
- case 'vox'
- if isempty(sp)
- error('Need space to define voxel centre of mass');
- end
- pt = sp.mat * [pt; 1];
- pt = pt(1:3)';
- otherwise
- error(['Do not recognize point type' pt_type]);
-end
diff --git a/lib/marsbar-0.44/@maroi_shape/has_space.m b/lib/marsbar-0.44/@maroi_shape/has_space.m
deleted file mode 100644
index 24dc41b..0000000
--- a/lib/marsbar-0.44/@maroi_shape/has_space.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function tf = has_space(obj)
-% has_space method - returns true if object has a native space
-%
-% $Id$
-
-tf = 0; % not true of shape object
diff --git a/lib/marsbar-0.44/@maroi_shape/maroi_matrix.m b/lib/marsbar-0.44/@maroi_shape/maroi_matrix.m
deleted file mode 100644
index da33d5c..0000000
--- a/lib/marsbar-0.44/@maroi_shape/maroi_matrix.m
+++ /dev/null
@@ -1,27 +0,0 @@
-function o2 = maroi_matrix(o, space)
-% method to convert shape objects to maroi_matrix objects
-%
-% $Id$
-
-if nargin < 2
- space = [];
-end
-if isempty(space)
- space = native_space(o);
-end
-if isempty(space)
- error('Need space to create maroi_matrix');
-end
-
-params = paramfields(o);
-params.mat = space.mat;
-dim = space.dim(1:3);
-params.dat = zeros(dim);
-
-[pts vals] = voxpts(o, space);
-dinds = pts(1,:) + ...
- (pts(2,:)-1) * dim(1) + ...
- (pts(3,:)-1) * dim(1)*dim(2);
-
-params.dat(dinds) = vals;
-o2 = maroi_matrix(params);
diff --git a/lib/marsbar-0.44/@maroi_shape/maroi_shape.m b/lib/marsbar-0.44/@maroi_shape/maroi_shape.m
deleted file mode 100644
index 8e12ba4..0000000
--- a/lib/marsbar-0.44/@maroi_shape/maroi_shape.m
+++ /dev/null
@@ -1,33 +0,0 @@
-function [o, others] = maroi_shape(params)
-% maroi_shape - (virtual) shape roi class constructor
-% FORMAT [o, others] = maroi_shape(params)
-% Inputs [defaults]
-% params - a structure containing any fields for a maroi parent
-%
-% Only used by inheriting objects
-%
-% $Id$
-
-myclass = 'maroi_shape';
-defstruct = struct('shape', []);
-
-if nargin < 1
- params = [];
-end
-if isa(params, myclass)
- o = params;
- return
-end
-
-% fill with defaults
-pparams = mars_struct('ffillmerge', defstruct, params);
-
-% umbrella object, parse out fields for (this object and children)
-[uo, pparams] = maroi(pparams);
-
-% reparse parameters into those for this object, children
-[pparams, others] = mars_struct('split', pparams, defstruct);
-
-o = class(pparams, myclass, uo);
-
-return
diff --git a/lib/marsbar-0.44/@maroi_sphere/centre.m b/lib/marsbar-0.44/@maroi_sphere/centre.m
deleted file mode 100644
index a5d21e1..0000000
--- a/lib/marsbar-0.44/@maroi_sphere/centre.m
+++ /dev/null
@@ -1,9 +0,0 @@
-function c = centre(obj, val)
-% centre method - sets / returns centre of ROI in mm
-%
-% $Id$
-
-if nargin > 1
- obj.centre = val;
-end
-c = obj.centre;
diff --git a/lib/marsbar-0.44/@maroi_sphere/flip_lr.m b/lib/marsbar-0.44/@maroi_sphere/flip_lr.m
deleted file mode 100644
index e86c9c3..0000000
--- a/lib/marsbar-0.44/@maroi_sphere/flip_lr.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function o = flip_lr(o)
-% flips ROI left / right
-%
-% $Id$
-
-o.centre(1) = o.centre(1)*-1;
diff --git a/lib/marsbar-0.44/@maroi_sphere/is_empty_roi.m b/lib/marsbar-0.44/@maroi_sphere/is_empty_roi.m
deleted file mode 100644
index 520a0a4..0000000
--- a/lib/marsbar-0.44/@maroi_sphere/is_empty_roi.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function tf = is_empty_roi(o)
-% is_empty_roi - returns true if ROI contains no volume
-%
-% $Id$
-
-tf = isempty(o.centre);
diff --git a/lib/marsbar-0.44/@maroi_sphere/maroi_sphere.m b/lib/marsbar-0.44/@maroi_sphere/maroi_sphere.m
deleted file mode 100644
index d742c9d..0000000
--- a/lib/marsbar-0.44/@maroi_sphere/maroi_sphere.m
+++ /dev/null
@@ -1,40 +0,0 @@
-function [o, others] = maroi_sphere(params)
-% maroi_sphere - class constructor
-% FORMAT [o, others] = maroi_sphere(params)
-% Inputs [defaults]
-% params - a structure containing any fields for a maroi parent and
-% .centre - a 1x3 coordinate in mm
-% .radius - a 1x1 radius in mm
-%
-%
-% $Id$
-
-myclass = 'maroi_sphere';
-defstruct = struct('centre', [0 0 0],'radius', 0);
-
-if nargin < 1
- params = [];
-end
-if isa(params, myclass)
- o = params;
- return
-end
-
-% fill with defaults
-pparams = mars_struct('ffillmerge', defstruct, params);
-
-% umbrella object, parse out fields for (this object and children)
-[uo, pparams] = maroi_shape(pparams);
-
-% reparse parameters into those for this object, children
-[pparams, others] = mars_struct('split', pparams, defstruct);
-
-% check resulting input
-if size(pparams.centre, 2) == 1
- pparams.centre = pparams.centre';
-end
-% enforce radius as double for vox->mm conversions
-pparams.radius = double(pparams.radius)
-
-o = class(pparams, myclass, uo);
-return
diff --git a/lib/marsbar-0.44/@maroi_sphere/volume.m b/lib/marsbar-0.44/@maroi_sphere/volume.m
deleted file mode 100644
index 42c44f6..0000000
--- a/lib/marsbar-0.44/@maroi_sphere/volume.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function v = volume(obj)
-% volume method - returns volume of ROI in mm
-%
-% $Id$
-
-v = (4/3*pi)*obj.radius^3;
diff --git a/lib/marsbar-0.44/@maroi_sphere/voxpts.m b/lib/marsbar-0.44/@maroi_sphere/voxpts.m
deleted file mode 100644
index c75b0fb..0000000
--- a/lib/marsbar-0.44/@maroi_sphere/voxpts.m
+++ /dev/null
@@ -1,26 +0,0 @@
-function [pts, vals] = voxpts(obj, sp)
-% voxpts method - voxels within a sphere in given space
-%
-% $Id$
-
-if nargin < 2
- error('Need object and space arguments');
-end
-sp = mars_space(sp);
-
-mc = obj.centre;
-mr = obj.radius;
-
-% find voxels that are within sphere
-vox = sqrt(sum(sp.mat(1:3,1:3)'.^2));
-vr = mr ./ vox;
-vc = sp.mat \ [mc(1:3) 1]';
-vc = vc(1:3)';
-blim = [max([1 1 1; ceil(vc-vr)]); min([sp.dim(1:3); floor(vc+vr)])];
-[R,C,P]=ndgrid(...
- blim(1,1):blim(2,1),blim(1,2):blim(2,2),blim(1,3):blim(2,3));
-vXYZ = [R(:)';C(:)';P(:)'];
-o = ones(1, size(vXYZ, 2));
-pts = find(sqrt(sum(((vXYZ-(vc'*o)) .* (vox'*o)).^2)) <= mr);
-pts = vXYZ(:,pts);
-vals = ones(1, size(pts, 2));
diff --git a/lib/marsbar-0.44/@mars_space/display.m b/lib/marsbar-0.44/@mars_space/display.m
deleted file mode 100644
index 7c3e845..0000000
--- a/lib/marsbar-0.44/@mars_space/display.m
+++ /dev/null
@@ -1,19 +0,0 @@
-function display(obj)
-% display method for mars_space object
-%
-% $Id$
-
-X = struct(obj);
-src = ['[mars_space object]'];
-if isequal(get(0,'FormatSpacing'),'compact')
- disp([inputname(1) ' =']);
- disp(src);
- disp(X)
-else
- disp(' ')
- disp([inputname(1) ' =']);
- disp(' ');
- disp(src);
- disp(' ');
- disp(X)
-end
diff --git a/lib/marsbar-0.44/@mars_space/eq.m b/lib/marsbar-0.44/@mars_space/eq.m
deleted file mode 100644
index ac6e905..0000000
--- a/lib/marsbar-0.44/@mars_space/eq.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function tf = eq(sp1, sp2)
-% overloaded eq method for mars_space objects
-%
-% $Id$
-
-if all(sp1.dim == sp2.dim) & all((abs(sp1.mat(:) - sp2.mat(:)))< eps)
- tf = 1;
-else
- tf = 0;
-end
diff --git a/lib/marsbar-0.44/@mars_space/mars_space.m b/lib/marsbar-0.44/@mars_space/mars_space.m
deleted file mode 100644
index c463299..0000000
--- a/lib/marsbar-0.44/@mars_space/mars_space.m
+++ /dev/null
@@ -1,61 +0,0 @@
-function [o, others] = mars_space(params, params2)
-% mars_space - class constructor for space defining object
-% FORMAT [o, others] = mars_space(params, params2)
-% Inputs [defaults]
-% params - either
-% a structure, containing fields to construct the object
-% an spm vol struct (see spm_vol)
-% a string, giving and image name (see spm_vol)
-% a matrix (for which, only the dimensions are used)
-% a 3x1 or 1x3 dimension vector
-% params2 in the latter 2 cases, might contain a 4x4 transformation matrix
-% [eye(4)]
-%
-% $Id$
-
-myclass = 'mars_space';
-defstruct = struct('dim', [1 1 1],...
- 'mat', eye(4));
-
-if nargin < 1
- params = [];
-end
-if nargin < 2
- params2 = [];
-end
-if isa(params, myclass)
- o = params;
- return
-end
-
-% check inputs
-if ~isstruct(params)
- % Matlab 7 does not like assigment of struct to non empty var
- inp1 = params;
- clear params;
- if ischar(inp1) % maybe it is an image filename
- params = spm_vol(inp1);
- params.dim = params.dim(1:3);
- elseif prod(size(inp1)) == 3
- % could be the dimensions of a space
- params.dim = inp1(:)';
- if ~isempty(params2), params.mat = params2; end
- else
- % lets hope it's a useful matrix, but with a mat parameter, quoi
- if isempty(params2)
- error(['Need to pass a ''mat'' definition with a'...
- ' matrix'])
- end
- params.mat = params2;
- m = inp1;
- sz = size(m);
- params.dim = [1 1 1];
- params.dim(1:length(sz)) = sz;
- end
-end
-
-% fill with defaults, parse into fields for this object, children
-[pparams, others] = mars_struct('ffillsplit', defstruct, params);
-
-o = class(pparams, myclass);
-return
diff --git a/lib/marsbar-0.44/@mars_space/subsasgn.m b/lib/marsbar-0.44/@mars_space/subsasgn.m
deleted file mode 100644
index b795ded..0000000
--- a/lib/marsbar-0.44/@mars_space/subsasgn.m
+++ /dev/null
@@ -1,7 +0,0 @@
-function result = subsasgn(this, Struct, rhs)
-% method to over load . notation in assignments.
-% Publicize subscripted assignments to private fields of object.
-%
-% $Id$
-
-result = builtin('subsasgn', this, Struct, rhs );
diff --git a/lib/marsbar-0.44/@mars_space/subsref.m b/lib/marsbar-0.44/@mars_space/subsref.m
deleted file mode 100644
index f668346..0000000
--- a/lib/marsbar-0.44/@mars_space/subsref.m
+++ /dev/null
@@ -1,7 +0,0 @@
-function result = subsref(this, Struct)
-% method to overload the . notation.
-% Publicize subscripted reference to private fields of object.
-%
-% $Id$
-
-result = builtin('subsref', this, Struct );
diff --git a/lib/marsbar-0.44/@marsy/as_summary_only.m b/lib/marsbar-0.44/@marsy/as_summary_only.m
deleted file mode 100644
index 1ec76aa..0000000
--- a/lib/marsbar-0.44/@marsy/as_summary_only.m
+++ /dev/null
@@ -1,19 +0,0 @@
-function out_o = as_summary_only(o)
-% returns object with region data removed
-%
-% Useful to save memory
-if ~is_summarized(o)
- out_o = resummarize(o);
-else
- out_o = o;
-end
-st = y_struct(o);
-if ~isfield(st, 'regions')
- return
-end
-for rno = 1:length(st.regions)
- st.regions{rno} = mars_struct('strip', st.regions{rno}, ...
- {'Y', 'weights','vXYZ'});
-end
-out_o = y_struct(out_o, st);
-return
diff --git a/lib/marsbar-0.44/@marsy/block_rows.m b/lib/marsbar-0.44/@marsy/block_rows.m
deleted file mode 100644
index b6d6267..0000000
--- a/lib/marsbar-0.44/@marsy/block_rows.m
+++ /dev/null
@@ -1,26 +0,0 @@
-function r = block_rows(Y, rows)
-% gets/sets cell array of rows for each (subject/session) block
-%
-% $Id$
-
-ys = y_struct(Y);
-n = n_time_points(Y);
-if nargin < 2 % get
- if ~isfield(ys, 'block_rows')
- r = {[1:n]'};
- else
- r = ys.block_rows;
- end
-else % set
- if ~iscell(rows)
- error('Need cell array of matrices for blocks');
- end
- for i = 1:prod(size(rows))
- rows{i} = rows{i}(:);
- if any(rows{i} < 1 | rows{i} > n)
- error(sprintf('Row %d: values out of range', i));
- end
- end
- ys.block_rows = rows;
- r = y_struct(Y, ys);
-end
diff --git a/lib/marsbar-0.44/@marsy/can_summarize.m b/lib/marsbar-0.44/@marsy/can_summarize.m
deleted file mode 100644
index 567d300..0000000
--- a/lib/marsbar-0.44/@marsy/can_summarize.m
+++ /dev/null
@@ -1,17 +0,0 @@
-function tf = can_summarize(o)
-% returns 1 if object contains enough information to be summarized
-% or is already summarized
-%
-% $Id$
-
-tf = 1;
-if is_summarized(o), return, end
-for i = 1:n_regions(o);
- r_samp = region_size(o, i, 2);
- if r_samp > 1 % at least one region needs summarizing
- % check for summary function
- s = sumfunc(o);
- tf = ~isempty(s) & ~strcmp(s, 'unknown');
- break
- end
-end
diff --git a/lib/marsbar-0.44/@marsy/display.m b/lib/marsbar-0.44/@marsy/display.m
deleted file mode 100644
index 38929c6..0000000
--- a/lib/marsbar-0.44/@marsy/display.m
+++ /dev/null
@@ -1,35 +0,0 @@
-function display(obj)
-% display method for marsy objects
-%
-% $Id$
-
-src = '[MarsBaR data object]';
-if length(obj) > 1 % array of objects
- sz = size(obj);
- src = sprintf('%d by %d array of %s', sz(1), sz(2), src);
- if isequal(get(0,'FormatSpacing'),'compact')
- disp([inputname(1) ' =']);
- disp(src);
- else
- disp(' ')
- disp([inputname(1) ' =']);
- disp(' ');
- disp(src);
- disp(' ');
- end
-else % single object
- X = char(summary(obj));
- if isequal(get(0,'FormatSpacing'),'compact')
- disp([inputname(1) ' =']);
- disp(src);
- disp(X)
- else
- disp(' ')
- disp([inputname(1) ' =']);
- disp(' ');
- disp(src);
- disp(' ');
- disp(X)
- disp(' ');
- end
-end
diff --git a/lib/marsbar-0.44/@marsy/eq.m b/lib/marsbar-0.44/@marsy/eq.m
deleted file mode 100644
index 084fe8b..0000000
--- a/lib/marsbar-0.44/@marsy/eq.m
+++ /dev/null
@@ -1,19 +0,0 @@
-function tf = eq(Y1, Y2)
-% method overrides == operator
-%
-% $Id$
-
-tf = 0;
-if ~isa(Y1, 'marsy') | ~isa(Y2, 'marsy'), return, end
-if ~all(summary_size(Y1) == summary_size(Y2)), return, end
-if is_summarized(Y1) ~= is_summarized(Y2), return, end
-if is_summarized(Y1)
- y1 = summary_data(Y1);
- y2 = summary_data(Y2);
-else
- y1 = region_data(Y1);
- y1 = [y1{:}];
- y2 = region_data(Y2);
- y2 = [y2{:}];
-end
-tf = all(all(y1 == y2));
diff --git a/lib/marsbar-0.44/@marsy/is_summarized.m b/lib/marsbar-0.44/@marsy/is_summarized.m
deleted file mode 100644
index 3b9f370..0000000
--- a/lib/marsbar-0.44/@marsy/is_summarized.m
+++ /dev/null
@@ -1,7 +0,0 @@
-function tf = is_summarized(o)
-% returns 1 if object contains calculated summary data
-%
-% $Id$
-
-st = y_struct(o);
-tf = isfield(st, 'Y') & isfield(st, 'Yvar');
diff --git a/lib/marsbar-0.44/@marsy/is_summary_only.m b/lib/marsbar-0.44/@marsy/is_summary_only.m
deleted file mode 100644
index c84c977..0000000
--- a/lib/marsbar-0.44/@marsy/is_summary_only.m
+++ /dev/null
@@ -1,16 +0,0 @@
-function tf = is_summary_only(o)
-% method returns 1 if object only contains summary data
-%
-% $Id$
-
-tf = 0;
-st = y_struct(o);
-if isfield(st, 'Y')
- if ~isfield(st, 'regions')
- tf = 1;
- else
- Y = region_data(o);
- Y = [Y{:}];
- tf = size(Y, 2) == size(st.Y, 2);
- end
-end
diff --git a/lib/marsbar-0.44/@marsy/is_valid.m b/lib/marsbar-0.44/@marsy/is_valid.m
deleted file mode 100644
index f1ec099..0000000
--- a/lib/marsbar-0.44/@marsy/is_valid.m
+++ /dev/null
@@ -1,7 +0,0 @@
-function tf = is_valid(o)
-% method returns 1 if object contains valid data
-%
-% $Id$
-
-st = y_struct(o);
-tf = isfield(st, 'Y') | isfield(st, 'regions');
diff --git a/lib/marsbar-0.44/@marsy/join.m b/lib/marsbar-0.44/@marsy/join.m
deleted file mode 100644
index 9601b0f..0000000
--- a/lib/marsbar-0.44/@marsy/join.m
+++ /dev/null
@@ -1,66 +0,0 @@
-function o = join(varargin)
-% joins marsy objects into one object
-%
-% $Id$
-
-% assemble all input object into a cell array
-% (deals with arrays of objects)
-o_c_a = {};
-ctr = 0;
-n_n = [];
-for v = 1:nargin
- o_arr = varargin{v};
- for i = 1:prod(size(o_arr))
- ctr = ctr + 1;
-
- % Check number of time points
- n = n_time_points(o_arr(i));
- if isempty(n_n), n_n = n;
- else
- if n ~= n_n
- error(sprintf(...
- 'Regions %d and %d have different numbers of time points',...
- ctr, ctr-1));
- end
- end
-
- o_c_a{ctr} = o_arr(i);
- end
-end
-
-o = o_c_a{1};
-want_sum_f = 1;
-sum_func = sumfunc(o);
-regions = {};
-Y = [];
-Yvar = [];
-for i = 1:ctr
- o_a = o_c_a{i};
- if want_sum_f
- % if summary function differs from other
- % objects, abort collecting summary data
- if ~strcmp(sum_func,sumfunc(o_a)) | ...
- ~can_summarize(o_a)
- want_sum_f = 0;
- else
- if ~is_summarized(o_a)
- o_a = resummarize(o_a);
- end
- [t1 t2] = summary_data(o_a);
- Y = [Y t1];
- Yvar = [Yvar t2];
- end
- end
- regions = [regions region(o_a)];
-end
-
-st = y_struct(o);
-if want_sum_f
- st.Y = Y;
- st.Yvar = Yvar;
- st.sumfunc = sum_func;
-else
- st = mars_struct('strip', st, {'Y','Yvar','sumfunc'});
-end
-st.regions = regions;
-o = y_struct(o, st);
diff --git a/lib/marsbar-0.44/@marsy/marsy.m b/lib/marsbar-0.44/@marsy/marsy.m
deleted file mode 100644
index 05c1905..0000000
--- a/lib/marsbar-0.44/@marsy/marsy.m
+++ /dev/null
@@ -1,358 +0,0 @@
-function [o,others] = marsy(params, region_stuff, summary_stuff)
-% Class constructor for marsy: the MarsBaR data object
-% FORMAT [o,others] = marsy(params, region_stuff, summary_stuff)
-%
-% Synopsis:
-% % Some example data
-% Y = rand(100, 10);
-%
-% % Use data as time courese from 10 regions
-% m_Y = marsy(Y);
-%
-% % Use data as 10 samples (voxels from one region)
-% m_Y = marsy({Y}, 'region_1', 'mean');
-%
-% % Extract data for ROI 'my_roi', from list (string array) of images P
-% m_Y = get_marsy(my_roi, P, 'mean'); % method for maroi (region) object
-%
-% Inputs
-% params - can be: structure, either:
-% containing MarsBaR data structure or
-% containing fields for marsy object, which should include
-% 'y_struct', containing data structure
-% OR: filename, which loads to give structure as above
-% OR: 2D matrix, containing summary data (Y) only (see below)
-% OR: cell array of 2D matrices, one per region
-%
-% region_stuff - (optional) cell array of names for regions
-% or array of structures containing information for
-% regions
-% or cell array of structures with information
-% Structure can have fields;
-% name - string identifying region
-% descrip - longer description of region
-% Y - matrix of samples (voxel data) for this
-% region, size N by S1 for region 1, N by S2 for
-% region 2 etc.
-% weights - weighting vector, one value for each sample
-% 1..S1 (for region 1) etc.
-% Can be empty, so each sample has weight 1.
-% info - structure containing any other fields of
-% interest
-% vXYZ - any voxel coordinates in X Y Z dimension
-% (3 by S1 for region 1 etc).
-% mat - a 4x4 transformation matrix giving coordinates
-% in mm from voxel coordinates in vXYZ
-%
-% summary_stuff - (optional) summary function to summarize data (string)
-% or structure containing information for summary data
-% Structure can have fields;
-% sumfunc - the summary function used to summarize the
-% samples (voxels) per time point; a string,
-% which is usually one of 'mean', 'median',
-% 'wtmean', 'eigen1', or 'unknown'
-% descrip - text field describing the origin of the data
-% info - a structure with fields defining any other
-% interesting information about the region
-% block_rows - optional cell array, specifying the rows in
-% the data that correspond to a particular
-% session or subject (see below). If absent, the
-% data is assumed to come from a single session
-% or subject.
-%
-% Any data in region_stuff, summary info will overwrite region or summary
-% information passed in the first argument
-%
-% Outputs
-% o - marsy object
-% others - any unrecognized fields from params, for processing by
-% (as yet non-existent) children
-%
-% marsy is an object to contain MarsBaR data structures.
-%
-% The marsy object contains data for one or more ROIs. It offers two
-% possible views of the data; the SUMMARY view, which gives one summary time
-% course for each ROI, and the REGION view, which gives all the timecourses
-% available from the ROI. For example, most ROIs contain more than one
-% voxel, and, in the REGION view, there will be one time course for each
-% voxel. In the SUMMARY view, all the data for a single region, for each
-% timepoint, are combined with a summary function, to give one
-% representative value per time point, and therefore a single time course
-% for the whole ROI. The most common summary function would be the mean of
-% all the samples (voxels) at each time point, but there are others (see
-% below).
-%
-% At its simplest, the marsy object can just contain a single time-course
-% for a single ROI. In this case the summary and region view will be
-% the same.
-%
-% It can also contain data for more than one ROI, and more than one
-% time course per region. In this case the object needs to know how to
-% summarize the timecourses for the ROIs to give the summary view.
-%
-% Let's call the number of regions R
-% All regions in the structure have data with the same number of time points
-% Let's call the number of time points N
-% For each region there may be many samples at each time point.
-% For example, there is usually one sample from each voxel in the ROI.
-% Let's call the number of samples (voxels) per time point S1..SR for
-% regions 1..R.
-%
-% Thus, the summary view will give an N by R matrix, with one row for
-% each ROI. The region view, for (say) region 2, will return all the
-% samples for ROI 2, an N by S2 matrix.
-%
-% The regions may also be associated with names, for interpreting output and
-% to help remember where the data has come from. They may also (optionally)
-% be associated with a longer text description ('descrip'), and any fields
-% you the user think may be useful (contained in 'info').
-%
-% You can also (optionally) set text description and info data for the
-% whole object, for examnple specifying where (all) the data was
-% extraxcted from.
-%
-% The data can come from several sessions or subjects. Optionally, this
-% can be specified with the summary data field 'block_rows', specifying
-% which rows in the data correspond to which session or subject
-%
-% The object contains a data structure of a particular format, listed in
-% the programmer's help for this function. Please avoid using this
-% structure directly, as this format may change at any time. Instead,
-% please use the public methods listed below
-%
-% Methods
-% verbose - get/set whether reporting is verbose or not (1 or 0)
-% summary_data - gets (N by R) summary matrix Y
-% summary_descrip - gets/sets description of object
-% summary_stuff - gets/sets information field of object
-% resummarize - recalculates summary data if possible
-% is_summarized - returns 1 if data has been summarized already
-% can_summarize - returns 1 if data can be suumarized without error
-% sumfunc - gets/sets summary function to summarize data
-% block_rows - gets/sets information on rows corresponding to
-% sessions/subjects
-% n_regions - gets number of regions (R above)
-% n_time_points - gets number of time points (N above)
-% ui_plot - a variety of plots of the data to SPM interface
-% save_struct - saves y_struct to disk as structure
-%
-% region - returns region structure, filled with defaults as necessary
-% region_data - gets region sample (voxel) data as cell array; returns
-% all regions if no region number specificed, or one cell
-% per region if region numbers are specified
-% region_weights - as above, but for region weighting vector (see above)
-% region_name - gets cell array of region names as 1 by R cell array
-% (if no region number is specified) or single cell string
-% if a single region is specified
-% region_descrip - gets cell array of descriptions of specified region
-% region_stuff - gets cell array of info field of specified region
-% xyz - gets voxel or mm XYZ coordinates of given region
-% join - accepts several marsy objects, and merges into one (if
-% possible)
-% split - splits object into array of objects, with one element
-% for each region
-%
-% Other methods (to avoid)
-% y_struct - sets or gets data structure
-%
-% $Id$
-
-% Programmer's help
-%
-% Please see the caveats in the main help about using the object
-% structure to access the object data.
-%
-% Fields
-% ------
-%
-% y_struct - structure containing MarsBaR data structure
-% verbose - flag for verbose messages while working
-%
-% The MarsBaR data structure
-% --------------------------
-%
-% The data structure contains fields:
-% Y - matrix of summary time courses, N by R
-% Yvar - matrix of summary time course variance, over samples for
-% each time point (usually voxels) - N by R
-% (the marsbar code does not currently use Yvar)
-% sumfunc - the summary function used to summarize the samples (voxels)
-% per time point; a string, which is usually one of
-% 'mean', 'median', 'wtmean', 'eigen1', or 'unknown'
-% descrip - text field describing the origin of the data (optional)
-% info - a structure defining any other interesting information
-% about where the data came from
-%
-% regions - cell array of structures, with one element per region (and
-% therefore one element per column in the Y field).
-% Regions is a cell array to allow different fields to be
-% filled for each region
-% Each structure in the cell array has fields
-% name - string identifying region
-% descrip - longer description of region
-% Y - matrix of samples (voxel data) for this region, size
-% N by S1 for region 1, N by S2 for region 2 etc.
-% weights - weighting vector, one value for each sample 1..S1
-% can be empty, so each sample has weight 1.
-% info - structure containing any other fields of interest
-% vXYZ - any voxel coordinates in X Y Z dimension
-% (3 by S1 for region 1 etc).
-% mat - a 4x4 transformation matrix giving coordinates in
-% mm from voxel coordinates in vXYZ
-
-myclass = 'marsy';
-defstruct = struct('y_struct', [],...
- 'verbose', 1);
-
-if nargin < 1
- params = [];
-end
-if isa(params, myclass)
- o = params;
- return
-end
-if nargin < 2
- region_stuff = [];
-end
-if nargin < 3
- summary_stuff = [];
-end
-
-% check first input
-if ischar(params) % maybe filename
- params = load(params);
-end
-switch class(params)
- case 'marsy'
- % pass quietly through
- o = params;
- return
- case 'struct'
- if ~isfield(params, 'y_struct')
- % Appears to be an MarsBaR data structure
- params = struct('y_struct',params);
- end
-
- % need to process old data structure format here
- if isfield(params.y_struct, 'cols')
- params.y_struct = sf_convert_0p23(params.y_struct);
- end
- case {'double','float'}
- % direct set of summary data call
- params = struct('y_struct', ...
- struct('Y', ...
- params, 'Yvar', ...
- params * Inf, ...
- 'sumfunc', 'unknown'));
- case 'cell'
- % specifying region data
- n = size(params{1}, 1);
- for i = 1:length(params)
- n2 = size(params{i}, 1);
- if any(n - n2)
- error('All regions must have the same number of time points');
- end
- if isstruct(params{i})
- regions{i} = params{i};
- else
- regions{i} = struct('Y', params{i});
- end
- end
- params = struct('y_struct', struct('regions', {regions}));
- otherwise
- error('Unexpected data type for first input');
-end
-
-% get number of regions
-R = NaN;
-st = params.y_struct;
-if isfield(st, 'Y')
- R = size(st.Y);
-elseif isfield(st, 'regions')
- R = length(st.regions);
-end
-
-% process further inputs
-if ~isempty(region_stuff)
- % region_stuff has been specified
- if ischar(region_stuff)
- region_stuff = {region_stuff};
- end
- if ~isnan(R)
- if length(region_stuff) ~= R
- error('region_stuff should have one entry per region');
- end
- end
- if iscell(region_stuff) & ischar(region_stuff{1}) % names only
- tmp = region_stuff; region_stuff = cell(size(region_stuff));
- for i = 1:length(tmp)
- region_stuff{i}.name = tmp{i};
- end
- end
- if isstruct(region_stuff) % need a cell array
- tmp = region_stuff; region_stuff = cell(size(region_stuff));
- for i = 1:length(tmp)
- region_stuff{i} = tmp(i);
- end
- end
-
- % set
- if ~isfield(params.y_struct, 'regions')
- params.y_struct.regions = cell(1, length(region_stuff));
- end
- for i = 1:length(region_stuff)
- params.y_struct.regions{i} = mars_struct('ffillmerge', ...
- params.y_struct.regions{i},...
- region_stuff{i});
- end
-end
-
-if ~isempty(summary_stuff)
- % summary_stuff has been specified
- if ischar(summary_stuff) % sumfunc only
- summary_stuff = struct('sumfunc', summary_stuff);
- end
- params.y_struct = mars_struct('ffillmerge', ...
- params.y_struct, ...
- summary_stuff);
-end
-
-% fill with defaults, parse into fields for this object, children
-[pparams, others] = mars_struct('ffillsplit', defstruct, params);
-
-% add version tag (was CVS; now marsbar version)
-pparams.cvs_version = marsbar('ver');
-
-% set the marsy object
-o = class(pparams, myclass);
-
-% calculate summary data if possible
-o = resummarize(o);
-
-return
-
-% Subfunctions
-
-% convert structure from MarsBaR <= 0.23
-function o_st = sf_convert_0p23(i_st)
-if ~isfield(i_st, 'cols')
- o_st = i_st;
- return
-end
-for r = 1:length(i_st.cols)
- col = i_st.cols{r};
- regions{r} = struct('name', col.name,...
- 'descrip', col.descrip,...
- 'Y', col.y,...
- 'weights', [],...
- 'info', struct('file', col.file),...
- 'vXYZ', [], ...
- 'mat', []);
-end
-o_st = struct('Y', i_st.Y,...
- 'Yvar', i_st.Yvar,...
- 'regions', {regions},...
- 'sumfunc', i_st.sumfunc,...
- 'descrip', 'Data from MarsBaR <= 0.23',...
- 'info', []);
-return
diff --git a/lib/marsbar-0.44/@marsy/n_blocks.m b/lib/marsbar-0.44/@marsy/n_blocks.m
deleted file mode 100644
index f99fb74..0000000
--- a/lib/marsbar-0.44/@marsy/n_blocks.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function n = n_blocks(Y)
-% method returns number of subjects/sessions in data
-%
-% $Id$
-
-n = length(block_rows(Y));
diff --git a/lib/marsbar-0.44/@marsy/n_regions.m b/lib/marsbar-0.44/@marsy/n_regions.m
deleted file mode 100644
index 3166f28..0000000
--- a/lib/marsbar-0.44/@marsy/n_regions.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function n = n_regions(o)
-% get number of regions
-%
-% $Id$
-
-n = summary_size(o, 2);
diff --git a/lib/marsbar-0.44/@marsy/n_time_points.m b/lib/marsbar-0.44/@marsy/n_time_points.m
deleted file mode 100644
index a974f70..0000000
--- a/lib/marsbar-0.44/@marsy/n_time_points.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function n = n_time_points(o)
-% get number of time_points
-%
-% $Id$
-
-n = summary_size(o, 1);
diff --git a/lib/marsbar-0.44/@marsy/ne.m b/lib/marsbar-0.44/@marsy/ne.m
deleted file mode 100644
index 5b7483d..0000000
--- a/lib/marsbar-0.44/@marsy/ne.m
+++ /dev/null
@@ -1,6 +0,0 @@
-function tf = ne(Y1, Y2)
-% method overrides ~= operator
-%
-% $Id$
-
-tf = ~eq(Y1, Y2);
diff --git a/lib/marsbar-0.44/@marsy/private/pr_sum_func.m b/lib/marsbar-0.44/@marsy/private/pr_sum_func.m
deleted file mode 100644
index 967e398..0000000
--- a/lib/marsbar-0.44/@marsy/private/pr_sum_func.m
+++ /dev/null
@@ -1,74 +0,0 @@
-function [sumY, varY] = pr_sum_func(y, sumfunc, wt)
-% creates summary stats for region data
-% FORMAT [sumY, varY] = pr_sum_func(y, sumfunc, wt)
-%
-% $Id$
-
-if nargin < 2
- error('Need data matrix and summary function');
-end
-[m n] = size(y);
-if any([m n] == 0)
- error('Data vector is empty');
-end
-if nargin < 3
- wt = [];
-end
-if isempty(wt)
- wt = ones(n,1);
-end
-if size(wt,1)==1
- wt = wt';
-end
-if n == 1 % only 1 sample in ROI
- sumY = y; varY = y*Inf;
- return
-end
-
-varY = ones(m,1) * Inf;
-switch sumfunc
- case 'mean'
- sumY = mean(y, 2);
- ssy = sum(y.^2, 2);
- varY = (ssy - n*sumY.^2)/(n-1);
- case 'wtmean'
- % Formulae from GNU scientific library
- % $\hat\mu = (\sum w_i x_i) / (\sum w_i)$
- % \hat\sigma^2 = ((\sum w_i)/((\sum w_i)^2 - \sum (w_i^2)))
- % \sum w_i (x_i - \hat\mu)^2$
- swt = sum(wt);
- sumY = y*wt/swt;
- varY = (swt/(swt.^2 - wt'*wt)) * ((y - (sumY * ones(1,n))).^2 * wt);
-
- % original formula
- %nwt = sum(wt ~= 0);
- %varY = (y - (sumY * ones(1,n))).^2 * wt / ((nwt-1) * swt / nwt);
- case 'median'
- sumY = median(y, 2);
- case 'eigen1'
- % code taken from spm_regions.m l 230-247, with thanks
- % @(#)spm_regions.m 2.7 Karl Friston 00/10/04
-
-% compute regional response in terms of first eigenvariate
-%-----------------------------------------------------------------------
-if m > n
- [v s v] = svd(spm_atranspa(y));
- s = diag(s);
- v = v(:,1);
- u = y*v/sqrt(s(1));
-else
- [u s u] = svd(spm_atranspa(y'));
- s = diag(s);
- u = u(:,1);
- v = y'*u/sqrt(s(1));
-end
-d = sign(sum(v));
-u = u*d;
-v = v*d;
-sumY = u*sqrt(s(1)/n);
-
-% end of paste from spm_regions
-
- otherwise
- error(['Do not recognize summary function ' sumfunc]);
-end
diff --git a/lib/marsbar-0.44/@marsy/region.m b/lib/marsbar-0.44/@marsy/region.m
deleted file mode 100644
index c2ff1e3..0000000
--- a/lib/marsbar-0.44/@marsy/region.m
+++ /dev/null
@@ -1,123 +0,0 @@
-function [rs,r_nos] = region(o, r_nos, new_data, fieldname)
-% gets / sets data for region or regions
-% FORMAT [rs r_nos] = region(o, r_nos) (set) OR
-% FORMAT [rs r_nos]= region(o, r_nos, new_data, fieldname) (get)
-%
-% Inputs
-% o - marsy object
-% r_nos - region number
-% or array of region numbers
-% or empty - giving all regions
-% new_data - cell array containing new data to set for region
-% fieldname - optional string, to identify field to be set
-% using data in new_data
-%
-% Returns
-% (get call)
-% rs - cell array of region structures
-% (set_call)
-% rs - new marsy object with fields set
-%
-% r_nos - region nos (empty now -> all region nos)
-%
-% $Id$
-
-r = n_regions(o);
-if nargin < 2
- r_nos = [];
-end
-if isempty(r_nos)
- r_nos = 1:r;
-end
-if any(r_nos > r)
- error('Region numbers too large');
-end
-
-st = y_struct(o);
-r_f = isfield(st, 'regions');
-y_f = isfield(st, 'Y');
-def_r_st = struct('name', '',...
- 'descrip', '',...
- 'Y', [],...
- 'weights', [],...
- 'info', [],...
- 'vXYZ', [],...
- 'mat', []);
-sum_func = sumfunc(o);
-r_len = length(r_nos);
-
-if nargin < 3
- % get call
- if ~r_len, rs = {}; return, end
- for i = 1:r_len
- r_st = [];
- if r_f
- r_st = st.regions{r_nos(i)};
- end
- r_st = mars_struct('fillafromb', def_r_st, r_st);
- if isempty(r_st.Y)
- if y_f
- r_st.Y = st.Y(:,r_nos(i));
- end
- end
- rs{i} = r_st;
- end
- return
-end
-
-% set call
-if nargin > 3
- % field name specified
- if ~ismember(fieldname, fieldnames(def_r_st))
- error(['Funny data field passed: ' fieldname]);
- end
-end
-
-if ~iscell(new_data), new_data = {new_data}; end
-if length(new_data) ~= r_len
- error('Different numbers of new data cells and regions');
-end
-if ~r_len, rs = o; return, end
-
-N = n_time_points(o);
-
-% we need to fill regions if they are not already there
-st.regions = region(o);
-
-% flag to tell if we need to resummarize
-re_sum_f = 0;
-
-for i = 1:r_len
- r = r_nos(i);
- r_st = st.regions{r};
- if nargin > 3 % fieldname call
- n_st = setfield([], fieldname, new_data{i});
- else % structure call
- n_st = new_data{i};
- end
-
- % check if Y or weights are being set
- % if so, we will have to resummarize
- if isfield(n_st, 'Y')
- re_sum_f = 1;
- if size(n_st.Y, 1) ~= N
- error('Incorrect number of time points in data set call');
- end
- end
- if isfield(n_st, 'weights')
- if strcmp(sum_func, 'wtmean')
- re_sum_f = 1;
- end
- if ~isempty(n_st.weights) & size(n_st.weights, 1) ~= N
- error('Incorrect number of time points in weight set call');
- end
- end
- st.regions{r} = mars_struct('ffillmerge', st.regions{r}, n_st);
-end
-
-if re_sum_f
- st = mars_struct('strip', st, {'Y','Yvar'});
- rs = resummarize(y_struct(o, st));
-else
- rs = y_struct(o, st);
-end
diff --git a/lib/marsbar-0.44/@marsy/region_data.m b/lib/marsbar-0.44/@marsy/region_data.m
deleted file mode 100644
index 7268003..0000000
--- a/lib/marsbar-0.44/@marsy/region_data.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function res = region_data(varargin)
-% method gets or sets data for region(s) as cell array
-% FORMAT res = region_data(o, r_nos) (get) OR
-% FORMAT res = region_data(o, r_nos, new_data) (set)
-%
-% See region_field for details
-%
-% $Id$
-
-res = region_field('Y', varargin{:});
diff --git a/lib/marsbar-0.44/@marsy/region_descrip.m b/lib/marsbar-0.44/@marsy/region_descrip.m
deleted file mode 100644
index 17c28e7..0000000
--- a/lib/marsbar-0.44/@marsy/region_descrip.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function res = region_descrip(varargin)
-% method gets or sets descrip for region(s) as cell array
-% FORMAT res = region_descrip(o, r_nos) (get) OR
-% FORMAT res = region_descrip(o, r_nos, new_data) (set)
-%
-% See region_field for details
-%
-% $Id$
-
-res = region_field('descrip', varargin{:});
diff --git a/lib/marsbar-0.44/@marsy/region_field.m b/lib/marsbar-0.44/@marsy/region_field.m
deleted file mode 100644
index ba2ac55..0000000
--- a/lib/marsbar-0.44/@marsy/region_field.m
+++ /dev/null
@@ -1,35 +0,0 @@
-function res = region_field(fieldname, o, r_nos, new_data)
-% method gets or sets data for region field
-% FORMAT res = region_field(fieldname, o, r_nos) (get) OR
-% FORMAT res = region_field(fieldname, o, r_nos, new_data) (set)
-%
-% Inputs
-% fieldname - name of field to get / set
-% o - marsy object
-% r_nos - region number
-% or array of region numbers
-% or empty - giving all regions
-% new_data - cell array, containing new data to set
-%
-% Returns
-% (get call)
-% res - cell array of region field values OR
-% (set call)
-% res - object with new field data set
-%
-% $Id$
-
-if nargin < 2
- error('Need fieldname');
-end
-if nargin < 3
- r_nos = [];
-end
-if nargin < 4 % get call
- [rs r_nos] = region(o, r_nos);
- for i = 1:length(r_nos)
- res{i} = getfield(rs{i}, fieldname);
- end
-else % set call
- res = region(o, r_nos, new_data, fieldname);
-end
diff --git a/lib/marsbar-0.44/@marsy/region_info.m b/lib/marsbar-0.44/@marsy/region_info.m
deleted file mode 100644
index 6aac8d5..0000000
--- a/lib/marsbar-0.44/@marsy/region_info.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function res = region_info(varargin)
-% method gets or sets info for region(s) as cell array
-% FORMAT res = region_info(o, r_nos) (get) OR
-% FORMAT res = region_info(o, r_nos, new_data) (set)
-%
-% See region_field for details
-%
-% $Id$
-
-res = region_field('info', varargin{:});
diff --git a/lib/marsbar-0.44/@marsy/region_name.m b/lib/marsbar-0.44/@marsy/region_name.m
deleted file mode 100644
index 7cc5bce..0000000
--- a/lib/marsbar-0.44/@marsy/region_name.m
+++ /dev/null
@@ -1,53 +0,0 @@
-function res = region_name(o, r_nos, new_data, default_prefix)
-% method gets or sets data for region name
-% FORMAT res = region_name(o, r_nos) (get) OR
-% FORMAT res = region_name(o, r_nos, [], default_prefix) (get) OR
-% FORMAT res = region_name(o, r_nos, new_data) (set)
-%
-% Inputs
-% o - marsy object
-% r_nos - region number
-% or array of region numbers
-% or empty - giving all regions
-% new_data - cell array, containing new names to set
-% default_prefix - default prefix to make default name for
-% regions with undefined names
-% if empty, undefined region names are empty
-% if not empty, undefined region names returned
-% as prefix followed by region number
-% defaults to 'region_', giving region names
-% 'region_1', 'region_2' etc
-%
-% Returns
-% (get call)
-% res - cell array of region names OR
-% (set call)
-% res - object with new field names set
-%
-% $Id$
-
-if nargin < 2
- r_nos = [];
-end
-if nargin < 3
- new_data = [];
-end
-if nargin < 4
- default_prefix = 'region_';
-end
-
-if ~isempty(new_data) % set call
- res = region(o, r_nos, new_data, 'name');
-else % get call
- [rs r_nos] = region(o, r_nos);
- if isempty(rs), res = rs; return, end
- for i = 1:length(rs)
- if mars_struct('isthere', rs{i}, 'name')
- res{i} = rs{i}.name;
- elseif ~isempty(default_prefix)
- res{i} = sprintf('%s%d', default_prefix, r_nos(i));
- else
- res{i} = '';
- end
- end
-end
diff --git a/lib/marsbar-0.44/@marsy/region_size.m b/lib/marsbar-0.44/@marsy/region_size.m
deleted file mode 100644
index 666b264..0000000
--- a/lib/marsbar-0.44/@marsy/region_size.m
+++ /dev/null
@@ -1,75 +0,0 @@
-function [m,n] = region_size(o, r_no, dim)
-% method to get size of specified region data
-% FORMAT [m,n] = region_size(o, r_no, dim)
-%
-% Input
-% o - marsy object
-% r_no - region number OR vector of region numbers
-% OR 'all' ['all' is default]
-% dim - [optional] dimension size to return
-%
-% Output
-% m - as for matlab SIZE call
-% n -
-%
-% e.g
-% % returns total number of timepoints (sz(1) and samples (sz(2)
-% % in all regions
-% sz = region_size(o);
-% % same thing
-% sz = region_size(o, 'all');
-% % number of samples in region 2
-% n = region_size(o, 2, 2);
-%
-% $Id$
-
-r = n_regions(o);
-if nargin < 2
- r_no = 'all';
-end
-if ischar(r_no)
- if strcmp(lower(r_no), 'all')
- r_no = 1:r;
- else
- error(['Surprise request of ' r_no]);
- end
-else
- if any(r_no > r | r_no < 1)
- error('Region number(s) out of range');
- end
-end
-
-st = y_struct(o);
-r_f = isfield(st, 'regions');
-y_f = isfield(st, 'Y');
-
-if ~r_f & ~y_f
- error('No information for region data size');
-end
-
-n = 0;
-for r = r_no
- r_st = [];
- if r_f, r_st = st.regions{r}; end
- if isfield(r_st, 'Y')
- [m n_r] = size(r_st.Y);
- n = n + n_r;
- elseif y_f
- m = size(st.Y, 1);
- n = n + 1;
- else
- error('No data to get size for region');
- end
-end
-
-if nargin < 3
- if nargout < 2
- m = [m n];
- end
-else
- if dim == 2
- m = n;
- elseif dim > 2
- m = ((m+n) > 0);
- end
-end
diff --git a/lib/marsbar-0.44/@marsy/region_weights.m b/lib/marsbar-0.44/@marsy/region_weights.m
deleted file mode 100644
index 147de88..0000000
--- a/lib/marsbar-0.44/@marsy/region_weights.m
+++ /dev/null
@@ -1,10 +0,0 @@
-function res = region_weights(varargin)
-% method gets or sets weights for region(s) as cell array
-% FORMAT res = region_weights(o, r_nos) (get) OR
-% FORMAT res = region_weights(o, r_nos, new_data) (set)
-%
-% See region_field for details
-%
-% $Id$
-
-res = region_field('weights', varargin{:});
diff --git a/lib/marsbar-0.44/@marsy/resummarize.m b/lib/marsbar-0.44/@marsy/resummarize.m
deleted file mode 100644
index 040b815..0000000
--- a/lib/marsbar-0.44/@marsy/resummarize.m
+++ /dev/null
@@ -1,9 +0,0 @@
-function o = resummarize(o)
-% recalculate summary data if possible
-%
-% $Id$
-
-s_f = sumfunc(o);
-if ~isempty(s_f) & ~strcmp(s_f, 'unknown')
- [t1 t2 o] = summary_data(o, s_f);
-end
diff --git a/lib/marsbar-0.44/@marsy/savestruct.m b/lib/marsbar-0.44/@marsy/savestruct.m
deleted file mode 100644
index 99817f7..0000000
--- a/lib/marsbar-0.44/@marsy/savestruct.m
+++ /dev/null
@@ -1,11 +0,0 @@
-function savestruct(obj, filename)
-% saves data in y_struct as variables in .mat file
-% FORMAT savestruct(object, matname)
-%
-% $Id$
-
-if nargin ~= 2
- error('Need matfile name');
-end
-savestruct(y_struct(obj), filename)
-return
diff --git a/lib/marsbar-0.44/@marsy/split.m b/lib/marsbar-0.44/@marsy/split.m
deleted file mode 100644
index d9fa31c..0000000
--- a/lib/marsbar-0.44/@marsy/split.m
+++ /dev/null
@@ -1,24 +0,0 @@
-function o_arr = split(o)
-% method splits regions in object into separate objects
-%
-% $Id$
-
-r = region(o);
-st = y_struct(o);
-is_s = isfield(st, 'Y') & isfield(st, 'Yvar');
-if is_s
- Y = st.Y;
- Yvar = st.Yvar;
-else
- % remove any rogue Y or Yvar fields
- st = mars_struct('strip', st, {'Y','Yvar'});
-end
-for i = 1:length(r)
- r_st = st;
- r_st.regions = r(i);
- if is_s
- r_st.Y = Y(:, i);
- r_st.Yvar = Yvar(:, i);
- end
- o_arr(i) = y_struct(o, r_st);
-end
diff --git a/lib/marsbar-0.44/@marsy/sumfunc.m b/lib/marsbar-0.44/@marsy/sumfunc.m
deleted file mode 100644
index 3425d2e..0000000
--- a/lib/marsbar-0.44/@marsy/sumfunc.m
+++ /dev/null
@@ -1,17 +0,0 @@
-function o = sumfunc(o, sumfunc)
-% method to get or set sumfunc
-%
-% $Id$
-
-if nargin < 2
- % get
- st = y_struct(o);
- if isfield(st, 'sumfunc')
- o = st.sumfunc;
- else
- o = '';
- end
-else
- % set
- o.y_struct.sumfunc = sumfunc;
-end
diff --git a/lib/marsbar-0.44/@marsy/summary.m b/lib/marsbar-0.44/@marsy/summary.m
deleted file mode 100644
index e9c59dd..0000000
--- a/lib/marsbar-0.44/@marsy/summary.m
+++ /dev/null
@@ -1,32 +0,0 @@
-function strs = summary(M)
-% method returns cell array of strings describing marsy object
-%
-% $Id$
-
-strs{1} = sprintf('Description: \t%s', summary_descrip(M));
-strs{2} = sprintf('Number of time points: \t%d', n_time_points(M));
-strs{3} = sprintf('Number of regions: \t%d', n_regions(M));
-s_f = is_summarized(M);
-strs{4} = sprintf('Is summarized?: \t%s', sf_recode(s_f));
-strs{5} = sprintf('Summary function: \t%s', sumfunc(M));
-if ~s_f
- strs{end+1} = sprintf('Can be summarized?: \t%s', ...
- sf_recode(can_summarize(M)));
-end
-ns = region_name(M, [], [], '');
-if isempty(strvcat(ns))
- strs{end+1} = sprintf('Region names: \t%s', ...
- 'not specified');
-else
- strs{end+1} = 'Region names:';
- for i = 1:length(ns)
- strs{end+1} = sprintf('Region %d: %s', i, ns{i});
- end
-end
-return
-
-function str = sf_recode(tf)
-if isnan(tf), str = 'unknown';
-elseif tf, str = 'yes';
-else str = 'no';
-end
diff --git a/lib/marsbar-0.44/@marsy/summary_block_means.m b/lib/marsbar-0.44/@marsy/summary_block_means.m
deleted file mode 100644
index cca81d2..0000000
--- a/lib/marsbar-0.44/@marsy/summary_block_means.m
+++ /dev/null
@@ -1,23 +0,0 @@
-function mus = summary_block_means(Y)
-% return raw means over blocks in summary data
-%
-% Input
-% Y - marsy object
-%
-% mus - means over block. Returns B x N matrix
-% where B is number of blocks, and N is number
-% of ROIs
-%
-% $Id$
-
-y = summary_data(Y);
-r = block_rows(Y);
-
-B = length(r);
-N = size(y, 2);
-
-mus = zeros(B, N);
-
-for b = 1:B
- mus(b, :) = mean(y(r{b},:),1);
-end
diff --git a/lib/marsbar-0.44/@marsy/summary_data.m b/lib/marsbar-0.44/@marsy/summary_data.m
deleted file mode 100644
index 89d35b3..0000000
--- a/lib/marsbar-0.44/@marsy/summary_data.m
+++ /dev/null
@@ -1,76 +0,0 @@
-function [Y,Yvar,o] = summary_data(o, sumfunc_str)
-% method to get summary data, maybe set sumfunc
-%
-% Inputs
-% o - marsy data object
-% sumfunc_str - [optional] summary function string; one of
-% 'mean', 'median', 'eig1', 'wtmean'
-% If not specified, defaults to previous summary
-% function for this object
-%
-% Output
-% Y - (re)calculated summary time course
-% Yvar - [optional] variance time course
-% o - possibly changed marsy data object
-%
-% e.g.
-% Y = summary_data(o);
-% [Y Yvar o] = summary_data(o, 'median');
-%
-% $Id$
-
-if nargin > 1
- o = sumfunc(o, sumfunc_str);
-end
-s_f = sumfunc(o);
-if isempty(s_f)
- error('No summary function specified');
-end
-
-% Get a copy of object structure
-st = y_struct(o);
-
-% refresh summary data if necessary
-% (if sumfunc passed, OR if data is not yet available)
-if nargin > 1 | ... % sumfunc passed
- ~isfield(st, 'Y') | ... % Y not yet calculated
- (nargout > 2 & ~isfield(st, 'Yvar')) % Yvar needed
-
- % If we only have one (or zero) columns per ROI, job is simple
- Ys = region_data(o);
- sz = summary_size(o);
- if isempty(Ys)
- error('No region data to summarize');
- elseif region_size(o, 'all', 2) == sz(2) % One column per ROI
- Y = [Ys{:}];
- Yvar = ones(sz) * Inf;
- else % More than one column per ROI
- if strcmp(s_f, 'unknown')
- error('Cannot recalculate from unknown sumfunc');
- end
- Ws = region_weights(o);
- Y = zeros(sz);
- Yvar = zeros(sz);
- for i = 1:sz(2);
- if isempty(Ys{i}) % set to NaN if no data to summarize
- Y(:,i) = NaN;
- Yvar(:,i) = NaN;
- else
- [Y(:,i) Yvar(:,i)] = pr_sum_func(Ys{i}, s_f, Ws{i});
- end
- end
- if verbose(o)
- fprintf('Summarizing data with summary function: %s\n', s_f);
- end
- end
- if nargout > 2
- st.Y = Y;
- st.Yvar = Yvar;
- o = y_struct(o, st);
- end
-else % not recalculated
- Y = st.Y;
- if nargout > 1
- Yvar = st.Yvar;
- end
-end
diff --git a/lib/marsbar-0.44/@marsy/summary_descrip.m b/lib/marsbar-0.44/@marsy/summary_descrip.m
deleted file mode 100644
index f95dd35..0000000
--- a/lib/marsbar-0.44/@marsy/summary_descrip.m
+++ /dev/null
@@ -1,16 +0,0 @@
-function res = summary_descrip(o, descrip)
-% get/set method for summary data description
-%
-% $Id$
-
-st = y_struct(o);
-if nargin < 2 % get
- res = '';
- if isfield(st, 'descrip')
- res = st.descrip;
- end
-else % set
- st.descrip = descrip;
- o = y_struct(o, st);
- res = o;
-end
diff --git a/lib/marsbar-0.44/@marsy/summary_info.m b/lib/marsbar-0.44/@marsy/summary_info.m
deleted file mode 100644
index 07455c8..0000000
--- a/lib/marsbar-0.44/@marsy/summary_info.m
+++ /dev/null
@@ -1,16 +0,0 @@
-function res = summary_info(o, descrip)
-% get/set method for summary data info
-%
-% $Id$
-
-st = y_struct(o);
-if nargin < 2 % get
- res = [];
- if isfield(st, 'info')
- res = st.info;
- end
-else % set
- st.info = info;
- o = y_struct(o, st);
- res = o;
-end
diff --git a/lib/marsbar-0.44/@marsy/summary_size.m b/lib/marsbar-0.44/@marsy/summary_size.m
deleted file mode 100644
index f3205a2..0000000
--- a/lib/marsbar-0.44/@marsy/summary_size.m
+++ /dev/null
@@ -1,31 +0,0 @@
-function [m,n] = summary_size(o, dim)
-% method returns number of time points x number of regions
-%
-% $Id$
-
-st = o.y_struct;
-sz = [0 0];
-if isfield(st, 'Y')
- sz = size(st.Y);
-elseif isfield(st, 'regions')
- if iscell(st.regions)
- if isfield(st.regions{1}, 'Y')
- sz(1) = size(st.regions{1}.Y, 1);
- end
- end
- sz(2) = length(st.regions);
-end
-
-if nargin < 2
- if nargout > 1
- m = sz(1); n = sz(2);
- else
- m = sz;
- end
-else
- if dim > 2
- m = (m+n > 0)
- else
- m = sz(dim);
- end
-end
diff --git a/lib/marsbar-0.44/@marsy/ui_plot.m b/lib/marsbar-0.44/@marsy/ui_plot.m
deleted file mode 100644
index 621b9c4..0000000
--- a/lib/marsbar-0.44/@marsy/ui_plot.m
+++ /dev/null
@@ -1,270 +0,0 @@
-function r = ui_plot(o, plot_spec, plot_params)
-% method plots data in various formats
-% FORMAT r = ui_plot(o, plot_spec, plot_params)
-%
-% Input
-% o - marsy object
-%
-% plot_spec - can be a
-% string, in which case it has the same meaning as
-% the structure version below, with only field 'types'
-% set to this value, OR
-% structure, with none ore more of fields
-% (in all cases, field missing is the same as the field
-% being empty)
-% r_nos - region number(s)
-% (if empty, -> all regions)
-% b_nos - session/subject numbers
-% (if empty, -> all blocks)
-% types - string, or cell arrays of strings
-% specifying plot type(s). Plot types can be
-% one or more of:
-% 'raw' - plots raw time series
-% 'acf - plots autocorrelation function
-% 'fft' - plots fourier analysis of time series
-% 'all' - all of the above
-% (defaults to 'raw')
-% graphics_obj - graphics object(s) for plot.
-% If empty, becomes handle SPM graphics
-% window, otherwise, can be a handle to
-% figure, or enough handles to axes for all
-% requested plots. This is useful for putting
-% the plot on a convenient figure or axis
-%
-% plot_params - (optional) Parameters to pass to plots
-% Can be empty (giving defaults) or structure, or
-% cell array of structures, one per requested plot
-% Relevant fields of structure differ for different plot
-% types;
-% Plot 'fft': fields 'bin_length' distance between time
-% points in seconds
-% 'acf': fields 'lags' no of lags to plot [10]
-%
-% Returns
-% r - results that were plotted; all the data for 'raw', all
-% the acf values for 'acf', all the fft coefficients for
-% 'fft'. Cell array, one cell per plot.
-%
-% Examples
-% ui_plot(Y, 'all') plots all plot types for all regions and sessions
-% ui_plot(Y, 'acf') just plots ACF, for all regions
-% ui_plot(Y, struct('types', 'fft', 'r_nos', 1))
-% will plot fft for region 1 only
-% f = figure; ui_plot(Y, struct('graphics_obj', f))
-% will plot all plot types to the new figure
-% ui_plot(Y, 'acf', struct('lags', 8))
-% plots ACF for all regions, with lag of 8 rather than
-% the default of 10
-%
-% $Id$
-
-% Get, check data from object
-[n_rows n_cols] = summary_size(o);
-if ~prod([n_rows n_cols]), warning('No data to plot'), return, end
-rows = block_rows(o);
-Y = summary_data(o);
-N = region_name(o);
-S = sumfunc(o);
-info = summary_info(o);
-if strcmp(S, 'unknown'), S = ''; end
-if ~isempty(S), S = [' - ' S]; end
-
-def_spec = struct('types', {{'raw'}}, ...
- 'r_nos', 1:n_cols, ...
- 'b_nos', 1:length(rows),...
- 'graphics_obj', []);
-
-% Process plot type arguments
-if nargin < 2
- plot_spec = [];
-end
-if ischar(plot_spec), plot_spec = struct('types', plot_spec); end
-plot_spec = mars_struct('fillafromb', plot_spec, def_spec);
-
-plot_types = plot_spec.types;
-if ~iscell(plot_types)
- plot_types = {plot_types};
-end
-if strcmp('all', plot_types{1})
- plot_types = {'raw','acf','fft'};
-end
-n_p_t = length(plot_types);
-n_plots = n_p_t * length(plot_spec.r_nos);
-
-% Check passed graphics object(s)
-gr_ob = plot_spec.graphics_obj;
-if isempty(gr_ob)
- gr_ob = spm_figure('GetWin','Graphics');
- spm_results_ui('Clear', gr_ob, 0);
-end
-if ~all(ishandle(gr_ob))
- error('One or more graphics objects are not valid');
-end
-o_t = get(gr_ob, 'type');
-if iscell(o_t)
- if any(diff(strvcat(o_t{:}),[],1))
- error('All graphics objects must be of the same type');
- end
- o_t = o_t{1};
-end
-switch o_t
- case 'figure'
- figure(gr_ob);
- case 'axes'
- if n_plots > length(gr_ob)
- error('Not enough axes for planned number of plots');
- end
- otherwise
- error(['Completely confused by graphics object type: ' o_t]);
-end
-
-rows = rows(plot_spec.b_nos);
-n_blocks = length(rows);
-
-% Process plot_param arguments
-if nargin < 3
- plot_params = cell(1,n_p_t);
-end
-if ~iscell(plot_params)
- plot_params = {plot_params};
-end
-if length(plot_params) == 1
- plot_params = repmat(plot_params, 1, n_p_t);
-elseif length(plot_params) < n_p_t
- error(sprintf('You need %d plot_param entries', n_p_t));
-end
-
-% Default string, bin_length for fft plots
-if mars_struct('isthere', info, 'TR')
- bin_length = info.TR;
- bin_str = 'Hz';
-else
- bin_length = 1;
- bin_str = 'cycles per time point';
-end
-
-p_ctr = 1;
-for c = plot_spec.r_nos
- for p = 1:n_p_t
- switch o_t
- case 'figure'
- subplot(n_plots, 1, p_ctr);
- case 'axes'
- axes(gr_ob(p_ctr));
- end
-
- y = Y(:,c);
-
- switch lower(plot_types{p})
- case 'raw'
- a_r = [];
- for s = 1:n_blocks
- a_r = [a_r; rows{s}(:)];
- end
- plot(y(a_r));
- axis tight
- hold on
- % add session indicators
- yrg = [min(y) max(y)];
- for s = 1:n_blocks
- rw = rows{s};
- if s > 1 % session divider
- plot([rw(1) rw(1)]-0.5, yrg, 'k:');
- end
- end
- ylabel(['Signal intensity' S])
- xlabel('Time point');
- r{p_ctr} = y;
-
- case 'acf'
- if isfield(plot_params{p}, 'lags')
- lags = plot_params{p}.lags;
- else lags = 10;
- end
- mn_len = Inf;
- for s = 1:n_blocks
- if length(rows{s}) < mn_len, mn_len = length(rows{s}); end
- end
- lags = max([1 min([mn_len-4 lags])]);
-
- C = [];
- for s = 1:n_blocks
- by = y(rows{s});
- nb_rows = length(by);
- ty = toeplitz(by, [by(1) zeros(1, lags)]);
- ty([1:lags n_rows+1:end], :) = [];
- Cs = corrcoef(ty);
- C = [C Cs(1,:)];
- n = nb_rows - 2; % df for correlation
- t_th = spm_invTcdf(1-0.025, n); % t for two tailed p=0.05
- r_th(s) = sqrt(1/(n/t_th.^2+1)); % r equivalent
- end
- stem(C);
- axis tight
- hold on
- % add confidence intervals, labels, session indicators
- Crg = [min(C) max(C)];
- for s = 1:n_blocks
- s_vals = [0 lags] + (s-1)*(lags+1) + 1;
- plot(s_vals, [r_th(s) r_th(s)], 'r:');
- plot(s_vals, -[r_th(s) r_th(s)], 'r:');
- if s > 1 % session divider line
- plot([s_vals(1) s_vals(1)]-0.5, Crg, 'k:');
- end
- end
- xtl = get(gca,'xticklabel');
- xtl = num2str(mod(str2num(xtl)-1, lags+1));
- set(gca, 'xticklabel', xtl);
-
- ylabel('Correlation coefficient')
- xlabel('Lag');
- r{p_ctr} = C;
- case 'fft'
- if isfield(plot_params{p}, 'bin_length')
- b_len = plot_params{p}.bin_length;
- b_str = 'Hz';
- else
- b_len = bin_length;
- b_str = bin_str;
- end
- P = []; H = []; St = [];
- for s = 1:n_blocks
- by = y(rows{s});
- gX = abs(fft(by)).^2;
- gX = gX*diag(1./sum(gX));
- q = size(gX,1);
- Hz = [0:(q - 1)]/(q * b_len);
- q = 2:fix(q/2);
- P = [P gX(q)'];
- St(s) = length(H)+1;
- H = [H; Hz(q)'];
- end
- plot(P)
- hold on
- Prg = [min(P) max(P)];
- for s = 2:n_blocks
- plot([St(s) St(s)]-0.5, Prg, 'k-');
- end
- axis tight
- % Rename tick labels
- xt = get(gca, 'xtick');
- xt = xt(xt==fix(xt));
- set(gca, 'xtick', xt);
- for t = 1:length(xt)
- xtl_fft{t} = sprintf('%5.3f', H(xt(t)));
- end
- set(gca, 'xticklabel', xtl_fft);
- xlabel(sprintf('Frequency (%s)', b_str))
- ylabel('Relative spectral density')
- axis tight
- r{p_ctr} = P;
- otherwise
- error(['What is this plot type: ' plot_types{p} '?']);
- end
- title(N{c}, 'interpreter', 'none');
-
- p_ctr = p_ctr + 1;
- end
-end
-
-return
diff --git a/lib/marsbar-0.44/@marsy/verbose.m b/lib/marsbar-0.44/@marsy/verbose.m
deleted file mode 100644
index 9438539..0000000
--- a/lib/marsbar-0.44/@marsy/verbose.m
+++ /dev/null
@@ -1,11 +0,0 @@
-function res = verbose(obj, data)
-% get/set method for verbose field
-%
-% $Id$
-
-if nargin > 1
- obj.verbose = data;
- res = obj;
-else
- res = obj.verbose;
-end
diff --git a/lib/marsbar-0.44/@marsy/xyz.m b/lib/marsbar-0.44/@marsy/xyz.m
deleted file mode 100644
index 4878630..0000000
--- a/lib/marsbar-0.44/@marsy/xyz.m
+++ /dev/null
@@ -1,53 +0,0 @@
-function [XYZ, M]= xyz(o, r_no, xyz_type)
-% gets XYZ coordinates for region
-% FORMAT [XYZ M]= xyz(o, r_no, xyz_type)
-%
-% Inputs
-% o - marsy object
-% r_no - region number
-% xyz_type - string, one of 'mm','real','vox'
-% where 'real' is a synonym for 'mm'
-% and 'mm' is the default (if not passed)
-% 'mm' results in coordinates in mm
-% 'vox' gives coordinates in voxels
-%
-% Outputs
-% XYZ - coordinates in specified reference
-% M - 4x4 transformation mapping voxels to mm
-%
-% $Id$
-
-r = n_regions(o);
-if nargin < 2
- error('Need region number to get XYZ coordinates')
-end
-if r_no > r
- error('Region number too large');
-end
-if nargin < 3
- xyz_type = 'mm';
-end
-
-XYZ = [];
-M = eye(4);
-st = y_struct(o);
-if ~isfield(st, 'regions')
- return
-end
-r_st = st.regions{r_no};
-if ~isfield(r_st, 'vXYZ') | ~isfield(r_st, 'mat')
- return
-end
-XYZ = r_st.vXYZ;
-if isempty(XYZ), return, end
-switch xyz_type
- case 'vox'
- case {'mm', 'real'}
- [m n] = size(XYZ);
- if m == 3, XYZ = [XYZ; ones(1, n)]; end
- M = r_st.mat;
- XYZ = M * XYZ;
- otherwise
- error(['Unknown coordinate type: ' xyz_type]);
-end
-XYZ = XYZ(1:3,:);
diff --git a/lib/marsbar-0.44/@marsy/y_struct.m b/lib/marsbar-0.44/@marsy/y_struct.m
deleted file mode 100644
index 96a0bf7..0000000
--- a/lib/marsbar-0.44/@marsy/y_struct.m
+++ /dev/null
@@ -1,11 +0,0 @@
-function res = y_struct(obj, Struct)
-% get/set method for y_struct field
-%
-% $Id$
-
-if nargin > 1
- obj.y_struct = Struct;
- res = obj;
-else
- res = obj.y_struct;
-end
diff --git a/lib/marsbar-0.44/contents.m b/lib/marsbar-0.44/contents.m
deleted file mode 100644
index 758fdf1..0000000
--- a/lib/marsbar-0.44/contents.m
+++ /dev/null
@@ -1,443 +0,0 @@
-% Contents of MarsBaR ROI toolbox version 0.44
-%
-% mars_arm - wrapper function for MarsBaR marmoire object
-% mars_arm_call - services callbacks from marmoire object set functions
-% mars_armoire - multifunction function to get/set various stores of stuff
-% mars_blob2roi - saves ROI for cluster in xSPM structure, containing point pt
-% mars_blob_menu - puts up ROI menu to add to SPM results interface
-% mars_blobs2rois - creates ROIs from spm_results_ui SPM
-% mars_build_roi - builds ROIs via the SPM GUI
-% mars_display_roi - utility routines for display of ROIs in graphic window
-% mars_get_option - Get option subfield as named by ``varargin``.
-% mars_image_scaling - get image scaling data for images, maybe via SPM design
-% mars_img2rois - creates ROIs from cluster image or image containing ROIs defined by unique nos
-% mars_new_space - make a new image space to contain image with rotations etc
-% mars_options - options utility routines
-% mars_orthviews - Display Orthogonal Views of a Normalized Image
-% mars_rois2img - creates cluster or number labelled ROI image from ROIs
-% mars_struct - multifunction function for manipulating structures
-% mars_uifile - wrapper for matlab uiputfile/getfile; to resolve version differences
-% mars_utils - collection of useful utility functions for MarsBaR etc
-% mars_vol_check - FORMAT [samef, msg, chgf] = mars_vol_check(V1, V2, ...)
-% mars_vol_utils - collection of useful utility functions for vol structs
-% marsbar - Startup, callback and utility routine for Marsbar
-% savestruct - saves data in structure as variables in .mat file
-%
-% @mardo/add_contrasts - method to add contrast definitions to design
-% @mardo/adjusted_data - Return adjusted data for estimated design and contrast no
-% @mardo/betas - method to get estimated betas
-% @mardo/block_mean_cols - method returns rows for means for blocks in design
-% @mardo/block_means - method returns means for blocks in design
-% @mardo/cd_images - method for changing path to image files in design
-% @mardo/contrasts - method to get or set contrasts
-% @mardo/data - method to get or set data object
-% @mardo/des_struct - get/set method for des_struct field
-% @mardo/descrip - method gets cell string description of design
-% @mardo/design_matrix - method returns design matrix from design
-% @mardo/design_structure - method to get or set SPM design structure
-% @mardo/display - display method for mardo objects
-% @mardo/error_df - method returns error df from design
-% @mardo/event_fitted - method to compute fitted event time course
-% @mardo/event_fitted_fir - method to compute fitted event time courses using FIR
-% @mardo/event_signal - method to compute % signal change from fMRI events
-% @mardo/event_types - method to get / set event types for design
-% @mardo/event_types_named - method returns event types structures for events with same names
-% @mardo/flip_images - flips images in design
-% @mardo/flip_option - get/set flag for flipping images in design
-% @mardo/full_vol - returns vol with full path, from vols, or image names
-% @mardo/get_contrast_by_name - get named contrast(s) from design contrast structure
-% @mardo/get_contrasts - method to get contrasts from design object
-% @mardo/get_data - method to get data from design object
-% @mardo/get_vol_field - method to get named field, containing or referring to vol structs
-% @mardo/has_contrasts - method returns 1 if design has contrasts
-% @mardo/has_filter - returns 1 if object contains filter
-% @mardo/has_images - returns 1 if design contains images, NaN if not known
-% @mardo/has_whitener - returns 1 if design has whitening filter
-% @mardo/image_names - method returning image file names for design
-% @mardo/images - method to get or set images
-% @mardo/is_fmri - method returns 1 if this is an fmri design
-% @mardo/is_mars_estimated - method returns 1 if design has been estimated in MarsBaR
-% @mardo/is_marsed - returns 1 if design has been processed with MarsBaR
-% @mardo/is_spm_estimated - returns 1 if design has been estimated in SPM
-% @mardo/is_valid - returns 1 if object contains valid SPM/MarsBaR design
-% @mardo/isempty - overloaded isempty method for mardo object
-% @mardo/isfield - method to overload isfield for mardo objects
-% @mardo/mardo - mardo - class constructor for MarsBaR design object
-% @mardo/mars_tag - returns, or sets, Mars tagging structure in design
-% @mardo/marsy_data - method to get or set marsy data
-% @mardo/masking_struct - method to get or set SPM masking structure
-% @mardo/modality - method returns modality of design
-% @mardo/n_effects - get number of effects (columns) in design
-% @mardo/n_time_points - get number of time_points in design
-% @mardo/native_vol_ver - return string specifying native vol type
-% @mardo/paramfields - returns struct with fields from maroi object useful for copying objects
-% @mardo/prefix_images - method for adding or removing prefix from file names in design
-% @mardo/refresh_contrasts - method to refresh contrasts to match design
-% @mardo/residuals - method returns residuals from model
-% @mardo/savestruct - saves data in def_struct as variables in .mat file
-% @mardo/set_contrasts - method to set contrasts into design object
-% @mardo/set_data - method to set data for design object
-% @mardo/set_vol_field - method to set named field, containing or referring to vol structs
-% @mardo/stat_table - gets Mars statistics and creates statistic table as cell array
-% @mardo/subsasgn - method to overload . notation in assignments.
-% @mardo/subsref - method to overload the . notation.
-% @mardo/summary - method returns cell array of strings describing design
-% @mardo/swd - method to get/set design directory
-% @mardo/swd_writable - returns true if swd directory can be written to
-% @mardo/type - returns SPM version string corresponding to design type
-% @mardo/ui_et_edit - method to edit invidual event types in design
-% @mardo/ui_et_edit_cb - method to handle callbacks from ui_et_edit
-% @mardo/ui_event_types - ui method for selection / editing of event types
-% @mardo/ui_event_types_cb - method to handle callbacks from ui_event_types
-% @mardo/ui_ft_design_data - method plots FT of design and data to graphics window
-% @mardo/ui_get_contrasts - SPM contrast UI, wrapped for MarsBaR
-% @mardo/unfiltered_efficiency - Calculate unfiltered efficiency for given SPM design and contrast
-% @mardo/verbose - get/set method for verbose field
-%
-% @mardo/private/pr_ev_diff - method to calculate event height for % signal change
-% @mardo/private/pr_refresh_et - Refreshes data and display of event type window after edit
-% @mardo/private/pr_sort_evs - function to sort event according to sort type
-%
-% @mardo_2/add_trial_f - method to add trial-specific F contrasts
-% @mardo_2/apply_filter - applies filter in design to data
-% @mardo_2/autocorr - method to set autocorrelation types for design
-% @mardo_2/bf_dt - method returns length of time bin for basis functions
-% @mardo_2/block_cols - method gets design columns for block (session / subject)
-% @mardo_2/block_rows - returns cell array of rows for each (subject/session) block
-% @mardo_2/can_mars_estimate - method returns 1 if design can be estimated in MarsBaR
-% @mardo_2/compute_contrasts - compute and return results of contrast statistics
-% @mardo_2/convert_vols - method that converts vol structs in design and converts to format 'ver'
-% @mardo_2/design_vol - returns vols in appropriate format for saving in design
-% @mardo_2/estimate - estimate method - estimates GLM for SPM2 model
-% @mardo_2/event_cols - method gets design columns for single event
-% @mardo_2/event_onsets - method gets onsets and durations for event/session
-% @mardo_2/event_regressor - method gets estimated regressor for single event
-% @mardo_2/event_specs - method to return event specifications for all event in model
-% @mardo_2/event_x_fir - method to return FIR design matrix columns for session
-% @mardo_2/fill - fills missing entries from SPM FMRI design matrix
-% @mardo_2/fwhm - method returns FWHM, or empty if not available
-% @mardo_2/get_images - method to get image vols from design
-% @mardo_2/has_autocorr - returns 1 if object contains autocorrelation specification
-% @mardo_2/has_filter - returns 1 if object contains filter
-% @mardo_2/has_images - returns 1 if design contains images
-% @mardo_2/has_whitener - returns 1 if design has whitening filter
-% @mardo_2/mardo_2 - class constructor for SPM2 MarsBaR design object
-% @mardo_2/mardo_99 - method to convert SPM2 design to SPM99 design
-% @mardo_2/mars_spm_graph - Graphical display of adjusted data
-% @mardo_2/modality - method returns modality of design
-% @mardo_2/save_spm - method to save design as SPM format design structure
-% @mardo_2/savestruct - saves data in def_struct into .mat file with variable name SPM
-% @mardo_2/set_images - method to set image vols to design
-% @mardo_2/tr - method returns TR in seconds, or empty if not available
-% @mardo_2/type - returns SPM version string corresponding to design type
-% @mardo_2/ui_build - method to create / fill design via GUI
-% @mardo_2/ui_get_event - method to select an event
-% @mardo_2/ui_get_filter - method to get filter via GUI
-% @mardo_2/ui_report - method for SPM2 design reporting
-% @mardo_2/ui_report_fmri - Interactive review of fMRI design matrix
-%
-% @mardo_2/private/my_design - returns 1 if design looks like it is of SPM99 type
-% @mardo_2/private/pr_estimate - Estimation of a General Linear Model
-% @mardo_2/private/pr_fmri_design - MarsBaR version of spm_fMRI design - asssembles a design for fMRI studies
-% @mardo_2/private/pr_fmristat_ar - function returns estimated AR coefficients using fmristat algorithm
-% @mardo_2/private/pr_get_filter - gets filter using spm_fmri_spm_ui routines
-% @mardo_2/private/pr_spm_ce - return error covariance constraints for serially correlated data
-% @mardo_2/private/pr_spm_diff - matrix differential
-% @mardo_2/private/pr_spm_filter - Removes low frequency confounds X0
-% @mardo_2/private/pr_spm_get_bf - fills in basis function structure
-% @mardo_2/private/pr_spm_get_ons - returns input [designed effects] structures
-% @mardo_2/private/pr_spm_gpdf - Probability Density Function (PDF) of Gamma distribution
-% @mardo_2/private/pr_spm_hrf - returns a hemodynamic response function
-% @mardo_2/private/pr_spm_orth - recursive orthogonalization of basis functions
-% @mardo_2/private/pr_spm_q - returns an (n x n) autocorrelation matrix for an AR(p) process
-% @mardo_2/private/pr_spm_reml - REML estimation of covariance components from Cov{y}
-% @mardo_2/private/pr_spm_svd - computationally efficient SVD (that can handle sparse arguments)
-% @mardo_2/private/pr_spm_ui - MarsBaR: setting up the general linear model for independent data
-% @mardo_2/private/pr_spm_volterra - generalized convolution of inputs (U) with basis set (bf)
-% @mardo_2/private/pr_stat_compute - private function to compute statistics for SPM2 design
-% @mardo_2/private/pr_stat_compute_mv - private function to compute mutlivariate statistics across ROIs
-%
-% @mardo_5/autocorr - method to set autocorrelation types for design
-% @mardo_5/convert_vols - method that converts vol structs in design and converts to format 'ver'
-% @mardo_5/estimate - estimate method - estimates GLM for SPM2 model
-% @mardo_5/fill - fills missing entries from SPM FMRI design matrix
-% @mardo_5/mardo_5 - class constructor for SPM5 MarsBaR design object
-% @mardo_5/native_vol_ver - return string specifying native vol type
-% @mardo_5/type - returns SPM version string corresponding to design type
-% @mardo_5/ui_build - method to create / fill design via GUI
-%
-% @mardo_5/private/my_design - returns 1 if design looks like it is of SPM5 / 8 type
-% @mardo_5/private/pr_estimate - Estimation of a General Linear Model
-% @mardo_5/private/pr_fmri_design - MarsBaR version of spm_fMRI design - asssembles a design for fMRI studies
-% @mardo_5/private/pr_fmristat_ar - function returns estimated AR coefficients using fmristat algorithm
-% @mardo_5/private/pr_get_filter - gets filter using spm_fmri_spm_ui routines
-% @mardo_5/private/pr_spm_cat - converts a cell array into a matrix
-% @mardo_5/private/pr_spm_ce - return error covariance constraints for serially correlated data
-% @mardo_5/private/pr_spm_diff - matrix high-order differentials
-% @mardo_5/private/pr_spm_en - Euclidean normalization
-% @mardo_5/private/pr_spm_fileparts - Like fileparts, but separates off a comma separated list at the end
-% @mardo_5/private/pr_spm_filter - Removes low frequency confounds X0
-% @mardo_5/private/pr_spm_get_bf - fills in basis function structure
-% @mardo_5/private/pr_spm_get_ons - returns input [designed effects] structures
-% @mardo_5/private/pr_spm_gpdf - Probability Density Function (PDF) of Gamma distribution
-% @mardo_5/private/pr_spm_hrf - returns a hemodynamic response function
-% @mardo_5/private/pr_spm_justify - Justify text
-% @mardo_5/private/pr_spm_logdet - returns the log of the determinant of positive semi-definite matrix C
-% @mardo_5/private/pr_spm_non_sphericity - return error covariance constraints for basic ANOVA designs
-% @mardo_5/private/pr_spm_orth - recursive orthogonalization of basis functions
-% @mardo_5/private/pr_spm_q - returns an (n x n) autocorrelation matrix for an AR(p) process
-% @mardo_5/private/pr_spm_reml - ReML estimation of covariance components from y*y'
-% @mardo_5/private/pr_spm_select - File selector
-% @mardo_5/private/pr_spm_svd - computationally efficient SVD (that can handle sparse arguments)
-% @mardo_5/private/pr_spm_ui - MarsBaR: Setting up the general linear model for independent data
-% @mardo_5/private/pr_spm_unvec - unvectorises a vectorised array
-% @mardo_5/private/pr_spm_vec - vectorises a numeric, cell or structure array
-% @mardo_5/private/pr_spm_volterra - generalized convolution of inputs (U) with basis set (bf)
-% @mardo_5/private/pr_stat_compute - private function to compute statistics for SPM2 design
-% @mardo_5/private/pr_stat_compute_mv - private function to compute mutlivariate statistics across ROIs
-%
-% @mardo_99/add_trial_f - method to add trial-specific F contrasts
-% @mardo_99/apply_filter - applies filter in design to data
-% @mardo_99/autocorr - method to report lack of autocorrelation options for SPM99
-% @mardo_99/bf_dt - method returns length of time bin for basis functions
-% @mardo_99/block_cols - method gets design columns for block (session / subject)
-% @mardo_99/block_rows - returns cell array of rows for each (subject/session) block
-% @mardo_99/can_mars_estimate - method returns 1 if design can be estimated in MarsBaR
-% @mardo_99/compute_contrasts - compute and return stats
-% @mardo_99/convert_vols - method that converts vol structs in design and converts to format 'ver'
-% @mardo_99/design_vol - returns vols in appropriate format for saving in design
-% @mardo_99/estimate - estimate method - estimates GLM for SPM99 model
-% @mardo_99/event_cols - method gets design columns for single event
-% @mardo_99/event_onsets - method gets (estimated) onsets and durations for event/session
-% @mardo_99/event_regressor - method gets estimated regressor for single event
-% @mardo_99/event_specs - method to return event specifications for all event in model
-% @mardo_99/event_x_fir - method to return FIR design matrix columns for session
-% @mardo_99/fill - fills missing entries from SPM FMRI design matrix
-% @mardo_99/fwhm - method returns FWHM, or empty if not available
-% @mardo_99/get_images - method to get image vols from design
-% @mardo_99/has_autocorr - returns 1 if object contains autocorrelation specification
-% @mardo_99/has_filter - returns 1 if object contains filter
-% @mardo_99/has_images - returns 1 if design contains images
-% @mardo_99/mardo_2 - method to convert SPM2 design to SPM99 design
-% @mardo_99/mardo_99 - class constructor for SPM99 MarsBaR design object
-% @mardo_99/mars_spm_graph - Graphical display of adjusted data
-% @mardo_99/modality - method returns modality of design
-% @mardo_99/save_spm - method to save design as SPM format design structure
-% @mardo_99/set_images - method to set image vols into design
-% @mardo_99/tr - method returns TR in seconds, or empty if not available
-% @mardo_99/type - returns SPM version string corresponding to design type
-% @mardo_99/ui_build - method to create / fill design via GUI
-% @mardo_99/ui_get_event - method to select an event
-% @mardo_99/ui_get_filter - method to get filter via GUI
-% @mardo_99/ui_report - mathod for SPM99 design reporting
-% @mardo_99/ui_report_fmri - Interactive review of fMRI design matrix
-%
-% @mardo_99/private/my_design - returns 1 if design looks like it is of SPM99 type
-% @mardo_99/private/pr_estimate - Estimation of a General Linear Model
-% @mardo_99/private/pr_fmri_design - MarsBaR version of spm_fMRI design - asssembles a design for fMRI studies
-% @mardo_99/private/pr_get_filter - gets filter using spm_fmri_spm_ui routines
-% @mardo_99/private/pr_spm_filter - contruct and/or apply high and/or low pass filter
-% @mardo_99/private/pr_spm_get_bf - creates basis functions for each trial type {i} in struct BF{i}
-% @mardo_99/private/pr_spm_get_ons - returns onset times for events
-% @mardo_99/private/pr_spm_hrf - returns a hemodynamic response function
-% @mardo_99/private/pr_spm_orth - recursive orthogonalization of basis functions
-% @mardo_99/private/pr_spm_ui - MarsBaR: setting up the general linear model for independent data
-% @mardo_99/private/pr_spm_volterra - returns [design] matrix of explanatory variables
-% @mardo_99/private/pr_stat_compute - calculates contrast value, stats and p values for contrasts
-% @mardo_99/private/pr_stat_compute_mv - compute multivariate statistics across ROIs
-%
-% @marmoire/add_if_absent - Adds item only if not already present
-% @marmoire/add_item - add item to armoire
-% @marmoire/clear_item_data - sets data for item to empty
-% @marmoire/default_item - returns default item
-% @marmoire/do_save - method to save data for item
-% @marmoire/do_set - private function to set data into item
-% @marmoire/get_item_data - get data for item
-% @marmoire/get_item_param - method to get item parameters
-% @marmoire/get_item_struct - get whole item structure, including parameters
-% @marmoire/isempty_item_data - returns 1 if no data for this item
-% @marmoire/item_exists - returns true if there is an item of this name
-% @marmoire/item_needs_save - return 1 if item requires a save
-% @marmoire/marmoire - marmoire - class constructor for marmoire container type
-% @marmoire/save_item_data - save data for item to file
-% @marmoire/save_item_data_ui - save data for item to file using GUI
-% @marmoire/set_item_data - sets data for item
-% @marmoire/set_item_data_ui - sets data for item using GUI
-% @marmoire/set_item_param - method to set item parameters
-% @marmoire/set_item_struct - set whole item structure, including parameters
-% @marmoire/update_item_data - updates data for item (sets data, flags change)
-%
-% @marmoire/private/pr_is_nan - (No help available)
-% @marmoire/private/pr_is_nix - (No help available)
-% @marmoire/private/pr_isempty - private function returns 1 if there is no data, or filename
-% @marmoire/private/pr_needs_save - private function returning 1 if item data needs save
-%
-% @maroi/and - overloaded add function
-% @maroi/are_same - returns 1 if rois are the same
-% @maroi/back2base - back2base method - check for spacebase, transform thereto
-% @maroi/binarize - binarize - returns / sets binarize value for object
-% @maroi/c_o_m - c_o_m method - calculates unweighted centre of mass
-% @maroi/classdata - classdata method - sets/gets class data
-% @maroi/descrip - name - returns / sets name value for object
-% @maroi/display - display - method
-% @maroi/eq - overloaded eq function
-% @maroi/flip_lr - flips ROI left / right
-% @maroi/ge - overloaded ge function
-% @maroi/get_marsy - gets data in ROIs from images
-% @maroi/getdata - getdata method - fetches time series data for ROI from images
-% @maroi/gt - overloaded gt (greater than) function
-% @maroi/has_space - has_space method - returns true if object has a native space
-% @maroi/history - history - returns / sets history value for object
-% @maroi/label - label - returns / sets label value for object
-% @maroi/le - overloaded le (less than or equal to) function
-% @maroi/loadobj - loadobj method - fills fields needed for backwards compatibility
-% @maroi/lt - overloaded lt (less than) function
-% @maroi/maroi - maroi - class constructor for umbrella ROI object
-% @maroi/maroi_matrix - maroi_matrix method - converts roi to maroi matrix type
-% @maroi/minus - overloaded minus function
-% @maroi/mrdivide - overloaded mrdivide (matrix right divide) function
-% @maroi/mtimes - overloaded mtimes function
-% @maroi/native_space - native_space method - returns native space of object
-% @maroi/ne - overloaded ne function
-% @maroi/not - overloaded not function
-% @maroi/or - overloaded or function
-% @maroi/paramfields - returns struct with fields from maroi object useful for copying objects
-% @maroi/plus - overloaded plus function
-% @maroi/rdivide - overloaded rdivide function
-% @maroi/realpts - realpts method - returns 3xN XYZ matrix in mm
-% @maroi/rle - run length encoding method
-% @maroi/roithresh - roithresh - returns / sets roithresh value for object
-% @maroi/save_as_image - method save_as_image - saves ROI as image
-% @maroi/save_mricro - saves in MRIcro format
-% @maroi/saveroi - saveroi method - checks fname, sets source field, saves object
-% @maroi/source - source - returns / sets source value for object
-% @maroi/spm_hold - hold - returns / sets hold value for object
-% @maroi/times - overloaded times function
-% @maroi/volume - volume method - returns volume of ROI in mm
-% @maroi/xor - overloaded xor function
-%
-% @maroi/private/my_classdata - my_classdata method - sets/gets class data
-% @maroi/private/my_loadroi - my_loadroi function - loads ROI from file, sets source field
-% @maroi/private/my_roifname - changes fname to appropriate ROI format
-%
-% @maroi_box/centre - centre method - sets / returns centre of ROI in mm
-% @maroi_box/flip_lr - flips ROI left / right
-% @maroi_box/is_empty_roi - returns 1 if ROI contains no volume
-% @maroi_box/maroi_box - maroi_box - class constructor
-% @maroi_box/volume - volume method - returns volume of ROI in mm
-% @maroi_box/voxpts - voxpts method - voxels within a box in given space
-%
-% @maroi_image/flip_lr - flips ROI left / right
-% @maroi_image/loadobj - loadobj method - reloads matrix from img file
-% @maroi_image/maroi_image - maroi_image - class constructor
-% @maroi_image/maroi_matrix - maroi_matrix method - converts maroi_image to maroi_matrix
-% @maroi_image/saveobj - saveobj method - removes matrix information from parent to save space
-% @maroi_image/vol - vol - returns / sets image vol for object
-%
-% @maroi_image/private/my_vol_func - checks vol and func, returns processed image matrix or error
-%
-% @maroi_matrix/do_write_image - method saves matrix as image and returns spm_vol
-% @maroi_matrix/domaths - helper function to do maths on matrix object
-% @maroi_matrix/flip_lr - flips ROI left / right
-% @maroi_matrix/is_empty_roi - is_empty_roi - returns true if ROI contains no volume
-% @maroi_matrix/loadobj - loadobj function - undoes run length encoding if appropriate
-% @maroi_matrix/maroi_matrix - maroi_matrix - class constructor
-% @maroi_matrix/matrixdata - matrixdata method - gets matrix from ROI object
-% @maroi_matrix/native_space - native_space method - returns native space of object
-% @maroi_matrix/rebase - rebase method - returns data from maroi_matrix in new space
-% @maroi_matrix/saveobj - saveobj function - does run length encoding if helpful
-% @maroi_matrix/spm_mat - spm_mat method - returns mat file defining orientation etc
-% @maroi_matrix/voxpts - voxpts method - returns 3xN ijk matrix in voxels
-%
-% @maroi_matrix/private/my_rld - function to do run length decoding
-% @maroi_matrix/private/my_rle - method to do run length encoding on matrix
-%
-% @maroi_pointlist/flip_lr - flips ROI left / right
-% @maroi_pointlist/getvals - returns vals for pointlist object
-% @maroi_pointlist/is_empty_roi - is_empty_roi - returns true if ROI contains no volume
-% @maroi_pointlist/loadobj - loadobj method - creates temporary voxel block
-% @maroi_pointlist/maroi_matrix - maroi_matrix method - converts roi to maroi matrix type
-% @maroi_pointlist/maroi_pointlist - maroi_pointlist - class constructor
-% @maroi_pointlist/native_space - native_space method - returns native space of object
-% @maroi_pointlist/saveobj - saveobj method - removes temporary voxblock structure
-% @maroi_pointlist/voxpts - voxpts method - returns 3xN ijk matrix in voxels
-%
-% @maroi_pointlist/private/my_voxblock - returns voxel block and modified mat file for pointlist
-%
-% @maroi_shape/c_o_m - c_o_m method - calculates centre of mass
-% @maroi_shape/has_space - has_space method - returns true if object has a native space
-% @maroi_shape/maroi_matrix - method to convert shape objects to maroi_matrix objects
-% @maroi_shape/maroi_shape - maroi_shape - (virtual) shape roi class constructor
-%
-% @maroi_sphere/centre - centre method - sets / returns centre of ROI in mm
-% @maroi_sphere/flip_lr - flips ROI left / right
-% @maroi_sphere/is_empty_roi - is_empty_roi - returns true if ROI contains no volume
-% @maroi_sphere/maroi_sphere - maroi_sphere - class constructor
-% @maroi_sphere/volume - volume method - returns volume of ROI in mm
-% @maroi_sphere/voxpts - voxpts method - voxels within a sphere in given space
-%
-% @mars_space/display - display method for mars_space object
-% @mars_space/eq - overloaded eq method for mars_space objects
-% @mars_space/mars_space - mars_space - class constructor for space defining object
-% @mars_space/subsasgn - method to over load . notation in assignments.
-% @mars_space/subsref - method to overload the . notation.
-%
-% @marsy/as_summary_only - returns object with region data removed
-% @marsy/block_rows - gets/sets cell array of rows for each (subject/session) block
-% @marsy/can_summarize - returns 1 if object contains enough information to be summarized
-% @marsy/display - display method for marsy objects
-% @marsy/eq - method overrides == operator
-% @marsy/is_summarized - returns 1 if object contains calculated summary data
-% @marsy/is_summary_only - method returns 1 if object only contains summary data
-% @marsy/is_valid - method returns 1 if object contains valid data
-% @marsy/join - joins marsy objects into one object
-% @marsy/marsy - Class constructor for marsy: the MarsBaR data object
-% @marsy/n_blocks - method returns number of subjects/sessions in data
-% @marsy/n_regions - get number of regions
-% @marsy/n_time_points - get number of time_points
-% @marsy/ne - method overrides ~= operator
-% @marsy/region - gets / sets data for region or regions
-% @marsy/region_data - method gets or sets data for region(s) as cell array
-% @marsy/region_descrip - method gets or sets descrip for region(s) as cell array
-% @marsy/region_field - method gets or sets data for region field
-% @marsy/region_info - method gets or sets info for region(s) as cell array
-% @marsy/region_name - method gets or sets data for region name
-% @marsy/region_size - method to get size of specified region data
-% @marsy/region_weights - method gets or sets weights for region(s) as cell array
-% @marsy/resummarize - recalculate summary data if possible
-% @marsy/savestruct - saves data in y_struct as variables in .mat file
-% @marsy/split - method splits regions in object into separate objects
-% @marsy/sumfunc - method to get or set sumfunc
-% @marsy/summary - method returns cell array of strings describing marsy object
-% @marsy/summary_block_means - return raw means over blocks in summary data
-% @marsy/summary_data - method to get summary data, maybe set sumfunc
-% @marsy/summary_descrip - get/set method for summary data description
-% @marsy/summary_info - get/set method for summary data info
-% @marsy/summary_size - method returns number of time points x number of regions
-% @marsy/ui_plot - method plots data in various formats
-% @marsy/verbose - get/set method for verbose field
-% @marsy/xyz - gets XYZ coordinates for region
-% @marsy/y_struct - get/set method for y_struct field
-%
-% @marsy/private/pr_sum_func - creates summary stats for region data
-%
-% release/make_contents - MAKECONTENTS makes Contents file, usually in current working directory.
-% release/pre_release - Runs pre-release export, cleanup
-% release/test_rig - runs tests on MarsBaR using specified designs
-%
-% spm2/mars_blob_ui - Displays SPM results, and ROI menu in SPM input window
-% spm2/mars_veropts - returns SPM version specific parameters
-% spm2/spm_create_image - Wrapper for spm_create_vol, for compatibility with SPM99
-%
-% spm5/mars_blob_ui - Displays SPM results, and ROI menu in SPM input window
-% spm5/mars_veropts - returns SPM version specific parameters
-% spm5/spm_create_image - Wrapper for spm_create_vol, for compatibility with SPM99
-% spm5/spm_get - compatibility function to allow spm_get calls with SPM5
-%
-% spm99/mars_blob_ui - Displays SPM results, and ROI menu in SPM input window
-% spm99/mars_veropts - returns SPM version specific parameters
-% spm99/spm_close_vol - Close image volume - for SPM2 / SPM99 compatibility
-% spm99/spm_create_vol - Wrapper for spm_create_image, for compatibility with SPM2
-% spm99/spm_read_hdr - SPM2 routine to read (SPM customised) Analyze header
-% spm99/spm_write_plane - Write a transverse plane of image data.
-% spm99/spm_write_vol - Write an image volume to disk, setting scales and offsets as appropriate
diff --git a/lib/marsbar-0.44/examples/batch/README b/lib/marsbar-0.44/examples/batch/README
deleted file mode 100644
index c87074f..0000000
--- a/lib/marsbar-0.44/examples/batch/README
+++ /dev/null
@@ -1,34 +0,0 @@
-Batch processing scripts for MarsBaR example data
--------------------------------------------------
-
-This directory contains the batch scripts for preprocessing of the
-MarsBaR example dataset. You can get the dataset from the MarsBaR
-download page, currently:
-
-https://sourceforge.net/project/showfiles.php?group_id=76381
-
-To run initial processing on the dataset in SPM, start matlab, change
-('cd') to the '/examples/batch' directory, and, from the
-console window run:
-
-run_preprocess
-
-The routines will create smoothed images and run a standard
-SPM statistical model on each of the three sessions.
-
-The routines should work with SPM99 through SPM12.
-
-There is also an example batch script for MarsBaR that replicates the
-analyses described in the MarsBaR tutorial; see
-http://marsbar.sourceforge.net. To run:
-
-run_tutorial
-
-Please use the MarsBaR mailing list for any questions or to report
-problems:
-
-https://lists.souceforge.net/lists/listinfo/marsbar-users
-
-We wish you a pleasant FMRI experience,
-
-Matthew Brett - for the team
diff --git a/lib/marsbar-0.44/examples/batch/configure_er_model.m b/lib/marsbar-0.44/examples/batch/configure_er_model.m
deleted file mode 100644
index 798de53..0000000
--- a/lib/marsbar-0.44/examples/batch/configure_er_model.m
+++ /dev/null
@@ -1,92 +0,0 @@
-function model_file = configure_er_model(sess_dir, sesses, sdirname)
-% batch script wrapper to configure model for MarsBaR ER data
-%
-% sess_dir - directory containing session directories
-% sesses - string or cell array of session directory names
-% sdirname - subdirectory name to put model in
-%
-% Returns
-% model_file - full path to SPM model file
-%
-% This wrapper does single or multisesson analyses.
-%
-% If only one session directory is passed, and sdirname is not an absolute
-% path, then the function assumes sdirname is a subdirectory of the session
-% directory
-%
-% $Id: configure_er_model.m,v 1.1.1.1 2004/08/14 00:07:52 matthewbrett Exp $
-
-if nargin < 1
- error('Need directory containing session subdirectories');
-end
-if nargin < 2
- error('Need directory names for sessions');
-end
-if ischar(sesses), sesses = cellstr(sesses); end
-if nargin < 3
- error('Need subdirectory name for results');
-end
-
-% store path
-pwd_orig = pwd;
-
-% make absolute path
-sess_dir = spm_get('CPath', sess_dir);
-
-% If only one session directory is passed, and sdirname is not an
-% absolute path, then assume sdirname is a subdirectory of the session
-% directory
-if ~sf_isabspath(sdirname) & length(sesses) == 1
- sdir_parent = fullfile(sess_dir, sesses{1});
-else
- sdir_parent = sess_dir;
-end
-
-% results directory
-ana_dir = fullfile(sdir_parent, sdirname);
-if ~exist(ana_dir, 'dir')
- mkdir(sdir_parent, sdirname);
-end
-
-switch spm('ver')
- case 'SPM99'
- % Batch directory should be current directory, but maybe not
- m_file = 'er_model_spm99';
- ms = which(m_file);
- if isempty(ms)
- error(sprintf(['Hmm - can''t find %s on the path - maybe ' ...
- 'you should run from the batch directory'], ...
- m_file))
- end
-
- % Fill batch thing and send
- global SPM_BCH_VARS
- SPM_BCH_VARS = struct(...
- 'work_dir', ana_dir, ...
- 'sess_dir', sess_dir, ...
- 'sesses', {sesses}, ...
- 'ana_type', 1, ... % model
- 'm_file', ms);
- spm_bch('do_bch_wrapper');
- model_file = fullfile(ana_dir, 'SPMcfg.mat');
-
- otherwise
- er_model_spm2(sess_dir, sesses, ana_dir);
- model_file = fullfile(ana_dir, 'SPM.mat');
-
-end
-
-return
-
-function absf = sf_isabspath(path)
-%=======================================================================
-%-Returns true if path is absolute, false if relative (or empty)
-switch (spm_platform('filesys'))
-case 'unx'
- if (~isempty(path) & path(1)=='/'), absf=1; else, absf=0; end
-case 'win'
- if (length(path)>1 & path(2)==':'), absf=1; else, absf=0; end
-otherwise
- error('isabspath not coded for this filesystem');
-end
-return
diff --git a/lib/marsbar-0.44/examples/batch/do_bch_wrapper.m b/lib/marsbar-0.44/examples/batch/do_bch_wrapper.m
deleted file mode 100644
index 517a4c6..0000000
--- a/lib/marsbar-0.44/examples/batch/do_bch_wrapper.m
+++ /dev/null
@@ -1,37 +0,0 @@
-%---------------------------------------------------------------
-% Generic single analysis wrapper for SPM99 crash mode.
-% Sorry, I mean SPM99 batch mode.
-%---------------------------------------------------------------
-% The analysis parameters are specified here using the global variable
-% SPM_BCH_VARS
-% Fields are:
-% work_dir - work_dir
-% ana_type - number specifying analysis type
-% m_file - string giving mfile to run
-%
-% We have to use the global variable to pass parameters here because of
-% the peculiarities of the batch mode.
-%---------------------------------------------------------------
-%
-% $Id: do_bch_wrapper.m,v 1.1.1.1 2004/08/14 00:07:52 matthewbrett Exp $
-
-global SPM_BCH_VARS
-
-% get (and make) the subdirectory in the main directory
-work_dir = {SPM_BCH_VARS.work_dir};
-[pn1 pn2] = fileparts(work_dir{1});
-if ~exist(work_dir{1}, 'dir')
- mkdir(pn1, pn2);
-end
-
-analyses = struct( ...
- 'type', SPM_BCH_VARS.ana_type, ...
- 'index', 1, ...
- 'work_dir', 1, ...
- 'mfile', 1 ...
- );
-
-type = {'model','contrasts','defaults_edit','headers',...
- 'means','realign','normalize','smooth'};
-
-mfile = {SPM_BCH_VARS.m_file};
diff --git a/lib/marsbar-0.44/examples/batch/er_contrast_spm99.m b/lib/marsbar-0.44/examples/batch/er_contrast_spm99.m
deleted file mode 100644
index 3c44bc6..0000000
--- a/lib/marsbar-0.44/examples/batch/er_contrast_spm99.m
+++ /dev/null
@@ -1,12 +0,0 @@
-%------------------------------------------------------------------
-% SPM99 batch mfile to configure contrasts
-%------------------------------------------------------------------
-%
-% $Id: er_contrast_spm99.m,v 1.1.1.1 2004/08/14 00:07:52 matthewbrett Exp $
-
-global SPM_BCH_VARS
-
-con = SPM_BCH_VARS.contrasts;
-contrasts(1).names = con.names;
-contrasts(1).types = con.types;
-contrasts(1).values = con.values;
diff --git a/lib/marsbar-0.44/examples/batch/er_model_spm2.m b/lib/marsbar-0.44/examples/batch/er_model_spm2.m
deleted file mode 100644
index 3a20156..0000000
--- a/lib/marsbar-0.44/examples/batch/er_model_spm2.m
+++ /dev/null
@@ -1,119 +0,0 @@
-function SPM = er_model_spm2(sess_dir, sesses, ana_dir)
-% SPM2 batch script wrapper for ER data
-% FORMAT SPM = er_model_spm2(sess_dir, sesses)
-%
-% sess_dir - directory containing session directories
-% sesses - string or cell array of session directory names
-% ana_dir - analysis directory
-%
-% Returns
-% SPM - SPM model structure after configuration
-%
-% The script is specific to this design...
-%
-% $Id: er_model_spm2.m,v 1.1.1.1 2004/08/14 00:07:52 matthewbrett Exp $
-
-if nargin < 1
- error('Need directory containing session subdirectories');
-end
-if nargin < 2
- error('Need directory names for sessions');
-end
-if nargin < 3
- ana_dir = pwd;
-end
-
-if ischar(sesses), sesses = cellstr(sesses); end
-nsessions = length(sesses);
-
-pwd_store = pwd;
-cd(ana_dir);
-
-% load SPM defaults
-if ~exist('defaults', 'var')
- global defaults;
- spm_defaults;
-end
-
-% Specify some design stuff
-SPM.xY.RT = 2.02726; % seconds
-
-% Specify design
-%===========================================================================
-% global normalization: OPTOINS:'Scaling'|'None'
-%---------------------------------------------------------------------------
-SPM.xGX.iGXcalc = 'None';
-
-% low frequency confound: high-pass cutoff (secs) [Inf = no filtering]
-%---------------------------------------------------------------------------
-SPM.xX.K(1).HParam = 60;
-
-% intrinsic autocorrelations: OPTIONS: 'none'|'AR(1) + w'
-%-----------------------------------------------------------------------
-SPM.xVi.form = 'AR(1) + w';
-
-% basis functions and timing parameters
-%---------------------------------------------------------------------------
-% OPTIONS:'hrf'
-% 'hrf (with time derivative)'
-% 'hrf (with time and dispersion derivatives)'
-% 'Fourier set'
-% 'Fourier set (Hanning)'
-% 'Gamma functions'
-% 'Finite Impulse Response'
-%---------------------------------------------------------------------------
-SPM.xBF.name = 'hrf (with time derivative)';
-SPM.xBF.length = 24; % length in seconds
-SPM.xBF.order = 1; % order of basis set
-SPM.xBF.T = 16; % number of time bins per scan
-SPM.xBF.T0 = 1; % first time bin (see slice timing)
-SPM.xBF.UNITS = 'scans'; % OPTIONS: 'scans'|'secs' for onsets
-SPM.xBF.Volterra = 1; % OPTIONS: 1|2 = order of convolution
-
-condnames = {'vis_stim'};
-nconds = length(condnames);
-
-% specify filter for filenames
-Filter = 's*.img';
-
-PP = ''; stimons = [];
-for ss = 1:nsessions
- % directory containing scans
- fildir = fullfile(sess_dir, sesses{ss});
-
- % Condition stuff - onset times for visual stimulus
- condir = fullfile(fildir, 'onsets');
- condfile = spm_get('Files', condir, 'flash*.txt');
- condons = spm_load(condfile);
- tmp = condons(:,2); % get stimulus column
- tmp(tmp < 0) = 0; % correct negative onsets
- stimons{1} = tmp;
-
- for cno = 1:nconds
- SPM.Sess(ss).U(cno).name =condnames(cno);
- SPM.Sess(ss).U(cno).P(1).name = 'none'; % Parametric modulation
- SPM.Sess(ss).U(cno).ons = stimons{cno};
- SPM.Sess(ss).U(cno).dur = 0;
- end
-
- % file selection
- P = spm_get('files',fildir,Filter);
- SPM.nscan(ss) = size(P,1);
-
- % covariates
- SPM.Sess(ss).C.C = []; % [n x c double] covariates
- SPM.Sess(ss).C.name = {}; % [1 x c cell] names
-
- % set files
- PP = strvcat(PP, P);
-
-end
-
-% set files
-SPM.xY.P = PP;
-
-% Configure design matrix
-SPM = spm_fmri_spm_ui(SPM);
-
-% Return to original directory
-cd(pwd_store);
diff --git a/lib/marsbar-0.44/examples/batch/er_model_spm99.m b/lib/marsbar-0.44/examples/batch/er_model_spm99.m
deleted file mode 100644
index 2633c57..0000000
--- a/lib/marsbar-0.44/examples/batch/er_model_spm99.m
+++ /dev/null
@@ -1,81 +0,0 @@
-%------------------------------------------------------------------
-% SPM99 batch mfile to configure analysis for 3 sessions of ER data
-%------------------------------------------------------------------
-%
-% $Id: er_model_spm99.m,v 1.1.1.1 2004/08/14 00:07:52 matthewbrett Exp $
-
-global SPM_BCH_VARS
-
-sess_dir = SPM_BCH_VARS.sess_dir;
-sesses = SPM_BCH_VARS.sesses;
-nsessions = length(sesses);
-
-TR = 2.02726;
-condnames = {'vis_stim'};
-nconds = length(condnames);
-
-clear scannames scannos;
-for ss = 1:nsessions
- fildir = fullfile(sess_dir, sesses{ss});
- % get scan names for the analysis
- files = spm_get('Files', fildir, 's*.img');
- scannos(ss) = size(files,1);
- scannames(ss) = {files};
-
- % Condition stuff - onset times for visual stimulus
- condir = fullfile(fildir, 'onsets');
- condfile = spm_get('Files', condir, 'flash*.txt');
- condons = spm_load(condfile);
- stimons = condons(:,2); % get stimulus column
- stimons(stimons < 0) = 0; % correct negative onsets
-
- conditions(ss) = struct( ...
- 'names', {condnames},...
- 'onsets',{{stimons}},...
- 'types', {repmat({'events'},1,nconds)}, ...
- 'bf_ev', [ones(1,nconds)], ...
- 'bf_ep', [0], ...
- 'volterra', 0, ...
- 'variable_dur', 0 ...
- );
-
-end
-
-%---------------------------------------------------------------
-% batch variables defined here for analysis 'model'
-%---------------------------------------------------------------
-o = ones(1, nsessions);
-model(1) = struct( ...
- 'types', 4, ...
- 'global_effects', {'None'}, ...
- 'burst_mode', 0, ...
- 'HF_fil', 'specify', ...
- 'HF_cut', o * 60, ...
- 'LF_fil', 'hrf', ...
- 'LF_cut', 4, ...
- 'int_corr', 'none', ...
- 'now_later', 0 , ... % flag is 0 -> configure only
- 'stop_writing', 0, ...
- 'trial_fcon', 0, ...
- 'RT', TR, ...
- 'replicated', 0, ...
- 'nsess', nsessions, ...
- 'nscans', scannos, ...
- 'files', {scannames}, ...
- 'conditions_nb', [ones(1,nsessions) * nconds], ...
- 'conditions', [1:nsessions], ...
- 'regressors_nb', o * 0, ...
- 'regressors', [], ...
- 'parametrics_type', {repmat({'none'},1,nsessions)}, ...
- 'parametrics', [], ...
- 'stochastics_flag', [0], ...
- 'stochastics', [] ...
-);
-
-%-------------------------------------------
-
-bf_ev(1) = struct( ...
- 'ev_type', 2, ... % 2 <-> 'hrf + temporal derivative',
- 'win_len',[], ...
- 'order', [] ...
-);
diff --git a/lib/marsbar-0.44/examples/batch/er_smooth.m b/lib/marsbar-0.44/examples/batch/er_smooth.m
deleted file mode 100644
index 179abfc..0000000
--- a/lib/marsbar-0.44/examples/batch/er_smooth.m
+++ /dev/null
@@ -1,32 +0,0 @@
-function er_smooth(subjroot, sesses, filt, fwhm)
-% smooth images prior to analysis
-%
-% Inputs
-% subjroot - root directory containing session directories
-% sesses - cell array containing session subdirectories
-% filt - shell exp filter for selecting files
-% fwhm - FWHM in mm for smoothing
-%
-% $Id: er_smooth.m,v 1.1.1.1 2004/08/14 00:07:52 matthewbrett Exp $
-
-nsesses = length(sesses);
-
-imgs = '';
-for s = 1:nsesses
- dirn = fullfile(subjroot,sesses{s});
- % get files in this directory
- imgs = strvcat(imgs, spm_get('files', dirn, filt));
-end
-
-% and this is just spm_smooth_ui pasted/edited
-P = imgs;
-n = size(P,1);
-
-% implement the convolution
-%---------------------------------------------------------------------------
-for i = 1:n
- Q = deblank(P(i,:));
- [pth,nm,xt] = fileparts(deblank(Q));
- U = fullfile(pth,['s' nm xt]);
- spm_smooth(Q,U,fwhm);
-end
diff --git a/lib/marsbar-0.44/examples/batch/estimate_er_model.m b/lib/marsbar-0.44/examples/batch/estimate_er_model.m
deleted file mode 100644
index 3c630c0..0000000
--- a/lib/marsbar-0.44/examples/batch/estimate_er_model.m
+++ /dev/null
@@ -1,86 +0,0 @@
-function SPM = estimate_er_model(model_file, ev_con)
-% SPM estimate of ER model, and add contrast to ER model
-%
-% model_file - path to directory containing model
-%
-% Single or multisesson analyses.
-%
-% $Id: estimate_er_model.m,v 1.1.1.1 2004/08/14 00:07:52 matthewbrett Exp $
-
-if nargin < 1
- error('Need model filename');
-end
-if nargin < 2
- error('Need event contrast');
-end
-
-% Check for model
-if ~exist(model_file, 'file')
- error(['Cannot find ' model_file]);
-end
-SPM = load(model_file);
-if isfield(SPM, 'SPM'), SPM=SPM.SPM; end
-
-% Work out contrast, taking into account no of sessions
-nblocks = length(SPM.xX.iB); % number of sessions in this model
-con = [repmat(ev_con, 1, nblocks) zeros(1, nblocks)]';
-
-% new path, store path, move to model path
-swd = fileparts(model_file);
-pwd_orig = pwd;
-
-switch spm('ver')
- case 'SPM99'
- % Estimate parameters
- cd(swd);
- Sess=SPM.Sess; xsDes=SPM.xsDes; % because spm_spm uses inputname
- spm_spm(SPM.VY,SPM.xX,SPM.xM,SPM.F_iX0,Sess,xsDes);
-
- % add contrasts, estimate all contrasts
- cd(pwd_orig);
- global SPM_BCH_VARS
- con_struct = struct('names', {{'stim_hrf'}},...
- 'types', {{'T'}}, ...
- 'values', {{con'}});
-
- % Batch directory should be current directory, but maybe not
- m_file = 'er_contrast_spm99';
- ms = which(m_file);
- if isempty(ms)
- error(sprintf(['Hmm - can''t find %s on the path - maybe ' ...
- 'you should run from the batch directory'], ...
- m_file))
- end
-
- SPM_BCH_VARS = struct(...
- 'work_dir', swd, ...
- 'ana_type', 2, ... % contrasts
- 'm_file', ms, ...
- 'contrasts', con_struct);
- spm_bch('do_bch_wrapper');
-
- otherwise
- % load SPM defaults
- if ~exist('defaults', 'var')
- global defaults;
- spm_defaults;
- end
-
- % Estimate parameters
- cd(swd);
- spm_unlink(fullfile('.', 'mask.img')); % avoid overwrite dialog
- SPM = spm_spm(SPM);
-
- % add contrast, estimate all contrasts
- new_con = spm_FcUtil('Set','stim_hrf',...
- 'T','c',con,SPM.xX.xKXs);
- if isempty(SPM.xCon)
- SPM.xCon = new_con;
- else
- SPM.xCon(end + 1) = new_con;
- end
- SPM = spm_contrasts(SPM);
-
- % Back to where we started
- cd(pwd_orig);
-end
diff --git a/lib/marsbar-0.44/examples/batch/get_subjroot.m b/lib/marsbar-0.44/examples/batch/get_subjroot.m
deleted file mode 100644
index e6c603d..0000000
--- a/lib/marsbar-0.44/examples/batch/get_subjroot.m
+++ /dev/null
@@ -1,14 +0,0 @@
-function subjroot = get_subjroot()
-% FORMAT subjroot = get_subjroot()
-%
-% Gets the root path for the example data.
-% Looks first for an environment variable, if not defined, uses GUI
-subjroot = getenv('MARSBAR_EG_DATAPATH');
-% Otherwise fetch via the GUI
-if isempty(subjroot)
- subjroot = spm_get(-1, '', 'Root directory of example data');
-end
-if ~exist(fullfile(subjroot, 'sess1'), 'dir')
- error(sprintf('Expecting "sess1" directory in %s', subjroot))
-end
-return
diff --git a/lib/marsbar-0.44/examples/batch/run_preprocess.m b/lib/marsbar-0.44/examples/batch/run_preprocess.m
deleted file mode 100644
index c24c0f5..0000000
--- a/lib/marsbar-0.44/examples/batch/run_preprocess.m
+++ /dev/null
@@ -1,28 +0,0 @@
-% Run smoothing and SPM analysis for MarsBaR ER sample data
-%
-% $Id: run_preprocess.m,v 1.2 2004/08/15 01:19:43 matthewbrett Exp $
-
-% Start marsbar to make sure spm_get works
-marsbar('on')
-
-% You might want to define the path to the example data here, as in
-% subjroot = '/my/path/somewhere';
-subjroot = get_subjroot();
-
-sesses = {'sess1','sess2','sess3'};
-
-spm_v = spm('ver');
-sdirname = [spm_v '_ana'];
-if ~strcmp(spm_v, 'SPM99'), spm_defaults; end
-
-% Make sure SPM modality-specific defaults are set
-spm('defaults', 'fmri');
-
-% do smoothing
-er_smooth(subjroot, sesses, 'nu*.img', 8);
-
-% Run statistics, contrasts
-for ss = 1:length(sesses)
- model_file = configure_er_model(subjroot, sesses{ss}, sdirname);
- estimate_er_model(model_file, [1 0]);
-end
diff --git a/lib/marsbar-0.44/examples/batch/run_s3_model.m b/lib/marsbar-0.44/examples/batch/run_s3_model.m
deleted file mode 100644
index ae2ccab..0000000
--- a/lib/marsbar-0.44/examples/batch/run_s3_model.m
+++ /dev/null
@@ -1,18 +0,0 @@
-% Run SPM 2-session model for MarsBaR ER sample data
-%
-% You might want to define the path to the example data here, as in
-% subjroot = '/my/path/somewhere';
-subjroot = get_subjroot();
-
-sesses = {'sess1','sess2','sess3'};
-
-spm_v = spm('ver');
-sdirname = [spm_v '_ana'];
-if ~strcmp(spm_v, 'SPM99'), spm_defaults; end
-
-% Make sure SPM modality-specific defaults are set
-spm('defaults', 'fmri');
-
-% Run statistics, contrasts
-model_file = configure_er_model(subjroot, sesses, sdirname);
-estimate_er_model(model_file, [1 0]);
diff --git a/lib/marsbar-0.44/examples/batch/run_tutorial.m b/lib/marsbar-0.44/examples/batch/run_tutorial.m
deleted file mode 100644
index 817dedf..0000000
--- a/lib/marsbar-0.44/examples/batch/run_tutorial.m
+++ /dev/null
@@ -1,173 +0,0 @@
-% MarsBaR batch script to show off MarsBaR batching
-% This script replicates most of the work in the MarsBaR tutorial.
-% See http://marsbar.sourceforge.net
-%
-% The script assumes that the current directory is the 'batch' directory
-% of the example data set files.
-%
-% $Id: run_tutorial.m,v 1.3 2004/08/15 01:19:43 matthewbrett Exp $
-
-% Start marsbar to make sure spm_get works
-marsbar('on')
-
-% You might want to define the path to the example data here, as in
-% subjroot = '/my/path/somewhere';
-subjroot = get_subjroot();
-
-% Directory to store (and load) ROIs
-roi_dir = fullfile(subjroot, 'rois');
-
-% MarsBaR version check
-v = str2num(marsbar('ver'));
-if v < 0.35
- error('Batch script only works for MarsBaR >= 0.35');
-end
-
-% SPM version check. We need this to guess which model directory to use and
-% to get the SPM configured design name.
-spm_ver = spm('ver');
-sdirname = [spm_ver '_ana'];
-if strcmp(spm_ver, 'SPM99')
- conf_design_name = 'SPMcfg.mat';
-else
- spm_defaults;
- conf_design_name = 'SPM.mat';
-end
-
-% Set up the SPM defaults, just in case
-spm('defaults', 'fmri');
-
-% Subdirectory for reconfigured design
-mars_sdir = 'Mars_ana';
-
-% Get SPM model for session 2
-sess2_model_dir = fullfile(subjroot, 'sess2', sdirname);
-sess2_model = mardo(fullfile(sess2_model_dir, 'SPM.mat'));
-if ~is_spm_estimated(sess2_model)
- error(['Session 2 model has not been estimated. ' ...
- 'You may need to run the run_preprocess script']);
-end
-
-% Get activation cluster by loading T image
-con_name = 'stim_hrf';
-t_con = get_contrast_by_name(sess2_model, con_name);
-if isempty(t_con)
- error(['Cannot find the contrast ' con_name ...
- ' in the design; has it been estimated?']);
-end
-% SPM2 stores contrasts as vols, SPM99 as filenames
-if isstruct(t_con.Vspm)
- t_con_fname = t_con.Vspm.fname;
-else
- t_con_fname = t_con.Vspm;
-end
-% SPM5 designs can have full paths in their Vspm.fnames
-t_pth = fileparts(t_con_fname);
-if isempty(t_pth)
- t_con_fname = fullfile(sess2_model_dir, t_con_fname);
-end
-if ~exist(t_con_fname)
- error(['Cannot find t image ' t_con_fname ...
- '; has it been estimated?']);
-end
-
-% Get t threshold of uncorrected p < 0.05
-p_thresh = 0.05;
-erdf = error_df(sess2_model);
-t_thresh = spm_invTcdf(1-p_thresh, erdf);
-
-% get all voxels from t image above threshold
-V = spm_vol(t_con_fname);
-img = spm_read_vols(V);
-tmp = find(img(:) > t_thresh);
-img = img(tmp);
-XYZ = mars_utils('e2xyz', tmp, V.dim(1:3));
-
-% make into clusters, find max cluster
-cluster_nos = spm_clusters(XYZ);
-[mx max_index] = max(img);
-max_cluster = cluster_nos(max_index);
-cluster_XYZ = XYZ(:, cluster_nos == max_cluster);
-
-% Make ROI from max cluster
-act_roi = maroi_pointlist(struct('XYZ', cluster_XYZ, ...
- 'mat', V.mat), 'vox');
-
-% Make box ROI to do trimming
-box_limits = [-20 20; -66 -106; -20 7]';
-box_centre = mean(box_limits);
-box_widths = abs(diff(box_limits));
-box_roi = maroi_box(struct('centre', box_centre, ...
- 'widths', box_widths));
-
-% Combine for trimmed ROI
-trim_stim = box_roi & act_roi;
-
-% Give it a name
-trim_stim = label(trim_stim, 'batch_trim_stim');
-
-% save ROI to MarsBaR ROI file, in current directory, just to show how
-saveroi(trim_stim, fullfile(roi_dir, 'batch_trim_stim_roi.mat'));
-
-% Save as image
-save_as_image(trim_stim, fullfile(subjroot, 'batch_trim_stim.img'));
-
-% We will do estimation for the trimmed functional ROI, and for two
-% anatomical ROIs
-bg_L_name = fullfile(roi_dir, 'MNI_Putamen_L_roi.mat');
-bg_R_name = fullfile(roi_dir, 'MNI_Putamen_R_roi.mat');
-roi_array{1} = trim_stim;
-roi_array{2} = maroi(bg_L_name);
-roi_array{3} = maroi(bg_R_name);
-
-% MarsBaR estimation for sessions 1 and 3 follows
-pwd_orig = pwd;
-sesses = {'sess1', 'sess3'};
-
-% event specification for getting fitted event time-courses
-% A bit silly here, as we only have one session per model and one event type
-event_session_no = 1;
-event_type_no = 1;
-event_spec = [event_session_no; event_type_no];
-event_duration = 0; % default SPM event duration
-
-clear model_file
-for roi_no = 1:length(roi_array)
- roi = roi_array{roi_no};
- for ss = 1:length(sesses)
- % Run SPM model configuration, just to show we don't need to do SPM
- % estimation before using MarsBaR
- % We only need to do this for the first ROI, because we reuse the
- % design for each ROI
- if roi_no == 1
- model_file{ss} = configure_er_model(subjroot, sesses{ss}, mars_sdir);
- end
- D = mardo(model_file{ss});
- % Extract data
- Y = get_marsy(roi, D, 'mean');
- % MarsBaR estimation
- E = estimate(D, Y);
- % Add contrast, return model, and contrast index
- [E Ic] = add_contrasts(E, 'stim_hrf', 'T', [1 0 0]);
- % Get, store statistics
- stat_struct(ss) = compute_contrasts(E, Ic);
- % And fitted time courses
- [this_tc dt] = event_fitted(E, event_spec, event_duration);
- % Make fitted time course into ~% signal change
- tc(:, ss) = this_tc / block_means(E) * 100;
- end
- % Show calculated t statistics and contrast values
- % NB this next line only works when we have only one stat/contrast
- % value per analysis
- vals = [ [1 3]; [stat_struct(:).con]; [stat_struct(:).stat]; ];
- fprintf('Statistics for %s\n', label(roi));
- fprintf('Session %d; contrast value %5.4f; t stat %5.4f\n', vals);
- % Show fitted event time courses
- figure
- secs = [0:length(tc) - 1] * dt;
- plot(secs, tc)
- title(['Time courses for ' label(roi)], 'Interpreter', 'none');
- xlabel('Seconds')
- ylabel('% signal change');
- legend(sesses)
-end
diff --git a/lib/marsbar-0.44/install.txt b/lib/marsbar-0.44/install.txt
deleted file mode 100644
index dac16a4..0000000
--- a/lib/marsbar-0.44/install.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-MarsBaR installation
----------------------
-
-MarsBaR is a region of interest toolbox for use within SPM
-(http://wwww.fil.ion.ucl.ac.uk/spm).
-
-When you unpack the MarsBaR archive, you should have a new directory
-named after the MarsBaR release number for example "marsbar-0.21"
-
-You have two options for using MarsBaR within SPM.
-
-First, you can add the new MarsBaR directory to your matlab path. To
-use MarsBaR, start it from the matlab prompt with the command
-"marsbar".
-
-Second, you could copy / move or link the MarsBaR directory to the
-"marsbar" directory in the SPM "toolbox" directory. If you do this,
-the next time you start spm you can start the toolbox by selecting
-'marsbar' from the toolbox button on the SPM interface.
-
-Matthew Brett, 19 April 2003
diff --git a/lib/marsbar-0.44/mars_arm.m b/lib/marsbar-0.44/mars_arm.m
deleted file mode 100644
index de33d89..0000000
--- a/lib/marsbar-0.44/mars_arm.m
+++ /dev/null
@@ -1,63 +0,0 @@
-function varargout = mars_arm(action, varargin)
-% wrapper function for MarsBaR marmoire object
-% FORMAT varargout = mars_arm(action, varargin)
-%
-% This only to make the marsbar.m code prettier
-% See the help for the marmoire object for details
-%
-% $Id$
-
-global MARS
-if ~isfield(MARS, 'ARMOIRE')
- error('Global structure does not contain marmoire object');
-end
-
-if nargin < 1
- error('Need action');
-end
-
-o = MARS.ARMOIRE;
-
-switch lower(action)
- case 'get'
- [varargout{1} o varargout{2}] = get_item_data(o, varargin{:});
- case 'set'
- [o varargout{1}] = set_item_data(o, varargin{:});
- case 'clear'
- [o varargout{1}] = clear_item_data(o, varargin{:});
- case 'set_ui'
- [o varargout{1}] = set_item_data_ui(o, varargin{:});
- case 'update'
- [o varargout{1}] = update_item_data(o, varargin{:});
- case 'set_param'
- o = set_item_param(o, varargin{:});
- case 'get_param'
- varargout{1} = get_item_param(o, varargin{:});
- case 'save'
- [varargout{1} o] = save_item_data(o, varargin{:});
- case 'save_ui'
- [varargout{1} o] = save_item_data_ui(o, varargin{:});
- case 'isempty'
- varargout{1} = isempty_item_data(o, varargin{:});
- case 'item_exists'
- varargout{1} = item_exists(o, varargin{:});
- case 'show_summary'
- if nargin < 2, error('Need item name'); end
- item_name = varargin{1};
- if ~item_exists(o, item_name)
- error(['What is ' item_name '?']);
- end
- if mars_arm('isempty', item_name)
- S = {'[Empty]'};
- else
- S = summary(get_item_data(o, item_name));
- fn = get_item_param(o, item_name, 'file_name');
- if isempty(fn), fn = '[Not set]'; end
- S = [{['Filename: ' fn]} S];
- end
- mars_utils('graphic_text', S, get_item_param(o, item_name, 'title'));
- otherwise
- error(['Weird: ' action]);
-end
-
-MARS.ARMOIRE = o;
diff --git a/lib/marsbar-0.44/mars_arm_call.m b/lib/marsbar-0.44/mars_arm_call.m
deleted file mode 100644
index c84fc50..0000000
--- a/lib/marsbar-0.44/mars_arm_call.m
+++ /dev/null
@@ -1,169 +0,0 @@
-function [o,errf,msg] = mars_arm_call(action, o, item, old_o)
-% services callbacks from marmoire object set functions
-% FORMAT [o,errf,msg] = mars_arm_call(action, o, item)
-% See documentation for marmoire object for more detail
-%
-% action - action string
-% o - candidate object for checking etc
-% item - name of item that has just been set
-% old_o - object before set
-%
-% Returns
-% o - possibly modified object
-% errf - flag, set if error in processing
-% msg - message to examplain error
-%
-% $Id$
-
-if nargin < 1
- error('Need action');
-end
-if nargin < 2
- error('Need object');
-end
-if nargin < 3
- error('Need item name');
-end
-if nargin < 4
- error('Need old object');
-end
-
-errf = 0; msg = '';
-
-item_struct = get_item_struct(o, item);
-
-switch lower(action)
- case 'set_design'
- % callback for setting design
-
- % Check for save of current design
- [btn o] = save_item_data_ui(old_o, 'def_design', ...
- struct('ync', 1, ...
- 'prompt_prefix','previous '));
- if btn == -1
- errf = 1;
- msg = 'Cancelled save of previous design';
- return
- end
-
- % Make design into object, do conversions
- [item_struct.data errf msg] = sf_check_design(item_struct.data);
- if errf, o = []; return, end
- o = set_item_struct(o, item, item_struct);
-
- % Unload roi data if design has been set, and data exists
- % and data is not the same size as design
- if ~isempty_item_data(o, 'roi_data')
- [Y o] = get_item_data(o, 'roi_data');
- if n_time_points(Y) ~= n_time_points(item_struct.data)
- fprintf('Design and data have different numbers of rows\n');
- [btn o] = save_item_data_ui(o, 'roi_data', struct('ync', 1));
- if btn == -1, errf = 1; msg = 'ROI save cancelled'; return, end
- o = clear_item_data(o, 'roi_data');
- fprintf('Reset of design, cleared ROI data...\n');
- end
- end
-
- case 'set_data'
- % callback for setting data
-
- % Check for save of current data
- [btn o] = save_item_data_ui(old_o, 'roi_data', ...
- struct('ync', 1, ...
- 'prompt_prefix','previous '));
- if btn == -1
- errf = 1; o = [];
- msg = 'Cancelled save of current data';
- return
- end
-
- % Make data into object, do conversions
- [item_struct.data errf msg] = sf_check_data(item_struct.data);
- if errf, o = []; return, end
- o = set_item_struct(o, item, item_struct);
-
- % Check data matches default design; clear if not
- if ~isempty_item_data(o, 'def_design')
- [D o] = get_item_data(o, 'def_design');
- if n_time_points(D) ~= n_time_points(item_struct.data)
- fprintf('Design and data have different numbers of rows\n');
- [btn o] = save_item_data_ui(o, 'def_design', struct('ync', 1));
- if btn == -1, errf = 1; msg = 'Design save cancelled'; return, end
- o = clear_item_data(o, 'def_design');
- fprintf('Reset of ROI data, cleared default design...\n');
- end
- end
-
- % Clear default region if data has changed
- global MARS;
- if mars_struct('isthere', MARS, 'WORKSPACE', 'default_region')
- MARS.WORKSPACE.default_region = [];
- fprintf('Reset of data, cleared default region...\n');
- end
-
- case 'set_results'
- % callback for setting results
-
- % Need to set default data from results, and load contrast file
- % if not present (this is so for old MarsBaR results)
-
- data = item_struct.data;
- if isempty(data), return, end
-
- % Check for save of current design
- [btn o] = save_item_data_ui(old_o, 'est_design', ...
- struct('ync', 1, ...
- 'prompt_prefix','previous '));
- if btn == -1
- errf = 1;
- msg = 'Cancelled save of current design';
- return
- end
-
- % Make design into object, do conversions
- [data errf msg] = sf_check_design(data);
- if errf, return, end
- if ~is_mars_estimated(data)
- error('Design has not been estimated')
- end
-
- % Deal with case of old MarsBaR designs
- if ~has_contrasts(data);
- fname = spm_get(1, '*x?on.mat', 'Select contrast file');
- [pth, fn, ext] = fileparts(fname);
- tmp = load(fname);
- % Default refreshing
- refreshf = mars_get_option('statistics', 'refresh_contrasts');
- % If the filename does not correspond to marsbar estimation, refresh the
- % contrasts for safety (the user could have selected an SPM xCon fle).
- refreshf = refreshf | ~strcmp(fn, 'mars_xCon.mat')
- data = set_contrasts(data, tmp, refreshf);
- end
-
- % Put data into object
- item_struct.data = data;
- o = set_item_struct(o, item, item_struct);
-
- otherwise
- error(['Peverse request for ' action]);
-end
-
-function [d,errf,msg] = sf_check_design(d)
-% Make design into object, do conversions
-errf = 0; msg = {};
-d = mardo(d);
-if ~is_valid(d)
- errf = 1;
- msg = 'This does not appear to be a valid design';
-end
-return
-
-function [d,errf,msg] = sf_check_data(d)
-% Make data structure into object, do conversions
-errf = 0; msg = {};
-d = marsy(d);
-if ~is_valid(d)
- errf = 1;
- msg = 'This does not appear to be a valid data structure';
-end
-return
diff --git a/lib/marsbar-0.44/mars_armoire.m b/lib/marsbar-0.44/mars_armoire.m
deleted file mode 100644
index 6b46af4..0000000
--- a/lib/marsbar-0.44/mars_armoire.m
+++ /dev/null
@@ -1,464 +0,0 @@
-function varargout = mars_armoire(action, item, data, filename)
-% multifunction function to get/set various stores of stuff
-% (armoire is the French for cupboard).
-% FORMAT varargout = mars_armoire(action, item, data, filename)
-%
-% This cupboard is to put items which I will want to fish out
-% from time to time.
-%
-% The items may well be associated with a filename
-% If they are associated with a filename when set, they
-% are assumed to have been saved already.
-% If not, they are flagged as awaiting a save
-%
-% If the data changes, you can indicate this with the
-% update method, which changes the data, and flags for a save
-%
-% In terms of the program structure, the function acts an object container,
-% but where the objects are only half implemented, in this case as fields in
-% a global variable MARMOIRE.
-%
-% The permissable actions are:
-%
-% add - add an item to the armoire
-% exist - ask if there an exists an item of given name
-% add_if_absent - adds item if it does not yet exist
-% set - sets data for item
-% get - gets data from item
-% set_ui - sets data, getting via UI
-% save - save data for item, if required
-% save_ui - saves, using GUI to ask for filename
-% For save and save_ui, the 'data' argument
-% can contain a structure with flags.
-% Fields in flag structure can be
-% 'force' - force save even if not flagged as needed
-% 'warn_empty' - GUI warn if no data to save
-% 'ync' - start save with save y/n/cancel dialog
-% 'prompt' - prompt for save;
-% 'prompt_suffix - suffix for prompt
-% 'prompt_prefix - prefix for prompt
-% 'ui' - use UI prompts for save - forced if save_ui
-% 'no_no_save' - if 'no' is chosen in the save dialog,
-% contents are flagged as not needing a save in
-% the future (has_changed flag set to 0)
-% save 'all' - saves data for all items, if required
-% update - updates data, sets flag to show change
-% clear - clears data for item
-% isempty - returns 1 if no data for item
-% need_save - returns 1 if this item needs a save
-%
-% And for use in debugging:
-% dump - returns contents of the underling variable
-%
-% for any other action string, mars_armoire will look to see if the action
-% matches any of the field names in the structures and get/set this
-% fieldname value (set if data is not empty, get otherwise)
-%
-% Each item is stored in a field in the global variable
-%
-% The name of the field is the 'item' argument to this function
-% Each item field requires the following fields
-%
-% data - the data
-% (or a filename which loads as the data - see the
-% char_is_filename field)
-% has_changed - flag, if set, means data has changed since first set
-% save_if_changed - flag, if set, will try to save changed data when a
-% save is requested. Saves can also be forced.
-% leave_as_file - flag, if set, will attempt to leave the data, defined
-% by the filename, on the disk, not in memory, and only
-% load the data for a 'get'.
-% Otherwise, if a set occurs, and the data field is
-% empty, will load data into the global variable when
-% 'set'ing field and leave it there.
-% If the data changes, and requires a save, this field
-% has no function, until the next save.
-% file_name - file name of .mat file containing data
-% If data is empty, and file_name is not,
-% an attempt to 'get' data will load contents of
-% file_name
-% default_file_name - default filename offered for save
-% file_type - type of file to load ('mat' or 'ascii')
-% char_is_filename - flag, if set, char data is assumed to be a filename
-% filter_spec - filter spec for uigetfile (see help uigetfile)
-% prompt - prompt for uigetfile
-% verbose - flag, if set, displays more information during
-% processing
-% set_action - actions to perform when item is set
-% in form of callback string. This is executed
-% in the 'i_set' subfunction, and can use all
-% variables functions defined therein. See programmers
-% notes in the function for callback format
-% set_action_if_update - flag, if set, applied set_action for 'update' as
-% well as 'set'
-% set_action_if_clear - flag, if set, applied set_action for 'clear' as
-% well as 'set'
-%
-% $Id$
-
-% Programmers' notes
-% ------------------
-% set_action callbacks
-% callbacks should be one of the following two formats;
-%
-% [data errf msg] = my_function(args) or
-% [item_field errf msg] = my_function(args)
-%
-% The first form just returns the data desired to be set,
-% the second returns the whole item field, where the data
-% is contained in the field 'data'.
-% if 'errf' is set, the routine warns, and abort the set with
-% the 'msg'.
-%
-% The available args are:
-% I - proposed whole item field contents
-% data - proposed data to be inserted
-% passed_filename - filename passed to function
-%
-% and anything else...
-
-% NaN for an argument signals it has not been passed
-% empty means that it was passed, but was empty
-if nargin < 1 % no action
- error('Need action!');
- return
-end
-if ~ismember(action, {'dump'})
- if nargin < 2 % no item
- error('Need item!');
- return
- end
-end
-if nargin < 3
- data = NaN;
-end
-if nargin < 4
- filename = NaN;
-end
-
-% certain actions do not require valid item names
-if ~ismember(action, ...
- {'add', 'add_if_absent', 'exist', 'dump', 'save_all'})
- % the rest do
- flist = i_item_list;
- switch item
- case 'all'
- % If item is 'all', do this action for all items
- % Watch for save_ui, as we need to look out for cancel
- s_u_f = strcmp(lower(action), 'save_ui');
- a = {};
- for fn = flist'
- a{end+1} = mars_armoire(action, fn{1}, data, filename);
- if s_u_f & (a{end} == -1), varargout = {-1}; return, end
- end
- varargout = a;
- return
- otherwise
- % item must be a field name in structure
- % fetch and set name field
- if ~ismember(item, flist)
- error([item ' is an unaccountable item']);
- end
- i_contents = i_up_dump(item);
- i_contents.name = item;
- i_contents.last_action = action;
- end
-end
-
-% run actions
-switch lower(action)
- case 'add'
- data.name = item;
- I = i_def;
- def_fns = fieldnames(I);
- new_fns = def_fns(~ismember(def_fns, fieldnames(data)));
- for fn = new_fns'
- data = setfield(data, fn{1}, getfield(I, fn{1}));
- end
- i_down_dump(data);
- case 'add_if_absent'
- if ~mars_armoire('exist', item)
- mars_armoire('add', item, data);
- end
- case 'exist'
- varargout = {ismember(item, i_item_list)};
- case 'default_item'
- varargout = {i_def};
- case 'set'
- if is_nan(data) & is_nan(filename)
- varargout = {i_set_ui(i_contents)};
- else
- varargout = {i_set(i_contents, data, filename)};
- end
- case 'get'
- if i_isempty(i_contents)
- varargout = {i_set_ui(i_contents)};
- else
- varargout = {i_get(i_contents)};
- end
- case 'set_ui'
- varargout = {i_set_ui(i_contents)};
- case 'update'
- varargout = {i_set(i_contents, data, filename)};
- i_contents = i_up_dump(item);
- i_contents.has_changed = 1;
- i_down_dump(i_contents);
- case 'clear'
- varargout = {i_set(i_contents, [], '')};
- case 'save'
- if is_nix(filename) & ...
- isempty(i_contents.file_name)
- varargout = {i_save_ui(i_contents, data, filename)};
- else
- varargout = {i_save(i_contents, data, filename)};
- end
- case 'save_ui'
- % data is used as flags for save call
- if ~isstruct(data), data = []; end
- data.ui = 1;
- varargout = {i_save_ui(i_contents, data, filename)};
- case 'need_save'
- varargout = {i_need_save(i_contents)};
- case 'isempty'
- varargout = {i_isempty(i_contents)};
- case 'dump'
- varargout = {i_dump};
- otherwise
- % look in fieldnames
- if ismember(action, fieldnames(i_contents))
- if ~is_nan(data) % it's a set
- i_contents = setfield(i_contents, action, data);
- i_down_dump(i_contents);
- end
- varargout = {getfield(i_contents, action)};
- else % really, this must be a mistake
- error(['The suggested action, ' action ', is disturbing']);
- end
-end
-return % end of main function
-
-function I = i_def
-% returns default item
-I = struct('data', [],...
- 'file_name', '',...
- 'default_file_name','',...
- 'has_changed', 0,...
- 'leave_as_file', 0,...
- 'save_if_changed', 1,...
- 'file_type', 'mat',...
- 'char_is_filename',1,...
- 'set_action_if_update', 0 ,...
- 'set_action_if_clear', 0 ,...
- 'verbose', 1,...
- 'title', 'file',...
- 'filter_spec', '',...
- 'set_action', '');
-return
-
-function res = i_isempty(I)
-res = isempty(I.data) & isempty(I.file_name);
-return
-
-function res = i_set_ui(I)
-[fn pn] = mars_uifile('get', I.filter_spec, ['Select ' I.title '...']);
-if isequal(fn,0) | isequal(pn,0), res = []; return, end
-res = i_set(I, [], fullfile(pn, fn));
-return
-
-
-function res = i_set(I, data, filename)
-
-% Keep copy of passed filename for set_action call
-passed_filename = filename;
-
-% optionally, treat char data as filename
-% but passed filename overrides char data
-if I.char_is_filename & ischar(data)
- if ~is_nix(filename)
- warning(sprintf(...
- 'Passed filename %s overrides data filename %s\n',...
- filename, data));
- else
- filename = data;
- end
- data = [];
-end
-
-if is_nix(filename) % may need to save if no associated filename
- I.has_changed = 1;
-else % don't need to save, but may need to load from file
- I.has_changed = 0;
- if isempty(data)
- data = load(filename, ['-' I.file_type]);
- end
-end
-I.data = data;
-
-% If no filename passed:
-% if new set, filename is empty
-% if an update, filename stays
-is_update = strcmp(I.last_action, 'update');
-if is_nan(filename)
- if ~is_update
- filename = '';
- end
-end
-I.file_name = filename;
-
-% If this was a clear, don't flag for save
-if i_isempty(I), I.has_changed = 0; end
-
-% and here is where we do the rules stuff
-is_clear = strcmp(I.last_action, 'clear');
-if ~isempty(I.set_action) & ...
- (ismember(I.last_action, {'get','set','set_ui'}) | ...
- (is_update & I.set_action_if_update) | ...
- (is_clear & I.set_action_if_clear))
- [tmp errf msg] = eval(I.set_action);
- if errf
- res = [];
- warning(['Data not set: ' msg]);
- return
- end
- % work out if whole thing as been returned, or only data
- if isfield(tmp, 'set_action') % whole thing
- I = tmp;
- else % it's just the data
- I.data = tmp;
- end
-end
-
-% return set data
-res = I.data;
-
-% possibly remove data from structure
-if ~I.has_changed & I.leave_as_file
- I.data = [];
-end
-
-% do the actual save into global structure
-i_down_dump(I);
-
-return
-
-function res = i_get(I)
-res = I.data;
-if isempty(res) & ~isempty(I.file_name)
- res = load(I.file_name, ['-' I.file_type]);
-end
-return
-
-function res = i_save_ui(I, flags, filename)
-if ~isstruct(flags), flags = []; end
-if i_isempty(I) & isfield(flags, 'warn')
- msgbox('Nothing to save', [I.title ' is not set'], 'warn');
- res = 0;
- return
-end
-flags.ui = 1;
-res = i_save(I, flags, filename);
-return
-
-function res = i_save(I, flags, filename)
-% data field is treated as flags
-if is_nix(flags) flags == []; end
-if is_nix(filename), filename = I.file_name; end
-if is_nix(filename), filename = I.default_file_name; end
-if i_need_save(I) | isfield(flags, 'force') % force flag
- % prompt for filename if UI
- if isfield(flags, 'ui')
- % Work out prompt
- if isfield(flags, 'prompt')
- prompt = flags.prompt;
- else
- prompt = I.title;
- end
- if isfield(flags, 'prompt_prefix')
- prompt = [flags.prompt_prefix prompt];
- end
- if isfield(flags, 'prompt_suffix')
- prompt = [prompt flags.prompt_suffix];
- end
- if isfield(flags, 'ync')
- save_yn = questdlg(['Save ' prompt '?'],...
- 'Save', 'Yes', 'No', 'Cancel', 'Yes');
- if strcmp(save_yn, 'Cancel'), res = -1; return, end
- if strcmp(save_yn, 'No')
- if isfield(flags, 'no_no_save')
- I.has_changed = 0;
- i_down_dump(I);
- end
- res = 0;
- return
- end
- end
- pr = ['Filename to save ' prompt];
- [f p] = mars_uifile('put', I.filter_spec, pr, filename);
- if all(f==0), res = -1, return, end
- filename = fullfile(p, f);
- end
- savestruct(I.data, filename);
- if I.verbose
- fprintf('%s saved to %s\n', I.title, filename);
- end
- I.file_name = filename;
- I.has_changed = 0;
- if I.leave_as_file
- % maintain only on file, as it has beed saved
- I.data = [];
- end
- res = 1;
- i_down_dump(I);
-else
- res = 0;
-end
-return
-
-function res = i_need_save(I)
-res = ~i_isempty(I) & I.has_changed & I.save_if_changed;
-return
-
-function res = is_nix(v)
-res = isempty(v) | is_nan(v);
-return
-
-function res = is_nan(v)
-res = 0;
-if isnumeric(v) & ~isempty(v)
- res = isnan(v);
-end
-return
-
-function items = i_item_list
-items = g_fieldnames;
-return
-
-function I = i_up_dump(i_name)
-I = g_getfield(i_name);
-return
-
-% Routines below explicity manipulate global variable
-
-function I = i_dump
-global MARMOIRE
-I = MARMOIRE;
-return
-
-function I = i_down_dump(I)
-global MARMOIRE
-MARMOIRE = setfield(MARMOIRE, I.name, I);
-return
-
-function fns = g_fieldnames
-global MARMOIRE
-if isempty(MARMOIRE) | ~isstruct(MARMOIRE)
- fns = {};
-else
- fns = fieldnames(MARMOIRE);
-end
-return
-
-function r = g_getfield(fn)
-global MARMOIRE
-r = getfield(MARMOIRE, fn);
-return
diff --git a/lib/marsbar-0.44/mars_blob2roi.m b/lib/marsbar-0.44/mars_blob2roi.m
deleted file mode 100644
index 5366b41..0000000
--- a/lib/marsbar-0.44/mars_blob2roi.m
+++ /dev/null
@@ -1,33 +0,0 @@
-function mars_blob2roi(xSPM, pt)
-% saves ROI for cluster in xSPM structure, containing point pt
-% FORMAT mars_blob2roi(xSPM, pt)
-%
-% Input
-% xSPM - SPM results structure with needed fields
-% title
-% XYZ - voxel coordinates of activated points
-% Z - statistic values for activated points
-% M - 4x4 matrix from voxels to mm
-%
-% $Id$
-
-if nargin < 1
- error('Need SPM structure');
-end
-if nargin < 2
- error('Need point to identify cluster');
-end
-
-vx_i = spm_XYZreg('findxyz', pt, xSPM.XYZmm);
-if isempty(vx_i)
- msgbox('No activated voxel at this location');
- return
-end
-Clusters = spm_clusters(xSPM.XYZ);
-cXYZ = xSPM.XYZmm(:, Clusters==Clusters(vx_i));
-if isempty(cXYZ), return, end
-d = sprintf('%s cluster at [%0.1f %0.1f %0.1f]', xSPM.title, pt);
-l = sprintf('%s_%0.0f_%0.0f_%0.0f', xSPM.title, pt);
-o = maroi_pointlist(struct('XYZ',cXYZ, 'mat', xSPM.M, ...
- 'label', l, 'descrip', d));
-marsbar('saveroi', o);
diff --git a/lib/marsbar-0.44/mars_blob_menu.m b/lib/marsbar-0.44/mars_blob_menu.m
deleted file mode 100644
index 66cda45..0000000
--- a/lib/marsbar-0.44/mars_blob_menu.m
+++ /dev/null
@@ -1,56 +0,0 @@
-function hC = mars_blob_menu
-% puts up ROI menu to add to SPM results interface
-% FORMAT hC = mars_blob_menu
-%
-% Returns
-% hC - handle of menu
-%
-% $Id$
-
-% Tag
-tg = 'blob_menu';
-
-%-Get Interactive window and delete any previous DesRepUI menu
-%-----------------------------------------------------------------------
-Finter = spm_figure('GetWin','Interactive');
-delete(findobj(get(Finter,'Children'),'flat','Tag',tg))
-
-hC = uimenu(Finter,'Label','Write ROI(s)',...
- 'Separator','on',...
- 'Tag',tg,...
- 'UserData','',...
- 'HandleVisibility','on');
-
-%-Write one blob
-%-----------------------------------------------------------------------
-hWo = uimenu(hC,'Label','Write one cluster','Accelerator','O',...
- 'CallBack','mars_blob_ui(''save_one'')',...
- 'UserData',hC,...
- 'HandleVisibility','off');
-
-%-Write all blobs
-%-----------------------------------------------------------------------
-hWo = uimenu(hC,'Label','Write all clusters','Accelerator','A',...
- 'CallBack','mars_blob_ui(''save_many'')',...
- 'UserData',hC,...
- 'HandleVisibility','off');
-
-%-Rerun results ui
-%-----------------------------------------------------------------------
-hWo = uimenu(hC,'Label','Rerun results UI','Accelerator','R',...
- 'CallBack','mars_blob_ui(''reinit'')',...
- 'UserData',hC,...
- 'HandleVisibility','off');
-%-Clear
-%-----------------------------------------------------------------------
-uimenu(hC,'Label','Clear','Accelerator','L','Separator','on',...
- 'CallBack','spm_results_ui(''Clear'')',...
- 'HandleVisibility','off');
-
-%-Pop open 'Interactive' window
-%-----------------------------------------------------------------------
-figure(Finter)
-
-%-Return handle of menu
-%-----------------------------------------------------------------------
-varargout = {hC};
diff --git a/lib/marsbar-0.44/mars_blobs2rois.m b/lib/marsbar-0.44/mars_blobs2rois.m
deleted file mode 100644
index 6755909..0000000
--- a/lib/marsbar-0.44/mars_blobs2rois.m
+++ /dev/null
@@ -1,64 +0,0 @@
-function mars_blobs2rois(xSPM, roipath, rootn)
-% creates ROIs from spm_results_ui SPM
-% FORMAT mars_blobs2rois(xSPM, roipath, rootn)
-%
-% Inputs
-% xSPM - SPM results structure with needed fields
-% title
-% XYZ - voxel coordinates of activated points
-% Z - statistic values for activated points
-% M - 4x4 matrix from voxels to mm
-% roipath - directory in which to write ROIs
-% rootn - root name for ROI(s)
-
-if nargin < 1
- error('Need SPM structure');
-end
-if nargin < 2
- roipath = '';
-end
-if nargin < 3
- rootn = '';
-end
-
-if isempty(roipath)
- roipath = spm_get([-1 0], '', 'Directory to save ROI(s)');
-end
-if isempty(roipath)
- return
-end
-if isempty(rootn)
- rootn = mars_utils('str2fname', xSPM.title);
- rootn = spm_input('Root name for clusters', '+1', 's', rootn);
-end
-
-pre_ones = ones(1, size(xSPM.XYZ,2));
-clusters = spm_clusters(xSPM.XYZ);
-[N Z maxes A] = spm_max(xSPM.Z,xSPM.XYZ);
-
-for c = unique(A(:)')
- % maximum maximum for this cluster
- tmp = Z; tmp(A~=c) = -Inf;
- [tmp mi] = max(tmp);
- % voxel coordinate of max
- vco = maxes(:, mi);
- % in mm
- maxmm = xSPM.M * [vco; 1];
- maxmm = maxmm(1:3);
- % corresponding cluster in spm_clusters, XYZ for cluster
- my_c = clusters(all(xSPM.XYZ == vco * pre_ones));
- XYZ = xSPM.XYZ(:, clusters == my_c(1));
- if ~isempty(XYZ)
- % file name and labels
- d = sprintf('%s cluster at [%0.1f %0.1f %0.1f]', rootn, maxmm);
- l = sprintf('%s_%0.0f_%0.0f_%0.0f', rootn, maxmm);
- fn = mars_utils('str2fname', l);
- fname = maroi('filename', fullfile(roipath, fn));
- o = maroi_pointlist(struct('XYZ',XYZ,'mat',xSPM.M,...
- 'descrip',d, 'label', l), ...
- 'vox');
- fprintf('\nSaving %s as %s...', d, fname);
- saveroi(o, fname);
- end
-end
-fprintf('\nDone...\n');
diff --git a/lib/marsbar-0.44/mars_build_roi.m b/lib/marsbar-0.44/mars_build_roi.m
deleted file mode 100644
index acb8417..0000000
--- a/lib/marsbar-0.44/mars_build_roi.m
+++ /dev/null
@@ -1,107 +0,0 @@
-function o = mars_build_roi
-% builds ROIs via the SPM GUI
-%
-% $Id$
-
-o = [];
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Build ROI', 0);
-
-% get ROI type
-optfields = {'image','voxel', 'sphere', 'box_cw', 'box_lims'};
-optlabs = {'Image', 'Voxel', 'Sphere',...
- 'Box (centre,widths)', 'Box (ranges XYZ)'};
-
-roitype = char(...
- spm_input('Type of ROI', '+1', 'm',{optlabs{:} 'Quit'},...
- {optfields{:} 'quit'},length(optfields)+1));
-
-% For selecting images, later
-img_flt = mars_veropts('get_img_ext');
-
-d = [];
-switch roitype
- case 'image'
- imgname = spm_get(1, img_flt, 'Image defining ROI');
- [p f e] = fileparts(imgname);
- binf = spm_input('Maintain as binary image', '+1','b',...
- ['Yes|No'], [1 0],1);
- func = '';
- if spm_input('Apply function to image', '+1','b',...
- ['Yes|No'], [1 0],1);
- spm_input('img < 30',1,'d','Example function:');
- func = spm_input('Function to apply to image', '+1', 's', 'img');
- end
- d = f; l = f;
- if ~isempty(func)
- d = [d ' func: ' func];
- l = [l '_f_' func];
- end
- if binf
- d = [d ' - binarized'];
- l = [l '_bin'];
- end
- o = maroi_image(struct('vol', spm_vol(imgname), 'binarize',binf,...
- 'func', func));
-
- % convert to matrix format to avoid delicacies of image format
- o = maroi_matrix(o);
-
- case 'voxel'
- not_donef = 1;
- while not_donef
- XYZ = spm_input('Coordinate(s)', '+1', 'e', []);
- if size(XYZ,1) == 1, XYZ = XYZ'; end
- if size(XYZ,1) ~= 3, warning('Need 3xN or Nx3 matrix');
- else not_donef = 0; end
- end
- v = char(spm_input('Coordinate(s) in','+1','b','mm|voxels',{'mm','vox'}, 1));
- spopts = {'spacebase','image'};
- splabs = {'Base space for ROIs','From image'};
- spo = spm_input('Space for voxel ROI', '+1', 'm',splabs,...
- spopts, 1);
- switch char(spo)
- case 'spacebase'
- sp = maroi('classdata', 'spacebase');
- case 'image'
- img = spm_get([0 1], img_flt, 'Image defining space');
- if isempty(img),return,end
- sp = mars_space(img);
- end
- o = maroi_pointlist(struct('XYZ', XYZ, 'mat', sp.mat), v);
- if size(XYZ, 2) > 1
- pos = c_o_m(o); coord_lbl = 'C.o.M.';
- else
- pos = XYZ; coord_lbl = 'coordinate';
- end
- d = sprintf('points; %s (%s) [%0.1f %0.1f %0.1f]',coord_lbl,v,pos);
- l = sprintf('points_%s_%s_%0.0f_%0.0f_%0.0f',coord_lbl,v,pos);
- case 'sphere'
- c = spm_input('Centre of sphere (mm)', '+1', 'e', [], 3);
- r = spm_input('Sphere radius (mm)', '+1', 'r', 10, 1);
- d = sprintf('%0.1fmm radius sphere at [%0.1f %0.1f %0.1f]',r,c);
- l = sprintf('sphere_%0.0f-%0.0f_%0.0f_%0.0f',r,c);
- o = maroi_sphere(struct('centre',c,'radius',r));
- case 'box_cw'
- c = spm_input('Centre of box (mm)', '+1', 'e', [], 3);
- w = spm_input('Widths in XYZ (mm)', '+1', 'e', [], 3);
- d = sprintf('[%0.1f %0.1f %0.1f] box at [%0.1f %0.1f %0.1f]',w,c);
- l = sprintf('box_w-%0.0f_%0.0f_%0.0f-%0.0f_%0.0f_%0.0f',w,c);
- o = maroi_box(struct('centre',c,'widths',w));
- case 'box_lims'
- X = sort(spm_input('Range in X (mm)', '+1', 'e', [], 2));
- Y = sort(spm_input('Range in Y (mm)', '+1', 'e', [], 2));
- Z = sort(spm_input('Range in Z (mm)', '+1', 'e', [], 2));
- A = [X Y Z];
- c = mean(A);
- w = diff(A);
- d = sprintf('box at %0.1f>X<%0.1f %0.1f>Y<%0.1f %0.1f>Z<%0.1f',A);
- l = sprintf('box_x_%0.0f:%0.0f_y_%0.0f:%0.0f_z_%0.0f:%0.0f',A);
- o = maroi_box(struct('centre',c,'widths',w));
- case 'quit'
- o = [];
- return
- otherwise
- error(['Strange ROI type: ' roitype]);
-end
-o = descrip(o,d);
-o = label(o,l);
diff --git a/lib/marsbar-0.44/mars_display_roi.m b/lib/marsbar-0.44/mars_display_roi.m
deleted file mode 100644
index 5b69228..0000000
--- a/lib/marsbar-0.44/mars_display_roi.m
+++ /dev/null
@@ -1,270 +0,0 @@
-function varargout=mars_display_roi(action_str, varargin)
-% utility routines for display of ROIs in graphic window
-% FORMAT varargout=mars_display_roi(action_str, varargin)
-%
-% Usual call displays one or more ROIs on structural image:
-% FORMAT mars_display_roi('display', roi_obj, structv, cmap)
-%
-% roi_obj - single ROI object, or cell array of objects, or strings
-% structv - structural image or spm_vol struct for image
-% [marsbar default structural if not passed]
-% cmap - colormap to use for display
-%
-% V0.2 - use of jet/specified colormap for display of many ROIs
-% V0.3 - string input allowed, actionstrs as first arg, service callback
-%
-% $Id$
-
-global st; % global variable from spm_orthviews
-
-if nargin < 1
- action_str = '';
-end
-if isempty(action_str), action_str = 'display'; end
-
-switch lower(action_str), case 'display' %-Display ROIs
-if nargin < 2
- roi_obj = spm_get([0 Inf],'*roi.mat','Select ROI(s) to view');
-else
- roi_obj = varargin{1};
-end
-if isempty(roi_obj), return, end
-
-if nargin < 3
- mb = spm('getglobal', 'MARS');
- if ~isempty(mb)
- structv = mb.OPTIONS.structural.fname;
- else
- structv = fullfile(spm('dir'), 'canonical', ...
- ['avg152T1' mars_veropts('template_ext')]);
- end
-else
- structv = varargin{2};
-end
-if ischar(structv)
- structv = spm_vol(structv);
-end
-if nargin < 4
- cmap = jet;
-else
- cmap = varargin{3};
-end
-
-% Process filenames to roi objects
-roi_obj = maroi('load_cell', roi_obj);
-
-olen = prod(size(roi_obj));
-if olen > 1
- col_inds = round((0:(olen-1))*(size(cmap, 1)-1)/(olen-1))+1;
-else
- col_inds = 1;
-end
-
-% display with spm orthoviews
-spm_image('init', structv.fname);
-
-% space for object for which this is not defined
-sp = mars_space(structv);
-
-mo = [];
-roi_ctr = 1;
-for i = 1:olen
- roi = roi_obj{i};
-
- % check ROI contains something
- if isempty(roi)
- warning(sprintf('ROI %d is missing', i));
- elseif is_empty_roi(roi)
- warning(sprintf('ROI %d:%s is empty', i, label(roi)));
- else
- % Define space for ROI
- nsp = native_space(roi);
- if isempty(nsp)
- nsp = sp;
- end
-
- % convert ROI to matrix
- mo = maroi_matrix(roi, nsp);
- dat = matrixdata(mo);
- if isempty(dat) | ~any(dat(:))
- warning(sprintf('ROI %d: %s - contains no points to show',...
- i, label(roi)));
- else
- dat(dat == 0) = NaN;
- % add to image to display
- mars_orthviews('AddColouredMatrix', 1, dat, nsp.mat, cmap(col_inds(i),:));
-
- % Information for display
- XYZ = realpts(roi,nsp);
- mx = max(XYZ, [], 2); mn = min(XYZ, [], 2);
- lbl = label(roi);
- if isempty(lbl), lbl = '[No label]'; end
- roi_info(roi_ctr) = struct(...
- 'label', lbl,...
- 'num', i,...
- 'c_o_m', c_o_m(mo, nsp, 'real'),...
- 'volume', volume(mo),...
- 'maxx', [mn(1) mx(1)],...
- 'maxy', [mn(2) mx(2)],...
- 'maxz', [mn(3) mx(3)] ...
- );
- roi_ctr = roi_ctr + 1;
- end
- end
-end
-if roi_ctr == 1
- return
-end
-
-% ROI information panel
-%-----------------------------------------------------------------------
-WS = spm('WinScale');
-fg = spm_figure('GetWin','Graphics');
-% Frame for ROI info
-uicontrol(fg,'Style','Frame','Position',[305 360 280 240].*WS);
-
-% ROI selection menu
-rl = length(roi_info);
-labs = [num2str([1:rl]') repmat(': ', rl, 1) strvcat(roi_info(:).label)];
-uicontrol(fg,'Style','popupmenu' ,'Position',[320 570 250 20].*WS,...
- 'String', cellstr(labs),...
- 'Callback','mars_display_roi(''roi_menu'')', ...
- 'ToolTipString','ROIs', 'Userdata', roi_info);
-
-uicontrol(fg,'Style','Text', 'Position',[310 520 50 020].*WS,...
- 'String','Label:','HorizontalAlignment','left');
-uicontrol(fg,'Style','Text', 'Position',[310 490 110 020].*WS,...
- 'String','Centre of mass:','HorizontalAlignment','left');
-uicontrol(fg,'Style','Text', 'Position',[310 460 110 020].*WS,...
- 'String','Volume (mm):','HorizontalAlignment','left');
-uicontrol(fg,'Style','Text', 'Position',[310 430 110 020].*WS,...
- 'String','Max/min X(mm):','HorizontalAlignment','left');
-uicontrol(fg,'Style','Text', 'Position',[310 400 110 020].*WS,...
- 'String','Max/min Y(mm):','HorizontalAlignment','left');
-uicontrol(fg,'Style','Text', 'Position',[310 370 110 020].*WS,...
- 'String','Max/min Z(mm):','HorizontalAlignment','left');
-
-% Text information
-st.mars.txt.label = uicontrol(fg,'Style','Text', ...
- 'Position',[360 520 220 020].*WS,...
- 'String','',...
- 'HorizontalAlignment','left',...
- 'FontWeight','bold');
-st.mars.txt.c_o_m = uicontrol(fg,'Style','Text', ...
- 'Position',[425 490 155 020].*WS,...
- 'String','',...
- 'HorizontalAlignment','left',...
- 'FontWeight','bold');
-st.mars.txt.volume = uicontrol(fg,'Style','Text', ...
- 'Position',[425 460 155 020].*WS,...
- 'String','',...
- 'HorizontalAlignment','left',...
- 'FontWeight','bold');
-st.mars.txt.maxx = uicontrol(fg,'Style','Text', ...
- 'Position',[425 430 155 020].*WS,...
- 'String','',...
- 'HorizontalAlignment','left',...
- 'FontWeight','bold');
-st.mars.txt.maxy = uicontrol(fg,'Style','Text', ...
- 'Position',[425 400 155 020].*WS,...
- 'String','',...
- 'HorizontalAlignment','left',...
- 'FontWeight','bold');
-st.mars.txt.maxz = uicontrol(fg,'Style','Text', ...
- 'Position',[425 370 155 020].*WS,...
- 'String','',...
- 'HorizontalAlignment','left',...
- 'FontWeight','bold');
-
-% store ROI information is orthviews global structure
-st.mars.roi_info = roi_info;
-
-% set our own callback for crosshair move
-st.callback = 'mars_display_roi(''orthcb'');';
-
-% Move to centre of mass of last ROI in list
-mars_orthviews('Reposition', roi_info(end).c_o_m);
-mars_display_roi('show_info', length(roi_info));
-
-case 'roi_menu' % callback service from ROI menu
-if isfield(st, 'mars')
- v = get(gco, 'Value');
- mars_orthviews('Reposition', st.mars.roi_info(v).c_o_m);
- mars_display_roi('show_info', v);
-end
-
-case 'show_info' % show info for ROI, from ROI info structure
-v = varargin{1};
-if isfield(st, 'mars')
- if ~isempty(v)
- set(st.mars.txt.label, 'String', ...
- st.mars.roi_info(v).label);
- set(st.mars.txt.c_o_m, 'String', ...
- sprintf('%.3g %.3g %.3g', ...
- st.mars.roi_info(v).c_o_m));
- set(st.mars.txt.volume, 'String', ...
- sprintf('%8.2f', st.mars.roi_info(v).volume));
- set(st.mars.txt.maxx, 'String', ...
- sprintf('%.3g %.3g', st.mars.roi_info(v).maxx));
- set(st.mars.txt.maxy, 'String', ...
- sprintf('%.3g %.3g', st.mars.roi_info(v).maxy));
- set(st.mars.txt.maxz, 'String', ...
- sprintf('%.3g %.3g', st.mars.roi_info(v).maxz));
- else
- set(st.mars.txt.label, 'String','');
- set(st.mars.txt.c_o_m, 'String','');
- set(st.mars.txt.volume, 'String','');
- set(st.mars.txt.maxx, 'String','');
- set(st.mars.txt.maxy, 'String','');
- set(st.mars.txt.maxz, 'String','');
- end
-end
-
-case 'orthcb' % callback service from mars_orthviews
-
-% This copied from mars_orthviews 'shopos' function
-
-% The position of the crosshairs has been moved.
-%-----------------------------------------------------------------------
-if isfield(st,'mp'),
- fg = spm_figure('Findwin','Graphics');
- if any(findobj(fg) == st.mp),
- set(st.mp,'String',sprintf('%.1f %.1f %.1f',mars_orthviews('pos')));
- pos = mars_orthviews('pos',1);
- set(st.vp,'String',sprintf('%.1f %.1f %.1f',pos));
-
- % Set intensity to ROI list
- in_str = '';
- roi_p = [];
- V1 = st.vols{1};
- for r = 1:length(V1.blobs)
- p2 = V1.blobs{r}.mat \ V1.mat * [pos; 1];
- rval = spm_sample_vol(V1.blobs{r}.vol,...
- p2(1),p2(2),p2(3), ...
- 0);
- if ~isnan(rval) & rval ~= 0
- roi_p = [roi_p r];
- in_str = [in_str num2str(r) ' '];
- end
- end
- set(st.in,'String',in_str);
-
- % find, and show info for ROI
- if ~isempty(roi_p)
- v = find(roi_p(end) == [st.mars.roi_info(:).num]);
- mars_display_roi('show_info', v);
- else
- mars_display_roi('show_info', []);
- end
-
- else,
- st.Callback = ';';
- rmfield(st,{'mp','vp','in'});
- end;
-else,
- st.Callback = ';';
-end;
-
-otherwise
- error(['Unknown action strig: ' action_str]);
-end
diff --git a/lib/marsbar-0.44/mars_get_option.m b/lib/marsbar-0.44/mars_get_option.m
deleted file mode 100644
index 2a49102..0000000
--- a/lib/marsbar-0.44/mars_get_option.m
+++ /dev/null
@@ -1,13 +0,0 @@
-function optval = mars_get_option(varargin)
-% Get option subfield as named by ``varargin``.
-%
-% FORMAT optval = mars_get_option(varargin)
-%
-% Tries to get base default if option is not set. Returns empty matrix if
-% there is no information for this option (for example, if the option fields
-% were mis-spelled).
-mars = mars_struct('getifthere', spm('getglobal','MARS'), 'OPTIONS');
-if isempty(mars)
- mars = mars_options('basedefaults');
-end
-optval = mars_struct('getifthere', mars, varargin{:});
diff --git a/lib/marsbar-0.44/mars_image_scaling.m b/lib/marsbar-0.44/mars_image_scaling.m
deleted file mode 100644
index 27d96e3..0000000
--- a/lib/marsbar-0.44/mars_image_scaling.m
+++ /dev/null
@@ -1,157 +0,0 @@
-function [VY,row] = mars_image_scaling(marsD)
-% get image scaling data for images, maybe via SPM design
-% FORMAT [VY,row] = mars_image_scaling(marsD)
-%-----------------------------------------------------------------------
-%
-% Inputs
-% marsD - design matrix to (optionally) get parameters from
-%
-% Returns
-% VY - SPM vol structs with selected scaling
-% row - cell array, one per subject/session giving corresponding
-% rows in for VY array
-%
-% $Id$
-
-VY = [];
-if nargin < 1
- marsD = [];
-end
-if isempty(marsD)
- mod_code = spm_input('Modality of images to scale', '+1', 'b', ...
- 'PET|FMRI|Other', [1 2 3], 2);
-else
- mod_code = is_fmri(marsD) + 1;
-end
-
-switch mod_code
- case 1 % PET
- dGM = 50;
- sess_str = 'Subject';
- case 2 % FMRI
- dGM = 100;
- sess_str = 'Session';
- case 3 % Other
- dGM = 0;
- sess_str = 'Subject';
-end
-
-VY = [];
-Global = [];
-
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Extract data from ROI(s)');
-
-% images
-if isempty(marsD)
- spmf = 0;
-else
- spmf = spm_input('Images from:', '+1','b',['SPM design|GUI select'], ...
- [1 0], 2);
-end
-
-% get images, from design, or by hand
-if spmf
- if ~has_images(marsD);
- warning('Design structure does not specify images');
- return
- end
- VY = get_images(marsD);
- row = block_rows(marsD);
- nsess = length(row);
-end
-
-if isempty(VY) % need to know about images
- % no of sessions / subjects
- nsess = spm_input(sprintf('No of %ss', sess_str), '+1', 'r', 1, 1);
- % select files for each session
- for s = 1:nsess
- simgs = spm_get(Inf, mars_veropts('get_img_ext'), ...
- sprintf('Data images %s %d', sess_str, s));
- row{s} = (1:size(simgs, 1))'+size(VY,1);
- VY = strvcat(VY, simgs);
- end
-end % of image get routines
-if isempty(VY), return, end
-
-% global scaling options
-askGMf = 1;
-if spmf
- gopts = {''};
- glabs = ['SPM design|' sess_str ' specific scaling',...
- '|Proportional scaling|Raw data'];
- tmp = spm_input('Scaling from:', '+1', 'm', glabs, 1:4, 1);
- if tmp == 1
- Global = [];
- askGMf = 0;
- else
- % force remap to wipe out previous SPM scaling
- VY = strvcat(VY(:).fname);
- if tmp == 2
- Global = 'None';
- elseif tmp == 3
- Global = 'Scale';
- elseif tmp == 4
- Global = [];
- end
- end
-
-else % scaling by hand
- glabs = [sess_str ' specific scaling',...
- '|Proportional scaling|Raw data'];
- tmp = spm_input('Scaling from:', '+1', 'm', glabs, [1 2 3], 1);
- if tmp == 1
- Global = 'None';
- elseif tmp == 2
- Global = 'Scale';
- else
- Global = [];
- end
-end
-
-% Grand mean scaling
-GM = 0;
-if askGMf
- GM = spm_input('Scale grand mean to (0=raw)','+1','r',dGM,1);
-end
-
-% map files now, if not yet mapped
-if ischar(VY)
- fprintf('\n%-40s: %30s','Mapping files',' ') %-#
- VY = spm_vol(VY);
- fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-#
-end
-
-% Apply scaling options if necessary
-if ~isempty(Global)
-
-%-Compute Global variate
-%-----------------------------------------------------------------------
-q = length(VY);
-g = zeros(q,1);
-fprintf('%-40s: %30s','Calculating globals',' ') %-#
-for i = 1:q
- fprintf('%s%30s',repmat(sprintf('\b'),1,30),sprintf('%4d/%-4d',i,q)) %-#
- g(i) = spm_global(VY(i));
-end
-fprintf('%s%30s\n',repmat(sprintf('\b'),1,30),'...done') %-#
-
-% get null GM scaling
-if (GM == 0)
- GM = mean(g);
-end
-
-% scale if specified (otherwise subject / session specific grand mean scaling)
-%-----------------------------------------------------------------------
-gSF = GM./g;
-if strcmp(Global,'None')
- for i = 1:nsess
- j = row{i};
- gSF(j) = GM./mean(g(j));
- end
-end
-
-%-Apply gSF to memory-mapped scalefactors to implement scaling
-%-----------------------------------------------------------------------
-for i = 1:q, VY(i).pinfo(1:2,:) = VY(i).pinfo(1:2,:)*gSF(i); end
-
-end % of global options
diff --git a/lib/marsbar-0.44/mars_img2rois.m b/lib/marsbar-0.44/mars_img2rois.m
deleted file mode 100644
index c12cda4..0000000
--- a/lib/marsbar-0.44/mars_img2rois.m
+++ /dev/null
@@ -1,130 +0,0 @@
-function mars_img2rois(P, roipath, rootn, flags)
-% creates ROIs from cluster image or image containing ROIs defined by unique nos
-% FORMAT mars_img2rois(P, roipath, rootn, flags)
-%
-% P - image (string or struct)
-% roipath - path to directory to store ROIs
-% rootn - string to prefix to ROI filenames
-% flags - none or more of: [default = 'i']
-% 'i' - id image, voxel values identify ROIs
-% 'c' - cluster image, clusters identified by location
-% 'x' - label clusters by location of maximum
-% (default is location of centre of mass)
-%
-% $Id$
-
-if nargin < 1
- P = '';
-end
-if nargin < 2
- roipath = '';
-end
-if nargin < 3
- rootn = '';
-end
-if nargin < 4
- flags = ' ';
-end
-
-% Process input arguments
-if any(flags == 'i')
- Pprompt = 'Image containing ROI ids';
-else
- Pprompt = 'Image containing clusters';
-end
-if isempty(P)
- P = spm_get(1, mars_veropts('get_img_ext', Pprompt));
-end
-if isempty(P)
- return
-end
-if ischar(P)
- P = spm_vol(P);
-end
-if isempty(roipath)
- roipath = spm_get([-1 0], '', 'Directory to save ROIs');
-end
-if isempty(roipath)
- return
-end
-if isempty(rootn)
- [pn rootn ext] = fileparts(P.fname);
- rootn = spm_input('Prefix for ROI filenames', '+1', 's', rootn);
-end
-if isempty(rootn)
- return
-end
-
-if isempty(flags)
- flags = 'i'; % id image is default
-end
-
-% read img, get non-zero voxels
-img = spm_read_vols(P);
-img = img(:)';
-dim = P.dim(1:3);
-pts = find(img~=0);
-
-% e2xyz
-nz = pts-1;
-pl_sz = dim(1)*dim(2);
-Z = floor(nz / pl_sz);
-nz = nz - Z*pl_sz;
-Y = floor(nz / dim(1));
-X = nz - Y*dim(1);
-XYZ = [X; Y;Z] +1;
-
-% collect clusters
-vals = img(pts);
-
-% select cluster or id
-if any(flags == 'i')
- cl_vals = vals;
-else
- cl_vals = spm_clusters(XYZ);
-end
-
-for c = unique(cl_vals)
- % points for this region/cluster
- t_cl_is = find(cl_vals == c);
-
- % corresponding XYZ
- cXYZ = XYZ(:, t_cl_is);
-
- if ~isempty(cXYZ)
- % location label for cluster images
- if any(flags == 'c')
- if any(flags == 'x') % maximum
- [mx maxi] = max(vals(t_cl_is));
- mi = t_cl_is(maxi);
- % voxel coordinate of max
- vco = XYZ(:, mi);
- else % centre of mass
- vco = mean(cXYZ, 2);
- end
-
- % pt coordinates in mm
- pt_lab = P.mat * [vco; 1];
- pt_lab = pt_lab(1:3);
-
- % file name and labels
- d = sprintf('%s cluster at [%0.1f %0.1f %0.1f]', rootn, pt_lab);
- l = sprintf('%s_%0.0f_%0.0f_%0.0f', rootn, pt_lab);
-
- else % id image labels from voxel values
- % file name and labels
- d = sprintf('%s: id: %d', rootn, c);
- l = sprintf('%s_%d', rootn, c);
- end
-
- fname = maroi('filename', fullfile(roipath, l));
- o = maroi_pointlist(struct('XYZ',cXYZ,...
- 'mat',P.mat,...
- 'descrip',d,...
- 'label', l), ...
- 'vox');
- fprintf('\nSaving %s as %s...', d, fname);
- saveroi(o, fname);
- end
-end
-fprintf('\nDone...\n');
diff --git a/lib/marsbar-0.44/mars_licence.man b/lib/marsbar-0.44/mars_licence.man
deleted file mode 100644
index fd83258..0000000
--- a/lib/marsbar-0.44/mars_licence.man
+++ /dev/null
@@ -1,365 +0,0 @@
-
-% MarsBaR is copyright, distributed under the GNU General Public Licence.
-%_______________________________________________________________________
-%
-% MarsBaR (being the collection of files given in the manifest in the
-% contents.m file) is free but copyright software, distributed under
-% the terms of the GNU General Public Licence as published by the Free
-% Software Foundation (either version 2, as given below, or at your
-% option, any later version).
-%
-% For more details on "copyleft", see http://www.gnu.org/copyleft/
-%
-% MarsBaR is supplied as is:
-% No formal support or maintenance is provided or implied.
-%_______________________________________________________________________
-%
-% GNU GENERAL PUBLIC LICENSE
-% Version 2, June 1991
-%
-% Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-% 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-% Everyone is permitted to copy and distribute verbatim copies
-% of this license document, but changing it is not allowed.
-%
-% Preamble
-%
-% The licenses for most software are designed to take away your
-% freedom to share and change it. By contrast, the GNU General Public
-% License is intended to guarantee your freedom to share and change free
-% software--to make sure the software is free for all its users. This
-% General Public License applies to most of the Free Software
-% Foundation's software and to any other program whose authors commit to
-% using it. (Some other Free Software Foundation software is covered by
-% the GNU Library General Public License instead.) You can apply it to
-% your programs, too.
-%
-% When we speak of free software, we are referring to freedom, not
-% price. Our General Public Licenses are designed to make sure that you
-% have the freedom to distribute copies of free software (and charge for
-% this service if you wish), that you receive source code or can get it
-% if you want it, that you can change the software or use pieces of it
-% in new free programs; and that you know you can do these things.
-%
-% To protect your rights, we need to make restrictions that forbid
-% anyone to deny you these rights or to ask you to surrender the rights.
-% These restrictions translate to certain responsibilities for you if you
-% distribute copies of the software, or if you modify it.
-%
-% For example, if you distribute copies of such a program, whether
-% gratis or for a fee, you must give the recipients all the rights that
-% you have. You must make sure that they, too, receive or can get the
-% source code. And you must show them these terms so they know their
-% rights.
-%
-% We protect your rights with two steps: (1) copyright the software, and
-% (2) offer you this license which gives you legal permission to copy,
-% distribute and/or modify the software.
-%
-% Also, for each author's protection and ours, we want to make certain
-% that everyone understands that there is no warranty for this free
-% software. If the software is modified by someone else and passed on, we
-% want its recipients to know that what they have is not the original, so
-% that any problems introduced by others will not reflect on the original
-% authors' reputations.
-%
-% Finally, any free program is threatened constantly by software
-% patents. We wish to avoid the danger that redistributors of a free
-% program will individually obtain patent licenses, in effect making the
-% program proprietary. To prevent this, we have made it clear that any
-% patent must be licensed for everyone's free use or not licensed at all.
-%
-% The precise terms and conditions for copying, distribution and
-% modification follow.
-%
-% ----------------
-%
-% GNU GENERAL PUBLIC LICENSE
-% TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-%
-% 0. This License applies to any program or other work which contains
-% a notice placed by the copyright holder saying it may be distributed
-% under the terms of this General Public License. The "Program", below,
-% refers to any such program or work, and a "work based on the Program"
-% means either the Program or any derivative work under copyright law:
-% that is to say, a work containing the Program or a portion of it,
-% either verbatim or with modifications and/or translated into another
-% language. (Hereinafter, translation is included without limitation in
-% the term "modification".) Each licensee is addressed as "you".
-%
-% Activities other than copying, distribution and modification are not
-% covered by this License; they are outside its scope. The act of
-% running the Program is not restricted, and the output from the Program
-% is covered only if its contents constitute a work based on the
-% Program (independent of having been made by running the Program).
-% Whether that is true depends on what the Program does.
-%
-% 1. You may copy and distribute verbatim copies of the Program's
-% source code as you receive it, in any medium, provided that you
-% conspicuously and appropriately publish on each copy an appropriate
-% copyright notice and disclaimer of warranty; keep intact all the
-% notices that refer to this License and to the absence of any warranty;
-% and give any other recipients of the Program a copy of this License
-% along with the Program.
-%
-% You may charge a fee for the physical act of transferring a copy, and
-% you may at your option offer warranty protection in exchange for a fee.
-%
-% 2. You may modify your copy or copies of the Program or any portion
-% of it, thus forming a work based on the Program, and copy and
-% distribute such modifications or work under the terms of Section 1
-% above, provided that you also meet all of these conditions:
-%
-% a) You must cause the modified files to carry prominent notices
-% stating that you changed the files and the date of any change.
-%
-% b) You must cause any work that you distribute or publish, that in
-% whole or in part contains or is derived from the Program or any
-% part thereof, to be licensed as a whole at no charge to all third
-% parties under the terms of this License.
-%
-% c) If the modified program normally reads commands interactively
-% when run, you must cause it, when started running for such
-% interactive use in the most ordinary way, to print or display an
-% announcement including an appropriate copyright notice and a
-% notice that there is no warranty (or else, saying that you provide
-% a warranty) and that users may redistribute the program under
-% these conditions, and telling the user how to view a copy of this
-% License. (Exception: if the Program itself is interactive but
-% does not normally print such an announcement, your work based on
-% the Program is not required to print an announcement.)
-%
-% These requirements apply to the modified work as a whole. If
-% identifiable sections of that work are not derived from the Program,
-% and can be reasonably considered independent and separate works in
-% themselves, then this License, and its terms, do not apply to those
-% sections when you distribute them as separate works. But when you
-% distribute the same sections as part of a whole which is a work based
-% on the Program, the distribution of the whole must be on the terms of
-% this License, whose permissions for other licensees extend to the
-% entire whole, and thus to each and every part regardless of who wrote it.
-%
-% Thus, it is not the intent of this section to claim rights or contest
-% your rights to work written entirely by you; rather, the intent is to
-% exercise the right to control the distribution of derivative or
-% collective works based on the Program.
-%
-% In addition, mere aggregation of another work not based on the Program
-% with the Program (or with a work based on the Program) on a volume of
-% a storage or distribution medium does not bring the other work under
-% the scope of this License.
-%
-% 3. You may copy and distribute the Program (or a work based on it,
-% under Section 2) in object code or executable form under the terms of
-% Sections 1 and 2 above provided that you also do one of the following:
-%
-% a) Accompany it with the complete corresponding machine-readable
-% source code, which must be distributed under the terms of Sections
-% 1 and 2 above on a medium customarily used for software interchange; or,
-%
-% b) Accompany it with a written offer, valid for at least three
-% years, to give any third party, for a charge no more than your
-% cost of physically performing source distribution, a complete
-% machine-readable copy of the corresponding source code, to be
-% distributed under the terms of Sections 1 and 2 above on a medium
-% customarily used for software interchange; or,
-%
-% c) Accompany it with the information you received as to the offer
-% to distribute corresponding source code. (This alternative is
-% allowed only for noncommercial distribution and only if you
-% received the program in object code or executable form with such
-% an offer, in accord with Subsection b above.)
-%
-% The source code for a work means the preferred form of the work for
-% making modifications to it. For an executable work, complete source
-% code means all the source code for all modules it contains, plus any
-% associated interface definition files, plus the scripts used to
-% control compilation and installation of the executable. However, as a
-% special exception, the source code distributed need not include
-% anything that is normally distributed (in either source or binary
-% form) with the major components (compiler, kernel, and so on) of the
-% operating system on which the executable runs, unless that component
-% itself accompanies the executable.
-%
-% If distribution of executable or object code is made by offering
-% access to copy from a designated place, then offering equivalent
-% access to copy the source code from the same place counts as
-% distribution of the source code, even though third parties are not
-% compelled to copy the source along with the object code.
-%
-% 4. You may not copy, modify, sublicense, or distribute the Program
-% except as expressly provided under this License. Any attempt
-% otherwise to copy, modify, sublicense or distribute the Program is
-% void, and will automatically terminate your rights under this License.
-% However, parties who have received copies, or rights, from you under
-% this License will not have their licenses terminated so long as such
-% parties remain in full compliance.
-%
-% 5. You are not required to accept this License, since you have not
-% signed it. However, nothing else grants you permission to modify or
-% distribute the Program or its derivative works. These actions are
-% prohibited by law if you do not accept this License. Therefore, by
-% modifying or distributing the Program (or any work based on the
-% Program), you indicate your acceptance of this License to do so, and
-% all its terms and conditions for copying, distributing or modifying
-% the Program or works based on it.
-%
-% 6. Each time you redistribute the Program (or any work based on the
-% Program), the recipient automatically receives a license from the
-% original licensor to copy, distribute or modify the Program subject to
-% these terms and conditions. You may not impose any further
-% restrictions on the recipients' exercise of the rights granted herein.
-% You are not responsible for enforcing compliance by third parties to
-% this License.
-%
-% 7. If, as a consequence of a court judgment or allegation of patent
-% infringement or for any other reason (not limited to patent issues),
-% conditions are imposed on you (whether by court order, agreement or
-% otherwise) that contradict the conditions of this License, they do not
-% excuse you from the conditions of this License. If you cannot
-% distribute so as to satisfy simultaneously your obligations under this
-% License and any other pertinent obligations, then as a consequence you
-% may not distribute the Program at all. For example, if a patent
-% license would not permit royalty-free redistribution of the Program by
-% all those who receive copies directly or indirectly through you, then
-% the only way you could satisfy both it and this License would be to
-% refrain entirely from distribution of the Program.
-%
-% If any portion of this section is held invalid or unenforceable under
-% any particular circumstance, the balance of the section is intended to
-% apply and the section as a whole is intended to apply in other
-% circumstances.
-%
-% It is not the purpose of this section to induce you to infringe any
-% patents or other property right claims or to contest validity of any
-% such claims; this section has the sole purpose of protecting the
-% integrity of the free software distribution system, which is
-% implemented by public license practices. Many people have made
-% generous contributions to the wide range of software distributed
-% through that system in reliance on consistent application of that
-% system; it is up to the author/donor to decide if he or she is willing
-% to distribute software through any other system and a licensee cannot
-% impose that choice.
-%
-% This section is intended to make thoroughly clear what is believed to
-% be a consequence of the rest of this License.
-%
-% 8. If the distribution and/or use of the Program is restricted in
-% certain countries either by patents or by copyrighted interfaces, the
-% original copyright holder who places the Program under this License
-% may add an explicit geographical distribution limitation excluding
-% those countries, so that distribution is permitted only in or among
-% countries not thus excluded. In such case, this License incorporates
-% the limitation as if written in the body of this License.
-%
-% 9. The Free Software Foundation may publish revised and/or new versions
-% of the General Public License from time to time. Such new versions will
-% be similar in spirit to the present version, but may differ in detail to
-% address new problems or concerns.
-%
-% Each version is given a distinguishing version number. If the Program
-% specifies a version number of this License which applies to it and "any
-% later version", you have the option of following the terms and conditions
-% either of that version or of any later version published by the Free
-% Software Foundation. If the Program does not specify a version number of
-% this License, you may choose any version ever published by the Free Software
-% Foundation.
-%
-% 10. If you wish to incorporate parts of the Program into other free
-% programs whose distribution conditions are different, write to the author
-% to ask for permission. For software which is copyrighted by the Free
-% Software Foundation, write to the Free Software Foundation; we sometimes
-% make exceptions for this. Our decision will be guided by the two goals
-% of preserving the free status of all derivatives of our free software and
-% of promoting the sharing and reuse of software generally.
-%
-% NO WARRANTY
-%
-% 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-% FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-% OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-% PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-% OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-% MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-% TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-% PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-% REPAIR OR CORRECTION.
-%
-% 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-% WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-% REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-% INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-% OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-% TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-% YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-% PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-% POSSIBILITY OF SUCH DAMAGES.
-%
-% END OF TERMS AND CONDITIONS
-%
-% ----------------
-%
-% How to Apply These Terms to Your New Programs
-%
-% If you develop a new program, and you want it to be of the greatest
-% possible use to the public, the best way to achieve this is to make it
-% free software which everyone can redistribute and change under these terms.
-%
-% To do so, attach the following notices to the program. It is safest
-% to attach them to the start of each source file to most effectively
-% convey the exclusion of warranty; and each file should have at least
-% the "copyright" line and a pointer to where the full notice is found.
-%
-%
-% Copyright (C) 19yy
-%
-% This program is free software; you can redistribute it and/or modify
-% it under the terms of the GNU General Public License as published by
-% the Free Software Foundation; either version 2 of the License, or
-% (at your option) any later version.
-%
-% This program is distributed in the hope that it will be useful,
-% but WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-% GNU General Public License for more details.
-%
-% You should have received a copy of the GNU General Public License
-% along with this program; if not, write to the Free Software
-% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-%
-%
-% Also add information on how to contact you by electronic and paper mail.
-%
-% If the program is interactive, make it output a short notice like this
-% when it starts in an interactive mode:
-%
-% Gnomovision version 69, Copyright (C) 19yy name of author
-% Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-% This is free software, and you are welcome to redistribute it
-% under certain conditions; type `show c' for details.
-%
-% The hypothetical commands `show w' and `show c' should show the appropriate
-% parts of the General Public License. Of course, the commands you use may
-% be called something other than `show w' and `show c'; they could even be
-% mouse-clicks or menu items--whatever suits your program.
-%
-% You should also get your employer (if you work as a programmer) or your
-% school, if any, to sign a "copyright disclaimer" for the program, if
-% necessary. Here is a sample; alter the names:
-%
-% Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-% `Gnomovision' (which makes passes at compilers) written by James Hacker.
-%
-% , 1 April 1989
-% Ty Coon, President of Vice
-%
-% This General Public License does not permit incorporating your program into
-% proprietary programs. If your program is a subroutine library, you may
-% consider it more useful to permit linking proprietary applications with the
-% library. If this is what you want to do, use the GNU Library General
-% Public License instead of this License.
-%_______________________________________________________________________
-%
-% Copied from @(#)spm_LICENCE.man 2.4 FIL 99/05/16
-%
-% $Id$
diff --git a/lib/marsbar-0.44/mars_new_space.m b/lib/marsbar-0.44/mars_new_space.m
deleted file mode 100644
index 0fd7218..0000000
--- a/lib/marsbar-0.44/mars_new_space.m
+++ /dev/null
@@ -1,83 +0,0 @@
-function [dim2, mat2, vox2] = mars_new_space(dim, mat, vox)
-% make a new image space to contain image with rotations etc
-% FORMAT [dim2, mat2, vox2] = mars_new_space(dim, mat, vox)
-%
-% dim - original dimensions in voxels
-% mat - orignal mat file (4x4 transformation matrix)
-% vox - required ouput voxel size
-%
-% OUTPUT
-% dim2 - new dimensions
-% mat2 - new mat file
-% vox2 - new voxel dimensions
-%
-% $Id$
-
-if nargin < 2
- error('Need two input args');
-end
-dim = dim(:);
-dim = dim(1:3)';
-if nargin < 3
- vox = [];
-end
-
-% size, opposite corners of transformed img in mm
-[sz mn_mx] = mmsz(dim, mat);
-
-% select new voxel size if needed
-if isempty(vox)
- % original voxel size
- vox = sqrt(sum(mat(1:3,1:3).^2));
-
- % XYZ max difference for one voxel
- vxsz = mmsz([1 1 1], mat);
-
- % reassign original dimensions to best matching
- % of new dimensions
- [t o] = sort(vxsz);
- vox2(o) = sort(vox);
-else
- vox2 = vox;
-end
-
-% new dimensions add 1 to allow for half voxel at either
-% side of voxel centres, allowing for rounding
-dim2 = sz./vox2 + 1;
-rdim2 = round(dim2);
-tiny = 1e-12;
-for d = 1:3
- if (dim2(d) - rdim2(d))=2, st.vols{H}.area = varargin{2}; end;
- if isempty(st.bb), st.bb = maxbb; end;
- bbox;
- redraw(H);
- end;
- varargout{1} = H;
-
-case 'bb',
- if length(varargin)> 0 & all(size(varargin{1})==[2 3]), st.bb = varargin{1}; end;
- bbox;
- redraw_all;
-
-case 'redraw',
- redraw_all;
- eval(st.callback);
- if isfield(st,'registry'),
- spm_XYZreg('SetCoords',st.centre,st.registry.hReg,st.registry.hMe);
- end;
-
-case 'reposition',
- if length(varargin)<1, tmp = findcent;
- else, tmp = varargin{1}; end;
- if length(tmp)==3, st.centre = tmp(:); end;
- redraw_all;
- eval(st.callback);
- if isfield(st,'registry'),
- spm_XYZreg('SetCoords',st.centre,st.registry.hReg,st.registry.hMe);
- end;
-
-case 'setcoords',
- st.centre = varargin{1};
- st.centre = st.centre(:);
- redraw_all;
- eval(st.callback);
-
-case 'space',
- if length(varargin)<1,
- st.Space = eye(4);
- st.bb = maxbb;
- redraw_all;
- else,
- space(varargin{1});
- redraw_all;
- end;
- bbox;
-
-case 'maxbb',
- st.bb = maxbb;
- bbox;
- redraw_all;
-
-case 'resolution',
- resolution(varargin{1});
- bbox;
- redraw_all;
-
-case 'window',
- if length(varargin)<2,
- win = 'auto';
- elseif length(varargin{2})==2,
- win = varargin{2};
- end;
- for i=valid_handles(varargin{1}),
- st.vols{i}.window = win;
- end;
- redraw(varargin{1});
-
-case 'delete',
- my_delete(varargin{1});
-
-case 'move',
- move(varargin{1},varargin{2});
- % redraw_all;
-
-case 'reset',
- my_reset;
-
-case 'pos',
- if isempty(varargin),
- H = st.centre(:);
- else,
- H = pos(varargin{1});
- end;
- varargout{1} = H;
-
-case 'interp',
- st.hld = varargin{1};
- redraw_all;
-
-case 'xhairs',
- xhairs(varargin{1});
-
-case 'register',
- register(varargin{1});
-
-case 'addblobs',
- addblobs(varargin{1}, varargin{2},varargin{3},varargin{4});
- redraw(varargin{1});
-
-case 'addcolouredblobs',
- addcolouredblobs(varargin{1}, varargin{2},varargin{3},varargin{4},varargin{5});
-
-case 'addcolouredmatrix',
- addcolouredmatrix(varargin{1}, varargin{2},varargin{3},varargin{4});
-
-case 'addimage',
- addimage(varargin{1}, varargin{2});
- redraw(varargin{1});
-
-case 'addcolouredimage',
- addcolouredimage(varargin{1}, varargin{2},varargin{3});
-
-case 'addtruecolourimage',
- % mars_orthviews('Addtruecolourimage',handle,filename,colourmap,prop,mx,mn)
- % Adds blobs from an image in true colour
- % handle - image number to add blobs to [default 1]
- % filename of image containing blob data [default - request via GUI]
- % colourmap - colormap to display blobs in [GUI input]
- % prop - intensity proportion of activation cf grayscale [0.4]
- % mx - maximum intensity to scale to [maximum value in activation image]
- % mn - minimum intensity to scale to [minimum value in activation image]
- %
-
- % For selecting images, later
-img_flt = mars_veropts('get_img_ext');
-
- if nargin < 2
- varargin(1) = {1};
- end
- if nargin < 3
- varargin(2) = {spm_get(1, img_flt, 'Image with activation signal')};
- end
- if ischar(varargin{2}),varargin{2} = spm_vol(varargin{2});end
- if nargin < 4
- actc = [];
- while isempty(actc)
- actc = getcmap(spm_input('Colourmap for activation image', '+1','s'));
- end
- varargin(3) = {actc};
- end
- if nargin < 5
- varargin(4) = {0.4};
- end
- if nargin < 6
- varargin(5) = {max([eps maxval(varargin{2})])};
- end
- if nargin < 7
- varargin(6) = {min([0 minval(varargin{2})])};
- end
-
- addtruecolourimage(varargin{1}, varargin{2},varargin{3}, varargin{4}, ...
- varargin{5}, varargin{6});
- redraw(varargin{1});
-
-case 'rmblobs',
- rmblobs(varargin{1});
- redraw(varargin{1});
-
-otherwise,
- warning('Unknown action string')
-end;
-
-spm('Pointer');
-return;
-
-
-%_______________________________________________________________________
-%_______________________________________________________________________
-function addblobs(handle, xyz, t, mat)
-global st
-for i=valid_handles(handle),
- if ~isempty(xyz),
- rcp = round(xyz);
- dim = max(rcp,[],2)';
- off = rcp(1,:) + dim(1)*(rcp(2,:)-1 + dim(2)*(rcp(3,:)-1));
- vol = zeros(dim)+NaN;
- vol(off) = t;
- vol = reshape(vol,dim);
- st.vols{i}.blobs=cell(1,1);
- if st.mode == 0,
- axpos = get(st.vols{i}.ax{2}.ax,'Position');
- else,
- axpos = get(st.vols{i}.ax{1}.ax,'Position');
- end;
- ax = axes('Parent',st.fig,'Position',[(axpos(1)+axpos(3)+0.1) (axpos(2)+0.005) 0.05 (axpos(4)-0.01)],...
- 'Box','on');
- mx = max([eps max(t)]);
- mn = min([0 min(t)]);
- image([0 1],[mn mx],[1:64]' + 64,'Parent',ax);
- set(ax,'YDir','normal','XTickLabel',[]);
- st.vols{i}.blobs{1} = struct('vol',vol,'mat',mat,'cbar',ax,'max',mx, 'min',mn);
- end;
-end;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function addimage(handle, fname)
-global st
-for i=valid_handles(handle),
- vol = spm_vol(fname);
- mat = vol.mat;
- st.vols{i}.blobs=cell(1,1);
- if st.mode == 0,
- axpos = get(st.vols{i}.ax{2}.ax,'Position');
- else,
- axpos = get(st.vols{i}.ax{1}.ax,'Position');
- end;
- ax = axes('Parent',st.fig,'Position',[(axpos(1)+axpos(3)+0.05) (axpos(2)+0.005) 0.05 (axpos(4)-0.01)],...
- 'Box','on');
- mx = max([eps maxval(vol)]);
- mn = min([0 minval(vol)]);
- image([0 1],[mn mx],[1:64]' + 64,'Parent',ax);
- set(ax,'YDir','normal','XTickLabel',[]);
- st.vols{i}.blobs{1} = struct('vol',vol,'mat',mat,'cbar',ax,'max',mx);
-end;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function addcolouredblobs(handle, xyz, t, mat,colour)
-global st
-for i=valid_handles(handle),
- if ~isempty(xyz),
- rcp = round(xyz);
- dim = max(rcp,[],2)';
- off = rcp(1,:) + dim(1)*(rcp(2,:)-1 + dim(2)*(rcp(3,:)-1));
- vol = zeros(dim)+NaN;
- vol(off) = t;
- vol = reshape(vol,dim);
- if ~isfield(st.vols{i},'blobs'),
- st.vols{i}.blobs=cell(1,1);
- bset = 1;
- else,
- bset = length(st.vols{i}.blobs)+1;
- end;
- axpos = get(st.vols{i}.ax{2}.ax,'Position');
- mx = max([eps maxval(vol)]);
- mn = min([0 minval(vol)]);
- st.vols{i}.blobs{bset} = struct('vol',vol,'mat',mat,'max',mx,'min',mn,'colour',colour);
- end;
-end;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function addcolouredmatrix(handle, vol, mat,colour)
-global st
-for i=valid_handles(handle),
- if ~isempty(vol),
- if ~isfield(st.vols{i},'blobs'),
- st.vols{i}.blobs=cell(1,1);
- bset = 1;
- else,
- bset = length(st.vols{i}.blobs)+1;
- end;
- axpos = get(st.vols{i}.ax{2}.ax,'Position');
- mx = max([eps maxval(vol)]);
- mn = min([0 minval(vol)]);
- st.vols{i}.blobs{bset} = struct('vol',vol,'mat',mat,'max',mx,'min',mn,'colour',colour);
- end;
-end;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function addcolouredimage(handle, fname,colour)
-global st
-for i=valid_handles(handle),
-
- vol = spm_vol(fname);
- mat = vol.mat;
- if ~isfield(st.vols{i},'blobs'),
- st.vols{i}.blobs=cell(1,1);
- bset = 1;
- else,
- bset = length(st.vols{i}.blobs)+1;
- end;
- axpos = get(st.vols{i}.ax{2}.ax,'Position');
- mx = max([eps maxval(vol)]);
- mn = min([0 minval(vol)]);
- st.vols{i}.blobs{bset} = struct('vol',vol,'mat',mat,'max',mx,'min',mn,'colour',colour);
-end;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function addtruecolourimage(handle,vol,colourmap,prop,mx,mn)
-% adds true colour image to current displayed image
-global st
-mat = vol.mat;
-if isstruct(vol) & isfield(vol, 'vol'), vol = vol.vol;end
-for i=valid_handles(handle),
- if ~isfield(st.vols{i},'blobs'),
- st.vols{i}.blobs=cell(1,1);
- bset = 1;
- else,
- bset = length(st.vols{i}.blobs)+1;
- end;
-% axpos = get(st.vols{i}.ax{2}.ax,'Position');
- c = struct('cmap', colourmap,'prop',prop);
- st.vols{i}.blobs{bset} = struct('vol',vol,'mat',mat,'max',mx,'min',mn,'colour',c);
-end;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function rmblobs(handle)
-global st
-for i=valid_handles(handle),
- if isfield(st.vols{i},'blobs'),
- for j=1:length(st.vols{i}.blobs),
- if isfield(st.vols{i}.blobs{j},'cbar') & ishandle(st.vols{i}.blobs{j}.cbar),
- delete(st.vols{i}.blobs{j}.cbar);
- end;
- end;
- st.vols{i} = rmfield(st.vols{i},'blobs');
- end;
-end;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function register(hreg)
-global st
-tmp = uicontrol('Position',[0 0 1 1],'Visible','off','Parent',st.fig);
-h = valid_handles(1:24);
-if ~isempty(h),
- tmp = st.vols{h(1)}.ax{1}.ax;
- st.registry = struct('hReg',hreg,'hMe', tmp);
- spm_XYZreg('Add2Reg',st.registry.hReg,st.registry.hMe, 'mars_orthviews');
-else,
- warning('Nothing to register with');
-end;
-st.centre = spm_XYZreg('GetCoords',st.registry.hReg);
-st.centre = st.centre(:);
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function xhairs(arg1),
-global st
-st.xhairs = 0;
-opt = 'on';
-if ~strcmp(arg1,'on'),
- opt = 'off';
-else,
- st.xhairs = 1;
-end;
-for i=valid_handles(1:24),
- for j=1:3,
- set(st.vols{i}.ax{j}.lx,'Visible',opt);
- set(st.vols{i}.ax{j}.ly,'Visible',opt);
- end;
-end;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function H = pos(arg1)
-global st
-H = [];
-for arg1=valid_handles(arg1),
- is = inv(st.vols{arg1}.premul*st.vols{arg1}.mat);
- H = is(1:3,1:3)*st.centre(:) + is(1:3,4);
-end;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function my_reset
-global st
-if ~isempty(st) & isfield(st,'registry') & ishandle(st.registry.hMe),
- delete(st.registry.hMe); st = rmfield(st,'registry');
-end;
-my_delete(1:24);
-reset_st;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function my_delete(arg1)
-global st
-for i=valid_handles(arg1),
- kids = get(st.fig,'Children');
- for j=1:3,
- if any(kids == st.vols{i}.ax{j}.ax),
- set(get(st.vols{i}.ax{j}.ax,'Children'),'DeleteFcn','');
- delete(st.vols{i}.ax{j}.ax);
- end;
- end;
- st.vols{i} = [];
-end;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function resolution(arg1)
-global st
-res = arg1/mean(svd(st.Space(1:3,1:3)));
-Mat = diag([res res res 1]);
-st.Space = st.Space*Mat;
-st.bb = st.bb/res;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function move(handle,pos)
-global st
-for handle = valid_handles(handle),
- st.vols{handle}.area = pos;
-end;
-bbox;
-% redraw(valid_handles(handle));
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function bb = maxbb
-global st
-mn = [Inf Inf Inf];
-mx = -mn;
-for i=valid_handles(1:24),
- bb = [[1 1 1];st.vols{i}.dim(1:3)];
- c = [ bb(1,1) bb(1,2) bb(1,3) 1
- bb(1,1) bb(1,2) bb(2,3) 1
- bb(1,1) bb(2,2) bb(1,3) 1
- bb(1,1) bb(2,2) bb(2,3) 1
- bb(2,1) bb(1,2) bb(1,3) 1
- bb(2,1) bb(1,2) bb(2,3) 1
- bb(2,1) bb(2,2) bb(1,3) 1
- bb(2,1) bb(2,2) bb(2,3) 1]';
- tc = st.Space\(st.vols{i}.premul*st.vols{i}.mat)*c;
- tc = tc(1:3,:)';
- mx = max([tc ; mx]);
- mn = min([tc ; mn]);
-end;
-bb = [mn ; mx];
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function space(arg1)
-global st
-if ~isempty(st.vols{arg1})
- num = arg1;
- Mat = st.vols{num}.premul(1:3,1:3)*st.vols{num}.mat(1:3,1:3);
- Mat = diag([sqrt(sum(Mat.^2)) 1]);
- Space = (st.vols{num}.mat)/Mat;
- bb = [1 1 1;st.vols{num}.dim(1:3)];
- bb = [bb [1;1]];
- bb=bb*Mat';
- bb=bb(:,1:3);
- st.Space = Space;
- st.bb = bb;
-end;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function H = specify_image(arg1, arg2)
-global st
-H=[];
-ok = 1;
-eval('V = spm_vol(arg1);','ok=0;');
-if ok == 0,
- fprintf('Can not use image "%s"\n', arg1);
- return;
-end;
-
-ii = 1;
-while ~isempty(st.vols{ii}), ii = ii + 1; end;
-
-DeleteFcn = ['mars_orthviews(''Delete'',' num2str(ii) ');'];
-V.ax = cell(3,1);
-for i=1:3,
- ax = axes('Visible','off','DrawMode','fast','Parent',st.fig,'DeleteFcn',DeleteFcn,...
- 'YDir','normal');
- d = image(0,'Tag','Transverse','Parent',ax,...
- 'DeleteFcn',DeleteFcn);
- set(ax,'Ydir','normal');
- lx = line(0,0,'Parent',ax,'DeleteFcn',DeleteFcn);
- ly = line(0,0,'Parent',ax,'DeleteFcn',DeleteFcn);
- if ~st.xhairs,
- set(lx,'Visible','off');
- set(ly,'Visible','off');
- end;
- V.ax{i} = struct('ax',ax,'d',d,'lx',lx,'ly',ly);
-end;
-V.premul = eye(4);
-V.window = 'auto';
-st.vols{ii} = V;
-
-H = ii;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function bbox
-global st
-Dims = diff(st.bb)'+1;
-
-TD = Dims([1 2])';
-CD = Dims([1 3])';
-if st.mode == 0, SD = Dims([3 2])'; else, SD = Dims([2 3])'; end;
-
-un = get(st.fig,'Units');set(st.fig,'Units','Pixels');sz=get(st.fig,'Position');set(st.fig,'Units',un);
-sz = sz(3:4);
-sz(2) = sz(2)-40;
-
-for i=valid_handles(1:24),
- area = st.vols{i}.area(:);
- area = [area(1)*sz(1) area(2)*sz(2) area(3)*sz(1) area(4)*sz(2)];
- if st.mode == 0,
- sx = area(3)/(Dims(1)+Dims(3))/1.02;
- else,
- sx = area(3)/(Dims(1)+Dims(2))/1.02;
- end;
- sy = area(4)/(Dims(2)+Dims(3))/1.02;
- s = min([sx sy]);
-
- offy = (area(4)-(Dims(2)+Dims(3))*1.02*s)/2 + area(2);
- sky = s*(Dims(2)+Dims(3))*0.02;
- if st.mode == 0,
- offx = (area(3)-(Dims(1)+Dims(3))*1.02*s)/2 + area(1);
- skx = s*(Dims(1)+Dims(3))*0.02;
- else,
- offx = (area(3)-(Dims(1)+Dims(2))*1.02*s)/2 + area(1);
- skx = s*(Dims(1)+Dims(2))*0.02;
- end;
-
- DeleteFcn = ['mars_orthviews(''Delete'',' num2str(i) ');'];
-
- % Transverse
- set(st.vols{i}.ax{1}.ax,'Units','pixels', ...
- 'Position',[offx offy s*Dims(1) s*Dims(2)],...
- 'Units','normalized','Xlim',[0 TD(1)]+0.5,'Ylim',[0 TD(2)]+0.5,...
- 'Visible','on','XTick',[],'YTick',[]);
-
- % Coronal
- set(st.vols{i}.ax{2}.ax,'Units','Pixels',...
- 'Position',[offx offy+s*Dims(2)+sky s*Dims(1) s*Dims(3)],...
- 'Units','normalized','Xlim',[0 CD(1)]+0.5,'Ylim',[0 CD(2)]+0.5,...
- 'Visible','on','XTick',[],'YTick',[]);
-
- % Sagittal
- if st.mode == 0,
- set(st.vols{i}.ax{3}.ax,'Units','Pixels', 'Box','on',...
- 'Position',[offx+s*Dims(1)+skx offy s*Dims(3) s*Dims(2)],...
- 'Units','normalized','Xlim',[0 SD(1)]+0.5,'Ylim',[0 SD(2)]+0.5,...
- 'Visible','on','XTick',[],'YTick',[]);
- else,
- set(st.vols{i}.ax{3}.ax,'Units','Pixels', 'Box','on',...
- 'Position',[offx+s*Dims(1)+skx offy+s*Dims(2)+sky s*Dims(2) s*Dims(3)],...
- 'Units','normalized','Xlim',[0 SD(1)]+0.5,'Ylim',[0 SD(2)]+0.5,...
- 'Visible','on','XTick',[],'YTick',[]);
- end;
-end;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function redraw_all
-global st
-redraw(1:24);
-return;
-%_______________________________________________________________________
-function mx = maxval(vol)
-if isstruct(vol) & isfield(vol, 'vol'), vol = vol.vol;end
-if isstruct(vol),
- mx = -Inf;
- for i=1:vol.dim(3),
- tmp = spm_slice_vol(vol,spm_matrix([0 0 i]),vol.dim(1:2),0);
- imx = max(tmp(find(isfinite(tmp))));
- if ~isempty(imx),mx = max(mx,imx);end
- end;
-else,
- mx = max(vol(find(isfinite(vol))));
-end;
-%_______________________________________________________________________
-function mn = minval(vol)
-if isstruct(vol) & isfield(vol, 'vol'), vol = vol.vol;end
-if isstruct(vol),
- mn = Inf;
- for i=1:vol.dim(3),
- tmp = spm_slice_vol(vol,spm_matrix([0 0 i]),vol.dim(1:2),0);
- imn = min(tmp(find(isfinite(tmp))));
- if ~isempty(imn),mn = min(mn,imn);end
- end;
-else,
- mn = min(vol(find(isfinite(vol))));
-end;
-
-%_______________________________________________________________________
-%_______________________________________________________________________
-function redraw(arg1)
-global st
-bb = st.bb;
-Dims = diff(bb)'+1;
-is = inv(st.Space);
-cent = is(1:3,1:3)*st.centre(:) + is(1:3,4);
-
-for i = valid_handles(arg1),
- M = st.vols{i}.premul*st.vols{i}.mat;
- TM0 = [ 1 0 0 -bb(1,1)+1
- 0 1 0 -bb(1,2)+1
- 0 0 1 -cent(3)
- 0 0 0 1];
- TM = inv(TM0*(st.Space\M));
- TD = Dims([1 2]);
-
- CM0 = [ 1 0 0 -bb(1,1)+1
- 0 0 1 -bb(1,3)+1
- 0 1 0 -cent(2)
- 0 0 0 1];
- CM = inv(CM0*(st.Space\M));
- CD = Dims([1 3]);
-
- if st.mode ==0,
- SM0 = [ 0 0 1 -bb(1,3)+1
- 0 1 0 -bb(1,2)+1
- 1 0 0 -cent(1)
- 0 0 0 1];
- SM = inv(SM0*(st.Space\M)); SD = Dims([3 2]);
- else,
- SM0 = [ 0 1 0 -bb(1,2)+1
- 0 0 1 -bb(1,3)+1
- 1 0 0 -cent(1)
- 0 0 0 1];
- SM0 = [ 0 -1 0 +bb(2,2)+1
- 0 0 1 -bb(1,3)+1
- 1 0 0 -cent(1)
- 0 0 0 1];
- SM = inv(SM0*(st.Space\M));
- SD = Dims([2 3]);
- end;
-
- ok=1;
- eval('imgt = (spm_slice_vol(st.vols{i},TM,TD,st.hld))'';','ok=0;');
- eval('imgc = (spm_slice_vol(st.vols{i},CM,CD,st.hld))'';','ok=0;');
- eval('imgs = (spm_slice_vol(st.vols{i},SM,SD,st.hld))'';','ok=0;');
- if (ok==0), fprintf('Image "%s" can not be resampled\n', st.vols{i}.fname);
- else,
- if strcmp(st.vols{i}.window,'auto'),
- mx = -Inf; mn = Inf;
- if ~isempty(imgt),
- mx = max([mx max(max(imgt))]);
- mn = min([mn min(min(imgt))]);
- end;
- if ~isempty(imgc),
- mx = max([mx max(max(imgc))]);
- mn = min([mn min(min(imgc))]);
- end;
- if ~isempty(imgs),
- mx = max([mx max(max(imgs))]);
- mn = min([mn min(min(imgs))]);
- end;
- if mx==mn, mx=mn+eps; end;
- else,
- mx = st.vols{i}.window(2);
- mn = st.vols{i}.window(1);
- r=min([mn mx]);imgt = max(imgt,r); r=max([mn mx]);imgt = min(imgt,r);
- r=min([mn mx]);imgc = max(imgc,r); r=max([mn mx]);imgc = min(imgc,r);
- r=min([mn mx]);imgs = max(imgs,r); r=max([mn mx]);imgs = min(imgs,r);
- end;
-
- if isfield(st.vols{i},'blobs'),
- if ~isfield(st.vols{i}.blobs{1},'colour'),
- % Add blobs for display using the split colourmap
- scal = 64/(mx-mn);
- dcoff = -mn*scal;
- imgt = imgt*scal+dcoff;
- imgc = imgc*scal+dcoff;
- imgs = imgs*scal+dcoff;
-
- vol = st.vols{i}.blobs{1}.vol;
- mat = st.vols{i}.premul*st.vols{i}.blobs{1}.mat;
- if isfield(st.vols{i}.blobs{1},'max'),
- mx = st.vols{i}.blobs{1}.max;
- else,
- mx = max([eps maxval(st.vols{i}.blobs{1}.vol)]);
- st.vols{i}.blobs{1}.max = mx;
- end;
- if isfield(st.vols{i}.blobs{1},'min'),
- mn = st.vols{i}.blobs{1}.min;
- else,
- mn = min([0 minval(st.vols{i}.blobs{1}.vol)]);
- st.vols{i}.blobs{1}.min = mn;
- end;
-
- vol = st.vols{i}.blobs{1}.vol;
- M = st.vols{i}.premul*st.vols{i}.blobs{1}.mat;
- tmpt = spm_slice_vol(vol,inv(TM0*(st.Space\M)),TD,[0 NaN])';
- tmpc = spm_slice_vol(vol,inv(CM0*(st.Space\M)),CD,[0 NaN])';
- tmps = spm_slice_vol(vol,inv(SM0*(st.Space\M)),SD,[0 NaN])';
-
- sc = 64/(mx-mn);
- off = 65.51-mn*sc;
- msk = find(isfinite(tmpt)); imgt(msk) = off+tmpt(msk)*sc;
- msk = find(isfinite(tmpc)); imgc(msk) = off+tmpc(msk)*sc;
- msk = find(isfinite(tmps)); imgs(msk) = off+tmps(msk)*sc;
-
- cmap = get(st.fig,'Colormap');
- if size(cmap,1)~=128
- figure(st.fig)
- spm_figure('Colormap','gray-hot')
- end;
- elseif isstruct(st.vols{i}.blobs{1}.colour),
- % Add blobs for display using a defined
- % colourmap
-
- % colourmaps
- gryc = [0:63]'*ones(1,3)/63;
- actc = ...
- st.vols{1}.blobs{1}.colour.cmap;
- actp = ...
- st.vols{1}.blobs{1}.colour.prop;
-
- % scale grayscale image, not finite -> black
- imgt = scaletocmap(imgt,mn,mx,gryc,65);
- imgc = scaletocmap(imgc,mn,mx,gryc,65);
- imgs = scaletocmap(imgs,mn,mx,gryc,65);
- gryc = [gryc; 0 0 0];
-
- % get max for blob image
- vol = st.vols{i}.blobs{1}.vol;
- mat = st.vols{i}.premul*st.vols{i}.blobs{1}.mat;
- if isfield(st.vols{i}.blobs{1},'max'),
- cmx = st.vols{i}.blobs{1}.max;
- else,
- cmx = max([eps maxval(st.vols{i}.blobs{1}.vol)]);
- end;
-
- % get blob data
- vol = st.vols{i}.blobs{1}.vol;
- M = st.vols{i}.premul*st.vols{i}.blobs{1}.mat;
- tmpt = spm_slice_vol(vol,inv(TM0*(st.Space\M)),TD,[0 NaN])';
- tmpc = spm_slice_vol(vol,inv(CM0*(st.Space\M)),CD,[0 NaN])';
- tmps = spm_slice_vol(vol,inv(SM0*(st.Space\M)),SD,[0 NaN])';
-
- % actimg scaled round 0, black NaNs
- topc = size(actc,1)+1;
- tmpt = scaletocmap(tmpt,-cmx,cmx,actc,topc);
- tmpc = scaletocmap(tmpc,-cmx,cmx,actc,topc);
- tmps = scaletocmap(tmps,-cmx,cmx,actc,topc);
- actc = [actc; 0 0 0];
-
- % combine gray and blob data to
- % truecolour
- imgt = reshape(actc(tmpt(:),:)*actp+ ...
- gryc(imgt(:),:)*(1-actp), ...
- [size(imgt) 3]);
- imgc = reshape(actc(tmpc(:),:)*actp+ ...
- gryc(imgc(:),:)*(1-actp), ...
- [size(imgc) 3]);
- imgs = reshape(actc(tmps(:),:)*actp+ ...
- gryc(imgs(:),:)*(1-actp), ...
- [size(imgs) 3]);
-
-
- else,
- % Add full colour blobs - several sets at once
- scal = 1/(mx-mn);
- dcoff = -mn*scal;
- imgt = repmat(imgt*scal+dcoff,[1,1,3]);
- imgc = repmat(imgc*scal+dcoff,[1,1,3]);
- imgs = repmat(imgs*scal+dcoff,[1,1,3]);
-
- for j=1:length(st.vols{i}.blobs),
- vol = st.vols{i}.blobs{j}.vol;
- mat = st.vols{i}.premul*st.vols{i}.blobs{j}.mat;
- if isfield(st.vols{i}.blobs{j},'colour'),
- colour = st.vols{i}.blobs{j}.colour;
- else,
- colour = [1 0 0];
- end;
- if isfield(st.vols{i}.blobs{j},'max'),
- mx = st.vols{i}.blobs{j}.max;
- else,
- mx = max([eps max(st.vols{i}.blobs{j}.vol(:))]);
- st.vols{i}.blobs{j}.max = mx;
- end;
- if isfield(st.vols{i}.blobs{j},'min'),
- mn = st.vols{i}.blobs{j}.min;
- else,
- mn = min([0 min(st.vols{i}.blobs{j}.vol(:))]);
- st.vols{i}.blobs{j}.min = mn;
- end;
-
- vol = st.vols{i}.blobs{j}.vol;
- M = st.vols{i}.premul*st.vols{i}.blobs{j}.mat;
- tmpt = spm_slice_vol(vol,inv(TM0*(st.Space\M)),TD,[0 NaN])'/(mx-mn)+mn;
- tmpc = spm_slice_vol(vol,inv(CM0*(st.Space\M)),CD,[0 NaN])'/(mx-mn)+mn;
- tmps = spm_slice_vol(vol,inv(SM0*(st.Space\M)),SD,[0 NaN])'/(mx-mn)+mn;
- tmpt(find(~isfinite(tmpt))) = 0;
- tmpc(find(~isfinite(tmpc))) = 0;
- tmps(find(~isfinite(tmps))) = 0;
-
- tmp = cat(3,tmpt*colour(1),tmpt*colour(2),tmpt*colour(3));
- imgt = (repmat(1-tmpt,[1 1 3]).*imgt+tmp);
- tmp = find(imgt<0); imgt(tmp)=0; tmp = find(imgt>1); imgt(tmp)=1;
-
- tmp = cat(3,tmpc*colour(1),tmpc*colour(2),tmpc*colour(3));
- imgc = (repmat(1-tmpc,[1 1 3]).*imgc+tmp);
- tmp = find(imgc<0); imgc(tmp)=0; tmp = find(imgc>1); imgc(tmp)=1;
-
- tmp = cat(3,tmps*colour(1),tmps*colour(2),tmps*colour(3));
- imgs = (repmat(1-tmps,[1 1 3]).*imgs+tmp);
- tmp = find(imgs<0); imgs(tmp)=0; tmp = find(imgs>1); imgs(tmp)=1;
- end;
- end;
- else,
- scal = 64/(mx-mn);
- dcoff = -mn*scal;
- imgt = imgt*scal+dcoff;
- imgc = imgc*scal+dcoff;
- imgs = imgs*scal+dcoff;
- end;
-
- callback = 'mars_orthviews(''Reposition'');';
-
- set(st.vols{i}.ax{1}.d,'ButtonDownFcn',callback, 'Cdata',imgt);
- set(st.vols{i}.ax{1}.lx,'ButtonDownFcn',callback,...
- 'Xdata',[0 TD(1)]+0.5,'Ydata',[1 1]*(cent(2)-bb(1,2)+1));
- set(st.vols{i}.ax{1}.ly,'ButtonDownFcn',callback,...
- 'Ydata',[0 TD(2)]+0.5,'Xdata',[1 1]*(cent(1)-bb(1,1)+1));
-
- set(st.vols{i}.ax{2}.d,'ButtonDownFcn',callback, 'Cdata',imgc);
- set(st.vols{i}.ax{2}.lx,'ButtonDownFcn',callback,...
- 'Xdata',[0 CD(1)]+0.5,'Ydata',[1 1]*(cent(3)-bb(1,3)+1));
- set(st.vols{i}.ax{2}.ly,'ButtonDownFcn',callback,...
- 'Ydata',[0 CD(2)]+0.5,'Xdata',[1 1]*(cent(1)-bb(1,1)+1));
-
- set(st.vols{i}.ax{3}.d,'ButtonDownFcn',callback,'Cdata',imgs);
- if st.mode ==0,
- set(st.vols{i}.ax{3}.lx,'ButtonDownFcn',callback,...
- 'Xdata',[0 SD(1)]+0.5,'Ydata',[1 1]*(cent(2)-bb(1,2)+1));
- set(st.vols{i}.ax{3}.ly,'ButtonDownFcn',callback,...
- 'Ydata',[0 SD(2)]+0.5,'Xdata',[1 1]*(cent(3)-bb(1,3)+1));
- else,
- set(st.vols{i}.ax{3}.lx,'ButtonDownFcn',callback,...
- 'Xdata',[0 SD(1)]+0.5,'Ydata',[1 1]*(cent(3)-bb(1,3)+1));
- set(st.vols{i}.ax{3}.ly,'ButtonDownFcn',callback,...
- 'Ydata',[0 SD(2)]+0.5,'Xdata',[1 1]*(bb(2,2)+1-cent(2)));
- end;
- end;
-end;
-drawnow;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function centre = findcent
-global st
-obj = get(st.fig,'CurrentObject');
-centre = [];
-cent = [];
-cp = [];
-for i=valid_handles(1:24),
- for j=1:3,
- if ~isempty(obj),
- if any([st.vols{i}.ax{j}.d ...
- st.vols{i}.ax{j}.lx ...
- st.vols{i}.ax{j}.ly]== obj)
- cp = get(get(obj,'Parent'),'CurrentPoint');
- elseif (st.vols{i}.ax{j}.ax == obj),
- cp = get(obj,'CurrentPoint');
- end;
- end;
- if ~isempty(cp),
- cp = cp(1,1:2);
- is = inv(st.Space);
- cent = is(1:3,1:3)*st.centre(:) + is(1:3,4);
- switch j,
- case 1,
- cent([1 2])=[cp(1)+st.bb(1,1)-1 cp(2)+st.bb(1,2)-1];
- case 2,
- cent([1 3])=[cp(1)+st.bb(1,1)-1 cp(2)+st.bb(1,3)-1];
- case 3,
- if st.mode ==0,
- cent([3 2])=[cp(1)+st.bb(1,3)-1 cp(2)+st.bb(1,2)-1];
- else,
- cent([2 3])=[st.bb(2,2)+1-cp(1) cp(2)+st.bb(1,3)-1];
- end;
- end;
- break;
- end;
- end;
- if ~isempty(cent), break; end;
-end;
-if ~isempty(cent), centre = st.Space(1:3,1:3)*cent(:) + st.Space(1:3,4); end;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function handles = valid_handles(handles)
-global st;
-handles = handles(:)';
-handles = handles(find(handles<=24 & handles>=1 & ~rem(handles,1)));
-for h=handles,
- if isempty(st.vols{h}), handles(find(handles==h))=[]; end;
-end;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function reset_st
-global st
-fig = spm_figure('FindWin','Graphics');
-bb = [ [-78 78]' [-112 76]' [-50 85]' ];
-st = struct('n', 0, 'vols',[], 'bb',bb,'Space',eye(4),'centre',[0 0 0],'callback',';','xhairs',1,'hld',1,'fig',fig,'mode',1);
-st.vols = cell(24,1);
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function img = scaletocmap(inpimg,mn,mx,cmap,miscol)
-if nargin < 5, miscol=1;end
-cml = size(cmap,1);
-scf = (cml-1)/(mx-mn);
-img = round((inpimg-mn)*scf)+1;
-img(find(img<1))=1;
-img(find(img>cml))=cml;
-img(~isfinite(img)) = miscol;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function cmap = getcmap(acmapname)
-% get colormap of name acmapname
-if ~isempty(acmapname)
- cmap = evalin('base',acmapname,'[]');
- if isempty(cmap) % not a matrix, is .mat file?
- [p f e] = fileparts(acmapname);
- acmat = fullfile(p, [f '.mat']);
- if exist(acmat, 'file')
- s = struct2cell(load(acmat));
- cmap = s{1};
- end
- end
-end
-if size(cmap, 2)~=3
- warning('Colormap was not an N by 3 matrix')
- cmap = [];
-end
-return
diff --git a/lib/marsbar-0.44/mars_rois2img.m b/lib/marsbar-0.44/mars_rois2img.m
deleted file mode 100644
index d65a3d9..0000000
--- a/lib/marsbar-0.44/mars_rois2img.m
+++ /dev/null
@@ -1,101 +0,0 @@
-function mars_rois2img(roi_list, img_name, roi_space, flags)
-% creates cluster or number labelled ROI image from ROIs
-% FORMAT mars_rois2img(roi_list, img_name, roi_space, flags)
-%
-% roi_list - strings with ROI filenames
-% img_name - name of image to write out
-% roi_space - space for image
-% flags - none or more of: [default = 'i']
-% 'i' - id image, voxel values identify ROIs
-% 'c' - cluster image, clusters identified by location
-%
-% $Id %
-
-if nargin < 1
- roi_list = '';
-end
-if nargin < 2
- img_name = '';
-end
-if nargin < 3
- roi_space = [];
-end
-if nargin < 4
- flags = '';
-end
-
-% Process input arguments
-if isempty(roi_list)
- roi_list = spm_get([0 Inf], ['*' maroi('classdata', 'fileend')], ...
- 'Select ROIs to write to image');
- if isempty(roi_list), return, end
-end
-if isempty(img_name)
- img_name = mars_utils('get_img_name');
- if isempty(img_name), return, end
-end
-if isempty(roi_space)
- roi_space = maroi('classdata', 'spacebase');
-end
-if isempty(flags)
- flags = 'i'; % id image is default
-end
-
-roi_list = maroi('load_cell', roi_list);
-roi_len = prod(size(roi_list));
-
-img_data = zeros(roi_space.dim);
-roi_ctr = 1;
-for i = 1:roi_len
- roi = roi_list{i};
- % check ROI contains something
- if isempty(roi)
- warning(sprintf('ROI %d is missing', i));
- elseif is_empty_roi(roi)
- warning(sprintf('ROI %d:%s is empty', i, label(roi)));
- else
- % convert ROI to matrix
- mo = maroi_matrix(roi, roi_space);
- dat = matrixdata(mo);
- if isempty(dat) | ~any(dat(:))
- warning(sprintf('ROI %d: %s - contains no points in this space',...
- i, label(roi)));
- else
- % add matrix to image
- if any(flags == 'i')
- img_data(dat ~= 0) = roi_ctr;
- roi_info(roi_ctr) = struct('label', label(roi),...
- 'number', roi_ctr);
- else
- img_data = img_data + dat;
- end
- roi_ctr = roi_ctr + 1;
- end
- end
-end
-if roi_ctr == 1
- warning('Found no useful ROIs, no image saved');
- return
-end
-
-% output image type
-img_type = 'float'; % to avoid rounding errors
-
-% save ROI info
-if any(flags == 'i')
- [p f e] = fileparts(img_name);
- iname = fullfile(p, [f '_labels.mat']);
- save(iname, 'roi_info');
-end
-
-% Prepare and write image
-V = mars_vol_utils('def_vol');
-V.fname = img_name;
-V.mat = roi_space.mat;
-V.dim(1:3) = roi_space.dim;
-V = mars_vol_utils('set_type', V, img_type);
-
-V = spm_create_vol(V);
-V = spm_write_vol(V, img_data);
-
-fprintf('Wrote image %s\nDone...\n', img_name);
diff --git a/lib/marsbar-0.44/mars_struct.m b/lib/marsbar-0.44/mars_struct.m
deleted file mode 100644
index 825800f..0000000
--- a/lib/marsbar-0.44/mars_struct.m
+++ /dev/null
@@ -1,264 +0,0 @@
-function varargout = mars_struct(action, varargin)
-% multifunction function for manipulating structures
-%
-% To help the exposition a bit:
-% 'fill' in a name, means that values empty or missing
-% in one structure are fetched from another
-%
-% 'merge' means simply that missing fields are added, with
-% values, from a second structure (but not filled if empty)
-%
-% Each function needs to deal with the case of empty arguments
-%
-% FORMAT c = mars_struct('fillafromb', a, b, fieldns, flags)
-% fills structure fields empty or missing in a from those present in b
-% a, b are structures
-% fieldns (optional) is cell array of field names to fill from in b
-% c is returned structure
-% Is recursive, will fill struct fields from struct fields
-% flags may contain 'f', which Force fills a from b (all non empty
-% fields in b overwrite those in a)
-% flags may also contain 'r', which Restricts fields to write from b, to
-% those that are already present in a
-%
-% FORMAT [c, d] = mars_struct('split', a, b)
-% split structure a into two, according to fields in b
-% so that c becomes a structure which contains the fields
-% in a, that are also present in b, and d contains the fields
-% in a that are not present in b. b can be a structure
-% or a cell array of fieldnames
-%
-% FORMAT [d] = mars_struct('strip', a, b)
-% strips all fields present in b from those in a,
-% returning denuded structure as d. b can be a structure
-% or a cell array of fieldnames. 'strip' is just 'split'
-% but returning only the second argument
-%
-% FORMAT c = mars_struct('merge', a, b)
-% merges structure a and b (fields present in b added to a)
-%
-% FORMAT [c,d] = mars_struct('ffillsplit', a, b)
-% force fill, followed by split
-% All fields from a, that are also present in b, and not empty in b,
-% are replaced with the values in b; the result is returned as c
-% Any fields present in b, but not present in a, are returned in d
-% So, let's say you have a default structure D, and you want to fill this
-% in with any interesting data in a passed structure P, you could use:
-% [good_struct not_recognized]= mars_struct('ffillsplit', D, P);
-%
-% FORMAT c = mars_struct('ffillmerge', a, b)
-% force fill followed by merge
-% performs 'ffillsplit' on a and b, then merges a and b
-% All fields present in a or b are returned in c, but
-% any fields present in both, now have the value from b
-%
-% FORMAT [c d] = mars_struct('splitmerge', a, b)
-% performs 'split' on a and b, creating c and d
-% then merges c with b.
-% d contains fields in a that were not present in b
-% c contains fields present in both, or just in b
-%
-% FORMAT z = mars_struct('isthere', a, b [, c [, d ...])
-% returns 1 if field named in b is present in a
-% and field value is not empty.
-% The call is recursive if more than two arguments are passed
-% Thus with structure s = struct('one', struct('two', 3))
-% mars_struct('isthere', s, 'one', 'two') returns 1
-%
-% FORMAT z = mars_struct('getifthere', a, b [, c [, d ...])
-% returns value of field named in b from a or [] if absent
-% Call is recursive, like 'isthere' above.
-%
-% FORMAT strs = mars_struct('celldisp', a)
-% returns output like disp(a) as a cell array
-% Useful for printing text description of structure
-%
-% $Id$
-
-if nargin < 1
- error('Action needed');
-end
-if nargin < 2
- error('Must specify structure')
-end
-if nargin < 3
- varargin = {varargin{:} []};
-end
-[a b] = deal(varargin{1:2});
-
-switch lower(action)
- case 'fillafromb'
- % Return for empty passed args
- if isempty(a), varargout = {b}; return, end
- if isempty(b), varargout = {a}; return, end
- if nargin < 4, fieldns = []; else fieldns = varargin{3}; end
- if isempty(fieldns)
- if ~isstruct(b), error('Need struct as 2nd argument'); end
- fieldns = fieldnames(b);
- end
- if nargin < 5, flags = ''; else flags = varargin{4}; end
- if isempty(flags), flags = ' ';end
-
- if ischar(fieldns), fieldns=cellstr(fieldns);end
-
- af = fieldnames(a)';
- bf = fieldns';
-
- % classify fields 0 = a~b, 1 = a&b, 2=b~a
- cf = af;
- ftype = ismember(af, bf);
- if ~any(flags == 'r')
- b_not_a = find(~ismember(bf, af));
- cf = {cf{:} bf{b_not_a}};
- ftype = [ftype ones(1, length(b_not_a))*2];
- end
-
- % cope with arrays of structures
- alen = prod(size(a));
- blen = prod(size(b));
- maxlen = max(alen, blen);
-
- for si=1:maxlen
- ctmp = [];
- for i=1:length(cf)
- fn = cf{i};
- switch ftype(i)
- case 0 % a~b
- fval = getfield(a(si), fn);
- case 1 % shared field
- bfc = getfield(b(si), fn);
- if isempty(getfield(a(si), fn)) || ... % a field is empty
- (any(flags == 'f' && ~isempty(bfc)))% or force fill
- fval = bfc;
- else % field not empty, could be struct -> recurse
- fval = getfield(a(si),fn);
- if isstruct(fval) && isstruct(bfc)
- fval = mars_struct('fillafromb',fval,bfc);
- end
- end
- case 2 % b~a
- fval = getfield(b(si), fn);
- case 3 % no field information, see below
- fval = [];
- end
- if isempty(ctmp)
- ctmp = struct(fn, fval);
- else
- ctmp = setfield(ctmp, fn, fval);
- end
- end
- c(si) = ctmp;
-
- if si == blen % reached end of bs, rest of b~a fields are empty
- ftype = (ftype == 2) * 3;
- elseif si == alen % end of a's rest of a~b fields are empty
- ftype = (ftype == 0) * 2 + 1;
- end
-
- end
- varargout = {c};
-
- case 'split'
- if isempty(a), varargout = {a,a}; return, end
- if isempty(b), varargout = {b,a}; return, end
- d = a;
- c = [];
-
- if ischar(b), b = {b};end
- if isstruct(b), b = fieldnames(b);end
-
- for bf = b(:)'
- if isfield(a, bf{1})
- c = setfield(c, bf{1}, getfield(a, bf{1}));
- d = rmfield(d, bf{1});
- end
- end
- varargout = {c, d};
-
- case 'strip'
- [c d] = mars_struct('split', a, b);
- varargout = {d};
-
- case 'merge'
- if isempty(a), varargout = {b}; return, end
- if isempty(b), varargout = {a}; return, end
- c = a;
-
- for bf = fieldnames(b)';
- if ~isfield(a, bf{1})
- c = setfield(c, bf{1}, getfield(b, bf{1}));
- end
- end
- varargout = {c};
-
- case 'ffillsplit'
- if isempty(a) || isempty(b)
- % Nothing in common, return unchanged
- varargout = {a, b}; return
- end
- c = a; d = b;
-
- cf = fieldnames(c);
- for i=1:length(cf)
- if isfield(d, cf{i})
- dfc = getfield(d,cf{i});
- if ~isempty(dfc)
- c = setfield(c, cf{i}, dfc);
- end
- d = rmfield(d, cf{i});
- end
- end
- varargout = {c,d};
-
- case 'ffillmerge'
- [a b] = mars_struct('ffillsplit', a, b);
- varargout = {mars_struct('merge', a, b)};
-
- case 'splitmerge'
- [a c] = mars_struct('split', a, b);
- varargout = {mars_struct('merge', a, b) c};
-
- case 'isthere'
- if isempty(a), varargout = {0}; return, end
- c = mars_struct('getifthere', varargin{:});
- varargout = {~isempty(c)};
-
- case 'getifthere'
- if isempty(a), varargout = {[]}; return, end
- if isempty(b), varargout = {[]}; return, end
- for v = 2:nargin-1
- b = varargin{v};
- if ~isfield(a, b)
- varargout = {[]};
- return
- end
- a = getfield(a, b);
- end
- varargout = {a};
-
- case 'celldisp'
- if isempty(a), varargout = {{}}; return, end
- af = fieldnames(a);
- c = {};
- pad_len = size(char(af), 2) + 4;
- pad_str = ['%' num2str(pad_len) 's: %s'];
- for f = 1:length(af)
- d = getfield(a, af{f});
- cls = class(d);
- sz = size(d);
- szstr = sprintf('%dx', size(d));
- szstr(end) = [];
- switch cls
- case 'char'
- case {'double', 'float'}
- d = ['[' num2str(d) ']'];
- otherwise
- d = sprintf('[%s %s]', szstr, cls);
- end
- c{f} = sprintf(pad_str, af{f}, d);
- end
- varargout = {c};
-
- otherwise
- error(['Suspicious action was ' action]);
-end % switch
diff --git a/lib/marsbar-0.44/mars_uifile.m b/lib/marsbar-0.44/mars_uifile.m
deleted file mode 100644
index a50ef86..0000000
--- a/lib/marsbar-0.44/mars_uifile.m
+++ /dev/null
@@ -1,87 +0,0 @@
-function [fn,pn,fi] = mars_uifile(action, filter_spec, prompt, filename, varargin)
-% wrapper for matlab uiputfile/getfile; to resolve version differences
-% FORMAT [fn,pn,fi] = mars_uifile(action, filter_spec, prompt, filename, varargin)
-%
-% uigetfile and uiputfile in matlab 5.3 does not support the use of multiple
-% filters, in the filter_spec array.
-% Matlab < 6.5 does not allow the passing of a seperate filename default
-% as a third argument.
-% Matlab < 6.5 does not return a third argument (file index)
-%
-% mars_uifile acts as a wrapper for calls to uiputfile and uigetfile, so
-% that 6.5 format calls will be translated to something useful to 5.3,
-% 6.1 if 5.3 or 6.1 is running.
-%
-% $Id$
-
-if nargin < 1
- error('Need action');
-end
-if nargin < 2
- filter_spec = '';
-end
-if nargin < 3
- prompt = '';
-end
-if nargin < 4
- filename = '';
-end
-if isnumeric(filename)
- varargin = [{filename} varargin];
- filename = '';
-end
-
-mlv = version; mlv = str2num(mlv(1:3));
-if mlv < 6.5
- % If we have a default filename, we cannot use it with the filterspec,
- % so use filename instead of filterspec
- if ~isempty(filename)
- filter_spec = filename;
- elseif mlv < 6 % only allowed string filterspec
- if iscell(filter_spec)
- filter_spec = filter_spec{1};
- end
- semic = find(filter_spec == ';');
- if ~isempty(semic)
- filter_spec(semic(1):end) = [];
- end
- end
- arglist = {filter_spec, prompt, varargin{:}};
-else % (so matlab >= 6.5)
- % It seems that, in the following setup:
- % matlab 7; Java interface; linux; cell array filterspec
- % - all uigetfile filters need to be of form '*.', where is
- % the file extension. This is not so for the one version of matlab 7
- % on windows that I tested (matlab 7.1.0.253 or something). I'm
- % guessing that other Unices may have the same problem though.
- if mlv >= 7 & usejava('jvm') & isunix
- for fsn = 1:size(filter_spec, 1)
- [pn fn ext] = fileparts(filter_spec{fsn, 1});
- filter_spec{fsn, 1} = ['*' ext];
- end
- end
-
- if isempty(filename) % matlab 7 does not tolerate empty filenames
- arglist = {filter_spec, prompt, varargin{:}};
- else
- arglist = {filter_spec, prompt, filename, varargin{:}};
- end
-end
-
-fi = [];
-switch lower(action)
- case 'get'
- if mlv < 6.5
- [fn pn] = uigetfile(arglist{:});
- else
- [fn pn fi] = uigetfile(arglist{:});
- end
- case 'put'
- if mlv < 6.5
- [fn pn] = uiputfile(arglist{:});
- else
- [fn pn fi] = uiputfile(arglist{:});
- end
- otherwise
- error(['Strange desire for ' action]);
-end
diff --git a/lib/marsbar-0.44/mars_utils.m b/lib/marsbar-0.44/mars_utils.m
deleted file mode 100644
index 2b50382..0000000
--- a/lib/marsbar-0.44/mars_utils.m
+++ /dev/null
@@ -1,275 +0,0 @@
-function varargout=mars_utils(varargin)
-% collection of useful utility functions for MarsBaR etc
-%
-% fname = mars_utils('str2fname', str)
-% accepts string, attempts return of string for valid filename
-% The passed string should be without path or extension
-%
-% tf = mars_utils('is_valid_varname', str)
-% accepts string, tests if it is a valid variable name
-% returns 1 for yes.
-%
-% P = mars_utils('get_img_name', fname, flags);
-% gets name of image, if image exists, checks for overwrite
-% returns filename, or empty string if overwrite not wanted
-%
-% XYZ = mars_utils('e2xyz', els, dims);
-% takes element numbers in an image (e.g. find(img>5)) and the
-% dimensions of the image [X Y Z] and returns the 3xN voxel
-% coordinates corresponding to the N elements
-%
-% absf = mars_utils('isabspath', path);
-% Takes path name, and returns flag, 1 if path is absolute on this
-% system, 0 if relative or empty
-%
-% mars_utils('graphic_text', strs, [title_str, [, figure_str]])
-% Displays cell array of text (strs) in SPM graphics window
-% with optional title (char) title_string. Can also set to display to
-% other figure window (string or figure handle).
-%
-% mars_utils('spm_version', [check_global])
-% Gets SPM version string. Robust version to allow there to be
-% versions of the spm.m file to not have Contents.m files in the same
-% directory. If optional flag check_global is zero, does _not_ check
-% global SPM_VER variable for version, and tries to get directly from
-% spm.m / Contents.m pairs.
-%
-% tf = mars_utils('is_swapped_wrong', V)
-% Deprecated - see version in mars_vol_utils
-%
-% tf = mars_utils('version_less_than', v1, v2)
-% Returns 1 if version v1 is lower than version v2.
-% Versions can be numbers. If strings, versions can contain more than
-% one '.' character. For example, '0.38.1' is less than '0.39', or
-% '0.38.2'
-%
-% $Id$
-
-if nargin < 1
- error('Need action');
-end
-Action = lower(varargin{1});
-
-switch(Action)
-
-%=======================================================================
-case 'str2fname' %-string to file name
-%=======================================================================
-if nargin < 2
- error('Need to specify string');
-end
-str = varargin{2};
-% forbidden chars in file name
-badchars = unique([filesep '/\ :;.''"~*?<>|&']);
-
-tmp = find(ismember(str, badchars));
-if ~isempty(tmp)
- str(tmp) = '_';
- dt = diff(tmp);
- if ~isempty(dt)
- str(tmp(dt==1))=[];
- end
-end
-varargout={str};
-
-%=======================================================================
-case 'is_valid_varname' %- tests if string is valid variable name
-%=======================================================================
-if nargin < 2
- error('Need to specify string');
-end
-str = varargin{2};
-try
- eval([str '= [];']);
- varargout={1};
-catch
- varargout = {0};
-end
-
-%=======================================================================
-case 'get_img_name' %-gets name of image, checks for overwrite
-%=======================================================================
-if nargin < 2
- fname = '';
-else
- fname = varargin{2};
-end
-if nargin < 3
- flags = '';
-else
- flags = varargin{3};
-end
-if isempty(flags)
- flags = 'k';
-end
-
-varargout = {''};
-fdir = spm_get(-1, '', 'Directory to save image');
-fname = spm_input('Image filename', '+1', 's', fname);
-if isempty(fname), return, end
-
-% set img extension and make absolute path
-[pn fn ext] = fileparts(fname);
-out_ext = mars_veropts('pref_img_out_ext');
-fname = fullfile(fdir, [fn out_ext]);
-fname = spm_get('cpath', fname);
-
-if any(flags == 'k') && exist(fname, 'file')
- if ~spm_input(['Overwrite ' fn], '+1', ...
- 'b','Yes|No',[1 0], 1)
- return
- end
-end
-varargout = {fname};
-
-%=======================================================================
-case 'e2xyz' %-returns XYZ voxel coordinates for element numbers
-%=======================================================================
-if nargin < 2
- error('Need element numbers');
-end
-if nargin < 3
- error('Need image dimensions');
-end
-els = varargin{2};
-dim = varargin{3};
-if size(els, 2) == 1, els = els'; end
-nz = els-1;
-pl_sz = dim(1)*dim(2);
-Z = floor(nz / pl_sz);
-nz = nz - Z*pl_sz;
-Y = floor(nz / dim(1));
-X = nz - Y*dim(1);
-XYZ = [X; Y; Z] +1;
-varargout = {XYZ};
-
-%=======================================================================
-case 'isabspath' % Returns 1 for absolute path, 0 if relative (or empty)
-%=======================================================================
-if nargin < 2
- error('Need path to test');
-end
-pn = varargin{2};
-switch (spm_platform('filesys'))
- case 'unx'
- if (~isempty(pn) && pn(1)=='/'), absf=1; else, absf=0; end
- case 'win'
- if (length(pn)>1 && pn(2)==':'), absf=1; else, absf=0; end
- otherwise
- error('isabspath not coded for this filesystem');
-end
-varargout = {absf};
-
-%=======================================================================
-case 'graphic_text' % Displays text in SPM figure window
-%=======================================================================
-if nargin < 2, error('Need text to show'); else S = varargin{2}; end
-if ischar(S), S = cellstr(S); end
-if nargin < 3, TTitle = ''; else TTitle = varargin{3}; end
-if nargin < 4, F = []; else, F=varargin{4}; end
-if isempty(F), F='Graphics'; end
-if ischar(F), F = spm_figure('GetWin', F); end
-if isempty(F), F = spm_figure('GetWin', 'Graphics'); end
-
-FS = spm('FontSizes');
-PF = spm_platform('fonts');
-
-spm_figure('clear', F);
-figure(F);
-hAxes = axes('Position',[0.028,0.05,0.85,0.85],...
- 'DefaultTextInterpreter','none',...
- 'Units','Points','Visible','off');
-AxPos = get(hAxes,'Position'); set(hAxes,'YLim',[0,AxPos(4)])
-
-dy = FS(10)*1.2; y0 = floor(AxPos(4)) -dy; y = y0;
-
-text(-0.03,y0,TTitle,'FontSize',FS(14),'FontWeight','bold');
-y = y0 - FS(14);
-
-%-Loop over lines of text
-%------------------------
-for i = 1:prod(size(S))
- d = S{i};
-
- %-For some reason, '|' characters cause a CR.
- d = strrep(d,'|','I');
- h = text(0,y,d,'FontName',PF.courier,'FontSize',FS(10));
- y = y - dy;
-end
-
-%=======================================================================
-case 'spm_version' % Robust get for SPM version string
-%=======================================================================
-% The problem we are trying to solve here is how to take account of the
-% unusual situation of the spm.m file _not_ being in the same directory
-% as the Contents.m file. SPM8 raises an error, SPM5 and probably
-% previous just returns 'SPM'. We raise an error always.
-
-try
- ver = spm('ver');
-catch
- err = lasterr;
- if strcmp('Undefined', err(1:length('Undefined')))
- error('Marsbar needs SPM on the matlab path')
- end
- error(lasterr)
-end
-% If version find failed, for SPM5, routine returns 'SPM'
-str = ['Can''t obtain SPM Revision information. Is spm.m in the same' ...
- ' directory as Contents.m?'];
-if strcmp(ver, 'SPM')
- error(str)
-end
-varargout = {ver};
-
-%=======================================================================
-case 'is_swapped_wrong' % Returns 1 for if vol is incorrectly swapped
-%=======================================================================
-warning(...
- sprintf(['mars_utils version of ''is_swapped_wrong'' deprecated\n',...
- 'Please use same function in mars_vol_utils']));
-varargout = {mars_vol_utils(varargin{:})};
-
-%=======================================================================
-case 'version_less_than' % Returns 1 for if first version less than last
-%=======================================================================
-
-if nargin < 3
- error('Need two version strings to compare');
-end
-varargout{1} = sf_ver_lt(varargin{2:3});
-
-otherwise
- error([Action ' is too strange']);
-end
-return
-
-% Subfunctions
-
-function tf = sf_ver_lt(v1, v2)
-% Returns 1 if version string v1 is lower than v2
-vs = {v1, v2};
-for v = 1:2
- ns = vs{v};
- if ~ischar(ns), ns = num2str(ns); end
- ns = sf_str_to_nums(ns);
- cmp_mat(v, 1:length(ns)) = ns;
-end
-dp = diff(cmp_mat) * -1;
-for i = 1:length(dp)
- if dp(i)<0, tf = 1; return, end
- if dp(i)>0, tf = 0; return, end
-end
-tf = 0;
-return
-
-function ns = sf_str_to_nums(str)
-str = str(ismember(str, '0123456789.'));
-str = ['.' str '.'];
-ps = find(str == '.');
-ns = [];
-for p = 2:length(ps)
- s = str(ps(p-1)+1:ps(p)-1);
- ns = [ns str2num(s)];
-end
-return
diff --git a/lib/marsbar-0.44/mars_vol_check.m b/lib/marsbar-0.44/mars_vol_check.m
deleted file mode 100644
index 039cb64..0000000
--- a/lib/marsbar-0.44/mars_vol_check.m
+++ /dev/null
@@ -1,70 +0,0 @@
-function [samef, msg, chgf] = mars_vol_check(varargin)
-% FORMAT [samef, msg, chgf] = mars_vol_check(V1, V2, ...)
-% checks spm_vol structs are in same space
-%
-% V1, V2, etc - arrays of spm_vol structs
-%
-% samef - true if images have same dims, mats
-% msg - cell array containing helpful message if not
-% chgf - logical Nx2 array of difference flags
-%_______________________________________________________________________
-% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
-
-% Copied from spm_vol_check.m
-% Matthew Brett
-% $Id: spm_vol_check.m 2696 2009-02-05 20:29:48Z guillaume $
-
-
-[fnames samef msg] = deal({},1,{});
-
-if nargin < 1,
- return;
-end
-
-for i = 1:numel(varargin),
- vols = varargin{i};
- if ~isempty(vols),
- if i == 1,
- dims = cat(3,vols(:).dim);
- mats = cat(3,vols(:).mat);
- else
- dims = cat(3,dims,vols(:).dim);
- mats = cat(3,mats,vols(:).mat);
- end
- fnames = {fnames{:}, vols(:).fname};
- end
-end
-
-nimgs = size(dims, 3);
-if nimgs < 2,
- return;
-end
-
-labs = {'dimensions', 'orientation & voxel size'};
-
-dimf = any(diff(dims(:,1:3,:),1,3));
-matf = any(any(diff(mats,1,3)));
-chgf = logical([dimf(:) matf(:)]);
-chgi = find(any(chgf, 2));
-if ~isempty(chgi),
- samef = 0;
- e1 = chgi(1);
- msg = {['Images don''t all have the same ' ...
- sepcat(labs(chgf(e1,:)),', ')],...
- 'First difference between image pair:',...
- fnames{e1},...
- fnames{e1+1}};
-end
-
-function s = sepcat(strs, sep)
-% returns cell array of strings as one char string, separated by sep
-if nargin < 2,
- sep = ';';
-end
-if isempty(strs),
- s = '';
- return
-end
-strs = strs(:)';
-strs = [strs; repmat({sep}, 1, length(strs))];
-s = [strs{1:end-1}];
diff --git a/lib/marsbar-0.44/mars_vol_utils.m b/lib/marsbar-0.44/mars_vol_utils.m
deleted file mode 100644
index ec0e1c5..0000000
--- a/lib/marsbar-0.44/mars_vol_utils.m
+++ /dev/null
@@ -1,341 +0,0 @@
-function varargout=mars_vol_utils(varargin)
-% collection of useful utility functions for vol structs
-%
-% tf = mars_vol_utils('is_vol', V)
-% Returns 1 if V may be a vol struct (right fields)
-%
-% [t,be,sw] = mars_vol_utils('type', V)
-% Returns type number for vol struct - see spm_type, spm_vol
-% Second output t = 1 if vol seems to be little-endian
-% Third output sw = 1 if vol swapped relative to this platform
-%
-% V = mars_vol_utils('set_type', V, type_info)
-% Sets type of vol struct, using type_info
-% type_info can be a number, or a string (see spm_type)
-%
-% tf = mars_vol_utils('is_swapped', V)
-% Returns 1 if V contains data that has opposite endianness from
-% current platform (as given by spm_platform('bigendian')
-%
-% ver = mars_vol_utils('ver', V)
-% Returns version string for vol struct
-% '99' if appears to be spm99 format, '5' for spm5
-%
-% ver = mars_vol_utils('current_ver')
-% Returns '99' if current spm_vols returns 99 vol type, else '5'
-%
-% tf = mars_vol_utils('is_swapped_wrong', V)
-% Returns 1 if the vol struct V has the different swapping
-% information from a fresh mapping from the same file, and thus might
-% have to be remapped.
-%
-% V = mars_vol_utils('byte_swap', V)
-% Returns new vols for opposite byte ordering to current spec
-%
-% V = mars_vol_utils('convert', V, ver)
-% Return vol struct(s) V converted to type specified in ver
-% If ver not specified, convert to current ver type
-%
-% V = mars_vol_utils('def_vol', ver)
-% Return default structure for type ver
-% If ver not specified, use current ver type
-%
-% $Id: mars_vol_utils.m 581 2005-06-21 15:40:17Z matthewbrett $
-
-nout = max(nargout,1);
-varargout = cell(1, nout);
-if nargin < 1
- error('Need action');
-end
-Action = lower(varargin{1});
-if nargin > 1
- V = varargin{2};
-end
-
-switch(Action)
-
-%=======================================================================
-case 'is_vol' % Returns 1 if this appears to be a vol struct
-%=======================================================================
-if nargin < 2
- error('Need vol struct to check');
-end
-varargout = {sf_is_vol(V)};
-
-%=======================================================================
-case 'type' % Returns vol type number
-%=======================================================================
-if nargin < 2
- error('Need vol struct to give type');
-end
-sf_die_no_vol(V);
-varargout{:} = sf_type(V);
-
-%=======================================================================
-case 'set_type' % Sets vol type
-%=======================================================================
-if nargin < 2
- error('Need vol struct to set type');
-end
-sf_die_no_vol(V);
-if nargin < 3
- error('Need type to set');
-end
-type_info = varargin{3};
-varargout = {sf_set_type(V, type_info)};
-
-%=======================================================================
-case 'is_swapped' % Returns 1 if vol swapped relative to this platform
-%=======================================================================
-if nargin < 2
- error('Need vol struct to check swapping');
-end
-sf_die_no_vol(V);
-[t be sw] = sf_type(V);
-varargout = {sw};
-
-%=======================================================================
-case 'ver' % Returns vol type version
-%=======================================================================
-if nargin < 2
- error('Need vol struct to give version');
-end
-sf_die_no_vol(V);
-varargout = {sf_ver(V)};
-
-%=======================================================================
-case 'current_ver' % Returns vol type from spm_vol on path
-%=======================================================================
-varargout = {sf_current_ver};
-
-%=======================================================================
-case 'is_swapped_wrong' % Returns 1 for if vol is incorrectly swapped
-%=======================================================================
-if nargin < 2
- error('Need vol struct to test');
-end
-sf_die_no_vol(V);
-V2 = spm_vol(V.fname);
-[t be] = sf_type(V);
-[t be2] = sf_type(V2);
-varargout = {be ~= be2};
-
-%=======================================================================
-case 'byte_swap' % return vols with opposite recorded byte ordering
-%=======================================================================
-if nargin < 2
- error('Need vol struct to swap');
-end
-sf_die_no_vol(V);
-switch sf_ver(V)
- case '99'
- for i = 1:numel(V)
- if V(i).dim(4) < 256, scf = 256; else scf = 1/256; end
- V(i).dim(4) = V(i).dim(4) * scf;
- end
- case '5'
- for i = 1:numel(V)
- V(i).dt(2) = 1-V(i).dt(2);
- end
- otherwise
- error(['Don''t often see those ' sf_ver(V)]);
-end
-varargout = {V};
-
-%=======================================================================
-case 'convert' % Returns vols converted to alternative type
-%=======================================================================
-if nargin < 2
- error('Need vol struct to convert');
-end
-if ~sf_is_vol(V), varargout={V}; return, end
-if nargin < 3
- ver = sf_current_ver;
-else
- ver = varargin{3};
- if sf_is_vol(ver), ver = sf_ver(ver); end
-end
-if sf_same_ver(V, ver)
- varargout = {V};
- return
-end
-switch sf_ver(V)
- case '99'
- varargout = {sf_99_to_5(V)};
- case '5'
- varargout = {sf_5_to_99(V)};
- otherwise
- error([sf_ver(V) ' is just nuts']);
-end
-
-%=======================================================================
-case 'def_vol' % Returns default vol struct of given type
-%=======================================================================
-if nargin < 2
- ver = sf_current_ver;
-else
- ver = varargin{2};
- if sf_is_vol(ver), ver = sf_ver(ver); end
-end
-switch ver
- case '99'
- varargout = {sf_def_vol_99};
- case '5'
- varargout = {sf_def_vol_5};
- otherwise
- error([ver ' is unacceptable']);
-end
-return
-
-otherwise
- error([Action ' is beyond my range']);
-end
-return
-
-% Subfunctions
-
-function tf = sf_is_vol(V)
-% returns 1 if this may be a vol struct
-tf = 0;
-if ~isstruct(V), return, end
-if ~isfield(V, 'dim'), return, end
-tf = 1;
-return
-
-function sf_die_no_vol(V)
-if ~sf_is_vol(V)
- error('I really wanted a vol struct here');
-end
-return
-
-function [t, be, sw] = sf_type(V)
-% returns type number, big-endian flag, swapped flag
-plat_be = spm_platform('bigend');
-V = V(1);
-if sf_same_ver(V, '5') % spm5 vol type
- t = V.dt(1);
- be = V.dt(2);
- sw = xor(be, plat_be);
-elseif length(V.dim) > 3 % spm99 style type specifier
- t = V.dim(4);
- sw = (t > 256);
- if sw, t = t/256; end
- be = xor(plat_be, sw);
-else
- error('Could not get vol type');
-end
-return
-
-function V = sf_set_type(V, type_info)
-% set type for V from type_info
-switch sf_current_ver
- case '99'
- if ischar(type_info)
- if strcmp(type_info, 'float32'), type_info='float'; end
- if strcmp(type_info, 'float64'), type_info='double'; end
- type_info = spm_type(type_info);
- end
- case '5'
- if ischar(type_info)
- if strcmp(type_info, 'float'), type_info='float32'; end
- if strcmp(type_info, 'double'), type_info='float64'; end
- type_info = spm_type(type_info);
- end
- otherwise
- error(['Don''t like your type: ' sf_current_ver]);
-end
-switch sf_ver(V)
- case '99'
- V.dim(4) = type_info;
- case '5'
- V.dt(1) = type_info;
- otherwise
- error(['That''s a funny type: ' sf_ver(V)]);
-end
-return
-
-function ver = sf_ver(V)
-% returns version string ('99' or '5')
-if isfield(V, 'dt')
- ver = '5';
-else
- ver = '99';
-end
-return
-
-function ver = sf_current_ver;
-% returns version for spm_vol on path
-% spm2,99 spm_vol do not accept no args
-try
- V = spm_vol;
- ver = sf_ver(V);
-catch
- ver = '99';
-end
-return
-
-function V = sf_def_vol_99;
-V = struct(...
- 'fname', '',...
- 'dim', zeros(1,4), ...
- 'pinfo', [1 0 0]', ...
- 'mat', eye(4), ...
- 'n', [], ...
- 'descrip', '');
-return
-
-function V = sf_def_vol_5;
-V = struct('fname', '',...
- 'dim', zeros(1,3),...
- 'dt', [0 0],...
- 'pinfo', [1 0 0]',...
- 'mat', eye(4),...
- 'n', [],...
- 'descrip', '',...
- 'private',[]);
-return
-
-function Vo = sf_99_to_5(Vi)
-% converts spm99 vols to spm5 vols
-d = sf_def_vol_5;
-Vo = d; % in case Vi is empty
-is_n = isfield(Vi, 'n');
-for i = 1:numel(Vi)
- OV = Vi(i);
- NV = d;
- [t be] = sf_type(OV);
- NV.fname = OV.fname;
- NV.dim = OV.dim(1:3);
- NV.dt = [t be];
- NV.mat = OV.mat;
- NV.pinfo = OV.pinfo;
- NV.descrip = OV.descrip;
- if is_n, NV.n = [OV.n 1]; end
- Vo(i) = NV;
-end
-Vo = reshape(Vo, size(Vi));
-return
-
-function Vo = sf_5_to_99(Vi)
-% converts spm5 vols to spm99 vols
-d = sf_def_vol_99;
-Vo = d; % in case Vi is empty
-for i = 1:numel(Vi)
- OV = Vi(i);
- NV = d;
- [t be sw] = sf_type(OV);
- if sw, t = t * 256; end
- NV.fname = OV.fname;
- NV.dim = [OV.dim(1:3) t];
- NV.mat = OV.mat;
- NV.pinfo = OV.pinfo;
- NV.descrip = OV.descrip;
- NV.n = OV.n(1);
- Vo(i) = NV;
-end
-Vo = reshape(Vo, size(Vi));
-return
-
-function tf = sf_same_ver(V, ver)
-tf = strcmp(sf_ver(V), ver);
-return
diff --git a/lib/marsbar-0.44/marsbar.jpg b/lib/marsbar-0.44/marsbar.jpg
deleted file mode 100644
index b15ce7f..0000000
Binary files a/lib/marsbar-0.44/marsbar.jpg and /dev/null differ
diff --git a/lib/marsbar-0.44/marsbar.m b/lib/marsbar-0.44/marsbar.m
deleted file mode 100644
index 55cfbd0..0000000
--- a/lib/marsbar-0.44/marsbar.m
+++ /dev/null
@@ -1,1854 +0,0 @@
-function varargout=marsbar(varargin)
-% Startup, callback and utility routine for Marsbar
-%
-% MarsBaR: Marseille Boite a Regions d'interet
-% Marseille Region of Interest Toolbox
-%
-% MarsBaR (the collection of files listed by contents.m) is copyright under
-% the GNU general public license. Please see mars_licence.man for details.
-%
-% Marsbar written and copyright claimed by
-% Jean-Luc Anton, Matthew Brett, Jean-Baptiste Poline, Romain Valabregue
-%
-% Portions of the code rely heavily on (or are copied from) SPM
-% (http://www.fil.ion.ucl.ac.uk/spm), which is also released under the GNU
-% public licence. Many thanks the SPM authors: (John Ashburner, Karl Friston,
-% Andrew Holmes et al, and of course our own Jean-Baptiste).
-%
-% This software is MarsBaRWare. It is written in the hope that it is
-% helpful; if you find it so, please let us know by sending a Mars bar to:
-% The Jean-Luc confectionery collection, Centre IRMf, CHU La Timone, 264,
-% Rue Saint Pierre 13385 Marseille Cedex 05, France
-%
-% If you find that it actively hinders your work, do send an
-% elderly sardine to the same address.
-%
-% Please visit our friends at The Visible Mars Bar project:
-% http://totl.net/VisibleMars
-%
-% $Id$
-
-% Programmer's help
-% -----------------
-% For a list of the functions implemented here, try
-% grep "^case " marsbar.m
-
-% Marsbar version
-MBver = '0.44'; % First release for SPM12 and earlier
-
-% Various working variables in global variable structure
-global MARS;
-
-%-Format arguments
-%-----------------------------------------------------------------------
-if nargin == 0, Action='Startup'; else, Action = varargin{1}; end
-
-%=======================================================================
-switch lower(Action), case 'startup' %-Start marsbar
-%=======================================================================
-
-%-Turn on warning messages for debugging
-warning backtrace
-
-% splash screen once per session
-splashf = ~marsbar('is_started');
-
-% promote spm directory to top of path, read defaults
-marsbar('on');
-
-% Workaround for bizarre linux uigetfile problem: see
-% http://www.mathworks.com/support/bugreports/details.html?rp=259878
-% (or search Mathworks support for uigetfile linux
-mlv = version; mlv = str2num(mlv(1:3));
-if mlv >= 7 && strcmp(computer, 'GLNX86')
- if usejava('jvm')
- setappdata(0,'UseNativeSystemDialogs',false)
- else
- warning(['Matlab 7, linux, no java, please see FAQ for '...
- 'information on problems with file selection dialogs']);
- end
-end
-
-%-Open startup window, set window defaults
-%-----------------------------------------------------------------------
-S = get(0,'ScreenSize');
-if all(S==1), error('Can''t open any graphics windows...'), end
-PF = spm_platform('fonts');
-
-% Splash screen
-%------------------------------------------
-if splashf
- marsbar('splash');
-end
-
-%-Draw marsbar window
-%-----------------------------------------------------------------------
-Fmenu = marsbar('CreateMenuWin','off');
-
-%-Reveal windows
-%-----------------------------------------------------------------------
-set([Fmenu],'Visible','on')
-
-%=======================================================================
-case 'on' %-Initialise MarsBaR
-%=======================================================================
-
-% promote spm replacement directory
-% remove incorrect spm replacement directories
-mbpath = fileparts(which('marsbar.m'));
-spmV = mars_utils('spm_version');
-m_spm_paths = {'spm99', 'spm2', 'spm5'};
-v_path = lower(spmV);
-% spm8 is effectively identical to spm5 for marsbar
-switch v_path
-case {'spm8', 'spm12b', 'spm12'}
- v_path = 'spm5';
-end
-w_s = warning;
-warning off
-for p = m_spm_paths(~ismember(m_spm_paths, v_path))
- rmpath(fullfile(mbpath, char(p)))
-end
-warning(w_s)
-MARS.ADDPATHS = {fullfile(mbpath, v_path)};
-addpath(MARS.ADDPATHS{:}, '-begin');
-fprintf('MarsBaR analysis functions prepended to path\n');
-
-% check SPM defaults are loaded
-mars_veropts('defaults');
-
-% set up the ARMOIRE stuff
-% see marmoire help for details
-if isfield(MARS, 'ARMOIRE')
- o = MARS.ARMOIRE;
-else
- o = marmoire;
-end
-
-spm_design_filter = mars_veropts('design_filter_spec');
-filter_specs = {[spm_design_filter(1,:);...
- {'*_mdes.mat','MarsBaR: *_mdes.mat'}; ...
- spm_design_filter(2:end,:)], ...
- {'*_mdata.mat','MarsBaR data file (*_mdata.mat)'},...
- {'*_mres.mat', 'MarsBaR results (*_mres.mat)'}};
-
-o = add_if_absent(o, 'def_design', ...
- struct('default_file_name', 'untitled_mdes.mat',...
- 'filter_spec', {filter_specs{1}},...
- 'title', 'Default design',...
- 'set_action','mars_arm_call(''set_design'',o,item,old_o)'));
-o = add_if_absent(o, 'roi_data',...
- struct('default_file_name', 'untitled_mdata.mat',...
- 'filter_spec', {filter_specs{2}},...
- 'title', 'ROI data',...
- 'set_action','mars_arm_call(''set_data'',o,item,old_o)'));
-o = add_if_absent(o, 'est_design',...
- struct('default_file_name', 'untitled_mres.mat',...
- 'filter_spec', {filter_specs{3}},...
- 'title', 'MarsBaR estimated design',...
- 'set_action', 'mars_arm_call(''set_results'',o,item,old_o)'));
-MARS.ARMOIRE = o;
-
-% and workspace
-if ~isfield(MARS, 'WORKSPACE'), MARS.WORKSPACE = []; end
-
-% read any necessary defaults
-if ~mars_struct('isthere', MARS, 'OPTIONS')
- loadf = 1;
- MARS.OPTIONS = [];
-else
- loadf = 0;
-end
-[mbdefs sourcestr] = mars_options('Defaults');
-MARS.OPTIONS = mars_options('fill',MARS.OPTIONS, mbdefs);
-mars_options('put');
-if loadf
- fprintf('Loaded MarsBaR defaults from %s\n',sourcestr);
-end
-
-% Add very very odd fix for maroi object path problem
-% and matlab 7.1 (at least)
-% Don't ask why this is needed - I don't know.
-maroi;
-
-%=======================================================================
-case 'off' %-Unload MarsBaR
-%=======================================================================
-% res = marsbar('Off')
-%-----------------------------------------------------------------------
-varargout = {0};
-
-% leave if no signs of marsbar
-if ~marsbar('is_started'), return, end
-
-% save outstanding information
-btn = mars_arm('save_ui', 'all', struct('ync', 1, 'no_no_save', 1));
-if btn == -1, varargout = {-1}; return, end % cancel
-
-% remove marsbar added directories
-rmpath(MARS.ADDPATHS{:});
-fprintf('MarsBaR analysis functions removed from path\n');
-
-%=======================================================================
-case 'quit' %-Quit MarsBaR window
-%=======================================================================
-% marsbar('Quit')
-%-----------------------------------------------------------------------
-
-% do path stuff, save any pending changes
-if marsbar('off') == -1, return, end % check for cancel
-
-% leave if no signs of MARSBAR
-if ~marsbar('is_started'), return, end
-
-%-Close any existing 'MarsBaR' 'Tag'ged windows
-delete(spm_figure('FindWin','MarsBaR'))
-fprintf('Au revoir...\n\n')
-
-%=======================================================================
-case 'is_started' %-returns 1 if MarsBaR GUI has been initialized
-%=======================================================================
-% tf = marsbar('is_started')
-varargout = {~isempty(MARS)};
-
-%=======================================================================
-case 'cfgfile' %-finds MarsBaR cfg file
-%=======================================================================
-% cfgfn = marsbar('cfgfile')
-cfgfile = 'marsbarcfg.mat';
-varargout = {which(cfgfile), cfgfile};
-
-%=======================================================================
-case 'createmenuwin' %-Draw MarsBaR menu window
-%=======================================================================
-% Fmenu = marsbar('CreateMenuWin',Vis)
-if nargin<2, Vis='on'; else, Vis=varargin{2}; end
-
-%-Close any existing 'MarsBaR' 'Tag'ged windows
-delete(spm_figure('FindWin','MarsBaR'))
-
-% Version etc info
-[MBver,MBc] = marsbar('Ver');
-
-%-Get size and scalings and create Menu window
-%-----------------------------------------------------------------------
-WS = spm('WinScale'); %-Window scaling factors
-FS = spm('FontSizes'); %-Scaled font sizes
-PF = spm_platform('fonts'); %-Font names (for this platform)
-Rect = [50 600 300 275]; %-Raw size menu window rectangle
-bno = 6; bgno = bno+1;
-bgapr = 0.25;
-bh = Rect(4) / (bno + bgno*bgapr); % Button height
-gh = bh * bgapr; % Button gap
-by = fliplr(cumsum([0 ones(1, bno-1)*(bh+gh)])+gh);
-bx = Rect(3)*0.1;
-bw = Rect(3)*0.8;
-Fmenu = figure('IntegerHandle','off',...
- 'Name',sprintf('%s',MBc),...
- 'NumberTitle','off',...
- 'Tag','MarsBaR',...
- 'Position',Rect.*WS,...
- 'Resize','off',...
- 'Color',[1 1 1]*.8,...
- 'UserData',struct('MBver',MBver,'MBc',MBc),...
- 'MenuBar','none',...
- 'DefaultTextFontName',PF.helvetica,...
- 'DefaultTextFontSize',FS(12),...
- 'DefaultUicontrolFontName',PF.helvetica,...
- 'DefaultUicontrolFontSize',FS(12),...
- 'DefaultUicontrolInterruptible','on',...
- 'Renderer','painters',...
- 'Visible','off');
-
-%-Objects with Callbacks - main MarsBaR routines
-%=======================================================================
-
-funcs = {'mars_display_roi(''display'');',...
- 'mars_blob_ui;',...
- 'marsbar(''buildroi'');',...
- 'marsbar(''transform'');',...
- 'marsbar(''import_rois'');',...
- 'marsbar(''export_rois'');'};
-
-uicontrol(Fmenu,'Style','PopUp',...
- 'String',['ROI definition',...
- '|View...'...
- '|Get SPM cluster(s)...'...
- '|Build...',...
- '|Transform...',...
- '|Import...',...
- '|Export...'],...
- 'Position',[bx by(1) bw bh].*WS,...
- 'ToolTipString','Draw / build / combine ROIs...',...
- 'CallBack','spm(''PopUpCB'',gcbo)',...
- 'UserData',funcs);
-
-% Design menu
-fw_st = 'struct(''force'', 1, ''warn_empty'', 1)';
-funcs = {...
- 'marsbar(''make_design'', ''pet'');',...
- 'marsbar(''make_design'', ''fmri'');',...
- 'marsbar(''make_design'', ''basic'');',...
- 'marsbar(''design_report'')',...
- 'marsbar(''design_filter'')',...
- 'marsbar(''add_images'')',...
- 'marsbar(''edit_filter'')',...
- 'marsbar(''check_images'')',...
- 'marsbar(''list_images'')',...
- 'marsbar(''ana_cd'')',...
- 'marsbar(''ana_desmooth'')',...
- 'marsbar(''def_from_est'')',...
- 'marsbar(''set_def'')',...
- ['mars_arm(''save_ui'', ''def_design'', ' fw_st ');'],...
- 'mars_arm(''show_summary'', ''def_design'')'};
-
-uicontrol(Fmenu,'Style','PopUp',...
- 'String',['Design...'...
- '|PET models',...
- '|FMRI models',...
- '|Basic models',...
- '|Explore',...
- '|Frequencies (event+data)',...
- '|Add images to FMRI design',...
- '|Add/edit filter for FMRI design',...
- '|Check image names in design',...
- '|List image names to console',...
- '|Change design path to images',...
- '|Convert to unsmoothed',...
- '|Set design from estimated',...
- '|Set design from file',...
- '|Save design to file',...
- '|Show default design summary'],...
- 'Position',[bx by(2) bw bh].*WS,...
- 'ToolTipString','Set/specify design...',...
- 'CallBack','spm(''PopUpCB'',gcbo)',...
- 'UserData',funcs);
-
-% Data menu
-funcs = {'marsbar(''extract_data'', ''default'');',...
- 'marsbar(''extract_data'', ''full'');',...
- 'marsbar(''set_defregion'');',...
- 'marsbar(''plot_data'', ''raw'');',...
- 'marsbar(''plot_data'', ''full'');',...
- 'marsbar(''import_data'');',...
- 'marsbar(''export_data'');',...
- 'marsbar(''split_data'');',...
- 'marsbar(''join_data'');',...
- 'mars_arm(''set_ui'', ''roi_data'');',...
- ['mars_arm(''save_ui'', ''roi_data'', ' fw_st ');'],...
- 'mars_arm(''show_summary'', ''roi_data'')'};
-
-uicontrol(Fmenu,'Style','PopUp',...
- 'String',['Data...'...
- '|Extract ROI data (default)',...
- '|Extract ROI data (full options)',...
- '|Default region...',...
- '|Plot data (simple)',...
- '|Plot data (full)',...
- '|Import data',...
- '|Export data',...
- '|Split regions into files',...
- '|Merge data files',...
- '|Set data from file',...
- '|Save data to file',...
- '|Show data summary'],...
- 'Position',[bx by(3) bw bh].*WS,...
- 'ToolTipString','Extract/set/save data...',...
- 'CallBack','spm(''PopUpCB'',gcbo)',...
- 'UserData',funcs);
-
-% results menu
-funcs = {...
- 'marsbar(''estimate'');',...
- 'marsbar(''merge_contrasts'');',...
- 'marsbar(''refresh_contrasts'');',...
- 'marsbar(''add_trial_f'');',...
- 'marsbar(''set_defcon'');',...
- 'marsbar(''set_defregion'');',...
- 'marsbar(''plot_residuals'');',...
- 'marsbar(''spm_graph'');',...
- 'marsbar(''stat_table'');',...
- 'marsbar(''signal_change'');',...
- 'marsbar(''fitted_events'');',...
- 'marsbar(''fir_events'');',...
- 'marsbar(''add_events_by_name'');',...
- 'marsbar(''set_results'');',...
- ['mars_arm(''save_ui'', ''est_design'', ' fw_st ');'],...
- 'mars_arm(''show_summary'', ''est_design'')'};
-
-uicontrol(Fmenu,'Style','PopUp',...
- 'String',['Results...'...
- '|Estimate results',...
- '|Import contrasts',...
- '|Refresh F contrasts',...
- '|Add trial-specific F',...
- '|Default contrast...',...
- '|Default region...',...
- '|Plot residuals',...
- '|MarsBaR SPM graph',...
- '|Statistic table',...
- '|% signal change',...
- '|Fitted event time course',...
- '|FIR event time course',...
- '|Add event types by name',...
- '|Set results from file',...
- '|Save results to file',...
- '|Show estimated design summary'],...
- 'Position',[bx by(4) bw bh].*WS,...
- 'ToolTipString','Write/display contrasts...',...
- 'CallBack','spm(''PopUpCB'',gcbo)',...
- 'UserData',funcs);
-
-% options menu
-funcs = {['global MARS; '...
- 'MARS.OPTIONS=mars_options(''edit'');mars_options(''put'');'],...
- ['global MARS; '...
- '[MARS.OPTIONS str]=mars_options(''defaults'');' ...
- 'mars_options(''put''); '...
- 'fprintf(''Defaults loaded from %s\n'', str)'],...
- ['global MARS; '...
- '[MARS.OPTIONS str]=mars_options(''basedefaults'');' ...
- 'mars_options(''put''); '...
- 'fprintf(''Defaults loaded from %s\n'', str)'],...
- ['global MARS; '...
- 'MARS.OPTIONS=mars_options(''load'');mars_options(''put'');'],...
- 'mars_options(''save'');'...
- };
-
-uicontrol(Fmenu,'Style','PopUp',...
- 'String',['Options...'...
- '|Edit options'...
- '|Restore defaults'...
- '|Base defaults',...
- '|Set options from file'...
- '|Save options to file'],...
- 'Position',[bx by(5) bw bh].*WS,...
- 'ToolTipString','Load/save/edit MarsBaR options',...
- 'CallBack','spm(''PopUpCB'',gcbo)',...
- 'UserData',funcs);
-
-% quit button
-uicontrol(Fmenu,'String','Quit',...
- 'Position',[bx by(6) bw bh].*WS,...
- 'ToolTipString','exit MarsBaR',...
- 'ForeGroundColor','r',...
- 'Interruptible','off',...
- 'CallBack','marsbar(''Quit'')');
-
-% Set quit action if MarsBaR window is closed
-%-----------------------------------------------------------------------
-set(Fmenu,'CloseRequestFcn','marsbar(''Quit'')')
-set(Fmenu,'Visible',Vis)
-
-varargout = {Fmenu};
-
-%=======================================================================
-case {'ver', 'version'} %-Return MarsBaR version
-%=======================================================================
-% [v [,banner]] = marsbar('Ver')
-%-----------------------------------------------------------------------
-varargout = {MBver, 'MarsBaR - Marseille ROI toolbox'};
-
-%=======================================================================
-case 'splash' %-show splash screen
-%=======================================================================
-% marsbar('splash')
-%-----------------------------------------------------------------------
-% Shows splash screen
-WS = spm('WinScale'); %-Window scaling factors
-[X,map] = imread('marsbar.jpg');
-aspct = size(X,1) / size(X,2);
-ww = 400;
-srect = [200 300 ww ww*aspct] .* WS; %-Scaled size splash rectangle
-h = figure('visible','off',...
- 'menubar','none',...
- 'numbertitle','off',...
- 'name','Welcome to MarsBaR',...
- 'pos',srect);
-im = image(X);
-colormap(map);
-ax = get(im, 'Parent');
-axis off;
-axis image;
-axis tight;
-set(ax,'plotboxaspectratiomode','manual',...
- 'unit','pixels',...
- 'pos',[0 0 srect(3:4)]);
-set(h,'visible','on');
-pause(2);
-close(h);
-
-%=======================================================================
-case 'buildroi' %-build and save ROI
-%=======================================================================
-% o = marsbar('buildroi')
-%-----------------------------------------------------------------------
-% build and save object
-varargout = {[]};
-o = mars_build_roi;
-if ~isempty(o)
- varargout = {marsbar('saveroi', o)};
-end
-
-%=======================================================================
-case 'transform' %-transform ROIs
-%=======================================================================
-% marsbar('transform')
-%-----------------------------------------------------------------------
-marsbar('mars_menu', 'Transform ROI', 'Transform:', ...
- {{'combinerois'},{'flip_lr'}},...
- {'Combine ROIs','Flip L/R'});
-
-%=======================================================================
-case 'import_rois' %- import ROIs!
-%=======================================================================
-% marsbar('import_rois')
-%-----------------------------------------------------------------------
-
-marsbar('mars_menu', 'Import ROIs', 'Import ROIs from:',...
- {{'img2rois','c'},...
- {'img2rois','i'}},...
- {'cluster image',...
- 'number labelled ROI image'});
-
-%=======================================================================
-case 'export_rois' %-export ROIs
-%=======================================================================
-% marsbar('export_rois')
-%-----------------------------------------------------------------------
-
-marsbar('mars_menu', 'Export ROI(s)', 'Export ROI(s) to:',...
- {{'roi_as_image'},...
- {'rois2img', 'c'},...
- {'rois2img', 'i'}},...
- {'image', 'cluster image',...
- 'number labelled ROI image'});
-
-%=======================================================================
-case 'img2rois' %-import ROI image
-%=======================================================================
-% marsbar('img2rois', roi_type)
-%-----------------------------------------------------------------------
-
-if nargin < 2
- roi_type = 'c'; % default is cluster image
-else
- roi_type = varargin{2};
-end
-mars_img2rois('','','',roi_type);
-
-%=======================================================================
-case 'rois2img' %-export ROI image
-%=======================================================================
-% marsbar('roi2img', roi_type)
-%-----------------------------------------------------------------------
-
-if nargin < 2
- roi_type = 'c'; % default is cluster image
-else
- roi_type = varargin{2};
-end
-mars_rois2img('','','',roi_type);
-
-%=======================================================================
-case 'saveroi' %-save ROI
-%=======================================================================
-% o = marsbar('saveroi', obj, flags)
-%-----------------------------------------------------------------------
-% flags will usually be empty, or one or more characters from
-% 'n' do not ask for label or description
-% 'l' use label to make filename, rather than source field
-
-if nargin < 2 || isempty(varargin{2})
- return
-end
-if nargin < 3
- flags = '';
-else
- flags = varargin{3};
-end
-if isempty(flags), flags = ' '; end
-o = varargin{2};
-varargout = {[]};
-
-% Label, description
-if ~any(flags=='n')
- d = spm_input('Description of ROI', '+1', 's', descrip(o));
- o = descrip(o,d);
- l = spm_input('Label for ROI', '+1', 's', label(o));
- o = label(o,l);
-end
-
-fn = source(o);
-if isempty(fn) || any(flags=='l')
- fn = maroi('filename', mars_utils('str2fname', label(o)));
-end
-
-f_f = ['*' maroi('classdata', 'fileend')];
-[f p] = mars_uifile('put', ...
- {f_f, ['ROI files (' f_f ')']},...
- 'File name for ROI', fn);
-if any(f~=0)
- roi_fname = maroi('filename', fullfile(p, f));
- try
- varargout = {saveroi(o, roi_fname)};
- catch
- warning([lasterr ' Error saving ROI to file ' roi_fname])
- end
-end
-
-%=======================================================================
-case 'combinerois' %-combine ROIs
-%=======================================================================
-% marsbar('combinerois')
-%-----------------------------------------------------------------------
-roilist = spm_get(Inf,['*' maroi('classdata', 'fileend')], ...
- 'Select ROI(s) to combine');
-if isempty(roilist)
- return
-end
-roilist = maroi('load_cell', roilist);
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Combine ROIs');
-spm_input('(r1 & r2) & ~r3',1,'d','Example function:');
-func = spm_input('Function to combine ROIs', '+1', 's', '');
-if isempty(func), retnrn, end
-for i = 1:length(roilist)
- eval(sprintf('r%d = roilist{%d};', i, i));
-end
-try
- eval(['o=' func ';']);
-catch
- warning(['Hmm, probem with function ' func ': ' lasterr]);
- return
-end
-if isempty(o)
- warning('Empty object resulted');
- return
-end
-if is_empty_roi(o)
- warning('No volume resulted for ROI');
- return
-end
-
-% save ROI
-if isa(o, 'maroi')
- o = label(o, func);
- o = marsbar('saveroi', o);
- if ~isempty(o)
- fprintf('\nSaved ROI as %s\n', source(o));
- end
-else
- warning(sprintf('\nNo ROI resulted from function %s...\n', func));
-end
-
-%=======================================================================
-case 'flip_lr' %-flip roi L<->R
-%=======================================================================
-% marsbar('flip_lr')
-%-----------------------------------------------------------------------
-roilist = spm_get([0 1],['*' maroi('classdata', 'fileend')],...
- 'Select ROI to flip L/R');
-if isempty(roilist)
- return
-end
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Flip ROI L<->R');
-o = maroi('load', roilist);
-o = flip_lr(o);
-
-% save ROI
-o = marsbar('saveroi', o, 'l');
-fprintf('\nSaved ROI as %s\n', source(o));
-
-%=======================================================================
-case 'show_volume' %- shows ROI volume in mm to console
-%=======================================================================
-% marsbar('show_volume')
-%-----------------------------------------------------------------------
-roi_names = spm_get([0 Inf], '*roi.mat', 'Select ROIs tp get volume');
-if isempty(roi_names),return,end
-rois = maroi('load_cell', roi_names);
-for i = 1:size(rois, 1)
- fprintf('Volume of %s: %6.2f\n', source(rois{i}), volume(rois{i}));
-end
-return
-
-%=======================================================================
-case 'roi_as_image' %- writes ROI as image
-%=======================================================================
-% marsbar('roi_as_image')
-%-----------------------------------------------------------------------
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Write ROI to image');
-
-roi = spm_get([0 1], '*roi.mat', 'Select ROI to write');
-if isempty(roi),return,end
-[pn fn ext] = fileparts(roi);
-roi = maroi('load', roi);
-
-% space of object
-spopts = {'spacebase','image'};
-splabs = {'Base space for ROIs','From image'};
-if has_space(roi)
- spopts = {spopts{:} 'native'};
- splabs = {splabs{:} 'ROI native space'};
-end
-spo = spm_input('Space for ROI image', '+1', 'm',splabs,...
- spopts, 1);
-switch char(spo)
- case 'spacebase'
- sp = maroi('classdata', 'spacebase');
- case 'image'
- img = spm_get([0 1], mars_veropts('get_img_ext'), 'Image defining space');
- if isempty(img),return,end
- sp = mars_space(img);
- case 'native'
- sp = [];
-end
-
-% remove ROI file ending
-gend = maroi('classdata', 'fileend');
-lg = length(gend);
-f2 = [fn ext];
-if length(f2)>=lg && strcmp(gend, [f2(end - lg +1 : end)])
- f2 = f2(1:end-lg);
-else
- f2 = fn;
-end
-
-fname = mars_utils('get_img_name', f2);
-if isempty(fname), return, end
-save_as_image(roi, fname, sp);
-fprintf('Saved ROI as %s\n',fname);
-
-%=======================================================================
-case 'attach_image' %- attaches image to ROI(s)
-%=======================================================================
-% marsbar('attach_image' [,img [,roilist]])
-%-----------------------------------------------------------------------
-if nargin < 2
- V = spm_get([0 1], mars_veropts('get_img_ext'), 'Image to attach');
- if isempty(V), return, end
-else
- V = varargin{1};
-end
-if nargin < 3
- rois = spm_get([0 Inf], ['*' maroi('classdata', 'fileend')], ...
- 'Select ROIs to attach image to');
-
- if isempty(rois), return, end
-else
- rois = varargin{2};
-end
-if ischar(V), V = spm_vol(V); end
-for i = 1:size(rois, 1)
- n = deblank(rois(i,:));
- try
- r = maroi('load', n);
- catch
- r = []
- if ~strmatch(lasterr, 'Cant map image file.')
- error(lasterr);
- end
- end
- if isempty(r)
- continue
- end
- if ~isa(r, 'maroi_image')
- fprintf('ROI %s is not an image ROI - ignored\n', n);
- continue
- end
-
- r = vol(r, V);
- saveroi(r, n);
- fprintf('Saved ROI %s, attached to image %s\n',...
- n, V.fname)
-end
-return
-
-%=======================================================================
-case 'make_design' %-runs design creation routines
-%=======================================================================
-% marsbar('make_design', des_type)
-%-----------------------------------------------------------------------
-if nargin < 2
- des_type = 'basic';
-else
- des_type = varargin{2};
-end
-if sf_prev_save('def_design') == -1, return, end
-D = ui_build(mars_veropts('default_design'), des_type);
-mars_arm('set', 'def_design', D);
-marsbar('design_report');
-
-%=======================================================================
-case 'list_images' %-lists image files in SPM design
-%=======================================================================
-% marsbar('list_images')
-%-----------------------------------------------------------------------
-marsD = mars_arm('get', 'def_design');
-if isempty(marsD), return, end;
-if has_images(marsD)
- P = image_names(marsD);
- strvcat(P{:})
-else
- disp('Design does not contain images');
-end
-
-%=======================================================================
-case 'check_images' %-checks image files in SPM design
-%=======================================================================
-% marsbar('check_images')
-%-----------------------------------------------------------------------
-marsD = mars_arm('get', 'def_design');
-if isempty(marsD), return, end;
-if ~has_images(marsD)
- disp('Design does not contain images');
- return
-end
-
-P = image_names(marsD);
-P = strvcat(P{:});
-ok_f = 1;
-for i = 1:size(P, 1)
- fname = deblank(P(i,:));
- if ~exist(fname, 'file');
- fprintf('Image %d: %s does not exist\n', i, fname);
- ok_f = 0;
- end
-end
-if ok_f
- disp('All images in design appear to exist');
-end
-
-%=======================================================================
-case 'ana_cd' %-changes path to files in SPM design
-%=======================================================================
-% marsbar('ana_cd')
-%-----------------------------------------------------------------------
-marsD = mars_arm('get', 'def_design');
-if isempty(marsD), return, end;
-
-% Setup input window
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Change image path in design', 0);
-
-% root path shown in output window
-P = image_names(marsD);
-P = strvcat(P{:});
-root_names = spm_str_manip(P, 'H');
-spm_input(deblank(root_names(1,:)),1,'d','Common path is:');
-
-% new root
-newpath = spm_get([-1 0], '', 'New directory root for files');
-if isempty(newpath), return, end
-
-% do
-marsD = cd_images(marsD, newpath);
-mars_arm('set', 'def_design', marsD);
-
-%=======================================================================
-case 'ana_desmooth' %-makes new SPM design for unsmoothed data
-%=======================================================================
-% marsbar('ana_desmooth')
-%-----------------------------------------------------------------------
-marsD = mars_arm('get', 'def_design');
-if isempty(marsD), return, end;
-marsD = prefix_images(marsD, 'remove', 's');
-mars_arm('set', 'def_design', marsD);
-disp('Done');
-
-%=======================================================================
-case 'add_images' %-add images to FMRI design
-%=======================================================================
-% marsbar('add_images')
-%-----------------------------------------------------------------------
-marsD = mars_arm('get', 'def_design');
-if isempty(marsD), return, end
-if ~is_fmri(marsD), return, end
-marsD = fill(marsD, {'images'});
-mars_arm('update', 'def_design', marsD);
-mars_arm('set_param', 'def_design', 'file_name', '');
-mars_arm('show_summary', 'def_design');
-
-%=======================================================================
-case 'edit_filter' %-add / edit filter for FMRI design
-%=======================================================================
-% marsbar('edit_filter')
-%-----------------------------------------------------------------------
-marsD = mars_arm('get', 'def_design');
-if isempty(marsD), return, end
-if ~is_fmri(marsD), return, end
-tmp = {'filter'};
-if ~strcmp(type(marsD), 'SPM99'), tmp = [tmp {'autocorr'}]; end
-marsD = fill(marsD, tmp);
-mars_arm('update', 'def_design', marsD);
-mars_arm('set_param', 'def_design', 'file_name', '');
-mars_arm('show_summary', 'def_design');
-
-%=======================================================================
-case 'def_from_est' %-sets default design from estimated design
-%=======================================================================
-% marsbar('def_from_est')
-%-----------------------------------------------------------------------
-marsE = mars_arm('get', 'est_design');
-if isempty(marsE), return, end;
-errf = mars_arm('set', 'def_design', marsE);
-if ~errf, marsbar('design_report'); end
-
-%=======================================================================
-case 'set_def' %-sets default design using GUI
-%=======================================================================
-% marsbar('set_def')
-%-----------------------------------------------------------------------
-if mars_arm('set_ui', 'def_design'), return, end
-marsbar('design_report');
-
-%=======================================================================
-case 'design_report' %-does explore design thing
-%=======================================================================
-% marsbar('design_report')
-%-----------------------------------------------------------------------
-marsD = mars_arm('get', 'def_design');
-if isempty(marsD), return, end;
-spm('FnUIsetup','Explore design', 0);
-
-fprintf('%-40s: ','Design reporting');
-ui_report(marsD, 'DesMtx');
-ui_report(marsD, 'DesRepUI');
-fprintf('%30s\n','...done');
-
-%=======================================================================
-case 'design_filter' %-shows FFT of data and design
-%=======================================================================
-% marsbar('design_filter')
-%-----------------------------------------------------------------------
-marsD = mars_arm('get', 'def_design');
-if isempty(marsD), return, end;
-marsY = mars_arm('get', 'roi_data');
-if isempty(marsY), return, end
-% If the design and data didn't match, the design will have been cleared
-if mars_arm('isempty', 'def_design')
- error('Need data and design with matching number of rows');
-end
-ui_ft_design_data(marsD, marsY);
-
-%=======================================================================
-case 'extract_data' % gets data maybe using design
-%=======================================================================
-% marsY = marsbar('extract_data'[, roi_list [, 'full'|'default']]);
-
-if nargin < 2
- etype = 'default';
-else
- etype = varargin{2};
-end
-if nargin < 3
- roi_list = '';
-else
- roi_list = varargin{3};
-end
-
-varargout = {[]};
-
-% Check for save of current data
-if sf_prev_save('roi_data') == -1, return, end
-if isempty(roi_list)
- roi_list = spm_get(Inf,'*roi.mat','Select ROI(s) to extract data for');
-end
-if isempty(roi_list), return, end
-
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Extract data', 0);
-
-if strcmp(etype, 'default')
- marsD = mars_arm('get', 'def_design');
- if isempty(marsD), return, end;
- if ~has_images(marsD),
- marsD = fill(marsD, 'images');
- mars_arm('update', 'def_design', marsD);
- end
- VY = marsD;
- row = block_rows(marsD);
-else % full options extraction
- % question for design
-
- marsD = [];
- if spm_input('Use SPM design?', '+1', 'b', 'Yes|No', [1 0], 1)
- marsD = mars_arm('get', 'def_design');
- if ~has_images(marsD),
- marsD = fill(marsD, 'images');
- mars_arm('update', 'def_design', marsD);
- end
- end
- [VY row] = mars_image_scaling(marsD);
-end
-
-% Summary function
-sumfunc = sf_get_sumfunc(MARS.OPTIONS.statistics.sumfunc);
-
-% ROI names to objects
-o = maroi('load_cell', roi_list);
-
-% Do data extraction
-marsY = get_marsy(o{:}, VY, sumfunc, 'v');
-marsY = block_rows(marsY, row);
-if ~n_regions(marsY)
- msgbox('No data returned','Data extraction', 'warn');
- return
-end
-
-% set into armoire, and display
-mars_arm('set', 'roi_data', marsY);
-mars_arm('show_summary', 'roi_data');
-
-varargout = {marsY};
-
-%=======================================================================
-case 'plot_data' %- it plots data!
-%=======================================================================
-% marsbar('plot_data', p_type)
-%-----------------------------------------------------------------------
-% p_type - plot type: one of 'raw','acf','fft','all' or 'full'
-% where 'full' results in a options to filter and choice of plot
-
-if nargin < 2
- p_type = [];
-else
- p_type = varargin{2};
-end
-if isempty(p_type)
- p_type = 'full';
-end
-marsY = mars_arm('get', 'roi_data');
-if isempty(marsY), return, end
-
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Plot data', 0);
-if strcmp(p_type, 'full')
- if ~mars_arm('isempty', 'def_design')
- D = mars_arm('get', 'def_design');
- if isempty(D), return, end
- if has_filter(D)
- if spm_input('Use design filter?', '+1', 'y/n', [1 0], 1)
- flags = {};
- if has_whitener(D)
- if ~spm_input('Use whitening filter?', '+1', 'y/n', [1 0], 1)
- flags = 'no_whitening';
- end
- end
- marsY = apply_filter(D, marsY, flags);
- end
- end
- end
- p_type = char(spm_input('Type of plot', '+1', 'm', ...
- 'All|Time course|FFT|ACF', ...
- {'all','raw','fft','acf'}));
-end
-
-ns = region_name(marsY);
-rno = mars_struct('getifthere', MARS, 'WORKSPACE', 'default_region');
-if ~isempty(rno)
- fprintf('Using default region: %s\n', ns{rno});
-end
-ui_plot(marsY, struct('types', p_type, 'r_nos', rno));
-
-%=======================================================================
-case 'import_data' %- it imports data
-%=======================================================================
-% marsbar('import_data')
-%-----------------------------------------------------------------------
-
-% Check for save of current dataa
-if sf_prev_save('roi_data') == -1, return, end
-
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Import data', 0);
-
-r_f = spm_input('Import what?', '+1', 'm', ...
- ['Sample time courses for one region'...
- '|Summary time course(s) for region(s)'],...
- [1 0], 2);
-
-Ls = ['Matlab workspace' ...
- '|Text file',...
- '|Lotus spreadsheet'];,...
-Os = {'matlab','txt','wk1'};
-
-if ~isempty(which('xlsread'))
- Ls = [Ls '|Excel spreadsheet'];
- Os = [Os {'xls'}];
-end
-
-src = spm_input('Import fron?', '+1', 'm', Ls, Os, 1);
-
-switch src{1}
- case 'matlab'
- Y = spm_input('Matlab expression', '+1', 'e');
- fn = 'Matlab input';
- pn_fn = lower(fn);
- case 'txt'
- [fn, pn] = mars_uifile('get', ...
- {'*.txt;*.dat;*.csv', 'Text files (*.txt, *.dat, *.csv)'; ...
- '*.*', 'All Files (*.*)'}, ...
- 'Select a text file');
- if isequal(fn,0), return, end
- pn_fn = fullfile(pn, fn);
- Y = spm_load(pn_fn);
- case 'wk1'
- [fn, pn] = mars_uifile('get', ...
- {'*.wk1', 'Lotus spreadsheet files (*.wk1)'; ...
- '*.*', 'All Files (*.*)'}, ...
- 'Select a Lotus file');
- if isequal(fn,0), return, end
- pn_fn = fullfile(pn, fn);
- Y = wk1read(pn_fn);
- case 'xls'
- [fn, pn] = mars_uifile('get', ...
- {'*.xls', 'Excel spreadsheet files (*.xls)'; ...
- '*.*', 'All Files (*.*)'}, ...
- 'Select an Excel file');
- if isequal(fn,0), return, end
- pn_fn = fullfile(pn, fn);
- Y = xlsread(pn_fn);
- otherwise
- error('Strange source');
-end
-if r_f % region data
- s_f = sf_get_sumfunc(MARS.OPTIONS.statistics.sumfunc);
- r_st = struct('name', fn,...
- 'descrip', pn_fn);
- s_st = struct('descrip', ['Region data loaded from ' pn_fn],...
- 'sumfunc', s_f);
- marsY = marsy({Y},r_st, s_st);
- pref = ''; % Region name prefix not used, as names are set
-else % summary data
- s_st = struct('descrip', ['Summary data loaded from ' pn_fn]);
- marsY = marsy(Y, '', s_st);
- pref = spm_input('Prefix for region names', '+1', 's', [fn '_']);
-end
-
-% Names
-stop_f = 0;
-ns = region_name(marsY, [], [], pref);
-spm_input('Return name with spaces only to abort entry','+1','d');
-for r = 1:length(ns)
- ns{r} = spm_input(...
- sprintf('Name for region %d', r),...
- '+1', 's', ns{r});
- if all(ns{r}==' '), stop_f = 1; break, end
-end
-if ~stop_f
- marsY = region_name(marsY, [], ns);
-end
-
-mars_arm('set', 'roi_data', marsY);
-mars_arm('show_summary', 'roi_data');
-disp(['Data loaded from ' pn_fn]);
-
-%=======================================================================
-case 'export_data' %- exports
-%=======================================================================
-% marsbar('export_data')
-%-----------------------------------------------------------------------
-marsY = mars_arm('get', 'roi_data');
-if isempty(marsY), return, end
-
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Export data', 0);
-
-r_f = spm_input('Export what?', '+1', 'm', ...
- ['Sample time courses for one region'...
- '|Summary time course(s) for region(s)'],...
- [1 0], 2);
-
-Ls = ['Matlab workspace' ...
- '|Text file',...
- '|Lotus spreadsheet'];,...
-Os = {'matlab','txt','wk1'};
-
-if ~isempty(which('xlswrite'))
- xls_write = 1;
-elseif ~isempty(which('xlswrite5'))
- xls_write = 2;
-else
- xls_write = 0;
-end
-
-if xls_write
- Ls = [Ls '|Excel spreadsheet'];
- Os = [Os {'xls'}];
-end
-
-src = spm_input('Export to?', '+1', 'm', Ls, Os, 1);
-
-if r_f
- rno = marsbar('get_region', region_name(marsY));
- Y = region_data(marsY, rno);
- Y = Y{1};
-else
- Y = summary_data(marsY);
-end
-
-switch src{1}
- case 'matlab'
- str = '';
- while ~mars_utils('is_valid_varname', str)
- str = spm_input('Matlab variable name', '+1', 's');
- if isempty(str), return, end
- end
- assignin('base', str, Y);
- fn = ['Matlab variable: ' str];
- case 'txt'
- [fn, pn] = mars_uifile('put', ...
- {'*.txt;*.dat;*.csv', 'Text files (*.txt, *.dat, *.csv)'; ...
- '*.*', 'All Files (*.*)'}, ...
- 'Text file name');
- if isequal(fn,0), return, end
- save(fullfile(pn,fn), 'Y', '-ascii');
- case 'wk1'
- [fn, pn] = mars_uifile('put', ...
- {'*.wk1', 'Lotus spreadsheet files (*.wk1)'; ...
- '*.*', 'All Files (*.*)'}, ...
- 'Lotus spreadsheet file');
- if isequal(fn,0), return, end
- wk1write(fullfile(pn,fn), Y);
- case 'xls'
- [fn, pn] = mars_uifile('put', ...
- {'*.xls', 'Excel spreadsheet files (*.xls)'; ...
- '*.*', 'All Files (*.*)'}, ...
- 'Excel spreadsheet file');
- if isequal(fn,0), return, end
- if xls_write == 1
- xlswrite(fullfile(pn,fn), Y);
- else
- xlswrite5(fullfile(pn,fn), Y);
- end
- otherwise
- error('Strange source');
-end
-disp(['Data saved to ' fn]);
-
-%=======================================================================
-case 'split_data' %- splits data into one file per region
-%=======================================================================
-% marsbar('split_data')
-%-----------------------------------------------------------------------
-marsY = mars_arm('get', 'roi_data');
-if isempty(marsY), return, end
-if n_regions(marsY) == 1
- disp('Only one region in ROI data');
- return
-end
-
-% Setup input window
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Split regions to files', 0);
-
-d = spm_get([-1 0], '', 'New directory root for files');
-if isempty(d), return, end
-
-def_f = summary_descrip(marsY);
-if ~isempty(def_f)
- def_f = mars_utils('str2fname', def_f);
-end
-f = spm_input('Root filename for regions', '+1', 's', def_f);
-f = mars_utils('str2fname', f);
-mYarr = split(marsY);
-for i = 1:length(mYarr)
- fname = fullfile(d, sprintf('%s_region_%d_mdata.mat', f, i));
- savestruct(mYarr(i), fname);
- fprintf('Saved region %d as %s\n', i, fname);
-end
-
-%=======================================================================
-case 'join_data' %- joins many data files into one object
-%=======================================================================
-% marsbar('join_data')
-%-----------------------------------------------------------------------
-
-% Check save of current data first
-if sf_prev_save('roi_data') == -1, return, end
-
-P = spm_get([0 Inf], '*_mdata.mat', 'Select data files to join');
-
-if isempty(P), return, end
-for i = 1:size(P,1)
- d_o{i} = marsy(deblank(P(i,:)));
-end
-marsY = join(d_o{:});
-mars_arm('set', 'roi_data', marsY);
-mars_arm('show_summary', 'roi_data');
-disp(P)
-disp('Files merged and set as current data')
-
-%=======================================================================
-case 'estimate' %-Estimates design
-%=======================================================================
-% marsbar('estimate')
-%-----------------------------------------------------------------------
-% Sequence is bit complex here, as setting the design may clear the ROI
-% data, and setting the ROI data may clear the default design, if they
-% have different numbers of rows
-marsD= mars_arm('get', 'def_design');
-if isempty(marsD), return, end
-marsY = mars_arm('get', 'roi_data');
-if isempty(marsY), return, end
-if mars_arm('isempty', 'def_design')
- error('Need design and data with matching number of rows');
-end
-if sf_prev_save('est_design') == -1, return, end
-if ~can_mars_estimate(marsD)
- marsD = fill(marsD, 'for_estimation');
- mars_arm('update', 'def_design', marsD);
-end
-marsRes = estimate(marsD, marsY, struct(...
- 'redo_covar', 1, 'redo_whitening', 1));
-mars_arm('set', 'est_design', marsRes);
-mars_arm('show_summary', 'est_design');
-
-%=======================================================================
-case 'set_results' %-sets estimated design into global stucture
-%=======================================================================
-% donef = marsbar('set_results')
-%-----------------------------------------------------------------------
-% Set results, put results ROI data into roi_data container
-
-varargout = {0};
-
-% Check if there's anything we don't want to write over
-if sf_prev_save('est_design') == -1, return, end
-if sf_prev_save('roi_data') == -1, return, end
-
-% Do set
-mars_arm('set_ui', 'est_design');
-if mars_arm('isempty', 'est_design'), return, end
-
-% Get design, set ROI data
-marsRes = mars_arm('get', 'est_design');
-mars_arm('set', 'roi_data', get_data(marsRes));
-
-% Clear default contrast
-if mars_struct('isthere', MARS, 'WORKSPACE', 'default_contrast')
- MARS.WORKSPACE.default_contrast = [];
- fprintf('Reset of estimated design, cleared default contrast...\n');
-end
-
-% Report on design
-fprintf('%-40s: ','Design reporting');
-ui_report(marsRes, 'DesMtx');
-ui_report(marsRes, 'DesRepUI');
-fprintf('%30s\n','...done');
-
-varargout = {1};
-return
-
-%=======================================================================
-case 'plot_residuals' %-plots residuals from estimation
-%=======================================================================
-% marsbar('plot_residuals')
-%-----------------------------------------------------------------------
-marsRes = mars_arm('get', 'est_design');
-if isempty(marsRes), return, end
-Y = residuals(marsRes);
-ns = region_name(Y);
-rno = mars_struct('getifthere', MARS, 'WORKSPACE', 'default_region');
-if ~isempty(rno)
- fprintf('Using default region: %s\n', ns{rno});
-end
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Plot residuals', 1);
-p_type = char(spm_input('Type of plot', '+1', 'm', ...
- 'All|Time course|FFT|ACF', ...
- {'all','raw','fft','acf'}));
-ui_plot(Y, struct('types', p_type, 'r_nos', rno));
-
-%=======================================================================
-case 'set_defcon' %-set default contrast
-%=======================================================================
-% Ic = marsbar('set_defcon')
-%-----------------------------------------------------------------------
-varargout = {[]};
-marsRes = mars_arm('get', 'est_design');
-if isempty(marsRes), return, end
-
-% Setup input window
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Default contrast', 0);
-Ic = mars_struct('getifthere',MARS, 'WORKSPACE', 'default_contrast');
-if isempty(Ic)
- cname = '[Not set]';
-else
- xCon = get_contrasts(marsRes);
- cname = xCon(Ic).name;
-end
-spm_input(cname, 1, 'd', 'Default contrast');
-opts = {'Quit', 'Set new default'};
-if ~isempty(Ic), opts = [opts {'Clear default contrast'}]; end
-switch spm_input('What to do?', '+1', 'm', opts, [1:length(opts)], 1);
- case 1
- case 2
- [Ic marsRes changef] = ui_get_contrasts(marsRes, 'T|F',1,...
- 'Select default contrast','',1);
- if changef
- mars_arm('update', 'est_design', marsRes);
- end
- case 3
- Ic = [];
-end
-MARS.WORKSPACE.default_contrast = Ic;
-varargout = {Ic};
-
-%=======================================================================
-case 'set_defregion' %-set default region
-%=======================================================================
-% rno = marsbar('set_defregion')
-%-----------------------------------------------------------------------
-varargout = {[]};
-marsY = mars_arm('get', 'roi_data');
-if isempty(marsY), return, end
-ns = region_name(marsY);
-if length(ns) == 1
- disp('Only one region in data');
- MARS.WORKSPACE.default_region = 1;
- varargout = {1};
- return
-end
-
-% Setup input window
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Default region', 0);
-rno = mars_struct('getifthere',MARS, 'WORKSPACE', 'default_region');
-if isempty(rno), rname = '[Not set]'; else rname = ns{rno}; end
-spm_input(rname, 1, 'd', 'Default region:');
-opts = {'Quit', 'Set new default'};
-if ~isempty(rno), opts = [opts {'Clear default region'}]; end
-switch spm_input('What to do?', '+1', 'm', opts, [1:length(opts)], 1);
- case 1
- case 2
- rno = marsbar('get_region', ns);
- disp(['Default region set to: ' ns{rno}]);
- case 3
- rno = [];
-end
-MARS.WORKSPACE.default_region = rno;
-varargout = {rno};
-
-%=======================================================================
-case 'get_region' %-ui to select region
-%=======================================================================
-% select region from list box / input
-% rno = marsbar('get_region', names, prompt)
-% names is cell array of strings identifying regions
-% prompt is prompt string
-%-----------------------------------------------------------------------
-
-if nargin < 2
- error('Need region names to select from');
-else
- names = varargin{2};
-end
-if nargin < 3
- prompt = 'Select region';
-else
- prompt = varargin{3};
-end
-
-% maximum no of items in list box
-maxlist = 200;
-if length(names) > maxlist
- % text input, maybe
- error('Too many regions');
-end
-if length(names) == 1
- rno = 1;
-elseif isempty(names)
- rno = []
-else
- % listbox
- rno = spm_input(prompt, '+1', 'm', names);
-end
-varargout = {rno};
-
-%=======================================================================
-case 'spm_graph' %-run spm_graph
-%=======================================================================
-% marsbar('spm_graph')
-%-----------------------------------------------------------------------
-marsRes = mars_arm('get', 'est_design');
-if isempty(marsRes), return, end
-
-% Setup input window
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Mars SPM graph', 1);
-
-ns = region_name(get_data(marsRes));
-rno = mars_struct('getifthere', MARS, 'WORKSPACE', 'default_region');
-if ~isempty(rno)
- fprintf('Using default region: %s\n', ns{rno});
-else
- rno = marsbar('get_region', ns, 'Select region to plot');
-end
-
-Ic = mars_struct('getifthere', MARS, 'WORKSPACE', 'default_contrast');
-if ~isempty(Ic)
- xCon = get_contrasts(marsRes);
- fprintf('Using default contrast: %s\n', xCon(Ic).name);
-end
-
-% Variables returned in field names to allow differences
-% in return variables between versions of spm_graph
-[r_st marsRes changef] = mars_spm_graph(marsRes, rno, Ic);
-
-% Dump field names to global workspace as variables
-fns = fieldnames(r_st);
-for f = 1:length(fns)
- assignin('base', fns{f}, getfield(r_st, fns{f}));
-end
-
-% Store if changed
-if changef
- mars_arm('update', 'est_design', marsRes);
-end
-
-%=======================================================================
-case 'stat_table' %-run stat_table
-%=======================================================================
-% marsbar('stat_table')
-%-----------------------------------------------------------------------
-marsRes = mars_arm('get', 'est_design');
-if isempty(marsRes), return, end
-Ic = mars_struct('getifthere', MARS, 'WORKSPACE', 'default_contrast');
-if ~isempty(Ic)
- xCon = get_contrasts(marsRes);
- fprintf('Using default contrast: %s\n', xCon(Ic).name);
-end
-[strs marsS marsRes changef] = ...
- stat_table(marsRes, Ic);
-disp(char(strs));
-assignin('base', 'marsS', marsS);
-if changef
- mars_arm('update', 'est_design', marsRes);
-end
-
-%=======================================================================
-case 'signal_change' % percent signal change
-%=======================================================================
-% marsbar('signal_change')
-%-----------------------------------------------------------------------
-marsRes = mars_arm('get', 'est_design');
-if isempty(marsRes), return, end
-if ~is_fmri(marsRes)
- fprintf('Need FMRI design for %% signal change\n');
- return
-end
-
-% Setup input window
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Percent signal change', 0);
-
-[marsRes ic status] = ui_event_types(marsRes);
-if (status==0), return, end
-if (status>1), mars_arm('update', 'est_design', marsRes); end
-if isempty(ic), return, end
-
-dur = spm_input('Event duration', '+1', 'e', 0);
-
-% Choose event difference function
-diff_func = mars_struct('getifthere', MARS, 'OPTIONS', ...
- 'events', 'diff_func');
-if isempty(diff_func), diff_func = 'max abs';
-elseif strcmp(diff_func, 'window')
- spm_input('Event signal change window...', '+1','d', mfilename);
- times = spm_input('Mean signal between times', ...
- '+1', 'r', [4 6], 2, [0 dur+32]);
- other_args = {times, bf_dt(marsRes)};
-else
- other_args = {};
-end
-
-ic_len = length(ic);
-et = event_types(marsRes);
-for i = 1:ic_len
- pc(i,:) = event_signal(marsRes, et(ic(i)).e_spec, dur, ...
- diff_func, ...
- other_args{:});
-end
-rns = region_name(get_data(marsRes));
-disp('Sort-of % signal change');
-disp(sprintf('Duration: %3.2f seconds', dur));
-for i = 1:ic_len
- disp(['Event: ' et(ic(i)).name]);
- for r = 1:length(rns)
- disp(sprintf('Region: %40s; %5.3f', rns{r}, pc(i, r)));
- end
-end
-assignin('base', 'pc', pc);
-
-%=======================================================================
-case 'fitted_events' % show fitted event time courses
-%=======================================================================
-% marsbar('fitted_events')
-%-----------------------------------------------------------------------
-marsRes = mars_arm('get', 'est_design');
-if isempty(marsRes), return, end
-if ~is_fmri(marsRes)
- fprintf('Need FMRI design for fitted event time courses\n');
- return
-end
-
-% Setup input window
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','Fitted events', 1);
-
-[marsRes ic status] = ui_event_types(marsRes);
-if (status==0), return, end
-if (status>1), mars_arm('update', 'est_design', marsRes); end
-if isempty(ic), return, end
-
-dur = spm_input('Event duration', '+1', 'e', 0);
-ic_len = length(ic);
-et = event_types(marsRes);
-for i = 1:ic_len
- [tc{i} dt] = event_fitted(marsRes, et(ic(i)).e_spec, dur);
-end
-
-if ic_len > 8
- warning('Too many event types to plot, plotting first 8');
- ic_len = 8;
-end
-
-figure(Fgraph);
-if ic_len > 1, p_cols = 2; else p_cols = 1; end
-p_rows = ceil(ic_len / p_cols);
-last_row_starts = (p_rows-1) * p_cols + 1;
-for i = 1:ic_len
- t = tc{i};
- secs = ([1:size(t, 1)]-1) * dt;
- subplot(p_rows, p_cols, i);
- plot(secs, t);
- title(et(ic(i)).name);
- if i >= last_row_starts, xlabel('Seconds'); end
- if rem(i-1, p_cols)==0, ylabel('Signal change'); end
-end
-
-legend(region_name(get_data(marsRes)));
-
-assignin('base', 'time_courses', tc);
-assignin('base', 'dt', dt);
-
-%=======================================================================
-case 'fir_events' % show FIR for events
-%=======================================================================
-% marsbar('fir_events')
-%-----------------------------------------------------------------------
-marsRes = mars_arm('get', 'est_design');
-if isempty(marsRes), return, end
-if ~is_fmri(marsRes)
- fprintf('Need FMRI design for FIR event time courses\n');
- return
-end
-
-% Setup input window
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup','FIR for events', 1);
-
-[marsRes ic status] = ui_event_types(marsRes);
-if (status==0), return, end
-if (status>1), mars_arm('update', 'est_design', marsRes); end
-if isempty(ic), return, end
-
-et = event_types(marsRes);
-ic_len = length(ic);
-
-% Single or stacked?
-% If all the events have zero duration, the model is already single, and
-% there is no point in asking. If any of the durations are different
-% across events, then the single model is invalid.
-d_a = []; opts = [];
-for i = 1:ic_len
- e_spec = et(ic(i)).e_spec;
- for j = 1:size(e_spec, 2)
- [o d] = event_onsets(marsRes, e_spec(:, j));
- d_a = [d_a; d];
- end
-end
-if any(d_a) && ~any(diff(d_a))
- if spm_input('FIR type', '+1','m',...
- 'Single|Stacked', [1 0], 1)
- opts.single = 1;
- end
-end
-if spm_input('Signal units', '+1','m',...
- 'Percent|Beta units', [1 0], 1)
- opts.percent = 1;
-end
-
-bin_length = spm_input('Bin length (secs)', '+1', 'e', tr(marsRes));
-def_bin_no = round(25/bin_length);
-bin_no = spm_input('No of bins', '+1', 'e', def_bin_no);
-
-for i = 1:ic_len
- tc{i} = event_fitted_fir(marsRes, ...
- et(ic(i)).e_spec, ...
- bin_length, ...
- bin_no, ...
- opts);
-end
-
-if ic_len > 8
- warning('Too many event types to plot, plotting first 8');
- ic_len = 8;
-end
-
-figure(Fgraph);
-if ic_len > 1, p_cols = 2; else p_cols = 1; end
-p_rows = ceil(ic_len / p_cols);
-last_row_starts = (p_rows-1) * p_cols + 1;
-secs = ([1:bin_no]-1) * bin_length + bin_length/2;
-for i = 1:ic_len
- t = tc{i};
- subplot(p_rows, p_cols, i);
- plot(secs, t);
- title(et(ic(i)).name);
- if i >= last_row_starts, xlabel('Seconds'); end
- if rem(i-1, p_cols)==0, ylabel('Signal change'); end
-end
-legend(region_name(get_data(marsRes)));
-
-assignin('base', 'time_courses', tc);
-assignin('base', 'bin_length', bin_length);
-assignin('base', 'bin_no', bin_no);
-
-%=======================================================================
-case 'add_events_by_name' %-make event types from events with same name
-%=======================================================================
-% marsbar(''add_events_by_name')
-%-----------------------------------------------------------------------
-D = mars_arm('get', 'est_design');
-if isempty(D), return, end
-if ~is_fmri(D)
- disp('Can only add event types to FMRI designs');
- return
-end
-et = event_types(D);
-et = [et event_types_named(D)];
-D = event_types(D, et);
-mars_arm('update', 'est_design', D);
-
-%=======================================================================
-case 'merge_contrasts' %-import contrasts
-%=======================================================================
-% marsbar('merge_contrasts')
-%-----------------------------------------------------------------------
-D = mars_arm('get', 'est_design');
-if isempty(D), return, end
-filter_spec = {...
- 'SPM.mat','SPM: SPM.mat';...
- '*_mres.mat','MarsBaR: *_mres.mat';...
- '*x?on.mat','xCon.mat file'};
-[fn pn] = mars_uifile('get', ...
- filter_spec, ...
- 'Source design/contrast file...');
-if isequal(fn,0) || isequal(pn,0), return, end
-fname = fullfile(pn, fn);
-D2 = mardo(fname);
-
-% has this got contrasts?
-if ~has_contrasts(D2)
- error(['Cannot find contrasts in design/contrast file ' fname]);
-end
-
-% now try to trap case of contrast only file
-if ~is_valid(D2)
- D2 = get_contrasts(D2);
-end
-
-[D Ic changef] = add_contrasts(D, D2, 'ui');
-disp('Done');
-if changef
- mars_arm('update', 'est_design', D);
-end
-
-%=======================================================================
-case 'refresh_contrasts' %-refresh contrasts
-%=======================================================================
-% marsbar('refresh_contrasts')
-%-----------------------------------------------------------------------
-D = mars_arm('get', 'est_design');
-if isempty(D), return, end
-D = refresh_contrasts(D);
-disp('Refreshed contrasts');
-mars_arm('update', 'est_design', D);
-
-%=======================================================================
-case 'add_trial_f' %-add trial-specific F contrasts to design
-%=======================================================================
-% marsbar('add_trial_f')
-%-----------------------------------------------------------------------
-D = mars_arm('get', 'est_design');
-if isempty(D), return, end
-if ~is_fmri(D)
- disp('Can only add trial specific F contrasts for FMRI designs');
- return
-end
-[D changef] = add_trial_f(D);
-disp('Done');
-if changef
- mars_arm('update', 'est_design', D);
-end
-
-%=======================================================================
-case 'error_log' %- makes file to help debugging errors
-%=======================================================================
-% fname = marsbar('error_log', fname);
-%-----------------------------------------------------------------------
-if nargin < 2
- fname = 'error_log.mat';
-else
- fname = varargin{2};
-end
-
-e_log = struct('last_error', lasterr, ...
- 'm_ver', marsbar('ver'),...
- 'mars', MARS);
-savestruct(fname, e_log);
-if ~isempty(which('zip'))
- zip([fname '.zip'], fname);
- fname = [fname '.zip'];
-end
-disp(['Saved error log as ' fname]);
-
-%=======================================================================
-case 'mars_menu' %-menu selection of marsbar actions
-%=======================================================================
-% marsbar('mars_menu',tstr,pstr,tasks_str,tasks)
-%-----------------------------------------------------------------------
-
-[tstr pstr optfields optlabs] = deal(varargin{2:5});
-if nargin < 6
- optargs = cell(1, length(optfields));
-else
- optargs = varargin{6};
-end
-
-[Finter,Fgraph,CmdLine] = spm('FnUIsetup',tstr);
-of_end = length(optfields)+1;
-my_task = spm_input(pstr, '+1', 'm',...
- {optlabs{:} 'Quit'},...
- [1:of_end],of_end);
-if my_task == of_end, return, end
-marsbar(optfields{my_task}{:});
-
-%=======================================================================
-otherwise %-Unknown action string
-%=======================================================================
-error('Unknown action string')
-
-%=======================================================================
-end
-return
-
-% subfunctions
-function sum_func = sf_get_sumfunc(sum_func)
-if strcmp(sum_func, 'ask')
- sum_func = char(spm_input('Summary function', '+1','m',...
- 'Mean|Weighted mean|Median|1st eigenvector',...
- {'mean','wtmean','median','eigen1'}, 1));
-end
-
-function btn = sf_prev_save(obj_name)
-btn = mars_arm('save_ui', obj_name, ...
- struct('ync', 1, ...
- 'no_no_save', 1, ...
- 'prompt_prefix', 'previous '));
-% If answer is 'No', then flag that we don't need to save
-if btn == 0
- mars_arm('set_param', obj_name, 'has_changed', 0);
-end
-return
diff --git a/lib/marsbar-0.44/release/make_contents.m b/lib/marsbar-0.44/release/make_contents.m
deleted file mode 100644
index 3136f39..0000000
--- a/lib/marsbar-0.44/release/make_contents.m
+++ /dev/null
@@ -1,186 +0,0 @@
-function make_contents(aString, flags, start_dir)
-% MAKECONTENTS makes Contents file, usually in current working directory.
-% MAKECONTENTS(STRING [FLAGS [START_DIR]])
-% creates a standard "Contents.m" file in the
-% current directory by assembling the first comment (H1) line in
-% each function found in the current working directory. If a
-% "Contents.m" file exists, it is renamed to "Contents.old", before
-% a new "Contents.m" file is created. STRING is inserted as the
-% first line of the "Contents.m" file; if omitted, a blank line
-% is inserted instead. The function changes permission on the
-% resultant "Contents.m" file to rw-r--r-- on Unix systems.
-%
-% FLAGS can contain none or more of
-% 'n' - suppress path name at top of Contents file
-% 'f' - include first word of first line (excluded by default)
-% 'c' - use filename 'contents.m' instead of 'Contents.m'
-% 'r' - recursively list subdirectory contents also
-% 'i' - include starting directory from file name path list
-% 'p' - save contents file in current rather than listed directory
-% 'd' - don't make backup of old contents file
-%
-% START_DIR can be omitted, giving a listing of current working
-% directory, or it can specify the directory to list
-%
-% Updated 29 June 2000.
-% Revised to recurse down directories, handle options by
-% Matthew Brett; 28 June 2003
-%
-% See also CONTENTS.
-%
-% $Id$
-
-% Author(s): L. Bertuccioli
-% A. Prasad
-
-% Based on mkcontents.m by Denis Gilbert
-
-% Default value of input string
-if nargin < 1,
- aString =' ';
-end
-if nargin < 2
- flags = '';
-end
-if isempty(flags)
- flags = ' ';
-end
-if nargin < 3
- start_dir = '';
-end
-if isempty(start_dir)
- start_dir = pwd;
-end
-
-% parse flags
-if any(flags == 'c')
- cont_file = 'contents.m';
-else
- cont_file = 'Contents.m';
-end
-if any(flags == 'p')
- cont_dir = pwd;
-else
- cont_dir = start_dir;
-end
-disp(['Creating "' cont_file '" in ' cont_dir])
-cont_path = fullfile(cont_dir, cont_file);
-if ~any(flags == 'd')
- if exist(cont_path, 'file')
- copyfile(cont_path, ...
- fullfile(cont_dir, [cont_file(1:end-1) 'old']));
- delete(cont_path)
- end
-end
-
-% Header lines
-line1 = ['% ' aString];
-fcontents = fopen(cont_path,'wt');
-if fcontents == -1
- error(['Could not open file: ' cont_path]);
-end
-fprintf(fcontents,'%s\n',line1);
-if ~any(flags == 'n')
- line2 = ['% Path -> ' start_dir];
- fprintf(fcontents,'%s\n',line2);
-end
-
-% set first past flag
-flags = [flags '1'];
-
-% do write
-do_list(start_dir, fcontents, flags);
-fclose(fcontents);
-
-% Change permissions on Contents.m file
-% only valid for Unix systems, no effect in Win32 systems
-if isunix
- unix(['chmod go+r ' cont_path]);
-end
-return
-
-function do_list(dirname, fcontents, flags)
-persistent START_DIR ST_D_LEN;
-if any(flags == '1') % first pass through
- START_DIR = dirname;
- ST_D_LEN = length(dirname) + 2;
-end
-
-if any(flags == 'r')
- % find directories
- dirlist = dir(dirname);
- dirnames = {dirlist([dirlist.isdir]).name};
- dirnames = dirnames(~(strcmp('.', dirnames) | strcmp('..', dirnames)));
-else
- dirnames = {};
-end
-
-% find m files
-files = what(dirname);
-
-% fix apparent bug in what function
-files = files(1);
-
-% exclude any contents files
-files.m = files.m(logical(~strcmpi(files.m,'contents.m')));
-if length(files.m)==0
- warning(['No m-files found in directory ' dirname])
- return
-end
-fprintf(fcontents,'%%\n');
-
-% maybe exclude starting path from listing
-if ~any(flags == 'i')
- dirlab = dirname(ST_D_LEN:end);
- if ~any(flags == '1') % not first pass
- dirlab = [dirlab filesep];
- end
-else % not excluding starting directory
- dirlab = [dirname filesep];
-end
-
-maxlen = size(char(files.m),2) + length(dirlab);
-
-% Write first lines to Contents.m if they exist
-for i = 1:length(files.m)
- fname = fullfile(files.path, files.m{i});
- fid=fopen(fname, 'rt');
- if fid == -1, error(['Error opening file: ' fname]); end
- aLine = '';
- while(isempty(aLine) | length(aLine) < 8)
- aLine = fgetl(fid);
- end
- if strcmp(aLine(1:8),'function'),
- count_percent = 0;
- while count_percent < 1 & feof(fid)==0;
- line = fgetl(fid);
- if length(line) > 0
- if ~isempty(findstr(line,'%'))
- count_percent = count_percent + 1;
- rr=line(2:length(line));
- if ~any(flags == 'f') % remove first word
- [tt,rr]=strtok(line(2:length(line)));
- end
- rr = fliplr(deblank(fliplr(rr)));
- fn = [dirlab strtok(char(files.m(i)),'.')];
- n = maxlen - length(fn) - 1;
- line = ['% ' fn blanks(n) '- ' rr];
- fprintf(fcontents,'%s\n',line);
- end % if ~isempty
- end % if length
- if feof(fid)==1
- fn = [dirlab strtok(char(files.m(i)),'.')];
- n = maxlen - length(fn) - 1;
- line = ['% ' fn blanks(n) '- (No help available)'];
- fprintf(fcontents,'%s\n',line);
- end % if feof
- end % while
- end % if strcmp
- fclose(fid);
-end
-% recurse down directory tree
-flags = flags(flags ~= '1'); % reset first pass flag
-for d = 1:length(dirnames)
- do_list(fullfile(dirname, dirnames{d}), fcontents, flags);
-end
-return
diff --git a/lib/marsbar-0.44/release/pre_release.m b/lib/marsbar-0.44/release/pre_release.m
deleted file mode 100644
index 4824796..0000000
--- a/lib/marsbar-0.44/release/pre_release.m
+++ /dev/null
@@ -1,62 +0,0 @@
-function pre_release(rname, outdir, proj, proj_descrip, proj_url)
-% Runs pre-release export, cleanup
-% FORMAT pre_release(rname, outdir, proj, proj_descrip)
-%
-% Inputs [defaults]
-% rname - string to define release version ['-%s']
-% outdir - directory to output release to [pwd]
-% proj - project name (and name of main project file) ['marsbar']
-% proj_descrip - short description of project ['MarsBaR ROI toolbox']
-% proj_url - URL from which to clone project
-% ['git://github.com/matthew-brett/marsbar.git']
-%
-% e.g. pre_release('-devel-%s', '/tmp')
-% would output a release called marsbar-devel-0.34.tar.gz (if the marsbar
-% version string is '0.34') to the /tmp directory
-
-if nargin < 1
- rname = '';
-end
-if isempty(rname)
- rname = '-%s';
-end
-if nargin < 2
- outdir = '';
-end
-if isempty(outdir)
- outdir = pwd;
-end
-if nargin < 3
- proj = 'marsbar';
-end
-if nargin < 4
- proj_descrip = 'MarsBaR ROI toolbox';
-end
-if nargin < 5
- proj_url = 'git://github.com/matthew-brett/marsbar.git';
-end
-
-% project version
-V = eval([proj '(''ver'')']);
-rname = sprintf(rname, V);
-
-% Clone from git
-cmd = sprintf('git clone %s %s', proj_url, proj);
-unix(cmd);
-
-% make contents file
-contents_str = sprintf('Contents of %s version %s', proj_descrip, V);
-make_contents(contents_str, 'fncrd', fullfile(pwd, proj, proj));
-
-% move directory
-full_name = sprintf('%s%s', proj, rname);
-unix(sprintf('mv %s/%s %s', proj, proj, full_name));
-% Make archives
-unix(sprintf('tar zcvf %s.tar.gz %s', full_name, full_name));
-unix(sprintf('zip -r %s.zip %s', full_name, full_name));
-% Remove traces of checkout
-unix(sprintf('rm -rf %s', full_name));
-unix(sprintf('rm -rf %s', proj));
-
-fprintf('Created %s release %s\n', proj, full_name);
-fprintf('Consider Changelog, e.g git log --pretty=%%s --first-parent\n');
diff --git a/lib/marsbar-0.44/release/test_rig.m b/lib/marsbar-0.44/release/test_rig.m
deleted file mode 100644
index 6c3d7e3..0000000
--- a/lib/marsbar-0.44/release/test_rig.m
+++ /dev/null
@@ -1,123 +0,0 @@
-function res = test_rig(design_paths, params)
-% runs tests on MarsBaR using specified designs
-% FORMAT res = test(design_paths, params)
-%
-% Inputs
-% design_paths - path(s) to SPM design files
-% params - structure giving params to pass to estimate method,
-% see help for do_estimate methods for details
-% Default is
-% params = struct('redo_covar', 0, ...
-% 'redo_whitening', 0);
-%
-% Outputs
-% res - 1 if all tests passed, 0 otherwise
-%
-% The function depends on the SPM design having estimated contrasts to
-% play with. It uses these to:
-% Get the maximum voxel in the first F and first T contrast
-% Records the T/F statistic value
-% Makes an ROI out of this voxel
-% Estimates in MarsBaR
-% Checks the statistic value is that same.
-%
-% Along the way, it uses much of the MarsBaR machinery
-%
-% $Id$
-
-if nargin < 1
- design_paths = spm_get([0 Inf], 'SPM*.mat', 'Select SPM designs');
-end
-if nargin < 2
- params = struct('redo_covar', 0, ...
- 'redo_whitening', 0);
-end
-
-n_designs = size(design_paths, 1);
-res = zeros(n_designs, 1);
-for d = 1:n_designs
- d_path = deblank(design_paths(d,:));
- res(d) = sf_test_design(d_path, params);
-end
-return
-
-function res = sf_test_design(d_path, params)
-% tests one design
-
-% Check for SPM estimated design, with estimated contrasts
-D = mardo(d_path);
-if ~is_spm_estimated(D)
- error('Need an SPM estimated design');
-end
-if ~has_contrasts(D)
- error(['Design ' d_path ' does not contain contrasts']);
-end
-if ~has_images(D)
- error(['Design ' d_path ' does not contain images']);
-end
-
-% try to get one F and one T contrast
-Swd = fileparts(d_path);
-xCon = get_contrasts(D);
-stats = [xCon(:).STAT];
-Ic = []; fnames = {};
-for t = 'TF'
- for c = fliplr(find(stats == t))
- F = xCon(c).Vspm;
- if ~isempty(F)
- % SPM99 = filename, SPM2 = vol_struct
- if isstruct(F), F = F.fname; end
- % SPM5 has full paths for the contrast images
- con_pth = fileparts(F);
- if isempty(con_pth)
- F = fullfile(Swd, F);
- end
- if exist(F, 'file'), Ic = [Ic c]; fnames{end+1} = F; break, end
- end
- end
-end
-if isempty(Ic)
- error(['Could not find any contrast images for ' d_path]);
-end
-
-% find maximum voxel coordinate for contrasts and test
-res = 1;
-for c = 1:length(Ic)
- V = spm_vol(fnames{c});
- img = spm_read_vols(V);
- [mx(c) i] = max(img(:));
- xyz(:, c) = mars_utils('e2xyz', i, V.dim(1:3));
- mx_roi(c) = maroi_pointlist(struct('XYZ', xyz(:, c), ...
- 'mat', V.mat), 'vox');
- Y = get_marsy(mx_roi(c), D, 'mean');
- E = estimate(D, Y, params);
- [E n_Ic] = add_contrasts(E, D, Ic(c));
- marsS = compute_contrasts(E, n_Ic);
- fprintf('SPM statistic %7.4f; MarsBaR statistic %7.4f\n',...
- mx(c), marsS.stat(1));
- st_spm = mx(c);
- st_mars = marsS.stat(1);
- bad_test = abs(st_mars - st_spm) > 1e-5;
- if bad_test % Statistics are different - SPM8 fudge?
- spmV = lower(mars_utils('spm_version'));
- if any(strcmp(spmV, {'spm8', 'spm12b', 'spm12'}))
- xCon = get_contrasts(E);
- this_con = xCon(n_Ic);
- if this_con.STAT == 'T' & (st_mars > st_spm)
- % Probably the fudge factor
- fudge = (st_mars / st_spm - 1) / exp(-8);
- fprintf('Fudge value was %f\n', fudge);
- % fudge should now be max SE across all voxels in the
- % estimation block (e.g. slice) / SE for this voxel
- if fudge < 10
- bad_test = 0;
- end
- end
- end
- end
- if bad_test
- disp('MarsBaR gives a different result for contrast');
- res = 0;
- end
-end
-return
diff --git a/lib/marsbar-0.44/savestruct.m b/lib/marsbar-0.44/savestruct.m
deleted file mode 100644
index 45019b5..0000000
--- a/lib/marsbar-0.44/savestruct.m
+++ /dev/null
@@ -1,21 +0,0 @@
-function savestruct(varargin)
-% saves data in structure as variables in .mat file
-% FORMAT savestruct(matname, struct) or
-% FORMAT savestruct(struct, matname)
-%
-% $Id$
-
-if nargin ~= 2
- error('Need matfile name and structure (only)');
-end
-if isstruct(varargin{1}), varargin = varargin([2 1]); end
-varargin{3} = fieldnames(varargin{2});
-if any(ismember(varargin{3}, {'wombat_tongue'}))
- error('Whoops, unexpected use of wombat_tongue');
-end
-for wombat_tongue = 1:length(varargin{3})
- eval([varargin{3}{wombat_tongue} ' = varargin{2}.' varargin{3}{wombat_tongue} ...
- ';']);
-end
-save(varargin{1}, varargin{3}{:});
-return
diff --git a/lib/marsbar-0.44/spm2/mars_blob_ui.m b/lib/marsbar-0.44/spm2/mars_blob_ui.m
deleted file mode 100644
index c52fa09..0000000
--- a/lib/marsbar-0.44/spm2/mars_blob_ui.m
+++ /dev/null
@@ -1,49 +0,0 @@
-function mars_blob_ui(action)
-% Displays SPM results, and ROI menu in SPM input window
-% FORMAT mars_blob_ui(action)
-%
-% This is the SPM2 version
-%
-% action - action string; can be
-% 'init' - initialise results interface
-% 'save_one' - UI to save current cluster
-% 'save_many' - UI to save all clusters
-%
-% This routine does SPM version specific stuff, the main
-% work is in mars_blob2roi.m and mars_blobs2rois.m
-%
-% $Id$
-
-if nargin < 1
- action = 'init';
-end
-
-errstr = sprintf(['''Cannot find xSPM struct in the workspace; '...
- 'Please (re)run SPM results GUI''']);
-
-switch lower(action)
- case 'init'
- try % and find valid SPM results stuff
- evalin('base', 'xSPM;');
- hReg = evalin('base', 'hReg;');
- spm_XYZreg('CleanReg',hReg);
- mars_blob_menu;
- catch % give up and get a new one
- mars_blob_ui('reinit');
- end
- case 'reinit'
- % Display SPM results
- evalin('base', '[hReg,xSPM,SPM] = spm_results_ui;');
- % Menu
- mars_blob_menu;
- case 'save_one'
- xSPM = evalin('base', 'xSPM', ['error(' errstr ')']);
- %-Get current location
- pt = spm_results_ui('GetCoords');
- mars_blob2roi(xSPM, pt);
- case 'save_many'
- xSPM = evalin('base', 'xSPM', ['error(' errstr ')']);
- mars_blobs2rois(xSPM);
- otherwise
- error(['Worried by request for ' action]);
-end
diff --git a/lib/marsbar-0.44/spm2/mars_veropts.m b/lib/marsbar-0.44/spm2/mars_veropts.m
deleted file mode 100644
index c1e8923..0000000
--- a/lib/marsbar-0.44/spm2/mars_veropts.m
+++ /dev/null
@@ -1,41 +0,0 @@
-function varargout = mars_veropts(arg, varargin)
-% returns SPM version specific parameters
-% FORMAT varargout = mars_veropts(arg, varargin)
-%
-% This is the SPM 2 version
-%
-% $Id$
-
-if nargin < 1
- varargout = {};
- return
-end
-
-switch lower(arg)
- case 'defaults'
- global defaults
- if isempty(defaults)
- spm_defaults;
- spm('defaults','FMRI');
- end
- varargout = {defaults};
- case 'default_design'
- varargout = {mardo_2};
- case 'template_ext' % extension for template images
- varargout = {'.mnc'};
- case 'get_img_ext' % default image extension for spm_get
- varargout = {'IMAGE'};
- case 'pref_img_out_ext' % preferred extension for writing images
- varargout = {'img'};
- case 'des_conf' % filter for configured, not estimated SPM designs
- varargout = {'SPM.mat'};
- case 'flip_option'
- varargout = {spm_flip_analyze_images};
- case 'design_filter_spec'
- varargout = {{...
- 'SPM.mat','SPM.mat; 2(all)/99 (estimated: SPM.mat)';...
- 'SPMcfg.mat','99 with imgs: SPMcfg.mat';...
- 'SPM_fMRIDesMtx.mat','99,FMRI,no imgs: SPM*fMRI*'}};
- otherwise
- error(['You asked for ' arg ', which is strange']);
-end
diff --git a/lib/marsbar-0.44/spm2/spm_create_image.m b/lib/marsbar-0.44/spm2/spm_create_image.m
deleted file mode 100644
index 8289d8d..0000000
--- a/lib/marsbar-0.44/spm2/spm_create_image.m
+++ /dev/null
@@ -1,11 +0,0 @@
-function V = spm_create_image(V)
-% Wrapper for spm_create_vol, for compatibility with SPM99
-% FORMAT V = spm_create_image(V)
-%
-% Actually, MarsBaR itself does not use this function; it's included here
-% for compatibility with Phiwave (phiwave.sourceforge.net), that depends
-% on MarsBaR for its design interface and such.
-%
-% $Id$
-
-V = spm_create_vol(V);
diff --git a/lib/marsbar-0.44/spm5/mars_blob_ui.m b/lib/marsbar-0.44/spm5/mars_blob_ui.m
deleted file mode 100644
index aa6d795..0000000
--- a/lib/marsbar-0.44/spm5/mars_blob_ui.m
+++ /dev/null
@@ -1,49 +0,0 @@
-function mars_blob_ui(action)
-% Displays SPM results, and ROI menu in SPM input window
-% FORMAT mars_blob_ui(action)
-%
-% This is the SPM2 / SPM5 version
-%
-% action - action string; can be
-% 'init' - initialise results interface
-% 'save_one' - UI to save current cluster
-% 'save_many' - UI to save all clusters
-%
-% This routine does SPM version specific stuff, the main
-% work is in mars_blob2roi.m and mars_blobs2rois.m
-%
-% $Id: mars_blob_ui.m 184 2004-01-18 11:26:08Z matthewbrett $
-
-if nargin < 1
- action = 'init';
-end
-
-errstr = sprintf(['''Cannot find xSPM struct in the workspace; '...
- 'Please (re)run SPM results GUI''']);
-
-switch lower(action)
- case 'init'
- try % and find valid SPM results stuff
- evalin('base', 'xSPM;');
- hReg = evalin('base', 'hReg;');
- spm_XYZreg('CleanReg',hReg);
- mars_blob_menu;
- catch % give up and get a new one
- mars_blob_ui('reinit');
- end
- case 'reinit'
- % Display SPM results
- evalin('base', '[hReg,xSPM,SPM] = spm_results_ui;');
- % Menu
- mars_blob_menu;
- case 'save_one'
- xSPM = evalin('base', 'xSPM', ['error(' errstr ')']);
- %-Get current location
- pt = spm_results_ui('GetCoords');
- mars_blob2roi(xSPM, pt);
- case 'save_many'
- xSPM = evalin('base', 'xSPM', ['error(' errstr ')']);
- mars_blobs2rois(xSPM);
- otherwise
- error(['Worried by request for ' action]);
-end
diff --git a/lib/marsbar-0.44/spm5/mars_veropts.m b/lib/marsbar-0.44/spm5/mars_veropts.m
deleted file mode 100644
index 81c78c3..0000000
--- a/lib/marsbar-0.44/spm5/mars_veropts.m
+++ /dev/null
@@ -1,47 +0,0 @@
-function varargout = mars_veropts(arg, varargin)
-% returns SPM version specific parameters
-% FORMAT varargout = mars_veropts(arg, varargin)
-%
-% This is the SPM 5 version
-%
-% $Id: mars_veropts.m 350 2004-08-12 06:52:18Z matthewbrett $
-
-if nargin < 1
- varargout = {};
- return
-end
-
-switch lower(arg)
- case 'defaults'
- global defaults
- if isempty(defaults)
- try
- % SPM8 likes to return the defaults
- defaults = spm('defaults','FMRI');
- catch
- % SPM5 does not
- spm_defaults;
- spm('defaults','FMRI');
- end
- end
- varargout = {defaults};
- case 'default_design'
- varargout = {mardo_5};
- case 'template_ext' % extension for template images
- varargout = {'.nii'};
- case 'get_img_ext' % default image extension for spm_get
- varargout = {'image'};
- case 'pref_img_out_ext' % preferred extension for writing images
- varargout = {'.nii'};
- case 'des_conf' % filter for configured, not estimated SPM designs
- varargout = {'SPM.mat'};
- case 'flip_option'
- varargout = {spm_flip_analyze_images};
- case 'design_filter_spec'
- varargout = {{...
- 'SPM.mat','SPM.mat; 5,2 (all)/99 (estimated: SPM.mat)';...
- 'SPMcfg.mat','99 with imgs: SPMcfg.mat';...
- 'SPM_fMRIDesMtx.mat','99,FMRI,no imgs: SPM*fMRI*'}};
- otherwise
- error(['You asked for ' arg ', which is strange']);
-end
diff --git a/lib/marsbar-0.44/spm5/spm_create_image.m b/lib/marsbar-0.44/spm5/spm_create_image.m
deleted file mode 100644
index 34c6af5..0000000
--- a/lib/marsbar-0.44/spm5/spm_create_image.m
+++ /dev/null
@@ -1,11 +0,0 @@
-function V = spm_create_image(V)
-% Wrapper for spm_create_vol, for compatibility with SPM99
-% FORMAT V = spm_create_image(V)
-%
-% Actually, MarsBaR itself does not use this function; it's included here
-% for compatibility with Phiwave (phiwave.sourceforge.net), that depends
-% on MarsBaR for its design interface and such.
-%
-% $Id: spm_create_image.m 510 2004-11-17 01:51:58Z matthewbrett $
-
-V = spm_create_vol(V);
diff --git a/lib/marsbar-0.44/spm5/spm_get.m b/lib/marsbar-0.44/spm5/spm_get.m
deleted file mode 100644
index cef89d4..0000000
--- a/lib/marsbar-0.44/spm5/spm_get.m
+++ /dev/null
@@ -1,143 +0,0 @@
-function varargout = spm_get(Action, varargin)
-% compatibility function to allow spm_get calls with SPM5
-%
-% SPM5 uses a function called spm_select to do file selection instead of
-% the spm_get of versions 96-2. This breaks a lot of old code; here we
-% wrap the most common calls to spm_get so that we can use
-% spm_select. I've only wrapped the spm_get calls used in marsbar.
-%
-% Usually, file / directory selection call is of format:
-% FORMAT P = spm_get(N, ext, prompt, newwdir)
-% Input
-% N - matrix specifying what (file or dir) to select, and how
-% many to select.
-% ext - the filter for files to select
-% prompt - the prompt to display for the selection window
-% newwdir - new working directory
-%
-% Output
-% P - a string matrix of file names
-%
-% First argument can also be action string:
-% FORMAT cpath = spm_get('CPath',path,cwd)
-% (returns canonical version of file path 'path')
-% FORMAT [files,dirs]=spm_select('files',direc,filt)
-% (Returns files matching the filter (filt) and directories within dir)
-%
-% See spm_select from the spm5 distribution, and spm_get from spm2
-% distribution
-
-nout = max(nargout,1);
-
-if nargin < 1
- Action=Inf;
-end
-
-% If the first argument is a string, this is an action
-if ischar(Action)
- switch(lower(Action))
- case 'cpath'
- varargout = {spm_select('cpath', varargin{:})};
- case 'files'
- if nargin < 2
- Dir = pwd;
- else
- Dir = varargin{1};
- end
- if nargin < 3
- Filt = '.*';
- else
- Filt = sf_get_to_select_filt(varargin{2});
- end
- varargout = {spm_select('list', Dir, Filt)};
- % The old spm_get returned full file paths
- Files = varargout{1};
- varargout{1} = [repmat([Dir filesep], size(Files, 1), 1) Files];
- otherwise
- error([Action ': I''m sorry, but I can''t do that']);
- end
- if strcmp(Action, 'files'), Action='List'; end
-
- return
-end
-
-% Otherwise, must be file / directory selection
-if nargin < 2
- Filt = 'any';
-else
- Filt = varargin{1};
- varargin(1) = [];
- Filt = sf_get_to_select_filt(Filt);
-end
-if any(Action < 0)
- % Directory select
- Action = abs(Action);
- Filt = 'dir';
-end
-if nargin<3
- Prompt='Select files...';
-else
- Prompt = varargin{1};
- varargin(1) = [];
-end
-if nargin<4
- wd = pwd;
-else
- wd = varargin{1};
- varargin(1) = []; % pop processed argument
-end
-if length(varargin) ~= 0
- error('Sorry, we do not handle this call to spm_select');
-end
-varargout = {spm_select(Action, Filt, Prompt, {''}, wd)};
-if isempty(varargout), return, end
-% Cell array prompt should return cell array of arguments
-if iscellstr(Prompt)
- if isempty(varargout{1})
- varargout{1} = {};
- else
- varargout{1} = cellstr(varargout{1});
- end
-end
-return
-
-
-% Subfunctions
-function F = sf_get_to_select_filt(F)
-% Converts filter for old spm_get routine to something for spm_select
-if strcmpi(F, 'image'), F = lower(F); return, end
-F = sf_shexp_regexp(F);
-return
-
-function new_str = sf_shexp_regexp(old_str)
-% Does basic conversion from shell expression to regexp
-% Have ignored some quoting issues here:
-% http://www.unix.org.ua/orelly/perl/cookbook/ch06_10.htm
-% sub glob2pat {
-% my $globstr = shift;
-% my %patmap = (
-% '*' => '.*',
-% '?' => '.',
-% '[' => '[',
-% ']' => ']',
-% );
-% $globstr =~ s{(.)} { $patmap{$1} || "\Q$1" }ge;
-% return '^' . $globstr . '$';
-%}
-
-new_str = '^';
-for c = old_str
- switch c
- case '*'
- nc = '.*';
- case '?'
- nc = '.';
- case {'.', '^', '$', '+'}
- nc = ['\' c];
- otherwise
- nc = c;
- end
- new_str = [new_str nc];
-end
-new_str = [new_str '$'];
-return
diff --git a/lib/marsbar-0.44/spm99/mars_blob_ui.m b/lib/marsbar-0.44/spm99/mars_blob_ui.m
deleted file mode 100644
index ce5f2cd..0000000
--- a/lib/marsbar-0.44/spm99/mars_blob_ui.m
+++ /dev/null
@@ -1,53 +0,0 @@
-function mars_blob_ui(action)
-% Displays SPM results, and ROI menu in SPM input window
-% FORMAT mars_blob_ui(action)
-%
-% This is the SPM99 version
-%
-% action - action string; can be
-% 'init' - initialise results interface
-% 'save_one' - UI to save current cluster
-% 'save_many' - UI to save all clusters
-%
-% This routine does SPM version specific stuff, the main
-% work is in mars_blob2roi.m and mars_blobs2rois.m
-%
-% $Id$
-
-if nargin < 1
- action = 'init';
-end
-
-errstr = sprintf(['''Cannot find SPM struct in the workspace; '...
- 'Please (re)run SPM results GUI''']);
-
-switch lower(action)
- case 'init'
- try % and find valid SPM results stuff
- evalin('base', 'SPM;');
- evalin('base', 'VOL.M;');
- hReg = evalin('base', 'hReg;');
- RD = get(hReg,'UserData');
- spm_XYZreg('VReg',RD.Reg,0);
- mars_blob_menu;
- catch % no good, need a new one
- mars_blob_ui('reinit');
- end
- case 'reinit'
- % Display SPM results
- evalin('base','[hReg,SPM,VOL,xX,xCon,xSDM] = spm_results_ui;');
- % and menu
- mars_blob_menu;
- case 'save_one'
- xSPM = evalin('base', 'SPM', ['error(' errstr ')']);
- xSPM.M = evalin('base', 'VOL.M', ['error(' errstr ')']);
- %-Get current location
- pt = spm_results_ui('GetCoords');
- mars_blob2roi(xSPM, pt);
- case 'save_many'
- xSPM = evalin('base', 'SPM', ['error(' errstr ')']);
- xSPM.M = evalin('base', 'VOL.M', ['error(' errstr ')']);
- mars_blobs2rois(xSPM);
- otherwise
- error(['Worried by request for ' action]);
-end
diff --git a/lib/marsbar-0.44/spm99/mars_veropts.m b/lib/marsbar-0.44/spm99/mars_veropts.m
deleted file mode 100644
index 2166519..0000000
--- a/lib/marsbar-0.44/spm99/mars_veropts.m
+++ /dev/null
@@ -1,36 +0,0 @@
-function varargout = mars_veropts(arg, varargin)
-% returns SPM version specific parameters
-% FORMAT varargout = mars_veropts(arg, varargin)
-%
-% This the SPM 99 version
-%
-% $Id$
-
-if nargin < 1
- varargout = {};
- return
-end
-
-switch lower(arg)
- case 'defaults'
- varargout = {};
- case 'default_design'
- varargout = {mardo_99};
- case 'template_ext' % extension for template images
- varargout = {'.img'};
- case 'get_img_ext' % default image extension for spm_get
- varargout = {'img'};
- case 'pref_img_out_ext' % preferred extension for writing images
- varargout = {'img'};
- case 'des_conf' % filter for configured, not estimated SPM designs
- varargout = {'SPMcfg.mat'};
- case 'flip_option'
- varargout = {0};
- case 'design_filter_spec'
- varargout = {{...
- 'SPMcfg.mat','99 with imgs: SPMcfg.mat';...
- 'SPM.mat','SPM.mat; 2(all)/99 (estimated: SPM.mat)';...
- 'SPM_fMRIDesMtx.mat','99,FMRI,no imgs: SPM*fMRI*'}};
- otherwise
- error(['You asked for ' arg ', which is strange']);
-end
diff --git a/lib/marsbar-0.44/spm99/spm_close_vol.m b/lib/marsbar-0.44/spm99/spm_close_vol.m
deleted file mode 100644
index 2502235..0000000
--- a/lib/marsbar-0.44/spm99/spm_close_vol.m
+++ /dev/null
@@ -1,11 +0,0 @@
-function Vo = spm_close_vol(Vi)
-% Close image volume - for SPM2 / SPM99 compatibility
-% See: spm_create_vol and spm_write_plane.
-%
-% SPM99 seems to use spm_create_image to close volumes
-%
-% $Id$
-
-for i=1:prod(size(Vi)),
- Vo(i) = spm_create_image(Vi(i));
-end
diff --git a/lib/marsbar-0.44/spm99/spm_create_vol.m b/lib/marsbar-0.44/spm99/spm_create_vol.m
deleted file mode 100644
index da3a80a..0000000
--- a/lib/marsbar-0.44/spm99/spm_create_vol.m
+++ /dev/null
@@ -1,7 +0,0 @@
-function V = spm_create_vol(V)
-% Wrapper for spm_create_image, for compatibility with SPM2
-% FORMAT V = spm_create_vol(V)
-%
-% $Id$
-
-V = spm_create_image(V);
diff --git a/lib/marsbar-0.44/spm99/spm_read_hdr.m b/lib/marsbar-0.44/spm99/spm_read_hdr.m
deleted file mode 100644
index 76cbec3..0000000
--- a/lib/marsbar-0.44/spm99/spm_read_hdr.m
+++ /dev/null
@@ -1,140 +0,0 @@
-function [hdr,otherendian] = spm_read_hdr(fname)
-% SPM2 routine to read (SPM customised) Analyze header
-% (Needed for compatibility with SPM99)
-% FORMAT [hdr,otherendian] = spm_read_hdr(fname)
-% fname - .hdr filename
-% hdr - structure containing Analyze header
-% otherendian - byte swapping necessary flag
-%_______________________________________________________________________
-% @(#)spm_read_hdr.m 2.2 John Ashburner 03/07/17
-%
-% $Id$
-
-fid = fopen(fname,'r','native');
-otherendian = 0;
-if (fid > 0)
- dime = read_dime(fid);
- if dime.dim(1)<0 | dime.dim(1)>15, % Appears to be other-endian
- % Re-open other-endian
- fclose(fid);
- if spm_platform('bigend'), fid = fopen(fname,'r','ieee-le');
- else, fid = fopen(fname,'r','ieee-be'); end;
- otherendian = 1;
- dime = read_dime(fid);
- end;
- hk = read_hk(fid);
- hist = read_hist(fid);
- hdr.hk = hk;
- hdr.dime = dime;
- hdr.hist = hist;
-
- % SPM specific bit - unused
- %if hdr.hk.sizeof_hdr > 348,
- % spmf = read_spmf(fid,dime.dim(5));
- % if ~isempty(spmf),
- % hdr.spmf = spmf;
- % end;
- %end;
-
- fclose(fid);
-else,
- hdr = [];
- otherendian = NaN;
- %error(['Problem opening header file (' fopen(fid) ').']);
-end;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function hk = read_hk(fid)
-% read (struct) header_key
-%-----------------------------------------------------------------------
-fseek(fid,0,'bof');
-hk.sizeof_hdr = fread(fid,1,'int32');
-hk.data_type = mysetstr(fread(fid,10,'uchar'))';
-hk.db_name = mysetstr(fread(fid,18,'uchar'))';
-hk.extents = fread(fid,1,'int32');
-hk.session_error = fread(fid,1,'int16');
-hk.regular = mysetstr(fread(fid,1,'uchar'))';
-hk.hkey_un0 = mysetstr(fread(fid,1,'uchar'))';
-if isempty(hk.hkey_un0), error(['Problem reading "hk" of header file (' fopen(fid) ').']); end;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function dime = read_dime(fid)
-% read (struct) image_dimension
-%-----------------------------------------------------------------------
-fseek(fid,40,'bof');
-dime.dim = fread(fid,8,'int16')';
-dime.vox_units = mysetstr(fread(fid,4,'uchar'))';
-dime.cal_units = mysetstr(fread(fid,8,'uchar'))';
-dime.unused1 = fread(fid,1,'int16');
-dime.datatype = fread(fid,1,'int16');
-dime.bitpix = fread(fid,1,'int16');
-dime.dim_un0 = fread(fid,1,'int16');
-dime.pixdim = fread(fid,8,'float')';
-dime.vox_offset = fread(fid,1,'float');
-dime.funused1 = fread(fid,1,'float');
-dime.funused2 = fread(fid,1,'float');
-dime.funused3 = fread(fid,1,'float');
-dime.cal_max = fread(fid,1,'float');
-dime.cal_min = fread(fid,1,'float');
-dime.compressed = fread(fid,1,'int32');
-dime.verified = fread(fid,1,'int32');
-dime.glmax = fread(fid,1,'int32');
-dime.glmin = fread(fid,1,'int32');
-if isempty(dime.glmin), error(['Problem reading "dime" of header file (' fopen(fid) ').']); end;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function hist = read_hist(fid)
-% read (struct) data_history
-%-----------------------------------------------------------------------
-fseek(fid,148,'bof');
-hist.descrip = mysetstr(fread(fid,80,'uchar'))';
-hist.aux_file = mysetstr(fread(fid,24,'uchar'))';
-hist.orient = fread(fid,1,'uchar');
-hist.origin = fread(fid,5,'int16')';
-hist.generated = mysetstr(fread(fid,10,'uchar'))';
-hist.scannum = mysetstr(fread(fid,10,'uchar'))';
-hist.patient_id = mysetstr(fread(fid,10,'uchar'))';
-hist.exp_date = mysetstr(fread(fid,10,'uchar'))';
-hist.exp_time = mysetstr(fread(fid,10,'uchar'))';
-hist.hist_un0 = mysetstr(fread(fid,3,'uchar'))';
-hist.views = fread(fid,1,'int32');
-hist.vols_added = fread(fid,1,'int32');
-hist.start_field= fread(fid,1,'int32');
-hist.field_skip = fread(fid,1,'int32');
-hist.omax = fread(fid,1,'int32');
-hist.omin = fread(fid,1,'int32');
-hist.smax = fread(fid,1,'int32');
-hist.smin = fread(fid,1,'int32');
-if isempty(hist.smin), error(['Problem reading "hist" of header file (' fopen(fid) ').']); end;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function spmf = read_spmf(fid,n)
-% Read SPM specific fields
-% This bit may be used in the future for extending the Analyze header.
-
-fseek(fid,348,'bof');
-mgc = fread(fid,1,'int32'); % Magic number
-if mgc ~= 20020417, spmf = []; return; end;
-
-for j=1:n,
- spmf(j).mat = fread(fid,16,'double'); % Orientation information
- spmf(j).unused = fread(fid,384,'uchar'); % Extra unused stuff
- if length(spmf(j).unused)<384,
- error(['Problem reading "spmf" of header file (' fopen(fid) ').']);
- end;
- spmf(j).mat = reshape(spmf(j).mat,[4 4]);
-end;
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
-function out = mysetstr(in)
-tmp = find(in == 0);
-tmp = min([min(tmp) length(in)]);
-out = setstr([in(1:tmp)' zeros(1,length(in)-(tmp))])';
-return;
-%_______________________________________________________________________
-%_______________________________________________________________________
diff --git a/lib/marsbar-0.44/spm99/spm_write_plane.m b/lib/marsbar-0.44/spm99/spm_write_plane.m
deleted file mode 100644
index e20230c..0000000
--- a/lib/marsbar-0.44/spm99/spm_write_plane.m
+++ /dev/null
@@ -1,121 +0,0 @@
-function V = spm_write_plane(V,A,p)
-% Write a transverse plane of image data.
-% FORMAT V = spm_write_plane(V,A,p)
-% V - data structure containing image information.
-% - see spm_vol for a description.
-% A - the two dimensional image to write.
-% p - the plane number (beginning from 1).
-%
-% VO - (possibly) modified data structure containing image information.
-% It is possible that future versions of spm_write_plane may
-% modify scalefactors (for example).
-%
-%_______________________________________________________________________
-% @(#)spm_write_plane.m 2.19 John Ashburner 03/07/16
-
-if any(V.dim(1:2) ~= size(A)), error('Incompatible image dimensions'); end;
-if p>V.dim(3), error('Plane number too high'); end;
-
-% Write Analyze image by default
-V = write_analyze_plane(V,A,p);
-return;
-%_______________________________________________________________________
-
-%_______________________________________________________________________
-function V = write_analyze_plane(V,A,p)
-
-types = [ 2 4 8 16 64 130 132 136, 512 1024 2048 4096 16384 33280 33792 34816];
-maxval = [2^8-1 2^15-1 2^31-1 Inf Inf 2^7-1 2^16-1 2^32-1, 2^8-1 2^15-1 2^31-1 Inf Inf 2^8-1 2^16-1 2^32-1];
-minval = [ 0 -2^15 -2^31 -Inf -Inf -2^7 0 0, 0 -2^15 -2^31 -Inf -Inf -2^7 0 0];
-intt = [ 1 1 1 0 0 1 1 1, 1 1 1 0 0 1 1 1];
-prec = str2mat('uint8','int16','int32','float','double','int8','uint16','uint32','uint8','int16','int32','float','double','int8','uint16','uint32');
-swapped = [ 0 0 0 0 0 0 0 0, 1 1 1 1 1 1 1 1];
-bits = [ 8 16 32 32 64 8 16 32, 8 16 32 32 64 8 16 32];
-
-dt = find(types==V.dim(4));
-if isempty(dt), error('Unknown datatype'); end;
-
-A = double(A);
-
-% Rescale to fit appropriate range
-if intt(dt),
- A(isnan(A)) = 0;
- mxv = maxval(dt);
- mnv = minval(dt);
- A = round(A*(1/V.pinfo(1)) - V.pinfo(2));
- A(A > mxv) = mxv;
- A(A < mnv) = mnv;
-end;
-
-if ~isfield(V,'private') | ~isfield(V.private,'fid') | isempty(V.private.fid),
- mach = 'native';
- if swapped(dt),
- if spm_platform('bigend'), mach = 'ieee-le'; else, mach = 'ieee-be'; end;
- end;
- [pth,nam,ext] = fileparts(V.fname);
- fname = fullfile(pth,[nam, '.img']);
- fid = fopen(fname,'r+',mach);
- if fid == -1,
- fid = fopen(fname,'w',mach);
- if fid == -1,
- error(['Error opening ' fname '. Check that you have write permission.']);
- end;
- end;
-else,
- if isempty(fopen(V.private.fid)),
- mach = 'native';
- if swapped(dt),
- if spm_platform('bigend'), mach = 'ieee-le'; else, mach = 'ieee-be'; end;
- end;
- V.private.fid = fopen(fname,'r+',mach);
- if V.private.fid == -1,
- error(['Error opening ' fname '. Check that you have write permission.']);
- end;
- end;
- fid = V.private.fid;
-end;
-
-% Seek to the appropriate offset
-datasize = bits(dt)/8;
-off = (p-1)*datasize*prod(V.dim(1:2)) + V.pinfo(3,1);
-fseek(fid,0,'bof'); % A bug in Matlab 6.5 means that a rewind is needed
-if fseek(fid,off,'bof')==-1,
- % Need this because fseek in Matlab does not seek past the EOF
- fseek(fid,0,'bof'); % A bug in Matlab 6.5 means that a rewind is needed
- fseek(fid,0,'eof');
- curr_off = ftell(fid);
- blanks = zeros(off-curr_off,1);
- if fwrite(fid,blanks,'uchar') ~= prod(size(blanks)),
- write_error_message(V.fname);
- error(['Error writing ' V.fname '.']);
- end;
- fseek(fid,0,'bof'); % A bug in Matlab 6.5 means that a rewind is needed
- if fseek(fid,off,'bof') == -1,
- write_error_message(V.fname);
- error(['Error writing ' V.fname '.']);
- return;
- end;
-end;
-
-if fwrite(fid,A,deblank(prec(dt,:))) ~= prod(size(A)),
- write_error_message(V.fname);
- error(['Error writing ' V.fname '.']);
-end;
-
-if ~isfield(V,'private') | ~isfield(V.private,'fid') | isempty(V.private.fid), fclose(fid); end;
-
-return;
-%_______________________________________________________________________
-
-%_______________________________________________________________________
-function write_error_message(q)
-str = {...
- 'Error writing:',...
- ' ',...
- [' ',spm_str_manip(q,'k40d')],...
- ' ',...
- 'Check disk space / disk quota.'};
-spm('alert*',str,mfilename,sqrt(-1));
-
-return;
-%_______________________________________________________________________
diff --git a/lib/marsbar-0.44/spm99/spm_write_vol.m b/lib/marsbar-0.44/spm99/spm_write_vol.m
deleted file mode 100644
index 06d0e11..0000000
--- a/lib/marsbar-0.44/spm99/spm_write_vol.m
+++ /dev/null
@@ -1,80 +0,0 @@
-function V = spm_write_vol(V,Y)
-% Write an image volume to disk, setting scales and offsets as appropriate
-% FORMAT V = spm_write_vol(V,Y)
-% V (input) - a structure containing image volume information (see spm_vol)
-% Y - a one, two or three dimensional matrix containing the image voxels
-% V (output) - data structure after modification for writing.
-%_______________________________________________________________________
-% @(#)spm_write_vol.m 2.9 John Ashburner 03/02/26
-
-if ndims(Y)>3, error('Can only handle a maximum of 3 dimensions.'), end
-
-if ~isfield(V,'pinfo'), V.pinfo = [1,0,0]'; end
-
-dim = [size(Y) 1 1 1];
-if ~all(dim(1:3) == V.dim(1:3)) | (size(V.pinfo,2)~=1 & size(V.pinfo,2)~=dim(3)),
- error('Incompatible dimensions.');
-end
-
-
-% Set scalefactors and offsets
-%-----------------------------------------------------------------------
-dt = V.dim(4); if dt>256, dt = dt/256; end;
-if any(dt == [128+2 128+4 128+8]),
- % Convert to a form that Analyze will support
- dt = dt - 128;
-end;
-s = find(dt == [2 4 8 128+2 128+4 128+8]);
-dmnmx = [0 -2^15 -2^31 -2^7 0 0 ; 2^8-1 2^15-1 2^31-1 2^7-1 2^16 2^32];
-dmnmx = dmnmx(:,s);
-V.pinfo(1,:) = 1;
-V.pinfo(2,:) = 0;
-mxs = zeros(dim(3),1)+NaN;
-mns = zeros(dim(3),1)+NaN;
-if ~isempty(s),
- for p=1:dim(3),
- tmp = double(Y(:,:,p));
- tmp = tmp(isfinite(tmp));
- if ~isempty(tmp),
- mxs(p) = max(tmp);
- mns(p) = min(tmp);
- end;
- end;
-
- if size(V.pinfo,2) ~= 1,
- for p=1:dim(3),
- mx = mxs(p);
- mn = mns(p);
- if ~isfinite(mx), mx = 0; end;
- if ~isfinite(mn), mn = 0; end;
- if mx~=mn,
- V.pinfo(1,p) = (mx-mn)/(dmnmx(2)-dmnmx(1));
- V.pinfo(2,p) = ...
- (dmnmx(2)*mn-dmnmx(1)*mx)/(dmnmx(2)-dmnmx(1));
- else,
- V.pinfo(1,p) = 0;
- V.pinfo(2,p) = mx;
- end;
- end;
- else,
- mx = max(mxs(isfinite(mxs)));
- mn = min(mns(isfinite(mns)));
- if isempty(mx), mx = 0; end;
- if isempty(mn), mn = 0; end;
- if mx~=mn,
- V.pinfo(1,1) = (mx-mn)/(dmnmx(2)-dmnmx(1));
- V.pinfo(2,1) = (dmnmx(2)*mn-dmnmx(1)*mx)/(dmnmx(2)-dmnmx(1));
- else,
- V.pinfo(1,1) = 0;
- V.pinfo(2,1) = mx;
- end;
- end;
-end;
-
-%-Create and write image
-%-----------------------------------------------------------------------
-V = spm_create_vol(V);
-for p=1:V.dim(3),
- V = spm_write_plane(V,Y(:,:,p),p);
-end;
-V = spm_close_vol(V);
diff --git a/lib/marsbar-0.44/todo.txt b/lib/marsbar-0.44/todo.txt
deleted file mode 100644
index b491157..0000000
--- a/lib/marsbar-0.44/todo.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-To do list
-----------
-
-Odd EoI + subset contrast error in MV routine.
-Random effects structure, with import / export etc
-Simple means store for event signal plotting (in case of estimation failure)
diff --git a/requirements.txt b/requirements.txt
index 8e6c176..c8dc86a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,5 @@
# linting
-miss_hit==0.9.30
+miss_hit==0.9.35
pre-commit
# doc
diff --git a/src/atlas/copyAtlasToSpmDir.m b/src/atlas/copyAtlasToSpmDir.m
new file mode 100644
index 0000000..a83abae
--- /dev/null
+++ b/src/atlas/copyAtlasToSpmDir.m
@@ -0,0 +1,69 @@
+function copyAtlasToSpmDir(varargin)
+ %
+ % Copies a given atlas to the SPM atlas directory.
+ %
+ % USAGE::
+ %
+ % copyAtlasToSpmDir(atlas, 'verbose', false)
+ %
+ % :param atlas: Any of ``{'AAL'}``. Defaults to ``'AAL'``
+ % :type atlas: char
+ %
+ % :param verbose: Defaults to ``false``
+ % :type verbose: boolean
+ %
+ %
+
+ % (C) Copyright 2022 CPP ROI developers
+
+ args = inputParser;
+
+ addOptional(args, 'atlas', 'AAL', @ischar);
+ addParameter(args, 'verbose', false, @islogical);
+
+ parse(args, varargin{:});
+
+ atlas = args.Results.atlas;
+ verbose = args.Results.verbose;
+
+ spmAtlasDir = fullfile(spm('dir'), 'atlas');
+ cppRoiAtlasDir = returnAtlasDir();
+
+ switch lower(atlas)
+
+ case 'aal'
+ sourceAtlasImage = fullfile(cppRoiAtlasDir, 'AAL3', 'AAL3v1_1mm.nii.gz');
+ sourceAtlasXml = fullfile(cppRoiAtlasDir, 'AAL3', 'AAL3v1_1mm.xml');
+ end
+
+ targetAtlasImage = fullfile(spmAtlasDir, spm_file(sourceAtlasImage, 'filename'));
+ targetAtlasXml = fullfile(spmAtlasDir, spm_file(sourceAtlasXml, 'filename'));
+
+ atlasPresent = isdir(spmAtlasDir) && ...
+ exist(targetAtlasImage(1:end - 3), 'file') && ...
+ exist(targetAtlasXml, 'file');
+
+ if ~atlasPresent
+ if verbose
+ fprintf('\nCopying atlas "%s" to spm atlas directory:\n\t%s\n', ...
+ atlas, ...
+ spmAtlasDir);
+ end
+ spm_mkdir(spmAtlasDir);
+
+ copyfile(sourceAtlasImage, spmAtlasDir);
+ gunzip(fullfile(spmAtlasDir, '*.nii.gz'));
+ delete(fullfile(spmAtlasDir, '*.nii.gz'));
+
+ copyfile(sourceAtlasXml, spmAtlasDir);
+
+ else
+ if verbose
+ fprintf('\nAtlas "%s" already in spm atlas directory:\n\t%s\n', ...
+ atlas, ...
+ spmAtlasDir);
+ end
+
+ end
+
+end
diff --git a/src/atlas/extractRoiByLabel.m b/src/atlas/extractRoiByLabel.m
index 95520a0..1be4164 100644
--- a/src/atlas/extractRoiByLabel.m
+++ b/src/atlas/extractRoiByLabel.m
@@ -14,6 +14,7 @@
% and ``label`` for the corresponding label
% :type labelStruct: structure
%
+
% (C) Copyright 2021 CPP ROI developers
hdr = spm_vol(sourceImage);
diff --git a/src/atlas/extractRoiFromAtlas.m b/src/atlas/extractRoiFromAtlas.m
index 565cb83..e4a401d 100644
--- a/src/atlas/extractRoiFromAtlas.m
+++ b/src/atlas/extractRoiFromAtlas.m
@@ -16,6 +16,7 @@
% :type roiName: string
% :type hemisphere: string
%
+
% (C) Copyright 2021 CPP ROI developers
if ~ismember(hemisphere, {'L', 'R'})
diff --git a/src/atlas/getAtlasAndLut.m b/src/atlas/getAtlasAndLut.m
index 7c24de5..6e451de 100644
--- a/src/atlas/getAtlasAndLut.m
+++ b/src/atlas/getAtlasAndLut.m
@@ -3,6 +3,7 @@
% Gets the atlas image and the look up table of a given atlas
%
%
+
% (C) Copyright 2021 CPP ROI developers
lut = getLookUpTable(atlasName);
diff --git a/src/atlas/getAtlasFilename.m b/src/atlas/getAtlasFilename.m
index 53489a2..70d471e 100644
--- a/src/atlas/getAtlasFilename.m
+++ b/src/atlas/getAtlasFilename.m
@@ -14,6 +14,7 @@
% PMID: 25452571
% Probabilistic Maps of Visual Topography in Human Cortex
%
+
% (C) Copyright 2021 CPP ROI developers
atlasDir = returnAtlasDir(atlasName);
diff --git a/src/atlas/getLookUpTable.m b/src/atlas/getLookUpTable.m
index c851f60..6dfeaf2 100644
--- a/src/atlas/getLookUpTable.m
+++ b/src/atlas/getLookUpTable.m
@@ -10,6 +10,7 @@
%
% :returns: - :roiLabelLUT: a structure with the fields ``ROI`` and ``label``
%
+
% (C) Copyright 2021 CPP ROI developers
if exist(atlasName, 'file')
diff --git a/src/atlas/labelClusters.m b/src/atlas/labelClusters.m
index 21c8ac8..03ffb01 100644
--- a/src/atlas/labelClusters.m
+++ b/src/atlas/labelClusters.m
@@ -21,6 +21,7 @@
% Adapted from:
% https://en.wikibooks.org/wiki/SPM/How-to#How_to_remove_clusters_under_a_certain_size_in_a_binary_mask?
%
+
% (C) Copyright 2021 CPP ROI developers
default_clusterSize = 0;
diff --git a/src/atlas/unzipAtlas.m b/src/atlas/unzipAtlas.m
index dee8432..5e99567 100644
--- a/src/atlas/unzipAtlas.m
+++ b/src/atlas/unzipAtlas.m
@@ -1,5 +1,6 @@
function unzipAtlas(atlas)
%
+
% (C) Copyright 2021 CPP ROI developers
atlasDir = returnAtlasDir();
diff --git a/src/roi/checkRoiOrientation.m b/src/roi/checkRoiOrientation.m
index c53a7a2..7f73c10 100644
--- a/src/roi/checkRoiOrientation.m
+++ b/src/roi/checkRoiOrientation.m
@@ -10,6 +10,7 @@
% :param imagesToCheck: better if fullfile path
% :type imagesToCheck: string
%
+
% (C) Copyright 2021 CPP ROI developers
% TODO
diff --git a/src/roi/createRoi.m b/src/roi/createRoi.m
index 4e8407f..2d53cdb 100644
--- a/src/roi/createRoi.m
+++ b/src/roi/createRoi.m
@@ -67,6 +67,7 @@
% - ``mask.global.XYZmm``
%
%
+
% (C) Copyright 2021 CPP ROI developers
args = inputParser;
diff --git a/src/roi/createRoiName.m b/src/roi/createRoiName.m
index 0039fee..a208d85 100644
--- a/src/roi/createRoiName.m
+++ b/src/roi/createRoiName.m
@@ -6,6 +6,7 @@
%
% roiName = createRoiName(mask, volumeDefiningImage)
%
+
% (C) Copyright 2022 CPP ROI developers
args = inputParser;
diff --git a/src/roi/getPeakCoordinates.m b/src/roi/getPeakCoordinates.m
index 5e3beb5..255d2e6 100644
--- a/src/roi/getPeakCoordinates.m
+++ b/src/roi/getPeakCoordinates.m
@@ -17,6 +17,7 @@
% :type threshold: numerical
%
%
+
% (C) Copyright 2021 CPP ROI developers
% TODO
diff --git a/src/roi/keepHemisphere.m b/src/roi/keepHemisphere.m
index 187b8a0..4619a56 100644
--- a/src/roi/keepHemisphere.m
+++ b/src/roi/keepHemisphere.m
@@ -13,6 +13,7 @@
% :type hemisphere: string
%
%
+
% (C) Copyright 2021 CPP ROI developers
% TODO change the hemi entity
@@ -45,6 +46,10 @@
hdr.fname = spm_file(inputImage, 'filename', bf.filename);
+ if not(any(vol(:)))
+ warning('This image will be empty:\n\t%s\n');
+ end
+
spm_write_vol(hdr, vol);
outputImage = hdr.fname;
diff --git a/src/roi/plotDataInRoi.m b/src/roi/plotDataInRoi.m
index 8ec3a42..8d31f76 100644
--- a/src/roi/plotDataInRoi.m
+++ b/src/roi/plotDataInRoi.m
@@ -52,6 +52,7 @@
% plotDataInRoi(data, mask);
%
%
+
% (C) Copyright 2022 CPP ROI developers
defaultNbBins = 100;
diff --git a/src/roi/renameNeuroSynth.m b/src/roi/renameNeuroSynth.m
index 0318bca..74d7243 100644
--- a/src/roi/renameNeuroSynth.m
+++ b/src/roi/renameNeuroSynth.m
@@ -16,6 +16,7 @@
% fullfile(pwd, 'space-MNI_label-neurosynthMotion_probseg.nii.gz');
%
%
+
% (C) Copyright 2021 CPP ROI developers
basename = spm_file(inputImage, 'basename');
diff --git a/src/roi/resliceRoiImages.m b/src/roi/resliceRoiImages.m
index a5bbdaa..05d8be6 100644
--- a/src/roi/resliceRoiImages.m
+++ b/src/roi/resliceRoiImages.m
@@ -15,6 +15,7 @@
% :param dryRun: Returns the matlabbatch without running it.
% :type dryRun: logical
%
+
% (C) Copyright 2021 CPP ROI developers
% TODO
diff --git a/src/roi/thresholdToMask.m b/src/roi/thresholdToMask.m
index 9317daa..e46db5c 100644
--- a/src/roi/thresholdToMask.m
+++ b/src/roi/thresholdToMask.m
@@ -16,6 +16,7 @@
%
% :returns: - :outputImage: (string)
%
+
% (C) Copyright 2021 CPP ROI developers
% TODO
diff --git a/src/utils/cppRoiRoot.m b/src/utils/cppRoiRoot.m
index 3f8a82f..f313dd4 100644
--- a/src/utils/cppRoiRoot.m
+++ b/src/utils/cppRoiRoot.m
@@ -6,6 +6,7 @@
% pth = cppRoiRoot()
%
%
+
% (C) Copyright 2022 CPP ROI developers
pth = fullfile(fileparts(mfilename('fullpath')), '..', '..');
diff --git a/src/utils/getClusters.m b/src/utils/getClusters.m
index 88dcbc4..7698514 100644
--- a/src/utils/getClusters.m
+++ b/src/utils/getClusters.m
@@ -11,6 +11,7 @@
%
% See also labelClusters, sortAndLabelClusters
%
+
% (C) Copyright 2021 CPP ROI developers
hdr = spm_vol(inputImage);
diff --git a/src/utils/isBinaryMask.m b/src/utils/isBinaryMask.m
index ad6e1a5..2c1d7f0 100644
--- a/src/utils/isBinaryMask.m
+++ b/src/utils/isBinaryMask.m
@@ -1,5 +1,6 @@
function status = isBinaryMask(image)
%
+
% (C) Copyright 2022 CPP ROI developers
status = true;
diff --git a/src/utils/optimizeSubplotNumber.m b/src/utils/optimizeSubplotNumber.m
index 1b6e92a..276eb5c 100644
--- a/src/utils/optimizeSubplotNumber.m
+++ b/src/utils/optimizeSubplotNumber.m
@@ -1,5 +1,6 @@
function [m, n] = optimizeSubplotNumber(mn)
%
+
% (C) Copyright 2022 CPP ROI developers
% Optimizes the number of subplot to have on a figure
diff --git a/src/utils/removePrefix.m b/src/utils/removePrefix.m
index 0947e14..a42f6a0 100644
--- a/src/utils/removePrefix.m
+++ b/src/utils/removePrefix.m
@@ -1,5 +1,6 @@
function image = removePrefix(image, prefix)
%
+
% (C) Copyright 2019 CPP ROI developers
basename = spm_file(image, 'basename');
diff --git a/src/utils/sortAndLabelClusters.m b/src/utils/sortAndLabelClusters.m
index 2b82f7d..d985c5a 100644
--- a/src/utils/sortAndLabelClusters.m
+++ b/src/utils/sortAndLabelClusters.m
@@ -12,6 +12,7 @@
%
% See also: getClusters, labelClusters
%
+
% (C) Copyright 2021 CPP ROI developers
% refactor with sortAndThresholdClusters
diff --git a/src/utils/sortAndThresholdClusters.m b/src/utils/sortAndThresholdClusters.m
index 5c09ddf..6d38542 100644
--- a/src/utils/sortAndThresholdClusters.m
+++ b/src/utils/sortAndThresholdClusters.m
@@ -1,5 +1,6 @@
function vol = sortAndThresholdClusters(l2, num, clusterSize)
%
+
% (C) Copyright 2020 CPP ROI developers
[n, ni] = sort(histc(l2(:), 0:num), 1, 'descend');
diff --git a/tests/test_copyAtlasToSpmDir.m b/tests/test_copyAtlasToSpmDir.m
new file mode 100644
index 0000000..7f6634e
--- /dev/null
+++ b/tests/test_copyAtlasToSpmDir.m
@@ -0,0 +1,26 @@
+function test_suite = test_copyAtlasToSpmDir %#ok<*STOUT>
+ % (C) Copyright 2022 CPP ROI developers
+ try % assignment of 'localfunctions' is necessary in Matlab >= 2016
+ test_functions = localfunctions(); %#ok<*NASGU>
+ catch % no problem; early Matlab versions can use initTestSuite fine
+ end
+ initTestSuite;
+end
+
+function test_copyAtlasToSpmDir_basic()
+
+ if isGithubCi()
+ return
+ end
+
+ copyAtlasToSpmDir('AAL', 'verbose', false);
+
+ spmAtlasDir = fullfile(spm('dir'), 'atlas');
+
+ targetAtlasImage = fullfile(spmAtlasDir, 'AAL3v1_1mm.nii');
+ targetAtlasXml = fullfile(spmAtlasDir, 'AAL3v1_1mm.xml');
+
+ assertEqual(exist(targetAtlasImage, 'file'), 2);
+ assertEqual(exist(targetAtlasXml, 'file'), 2);
+
+end
diff --git a/version.txt b/version.txt
index 268b033..937cd78 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-v0.3.0
+v0.3.1