source: misclib/addicon.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.7 KB
Line 
1function imdata=addicon(filename,fieldname)
2% ADDICON
3%
4% Synopsis:
5%
6% Description:
7%
8% Examples:
9%
10% See also:
11%       
12
13% Copyright (C) 2006 Juha-Pekka Niskanen <Juha-Pekka.Niskanen@uku.fi>
14%
15% Department of Physics, (or Department of Neurobiology)
16% University of Kuopio,
17% P.O. Box 1627,
18% FIN-70211, Kuopio
19% FINLAND
20%
21% This program may be used under the terms of the GNU General Public
22% License version 2.0 as published by the Free Software Foundation
23% and appearing in the file LICENSE.TXT included in the packaging of
24% this program.
25%
26% This program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
27% WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
28
29if ~iscell(filename) && ~iscell(fieldname)
30  filename = {filename};
31  fieldname={fieldname};
32end
33
34% Load icon cdata
35S=load('an2_cdata.mat');
36cdata = S.cdata;
37 
38for ii=1:length(filename) 
39  % Read image
40  imdata = imread(filename{ii});
41  if length(size(imdata))<3
42    continue
43  end
44  imdata=[];
45  imdata = imread(filename{ii},'Backgroundcolor',[236 233 216]./255);
46 
47  % Scale image data and convert to double
48  imdata = double(imdata);
49  sz=size(imdata);
50 
51  % Add NaN:s
52  for jj=1:sz(1)
53    for kk=1:sz(2)
54      if all(squeeze(imdata(jj,kk,:))'==[236 233 216])
55        imdata(jj,kk,1)=NaN;
56        imdata(jj,kk,2)=NaN;
57        imdata(jj,kk,3)=NaN;
58      end
59    end
60  end
61  imdata = imdata/max(max(max(imdata)));
62  %imdata(imdata==0)=NaN;
63 
64  cdata.(fieldname{ii}) = imdata;
65end
66
67
68% Show in figure menubar
69fh=figure('menubar','none');
70fl_names = fieldnames(cdata);
71for ii=1:length(fl_names)
72  if isnumeric(cdata.(fl_names{ii}))
73    h=uipushtool('cdata',cdata.(fl_names{ii}));
74  end
75end
Note: See TracBrowser for help on using the repository browser.

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