source: plugins/view_kspace.m @ 36

Last change on this file since 36 was 36, checked in by tjniskan, 11 years ago
  • Added option to an2_readfid, an2_data_read and an2_readfidprefs

which allows controlling the output precision. Default is 'double'
(which is more precise), but if you have a very long data changing
this to 'single' will half the memory requirements.

  • Rewrote an2_inputdlg so that it does not depend on Matlab license.
  • Deleted many depricated files.
  • Moved addicon.m under misclib.
  • Added Analyze2 under GNU General Public License (version 2).
  • Added GPL license in license.txt file and added license

notifications in m-files.

M an2_export_gui.m
M analyze2.m
M an2_cellsprintf.m
M an2_getfilefilter.m
M an2_calc_wait.m
D an2_getnicedialoglocation.m
D misclib/uiclear.m
M misclib/spectrsum.m
M misclib/shiftind.m
M misclib/dcm_info.m
D misclib/b1_map.m
A 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
D an2_questerrordlg.m
M an2_readprocpar.m
M an2_fitmaps.m
M an2_read_nifti.m
M an2_data_read.m
A license.txt
M an2_resviewer.m
M an2_maptool.m
M an2_res2table.m
M an2_helpabout.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
D an2_setdefaultbutton.m
M an2_readfid.m
M an2_readfidprefs.m
D addicon.m
M an2_readtab.m
D an2_imaread.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: 3.3 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
[36]14% This function is a part of Analyze 2.0 - A graphical tool for analyzing
15% medical images
[2]16%
[36]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,
21% P.O. Box 1627,
22% FIN-70211, Kuopio
23% FINLAND
24%
25% This program may be used under the terms of the GNU General Public
26% License version 2.0 as published by the Free Software Foundation
27% and appearing in the file LICENSE.TXT included in the packaging of
28% this program.
29%
30% This program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31% WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
[2]32
33
[36]34
[2]35%% Check that the current file is vnmr data
36isVnmr = false;
37if AddInfo.isDataMixed
38  currentSlice = AddInfo.CurrentSlice;
39else
40  currentSlice = 1;
41end
42if isfield(DATA{currentSlice},'DataFormat') && ...
43    strcmpi(DATA{currentSlice}.DataFormat,'vnmr')
44  isVnmr = true;
45elseif isfield(DATA{currentSlice},'HDR') && ...
46    strcmpi(DATA{currentSlice}.HDR.fname,'fid')
47  isVnmr = true;
48end
49if ~isVnmr
50  hh=errordlg('The current file does not contain Varian VNMR data!',...
51              'Error','modal');
52  return
53end
54
55%% Check if the DATA structure already contains k-space. Otherwise the
56%% k-space data has to be read.
57if ~isfield(DATA{currentSlice},'KSPACE') || ...
58    isempty(DATA{currentSlice}.KSPACE)
59 
60  % Get file name and path
61  if isfield(DATA{currentSlice},'HDR') && ...
62      isfield(DATA{currentSlice}.HDR,'fname') && ...
63      isfield(DATA{currentSlice}.HDR,'fpath')
64   
65    fname = DATA{currentSlice}.HDR.fname;
66    fpath = DATA{currentSlice}.HDR.fpath;
67  else
68    hh=errordlg('The current file does not contain Varian VNMR data!',...
69                'Error','modal');
70    return
71  end
72 
73  resp=questdlg({'The k-space data has to be read from the file',...
74                sprintf('"%s"',[fpath,fname]),'',...
75                'Do you want to continue?'},...
76                'Read k-space from file?','OK','Abort','OK');
77  if strcmpi(resp,'Abort')
78    return
79  end
80 
81  %% Check if file exists
82  if exist([fpath,fname],'file')~=2
83    hh=errordlg({'Cannot read file',...
84                ['"',fpath,fname,'"'],'',...
85                'The file does not exist!'},...
86                'File does not exist!','modal');
87    return
88  end
89 
90  %% Read K-space
[17]91  [tmp,msg]=an2_readfid([fpath,fname],'return',2);
[2]92  if isempty(tmp)
93    if iscell(msg)
94      hh==errordlg({'Error while reading file.',...
95                    '',msg{:}},'Error reading file',...
96                   'modal');
97      return
98    else
99      hh==errordlg({'Error while reading file.',...
100                    '',msg},'Error reading file',...
101                   'modal');
102      return
103    end
104  end
105  DATA_NEW = tmp;
106  DATA_NEW.FTDATA = abs(DATA_NEW.KSPACE);
107  DATA_NEW.FTDATA(:,:,:,2) = real(DATA_NEW.KSPACE);
108  DATA_NEW.FTDATA(:,:,:,3) = imag(DATA_NEW.KSPACE);
109  DATA_NEW.KSPACE = [];
110else
[24]111  DATA_NEW = DATA{currentSlice};
[2]112  DATA_NEW.FTDATA = abs(DATA_NEW.KSPACE);
113  DATA_NEW.FTDATA(:,:,:,2) = real(DATA_NEW.KSPACE);
114  DATA_NEW.FTDATA(:,:,:,3) = imag(DATA_NEW.KSPACE);
115  DATA_NEW.KSPACE=[];
116end
117
118%% Open the new DATA-structure in a new Analyze2 window
119analyze2(DATA_NEW)
120
Note: See TracBrowser for help on using the repository browser.

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