Cell tissue image style conversion method, system, device and medium
By calculating the difference matrix and constructing the mapping function in a single-channel color gamut, the problem of style transfer of cell tissue images under different staining or devices is solved. This achieves image style transfer while maintaining the integrity of tissue structure, avoiding the problems of computational complexity and poor interpretability in existing technologies, and meeting the reliability requirements of medical image processing.
Patent Information
- Application Number
- CN202611312173.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-27
- Publication Date
- 2026-11-24
AI Technical Summary
Existing technologies struggle to achieve style transfer of cell tissue images while maintaining the integrity of the tissue structure, especially in the comparative analysis of images under different staining methods or imaging equipment conditions. Furthermore, existing methods suffer from computational complexity, high cost, poor interpretability, and unsatisfactory conversion results.
By mapping the source and target images to a single-channel color gamut space respectively, three types of difference matrices are calculated and a mapping function is constructed, including the difference matrix to be transformed, the target difference matrix, and the unified color gamut difference matrix. The transformation is performed pixel by pixel to ensure that the mapping function of each channel is a deterministic linear calculation, thus avoiding the structural distortion and color imbalance problems in deep learning methods.
It achieves style transfer of cell tissue images under different imaging conditions, maintains the integrity of spatial structural information such as cell nuclear boundaries, tissue texture and cell morphology, meets the strict requirements of medical image processing for result reliability, and has low computational complexity and strong interpretability of the conversion process.
Smart Images

