Coder Social home page Coder Social logo

smujiang / wsipenmarkingremoval Goto Github PK

View Code? Open in Web Editor NEW
15.0 2.0 1.0 14.11 MB

Remove pen-marking annotations on whole slide images(WSIs) for data achiving.

License: MIT License

Python 95.06% Shell 4.94%
image-normalization deep-learning digital-pathology gan image-inpainting image-restoration

wsipenmarkingremoval's Introduction

Deep learning models are showing promise in digital pathology to aid diagnoses. Training complex models require a significant amount and diversity of well-annotated data, typically housed in institutional archives. These slides often contain clinically meaningful markings to indicate regions of interest. If slides are scanned with the ink present, then the downstream model may end up looking for regions with ink before making a classification. If scanned without the markings, the information is lost about where the relevant regions are located.

In this repo, we proposed a straightforward framework to digitally remove ink markings from whole slide images using a conditional generative adversarial network, opening the possibility of using archived clinical samples as resources to fuel the next generation of deep learning models for digital pathology.
Please read our paper to get more details. If you find this repo helps you, please cite our work:

Jiang, Jun, Naresh Prodduturi, David Chen, Qiangqiang Gu, Thomas Flotte, Qianjin Feng, and Steven Hart. "Image-to-image translation for automatic ink removal in whole slide images." Journal of Medical Imaging 7, no. 5 (2020): 057502.

Here is an example of WSI showing the clean scan, marked slides and image after restoration.
Thumbnail level Here are some high resolution image patches to show performance of image restoration . High resolution patches In order to evaluate the effectiveness of our workflow, violin plots were drawn to enrich our assessment. We can observe: First, the distributions of all evaluation metrics for tissue_only patches are symmetrical, which indicates that our model preserves the image content if no ink presents. Second, for patches with ink (inked_tissue and ink_only), all three evaluation metrics move to higher values, which indicates ink was effectively removed. Particularly, for image patches with ink, SSIM distributions were dispersive before ink removal (which may be caused by uneven thickness of ink), but aggregate to higher values, which indicates inked image patches were effectively restored. Quantitative evaluation result

Installation

  • Clone our code
git clone https://github.com/smujiang/WSIPenMarkingRemoval.git
  • Install the dependencies
conda install tensorflow-1.14 numpy-1.15 PIL seaborn pandas

You may also need to install our WSITools to enable our patch extraction sub-module.

Run our workflow

  • Step 1 [optional]. Prepare your own dataset
    Since the volume of image data for this research is huge, we only provide very few image samples in this directory. (Image size: 512x256 px, pixel size: 0.25μm)

    You may need to extract patches from WSIs, depend on if you would like to run on your own dataset.
    If you would like to train your own model, you need to prepare some clean and marked image pairs. Please refer to our pairwise patch extraction code, and image samples
    If you would like to test our pre-trained model, you just need marked WSIs for testing. Please refer to our marked WSI extraction code. and image samples (Fill the left 256*256 part of the image with pure white, if you don't have clean slides as counterparts.)

  • Step 2 [optional]. Train the model
    Please refer to this bash script to train the ink removal model. You may need to modify some code to load the data for model training.

  • Step 3. Testing the model
    Please refer to this bash script to evaluate the model. You can test your own model (follow step 2 to train your model), or run our pre-trained model which can be downloaded from Google Drive.

  • Step 4. Reconstruct the image from restored patches
    Please refer our code for patch reconstruction

  • Step 5 [optional]. Quantitative evaluation
    Evaluation metrics can be calculated with code in ./eval

References

[1] S. Ali, N. K. Alham, C. Verrill, and J. Rittscher, "Ink removal from histopathology whole slide images by combining classification, detection and image generation models," arXiv preprint arXiv:1905.04385, 2019.

[2] Venkatesh, Bairavi, Tosha Shah, Antong Chen, and Soheil Ghafurian. "Restoration of marker occluded hematoxylin and eosin stained whole slide histology images using generative adversarial networks." arXiv preprint arXiv:1910.06428 (2019).

wsipenmarkingremoval's People

Contributors

smujiang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

gouldbach

wsipenmarkingremoval's Issues

Dataset

Can you kindly share the entire dataset?
Is there any restriction for usage of the data

Missing pre-trained model weight

Hi, I can't seem to find the pre-trained model weight anywhere in this repo or the Google Drive link provided. Could you please provide your pre-trained model weight so that we can test the model using our own data? Many thanks!

google drive checkpoint load

Hi!
Thank you very much for sharing your code!

When I am trying to evaluate your model on my data, i get the following error:

loading model from checkpoint
ERROR:tensorflow:Couldn't match files for checkpoint /projects/shart/digital_pathology/data/PenMarking/model/pixel2pixel_256_50cases/model-11785000

I have downloaded checkpoint file from google drive and put into models folder

Could you please help with solving this issue?

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.