Skip to content

Commit

Permalink
apply guard, check bin index is within range prior to indexing in to …
Browse files Browse the repository at this point in the history
…histogram
  • Loading branch information
sjswerdloff committed Oct 21, 2023
1 parent ed39a95 commit 0b8bac1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/View/mainpage/WindowingSlider.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ def initialise_density_histogram(self):
p = min(pixel, WindowingSlider.MAX_PIXEL_VALUE)
p = max(p, 0)
p = round(p)
self.densities[s][p] += 1
if p>=0 and p < WindowingSlider.MAX_PIXEL_VALUE:
self.densities[s][p] += 1
max_value = max(self.densities[s])
min_value = min(self.densities[s])
avg_value = np.average(self.densities[s])
Expand Down

0 comments on commit 0b8bac1

Please sign in to comment.