Chris Oswald commited on
Commit ·
49b2bed
1
Parent(s): 745e2d8
debugging
Browse files75 unmodified lines76777879808182838485868788423 unmodified lines51251351451551651751851952052175 unmodified linesif image.shape[0] < image.shape[2]:image = np.transpose(image, axes=[1, 2, 0])# Resize imageorder = 0 if nearest_neighbor_interpolation else 1image = skimage.transform.resize(image, resize_shape, order=order)# Rescale to UInt8 type (required for PyArrow and PIL)image = skimage.img_as_ubyte(image)return image# Define constantsMIN_IVD = 0423 unmodified linesmask_array_standardized = np.array(mask_array_original, dtype='uint8')# Convert .mha mask to standardized numeric arraymask_array_standardized = standardize_3D_image(mask_array_standardized,resize_shape,nearest_neighbor_interpolation=True,)# Extract overview data corresponding to image75 unmodified lines767778798081828384858687888990919293949596979899100101102103104105106423 unmodified lines53053153253353453553653753875 unmodified linesif image.shape[0] < image.shape[2]:image = np.transpose(image, axes=[1, 2, 0])# Resize imageimage = skimage.transform.resize(image, resize_shape)# Rescale to UInt8 type (required for PyArrow and PIL)image = skimage.img_as_ubyte(image)return imagedef standardize_3D_mask(mask: np.ndarray,resize_shape: Tuple[int, int, int],) -> np.ndarray:"""Aligns dimensions of image to be (height, width, channels); resizesimages to values specified in resize_shape using nearest neighbor interpolation;and rescales pixel values to Uint8."""# Align height, width, channel dimsif mask.shape[0] < mask.shape[2]:mask = np.transpose(mask, axes=[1, 2, 0])# Resize maskmask = skimage.transform.resize(mask,resize_shape,order=0,preserve_range=True,)# Rescale to UInt8 type (required for PyArrow and PIL)mask = skimage.img_as_ubyte(mask)return mask# Define constantsMIN_IVD = 0423 unmodified linesmask_array_standardized = np.array(mask_array_original, dtype='uint8')# Convert .mha mask to standardized numeric arraymask_array_standardized = standardize_3D_mask(mask_array_standardized,resize_shape,)# Extract overview data corresponding to image
SPIDER.py+22-5