Method and apparatus for baseline frame detection in spatial transcriptome microarray images

By detecting line segments and intersections in spatial transcriptome chip images and filtering out intersections that do not meet the angle constraints, the problem of accuracy and robustness of reference box detection in complex backgrounds is solved, and high-precision and robust reference box detection is achieved.

CN122089636APending Publication Date: 2026-05-26XIAMEN DEYUN XINZHUN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511953773.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-23
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Baseline bounding box detection in spatial transcriptome microarray images is difficult to achieve with high accuracy and robustness in complex backgrounds.

Method used

By acquiring target space transcriptome chip images, detecting line segments and obtaining line intersections, filtering out intersections that do not meet the included angle constraint conditions, and determining intersections based on the actual shape of the reference box, high-precision and robust reference box detection is achieved.

Benefits of technology

High-precision and robust detection of reference boxes was achieved in complex environments, eliminating noise and impurity interference and improving the objectivity and repeatability of the detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122089636A_ABST
    Figure CN122089636A_ABST
Patent Text Reader

Abstract

This invention relates to the field of bioinformatics and discloses a method and apparatus for detecting reference bounding boxes in spatial transcriptome chip images. The method includes: acquiring a target spatial transcriptome chip image; detecting line segments in the target spatial transcriptome chip image to obtain multiple initial line segments; obtaining the intersection point of each pair of initial line segments; for each line intersection point, if the included angle between the two initial line segments corresponding to the intersection point does not meet a preset angle constraint condition, then the line intersection point is removed; the angle constraint condition is determined based on the actual shape of the reference bounding box of the target spatial transcriptome chip image; and based on the retained line intersection points, the reference bounding box intersection point of the target spatial transcriptome chip image is determined. This invention enables high-precision and robust detection of reference bounding boxes in spatial transcriptome chip images with complex backgrounds.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of bioinformatics, specifically to a method and apparatus for detecting reference frames in spatial transcriptome chip images. Background Technology

[0002] With the development of life sciences, the study of gene expression has become an important research direction. Among them, spatial transcriptomics technology can provide information on the spatial location of genes in tissues, helping researchers to understand biological processes more deeply. However, the bounding box detection unique to spatial transcriptomics microarray images still has significant limitations, one of which is the difficulty in achieving high-precision and high-robustness bounding box detection in complex backgrounds. Summary of the Invention

[0003] This invention provides a method and apparatus for detecting reference boxes in spatial transcriptome chip images, in order to solve the problems of low accuracy and low robustness in detecting reference boxes in spatial transcriptome chip images.

[0004] In a first aspect, the present invention provides a method for detecting reference boxes in spatial transcriptome chip images, the method comprising: Acquire target spatial transcriptome microarray images; Multiple initial line segments are obtained by detecting straight line segments in the target spatial transcriptome chip image; Obtain the intersection point of the lines corresponding to each of the two initial line segments; For the intersection of the lines, if the included angle between the two initial line segments corresponding to the intersection does not meet the preset included angle constraint condition, then the intersection of the lines is eliminated; the included angle constraint condition is determined based on the actual shape of the reference box of the target spatial transcriptome chip image. Based on the preserved intersection points of the straight lines, the reference frame intersection points of the target spatial transcriptome chip image are determined.

[0005] In a second aspect, the present invention provides a reference box detection device for spatial transcriptome chip images, the device comprising: The image acquisition module is used to acquire images of the target spatial transcriptome chip. The straight line detection module is used to detect straight line segments in the target spatial transcriptome chip image and obtain multiple initial straight line segments; The line intersection point acquisition module is used to acquire the line intersection point corresponding to each of the two initial line segments; The line intersection filtering module is used to filter out the line intersection if the included angle between the two initial line segments corresponding to the line intersection does not meet the preset included angle constraint condition; the included angle constraint condition is determined based on the actual shape of the reference box of the target spatial transcriptome chip image. The reference frame intersection determination module is used to determine the reference frame intersection of the target spatial transcriptome chip image based on the retained line intersections.

[0006] Thirdly, the present invention provides an electronic device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the reference box detection method for spatial transcriptome chip images described in the first aspect or any corresponding embodiment.

[0007] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to perform a reference box detection method for spatial transcriptome chip images as described in the first aspect or any of its corresponding embodiments.

[0008] Fifthly, the present invention provides a computer program product, including computer instructions for causing a computer to execute a reference box detection method for spatial transcriptome chip images as described in the first aspect or any corresponding embodiment.

[0009] The reference frame detection method and apparatus for spatial transcriptome chip images provided in this invention filter the intersection points obtained by line detection based on the angular constraint of the intersection of the reference frame's side lines, eliminating false intersection points that do not conform to the physical constraints, and effectively removing intersection points caused by interference line segments generated by tissue or impurities, thereby achieving high-precision and high-robust detection of reference frames in spatial transcriptome chip images with complex backgrounds. Attached Figure Description

