Diaminobenzidine separation and evaluation method based on YCbCr color space
Technical Field
The invention relates to the technical field of computer-assisted immunohistochemical staining, in particular to a diaminobenzidine separation and evaluation method based on a YCbCr color space.
Background
Immunohistochemistry is a very powerful target antigen detection method, and immunohistochemical digital images are three-dimensional data consisting of three color channels of red, green and blue (RGB). The computer aided diagnosis tool needs to segment the positive staining pixels from the three-dimensional image to the maximum extent through a mathematical algorithm and mark the staining degree, so that the target antigen tissue can be seen under an optical microscope through staining. The reliability and versatility of immunohistochemistry, which makes it widely used in clinical diagnosis and basic research, diaminobenzidine, one of the most commonly used dyes in immunohistochemistry, can stain target tissues with tan (positive staining) to distinguish it from blue (negative staining) caused by background and hematoxylin stain, and for immunohistochemical staining pathological images stained with hematoxylin-diaminobenzidine (H-DAB), quantitative analysis of the distribution and staining intensity of positive staining (DAB) can be used for biomarker localization or immunoreaction scoring, which is of great significance in clinical medicine, however, currently used methods are based on manual semi-quantitative evaluation of positive staining area and intensity, such as a color deconvolution method, a blue normalization method, a method of performing mathematical transformation on an original image matrix to perform positive staining separation, and the like, the methods have extremely poor segmentation effect on the severe positive staining, are troublesome to adjust on different databases, or can generate pictures which can not give quantitative description of staining concentration and are time-consuming and subject to subjective errors, so that the method is particularly important for accurately separating and evaluating the staining by adopting a computer algorithm.
The present invention is an improvement to solve the above problems.
Disclosure of Invention
The technical problem to be solved by the invention is to provide a method for separating and evaluating diaminobenzidine based on YCbCr color space, which aims at the characteristics that the dyeing degree span of diaminobenzidine is too large and the scattering frequency spectrum is too wide, adopts a multi-threshold technology based on brightness to improve the separation effect, and uses a brightness assignment method to enable the final picture to quantitatively describe the dyeing degree.
The technical scheme adopted by the invention for solving the technical problem is as follows:
a diaminobenzidine separation and evaluation method based on YCbCr color space comprises the following implementation steps:
s1, acquiring a picture, loading the original picture, and acquiring a red, green and blue (RGB) three-channel image matrix of the picture;
s2, converting the image matrix in the step S1 into a YCbCr three-channel image matrix;
s3, generating a Crb or Cbr chromaticity difference picture, obtaining the Crb or Cbr chromaticity difference picture through the chromaticity component of the three-dimensional matrix in the step S2, and then separating a positive dyeing area;
s4, setting a bias value, equally dividing Crb or Cbr according to the brightness component channel value n, and adding a bias value alpha to each interval;
s5, extracting symbol information, and extracting symbol information of a Crb or Cbr image matrix;
s6, performing morphological processing on the information in the step S5;
s7, generating a final image, and finally obtaining an image matrix according to the information obtained in the step S6;
further, the color space is YCbCr;
further, the conversion formula for converting the image matrix into the three-dimensional matrix in step S2 is as follows:
Y=(0.299×R+0.587×G+0.114×B)/255
Cb=(-0.168736×R+0.331264×G+0.5×B)/255
Cr=(0.5×R-0.418688×G-0.081312×B)/255。
where Y is the luminance component and Cb and Cr are the chrominance components;
y ranges from 0 to 1, Cb and Cr are respectively a blue excursion and a red excursion, and the ranges are-0.5 to 0.5;
in the step S3, a Crb or Cbr chrominance difference image is obtained through information of two color channels Cb and Cr;
specifically, the formula for separating the positive dyeing region in step S3 is as follows:
Crb(x,y)=Cr(x,y)-Cb(x,y)or Cbr(x,y)=Cb(x,y)-Cr(x,y)
Wherein (x, y) is a two-dimensional coordinate of an image pixel, and the value range of the Crb or Cbr image is-1 to 1;
wherein, the formula of the separated positive dyeing area after the bias value is set in the step S4 is as follows:
Crbi (x,y)=Cri (x,y)-Cbi (x,y)+αi1, 2, n or
Cbri (x,y)=Cbi (x,y)-Cri (x,y)+αii=1,2…,n;
The symbol separation information extracted from the Crb image matrix in step S5 is a binary segmentation result obtained from the chrominance difference, and the formula is as follows:
In step S6, morphological processing is performed on the binary segmentation result, and the implementation steps include:
y1, opening operation, namely, firstly performing corrosion operation and then performing expansion operation to eliminate tiny non-tissue pixels which are not related to evaluation in the image;
y2, closing operation, namely, firstly performing expansion operation and then performing corrosion operation to fill up fine cavity noise generated by a positive image of a cell nucleus;
the sign separation information sign (crb) obtained in step S7 is multiplied by the inverted Y value to obtain a final sepia-blue (BB) image matrix, which has the formula:
converting an original red, green and blue picture matrix into a YCbCr color space, and obtaining a chromaticity difference image by subtracting a Cb channel from a Cr channel; different bias values are applied according to a mode of equally dividing Y channels, so that positive and negative stains are accurately separated. The method can effectively solve the problem that the dyeing degree span of the diaminobenzidine is too large, so that the scattering spectrum is too wide and the separation is difficult; the pictures that have been separated in terms of chroma are assigned information of the luminance channel, so that the degree of staining of the positive stain can be quantitatively evaluated.
The invention has the advantages that: the YCbCr color space adopted by the invention is most consistent with the color composition essence of diaminobenzidine and hematoxylin dyeing, and can more accurately separate a positive dyeing area; the final image generated by the method can be used for quantitatively describing the dyeing degree; with this method, higher separation accuracy can be obtained than with the conventional method.
Drawings
Fig. 1 shows the distribution of pixel points in Crb and luminance two-dimensional space in the YCbCr color space-based diaminobenzidine separation and evaluation method.
Detailed Description
In order to make the technical means, the original characteristics, the achieved purposes and the effects of the invention easy to understand, the invention is further described with reference to the figures and the specific embodiments.
Referring to fig. 1, the method for separating and evaluating diaminobenzidine based on YCbCr color space is implemented by the following steps:
s1, acquiring a picture, loading the original picture, acquiring a three-dimensional image matrix of the picture, and acquiring a three-dimensional image matrix described by a red, green and blue color channel;
s2, converting the image matrix in the step S1 into a three-dimensional matrix, and converting the acquired original image matrix into YCbC by using the ITU-R BT.601 standard or the ITU-R BT.2020 standardrA three-dimensional matrix of color channel descriptions;
s3, generating a Crb or Cbr chromaticity difference image, obtaining the Crb or Cbr chromaticity difference image through the chromaticity component of the three-dimensional matrix in the step S2, and then separating a positive dyeing area;
s4, setting a bias value, equally dividing Crb or Cbr according to the brightness component channel value n, and adding a bias value alpha to each interval;
s5, extracting symbol information, and extracting symbol information of a Crb or Cbr image matrix;
s6, performing morphological processing on the information in the step S5;
s7, generating a final image, and finally obtaining an image matrix according to the information obtained in the step S6;
further, the color space is YCbCr;
Further, the conversion formula for converting the image matrix into the three-dimensional matrix in step S2 is as follows:
Y=(0.299×R+0.587×G+0.114×B)/255
Cb=(-0.168736×R+0.331264×G+0.5×B)/255
Cr=(0.5×R-0.418688×G-0.081312×B)/255。
where Y is the luminance component and Cb and Cr are the chrominance components;
y ranges from 0 to 1, Cb and Cr are respectively a blue excursion and a red excursion, and the ranges are-0.5 to 0.5;
in the step S3, a Crb or Cbr chrominance difference image is obtained through information of two color channels Cb and Cr;
specifically, the formula for separating the positive dyeing region in step S3 is as follows:
Crb(x,y)=Cr(x,y)-Cb(x,y)or Cbr(x,y)=Cb(x,y)-Cr(x,y)
Wherein (x, y) is a two-dimensional coordinate of an image pixel, and the value range of the Crb or Cbr image is-1 to 1;
wherein, the formula of the separated positive dyeing area after the bias value is set in the step S4 is as follows:
Crbi (x,y)=Cri (x,y)-Cbi (x,y)+αi1, 2, n or
Cbri (x,y)=Cbi (x,y)-Cri (x,y)+αii=1,2…,n.
The values of the equipartition value n and the bias value a are set by the pathologist from different databases. The set Crb can correctly separate diaminobenzidine dyeing pixels through positive and negative values;
the symbol separation information extracted from the Crb image matrix in step S5 is a binary segmentation result obtained from the chrominance difference, and the formula is as follows:
The obtained binary image Sign (Crb)(x,y)) Can be used to calculate the positive staining ratio equating information of the whole image;
in step S6, morphological processing is performed on the binary segmentation result, and the implementation steps include:
y1, opening operation, namely, firstly performing corrosion operation and then performing expansion operation to eliminate tiny non-tissue pixels which are not related to evaluation in the image;
y2, closing operation, namely, firstly performing expansion operation and then performing corrosion operation to fill up fine cavity noise generated by a positive image of a cell nucleus;
the sign separation information sign (crb) obtained in step S7 is multiplied by the inverted Y value to obtain a final sepia-blue (BB) image matrix, which has the formula:
BB obtained(x,y)The image can be used for describing the positive staining intensity of the image, and a threshold value can be applied to the image to obtain the ratio of strong positive, medium positive and weak positive, the image matrix is assigned according to the staining degree of each pixel, and the numerical difference between positive staining and negative staining is enlarged according to the difference of brightness; high brightness background pixels will concentrate to values around 1. The BB image allows a quantitative description of the degree of positive staining.
Converting an original red, green and blue picture matrix into a YCbCr color space, and obtaining a chromaticity difference image by subtracting a Cb channel from a Cr channel; different bias values are applied according to a mode of equally dividing Y channels, so that positive and negative stains are accurately separated. The method can effectively solve the problem that the dyeing degree span of the diaminobenzidine is too large, so that the scattering spectrum is too wide and the separation is difficult; the pictures that have been separated in terms of chroma are assigned information of the luminance channel, so that the degree of staining of the positive stain can be quantitatively evaluated.
The YCbCr color space adopted by the invention is most consistent with the color composition essence of diaminobenzidine and hematoxylin dyeing, and can more accurately separate a positive dyeing area; the final image generated by the method can be used for quantitatively describing the dyeing degree; with this method, higher separation accuracy can be obtained than with the conventional method.
It is evident from fig. 1 that the Crb value effectively separates the brownish and blue colors.
The foregoing shows and describes the general principles, essential features, and advantages of the invention. It will be understood by those skilled in the art that the present invention is not limited to the embodiments described above, which are given by way of illustration of the principles of the present invention, and that various changes and modifications may be made without departing from the spirit and scope of the invention as defined by the appended claims. The scope of the invention is defined by the appended claims and equivalents thereof.