Changeset 185


Ignore:
Timestamp:
Jan 3, 2012, 12:31:37 PM (6 years ago)
Author:
tjniskan
Message:
  • Added an option for calculating CBF time series from CASL data in ASL-CBF plugin.

M plugins/calc_asl_cbf.m
M aedes_revision.m

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • aedes_revision.m

    r184 r185  
    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/calc_asl_cbf.m

    r184 r185  
    146146end
    147147
     148% Ask if the user wants to calculate a single asl map or time series
     149resp = questdlg(['Calculate an average CBF map (recommended) ',...
     150        'or a CBF time series (i.e. one CBF map / image pair)?'],...
     151  'Calculate an average CBF map?',...
     152  'Average CBF','CBF map / image pair','Cancel',...
     153  'Average CBF');
     154if isempty(resp) || strcmpi(resp,'Cancel')
     155        % Canceled
     156        return
     157end
     158if strcmpi(resp,'Average CBF')
     159        CBFts = false;
     160else
     161        CBFts = true;
     162end
     163
    148164% Convert milliseconds to seconds
    149165%t1map=t1map./1000;
    150166
    151 % Calculate difference fotr ASL
    152 mean_control = mean(controlIm,3);
    153 mean_label = mean(labelIm,3);
    154 asl_map = mean_control-mean_label;
    155 
    156 % Calculate CBF and save it into a MAT-file
    157 cbf_map = (100.*60.*lambda.*asl_map)./(t1map.*2.*mean_control);
     167if CBFts
     168        % Calculate differences and CBF maps
     169        asl_map = zeros(size(controlIm));
     170        cbf_map = zeros(size(controlIm));
     171        for ii=1:size(controlIm,3)
     172                asl_map(:,:,ii) = controlIm(:,:,ii)-labelIm(:,:,ii);
     173                cbf_map(:,:,ii) = (100.*60.*lambda.*asl_map(:,:,ii))./(t1map.*2.*controlIm(:,:,ii));
     174        end
     175
     176else
     177        % Calculate difference fotr ASL
     178        mean_control = mean(controlIm,3);
     179        mean_label = mean(labelIm,3);
     180        asl_map = mean_control-mean_label;
     181       
     182        % Calculate CBF and save it into a MAT-file
     183        cbf_map = (100.*60.*lambda.*asl_map)./(t1map.*2.*mean_control);
     184
     185end
    158186cbf_map(isinf(cbf_map))=0;
    159187cbf_map(isnan(cbf_map))=0;
     
    161189% Ask where to save the resulting CBF map
    162190[fn,fp,fi] = uiputfile({'*.mat','Matlab MAT-Files (*.mat)';...
    163   '*.*','All Files (*.*)'},'Save CBF-map as...',...
    164   [default_path,'asl_cbf_map.mat']);
     191        '*.*','All Files (*.*)'},'Save CBF-map as...',...
     192        [default_path,'asl_cbf_map.mat']);
    165193if isequal(fname,0)
    166   % Canceled
    167   return
     194        % Canceled
     195        return
    168196end
    169197
Note: See TracChangeset for help on using the changeset viewer.

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