[0010] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0011] Figure 1 This is a schematic diagram of the first step of the reference box detection method for spatial transcriptome chip images according to an embodiment of the present invention. Figure 2 This is a schematic diagram of a second process for a reference box detection method for spatial transcriptome chip images according to an embodiment of the present invention. Figure 3 This is a schematic diagram of a spatial transcriptome chip image according to an embodiment of the present invention; Figure 4This is a schematic diagram of the intersection points and their order of reference boxes detected using the reference box detection method for spatial transcriptome chip images provided in this embodiment of the invention; Figure 5 This is a structural block diagram of a reference frame detection device for spatial transcriptome chip images according to an embodiment of the present invention; Figure 6 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0012] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0013] It is understood that before using the technical solutions disclosed in the various embodiments of the present invention, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in the present invention and their authorization should be obtained in accordance with relevant laws and regulations through appropriate means.

[0014] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.

[0015] According to an embodiment of the present invention, a reference box detection method for spatial transcriptome chip images is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0016] This embodiment provides a reference box detection method for spatial transcriptome chip images, which can be used in various electronic devices, such as various mobile terminals, desktop computer terminals, or servers. Figure 1 This is a flowchart of a reference box detection method for spatial transcriptome chip images according to an embodiment of the present invention, such as... Figure 1 As shown, the process includes the following steps: Step S101: Obtain the target spatial transcriptome chip image.

[0017] Step S102: Detect straight line segments in the target spatial transcriptome chip image to obtain multiple initial straight line segments.

[0018] Step S103: Obtain the intersection point of each pair of initial line segments. This intersection point includes the intersection point within the size range of the target spatial transcriptome chip image after the initial line segments are extended. Of course, if two initial line segments do not intersect, or do not have an intersection point within the size range of the target spatial transcriptome chip image, then the intersection point of those two initial line segments cannot be obtained.

[0019] Step S104: For the intersection of the lines, if the included angle between the two initial line segments corresponding to the intersection of the lines does not meet the preset included angle constraint condition, then the intersection of the lines is screened out; the included angle constraint condition is determined based on the actual shape of the reference box of the target spatial transcriptome chip image. Step S105: Based on the retained intersection points of the straight lines, determine the reference frame intersection points of the target spatial transcriptome chip image.

[0020] The reference box detection method for spatial transcriptome chip images provided in this embodiment filters the intersection points obtained by line detection based on the angle constraint of the intersection of the reference box's edge lines, eliminating false intersection points that do not conform to the physical constraints, and effectively removing intersection points caused by interference line segments generated by tissue or impurities. This enables high-precision and robust detection of reference boxes in spatial transcriptome chip images with complex backgrounds.

[0021] Furthermore, this embodiment achieves fully automated baseline bounding box intersection location, eliminating the need for manual intervention. Specifically, addressing the inefficiencies and inconsistencies caused by the heavy reliance on manual or semi-manual operation in related technologies, this embodiment automates the entire process from image input to intersection coordinate output. This method can intelligently identify the baseline bounding box structure in tissue images and automatically locate the coordinates of internal intersections, completely eliminating reliance on operator experience and significantly improving the objectivity and repeatability of the detection.

[0022] This embodiment provides a reference box detection method for spatial transcriptome chip images, which can be used in various electronic devices, such as various mobile terminals, desktop computer terminals, or servers. Figure 2 This is a flowchart of a reference box detection method for spatial transcriptome chip images according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps: Step S201: Obtain the target spatial transcriptome chip image.

[0023] Step S202: Detect straight line segments in the target spatial transcriptome chip image to obtain multiple initial straight line segments.

[0024] In some optional implementations, step S202, namely detecting straight line segments in the target spatial transcriptome chip image to obtain multiple initial straight line segments, includes: Step S2021: Separate the target spatial transcriptome chip image into independent red channel grayscale images, green channel grayscale images, and blue channel grayscale images.

[0025] Step S2022: Detect straight line segments in the green channel grayscale image to obtain multiple initial straight line segments.

[0026] In this embodiment, the original spatial transcriptome chip image file is read and decoded into a standard RGB three-channel image matrix to ensure that the image data is loaded into memory completely and without error. The three-channel image matrix is ​​then separated into three independent red, green, and blue single-channel grayscale images, and the G-channel image with the most complete reference box information and the greatest difference from the background is retained for subsequent analysis.

[0027] In addition, before performing line segment detection, at least one of the following processes can be performed: Gaussian filtering denoising preprocessing, adaptive threshold binarization segmentation, morphological opening operation, and morphological closing operation.

[0028] The following examples illustrate the various image processing techniques described above.

[0029] Regarding Gaussian filtering noise reduction preprocessing: First, a discrete Gaussian convolution kernel is generated. Specifically, the continuous Gaussian function can be discretized and sampled on a two-dimensional grid to generate a discrete convolution kernel matrix (this discrete convolution kernel matrix can be odd-numbered or square-shaped), and then the matrix is ​​normalized to obtain the discrete Gaussian convolution kernel.

