Skip to content

Commit

Permalink
Replace int(np.max(label_image)) with len(predictionlist) in generate…
Browse files Browse the repository at this point in the history
…_cluster_image function

* int(np.max(label_image)) could lead to an index out of bounds error, in case where a single timeframe does not contain all labels of the complete timelapse
  • Loading branch information
stefanhahmann committed Dec 14, 2023
1 parent 1d952d7 commit b6e5f60
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion napari_clusters_plotter/_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def generate_cluster_image(label_image, label_list, predictionlist):

# label_list can be removed from method.
predictionlist_new = np.array(predictionlist) + 1
plist = np.zeros(int(np.max(label_image)) + 1, dtype=np.uint32)
plist = np.zeros(len(predictionlist) + 1, dtype=np.uint32)
plist[label_list] = predictionlist_new

predictionlist_new = plist
Expand Down

0 comments on commit b6e5f60

Please sign in to comment.