source: plugins/show_kspace.m @ 31

Last change on this file since 31 was 31, checked in by tjniskan, 12 years ago
  • Small bug fixes here and there...
  • Fixed the calculation of ADC maps
  • Renamed plugin functions

M analyze2.m
M an2_getfilefilter.m
M an2_revision.m
M an2_fitmaps.m
M an2_data_read.m
M plugins/calc_t1r_map.m
M plugins/show_kspace.m
M plugins/diffimage.m
M plugins/copydataroi_plugin.m
M plugins/snapshot_plugin.m
M plugins/profile_plugin.m
A plugins/calculate_t2_map.m

File size: 2.8 KB
RevLine 
[31]1function view_kspace(DATA,ROI,AddInfo)
2% VIEW_KSPACE - Analyze2 plugin for viewing k-space of vnmr files
[2]3%   
4%
5% Synopsis:
6%
7% Description:
8%
9% Examples:
10%
11% See also:
12%
13
14% Juha-Pekka Niskanen - <Juha-Pekka.Niskanen@uku.fi>  -  08.09.2006
15% Department of Neurology, University of Kuopio
16%
[17]17% Last modified - 28.06.2007 - (J-P N)
[2]18
19
20%% Check that the current file is vnmr data
21isVnmr = false;
22if AddInfo.isDataMixed
23  currentSlice = AddInfo.CurrentSlice;
24else
25  currentSlice = 1;
26end
27if isfield(DATA{currentSlice},'DataFormat') && ...
28    strcmpi(DATA{currentSlice}.DataFormat,'vnmr')
29  isVnmr = true;
30elseif isfield(DATA{currentSlice},'HDR') && ...
31    strcmpi(DATA{currentSlice}.HDR.fname,'fid')
32  isVnmr = true;
33end
34if ~isVnmr
35  hh=errordlg('The current file does not contain Varian VNMR data!',...
36              'Error','modal');
37  return
38end
39
40%% Check if the DATA structure already contains k-space. Otherwise the
41%% k-space data has to be read.
42if ~isfield(DATA{currentSlice},'KSPACE') || ...
43    isempty(DATA{currentSlice}.KSPACE)
44 
45  % Get file name and path
46  if isfield(DATA{currentSlice},'HDR') && ...
47      isfield(DATA{currentSlice}.HDR,'fname') && ...
48      isfield(DATA{currentSlice}.HDR,'fpath')
49   
50    fname = DATA{currentSlice}.HDR.fname;
51    fpath = DATA{currentSlice}.HDR.fpath;
52  else
53    hh=errordlg('The current file does not contain Varian VNMR data!',...
54                'Error','modal');
55    return
56  end
57 
58  resp=questdlg({'The k-space data has to be read from the file',...
59                sprintf('"%s"',[fpath,fname]),'',...
60                'Do you want to continue?'},...
61                'Read k-space from file?','OK','Abort','OK');
62  if strcmpi(resp,'Abort')
63    return
64  end
65 
66  %% Check if file exists
67  if exist([fpath,fname],'file')~=2
68    hh=errordlg({'Cannot read file',...
69                ['"',fpath,fname,'"'],'',...
70                'The file does not exist!'},...
71                'File does not exist!','modal');
72    return
73  end
74 
75  %% Read K-space
[17]76  [tmp,msg]=an2_readfid([fpath,fname],'return',2);
[2]77  if isempty(tmp)
78    if iscell(msg)
79      hh==errordlg({'Error while reading file.',...
80                    '',msg{:}},'Error reading file',...
81                   'modal');
82      return
83    else
84      hh==errordlg({'Error while reading file.',...
85                    '',msg},'Error reading file',...
86                   'modal');
87      return
88    end
89  end
90  DATA_NEW = tmp;
91  DATA_NEW.FTDATA = abs(DATA_NEW.KSPACE);
92  DATA_NEW.FTDATA(:,:,:,2) = real(DATA_NEW.KSPACE);
93  DATA_NEW.FTDATA(:,:,:,3) = imag(DATA_NEW.KSPACE);
94  DATA_NEW.KSPACE = [];
95else
[24]96  DATA_NEW = DATA{currentSlice};
[2]97  DATA_NEW.FTDATA = abs(DATA_NEW.KSPACE);
98  DATA_NEW.FTDATA(:,:,:,2) = real(DATA_NEW.KSPACE);
99  DATA_NEW.FTDATA(:,:,:,3) = imag(DATA_NEW.KSPACE);
100  DATA_NEW.KSPACE=[];
101end
102
103%% Open the new DATA-structure in a new Analyze2 window
104analyze2(DATA_NEW)
105
Note: See TracBrowser for help on using the repository browser.

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