[0030] Then, the generated discrete Gaussian convolution kernel is used to perform Gaussian weighted average filtering on the target spatial transcriptome chip image (specifically, the aforementioned green channel grayscale image). Specifically, the generated discrete Gaussian convolution kernel can be used to perform a two-dimensional convolution operation with the green channel grayscale image. In this embodiment, the final grayscale value of each pixel is determined by the weighted average of its neighboring pixels, with the weights defined by the Gaussian kernel, thereby achieving smooth noise suppression.

[0031] Regarding adaptive threshold binarization segmentation: The first step is to define a local analysis window of a preset size so that the image can be systematically traversed using a sliding method. Specifically, this image can be the green channel grayscale image that has undergone Gaussian filtering and denoising preprocessing as described above.

[0032] The second step involves using the local analysis window to slide and select the current image region. A pre-generated Gaussian weight matrix is ​​then used to perform a weighted average of the pixel grayscale values ​​within the current image region, yielding a locally weighted average grayscale value for that region.

[0033] Specifically, the Gaussian weight matrix used can be the same or different depending on the current image region selected by the sliding selection. This Gaussian weight matrix is ​​a two-dimensional Gaussian distributed weight matrix, with the highest weight value at the center and decreasing weight values ​​at the edges. This is designed to give higher computational importance to pixels in the center region of the window, making the binarization threshold more sensitive to local center features.

[0034] The third step is to determine the adaptive binarization threshold corresponding to the current image region based on the local weighted average gray value within the current image region. Specifically, the adaptive binarization threshold can also be determined by combining the local weighted average gray value and the local gray standard deviation within the current image region.

[0035] The fourth step is to iterate through each pixel in the current image region and compare its gray value with the adaptive binarization threshold corresponding to the current image region: if the pixel gray value is less than or equal to the adaptive binarization threshold, it is classified as foreground; otherwise, it is classified as background.

[0036] The fifth step is to integrate the binarization results of all pixels in the target space transcriptome chip image (specifically, the green channel grayscale image mentioned above) to generate a binarized image for line segment detection.

[0037] In this embodiment, the use of Gaussian weighted local computation effectively suppresses block artifacts, ensuring a smooth transition of binarization results between different regions and providing high-quality foreground segmentation for subsequent processing.

[0038] Traditional methods for detecting reference boxes in spatial transcriptome chip images often suffer from noise interference and reference box breaks due to the complex background colors, varied textures, and uneven lighting of these images, resulting in poor foreground segmentation. This embodiment addresses this issue by fusing color channel separation technology with an adaptive threshold binarization algorithm to construct a robust image segmentation scheme. The scheme proposes a Gaussian weighted adaptive thresholding algorithm based on a sliding window. This algorithm establishes local analysis windows on the image and dynamically calculates binarization thresholds within each window using a Gaussian weighting method to adapt to the characteristics of the affected region. This scheme dynamically enhances the contrast between the reference box and the background and adaptively adjusts the segmentation threshold based on local image characteristics. This allows for accurate extraction and isolation of the reference box and foreground under various challenging background conditions, effectively suppressing the interference of background color and texture on the reference box detection process and ensuring the reliability of core feature extraction.

[0039] Regarding morphological opening operations: First, design and select structural elements: Based on the expected shape and size of the noise to be eliminated in the target space transcriptome chip image (specifically, the binarized image mentioned above), select a structural element (which can be called the first structural element). Specifically, a suitable flat structural element with a size slightly larger than the main noise point can be selected.

[0040] Then, an erosion operation is performed to eliminate tiny adhesions: the selected structuring element is slid across the image, and the erosion operation is performed. Only when the structuring element is completely within the foreground region is the center pixel preserved, thereby eliminating isolated noise points and reducing the foreground region.

[0041] Finally, a dilation operation is performed to restore the subject's outline: the same structuring element is used to perform the dilation operation on the eroded image. Whenever the structuring element intersects with the foreground region, the center pixel is set to the foreground, thus restoring the size of the preserved subject region while removing isolated noise smaller than the structuring element, thus cleansing the image.

[0042] Regarding morphological closing operations: First, design and select structural elements: Based on the expected width of the fracture or hole to be repaired in the target spatial transcriptome chip image (specifically, it can be the aforementioned binarized image or a binarized image after morphological opening operation), select a structural element (which can be called a second structural element). Specifically, you can choose a suitable flat structural element that is slightly larger than the main defect.

[0043] Next, a dilation operation is performed to bridge the narrow break: the selected structuring element is slid across the image, and the dilation operation is performed first. This operation expands the foreground area, effectively connecting adjacent line segments separated by the break.

[0044] Finally, an erosion operation is performed to refine the dilation result: the same structuring element is used to perform the erosion operation on the dilated image. This operation shrinks the foreground area, aiming to restore the approximate original width of the reference box lines while maintaining the connectivity established during the dilation stage, thus repairing the contours.

[0045] In response to the noise and discrete impurities commonly found in real-world images, this embodiment provides a multi-layered filtering and screening mechanism, constructing a systematic anti-noise and anti-impurity interference defense system. This system comprehensively utilizes Gaussian filtering for noise smoothing and morphological operations to purify image morphology, thereby systematically improving the fault tolerance and stability of this embodiment under low-quality, high-noise imaging conditions.

[0046] The following example illustrates a specific method for detecting straight line segments.

[0047] In some alternative implementations, such as Figure 2 As shown, step S202, which is the detection of straight line segments in the target spatial transcriptome chip image, yields multiple initial straight line segments, including: Step S202a: Determine the threshold of the Hough accumulator based on the size of the target spatial transcriptome chip image.

[0048] The target spatial transcriptome chip image can be a binarized image, specifically a binarized image that has undergone Gaussian filtering denoising preprocessing, adaptive threshold binarization segmentation, morphological opening operation, and morphological closing operation as described above.

[0049] In other specific implementations, the threshold of the Hough accumulator can be dynamically set by combining the size of the target spatial transcriptome chip image and the density of foreground pixels. For example, the threshold of the Hough accumulator can be dynamically derived using a nonlinear function.

[0050] The threshold of the Hough accumulator is used to determine whether a peak in the Hough space is sufficient to represent a meaningful line segment.

[0051] Step S202b: Execute the probabilistic Hough transform algorithm within the set Hough parameter space, and identify the target local peak exceeding the threshold in the Hough accumulator.

[0052] Specifically, the probabilistic Hough transform algorithm accumulates the pixels of all possible line segments by randomly sampling pixels in the binarized image and voting on them.

[0053] Step S202c: Based on the target local peaks, the initial line segments are obtained. Specifically, each peak corresponds to a potential line segment in the image space. These target local peaks are then mapped back to image coordinates to obtain a set of initial line segment detection results.

[0054] In addition, the quantization step size of the Hough parameter space is determined based on the size of the target space transcriptome chip image and the expected line segment detection accuracy, thereby ensuring a balance between computational complexity and detection resolution.

[0055] Line detection methods in related technologies are difficult to adapt to images of different sizes due to fixed parameter settings. This embodiment constructs an adaptive adjustment mechanism for detection parameters based on image size. By establishing a mapping relationship between the physical size of the image and the cumulative plane threshold of the Hough transform, key parameters are dynamically optimized with the image size, thereby enabling stable and accurate extraction of the reference box line structure in input images of different scales.

[0056] Step S203: Obtain the intersection point of each pair of initial line segments. Here, the intersection point includes the intersection point formed within the target space transcriptome chip image size range after the initial line segments are extended.

[0057] In some optional embodiments, before step S203, that is, before obtaining the intersection point of each pair of the initial line segments, the method further includes: Based on the position and orientation of the initial line segments, the initial line segments are merged. Specifically, short line segments (short initial line segments) that are detected and are close in position and have similar orientation in the image space can be identified and merged to form longer and more complete line segments, reducing redundancy.

[0058] In some alternative embodiments, before step S203, that is, before obtaining the intersection point of each pair of the initial line segments, the method further includes: The initial straight line segment is extended based on the size of the target spatial transcriptome chip image or the expected size of the reference frame.

[0059] The initial line segment here can be either the detected initial line segment or the initial line segment obtained after collinear segment merging. That is, for the initial line segment detected by Hough transform, collinear segment merging can be performed first, and then extension processing can be performed.

[0060] The collinear segment merging process described above is generally used to merge short line segments that are close in position and have similar directions in image space. However, it cannot merge line segments with relatively long interruptions. Therefore, in this embodiment, line segment extension processing is used to merge line segments with relatively long interruptions.

[0061] Specifically, the process of extending the initial straight line segment based on the size of the target spatial transcriptome chip image or the expected size of the reference frame includes: First, based on the size of the target spatial transcriptome chip image or the expected size of the reference frame, and the length of the initial straight line segment, the extension amount is determined to ensure that the extension amount can cover possible interrupted areas; the size of the target spatial transcriptome chip image mentioned here can be the diagonal length or the length and width dimensions, which can be determined according to the shape of the reference frame and its relative position in the image.

[0062] Then, the initial straight line segment is extended by a determined amount to connect the two line segments on the same straight line.

[0063] Of course, while determining the amount of extension, it is also necessary to determine the direction of extension. Generally, it should be extended towards the direction where there are other initial straight line segments. It is also possible to extend simultaneously towards both ends of the initial straight line segments.

[0064] In other alternative embodiments, the process of extending the initial straight line segment based on the size of the target spatial transcriptome chip image or the expected size of the reference frame may also include: Based on the dimensions of the target spatial transcriptome chip image or the expected dimensions of the reference frame, the initial straight line segment is extended to the boundary of the target spatial transcriptome chip image, or to the boundary of the region of interest, which is determined based on the expected dimensions of the reference frame. This enables the formation of finite-length virtual line segments that can be used for visualization analysis and intersection calculation, avoiding invalid distal intersections.

