You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a lot off allocations in the function:
function ensureConectivity1{T,N}(labels::Image{T,N,Array{T,N}})
nlabels = copy(labels)
nlabel = one(T)
for i_2 = 1: size(labels, 2)
for i_1 = 1: size(labels, 1)
if (zero(T) < nlabels[i_1, i_2])
nlabels[i_1, i_2] = nlabel
end
end
end
return nlabels, nlabel - one(T)
end
but if I change the nlabels in the is less statement to labels, all the allocations vanish
The changed function is:
function ensureConectivity1{T,N}(labels::Image{T,N,Array{T,N}})
nlabels = copy(labels)
nlabel = one(T)
for i_2 = 1: size(labels, 2)
for i_1 = 1: size(labels, 1)
if (zero(T) < labels[i_1, i_2])
nlabels[i_1, i_2] = nlabel
end
end
end
return nlabels, nlabel - one(T)
end
I don't see the allocations if the function operates on Array instead of Image:
function ensureConectivity1{T,N}(labels::Array{T,N})
nlabels = copy(labels)
nlabel = one(T)
for i_2 = 1: size(labels, 2)
for i_1 = 1: size(labels, 1)
if (zero(T) < nlabels[i_1, i_2])
nlabels[i_1, i_2] = nlabel
end
end
end
return nlabels, nlabel - one(T)
end
The text was updated successfully, but these errors were encountered:
There is a lot off allocations in the function:
function ensureConectivity1{T,N}(labels::Image{T,N,Array{T,N}})
nlabels = copy(labels)
nlabel = one(T)
for i_2 = 1: size(labels, 2)
for i_1 = 1: size(labels, 1)
if (zero(T) < nlabels[i_1, i_2])
nlabels[i_1, i_2] = nlabel
end
end
end
return nlabels, nlabel - one(T)
end
but if I change the nlabels in the is less statement to labels, all the allocations vanish
The changed function is:
function ensureConectivity1{T,N}(labels::Image{T,N,Array{T,N}})
nlabels = copy(labels)
nlabel = one(T)
for i_2 = 1: size(labels, 2)
for i_1 = 1: size(labels, 1)
if (zero(T) < labels[i_1, i_2])
nlabels[i_1, i_2] = nlabel
end
end
end
return nlabels, nlabel - one(T)
end
I don't see the allocations if the function operates on Array instead of Image:
function ensureConectivity1{T,N}(labels::Array{T,N})
nlabels = copy(labels)
nlabel = one(T)
for i_2 = 1: size(labels, 2)
for i_1 = 1: size(labels, 1)
if (zero(T) < nlabels[i_1, i_2])
nlabels[i_1, i_2] = nlabel
end
end
end
return nlabels, nlabel - one(T)
end
The text was updated successfully, but these errors were encountered: