source: plugins/view_kspace.m @ 39

Last change on this file since 39 was 39, checked in by tjniskan, 11 years ago
  • Added "Recent Files" quick access menu in File-menu
  • Fixed a bug in plugins/copy_data_to_workspace.m that made writing a

new name for a variable difficult

  • Fixed a bug in the file prefix editbox in an2_export_gui.m
  • Changed references to Analyze 2.0 in all license notices to Aedes.

The name change should now be complete...

M an2_export_gui.m
M an2_cellsprintf.m
M an2_calc_wait.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_resviewer.m
M an2_maptool.m
M aedes.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_update.m
M an2_write_nifti.m

File size: 3.3 KB
Line 
1function view_kspace(DATA,ROI,AddInfo)
2% VIEW_KSPACE - Aedes plugin for viewing k-space of vnmr files
3%   
4%
5% Synopsis:
6%
7% Description:
8%
9% Examples:
10%
11% See also:
12%
13
14% This function is a part of Aedes - A graphical tool for analyzing
15% medical images
16%
17% Copyright (C) 2006 Juha-Pekka Niskanen <Juha-Pekka.Niskanen@uku.fi>
18%
19% Department of Physics, (or Department of Neurobiology)
20% University of Kuopio, FINLAND
21%
22% This program may be used under the terms of the GNU General Public
23% License version 2.0 as published by the Free Software Foundation
24% and appearing in the file LICENSE.TXT included in the packaging of
25% this program.
26%
27% This program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28% WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29
30
31
32%% Check that the current file is vnmr data
33isVnmr = false;
34if AddInfo.isDataMixed
35  currentSlice = AddInfo.CurrentSlice;
36else
37  currentSlice = 1;
38end
39if isfield(DATA{currentSlice},'DataFormat') && ...
40    strcmpi(DATA{currentSlice}.DataFormat,'vnmr')
41  isVnmr = true;
42elseif isfield(DATA{currentSlice},'HDR') && ...
43    strcmpi(DATA{currentSlice}.HDR.fname,'fid')
44  isVnmr = true;
45end
46if ~isVnmr
47  hh=errordlg('The current file does not contain Varian VNMR data!',...
48              'Error','modal');
49  return
50end
51
52%% Check if the DATA structure already contains k-space. Otherwise the
53%% k-space data has to be read.
54if ~isfield(DATA{currentSlice},'KSPACE') || ...
55    isempty(DATA{currentSlice}.KSPACE)
56 
57  % Get file name and path
58  if isfield(DATA{currentSlice},'HDR') && ...
59      isfield(DATA{currentSlice}.HDR,'fname') && ...
60      isfield(DATA{currentSlice}.HDR,'fpath')
61   
62    fname = DATA{currentSlice}.HDR.fname;
63    fpath = DATA{currentSlice}.HDR.fpath;
64  else
65    hh=errordlg('The current file does not contain Varian VNMR data!',...
66                'Error','modal');
67    return
68  end
69 
70  resp=questdlg({'The k-space data has to be read from the file',...
71                sprintf('"%s"',[fpath,fname]),'',...
72                'Do you want to continue?'},...
73                'Read k-space from file?','OK','Abort','OK');
74  if strcmpi(resp,'Abort')
75    return
76  end
77 
78  %% Check if file exists
79  if exist([fpath,fname],'file')~=2
80    hh=errordlg({'Cannot read file',...
81                ['"',fpath,fname,'"'],'',...
82                'The file does not exist!'},...
83                'File does not exist!','modal');
84    return
85  end
86 
87  %% Read K-space
88  [tmp,msg]=an2_readfid([fpath,fname],'return',2);
89  if isempty(tmp)
90    if iscell(msg)
91      hh==errordlg({'Error while reading file.',...
92                    '',msg{:}},'Error reading file',...
93                   'modal');
94      return
95    else
96      hh==errordlg({'Error while reading file.',...
97                    '',msg},'Error reading file',...
98                   'modal');
99      return
100    end
101  end
102  DATA_NEW = tmp;
103  DATA_NEW.FTDATA = abs(DATA_NEW.KSPACE);
104  DATA_NEW.FTDATA(:,:,:,2) = real(DATA_NEW.KSPACE);
105  DATA_NEW.FTDATA(:,:,:,3) = imag(DATA_NEW.KSPACE);
106  DATA_NEW.KSPACE = [];
107else
108  DATA_NEW = DATA{currentSlice};
109  DATA_NEW.FTDATA = abs(DATA_NEW.KSPACE);
110  DATA_NEW.FTDATA(:,:,:,2) = real(DATA_NEW.KSPACE);
111  DATA_NEW.FTDATA(:,:,:,3) = imag(DATA_NEW.KSPACE);
112  DATA_NEW.KSPACE=[];
113end
114
115%% Open the new DATA-structure in a new Aedes window
116aedes(DATA_NEW)
117
Note: See TracBrowser for help on using the repository browser.

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