[0065] The extension processing method provided in this embodiment can not only merge collinear initial line segments, but also merge line segments with long interruptions. It can also fill missing parts near the vertices of the reference frame.

[0066] Spatial transcriptome microarray images may suffer from partial defects in the reference bounding box due to tissue or other obstructions, as well as discontinuities or breaks in the reference bounding box lines themselves. These factors often lead to detection failures or localization errors, significantly limiting the accuracy and reliability of reference bounding box detection. When the reference bounding box is partially interrupted due to tissue coverage, imaging defects, or printing defects, the reference bounding box detection methods provided in related technologies struggle to achieve complete detection. This application introduces a straight line extension repair mechanism and an intelligent result filtering strategy to virtually repair broken frame lines, ensuring that all theoretically intersecting non-parallel straight lines generate valid intersection points. It also accurately distinguishes between true reference bounding box lines and tissue artifacts (i.e., interference lines generated by tissue), ensuring that even with incomplete frame lines, all reference bounding box intersection points can still be located completely and accurately, and a complete reference bounding box structure can be reconstructed. In other words, this method significantly improves the algorithm's fault tolerance and reconstruction accuracy for incomplete reference bounding box structures.

[0067] Traditional spatial transcriptome chip image bounding box detection methods are highly coupled to the fixed size of the input image, making it difficult to flexibly adapt to image inputs with varying resolutions or scales, thus limiting their versatility in practical applications. The bounding box detection method for spatial transcriptome chip images provided in this embodiment not only adaptively determines the threshold of the Hough accumulator and the quantization step size of the Hough parameter space based on the image size during the line detection stage, but also limits the extension amount based on the image size during the stages of extending detected lines to merge collinear discrete line segments and determining line intersections. This decouples the detection performance of the bounding box detection method provided in this embodiment from the size of the input image, allowing for flexible adaptation to image inputs with varying resolutions or scales.

[0068] In other words, this embodiment establishes an adaptive correlation between image size and core detection parameters, thereby achieving dynamic optimization and adjustment of key detection parameters. This enables the reference box detection method provided in this embodiment to seamlessly adapt to input images of different resolutions and scales, ensuring that the detection performance is not affected by image scaling or resolution changes, and demonstrating excellent versatility and practicality.

[0069] The following example illustrates how to obtain the intersection point of each of the two initial line segments.

[0070] First, for each initial line segment, construct a standard linear equation. Then, for every two initial line segments, simultaneously construct a system of two linear equations in two variables. The initial line segments here can be the non-repeating line segments obtained after the above merging and extension processes.

[0071] Next, calculate the determinant of the coefficient matrix of the system of equations to determine whether the two lines intersect. If they intersect, solve the system of equations to obtain the coordinates of the unique intersection point.

[0072] Finally, all successfully solved intersection points whose coordinates lie within the valid boundaries of the image are recorded to form a preliminary, unfiltered set of candidate intersection point coordinates.

[0073] Step S204: For the intersection of the lines, if the included angle between the two initial line segments corresponding to the intersection of the lines does not meet the preset included angle constraint condition, then the intersection of the lines is eliminated; the included angle constraint condition is determined based on the actual shape of the reference box of the target spatial transcriptome chip image.

[0074] In some optional implementations, before step S204, that is, before filtering out the intersection points of the lines if the included angle between the two initial line segments corresponding to the intersection points does not meet the preset included angle constraint condition: Step 1: Obtain the equation of the line corresponding to the initial line segment; this equation is also the standard linear equation described in the above embodiment; the initial line segment here can be the initial line segment corresponding to the intersection point of the lines; Step 2: Based on the equation of the line, determine the direction vector of the corresponding initial line segment; Step 3: Using the dot product formula, calculate the angle between the direction vectors corresponding to the two initial line segments.

[0075] In addition, after obtaining the included angle between the two initial line segments corresponding to the intersection of the lines using the above method, the included angle can be normalized to a specific angle range to eliminate the influence of the line direction.

[0076] In this embodiment, a reasonable angle constraint is determined based on the actual shape of the reference frame of the target spatial transcriptome chip image, and it is checked whether the angle obtained by normalization meets the angle constraint. All intersections that meet the angle constraint are retained and included in the high-confidence candidate set; while intersections that do not meet the angle constraint are regarded as noise and discarded.

[0077] Step S205: Based on the retained intersection points of the straight lines, determine the reference frame intersection points of the target spatial transcriptome chip image.

[0078] In some optional implementations, step S205, namely determining the reference frame intersection of the target spatial transcriptome chip image based on the preserved intersection of the straight lines, includes: Step S2051: Perform spatial clustering analysis on the retained line intersections to identify line intersections that cluster in space, resulting in multiple intersection clusters. The line intersections in one intersection cluster typically correspond to the same corner point of the reference frame, because the reference frame has a certain width.

