Skip to content

Commit

Permalink
no nan in ct assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasmueboe committed Jul 15, 2024
1 parent ea4cfdf commit 77aea86
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/KDE.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,17 @@ function calculatecosinesim(
map(x -> findcelltypescore(x, similaritycorrection), eachslice(cosine; dims=(1, 2)))
)

# set empty pixels to zero (otherwise there might be random results)
empty = iszero.(kde_norm)
cosine[empty] .= 0
score[empty] .= 0
celltype[empty] .= 0

@. kde_norm = sqrt(kde_norm)
cosine ./= kde_norm
score ./= kde_norm

# set empty pixels to zero (to avoid nan and "random" celltype)
cosine[empty] .= 0
score[empty] .= 0
celltype[empty] .= 0

return celltype, cosine, score
end

Expand Down

0 comments on commit 77aea86

Please sign in to comment.