source: plugins/write_difference_images.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: 1.6 KB
Line 
1function write_difference_images(DATA,ROI,AddInfo)
2% Analyze2 plugin for writing difference images for ASL
3
4% This function is a part of Analyze 2.0 - 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, (or Department of Neurobiology)
10% University of Kuopio,
11% P.O. Box 1627,
12% FIN-70211, Kuopio
13% FINLAND
14%
15% This program may be used under the terms of the GNU General Public
16% License version 2.0 as published by the Free Software Foundation
17% and appearing in the file LICENSE.TXT included in the packaging of
18% this program.
19%
20% This program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
21% WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
22
23if AddInfo.isDataMixed
24  if rem(length(DATA),2)~=0
25        return
26  end
27 
28  % Ask a directory to save the files
29  dirname = uigetdir;
30  if isequal(dirname,0)
31        return
32  else
33        dirname = [dirname,filesep];
34  end
35 
36  data_new = cell(1,length(DATA)/2);
37  fnames = cell(1,length(DATA)/2);
38  count = 1;
39  for ii=1:2:length(DATA)
40        data_new{count} = DATA{ii}.FTDATA-DATA{ii+1}.FTDATA;
41        [fp1,fn1,fe1]=fileparts(DATA{ii}.HDR.fname);
42        [fp2,fn2,fe2]=fileparts(DATA{ii+1}.HDR.fname);
43        fnames{count}=[fn1,' - ',fn2,'.nii'];
44        count=count+1;
45  end
46 
47 
48  % write *.nii files
49  h=an2_wbar(0,sprintf('Writing File...\n%s',' '));
50  for ii=1:length(data_new)
51        an2_wbar(ii/length(data_new),h,...
52          sprintf('Writing File...\n%s',[dirname,fnames{ii}]))
53        an2_write_nifti(data_new{ii},[dirname,fnames{ii}]);
54  end
55  delete(h)
56else
57  return
58end
Note: See TracBrowser for help on using the repository browser.

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