[0079] Step S2052: For multiple straight line intersections in the intersection cluster, determine the first geometric center point of the multiple straight line intersections.

[0080] In this embodiment, for a cluster of intersection points, the geometric center point of the coordinates of all intersection points inside it is calculated and used as the precise and unique representative coordinates of the corresponding corner points.

[0081] Step S2053: Based on the determined plurality of first geometric center points, determine the reference frame intersection point of the target spatial transcriptome chip image. Specifically, the first geometric center point can be directly determined as the reference frame intersection point of the target spatial transcriptome chip image.

[0082] In some optional implementations, step S2053, namely determining the reference frame intersection of the target spatial transcriptome chip image based on the determined plurality of first geometric center points, includes: Step S20531: Obtain the convex hull of multiple first geometric center points; Step S20532: If the number of vertices of the convex hull is the same as the expected number of vertices of the reference frame, then the vertices of the convex hull are determined to be the intersection points of the reference frame (specifically, the intersection points of the inner edges of the reference frame). For example, if the reference frame is a quadrilateral, then the convex hull should be composed of exactly four vertices.

[0083] In response to the noise and discrete impurities commonly found in real-world images, this embodiment provides a progressive multi-stage filtering and screening mechanism, constructing a systematic anti-noise and anti-impurity interference defense system. This system comprehensively utilizes Gaussian filtering for noise smoothing and suppression, morphological operations to purify image morphology and remove discrete impurities, and combines geometric feature rules (angle, number of vertices, etc.) to screen intersection detection results, thereby systematically improving the fault tolerance, stability, and robustness of this embodiment under low-quality, high-noise imaging conditions.

[0084] In some optional implementations, step S205, namely determining the reference frame intersection of the target spatial transcriptome chip image based on the preserved intersection of the straight lines, further includes: Step S205a: For multiple line intersections in the intersection cluster, calculate the distance between every two line intersections and calculate the average value; Step S205b: Determine the first reference frame intersection point as the reference frame intersection point corresponding to the target intersection point cluster; the target intersection point cluster is the intersection point cluster with the smallest average distance between straight line intersection points; Step S205c: Obtain the second geometric center point of the intersection of the reference frame; Step S205d: Use the vector pointing from the second geometric center point to the intersection of the first reference frame as the reference vector; Step S205e: Obtain the target vectors pointing from the second geometric center point to other reference frame intersections, wherein the other reference frame intersections are reference frame intersections other than the first reference frame intersection. Step S205f: Calculate the azimuth angle between the target vector and the reference vector; Step S205g: Sort the intersection points of the other reference frames according to the order of increasing or decreasing azimuth angles.

[0085] For scenarios where the reference frame includes two narrow sides (all other sides of the reference frame are wider than these two narrow sides), this embodiment can accurately identify the intersection point of the two narrow sides, which serves as the first reference frame intersection point in the entire intersection point coordinate sequence. Then, the geometric centers of multiple (e.g., four) reference frame intersection points (specifically, the inner edge intersection points mentioned above) are calculated. Next, the vector pointing from the geometric center to the first reference frame intersection point is used as the reference vector, and the remaining reference frame intersection points are also converted into vectors relative to the geometric center. The azimuth angles between all vectors and the reference vector are calculated, and all reference frame intersection points are sorted in descending (or ascending) order of azimuth angle to ensure that the output is a continuous sequence of intersection points in a unified direction.

[0086] In complex spatial transcriptome microarray images, simply locating intersection points is insufficient to support accurate subsequent analysis. This embodiment overcomes the technical challenge of accurately identifying the "first intersection point" among multiple intersection points and correctly spatially ordering them. By introducing a discrimination algorithm based on geometric features and topological relationships, it ensures that the intersection points of the reference frame can be uniquely and correctly ordered, providing a reliable and structured coordinate foundation for subsequent geometric measurements and data analysis.

[0087] In summary, this embodiment not only robustly detects the precise coordinates of the intersection points of the reference frame (specifically, the intersection points of the inner edges), but also intelligently identifies and automatically sorts the intersection points based on the morphological features of the reference frame edges. This capability ensures that the output results have a consistent structured format, providing a high-quality data foundation that can be directly used for subsequent quantitative analysis and automated processing.

[0088] Figure 3 A schematic diagram of a spatial transcriptome chip image (including reference box 301) is shown. Figure 4 The diagram shows the intersection points 302 of the reference boxes and their order, detected using the reference box detection method for spatial transcriptome chip images provided in this embodiment.

[0089] This embodiment also provides a reference frame detection device for spatial transcriptome chip images. This device is used to implement the above embodiments and preferred embodiments, and details already described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0090] This embodiment provides a reference box detection device for spatial transcriptome chip images, such as... Figure 5 As shown, it includes: Image acquisition module 501 is used to acquire target spatial transcriptome chip images; The straight line detection module 502 is used to detect straight line segments in the target spatial transcriptome chip image to obtain multiple initial straight line segments; The line intersection point acquisition module 503 is used to acquire the line intersection point corresponding to each of the two initial line segments; The line intersection filtering module 504 is used to filter out the line intersection if the included angle between the two initial line segments corresponding to the line intersection does not meet the preset included angle constraint condition; the included angle constraint condition is determined based on the actual shape of the reference box of the target spatial transcriptome chip image. The reference frame intersection determination module 505 is used to determine the reference frame intersection of the target spatial transcriptome chip image based on the retained line intersections.

[0091] In some optional implementations, the line detection module 502 includes: The channel separation unit is used to separate the target spatial transcriptome chip image into independent red channel grayscale images, green channel grayscale images, and blue channel grayscale images; The detection unit is used to detect straight line segments in the green channel grayscale image to obtain multiple initial straight line segments.

[0092] In some optional embodiments, the reference frame detection device for the spatial transcriptome chip image further includes: An equation acquisition module is used to acquire the equation of the line corresponding to the initial line segment; The direction vector determination module is used to determine the direction vector of the corresponding initial line segment based on the line equation. The angle calculation module is used to calculate the angle between the direction vectors corresponding to the two initial line segments using the vector dot product formula.

[0093] In some optional implementations, the line detection module 502 includes: A threshold determination unit is used to determine the threshold of the Hough accumulator based on the size of the target spatial transcriptome chip image; The peak identification unit is used to perform a probabilistic Hough transform algorithm in a set Hough parameter space and identify target local peaks that exceed the threshold in the Hough accumulator. A straight line determination unit is used to obtain the initial straight line segment based on the target local peak value.

[0094] In some alternative implementations, the quantization step size of the Hough parameter space is determined based on the size of the target space transcriptome chip image and the expected line segment detection accuracy.

[0095] In some optional embodiments, the reference frame detection device for the spatial transcriptome chip image further includes: A merging module is used to merge the initial line segments based on their position and orientation. And / or, An extension module is used to extend the initial straight line segment based on the size of the target spatial transcriptome chip image or the expected size of the reference frame.

[0096] In some optional implementations, the reference frame intersection determination module 505 includes: Clustering units are used to perform spatial clustering analysis on the retained intersection points of the lines, identify the intersection points of the lines that are clustered in space, and obtain multiple intersection point clusters; The first geometric center determination unit is used to determine the first geometric center point of the multiple straight line intersection points in the intersection point cluster. The intersection point determination unit is used to determine the reference frame intersection points of the target spatial transcriptome chip image based on a plurality of determined first geometric center points.

[0097] In some optional implementations, the intersection point determination unit is specifically used to obtain the convex hull of a plurality of the first geometric center points; if the number of vertices of the convex hull is the same as the expected number of vertices of the reference frame, then the vertices of the convex hull are determined as the intersection points of the reference frame.

[0098] In some optional implementations, the reference frame intersection determination module 505 further includes: The distance calculation unit is used to calculate the distance between every two line intersections in the intersection cluster, and to calculate the average value. The first intersection point determination unit is used to determine the intersection point of the reference frame corresponding to the target intersection point cluster as the first reference frame intersection point; the target intersection point cluster is the intersection point cluster with the smallest average distance between straight line intersection points; The second geometric center point acquisition unit is used to acquire the second geometric center point of the intersection of the reference frame; A reference vector determination unit is used to take the vector pointing from the second geometric center point to the intersection of the first reference frame as a reference vector; The target vector acquisition unit is used to acquire the target vectors pointing from the second geometric center point to other reference frame intersections, wherein the other reference frame intersections are reference frame intersections other than the first reference frame intersection. An azimuth angle calculation unit is used to calculate the azimuth angle between the target vector and the reference vector; The sorting unit is used to sort the intersection points of the other reference frames in ascending or descending order of azimuth angle.

[0099] The reference box detection device for spatial transcriptome chip images provided in this embodiment of the invention can execute the reference box detection method for spatial transcriptome chip images provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method. Further functional descriptions of the above modules and units are the same as in the corresponding embodiments described above, and will not be repeated here.

[0100] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.

[0101] The following is a detailed reference. Figure 6 This diagram illustrates a suitable structural design for implementing an electronic device according to embodiments of the present invention. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 601, which can perform various appropriate actions and processes based on a program stored in read-only memory (ROM) 602 or a program loaded from memory 608 into random access memory (RAM) 603. RAM 603 also stores various programs and data required for the operation of the electronic device. The processor 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0102] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.

[0103] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a memory 608, or installed from a ROM 602. When the computer program is executed by the processor 601, it performs the functions defined in the reference frame detection method for spatial transcriptome chip images according to embodiments of the present invention.

[0104] Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.

