Giter VIP home page Giter VIP logo

unikill066 / normalize-h-and-e-images Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 31 KB

A method for normalizing H and E images

Home Page: https://www.cs.unc.edu/~mn/sites/default/files/macenko2009.pdf

License: GNU General Public License v3.0

Python 41.69% Jupyter Notebook 58.31%
bioinformatics bioinformatics-tool image-processing object-detection opencv-python python3 image-normalization normalization hematoxylin-eosin-staining

normalize-h-and-e-images's Introduction

Normalize-H-and-E-images

A method to normalize H and E images for Image Processing and Quantitative Testing, this is referenced from a paper - https://www.cs.unc.edu/~mn/sites/default/files/macenko2009.pdf

Setting up the tool:

  1. Cloning the repository: git clone https://github.com/unikill066/Normalize-H-and-E-images.git
  2. Install all the necessary libraries: pip install -r requirements.txt to run the tool in 2 ways; from the terminal/any python IDE or from Jupyter Notebook/Lab(.ipynb)

2.1 Running the tool from terminal:

  1. Windows: python h_and_e_nrom_script.py C:\path\to\neuron\images C:\path\to\output\directory
  2. Linux and MacOS: python h_and_e_nrom_script.py /path/to/neuron/images /path/to/output/directory

2.2 Running the tool from Jupyter Notebook/Lab:

  1. Spin a jpyter notebook instance from the conda/miniconda terminal: jupyter notebook
  2. Run the code cell(s) to generate the normalized images.

Output: The output is put in 3 folders in /path/to/output/directory:

  1. h - hematoxylin separated images
  2. e - eosin separated images
  3. norm - normalized images

Foot notes on the theory behind this tool:

  1. H and E stains are applied to a Neuronal Image, where H-Hematoxylin stains for nucleic acids (blue-purple) and eosin stains for proteins (bright pink).
  2. All color values are converted to their corresponding optical density (OD) values using the formula OD = -log10(I), where I is the RGB color vector, and each component is normalized in the range of [0, 1]. This transformation results in a linear combination of OD values. OD-hat represents values that pass a pre-defined filter with beta=0.15.
  3. Color deconvolution is performed to transform color values into quantitative values of interest:
    OD = V · S
    S = V^(-1) · OD
    

    where V and S are stain vectors and saturation of each stain, respectively

  4. The single value decomposition (SVD) is applied to the OD tuples, creating a plane from SVD directions corresponding to the two largest singular values. This plane is then projected and normalized.
  5. NMF-based algorithms attempt to factor the OD matrix into V and S using an algorithm that automatically finds the correct stain vectors for the image and performs color deconvolution.
  6. The angle at each point is calculated with respect to the SVD direction, and the data is normalized between the 1st and 99th percentiles. A value of 0 corresponds to a white pixel, and 1 corresponds to a black pixel, maintaining stability for low OD values with no stains.
  7. Finally, the values are converted back to OD space to reconstruct an image.

normalize-h-and-e-images's People

Contributors

unikill066 avatar

Watchers

 avatar

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.