 Timestamp:
 Jan 3, 2012, 12:31:37 PM (7 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

plugins/calc_asl_cbf.m
r184 r185 146 146 end 147 147 148 % Ask if the user wants to calculate a single asl map or time series 149 resp = 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'); 154 if isempty(resp)  strcmpi(resp,'Cancel') 155 % Canceled 156 return 157 end 158 if strcmpi(resp,'Average CBF') 159 CBFts = false; 160 else 161 CBFts = true; 162 end 163 148 164 % Convert milliseconds to seconds 149 165 %t1map=t1map./1000; 150 166 151 % Calculate difference fotr ASL 152 mean_control = mean(controlIm,3); 153 mean_label = mean(labelIm,3); 154 asl_map = mean_controlmean_label; 155 156 % Calculate CBF and save it into a MATfile 157 cbf_map = (100.*60.*lambda.*asl_map)./(t1map.*2.*mean_control); 167 if 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 176 else 177 % Calculate difference fotr ASL 178 mean_control = mean(controlIm,3); 179 mean_label = mean(labelIm,3); 180 asl_map = mean_controlmean_label; 181 182 % Calculate CBF and save it into a MATfile 183 cbf_map = (100.*60.*lambda.*asl_map)./(t1map.*2.*mean_control); 184 185 end 158 186 cbf_map(isinf(cbf_map))=0; 159 187 cbf_map(isnan(cbf_map))=0; … … 161 189 % Ask where to save the resulting CBF map 162 190 [fn,fp,fi] = uiputfile({'*.mat','Matlab MATFiles (*.mat)';... 163 164 191 '*.*','All Files (*.*)'},'Save CBFmap as...',... 192 [default_path,'asl_cbf_map.mat']); 165 193 if isequal(fname,0) 166 167 194 % Canceled 195 return 168 196 end 169 197
Note: See TracChangeset
for help on using the changeset viewer.