[0105] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and subsequently stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the reference frame detection method for spatial transcriptome chip images shown in the above embodiments is implemented.

[0106] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.

[0107] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A method for detecting reference boxes in spatial transcriptome microarray images, characterized in that, The method includes: Acquire target spatial transcriptome microarray images; Multiple initial line segments are obtained by detecting straight line segments in the target spatial transcriptome chip image; Obtain the intersection point of the lines corresponding to each of the two initial line segments; For the intersection of the lines, if the included angle between the two initial line segments corresponding to the intersection does not meet the preset included angle constraint condition, then the intersection of the lines is eliminated; the included angle constraint condition is determined based on the actual shape of the reference box of the target spatial transcriptome chip image. Based on the preserved intersection points of the straight lines, the reference frame intersection points of the target spatial transcriptome chip image are determined.

2. The method according to claim 1, characterized in that, The detection of straight line segments in the target spatial transcriptome chip image yields multiple initial straight line segments, including: The target spatial transcriptome chip image is separated into independent red channel grayscale images, green channel grayscale images, and blue channel grayscale images; The line segments in the green channel grayscale image are detected to obtain multiple initial line segments.

3. The method according to claim 1, characterized in that, Before filtering out the intersection points of the lines, if the included angle between the two initial line segments corresponding to the intersection point does not meet the preset included angle constraint condition, the process further includes: Obtain the equation of the line corresponding to the initial line segment; Based on the equation of the line, determine the direction vector of the corresponding initial line segment; The angle between the direction vectors corresponding to the two initial line segments is calculated using the dot product formula.

4. The method according to claim 1 or 3, characterized in that, The detection of straight line segments in the target spatial transcriptome chip image yields multiple initial straight line segments, including: The threshold of the Hough accumulator is determined based on the size of the target spatial transcriptome chip image; The probabilistic Hough transform algorithm is executed within the set Hough parameter space, and the target local peak exceeding the threshold is identified in the Hough accumulator; The initial straight line segment is obtained based on the target local peak value.

5. The method according to claim 4, characterized in that, The quantization step size of the Hough parameter space is determined based on the size of the target space transcriptome chip image and the expected line segment detection accuracy.

6. The method according to claim 1, characterized in that, Before obtaining the intersection point of each pair of the initial line segments, the method further includes: Based on the position and direction of the initial line segments, the initial line segments are merged; And / or, The initial straight line segment is extended based on the size of the target spatial transcriptome chip image or the expected size of the reference frame.

7. The method according to claim 1, characterized in that, The determination of the reference frame intersection of the target spatial transcriptome chip image based on the preserved intersection of the straight lines includes: Spatial clustering analysis is performed on the retained line intersections to identify the line intersections that cluster in space, resulting in multiple intersection clusters; For multiple straight line intersections in the intersection cluster, determine the first geometric center point of the multiple straight line intersections; Based on the determined plurality of first geometric center points, the reference frame intersection points of the target spatial transcriptome chip image are determined.

8. The method according to claim 7, characterized in that, The step of determining the reference frame intersection of the target spatial transcriptome chip image based on the determined plurality of first geometric center points includes: Obtain the convex hull of multiple first geometric center points; If the number of vertices of the convex hull is the same as the expected number of vertices of the reference frame, then the vertices of the convex hull are determined to be the intersection points of the reference frame.

9. The method according to claim 7 or 8, characterized in that, The method of determining the reference frame intersection of the target spatial transcriptome chip image based on the preserved intersection of the straight lines further includes: For multiple line intersections in the intersection cluster, calculate the distance between every two line intersections and calculate the average value; The intersection point of the reference frame corresponding to the target intersection point cluster is determined as the first reference frame intersection point; the target intersection point cluster is the intersection point cluster with the smallest average distance between the line intersection points; Obtain the second geometric center point of the intersection of the reference frame; The vector pointing from the second geometric center point to the intersection of the first reference frame is used as the reference vector; Obtain the target vectors pointing from the second geometric center point to other reference box intersections, wherein the other reference box intersections are reference box intersections other than the first reference box intersection; Calculate the azimuth angle between the target vector and the reference vector; The intersection points of the other reference frames are sorted according to the order of increasing or decreasing azimuth angle.

10. A reference box detection device for spatial transcriptome chip images, characterized in that, The device includes: The image acquisition module is used to acquire images of the target spatial transcriptome chip. The straight line detection module is used to detect straight line segments in the target spatial transcriptome chip image and obtain multiple initial straight line segments; The line intersection point acquisition module is used to acquire the line intersection point corresponding to each of the two initial line segments; The line intersection filtering module is used to filter out the line intersection if the included angle between the two initial line segments corresponding to the line intersection does not meet the preset included angle constraint condition; the included angle constraint condition is determined based on the actual shape of the reference box of the target spatial transcriptome chip image. The reference frame intersection determination module is used to determine the reference frame intersection of the target spatial transcriptome chip image based on the retained line intersections.