1 | function t2(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 | |
---|

20 | fit_vals = []; |
---|

21 | if AddInfo.isDataMixed |
---|

22 | nSlices = length(DATA); |
---|

23 | fit_vals = []; |
---|

24 | else |
---|

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 |
---|

39 | end |
---|

40 | |
---|

41 | |
---|

42 | resp = an2_inputdlg('Type TE values','Input dialog',... |
---|

43 | {mat2str(fit_vals)}); |
---|

44 | if isempty(resp) |
---|

45 | return |
---|

46 | else |
---|

47 | resp=resp{1}; |
---|

48 | fit_vals = str2num(resp); |
---|

49 | end |
---|

50 | |
---|

51 | % Prompt for file name |
---|

52 | [fname,fpath,findex]=uiputfile({'*.t2;*.T2;*.s2;*.S2',... |
---|

53 | 'T2-Files (*.t2, *.s2)';... |
---|

54 | '*.*','All Files (*.*)'},... |
---|

55 | 'Save T2-file',[DATA{1}.HDR.fpath, ... |
---|

56 | 't2_map']); |
---|

57 | if isequal(fname,0) || isequal(fpath,0) |
---|

58 | return |
---|

59 | end |
---|

60 | |
---|

61 | % Calculate the map |
---|

62 | [fp,fn,fe]=fileparts([fpath,fname]); |
---|

63 | try |
---|

64 | an2_fitmaps(DATA,'t2',fit_vals,'FileName',[fp,filesep,fn]); |
---|

65 | catch |
---|

66 | errordlg({'Could not calculate T2 maps. The following error was returned',... |
---|

67 | '',lasterr},'modal') |
---|

68 | end |
---|

69 | |
---|