Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion batchgenerators/augmentations/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,11 +591,12 @@ def resize_segmentation(segmentation, new_shape, order=3):
:return:
'''
tpe = segmentation.dtype
unique_labels = np.unique(segmentation)

assert len(segmentation.shape) == len(new_shape), "new shape must have same dimensionality as segmentation"
if order == 0:
return resize(segmentation.astype(float), new_shape, order, mode="edge", clip=True, anti_aliasing=False).astype(tpe)
else:
unique_labels = np.unique(segmentation)
reshaped = np.zeros(new_shape, dtype=segmentation.dtype)

for i, c in enumerate(unique_labels):
Expand Down