Skip to content

Instantly share code, notes, and snippets.

@jccaicedo
Last active December 3, 2023 03:13
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jccaicedo/15e811722fca51e3ae90e8b43057f075 to your computer and use it in GitHub Desktop.
Save jccaicedo/15e811722fca51e3ae90e8b43057f075 to your computer and use it in GitHub Desktop.
# Example instructions to decode ground truth masks in BBBC039
# Masks available at: https://data.broadinstitute.org/bbbc/BBBC039/masks.zip
import skimage.io
import matplotlib.pyplot as plt
import skimage.morphology
# Load one image after uncompressing masks.zip
gt = skimage.io.imread("IXMtest_A02_s1_w1051DAA7C-7042-435F-99F0-1E847D9B42CB.png")
# Keep first channel only
gt = gt[:,:,0]
# Label independent connected components
gt = skimage.morphology.label(gt)
# Display image or use as needed
plt.imshow(gt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment