-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscnplot2.m
77 lines (69 loc) · 2.19 KB
/
scnplot2.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
function scnplot2(C,dim,cnt);
% SCNPLOT plots a 2D or a 3D graph of the SCN with data C
% p=scnplot(C); plots a2D or a 3D graph of the SCN with data C.
% USES UNSCALED DATA, ONLY FOR TIME SERIES
if nargin==2 & dim==3,
C=flipdim(C,3);
S1=size(C,1);
S2=size(C,2);
zmin=min(C(find(C)));
zmax=max(C(find(C)));
% [x y z C]=subvolume(C,[nan floor(2*S1/3) nan nan nan nan ]);
[x y z C]=subvolume(C,[floor(S1/2)+1 nan floor(S2/3)+1 nan nan nan ]);
% p=patch(isosurface(C~=0),'FaceColor',[0.8 0.8 0.8],'EdgeColor','none');
p=patch(isosurface(x,y,z,abs(C),0));
p2=patch(isocaps(x,y,z,abs(C),0));
isocolors(x,y,z,C,p2);
set(p,'FaceColor','red','EdgeColor','none');
set(p2,'FaceColor','flat','EdgeColor','none');
% p2 = patch(isocaps(C~=0),'FaceColor','flat','EdgeColor','none');
% hold on
% isocolors(C,p2);
% isocolors(C,p);
% caxis([zmin zmax])
view(-51,36); daspect([1 1 1]);
axis(volumebounds(x,y,z,C))
% camlight headlight; lighting gouraud;
colorbar;
%%%=============================================================
% S1=size(C,1);
% S2=size(C,2);
% S3=size(C,3);
% zmin=min(C(find(C~=0)));
% zmax=max(C(find(C~=0)));
%
% p3 = slice(C,[S1/4 S1/2 3*S1/4],[],[]);
% % isocolors(C,p2);
% caxis([zmin zmax])
% % view(-17,44); daspect([1 1 1]);
% axis tight
% % camlight; lighting p;
% colorbar;
%%% ABOVE 3D
else
%%%==============================================================
%%% BELOW 2D
S2=size(C,2);
if S2>=3,
C=squeeze(C(:,floor(S2/2),:));
elseif S2==2,
[m,layer]=max([length(find(C(:,1,:))) length(find(C(:,2,:)))]);
C=squeeze(C(:,layer,:));
else
C=squeeze(C);
end
zmin=min(C(find(C~=0)));
zmax=max(C(find(C~=0)));
[p,q]=find(C);
tb=[min(p)-1, max(p)+1, min(q)-1, max(q)+1];
if numel(tb)~=0 && tb(1)<tb(2) && tb(3)<tb(4),
X=C(tb(1):tb(2),tb(3):tb(4))';
lc=length(colormap);
%ceil(256*X)
% X(find(X))=X(find(X))+0.01;
image(ceil(cnt*lc*X))
% cmap=contrast(X);
% colormap(cmap);
% caxis([zmin zmax])
end
end