Skip to content

Commit e80231d

Browse files
authored
Merge pull request #23 from Kainmueller-Lab/pannuke
small clean ups
2 parents 6f18c66 + 0301caa commit e80231d

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/bio_image_datasets/pannuke.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import os
2-
import h5py
32
import numpy as np
43
from bio_image_datasets.dataset import Dataset
54
from skimage.measure import label as relabel
@@ -160,7 +159,7 @@ def prepare_semantic_masks(self, masks):
160159
Args:
161160
masks (np.array): B x H x W x C
162161
"""
163-
# reverse order of last dim of masks
162+
# reverse order of last dim of masks to adhere to class mapping specified in mapping_dict
164163
masks = np.flip(masks, axis=-1)
165164
semantic_masks = np.argmax(masks, -1)
166165
return semantic_masks
@@ -172,7 +171,7 @@ def prepare_instance_masks(self, masks):
172171
Args:
173172
masks (np.array): B x H x W x C
174173
"""
175-
# reverse order of last dim of masks
174+
# reverse order of last dim of masks to adhere to class mapping specified in mapping_dict
176175
instance_masks = np.max(masks[..., :-1], -1)
177176
# iterate over first dimension and use relabel on each individual tile
178177
for i in range(instance_masks.shape[0]):

tests/test_pannuke_dataset.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from bio_image_datasets.pannuke import PanNukeDataset, mapping_dict
22
import os
3-
import h5py
43
import numpy as np
54
import tempfile
65

0 commit comments

Comments
 (0)