Mentions légales du service

Skip to content
Snippets Groups Projects
Commit c13756d5 authored by DIB Elian's avatar DIB Elian
Browse files

Added function to perform visibility layer interleaving

parent f2f5c5e7
Branches layers
No related tags found
No related merge requests found
function Set = interleave(Set)
%INTERLEAVE Summary of this function goes here
% Detailed explanation goes here
sig = [1,2,4,5,3,6];
[Offset,Color,Label] = SR.SetToFields(Set);
Color = Color{:};
Label = Label{:};
ColSize = size(Color);
ColSizep = ColSize(sig);
ColSizep = [prod(ColSizep(1:4)),ColSizep(5),ColSizep(6)];
LabSize = size(Label);
LabSizep = LabSize(sig);
LabSizep = [prod(LabSizep(1:4)),LabSizep(5),LabSizep(6)];
numLayers = size(Color,6);
Color = permute(Color,sig);
Color = reshape(Color,ColSizep);
Label = permute(Label,sig);
Label = reshape(Label,LabSizep);
for lay = 2:numLayers
cur = Label(:,:,lay )==0 & Label(:,:,lay-1)~=0;
pre = Label(:,:,lay-1)==0 & Label(:,:,lay )~=0;
Color(cur,:,lay ) = Color(cur,:,lay-1);
Color(pre,:,lay-1) = Color(pre,:,lay);
Label(cur,:,lay ) = Label(cur,:,lay-1);
Label(pre,:,lay-1) = Label(pre,:,lay);
end
Color = reshape(Color,ColSize);
Label = reshape(Label,LabSize);
Color = ipermute(Color,sig);
Label = ipermute(Label,sig);
Color = {Color};
Label = {Label};
Set = SR.FieldsToSet(Offset,Color,Label);
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment