You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, thanks for sharing the code. After reading and testing the part of what I need, may I ask why you use different resize function here for image(assume is 3 dimensions) and mask(assume is 4 dimensions)?
For dim=3: you used skimage.transform.resize()
For dim=4: you used scipy.ndimage.zoom() for each channel
I tried the two on the same mask and in the resized masks there are some pixels labeled differently. So I am confused whether this will also trigger some mismatch between image and mask?
def resize(img, new_shape, interpolation=1):
"""
img: [H, W, D, C] or [H, W, D]
new_shape: [H, W, D]
"""
type = 1
if type == 0:
new_img = skt.resize(img, new_shape, order=interpolation, mode='constant', cval=0, clip=True, anti_aliasing=False)
else:
shp = tuple(np.array(new_shape) / np.array(img.shape[:3]))
# Multichannel
data = []
for i in range(img.shape[-1]):
d0 = zoom(img[..., i].astype(np.uint8).copy(), shp, order=interpolation)
data.append(d0.copy())
new_img = np.stack(data, axis=3)
return new_img
The text was updated successfully, but these errors were encountered:
Hi, thanks for sharing the code. After reading and testing the part of what I need, may I ask why you use different resize function here for image(assume is 3 dimensions) and mask(assume is 4 dimensions)?
For dim=3: you used skimage.transform.resize()
For dim=4: you used scipy.ndimage.zoom() for each channel
I tried the two on the same mask and in the resized masks there are some pixels labeled differently. So I am confused whether this will also trigger some mismatch between image and mask?
The text was updated successfully, but these errors were encountered: