-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnormProj.m
More file actions
38 lines (28 loc) · 834 Bytes
/
Copy pathnormProj.m
File metadata and controls
38 lines (28 loc) · 834 Bytes
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
function [rgb,w] = normProj(data,lut,T)
[nx,ny,nz] = size(data);
lut = imresize(lut,[nz 3],'bilinear');
rgb = zeros(nx,ny,3,'double');
w = zeros(size(data));
[b,map] = sort(data,3,'descend');
mask = zeros(nx,ny,nz); % look at the axial energy distribution
eTot = sum(b,3);
for k = 1:12
mask(:,:,k) = sum(b(:,:,1:k),3) <= T.*eTot;
temp = mask(:,:,k);
tb = b(:,:,k);
temp(temp == 1) = tb(temp == 1);
mask(:,:,k) = temp;
end
for xx = 1:nx
for yy = 1:ny
w(xx,yy,:) = mask(xx,yy,map(xx,yy,:));
end
end
w = w./repmat(sum(w,3),[1 1 nz]);
for k = 1:nz
temp = w(:,:,k).*(data(:,:,k).^T);
temp = double(linmap(double(temp),double(min(temp(:))),double(max(temp(:))),0,1));
for j = 1:3
rgb(:,:,j) = rgb(:,:,j) + temp.*lut(k,j);
end
end