Today: June 21, 2025
admin Posted on 6:03 pm

Project Computer Vision – Image Analysis and Enhancement of Histopathology Slides

Whole slide image (Level 3, width and height decimation by 32)
Central slice of whole slide image (height,width) = (300 , 400)
Visualization of stain vector estimation

Stain de-convolution

Method 1 : least square fitting

Solve the linear equation Ax = b,

where A is the estimated stain vectors, b is optical density(OD).

# Method 1 : least squared fitting
A = stainVectors.T
b = np.reshape(OD,(ROI_height*ROI_width,3)).T
x, _, _, _ = np.linalg.lstsq(A,b)
hema_lstsq = np.reshape(x[0,:],(ROI_height,ROI_width))
eosin_lstsq = np.reshape(x[1,:],(ROI_height,ROI_width))
Method 2 : Moore-Penrose pseudo-inverse
# Method 2 : Moore-Penrose pseudoinverse
inv_matx = np.linalg.pinv(np.dot(stainVectors,stainVectors.T))
result = np.dot(np.dot(OD,stainVectors.T),inv_matx)
hema = result[:,:,0]
eosin =result[:,:,1] 
H&E stain concentration ( both components are clamped at max. level = 1.0)

Reference

https://towardsdatascience.com/stain-estimation-on-microscopy-whole-slide-images-2b5a57062268

https://towardsdatascience.com/microscopy-stain-variations-and-how-to-estimate-them-baca29f57ee9

https://github.com/DeepPathology/SlideRunner

Leave a Reply

Your email address will not be published. Required fields are marked *

Social media & sharing icons powered by UltimatelySocial
YouTube
LinkedIn
Instagram
Verified by MonsterInsights