Figure CN123160332A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of image processing, and specifically relates to a method, system, device and medium for style transfer of cell tissue images. Background Technology
[0002] In clinical pathology diagnosis and medical research, microscopic images of cells and tissues are crucial for observing cell morphology, tissue structure, and diagnosing diseases. The same cell and tissue sample often needs to be observed and analyzed under different imaging conditions: on the one hand, pathologists may use different staining methods to stain tissue sections. Different staining methods have selective staining characteristics for different structures such as cell nuclei, cytoplasm, and collagen fibers, revealing the structural features and pathological information of the tissue from different angles; on the other hand, different microscopic imaging devices have different imaging principles and color response characteristics, resulting in significant differences in the color distribution and color gamut of the acquired multi-channel images (such as RGB three-channel images).
[0003] However, the differences in image color style caused by the aforementioned different imaging conditions bring the following problems to pathological diagnosis and medical research: Image comparison and analysis across staining and devices is difficult: the same tissue sample presents drastically different color styles under different staining conditions, and the color distribution of each channel is significantly different. Images of the same stained section acquired under different display devices also have different color gamut ranges and color characteristics. This makes it difficult for pathologists to accurately determine the same tissue structure regions in different images when performing image comparisons across staining or devices, increasing the difficulty and subjectivity of diagnostic analysis.
[0004] The demand for multi-style image presentation in teaching and research scenarios cannot be effectively met: In medical teaching and research, it is sometimes necessary to observe the presentation effect of the same tissue under different staining or different equipment in order to demonstrate the influence of different imaging conditions on the display of tissue structure. However, re-preparing sections, performing different staining, or re-collecting with different equipment is not only time-consuming, labor-intensive, and costly, but also, in some cases (such as rare samples or retrospective studies), the conditions for re-collection are simply not available.
[0005] To address the above problems, several image style transfer methods have been proposed in the existing technology, mainly including the following categories: 1. Deep Learning-Based Image Style Transfer Method Deep learning methods such as Generative Adversarial Networks (GANs) and Convolutional Neural Networks (CNNs) are widely used in the field of image style transfer, with some research applying them to medical image processing. These methods learn an end-to-end mapping from source to target images using a large amount of paired training data, achieving image style transfer to a certain extent. However, these methods have the following drawbacks: they require a large amount of paired training image data, which is extremely difficult to obtain in the medical field and is costly to annotate; the training process is complex, requiring high-performance computing resources and taking a long time; deep learning models are black-box models, lacking interpretability in the transfer process, and intermediate results are not traceable, making it difficult to meet the stringent requirements of reliability and traceability in medical image processing; the transfer results may produce tissue structure distortion, blurred edges, or artifacts, directly affecting the accuracy of pathological diagnosis.
[0006] 2. Traditional Image Color Transfer Method Based on Histogram Matching Histogram matching methods achieve color transfer by matching the color histogram of the source image to the color histogram of the target image. While these methods are computationally simple and require no training, they primarily target single-channel grayscale images or operate independently on each color channel, failing to consider the inherent relationships between the color information of different channels in multi-channel images. This can easily lead to color imbalances in the converted channels. More importantly, these methods cannot establish a complete mapping path from each channel of the source image to each channel of the target image, lacking a mechanism to differentiate between "channel-specific color information" and "overall brightness / structural information" in multi-channel images. Consequently, the color harmony and fidelity of the converted results are both unsatisfactory.
[0007] 3. Color correction method based on color space conversion This method involves converting the image to a specific color space (such as Lab color space), correcting each channel separately, and then converting the image back to the original color space. While this approach achieves some color correction by separating the luminance and chrominance channels, it primarily targets color consistency correction between images from the same device or under the same staining conditions, rather than style conversion between different staining methods or devices. Its processing is typically a global transformation, lacking pixel-level precision mapping capabilities, making it difficult to meticulously preserve the detailed information of the organizational structure while changing the color style.
[0008] In summary, there is an urgent need in the existing technology for a method that is highly interpretable and can achieve style transfer of cell tissue images while maintaining the integrity of the tissue structure. Summary of the Invention
[0009] To address the aforementioned issues, this application provides a method, system, device, and medium for style conversion of cell and tissue images. The image conversion process is highly interpretable and fully preserves the details of the cell and tissue structure in the source image during the conversion process.
[0010] The technical solution is as follows: A method for style transfer of cell tissue images, comprising: Acquire source image A and target image B, wherein source image A and target image B are images of the same cell tissue acquired under different imaging conditions, and each has N channels, where N≥2; The source image A and the target image B are respectively mapped to a single-channel color gamut space to obtain a single-channel source image A′ and a single-channel target image B′. Calculate the pixel difference between each channel of the source image A and the single-channel source image A′, the pixel difference between each channel of the target image B and the single-channel target image B′, and the pixel difference between the single-channel source image A′ and the single-channel target image B′ to obtain the difference matrix to be converted, the target difference matrix, and the unified color gamut difference matrix for each channel. For any channel, the mapping function of the channel is constructed by first subtracting the difference matrix to be converted, then subtracting the unified color gamut difference matrix, and finally adding the target difference matrix. The unified color gamut difference matrix is used as a compensation component shared by all channels. The source image A is transformed pixel by pixel according to the mapping function, and the transformation results of each channel are merged into a multi-channel image and output.
[0011] A cell tissue image style transfer system, comprising: The image acquisition module is used to acquire source image A and target image B, wherein source image A and target image B are images of the same cell tissue acquired under different imaging conditions, and each has N channels, where N≥2; The color gamut mapping module is used to map the source image A and the target image B to a single-channel color gamut space respectively, to obtain a single-channel source image A′ and a single-channel target image B′. The difference calculation module is used to calculate the pixel difference between each channel of the source image A and the single-channel source image A′, the pixel difference between each channel of the target image B and the single-channel target image B′, and the pixel difference between the single-channel source image A′ and the single-channel target image B′, respectively, to obtain the difference matrix to be converted, the target difference matrix, and the unified color gamut difference matrix for each channel; The mapping function construction module is used to construct the mapping function for each channel. The mapping function for each channel is constructed in the following order: first subtracting the difference matrix to be converted, then subtracting the unified color gamut difference matrix, and finally adding the target difference matrix. The unified color gamut difference matrix is used as a compensation component shared by all channels. The output module is used to perform pixel-by-pixel transformation on each channel of the source image A according to the mapping function, merge the transformation results of each channel into a multi-channel image and output it.
[0012] Based on the same inventive concept, this application also provides an electronic device, including: a memory and a processor; the processor is used to read and execute a computer program stored in the memory to implement the aforementioned cell tissue image style transfer method.
[0013] Based on the same inventive concept, this application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed, implement the aforementioned cell tissue image style transfer method.
[0014] Compared with the prior art, this application has the following advantages: (1) It is applicable to style conversion of cell tissue images under different imaging conditions. The mapping function of each channel of the image is a deterministic linear calculation. All parameters are directly calculated from the pixel values of the source image and the target image. The computational complexity is low. The image conversion operation is a pixel-by-pixel independent mapping. The conversion of each pixel is independent of its spatial neighborhood. Therefore, the spatial structural information such as cell nuclear boundary, tissue texture, and cell morphology remains completely unchanged before and after the conversion. This avoids the structural distortion, edge blurring and artifact problems common in deep learning methods, which is of great significance for ensuring the accuracy of pathological diagnosis. (2) By decomposing and calculating the three types of difference matrices and using a three-step mapping path, the complex cell tissue style conversion process is decomposed into three steps: stripping the source channel color (reverting to the source brightness reference), compensating for the difference in brightness reference (crossing over to the target brightness reference), and assigning the target channel color (achieving the target style). Each step of the mathematical operation has a corresponding physical meaning. The entire conversion process is completely traceable and verifiable, effectively overcoming the poor interpretability of deep learning black box models and meeting the strict requirements of medical image processing for the reliability of results. (3) The unified color gamut difference matrix is shared in the mapping function of N channels. All channels use the same brightness reference compensation amount for conversion. Therefore, each channel maintains a consistent change reference in the brightness dimension, which fundamentally avoids the color imbalance problem that may be caused by independent processing of each channel.
[0015] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures pointed out in the description, claims and drawings. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 A flowchart of the cell tissue image style conversion method in an embodiment of this application is shown; Figure 2 A schematic diagram of the unified color gamut mapping process in an embodiment of this application is shown; Figure 3 This illustration shows a schematic diagram of constructing the difference matrix to be transformed in an embodiment of this application; Figure 4 A schematic diagram illustrating the construction of the target difference matrix in an embodiment of this application is shown; Figure 5 A schematic diagram illustrating the construction of a unified color gamut difference matrix in an embodiment of this application is shown; Figure 6 A schematic diagram of the difference filling process in an embodiment of this application is shown; Figure 7 A schematic diagram of the resulting image obtained by channel-by-channel conversion in an embodiment of this application is shown. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0019] This application provides a method for style transfer of cell tissue images, enabling style transfer between cell tissue images under different imaging conditions. For example... Figure 1 As shown, the method includes: S1. Obtain source image A and target image B; The source image A and the target image B are images of the same cell tissue acquired under different imaging conditions, and both have N channels (N≥2). Continuous slices or imaging of the same tissue region from the same biological tissue sample under different conditions have a spatial correspondence in their tissue structures.
[0020] S2. Map the source image A and the target image B to the same color space to obtain a single-channel source image A′ and a single-channel target image B′. S3. Calculate the pixel difference between each channel of the source image A and the single-channel source image A′, the pixel difference between each channel of the target image B and the single-channel target image B′, and the pixel difference between the single-channel source image A′ and the single-channel target image B′, respectively, to obtain the difference matrix to be converted, the target difference matrix, and the unified color gamut difference matrix for each channel; S4. For any channel, construct the mapping function of the channel by first subtracting the difference matrix to be converted, then subtracting the unified color gamut difference matrix, and finally adding the target difference matrix. The unified color gamut difference matrix is used as a compensation component shared by all channels. S5. Perform pixel-by-pixel transformation on each channel of the source image A according to the mapping function, merge the transformation results of each channel into a multi-channel image and output it.
[0021] The embodiments of this application are applicable to style transfer of cell tissue images under different imaging conditions. The mapping function of each channel is a deterministic linear calculation. All parameters are directly calculated from the pixel values of the image to be converted and the target image, resulting in low computational complexity. Moreover, the conversion operation is a pixel-by-pixel independent mapping, and the conversion of each pixel is independent of its spatial neighborhood. Therefore, the spatial structural information such as cell nuclear boundaries, tissue texture, and cell morphology remains completely unchanged before and after the conversion. This fundamentally avoids the structural distortion, edge blurring, and artifact problems common in deep learning methods, which is of great significance for ensuring the accuracy of pathological diagnosis.
[0022] In this embodiment, images of the same cell tissue acquired under different imaging conditions include: cell tissue images acquired through different display devices and cell tissue images obtained using different staining methods.
[0023] The different display devices include at least two of optical microscopes, electron microscopes, fluorescence microscopes, and confocal microscopes. Different devices have different imaging principles and color response characteristics, resulting in images with different color gamuts and color features.
[0024] The different staining methods include at least two of the following: hematoxylin-eosin (HE) staining, MASSON trichrome staining, immunohistochemical staining, PAS staining, Congo red staining, and silver staining. These different staining methods exhibit selective staining characteristics for tissue structures such as cell nuclei, cytoplasm, collagen fibers, and basement membranes, resulting in systematic differences in the color distribution across the various channels of the generated multi-channel images.
[0025] In this embodiment, both the source image A and the target image B have N color channels (N≥2). For example, both the source image A and the target image B are RGB color images (N=3), containing a red channel (R), a green channel (G), and a blue channel (B), respectively.
[0026] According to a preferred embodiment, before mapping the source image A and the target image B to a single-channel color gamut space, it is first determined whether the size of the source image A and the target image B are consistent; if they are inconsistent, the source image A and the target image B are registered and their sizes are normalized so that the pixel positions of the two images correspond one-to-one.
[0027] The purpose of image registration is to align the spatial positions of the same tissue structure in two images. Known registration methods in the field, such as rigid registration, affine registration, or nonlinear registration, can be used. Specifically, one image is selected as a reference image, and the other image is spatially transformed so that the corresponding tissue structures in the two images coincide in spatial position.
[0028] The purpose of size normalization is to make two images have the same pixel size (i.e., the same number of pixels in width and height). This can be achieved by using interpolation methods (such as bilinear interpolation, bicubic interpolation, etc.) to scale the images, making the width and height of the two images consistent. After size normalization, the pixel positions of the two images correspond one-to-one.
[0029] like Figure 2 As shown, the source image A (the cell tissue image to be converted) and the target image B (the target cell tissue image) are mapped to a single-channel color gamut space respectively to obtain a single-channel source image A′ (the cell tissue unified color gamut image to be converted) and a single-channel target image B′ (the target cell tissue unified color gamut image).
[0030] Unified color gamut mapping includes the following steps: 1. Identify the original color space C_A of the source image A and the original color space C_B of the target image B.
[0031] For example, the original color space corresponding to an RGB image is the sRGB color space, and the original color space corresponding to a CMYK image is the CMYK color space. Image A and image B can have the same original color space (e.g., both are RGB) or different original color spaces.
[0032] 2. Select a single-channel standard color space C_U as the unified color gamut.
[0033] For example, for RGB images, a standard grayscale conversion formula can be used to convert the color image to a grayscale image; alternatively, a multi-channel image can be converted to the Lab color space and the L channel can be extracted as a single-channel unified color gamut image. The advantage of the Lab color space is that the L channel has good consistency with the brightness perceived by the human eye; or a multi-channel image can be converted to the XYZ color space and the Y channel can be extracted as a single-channel unified color gamut image.
[0034] 3. Color Gamut Mapping For the source image A, it is mapped from the original color space C_A to the selected single-channel standard color space C_U to obtain the single-channel source image A′; for the target image B, it is mapped from the original color space C_B to the same single-channel standard color space C_U to obtain the single-channel target image B′.
[0035] It should be noted that although images A′ and B′ are in the same single-channel color gamut space C_U, the pixel values of images A′ and B′ are different at corresponding positions because the source image A and the target image B were acquired under different imaging conditions. This reflects the brightness / luminance difference that still exists after the same cell tissue is mapped to a unified color gamut under different imaging conditions, which is an important basis for subsequent difference compensation.
[0036] The significance of unified color gamut mapping lies in reducing the dimensionality of multi-channel images to a single channel, eliminating the dimensional differences between different multi-channel color spaces, and making multi-channel images that were originally not directly comparable numerically, thereby enabling cross-coloring and cross-device style transfer.
[0037] See Figures 3-5 For any channel c of the source image A and the target image B, three types of difference matrices are constructed as follows: (1) Difference matrix to be transformed Obtain the channel c of source image A at pixel point pixel values and the single-channel source image A′ at pixel points pixel values The difference matrix to be converted is obtained by subtracting each pixel. :
[0038] A total of N (N being the channel values) difference matrices to be converted are obtained.
[0039] If the source image A is an RGB image, the specific difference matrix to be converted for each channel is as follows:
[0040] in, , , These represent the R, G, and B channels of the source image A at pixel points. pixel values, For image A′ at pixel point The grayscale value.
[0041] The difference matrix to be transformed Each element in the table is a scalar that reflects the difference between the color value of channel c and the grayscale value of the uniform color gamut. This difference characterizes the staining or device-specific color shift of that channel. For example, in an HE staining image, the positive shift of the R channel relative to the grayscale value reflects the pink information of the cytoplasm, while the relative negative shifts of the G and B channels reflect the blue-violet information of the cell nucleus.
[0042] (2) Target difference matrix Obtain channel c of the target image B at pixel points pixel values and the single-channel target image B′ at pixel points pixel values The target difference matrix is obtained by subtracting each pixel. :
[0043] A total of N target difference matrices are obtained.
[0044] If the target image B is also an RGB image, the target difference matrix for each channel is:
[0045] in, , , These represent the R, G, and B channels of the target image B at pixel points. pixel values, For image B′ at pixel point The grayscale value.
[0046] (3) Uniform color gamut difference matrix The single-channel source image A′ and the single-channel target image B′ are subtracted pixel by pixel to obtain a unified color gamut difference matrix. : .
[0047] Since the single-channel source image A′ and the single-channel target image B′ are two different single-channel images, the values at corresponding pixel positions are usually not equal. It is a non-zero matrix, meaning there exists at least one pixel such that... Not zero.
[0048] The unified color gamut difference matrix It characterizes the pixel differences between two different single-channel unified color gamut images, that is, the brightness / luminance differences that still exist after the same cell tissue is mapped to the unified color gamut under different imaging conditions. This matrix is shared in the subsequent mapping function calculation of all channels and plays a role in cross-channel coordination compensation.
[0049] Furthermore, the difference compensation amount for each channel is determined based on the above three types of difference matrices, and the channel mapping function is constructed.
[0050] like Figure 6 As shown, when constructing the mapping function for any channel c, the interpolation is performed in the following order. It is important to emphasize that the order of the steps cannot be changed, and each step has a clear physical meaning: Step 1 (Revert to the source uniform color gamut): Subtract the difference matrix to be converted. The pixel value of channel c of the source image A is backed up to the pixel value of the single-channel source image A′;
[0051] The physical meaning of this step is: to migrate the channel color space of the source image A to a unified color gamut reference, and to strip away the channel features (coloring / device color offset information) of the source stained structure. After this step, the pixel values that originally contained channel-specific color information are restored to single-channel grayscale values that only reflect the brightness / lightness information of the tissue structure, effectively removing the color style in the source image while retaining the tissue structure information.
[0052] Step 2 (Transition to the target unified color gamut): Subtract the unified color gamut difference matrix The pixel values of the single-channel source image A′ are transitioned to the pixel values of the single-channel target image B′.
[0053] The physical meaning of this step is to compensate for the color gamut space difference (luminance / brightness difference) between the single-channel source image A′ and the single-channel target image B′. Essentially, it involves migrating the luminance reference from the source imaging conditions to the target imaging conditions. It is worth noting that this step shares the same luminance reference across all N channels. The matrix ensures that each channel maintains consistency in brightness variation, thus avoiding color imbalance that may result from independent processing of each channel.
[0054] Step 3 (Assigning color to the target channel): Add the target difference matrix. The pixel values of the single-channel target image B′ are filled into the pixel values of channel c of the target image B.
[0055]
[0056] The physical meaning of this step is to increase the channel characteristics (staining / device color offset information) of the target stained structure, which is essentially to give the cell tissue structure the color style of the target staining / device.
[0057] After the above steps, the difference compensation amount of channel c is obtained. :
[0058] In this context, a negative sign indicates a subtraction operation, and a positive sign indicates an addition operation. Difference compensation amount. This represents the total adjustment required to be applied to the pixel values of channel c of the source image A.
[0059] Therefore, the mapping function for channel c is:
[0060] The mapping function described above establishes a complete mapping path from the pixel values of the source image A to the pixel values of the target image B: Each step in this mapping path is a deterministic linear operation, without any nonlinear transformations, random sampling, or learnable parameters. Therefore, the entire mapping process is determined entirely by the pixel values of the input images A and B, without any training data or training process.
[0061] This mapping function decomposes the complex multi-channel image style transfer problem into three independent and interpretable steps in engineering. Its core idea is to decompose the color information of a multi-channel image into channel-specific color shifts. , The system consists of two independent components: a luminance reference (A′, B′) and a luminance reference (A′, B′), and compensates for the difference in luminance reference (A′, B′). This enables the transition from the source style to the target style. This decomposition linearly separates the information that was originally coupled in the multi-channel color space, giving each component a clear physical meaning, and making the entire conversion process traceable and verifiable.
[0062] In this embodiment, the complex cell tissue style conversion process is decomposed into three steps through the decomposition calculation of three types of difference matrices and a three-step paper insertion mapping path: stripping the source channel color (falling back to the source luminance reference), compensating for luminance reference differences (crossing over to the target luminance reference), and assigning color to the target channel (achieving the target style). Each step of the mathematical operation has a corresponding physical meaning, and the entire conversion process is completely traceable and verifiable, effectively overcoming the poor interpretability of deep learning black box models and meeting the strict requirements of medical image processing for result reliability. The unified color gamut difference matrix is shared in the mapping functions of N channels, and the conversion of all channels uses the same luminance reference compensation amount to transition from A′ to B′. Therefore, each channel maintains a consistent change reference in the luminance dimension, fundamentally avoiding the color imbalance problem that may be caused by independent processing of each channel.
[0063] Furthermore, such as Figure 7 As shown, each channel of the source image A is transformed pixel by pixel according to the mapping function, and then the transformation results of N channels are merged into a multi-channel image, and finally the style-transformed result image R is output.
[0064] Specifically, for channel c of the source image A, the corresponding mapping function is used to convert the pixel value of pixel (i,j) of pixel (i,j) into the pixel value of channel c of the output image R at pixel (i,j):
[0065] Repeat the above calculation process until all N channels and all pixels of the source image A have been converted. Preferably, all pixels are traversed from left to right and from top to bottom, and converted pixel by pixel. Other traversal orders can also be used (such as from top to bottom, from left to right, or block scanning, etc.), as long as all pixel positions can be covered. This application does not limit this.
[0066] The resulting image R retains the structural details of the source image A (such as cell nucleus morphology, tissue boundaries, and texture) because the transformation process is a pixel-by-pixel independent mapping that does not involve spatial neighborhood operations. It also presents the color style of the target image B (such as staining hue and color distribution across channels) because the mapping function incorporates the target difference matrix. To impart a color shift to the target channel, and due to the uniform color gamut difference matrix It is shared across all channels, and the color is coordinated between channels to ensure the consistency of the brightness reference.
[0067] After obtaining the result image R, post-processing is performed on the result image R. The post-processing includes one or more of the following: Color range cropping: Crops the pixel values of each channel in the resulting image R to a valid range. For example, for an 8-bit image, pixel values less than 0 are set to 0, and pixel values greater than 255 are set to 255, ensuring that the output image is within a valid display range.
[0068] Contrast Enhancement: Contrast stretching or histogram equalization is applied to the resulting image R to enhance the visual contrast of the tissue structure and make details clearer.
[0069] Edge smoothing: Apply edge-preserving smoothing filtering (such as bilateral filtering) to the resulting image R to reduce potential noise without blurring the boundaries of the tissue structure.
[0070] The above post-processing steps are all image processing techniques known in the art, and can be selected and used according to actual application needs.
[0071] This application also provides a cell tissue image style transfer system, including: an image acquisition module, a color gamut mapping module, a difference calculation module, a mapping function construction module, and an output module.
[0072] The image acquisition module is used to acquire source image A and target image B. The source image A and the target image B are images of the same cell tissue acquired under different imaging conditions, and both have N channels, where N≥2.
[0073] The color gamut mapping module is used to map the source image A and the target image B to a single-channel color gamut space, respectively, to obtain a single-channel source image A′ and a single-channel target image B′.
[0074] The difference calculation module is used to calculate the pixel difference between each channel of the source image A and the single-channel source image A′, the pixel difference between each channel of the target image B and the single-channel target image B′, and the pixel difference between the single-channel source image A′ and the single-channel target image B′, respectively, to obtain the difference matrix to be converted, the target difference matrix, and the unified color gamut difference matrix for each channel.
[0075] The mapping function construction module is used to construct the mapping function for each channel. The mapping function for each channel is constructed in the following order: first, subtract the difference matrix to be converted, then subtract the unified color gamut difference matrix, and finally add the target difference matrix. The unified color gamut difference matrix is used as a compensation component shared by all channels.
[0076] The output module is used to perform pixel-by-pixel transformation on each channel of the source image A according to the mapping function, merge the transformation results of each channel into a multi-channel image and output it.
[0077] Regarding the system in the above embodiments, the specific manner in which each unit module performs operations has been described in detail in the embodiments related to the method, and will not be elaborated here.
[0078] Based on the same inventive concept, this application also provides an electronic device, including: a memory and a processor, wherein the processor is used to read and execute a computer program stored in the memory to implement the aforementioned cell tissue image style transfer method.
[0079] Based on the same inventive concept, embodiments of this application also provide a computer-readable storage medium storing computer-executable instructions, which, when executed, implement the aforementioned cell tissue image style transfer method.
[0080] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.
[0081] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.
[0082] In the above embodiments, the descriptions of each embodiment have their own emphasis. Parts not described in detail in a particular embodiment can be found in the relevant descriptions of other embodiments. Finally, it should be noted that the above descriptions are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for style transfer of cell tissue images, characterized in that, The method includes: Acquire source image A and target image B, wherein source image A and target image B are images of the same cell tissue acquired under different imaging conditions, and each has N channels, where N≥2; The source image A and the target image B are respectively mapped to a single-channel color gamut space to obtain a single-channel source image A′ and a single-channel target image B′. Calculate the pixel difference between each channel of the source image A and the single-channel source image A′, the pixel difference between each channel of the target image B and the single-channel target image B′, and the pixel difference between the single-channel source image A′ and the single-channel target image B′ to obtain the difference matrix to be converted, the target difference matrix, and the unified color gamut difference matrix for each channel. For any channel, the mapping function of the channel is constructed by first subtracting the difference matrix to be converted, then subtracting the unified color gamut difference matrix, and finally adding the target difference matrix. The unified color gamut difference matrix is used as a compensation component shared by all channels. The source image A is transformed pixel by pixel according to the mapping function, and the transformation results of each channel are merged into a multi-channel image and output.
2. The method according to claim 1, characterized in that, Images of the same cell tissue acquired under different imaging conditions include: cell tissue images acquired using different display devices and cell tissue images acquired using different staining methods; The different display devices include at least two of optical microscopes, electron microscopes, fluorescence microscopes, and confocal microscopes; The different staining methods include at least two of HE staining, MASSON staining, immunohistochemical staining, PAS staining, Congo red staining, and silver staining.
3. The method according to claim 1, characterized in that, For any channel c, construct the difference matrix to be converted, the target difference matrix, and the unified color gamut difference matrix respectively; Difference matrix to be transformed : in, For the source image A, channel c at pixel point pixel values, For the single-channel source image A′ at pixel point Pixel values; Construct the target difference matrix : in, For the target image B, channel c at pixel point pixel values, For the single-channel target image B′ at pixel point Pixel values; Construct a unified color gamut difference matrix : It is a non-zero matrix.
4. The method according to claim 3, characterized in that, When constructing the mapping function for channel c, interpolation is performed in the following order: The first step is to subtract the difference matrix to be transformed. The pixel value of channel c of the source image A is backed up to the pixel value of the single-channel source image A′; The second step is to subtract the unified color gamut difference matrix. The pixel values of the single-channel source image A′ are transitioned to the pixel values of the single-channel target image B′. The third step is to add the target difference matrix. The pixel values of the single-channel target image B′ are filled into the pixel values of channel c of the target image B.
5. The method according to claim 4, characterized in that, The mapping function for channel c is: This is the difference compensation amount for channel c; 。 6. The method according to claim 1, characterized in that, Before mapping the source image A and the target image B to a single-channel color gamut space, the method further includes: Determine whether the source image A and the target image B have the same dimensions; If they are inconsistent, the source image A and the target image B are registered and normalized in size to ensure that the pixel positions of the two images correspond one-to-one.
7. The method according to claim 1, characterized in that, After outputting the multi-channel image, the following is also included: The multi-channel image is post-processed, including one or more of color range cropping, contrast enhancement, and edge smoothing.
8. A cell tissue image style transfer system, characterized in that, The system includes: The image acquisition module is used to acquire source image A and target image B, wherein source image A and target image B are images of the same cell tissue acquired under different imaging conditions, and each has N channels, where N≥2; The color gamut mapping module is used to map the source image A and the target image B to a single-channel color gamut space respectively, to obtain a single-channel source image A′ and a single-channel target image B′. The difference calculation module is used to calculate the pixel difference between each channel of the source image A and the single-channel source image A′, the pixel difference between each channel of the target image B and the single-channel target image B′, and the pixel difference between the single-channel source image A′ and the single-channel target image B′, respectively, to obtain the difference matrix to be converted, the target difference matrix, and the unified color gamut difference matrix for each channel; The mapping function construction module is used to construct the mapping function for each channel. The mapping function for each channel is constructed in the following order: first subtracting the difference matrix to be converted, then subtracting the unified color gamut difference matrix, and finally adding the target difference matrix. The unified color gamut difference matrix is used as a compensation component shared by all channels. The output module is used to perform pixel-by-pixel transformation on each channel of the source image A according to the mapping function, merge the transformation results of each channel into a multi-channel image and output it.
9. An electronic device, characterized in that, include: Memory, processor; The processor is configured to read and execute the computer program stored in the memory to implement the method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed, implement the method described in any one of claims 1-7.
