Skip to content

Commit 0ca8106

Browse files
committed
Change variable name to match workflow
1 parent 4c1e7ce commit 0ca8106

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

scripts/datasets/histopathology/check_puma.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010

1111
def check_puma():
12-
from util import ROOT
12+
# from util import ROOT
13+
ROOT = "/media/anwai/ANWAI/data"
1314

1415
loader = get_puma_loader(
1516
path=os.path.join(ROOT, "puma"),

torch_em/data/datasets/histopathology/puma.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,11 @@ def _preprocess_inputs(path, annotations, split):
123123
width, height = 1024, 1024 # roi shape
124124
transform = from_bounds(minx, miny, maxx, maxy, width, height)
125125

126-
class_names = [
126+
# Extract class ids mapped to each class name.
127+
class_ids = [
127128
CLASS_DICT[nuc_class["name"]] for nuc_class in gdf["classification"].apply(lambda x: ast.literal_eval(x))
128129
]
129-
semantic_shapes = ((geom, unique_id) for geom, unique_id in zip(gdf.geometry, class_names))
130+
semantic_shapes = ((geom, unique_id) for geom, unique_id in zip(gdf.geometry, class_ids))
130131
semantic_mask = rasterize(
131132
semantic_shapes, out_shape=(height, width), transform=transform, fill=0, dtype=np.uint8
132133
)

0 commit comments

Comments
 (0)