source: addicon.m @ 15

Last change on this file since 15 was 15, checked in by tjniskan, 12 years ago
  • Almost all of the functions used by Analyze2 start now with a prefix

"an2_".

  • Deleted some depricated functions.

M analyze2.m
D cellsprintf.m
M spectrsum.m
A an2_cellsprintf.m
D calc_wait.m
A an2_calc_wait.m
D getnicedialoglocation.m
A an2_getnicedialoglocation.m
A an2_iseven.m
D iseven.m
M an2_revision.m
D checkcthdr.m
A an2_checkcthdr.m
D fitmaps.m
A an2_fitmaps.m
A an2_read_nifti.m
D read_nifti.m
D mrdread.m
A an2_mrdread.m
D res2table.m
A an2_copy_roi.m
D copy_roi.m
D helpabout.m
A an2_helpabout.m
A an2_res2table.m
D readfid.m
A an2_readfid.m
D readtab.m
A an2_readtab.m
A an2_killfigs.m
D killfigs.m
D roi_stats.m
A an2_roi_stats.m
A an2_juigetfiles.m
D juigetfiles.m
A an2_gui_defaults.m
D gui_defaults.m
D errordump.m
A an2_errordump.m
D export_gui.m
A an2_export_gui.m
D check_file_exist.m
A an2_check_file_exist.m
A an2_cellwrite.m
D cellwrite.m
A an2_rot3d.m
A an2_wbar.m
D wbar.m
D readfdf.m
D rot3d.m
A an2_readfdf.m
M b1_map.m
D uigetfiles.m
D viewprocpar.m
D cdata.mat
A an2_viewprocpar.m
A an2_cdata.mat
A an2_readprocpar.m
D readprocpar.m
A an2_data_read.m
D data_read.m
D surread.m
D deblanke.m
A an2_surread.m
D maptool.m
D resviewer.m
A an2_resviewer.m
A an2_maptool.m
D mriread.m
A an2_mriread.m
A an2_inputdlg.m
D roi_copy_gui.m
A an2_roi_copy_gui.m
D setdefaultbutton.m
D readctdata.m
A an2_readctdata.m
D readfidprefs.m
A an2_readfidprefs.m
D roi_inputdlg.m
M addicon.m
D imaread.m
A an2_imaread.m
D saveres.m
A an2_saveres.m
D rotateflip.m
A an2_rotateflip.m
D editstack.m
A an2_editstack.m
D plugins.m
A an2_plugins.m
M makelcmraw.m
D write_nifti.m
A an2_write_nifti.m

File size: 1.0 KB
Line 
1function imdata=addicon(filename,fieldname)
2
3
4if ~iscell(filename) && ~iscell(fieldname)
5  filename = {filename};
6  fieldname={fieldname};
7end
8
9% Load icon cdata
10S=load('an2_cdata.mat');
11cdata = S.cdata;
12 
13for ii=1:length(filename) 
14  % Read image
15  imdata = imread(filename{ii});
16  if length(size(imdata))<3
17    continue
18  end
19  imdata=[];
20  imdata = imread(filename{ii},'Backgroundcolor',[236 233 216]./255);
21 
22  % Scale image data and convert to double
23  imdata = double(imdata);
24  sz=size(imdata);
25 
26  % Add NaN:s
27  for jj=1:sz(1)
28    for kk=1:sz(2)
29      if all(squeeze(imdata(jj,kk,:))'==[236 233 216])
30        imdata(jj,kk,1)=NaN;
31        imdata(jj,kk,2)=NaN;
32        imdata(jj,kk,3)=NaN;
33      end
34    end
35  end
36  imdata = imdata/max(max(max(imdata)));
37  %imdata(imdata==0)=NaN;
38 
39  cdata.(fieldname{ii}) = imdata;
40end
41
42
43% Show in figure menubar
44fh=figure('menubar','none');
45fl_names = fieldnames(cdata);
46for ii=1:length(fl_names)
47  if isnumeric(cdata.(fl_names{ii}))
48    h=uipushtool('cdata',cdata.(fl_names{ii}));
49  end
50end
Note: See TracBrowser for help on using the repository browser.

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