Giter VIP home page Giter VIP logo

wsi_extractor's Introduction

WSI extractor

Tiling patches or generate patches of whole slide image based on Openslide

Basic Functions

  • Tiling patches and saving them to local disk
  • Generate patch generator for testing of WSIs

Usage

  • First assign the slide_folder(will findslides in subfolder(s)) and save_folder.
slide_folder = os.path.join(os.curdir, 'data', 'slide')
save_folder = os.path.join(os.curdir, 'data', 'patch')
  • For tiling patches and saving them to disks
TileSaving(slide_folder, save_folder, n_procs=4, target_size=512, ds_rate=0, black_thresh=50).tiling()
  • For get patch generation (using in the inference code)
loader_sequence = TestDataGenerator(slide_folder).get_patch_generator(mode='sequence')
for patch_gen, idx in loader_sequence:
    for patch, c, r in patch_gen:
        if patch == -1:
            # patch is black
            pass
        elif patch == -2:
            # patch is blank
            pass
        else:
            # patch is valid
            pass

loader_randomly = TestDataGenerator(slide_folder).get_patch_generator(mode='random')
for patch_gen, idx in loader_randomly:
    for patch, c, r in patch_gen:
        if patch == -1:
            # patch is black
            pass
        elif patch == -2:
            # patch is blank
            pass
        else:
            # patch is valid
            pass

wsi_extractor's People

Contributors

xjw00654 avatar

Stargazers

 avatar matarina avatar  avatar  avatar  avatar  avatar AidenChen avatar WangRui avatar Hanin avatar Darlewo avatar Chaoyang Yan avatar  avatar  avatar

Watchers

 avatar

wsi_extractor's Issues

Mask patches

Can this also be used for generating corresponding patches from the tumor binary mask?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.