okunator commited on
Commit
8e8bf58
·
verified ·
1 Parent(s): ae3e9ac

Add standalone mask examples on black backgrounds

Browse files
Files changed (3) hide show
  1. README.md +39 -0
  2. manifest.json +6 -2
  3. masks.png +3 -0
README.md CHANGED
@@ -169,6 +169,45 @@ plt.show()
169
 
170
  Each row shows the colour image and its marked nuclei.
171
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
172
  ## Preparation and validation
173
 
174
  The [original PanNuke masks](https://warwick.ac.uk/fac/cross_fac/tia/data/pannuke/) store each cell class separately. These were combined into `inst` and `type`, keeping every nucleus and assigning new nucleus numbers within each image. Where source masks overlap, the lower class number wins. Image size and colour values are unchanged.
 
169
 
170
  Each row shows the colour image and its marked nuclei.
171
 
172
+ Two examples without the image underneath. Black marks background; bright instance colours distinguish objects, not cell types. Class colours match the overlay examples above.
173
+
174
+ ```python
175
+ from skimage.color import label2rgb
176
+
177
+ instance_colors = [
178
+ (1, 0.85, 0.2),
179
+ (0.2, 1, 1),
180
+ (1, 0.3, 0.8),
181
+ (0.5, 1, 0.2),
182
+ (0.65, 0.55, 1),
183
+ ]
184
+ mask_samples = samples.to_dicts()
185
+ mask_samples = [mask_samples[0], mask_samples[-1]]
186
+ mask_layers = [("inst", "Nucleus instances"), ("type", "Nucleus classes")]
187
+ mask_fig, mask_axes = plt.subplots(2, 2, figsize=(6.4, 8))
188
+ for row_axes, sample in zip(mask_axes, mask_samples):
189
+ for column, (ax, (key, title)) in enumerate(zip(row_axes, mask_layers)):
190
+ labels = read_png(sample[key])
191
+ if key == "type":
192
+ pixels = nucleus_colors[labels]
193
+ else:
194
+ pixels = label2rgb(
195
+ labels, colors=instance_colors, bg_label=0, bg_color=(0, 0, 0)
196
+ )
197
+ ax.imshow(pixels, interpolation="nearest")
198
+ ax.set_axis_off()
199
+ label = sample["id"]
200
+ row_axes[0].text(0, 1.02, label, transform=row_axes[0].transAxes, fontsize=8)
201
+ for ax, (_, title) in zip(mask_axes[0], mask_layers):
202
+ ax.set_title(title, fontsize=10, pad=18)
203
+ mask_fig.subplots_adjust(
204
+ left=0.01, right=0.99, bottom=0.02, top=0.94, hspace=0.16, wspace=0.03
205
+ )
206
+ plt.show()
207
+ ```
208
+
209
+ ![Two examples of the annotation masks without image backgrounds](masks.png)
210
+
211
  ## Preparation and validation
212
 
213
  The [original PanNuke masks](https://warwick.ac.uk/fac/cross_fac/tia/data/pannuke/) store each cell class separately. These were combined into `inst` and `type`, keeping every nucleus and assigning new nucleus numbers within each image. Where source masks overlap, the lower class number wins. Image size and colour values are unchanged.
manifest.json CHANGED
@@ -136,12 +136,16 @@
136
  ],
137
  "documentation": {
138
  "README.md": {
139
- "sha256": "f08df51a208775da69a4b3fee57c8e9d3eff489318dc6ea81f0619fee4d49b08",
140
- "bytes": 6288
141
  },
142
  "examples.png": {
143
  "sha256": "d281d4048618bcb91a1b8d919c70638f28778f8267b4d1e5ff98f914159a7cb2",
144
  "bytes": 394767
 
 
 
 
145
  }
146
  }
147
  }
 
136
  ],
137
  "documentation": {
138
  "README.md": {
139
+ "sha256": "0a3cab01cdf4c42212239be4bbb6b0314b0702ab6b7a74377e39418b85817580",
140
+ "bytes": 7708
141
  },
142
  "examples.png": {
143
  "sha256": "d281d4048618bcb91a1b8d919c70638f28778f8267b4d1e5ff98f914159a7cb2",
144
  "bytes": 394767
145
+ },
146
+ "masks.png": {
147
+ "sha256": "4ca487b5e39d90d957761bd013c711760be5e0882a297bb4339f49c7eda8b3da",
148
+ "bytes": 31208
149
  }
150
  }
151
  }
masks.png ADDED

Git LFS Details

  • SHA256: 4ca487b5e39d90d957761bd013c711760be5e0882a297bb4339f49c7eda8b3da
  • Pointer size: 130 Bytes
  • Size of remote file: 31.2 kB