Changeset 90


Ignore:
Timestamp:
Sep 9, 2009, 1:31:18 PM (10 years ago)
Author:
tjniskan
Message:
  • Modified the fMRI plugin to show trends over the ROI time series and

the time series are now plotted in one figure instead of separate
figures.

M plugins/fmri_plugins/basic_fmri_analysis.m
M aedes_revision.m

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • aedes_revision.m

    r89 r90  
    9393% bash-script every time it is called so that this file "aedes_revision.m" is
    9494% always in the list of committed files. DO NOT EDIT THE NEXT LINE!!!
    95 % - SVN Hook -
     95% - Svn Hook -
  • plugins/fmri_plugins/basic_fmri_analysis.m

    r82 r90  
    112112  nScans = size(DATA{1}.FTDATA,4);
    113113  fprintf(1,'---------------------------------------\n');
     114  fh=figure;
     115  if length(ROI)<=3
     116    nRows = length(ROI);
     117    nCols=1;
     118  elseif length(ROI)==4
     119    nRows = 2;
     120    nCols=2;
     121  elseif length(ROI)<10
     122    nRows = 3;
     123    nCols = ceil(length(ROI)/nRows);
     124  else
     125    nRows = 4;
     126    nCols = ceil(length(ROI)/nRows);
     127  end
    114128  for kk=1:length(ROI)
    115129   
     
    129143   
    130144    z_norm = (z./th(2)-1)*100;
    131     z_hat_norm = (z_hat./th(2)-1)*100;
     145    %z_hat_norm = (z_hat./th(2)-1)*100;
     146   
     147    z_hat_norm=aedes_trendest(double(z_norm),10);
    132148   
    133149    % Normalize raw timeseries to bold-%
     
    135151   
    136152    % Plot results
    137     figure;
    138     ax=axes;
     153    ax=subplot(nRows,nCols,kk,'align','parent',fh);
    139154    line(1:length(z),z_norm,'color','k',...
    140155      'parent',ax);
     
    142157      'color','r','linewidth',2,'parent',ax);
    143158    title(['Time series for ROI: ',ROI(kk).label])
    144     ylabel('BOLD-%');
     159    ylabel(ax,'BOLD-%');
    145160    set(ax,'xlim',[0 length(z)],...
    146161      'ylim',[min(z_norm)-min(z_norm)*0.05 ...
    147162      max(z_norm)+max(z_norm)*0.05]);
     163    for ii=1:length(new_onset)
     164      xdata = [new_onset(ii) new_onset(ii)+new_durat(ii) ...
     165        new_onset(ii)+new_durat(ii) new_onset(ii)];
     166      tmp = get(ax,'ylim');
     167      ydata = [tmp(1) tmp(1) tmp(2) tmp(2)];
     168      patch('parent',ax,...
     169        'xdata',xdata,'ydata',ydata,'FaceColor','r',...
     170        'FaceAlpha',0.3,'LineStyle','none');
     171    end
    148172   
    149173    fprintf(1,'BOLD-%% %s: %.3f\n',ROI(kk).label,bold_prc);
     
    166190 
    167191  z_norm_max = (z_max./th_max(2)-1)*100;
    168   z_hat_norm_max = (z_hat_max./th_max(2)-1)*100;
     192  z_hat_norm_max=aedes_trendest(double(z_norm_max),10);
     193  %z_hat_norm_max = (z_hat_max./th_max(2)-1)*100;
    169194 
    170195  z_norm_min = (z_min./th_min(2)-1)*100;
    171   z_hat_norm_min= (z_hat_min./th_min(2)-1)*100;
     196  z_hat_norm_min=aedes_trendest(double(z_norm_min),10);
     197  %z_hat_norm_min= (z_hat_min./th_min(2)-1)*100;
    172198 
    173199  % Plot results
    174200  figure;
    175   ax1=subplot(2,1,1);
     201  ax1=subplot(2,1,1,'align');
    176202  line(1:length(z_max),z_norm_max,'color','k',...
    177203    'parent',ax1);
     
    183209    'ylim',[min(z_norm_max)-min(z_norm_max)*0.05 ...
    184210    max(z_norm_max)+max(z_norm_max)*0.05]);
    185  
    186   ax2=subplot(2,1,2);
     211
     212  ax2=subplot(2,1,2,'align');
    187213  line(1:length(z_min),z_norm_min,'color','k',...
    188214    'parent',ax2);
     
    194220    'ylim',[min(z_norm_min)-min(z_norm_min)*0.05 ...
    195221    max(z_norm_min)+max(z_norm_min)*0.05]);
     222 
     223  for ii=1:length(new_onset)
     224    xdata = [new_onset(ii) new_onset(ii)+new_durat(ii) ...
     225      new_onset(ii)+new_durat(ii) new_onset(ii)];
     226    tmp = get(ax1,'ylim');
     227    ydata = [tmp(1) tmp(1) tmp(2) tmp(2)];
     228    patch('parent',ax1,...
     229      'xdata',xdata,'ydata',ydata,'FaceColor','r',...
     230      'FaceAlpha',0.3,'LineStyle','none');
     231    tmp = get(ax2,'ylim');
     232    ydata = [tmp(1) tmp(1) tmp(2) tmp(2)];
     233    patch('parent',ax2,...
     234      'xdata',xdata,'ydata',ydata,'FaceColor','r',...
     235      'FaceAlpha',0.3,'LineStyle','none');
     236  end
    196237 
    197238  % Print percents to command window
Note: See TracChangeset for help on using the changeset viewer.

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