Welcome to pyslide’s documentation!

The documentation for pyslide is mainly organized by sub-modules.

Contour

contour_valid

def contour_valid(cnt_arr):

“”” Check contour is valid or not.

“”“

contour_to_poly_valid

def contour_to_poly_valid(cnt_arr):

“”” Convert contour to poly valid if not poly valid

“”“

cnt_inside_wsi

def cnt_inside_wsi(cnt_arr, wsi_h, wsi_w):

“”” Determine contour is fully inside whole slide image or not.

“”“

intersect_cnt_wsi

def intersect_cnt_wsi(cnt_arr, wsi_h, wsi_w):

“”” Cutting out the contour part inside the whole slide image.

“”“

cnt_inside_ratio

def cnt_inside_ratio(cnt_arr1, cnt_arr2):

“”” Calculate the ratio between intersection part of cnt_arr1 and cnt_arr2 to cnt_arr1.

“”“

contour_patch_splitting_no_overlap

def contour_patch_splitting_no_overlap(cnt_arr, wsi_h, wsi_w,
patch_size=299, inside_ratio=0.75):

“”” Splitting contour into patches with no overlapping between patches.

“”“

contour_patch_splitting_self_overlap

def contour_patch_splitting_self_overlap(cnt_arr, patch_size=299, inside_ratio=0.75):

“”” Splitting contour into patches with both start and end meeting, with overlapping among patches.

“”“

contour_patch_splitting_half_overlap

def contour_patch_splitting_half_overlap(cnt_arr, wsi_h, wsi_w,
patch_size=448, inside_ratio=0.75):

“”” Splitting patches with half overlap between patches.

“”“

Patch

wsi_coor_splitting

def wsi_coor_splitting(wsi_h, wsi_w, length, overlap_flag=True):

“”” Spltting whole slide image to starting coordinates.

“”“

wsi_stride_splitting

def wsi_stride_splitting(wsi_h, wsi_w, patch_len, stride_len):

“”” Spltting whole slide image to patches by stride.

“”“

mean_patch_val

def mean_patch_val(img):

“”” Mean pixel value of the patch.

“”“

std_patch_val

def std_patch_val(img):

“”” Standard deviation of pixel values in the patch.

“”“

patch_bk_ratio

def patch_bk_ratio(img, bk_thresh=0.80):

“”” Calculate the ratio of background in the image

“”“

Pyramid

create_pyramidal_img

def create_pyramidal_img(img_path, save_dir):

“”” Convert normal image to pyramidal image.

“”“

load_wsi_head

def load_wsi_head(wsi_img_path):

“”” Load the header meta data of whole slide pyramidal image.

“”“

load_wsi_level_img

def load_wsi_level_img(wsi_img_path, level=0):

“”” Load the image from specified level of the whole slide image.

“”“

About pyslide

pyslide is written for whole slide pathology image automatic analysis. We would like to include as much as general utilities for whole slide image analysis. Pull Request and Issue are very welcome!