annotate toolboxes/MIRtoolbox1.3.2/MIRToolbox/@mirsimatrix/display.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function display(m)
wolffd@0 2 % DISSIMATRIX/DISPLAY display of a dissimilarity matrix
wolffd@0 3 disp(' ');
wolffd@0 4 d = get(m,'Data');
wolffd@0 5 nam = get(m,'Name');
wolffd@0 6 fp = get(m,'FramePos');
wolffd@0 7 cha = get(m,'Channels');
wolffd@0 8 t = get(m,'Title');
wolffd@0 9 tp = get(m,'TrackPos');
wolffd@0 10 tv = get(m,'TrackVal');
wolffd@0 11 pp = get(m,'PeakPos');
wolffd@0 12 g = get(m,'Graph');
wolffd@0 13 b = get(m,'Branch');
wolffd@0 14 for i = 1:length(d)
wolffd@0 15 if iscell(d{i})
wolffd@0 16 d{i} = d{i}{1};
wolffd@0 17 end
wolffd@0 18 l = size(d{1},3); % Number of channels
wolffd@0 19 il = (1-0.15)/l;
wolffd@0 20 figure
wolffd@0 21 for k = 1:l % For each channel
wolffd@0 22 if l>1
wolffd@0 23 subplot('Position',[0.1 (k-1)*il+0.1 0.89 il-0.02])
wolffd@0 24 end
wolffd@0 25 fpi = cell2mat(fp{i});
wolffd@0 26 if size(fpi,1) == 2
wolffd@0 27 fpi = (fpi(1,:,:,:)+fpi(2,:,:,:))/2;
wolffd@0 28 end
wolffd@0 29 if strcmp(m.view,'l')
wolffd@0 30 h = imagesc(fpi,fpi(1:size(d{i},1))-fpi(1),d{i}(:,:,k));
wolffd@0 31 else
wolffd@0 32 h = imagesc(fpi,fpi,d{i}(:,:,k));
wolffd@0 33 end
wolffd@0 34 if not(isempty(g))
wolffd@0 35 hold on
wolffd@0 36 pi = cell(1,size(g{i}{1},2));
wolffd@0 37 for j = 1:size(g{i}{1},2)
wolffd@0 38 pi{j} = sort(pp{i}{1}{j});
wolffd@0 39 end
wolffd@0 40 for j = 1:size(g{i}{1},2)
wolffd@0 41 for h = 1:length(g{i}{1}{1,j,l})
wolffd@0 42 next = g{i}{1}{1,j,l}{h};
wolffd@0 43 if length(next)>1
wolffd@0 44 for n = 1:size(next,1)
wolffd@0 45 plot([fpi(j) fpi(next(n,1))],...
wolffd@0 46 [fpi(pi{j}(h)) - fpi(1), ...
wolffd@0 47 fpi(pi{next(n,1)}(next(n,2))) - fpi(1)],...
wolffd@0 48 'k','LineWidth',1)
wolffd@0 49 %plot([fpi(j) fpi(next(n,1))],...
wolffd@0 50 % [fpi(pi{j}(h)) - fpi(1), ...
wolffd@0 51 % fpi(pi{next(n,1)}(next(n,2))) - fpi(1)],...
wolffd@0 52 % 'w+','MarkerSize',10)
wolffd@0 53 plot([fpi(j) fpi(next(n,1))],...
wolffd@0 54 [fpi(pi{j}(h)) - fpi(1), ...
wolffd@0 55 fpi(pi{next(n,1)}(next(n,2))) - fpi(1)],...
wolffd@0 56 'kx','MarkerSize',10)
wolffd@0 57 end
wolffd@0 58 end
wolffd@0 59 end
wolffd@0 60 end
wolffd@0 61 bi = b{i}{1}{1};
wolffd@0 62 for j = 1:size(bi,1)-1
wolffd@0 63 plot([fpi(bi(j,1)) fpi(bi(j+1,1))],...
wolffd@0 64 [fpi(pi{bi(j,1)}(bi(j,2))) - fpi(1), ...
wolffd@0 65 fpi(pi{bi(j+1,1)}(bi(j+1,2))) - fpi(1)],...
wolffd@0 66 'w','LineWidth',1.5)
wolffd@0 67 plot([fpi(bi(j,1)) fpi(bi(j+1,1))],...
wolffd@0 68 [fpi(pi{bi(j,1)}(bi(j,2))) - fpi(1), ...
wolffd@0 69 fpi(pi{bi(j+1,1)}(bi(j+1,2))) - fpi(1)],...
wolffd@0 70 'w+','MarkerSize',15)
wolffd@0 71 plot([fpi(bi(j,1)) fpi(bi(j+1,1))],...
wolffd@0 72 [fpi(pi{bi(j,1)}(bi(j,2))) - fpi(1), ...
wolffd@0 73 fpi(pi{bi(j+1,1)}(bi(j+1,2))) - fpi(1)],...
wolffd@0 74 'kx','MarkerSize',15)
wolffd@0 75 end
wolffd@0 76 elseif not(isempty(tp)) && not(isempty(tp{i}))
wolffd@0 77 hold on
wolffd@0 78 for k = 1:size(tp{i}{1}{1},1)
wolffd@0 79 prej = 0;
wolffd@0 80 for j = 1:size(tp{i}{1}{1},2)
wolffd@0 81 if tv{i}{1}{1}(k,j)
wolffd@0 82 if prej% && not(isempty(tp(k,j)))
wolffd@0 83 plot([fpi(prej) fpi(j)],...
wolffd@0 84 [fpi(tp{i}{1}{1}(k,prej)) - fpi(1) ...
wolffd@0 85 fpi(tp{i}{1}{1}(k,j)) - fpi(1)],...
wolffd@0 86 'k','LineWidth',1)
wolffd@0 87 plot([fpi(prej) fpi(j)],...
wolffd@0 88 [fpi(tp{i}{1}{1}(k,prej)) - fpi(1) ...
wolffd@0 89 fpi(tp{i}{1}{1}(k,j)) - fpi(1)],...
wolffd@0 90 'w+','MarkerSize',10)
wolffd@0 91 plot([fpi(prej) fpi(j)],...
wolffd@0 92 [fpi(tp{i}{1}{1}(k,prej)) - fpi(1) ...
wolffd@0 93 fpi(tp{i}{1}{1}(k,j)) - fpi(1)],...
wolffd@0 94 'kx','MarkerSize',10)
wolffd@0 95 end
wolffd@0 96 prej = j;
wolffd@0 97 end
wolffd@0 98 end
wolffd@0 99 end
wolffd@0 100 elseif not(isempty(pp)) && not(isempty(pp{i}))
wolffd@0 101 hold on
wolffd@0 102 for k = 1:length(pp{i}{1})
wolffd@0 103 for j = 1:length(pp{i}{1}{k})
wolffd@0 104 plot(fpi(k),fpi(pp{i}{1}{k}(j)) - fpi(1), ...
wolffd@0 105 'w+','MarkerSize',10)
wolffd@0 106 end
wolffd@0 107 end
wolffd@0 108 end
wolffd@0 109 set(gca,'YDir','normal')
wolffd@0 110 if k == l
wolffd@0 111 title(t)
wolffd@0 112 end
wolffd@0 113 if k == 1
wolffd@0 114 xlabel('temporal location of frame centers (in s.)')
wolffd@0 115 end
wolffd@0 116 if k == ceil(l/2)
wolffd@0 117 if strcmp(m.view,'h')
wolffd@0 118 ylabel('relative distance between compared frames (in s.)')
wolffd@0 119 elseif strcmp(m.view,'l')
wolffd@0 120 ylabel('temporal lag (in s.)')
wolffd@0 121 else
wolffd@0 122 ylabel('temporal location of frame centers (in s.)')
wolffd@0 123 end
wolffd@0 124 end
wolffd@0 125 if l > 1
wolffd@0 126 pos = get(gca,'Position');
wolffd@0 127 hfig = axes('Position',[pos(1)-.05 pos(2)+pos(4)/2 .01 .01],...
wolffd@0 128 'Visible','off');
wolffd@0 129 text(0,0,num2str(cha{i}(k)),'FontSize',12,'Color','r')
wolffd@0 130 end
wolffd@0 131 end
wolffd@0 132 fig = get(0,'CurrentFigure');
wolffd@0 133 disp(['The ',t,' related to file ',nam{i},' is displayed in Figure ',num2str(fig),'.']);
wolffd@0 134 end
wolffd@0 135 disp(' ');
wolffd@0 136 drawnow