source: plugins/calculate_t2_map.m @ 74

Last change on this file since 74 was 45, checked in by tjniskan, 11 years ago
  • Changed a small thing in license notices

M an2_export_gui.m
M an2_cellsprintf.m
M an2_getfilefilter.m
M an2_calc_wait.m
M an2_smiswrite.m
M misclib/spectrsum.m
M misclib/shiftind.m
M misclib/nifti4dto3d.m
M misclib/nifti3dto4d.m
M misclib/dcm_info.m
M misclib/addicon.m
M misclib/makelcmraw.m
M an2_check_file_exist.m
M an2_iseven.m
M an2_cellwrite.m
M an2_wbar.m
M an2_rot3d.m
M an2_readfdf.m
M an2_revision.m
M an2_viewprocpar.m
M an2_checkcthdr.m
M an2_readprocpar.m
M an2_fitmaps.m
M an2_read_nifti.m
M an2_data_read.m
M an2_smisread.m
M an2_resviewer.m
M an2_maptool.m
M aedes.m
M an2_helpabout.m
M an2_res2table.m
M an2_copy_roi.m
M plugins/save_roi_as_mask.m
M plugins/write_difference_images.m
M plugins/plot_profile.m
M plugins/calculate_t2_map.m
M plugins/calculate_t1r_map.m
M plugins/view_kspace.m
M plugins/copy_data_to_workspace.m
M plugins/take_snapshot.m
M an2_inputdlg.m
M an2_roi_copy_gui.m
M an2_readctdata.m
M an2_readfid.m
M an2_readfidprefs.m
M an2_readtab.m
M an2_check_updates.m
M an2_killfigs.m
M an2_roi_stats.m
M an2_saveres.m
M an2_rotateflip.m
M an2_juigetfiles.m
M an2_gui_defaults.m
M an2_editstack.m
M an2_errordump.m
M an2_update.m
M an2_write_nifti.m

File size: 2.2 KB
Line 
1function calculate_t2_map(DATA,ROI,AddInfo)
2% This Aedes plugin calculates T2 map
3
4% This function is a part of Aedes - A graphical tool for analyzing
5% medical images
6%
7% Copyright (C) 2006 Juha-Pekka Niskanen <Juha-Pekka.Niskanen@uku.fi>
8%
9% Department of Physics, Department of Neurobiology
10% University of Kuopio, FINLAND
11%
12% This program may be used under the terms of the GNU General Public
13% License version 2.0 as published by the Free Software Foundation
14% and appearing in the file LICENSE.TXT included in the packaging of
15% this program.
16%
17% This program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18% WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19
20fit_vals = [];
21if AddInfo.isDataMixed
22  nSlices = length(DATA);
23  fit_vals = [];
24else
25  nSlices = size(DATA{1}.FTDATA,3);
26 
27  % Try to get fit values from PROCPAR
28  if isfield(DATA{1},'PROCPAR') && ~isempty(DATA{1}.PROCPAR) && ...
29        isfield(DATA{1}.PROCPAR,'ne')
30   
31    if DATA{1}.PROCPAR.ne==8
32        fit_vals=cumsum(ones(1,6)*DATA{1}.PROCPAR.te).*1000;
33        nSlices = 6;
34        DATA{1}.FTDATA = DATA{1}.FTDATA(:,:,1:6);
35    else
36        fit_vals=DATA{1}.PROCPAR.te.*1000;
37    end
38  end
39end
40
41% If fit values could not be determined, prompt user
42%done = false;
43%while ~done
44  resp = an2_inputdlg('Type TE values','Input dialog',...
45        {mat2str(fit_vals)});
46  if isempty(resp)
47        return
48  else
49        resp=resp{1};
50        fit_vals = str2num(resp);
51%       if length(fit_vals)<2 || rem(nSlices,length(fit_vals))~=0
52%         h=errordlg('Number of time to echo values does not match with the data size!',...
53%               'TE number mismatch','modal');
54%         uiwait(h)
55%       else
56%         done=true;
57%       end
58  end
59%end
60
61% Prompt for file name
62[fname,fpath,findex]=uiputfile({'*.t2;*.T2;*.s2;*.S2',...
63                    'T2-Files (*.t2, *.s2)';...
64                    '*.*','All Files (*.*)'},...
65                               'Save T2-file',[DATA{1}.HDR.fpath, ...
66                    't2_map']);
67if isequal(fname,0) || isequal(fpath,0)
68  return
69end
70
71% Calculate the map
72[fp,fn,fe]=fileparts([fpath,fname]);
73try
74  an2_fitmaps(DATA,'t2',fit_vals,'FileName',[fp,filesep,fn]);
75catch
76  errordlg({'Could not calculate maps. The following error was returned',...
77           '',lasterr},'modal')
78end
79
80
Note: See TracBrowser for help on using the repository browser.

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