Method, device and system for processing intestinal space-time group curled images
Through polygon annotation and spatial conversion technology, the coordinate confusion and sample layout limitation of intestinal biological sample data processing in the prior art are solved, and detailed comparison and analysis of different intestinal areas are realized, and data visualization and interpretation efficiency are improved.
Patent Information
- Application Number
- CN202411640456.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-11-18
AI Technical Summary
Existing spatial transcriptomics technologies face the problems of coordinate system intersection, sample layout limitations and lack of effective visualization tools when dealing with intestinal biological samples, resulting in difficulty in intuitive comparison and detailed interpretation of data.
By obtaining the target image and sequencing data based on the spatiotemporal group chip, polygon annotation is used to obtain the coordinate pixel matrix, combining the expression matrix data to convert it into an RDS file, mapping the coordinate matrix in the image feature annotation file, constructing an ordered set of bin regions, and spatially converting each bin region to form a straightened image.
Detailed comparison and analysis of different intestinal areas is realized, data visualization and interpretation efficiency is improved, and coordinate confusion and sample layout limitations are solved.
Smart Images

Figure CN119151777B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of spatiotemporal omics, and in particular to a method, device and system for processing intestinal spatiotemporal group curled images. Background Art
[0002] Spatial transcriptomics (ST) technology is a revolutionary scientific method that allows researchers to observe gene expression within cells with unprecedented spatial resolution. This technology combines biological samples (such as mouse intestines) with high-density biochips to achieve accurate mapping of gene activity within tissues and construct a curly image of the intestinal spatiotemporal group. This not only enhances the understanding of complex interactions between cells, but also provides deep insights into the biological basis of diseases, especially in the complex intestinal environment. This technology helps scientists to analyze in detail the cell and gene expression patterns in health and disease states.
[0003] Although spatial transcriptomics technology has provided significant progress in intestinal biology research, existing application methods still face some limitations in data processing and interpretation. Existing technologies attempt to overcome the challenges posed by the complex morphology of samples by establishing a coordinate system on the outer ring of the intestinal roll to calibrate the position of each point. However, this method has intersections and overlaps between coordinate systems in actual operation. This coordinate confusion makes it impossible to accurately determine the specific characteristics of the surrounding points, thereby affecting the accurate description of the detailed characteristics of the local area.
[0004] In addition, due to the spiral coiled layout of the sample, although a certain spatial continuity is maintained, this physical morphology limits the direct comparison of different regions of the intestine, especially in detailed longitudinal and transverse analysis. For example, it is difficult to clearly show the changes in gene expression and the distribution of functional areas from the beginning to the end of the intestine in longitudinal comparisons; in transverse analysis, it is also difficult to distinguish subtle differences between different cell types or sub-regions in the same cross-section. These limitations reduce the ability of researchers to understand complex pathological processes, especially when comparing tissue samples under different experimental conditions.
[0005] In summary, although spatial transcriptomics technology has made breakthrough progress in the study of intestinal diseases, it still needs to be improved in terms of intuitive comparison of data, detailed interpretation, and ease of operation. The intersection of coordinate systems, limitations of sample layout, and lack of effective visualization tools are the main technical obstacles that existing methods need to overcome in their application. The existence of these problems not only affects the reliability of the data, but also limits the ability to obtain accurate information from complex biological samples. Summary of the invention
[0006] In a first aspect, the present invention provides a method for processing a curled image of an intestinal spatiotemporal group, comprising:
[0007] Acquire a target image and sequencing data based on the spatiotemporal chip, and perform polygon annotation on a target curling region in the target image to obtain an image feature annotation file containing a coordinate pixel matrix of the target curling region;
[0008] Analyze the sequencing data to obtain expression matrix data, and convert the data into an RDS file containing the expression matrix data in combination with the physical coordinates of the spatiotemporal group chip;
[0009] Based on the RDS file, mapping the coordinate pixel matrix in the image feature annotation file to the target image to obtain an original coordinate matrix;
[0010] According to the original coordinate matrix, construct a set of ordered bin regions, and map each cell in the RDS file to the bin region;
[0011] A spatial transformation is performed on each of the bin regions to form a straightened image, the transformed coordinates in the bin region are obtained, and a visualization image is constructed based on the transformed coordinates.
[0012] In an optional implementation, the polygonal marking of the target curled area in the target image includes:
[0013] Using polygonal point drawing method, annotate the outer contour edge of the target curling area, connect the end to the end to form a closed loop, and obtain the outer contour annotation result; and annotate the inner contour edge of the target curling area, connect the end to the end to form a closed loop, and obtain the inner contour annotation result;
[0014] The coordinate pixel matrix is formed according to the outer contour marking result and the inner contour marking result, and the image feature marking file is constructed according to the coordinate pixel matrix.
[0015] In an optional embodiment, before analyzing the sequencing data to obtain expression matrix data, the method further includes:
[0016] The sequencing data is subjected to lasso processing along the outermost tissue contour, and the SAW analysis process is used to perform data analysis to obtain the sequencing data including the expression matrix.
[0017] In an optional implementation, mapping the coordinate pixel matrix in the image feature annotation file to the target image based on the RDS file to obtain the original coordinate matrix includes:
[0018] The coordinate pixel matrix of the target image is inversely mapped to the intestinal spatiotemporal group curled image corresponding to the target image through a coordinate conversion formula, and the coordinates in the image feature annotation file are updated through the coordinates in the intestinal spatiotemporal group curled image; wherein the target image is an image obtained by reducing the pixel count of the intestinal spatiotemporal group curled image;
[0019] Performing registration processing on the coordinate matrix formed by the coordinates in the image feature annotation file through the expression matrix data in the RDS file to obtain the original coordinate matrix after registration;
[0020] The coordinate transformation formula includes:
[0021] ; ;
[0022] Among them, x new and new represents the horizontal and vertical coordinates of the point in the target image before transformation; old and old represents the horizontal and vertical coordinates of the points in the transformed intestinal spatiotemporal group curled image; h new represents the total height of pixel coordinates in the target image; h old represents the total height of pixel coordinates in the curled image of the intestinal spatiotemporal group; w new represents the total width of pixel coordinates in the target image; w old represents the total width of pixel coordinates in the curled image of the intestinal spatiotemporal group;
[0023] The coordinate matrix formed by the coordinates in the image feature annotation file is registered by using the expression matrix data in the RDS file to obtain the registered original coordinate matrix, including:
[0024] Perform contour extraction on the coordinate matrix in the image feature annotation file and the expression matrix data containing the physical coordinates in the RDS file, respectively, to obtain polygonal contour dot matrices corresponding to the coordinate matrix and the expression matrix data, respectively; wherein the polygonal contour dot matrix includes an outer contour dot matrix and an inner contour dot matrix;
[0025] Performing registration processing of the outer contour point matrix and the inner contour point matrix in the polygonal contour point matrix respectively on the outer coordinate points and the inner coordinate points to obtain the original coordinate matrix after registration;
[0026] The registering process of the outer coordinate points and the inner coordinate points respectively comprises:
[0027] For the peripheral coordinate points or the inner coordinate points, a mask image is generated for the polygonal contour dot matrix corresponding to the coordinate matrix and the expression matrix data respectively; wherein the mask image includes a core contour area of the polygon and a peripheral area surrounding the core contour area;
[0028] Binarizing each of the mask images respectively to convert them into a binary image retaining the core contour area; the binary image includes a first image corresponding to the coordinate matrix and a second image corresponding to the expression matrix data;
[0029] Determine the outer contour and geometric center point of the core contour area in each of the binary images;
[0030] The first image and the second image are translated using the geometric center point to perform a coordinate translation transformation focus process; and based on the geometric center point and the outer contour, an image deflection angle of the first image relative to the second image in the coordinate translation transformation focus process is determined;
[0031] Determining whether the image deflection angle is not greater than a preset angle threshold;
[0032] If so, it is determined that the registration process of the first image based on the second image is qualified.
[0033] After determining whether the image deflection angle is not greater than a preset angle threshold, the method further includes:
[0034] If not, it is determined that the registration processing of the first image based on the second image is unqualified; the coordinate matrix in the image feature annotation file and the expression matrix data containing the physical coordinates in the RDS file are respectively extracted to obtain the corresponding polygon contour point matrix;
[0035] Generate a mask image for each polygonal contour dot matrix; wherein the mask image includes a core contour area of the polygon and a peripheral area of the core contour area;
[0036] Marking the edge of the core contour area of the mask image and calculating the geometric center point of the core contour area;
[0037] Coordinate translation transformation is performed using the geometric center point and annotated edge of each mask image to match the direction of the mask image, and the mask image is returned to execute the above-mentioned step of generating a mask image for the polygonal contour dot matrix corresponding to the coordinate matrix and the expression matrix data respectively, with respect to the outer coordinate points or the inner coordinate points.
[0038] In an optional implementation, after mapping the coordinate pixel matrix in the image feature annotation file to the target image based on the RDS file and obtaining the original coordinate matrix, the method further includes:
[0039] Performing filtering and redundancy removal processing on the outer contour dot matrix and the inner contour dot matrix of the polygonal contour dot matrix in the original coordinate matrix respectively;
[0040] The filtering and redundancy removal process comprises:
[0041] For one of the outer contour dot matrix and the inner contour dot matrix, three coordinate points arranged in sequence in the contour dot matrix are selected in order, and a triangular area is formed based on the three coordinate points;
[0042] Based on the RDS file, determining whether the number of cell points contained in the triangular area is not less than a preset cell point number threshold;
[0043] If yes, retain the first coordinate point of the three coordinate points, select three coordinate points arranged in sequence in the contour lattice from the second coordinate point, and form a triangular area again, and return to execute the RDS file based on the triangular area to determine whether the number of cell points contained in the triangular area is not less than the preset cell point number threshold until the coordinate points in the contour lattice are processed;
[0044] If not, delete the coordinate point in the middle of the three coordinate points constituting the triangle, and take the first coordinate point and the third coordinate point constituting the triangle as adjacent coordinate points, select the next coordinate point adjacent to the third coordinate point, and together form a triangle again, and return to execute the method based on the RDS file to determine whether the number of cell points in the triangle area is not less than the preset cell point number threshold;
[0045] The step of constructing a set of ordered bin regions according to the original coordinate matrix, and mapping each cell in the RDS file to the bin region, comprises:
[0046] Using the outer contour dot matrix and the inner contour dot matrix in the polygon contour dot matrix of the original coordinate matrix, a bin set including bin areas that are sequentially connected and arranged in order is constructed; the bin area is the area where the polygon includes at least 3 sides;
[0047] Mapping each cell in the RDS file to the bin region in the bin set;
[0048] The method of using the outer contour dot matrix and the inner contour dot matrix in the polygonal contour dot matrix of the original coordinate matrix to construct a bin set including bin areas that are sequentially connected and arranged in order includes:
[0049] In the original coordinate matrix, two adjacent outer coordinate points in the outer contour dot matrix are selected in sequence as the lower left point and the lower right point respectively; the inner coordinate point corresponding to the lower left point in the inner contour dot matrix is selected as the upper left point; or the upper right point of the adjacent previous bin area is selected as the current upper left point;
[0050] Determine an upper right point according to the lower left point, the lower right point and the upper left point;
[0051] A bin area is formed based on the lower left point, the lower right point, the upper left point and the upper right point;
[0052] The bin set is constructed based on the bin areas that are connected and arranged in order; wherein, in adjacent bin areas, the upper right point of the previous bin area is the upper left point of the next bin area; and the lower right point of the previous bin area is the lower left point of the next bin area;
[0053] The determining the upper right point according to the lower left point, the lower right point and the upper left point comprises:
[0054] Determine a straight line passing through the lower right point and perpendicular to a line connecting the lower left point and the lower right point as a first straight line;
[0055] Determine a straight line passing through the upper left point and perpendicular to the first straight line as a second straight line; and take the intersection of the first straight line and the second straight line as an intersection point;
[0056] Selecting inner coordinate points whose horizontal coordinates fall between the upper left point and the intersection point in the inner contour dot matrix as a selected point set;
[0057] The pixel distance between each coordinate point in the selected point set and the lower right point is calculated, and the coordinate point with the smallest pixel distance is selected as the upper right point.
[0058] In an optional embodiment, after constructing a bin set comprising bin areas that are sequentially connected and arranged in order, the method further includes:
[0059] The length between the lower left point and the lower right point of all the bin areas is used as the bottom edge length; the mean or median of the bottom edge lengths of all the bin areas in the bin set is calculated as the evaluation value;
[0060] Determine whether there is a bin area in the bin set whose bottom length is less than the evaluation value;
[0061] If there is a bin region whose bottom length is less than the evaluation value, merge the bin region with the adjacent previous or next bin region until the bottom length of the merged bin region is not less than the evaluation value;
[0062] The average length of the bottom edges of all bin areas in the bin set is calculated according to the formula as the average length value: Represents the total number of bin areas in the bin set;
[0063] Determine whether there is a bin region in the bin set whose bottom length is less than the average length value;
[0064] If there is a bin region whose bottom length is less than the average length value, the bin region is merged with the adjacent previous or next bin region until the bottom length of the merged bin region is not less than the average length value;
[0065] Obtaining the number of cells contained in each of the bin regions of the bin set; and determining whether there is a bin region in the bin set whose cell number is less than a preset cell number threshold;
[0066] If there is a bin region with a cell number less than a preset cell number threshold, the bin region is merged with the adjacent previous or next bin region until the cell number in the merged bin region is not less than the preset cell number threshold.
[0067] In an optional embodiment, performing spatial transformation on each of the bin regions to form a straightened image and obtaining transformed coordinates in the bin region comprises:
[0068] Calculating the geometric center point of each of the bin areas, and calculating the rotation angle of each of the bin areas relative to the geometric center point;
[0069] Based on the geometric center point and the rotation angle, mirror transform the bin area, and translate the geometric center point to the position of the transformed geometric center point;
[0070] Performing affine transformation processing and obtaining the transformed coordinates in the bin area after the affine transformation processing;
[0071] The calculation formula of the geometric center point of the bin area is:
[0072] ; ;
[0073] Each bin area is defined as a polygon with 4 vertices, n represents the number of vertices of the polygon, n=4; i represents the bin area bin i The index of each vertex is (x i ,y i ), the vertices include: the lower left point is C (x iC ,y iC ), the lower right point is A (x iA ,y iA ), the upper left point is D (x iD ,y iD ) and the upper right point is B (x iB ,y iB ).
[0074] In an optional implementation, calculating the rotation angle of each bin area relative to the geometric center point includes:
[0075] The straight line between the lower left point and the lower right point in the bin area is used as the base straight line; the straight line perpendicular to the base straight line is used as the vertical straight line; the intersection point where the vertical straight line passing through the geometric center point O intersects with the base straight line is determined as the intersection point P, and the coordinates of the intersection point are (x, y);
[0076] The straight line passing through the geometric center point O and the intersection point P is taken as OP; the vector of OP is limited to be parallel to the positive direction of the y-axis, and the rotation angle θ of the vector of OP along the geometric center point O is calculated;
[0077] The calculation formula of the rotation angle θ of the vector of the OP along the geometric center point O is:
[0078] when , , , ;
[0079] when , , , ;
[0080] when , , , ;
[0081] when , , , ;
[0082] when , , , ;
[0083] when , , , ;
[0084] when , , , ;
[0085] when , , , ;
[0086] Among them, π represents pi; i represents the bin area bin i The index in; arccos function is the inverse cosine function; point (x iO ,y iO ) is the i-th bin i The coordinates of the geometric center point; point (x iP ,y iP ), represents the i-th bin i , passing through the geometric center point O i The point of intersection of the vertical line and the base line is P i The coordinates of the point (x iA ,y iA ) is the i-th ) is the i-th The coordinates of
[0087] The mirroring of the bin area based on the geometric center point and the rotation angle includes:
[0088] Define a rotation matrix according to the rotation angle, rotate along the geometric center point of the bin area based on the rotation matrix, and calculate the coordinates of the intersection point P before the rotation and the intersection point P' after the rotation;
[0089] Based on the intersection point after rotation and all points in the bin area, a mirror transformation of the y=y0 symmetry line is performed.
[0090] In an optional embodiment, the coordinates of the intersection point P' after the rotation are calculated using the formula:
[0091] ;
[0092] Among them, the cos function is the cosine function, and the sin function is the sine function; represents the rotation matrix; P represents the coordinates of the intersection point before rotation; O represents the coordinates of the geometric center point of the bin area; P` represents the coordinates of the intersection point after rotation;
[0093] The regular formula for the mirror transformation of the y=y0 symmetry line is:
[0094] y'=2×y0-y;A x <C x And y0≥y p , or, A x ≥C x And y0<y p ;
[0095] Wherein, y0 represents the y-axis coordinate of the geometric center point O, y` represents the y-axis coordinate of the point after the mirror transformation; y represents the y-axis coordinate of the point before the mirror transformation; A x represents the x-axis coordinate of the lower right point A; C x represents the x-axis coordinate of the lower left point C; y0 represents the y-axis coordinate of the geometric center point O, y p represents the y-axis coordinate of the intersection point P;
[0096] In an optional implementation, the translating the geometric center point to the position of the transformed geometric center point includes:
[0097] The geometric center point before the transformation is translated to the position of the geometric center point after the transformation, requiring the following conditions to be met at the same time:
[0098] A. The current bin area bin i Move to the adjacent previous bin area bin i-1 after;
[0099] B. The bin area i The lower left point C and the previous bin area bin i-1 The lower right point A coincides with the
[0100] The straight line between the lower left point and the lower right point in the bin area is used as the base straight line; the straight line perpendicular to the base straight line is used as the vertical straight line; the intersection point where the vertical straight line passing through the geometric center point O intersects with the base straight line is determined as the intersection point P, and the coordinates of the intersection point are (x, y);
[0101] The coordinates of the intersection point P before the transformation are transformed into the coordinates of P' after the transformation; the calculation formula for the transformation is: x'=x+(x O` -xO ); y`=y+(y O` -y O );
[0102] Wherein, x and y are the horizontal and vertical coordinates of the intersection point P before transformation, respectively; x' and y' are the horizontal and vertical coordinates of the intersection point P' after transformation, respectively; x O and O are the horizontal and vertical coordinates of the geometric center point O before transformation; O` and O` are respectively the horizontal and vertical coordinates of the geometric center point O' after transformation;
[0103] The geometric center point before the transformation is translated to the position of the geometric center point after the transformation, and the i-th bin area bin after the transformation i The calculation formulas for the coordinates of the lower left point C' and the geometric center point O' are:
[0104] For the lower left point C':
[0105] When i=1, the horizontal and vertical coordinates of the lower left point C' are both 0;
[0106] When i>1, the horizontal coordinate of the lower left point C' is , the vertical coordinate is 0;
[0107] Among them, i represents the bin area bin i Index in; x iC and iC Respectively represent the horizontal and vertical coordinates of the lower left point C' of the i-th bin area; iA and iA Respectively represent the horizontal and vertical coordinates of the lower right point A' of the i-th bin area;
[0108] For the geometric center point O`:
[0109] when :
[0110] When i=1, the horizontal coordinate of the geometric center point O' is ; The vertical axis is ;
[0111] When i>1, the horizontal coordinate of the geometric center point O' is ; The vertical axis is ;
[0112] when :
[0113] When i=1, the horizontal coordinate of the geometric center point O' is ; The vertical axis is ;
[0114] When i>1, the horizontal coordinate of the geometric center point O' is; the vertical coordinate is ;
[0115] in, Represents the distance from the lower left point C' to the intersection point P' after transformation; Represents the distance from the geometric center point O to the intersection point P before transformation.
[0116] In an optional implementation, the performing affine transformation processing includes:
[0117] The affine transformation matrix of the bin area is calculated based on the cv2.getPerspectiveTransform function in OpenCV; the calculation method is:
[0118] M i = cv2.getPerspectiveTransform(CABD,C1A1B1D1);
[0119] Among them, M i represents the affine transformation matrix for the i-th bin area; C, A, B and D respectively represent the lower left point C, lower right point A, upper right point B and upper left point D of the bin area before transformation; C1, A1, B1 and D1 respectively represent the lower left point C1, lower right point A1, upper right point B1 and upper left point D1 of the bin area after transformation;
[0120] The calculation formula of the converted coordinates in the bin area is: ;
[0121] Among them, M represents the affine transformation matrix; x and y represent the horizontal and vertical coordinates of the intersection point P of the bin area before the transformation; x` and y` represent the horizontal and vertical coordinates of the intersection point P` of the bin area after the transformation.
[0122] In a second aspect, the present invention provides a device for processing a curled image of an intestinal spatiotemporal group, comprising:
[0123] An acquisition and annotation module is used to acquire a target image and sequencing data based on the spatiotemporal group chip, and to perform polygon annotation on a target curling area in the target image to obtain an image feature annotation file containing a coordinate pixel matrix of the target curling area;
[0124] An analysis and conversion module, used for analyzing the sequencing data to obtain expression matrix data, and converting the data into an RDS file containing the expression matrix data in combination with the physical coordinates of the spatiotemporal group chip;
[0125] A data mapping module maps the coordinate pixel matrix in the image feature annotation file to the target image based on the RDS file to obtain an original coordinate matrix;
[0126] A set construction module, used to construct a set of ordered bin regions according to the original coordinate matrix, and map each cell in the RDS file to the bin region;
[0127] The image conversion module is used to perform spatial conversion on each of the bin areas to form a straightened image, obtain the converted coordinates in the bin area, and construct a visual image based on the converted coordinates.
[0128] In a third aspect, the present invention provides a system for processing intestinal spatiotemporal group curled images, comprising a memory and a processor, wherein the memory stores a processing program for intestinal spatiotemporal group curled images, and the processor runs the processing program for intestinal spatiotemporal group curled images so that the system for processing intestinal spatiotemporal group curled images executes the method for processing intestinal spatiotemporal group curled images as described in any one of the aforementioned embodiments.
[0129] The present invention provides a method, device and system for processing intestinal space-time group curled images. The method for processing intestinal space-time group curled images uses a finite number of ordered bin regions to segment, rotate, translate and affine transform the spirally curled intestinal space-time group curled images, thereby achieving horizontal straightening and unfolding of expression data, and more clearly observing and comparing the differences in gene expression in different intestinal segments. In addition, by using advanced image processing and data analysis techniques, different areas of the intestine can be divided and compared more finely, thereby revealing the regional characteristics of the intestine, providing scientific researchers with a more reliable and efficient research approach. BRIEF DESCRIPTION OF THE DRAWINGS
[0130] In order to more clearly illustrate the technical solution of the present invention, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and should not be regarded as limiting the scope of protection of the present invention. In each of the drawings, similar components are numbered similarly.
[0131] Figure 1 It is a schematic diagram of the structure of the hardware operating environment involved in the embodiment of the method for processing the curled image of the intestinal spatiotemporal group of the present invention;
[0132] Figure 2 It is a schematic flow chart of Example 1 of the method for processing the curled image of the intestinal spatiotemporal group of the present invention;
[0133] Figure 3It is a schematic diagram of obtaining a target image by reducing the pixel count of the intestinal space-time group curled image in Example 1 of the processing method of the intestinal space-time group curled image of the present invention;
[0134] Figure 4 It is a schematic diagram of a detailed process of step S100 in Embodiment 2 of the method for processing the intestinal spatiotemporal group curled image of the present invention;
[0135] Figure 5 It is a schematic diagram of the result of polygon annotation in Example 2 of the method for processing the curled image of the intestinal spatiotemporal group of the present invention;
[0136] Figure 6 Schematic diagram of the process of processing the intestinal spatiotemporal group curled image including step S600 in Embodiment 2 of the present invention;
[0137] Figure 7 It is a schematic diagram of a detailed process of step S300 in Embodiment 3 of the method for processing the curled image of the intestinal spatiotemporal group of the present invention;
[0138] Figure 8 It is a schematic diagram of the processing method of the intestinal space-time group curled image in Example 3 of the present invention before and after the coordinate transformation formula processing;
[0139] Fig. 9 This is a schematic diagram of a detailed flow chart of step S320 in Embodiment 3 of the method for processing the intestinal spatiotemporal group curled image of the present invention;
[0140] Fig.10 It is a schematic diagram of a detailed process of step S322 in Embodiment 3 of the method for processing the curled image of the intestinal spatiotemporal group of the present invention;
[0141] Fig.11 It is a schematic diagram of mask image generation in Example 3 of the method for processing the curled image of the intestinal spatiotemporal group of the present invention;
[0142] Fig.12 This is a schematic diagram of generating a binary image in Example 3 of the method for processing the curled image of the intestinal spatiotemporal group of the present invention;
[0143] Fig.13 It is a schematic diagram of the result of marking the edge of the core contour area of the mask image in Example 3 of the method for processing the curled image of the intestinal spatiotemporal group of the present invention;
[0144] Fig.14 4 is a flow chart of the processing method of the intestinal spatiotemporal group curled image including step S700 in Embodiment 4 of the present invention;
[0145] Fig.15 It is a schematic diagram of a detailed process of step S700 in Embodiment 4 of the method for processing the curled image of the intestinal spatiotemporal group of the present invention;
[0146] Fig.16It is a schematic diagram of judging different triangular areas in Example 4 of the method for processing the curled image of the intestinal spatiotemporal group of the present invention;
[0147] Fig.17 It is a schematic diagram of a detailed process of step S400 in Embodiment 5 of the method for processing the intestinal spatiotemporal group curled image of the present invention;
[0148] Fig.18 It is a schematic diagram of a detailed process of step S410 in Embodiment 5 of the method for processing the intestinal spatiotemporal group curled image of the present invention;
[0149] Fig.19 It is a schematic diagram of the connection form of the ordered bin areas in Example 5 of the method for processing the intestinal spatiotemporal group curled image of the present invention;
[0150] Fig. 20 It is a schematic diagram of a detailed process of step S412 in Embodiment 5 of the method for processing the curled image of the intestinal spatiotemporal group of the present invention;
[0151] Fig.21 It is a flowchart of the supplementary steps after step S410 in Example 5 of the method for processing the curled image of the intestinal spatiotemporal group of the present invention;
[0152] Fig. 22 It is a schematic diagram of a detailed process of step S500 in Embodiment 6 of the method for processing the curled image of the intestinal spatiotemporal group of the present invention;
[0153] Fig.23 It is a schematic diagram of a detailed process of step S510 in Example 6 of the method for processing the curled image of the intestinal spatiotemporal group of the present invention;
[0154] Fig.24 It is a schematic diagram of a detailed process of step S520 in Example 6 of the method for processing the curled image of the intestinal spatiotemporal group of the present invention;
[0155] Fig.25 It is a schematic diagram of coordinate registration in Example 7 of the method for processing the curled image of the intestinal spatiotemporal group of the present invention;
[0156] Fig.26 It is a schematic diagram of the bin area construction in Example 7 of the method for processing the intestinal spatiotemporal group curled image of the present invention;
[0157] Fig. 27 It is a schematic diagram of the intestinal space-time group curled image after straightening processing in Example 7 of the method for processing the intestinal space-time group curled image of the present invention;
[0158] Fig.28 It is a schematic diagram comparing the effects of the comparative method in Example 7 of the method for processing the curled image of the intestinal spatiotemporal group of the present invention and the method in this embodiment after processing;
[0159] Fig.29Schematic diagram of module connection of a device for processing curled images of intestinal spatiotemporal groups in an embodiment of the present invention. DETAILED DESCRIPTION
[0160] The embodiments of the present invention are described in detail below, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions.
[0161] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0162] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0163] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0164] like Figure 1 , which is a schematic diagram of the structure of the hardware operating environment of the terminal involved in the embodiment of the present invention.
[0165] The processing system of the intestinal spatiotemporal group curled image provided by the embodiment of the present invention can be a PC, or a mobile terminal device such as a smart phone, a tablet computer or a portable computer. The processing system of the intestinal spatiotemporal group curled image may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005 and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen, an input unit such as a keyboard, and a remote control. The optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory, such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0166] Those skilled in the art will understand that Figure 1 The processing system for the intestinal spatiotemporal group curled image shown in the figure does not constitute a limitation thereof, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently. Figure 1 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a data interface control program, a network connection program, and a processing program for the intestinal spatiotemporal group curled image.
[0167] Example 1
[0168] Reference Figure 2 Embodiment 1 of the present invention provides a method for processing a curled image of an intestinal spatiotemporal group, comprising:
[0169] Step S100, obtaining a target image and sequencing data based on a spatiotemporal chip, and performing polygon annotation on a target curling region in the target image to obtain an image feature annotation file containing a coordinate pixel matrix of the target curling region;
[0170] It should be noted that in this embodiment, the image used refers to a graph used to display spatial transcriptomics data. The intestinal spatiotemporal group curled image can be called a "spatial transcriptomic landscape", which uses color coding to display the gene expression patterns in different regions, thereby revealing the spatial heterogeneity of gene expression in tissues.
[0171] This map is used to show gene expression at different locations in tissue sections, helping to understand how gene expression is affected by spatial location at the tissue level. Through this map, the differences in gene expression in different areas of the tissue can be more intuitively observed, and the distribution pattern and biological function of specific genes in the tissue can be analyzed.
[0172] The intestinal spatiotemporal curl images can be used to show the transcriptome changes in the mouse intestine during homeostasis and healing, revealing the regional characteristics of different regions of the intestine at the molecular level and the dynamic changes during injury and healing.
[0173] The above-mentioned spatiotemporal group chip is a spatiotemporal group microscopy chip. In spatiotemporal transcriptomics, the chip usually contains multiple pre-designed microarrays that can capture RNA molecules of cells in tissue sections and retain their spatial location in the tissue. This chip is an important tool for analyzing cell types and states in tissue samples.
[0174] This chip is critical in spatiotemporal transcriptomics research, as it can capture and analyze the spatial location and gene expression information of cells at the microscopic level. The data obtained using this chip are observed and recorded in detail by spatiotemporal microscopy, allowing researchers to analyze the gene expression patterns of tissues at the single-cell level and understand how these patterns are distributed spatially. Together, these technologies and methods provide a deeper understanding of tissue structure and function.
[0175] The above-mentioned intestinal spatiotemporal group curled images are obtained by placing tissue sections on the spatiotemporal group chip before sequencing and imaging them through a microscope to obtain high-resolution images. The sequencing data is the raw sequencing data generated after the tissue sections are sequenced on the chip, which is the offline sequencing data. These data need to be processed by bioinformatics methods to extract useful biological information. The high-definition images under the spatiotemporal group microscope, namely the intestinal spatiotemporal group curled images, provide spatial visual information, while the offline sequencing data provides molecular information at the corresponding position. Combining these two types of data, researchers can perform detailed spatial analysis of the biological characteristics of tissue samples at the cellular level.
[0176] The sequencing data mentioned above refers to the off-machine sequencing data based on the spatiotemporal chip. In bioinformatics, "off-machine data" refers to the original sequencing results output from the sequencing equipment (such as the Illumina sequencer). These data are usually stored in FASTQ format and contain the sequence information of RNA or DNA obtained from tissue samples. Off-machine sequencing data is the starting point for analyzing gene expression and needs to be interpreted through further bioinformatics analysis.
[0177] As mentioned above, polygon annotation is a technique in the field of image processing and computer vision, which involves marking polygonal areas on an image to identify and distinguish specific objects or areas in the image. In this embodiment, polygon annotation is used to accurately define regions of interest in an image, which include specific types of cells or regions with special biological characteristics.
[0178] In the above, step S100 is used to obtain a high-resolution image of a tissue sample (the target image can be obtained based on the high-resolution image, or the target image can be obtained directly) and sequencing data. The target curled area in the image (such as the mouse intestine) is marked as a polygon to form an image feature annotation file, which contains a coordinate pixel matrix of the target area, thereby generating an image feature annotation file containing the coordinates of the target curled area, which provides basic data for subsequent steps. The above steps ensure the accurate correspondence between the image and the sequencing data, providing a basis for accurate analysis.
[0179] In the above, the target image can be the intestinal spatiotemporal group curl image obtained directly from the spatiotemporal group chip, or can be an image related to the intestinal spatiotemporal group curl image obtained by the spatiotemporal group chip. In this embodiment, the target image is a processed image obtained after preprocessing based on the intestinal spatiotemporal group curl image. For example, it can be a dimensionality reduction process, a pixel reduction process, etc.
[0180] It should be noted that the high-definition image of the ssDNA of the intestinal tissue on the chip under the space-time group microscope is obtained from the space-time group experimental platform, that is, the intestinal space-time group curled image, and the image format is usually in tiff / tif format. Since the high-definition image cannot be opened using the existing annotation software, the image is subjected to a pixel reduction operation. Therefore, the pixel reduction of the image is achieved by resampling or scaling the image, that is, reducing the resolution of the image to reduce the number of pixels in the image, thereby generating a png image with low resolution but sufficient clarity. In this embodiment, the python library PIL and matplotlib are used to implement it.
[0181] Specifically, refer to Figure 3 , you can use Python's PIL library and matplotlib library to read the first band of the tiff / tif file, save it as a png picture, that is, the target image, and record the length and width of the original image and the generated image. Figure 3 In the middle, on the left represents the total height of the pixel coordinates of the curled image of the intestinal spatiotemporal group, Indicates the total pixel coordinate width of the curled image of the intestinal spatiotemporal group. Indicates the total height of the pixel coordinates of the target image after pixel reduction. Indicates the total pixel coordinate width of the target image after pixel reduction.
[0182] Step S200, analyzing the sequencing data to obtain expression matrix data, and converting the data into an RDS file containing the expression matrix data in combination with the physical coordinates of the spatiotemporal group chip;
[0183] As mentioned above, the sequencing data obtained from the tissue chip is analyzed to generate the gene expression matrix of the cells and converted into the RDS file format, thereby obtaining an RDS file containing the expression matrix data for further analysis. The RDS format is convenient for loading and processing in the statistical software R, which speeds up the data analysis process. The expression matrix data can be processed using bioinformatics tools (such as the Seurat package) and saved as an RDS file.
[0184] It should be noted that the spatial transcriptomics chip is a technology used to capture and analyze the spatial gene expression data of cells in tissue slices. This chip has high-density microwells, each of which can capture RNA molecules in the surrounding tissue and provide gene expression information at that location after sequencing. The physical coordinates of the spatial transcriptomics chip have the following characteristics: (1) Spatial position: each microwell has a specific physical position on the chip, usually expressed as two-dimensional coordinates (such as x, y coordinates); (2) Proximity: The arrangement of microwells on the chip reflects the relative position relationship between cells in the tissue slice. (3) Tissue correspondence: The position of the microwells on the chip corresponds to the specific area in the tissue slice, which helps to link gene expression data with the specific part of the tissue.
[0185] In this step, when analyzing the sequencing data to obtain expression matrix data, it is necessary to combine these data with their specific positions on the spatiotemporal chip. The purpose of this is to accurately map the gene expression information back to the original spatial position of the tissue section in the subsequent data analysis, thereby revealing the spatial heterogeneity of gene expression.
[0186] The expression matrix data is combined with the physical coordinates of the spatiotemporal microarray and converted into an RDS file (R DataStorage) in order to create an expression data file containing spatial information.
[0187] Step S300, based on the RDS file, mapping the coordinate pixel matrix in the image feature annotation file to the target image to obtain an original coordinate matrix;
[0188] As mentioned above, the coordinate pixel matrix in the image feature annotation file is mapped to the high-resolution target image to obtain the coordinate matrix corresponding to the original image, thereby generating a matrix that accurately maps the coordinates of the original image, allowing quantitative analysis to be performed directly on the original high-resolution image.
[0189] A coordinate mapping algorithm may be used to map the reduced resolution coordinates back to the original high resolution image.
[0190] Step S400, constructing a set of ordered bin regions according to the original coordinate matrix, and mapping each cell in the RDS file to the bin region;
[0191] In the above, an ordered bin area set is constructed based on the original coordinate matrix. In the bin area set, there are multiple bin areas, each bin area is a specific area, and each cell is mapped to a specific bin area according to its physical position. In this step, a specific bin area is assigned to each cell to facilitate spatial statistics and analysis.
[0192] In this step, spatial partitioning can provide a better understanding of the distribution and interaction of cells in the tissue. Data processing algorithms (such as spatial gridding) can be used to divide bins and map cells to corresponding bins.
[0193] Step S500, performing spatial transformation on each of the bin regions to form a straightened image, obtaining transformed coordinates in the bin region, and constructing a visual image based on the transformed coordinates.
[0194] Perform spatial transformation on each bin area, such as straightening or flattening, to form a straightened image, and calculate the transformed coordinates. Build a visualization image based on these new coordinates to obtain the transformed coordinates, and generate a visualization image based on these coordinates, such as a heat map or distribution map.
[0195] In this step, spatial conversion is performed to form a straightened image. The corresponding cell information after straightening can be combined with the gene information that needs attention and scientific research exploration to visualize the cellular level of expression.
[0196] The visualized images intuitively display the spatial distribution and gene expression of cells, facilitating analysis and comparison.
[0197] Use image processing and data visualization techniques such as OpenCV and Matplotlib for spatial transformation and visualization.
[0198] In summary, in the embodiment, the horizontal straightening and unfolding of intestinal gene expression data is achieved by orderly segmenting the spirally rolled intestine and applying rotational translation and affine transformation, and this process brings obvious beneficial effects. First, the high-definition images and sequencing data obtained in step S100 provide the basis for the entire analysis, and the accuracy of subsequent analysis is ensured by accurately marking the target area with polygons. Next, the expression matrix data analyzed in step S200 is converted into an RDS file for further processing and analysis. The coordinate mapping in step S300 allows the coordinate information of the image annotation to be accurately mapped to the original image, thereby maintaining the spatial accuracy of the data. Step S400 makes the spatial analysis of gene expression more refined by constructing an ordered set of bin regions and mapping cells to these regions. Finally, in step S500, the spatial conversion and the adjustment of coordinates enable the generation of clear, straightened intestinal images, which greatly improves the comparability and visualization clarity of the gene expression differences between different intestinal segments. Through this series of steps, researchers can make more detailed divisions and comparisons of different areas of the intestine, revealing the regional characteristics of the intestine, and providing researchers with a more reliable and efficient research method. This whole process not only optimizes the data processing flow, but also improves the accuracy and efficiency of the research, which is a major advancement in the field of spatiotemporal omics.
[0199] Example 2
[0200] Reference Figure 4 Embodiment 2 of the present invention provides a method for processing an intestinal space-time group curled image, wherein step S100, polygonally marking a target curled area in the target image, comprises:
[0201] Step S110, annotating the outer contour edge of the target curling area in a polygonal point drawing manner, connecting the ends to form a closed loop, and obtaining an outer contour annotation result; and annotating the inner contour edge of the target curling area, connecting the ends to form a closed loop, and obtaining an inner contour annotation result;
[0202] Step S120 , constructing the coordinate pixel matrix according to the outer contour marking result and the inner contour marking result, and building the image feature marking file according to the coordinate pixel matrix.
[0203] This step involves accurate polygonal annotation on the target image of the intestinal curled area. First, the outer contour of the target curled area is annotated to form a closed loop outer contour; then, the inner contour is annotated to also form a closed loop. This double annotation helps to accurately define the position and extent of the intestine on the image.
[0204] In this way, two sets of coordinate points representing the lateral and medial edges of the intestine were generated, providing more detailed spatial information for subsequent analysis.
[0205] This annotation method can more accurately capture the spatial structure of the intestine, which helps improve the accuracy of subsequent image processing and data analysis. At the same time, the double-layer annotation provides additional information about the thickness and internal structure of the intestinal wall, which is particularly valuable for biomedical research.
[0206] Specifically, the obtained target image png picture can be input into the picture feature annotation software, and the polygon point drawing method can be selected to perform graphic annotation on the area of interest. The annotation is divided into two parts:
[0207] (1) The edge of the outermost circle of the spiral intestinal organ;
[0208] (2) the inner edge relative to the outer edge;
[0209] Finally, the pixel coordinate matrix text of the polygon outer contour of the focus area is formed.
[0210] In addition, manual annotation can also be performed using image annotation tools such as LabelMe, ImageJ, etc. Through the graphical user interface selection tool, users can click points on the image to form a polygon. Each click adds a vertex until a closed loop is formed.
[0211] For example, the following method can be used: the method for obtaining the inner and outer contour annotation results of the target image is to select LabelMe or ImageJ for contour annotation, and obtain a annotation json file, in which the annotation method is as follows:
[0212] (1) Outer contour annotation results: The polygonal annotation method is used to annotate along the outer contour of the roll, and finally the first ones are connected to form a closed loop. The feature is defined as 'wai'.
[0213] (2) Outer contour annotation results: Use polygonal annotation method to annotate along the inner contour of the roll, and finally connect the first digits to form a closed loop. The feature is defined as 'nei'.
[0214] According to the outer contour marking result and the inner contour marking result, the coordinate matrix included therein constitutes a coordinate pixel matrix, and the image feature marking file, that is, a json file, is constructed according to the coordinate pixel matrix.
[0215] It should be noted that the reference Figure 5 In biological structure, the inner and outer sides of the same tissue cannot intersect.
[0216] Furthermore, before analyzing the sequencing data to obtain expression matrix data in step S200, the step further includes:
[0217] Step S600, performing lasso processing on the sequencing data along the outermost tissue contour, and using a SAW analysis process to perform data analysis to obtain the sequencing data including an expression matrix.
[0218] As mentioned above, lasso processing and SAW analysis are important preprocessing steps for spatial transcriptomics data, which are crucial to ensure the accuracy and effectiveness of data analysis. If these preprocessing steps are not performed, various problems may occur.
[0219] First, not performing lasso processing may result in the inclusion of a large amount of irrelevant background data, which can interfere with and obscure the biological signals in the marginal areas of the tissue, thereby affecting the understanding of the biological characteristics of these key areas. Unfiltered data may include signals from non-target areas, increasing the complexity of the analysis and the possibility of errors.
[0220] Secondly, not using a SAW analysis pipeline designed for spatial data may result in the inability to fully utilize spatial information and affect the identification of expression patterns related to the location of cells in the tissue. This positional information is critical to understanding how cells interact with each other and their role in tissue function and pathology. Therefore, taking these preprocessing measures is key to achieving accurate and reliable analysis. The lack of these steps may lead to inaccurate data interpretation and missed opportunities to gain insight into the complex spatial structure of biological samples.
[0221] This step involves lasso processing of the sequencing data on the tissue chip, that is, using a graphical selection tool (lasso tool) to select the sequencing data along the outermost contour of the tissue. This is usually done in image processing software to accurately locate and select data points that are at the edge of the tissue.
[0222] This method can be used to filter out data points directly related to the periphery of the tissue from a large amount of sequencing data, thereby reducing background noise and focusing on the most relevant biological signals. This preprocessing step helps reduce irrelevant information in the data and improves the accuracy and reliability of subsequent analysis, especially when dealing with biological samples with complex edge or boundary conditions.
[0223] Specialized image processing software can be used, such as the professional bioinformatics software StereoMap, which can identify the correspondence between image data and raw sequencing data and allow users to graphically select areas of interest.
[0224] As mentioned above, the SAW (Spatial Analysis Workflow) analysis process is an analysis method designed specifically for spatial transcriptomics data. This step involves using the process to perform a detailed analysis of the selected sequencing data. This usually includes data cleaning, standardization, calculation of gene expression, etc. This step generates sequencing data containing expression matrices, which record in detail the gene expression of each cell or cell population. The SAW analysis process is specifically optimized for spatial data, which can effectively integrate spatial information and gene expression data and improve the ability to parse data, especially when describing the complex interactions between tissue structure and function.
[0225] This process can be achieved through specialized bioinformatics software packages, such as SpatialDE or Seurat, which provide a complete set of analysis functions for spatial transcriptome data.
[0226] Specifically, it can be achieved through the following steps:
[0227] (1) Using StereoMap, adjust the Opacity value to the minimum, and then perform the lasso operation strictly along the outermost tissue contour;
[0228] (2) Use the SAW analysis process to analyze the data and obtain the expression matrix file in gef format;
[0229] (3) Use Stereopy and Seurat to convert gef into seurat object files and store them in RDS format.
[0230] The SAW analysis process is used to analyze and obtain the expression information file. The SAW standard analysis process of the BGI spatiotemporal group can be used to analyze the off-machine sequencing data of the spatiotemporal group chip or the data processed by the StereoMap software lasso to obtain the expression matrix data containing the physical location information of the cells. The format is usually chip number.tissue.gef.
[0231] The Python package Stereopy and the R package Seurat were used to convert the expression matrix data in the GEF format into a Seurat object file, which is usually in the .RDS format.
[0232] The implementation of these steps not only optimizes the data processing flow, but also improves the ability to extract accurate and useful information from complex biological tissue samples. Through this method, researchers can more effectively identify and analyze the spatial and molecular heterogeneity in tissues, which is of great significance for a deeper understanding of the biological function and pathological state of tissues.
[0233] Example 3
[0234] Reference Figure 7 Embodiment 3 of the present invention provides a method for processing an intestinal spatiotemporal group curled image, wherein step S300 maps the coordinate pixel matrix in the image feature annotation file to the target image based on the RDS file to obtain the original coordinate matrix, including:
[0235] Step S310, inversely mapping the coordinate pixel matrix of the target image to the intestinal spatiotemporal group curled image corresponding to the target image through a coordinate conversion formula, and updating the coordinates in the image feature annotation file through the coordinates in the intestinal spatiotemporal group curled image; wherein the target image is an image obtained by reducing the pixel count of the intestinal spatiotemporal group curled image;
[0236] This step involves inversely mapping the coordinate pixel matrix in the target image obtained by reducing the resolution to the corresponding high-resolution enterotemporal group warp image. This usually requires a coordinate transformation formula for converting the coordinate points on the low-resolution image to the corresponding points on the high-resolution image.
[0237] Through this inverse mapping process, the coordinates in the image feature annotation file can be updated on the high-resolution intestinal spatiotemporal group curled image, making the coordinate position more accurate. This method allows maintaining high spatial accuracy during image processing and ensures that the results of data analysis can accurately reflect the actual situation of the tissue.
[0238] This can be achieved through image processing software or programming languages (such as Python using the OpenCV library), using mathematical formulas to perform coordinate scaling and position adjustment.
[0239] Step S320, performing registration processing on the coordinate matrix formed by the coordinates in the image feature annotation file using the expression matrix data in the RDS file to obtain the registered original coordinate matrix.
[0240] This step involves registering the coordinate matrix constructed in the image feature annotation file with the expression matrix data based on the RDS file. Registration is a technique in image processing that is used to calibrate and synchronize coordinate systems between different images or data sets to ensure that all data are based on the same spatial reference, thereby obtaining the registered original coordinate matrix, which means that the image data and gene expression data can accurately correspond to each other, providing a consistent reference framework for subsequent analysis.
[0241] Registration processing can significantly improve the accuracy of multimodal data analysis, especially when combining spatial expression patterns with tissue morphological characteristics, which helps to gain a deeper understanding of the relationship between tissue structure and function.
[0242] Image registration algorithms can be used, such as feature-based registration or region-based registration methods. These methods can be implemented with specialized image analysis software or custom data processing scripts, such as using MATLAB or Python's SciPy and NumPy libraries.
[0243] Through the above steps, target images and detailed expression matrix data can be accurately integrated and analyzed, which provides a powerful tool for intestinal biology research and can reveal more complex biological mechanisms and pathological changes.
[0244] Furthermore, the coordinate transformation formula includes:
[0245] (Formula 1); (Formula 2);
[0246] Among them, reference Figure 8 , x new and new represents the horizontal and vertical coordinates of the point in the target image before transformation; old and old represents the horizontal and vertical coordinates of the points in the transformed intestinal spatiotemporal group curled image; h new represents the total height of pixel coordinates in the target image; h old represents the total height of pixel coordinates in the curled image of the intestinal spatiotemporal group; w new represents the total width of pixel coordinates in the target image; w old Represents the total width of the intestinal spatiotemporal group in pixel coordinates in the curled image.
[0247] As mentioned above, formula 1 is used to calculate the transformation of horizontal coordinates from the new image to the original image. The formula adjusts the coordinates by proportionality to ensure spatial correspondence between the new and old images. Formula 2 is used to calculate the transformation of vertical coordinates. Since the coordinate system of the image may be different in the vertical direction (usually the origin is at the top or bottom), this formula not only transforms the coordinates, but also inverts the coordinate axes to ensure the coordinate system is consistent.
[0248] These formulas are used to adjust and transform the locations of points in the images so that they can be accurately mapped and compared between images of different resolutions. Using these formulas ensures that there is an accurate spatial correspondence between the high-resolution image and the image that has been processed after the resolution has been reduced. In this way, any location marked on the low-resolution image can be accurately reflected in the high-resolution image.
[0249] For further reference, Fig. 9 The step S320, performing registration processing on the coordinate matrix formed by the coordinates in the image feature annotation file through the expression matrix data in the RDS file to obtain the registered original coordinate matrix, includes:
[0250] Step S321, performing contour extraction on the coordinate matrix in the image feature annotation file and the expression matrix data containing the physical coordinates in the RDS file, respectively, to obtain polygonal contour dot matrices corresponding to the coordinate matrix and the expression matrix data, respectively; wherein the polygonal contour dot matrices include an outer contour dot matrix and an inner contour dot matrix;
[0251] The polygonal contour dot matrix mentioned above is a dot matrix composed of coordinate points of the contour corresponding to the target curling area in the target image; wherein, according to the contour, it includes an outer peripheral contour dot matrix and an inner internal contour dot matrix.
[0252] According to the coordinate matrix in the image feature annotation file and the expression matrix data containing the physical coordinates in the RDS file, a polygonal contour dot matrix is obtained respectively. Therefore, each data source obtains a set of outer contour dot matrix and inner inner contour dot matrix.
[0253] Extract contours from the image feature annotation file and the RDS file to create polygonal contour point arrays. This includes accurate contour calibration of the periphery and inner side of the intestinal curl area. The contour point arrays for each data source are obtained, which provides the necessary spatial reference for the registration step.
[0254] Contour extraction helps to precisely define the region of interest, reduce data noise, and improve the accuracy and efficiency of subsequent analysis.
[0255] Step S322, performing registration processing of the outer contour dot matrix and the inner contour dot matrix in the polygonal contour dot matrix on the outer coordinate points and the inner coordinate points respectively, to obtain the original coordinate matrix after registration;
[0256] The extracted polygonal contour lattice is registered to ensure that the outer and inner contours are correctly aligned in space. Through the precise registration of the outer and inner contours, the final consistent coordinate matrix is obtained, making the image perfectly correspond to the sequencing data.
[0257] Registration processing ensures the spatial consistency between image data and gene expression data, which is key to multimodal data analysis and improves the reliability of results.
[0258] refer to Fig.10 The step S322, respectively performing registration processing on the peripheral coordinate points and the inner coordinate points, includes:
[0259] Step S3221, for the peripheral coordinate points or the inner coordinate points, a mask image is generated for the polygon outline dot matrix corresponding to the coordinate matrix and the expression matrix data respectively; wherein the mask image includes a core outline area of the polygon and a peripheral area surrounding the core outline area;
[0260] In the above steps, contour extraction is first performed to convert the data in the image feature annotation file and the RDS file into corresponding polygon contour lattices. These contour lattices include peripheral and inner contours, and then a mask image is generated for each data source, in which the core contour area and its peripheral area are highlighted.
[0261] When a corresponding mask image is generated for each polygonal contour point matrix, a core contour area and a peripheral area of the periphery of the polygon are formed.
[0262] refer to Fig.11 The peripheral area is outside the core contour area, and in a conventional mask image, the core contour area can be white, and the peripheral area, that is, the rest of the core contour area, can be black.
[0263] The generated mask image ensures that the data processing focuses on the biologically significant core region, while the inclusion of the peripheral region ensures the integrity of the spatial information.
[0264] This step helps to accurately define the processing area and improves the accuracy and efficiency of data analysis, especially in the subsequent registration process.
[0265] Step S3222, binarizing each of the mask images respectively, and converting them into a binary image retaining the core contour area; the binary image includes a first image corresponding to the coordinate matrix, and a second image corresponding to the expression matrix data;
[0266] Step S3223, determining the outer contour and geometric center point of the core contour area in each of the binary images;
[0267] refer to Fig.12 , the mask image is binarized and converted into an image containing only the core contour area, and the geometric center point of each contour is determined. Binarization simplifies the complexity of the image, highlights the core contour area, and facilitates accurate geometric analysis. Binarization makes the subsequent registration processing more accurate, and the determination of the center point also provides a key reference for image focus and registration.
[0268] Specifically, the mask image is converted into a binary image so that only the core contour area, that is, the white area therein, is retained; then, the white area contour (the outer contour of the core contour area) is identified: the contour of the white area is found, and the geometric center point of each white area is calculated.
[0269] Step S3224, translating the first image and the second image using the geometric center point to perform coordinate translation transformation focus processing; and determining an image deflection angle of the first image relative to the second image in the coordinate translation transformation focus processing based on the geometric center point and the outer contour;
[0270] In the above, the determined geometric center point is used to perform translation transformation and focus processing between the images to ensure that the core areas of the two images are spatially aligned. Specifically, the transformation is applied to focus the first image and the second image of the mask image, and the geometric center point is translated to perform coordinate translation transformation.
[0271] Step S3225, determining whether the image deflection angle is not greater than a preset angle threshold;
[0272] In addition, it is also necessary to measure and determine the deflection angle between the images based on the geometric center point and the outer contour to determine whether it is less than or equal to a preset angle threshold.
[0273] The preset angle threshold is a preset evaluation value of an angle, for example, the angle threshold = 1°. Then the image deflection angle is compared with 1°.
[0274] Step S32251: If yes, determine that the registration processing of the first image based on the second image is qualified.
[0275] If the image deflection angle is not greater than a preset threshold, the registration process is judged to be qualified, which means that the spatial correspondence between the two data sources is accurate.
[0276] Accurate registration is key to ensuring the correct association between spatial expression data and image data, which is crucial for the biological relevance and accuracy of the analysis.
[0277] Furthermore, after determining whether the image deflection angle is not greater than a preset angle threshold, the method further includes:
[0278] Step S32252: if not, it is determined that the registration process of the first image based on the second image is unqualified; the coordinate matrix in the image feature annotation file and the expression matrix data containing the physical coordinates in the RDS file are respectively extracted to obtain the corresponding polygon contour point matrix;
[0279] For example, according to the above example, the angle threshold = 1°, then the image deflection angle ≤ 1°, and the registration process is qualified; if the image deflection angle > 1°, the registration process is unqualified.
[0280] If it fails, the registration process is performed again.
[0281] If the deflection angle of the registered image is greater than the preset threshold, it is necessary to re-extract the contours of the image feature annotation file and the gene expression matrix data to generate a new polygonal contour lattice, thereby obtaining a more accurate polygonal contour lattice and providing a basis for re-registration.
[0282] By re-extracting the contours, any errors that may exist can be corrected and accurate alignment of the data can be ensured.
[0283] Step S32253, generating a mask image for each of the polygonal contour dot matrixes; wherein the mask image includes a core contour area of the polygon and a peripheral area of the core contour area;
[0284] As described above, a mask image including a core contour area and its peripheral area is generated for each polygonal contour point matrix. The mask image defines the contour area more clearly, which helps to focus on analyzing important areas.
[0285] The mask image can simplify the image processing steps and improve the registration accuracy by focusing on the key areas.
[0286] Step S32254, marking the edge of the core contour area of the mask image, and calculating the geometric center point of the core contour area;
[0287] Mark the edge of the core contour area of the mask image and calculate the geometric center point. Determine the exact center of the core area of each mask to provide the necessary spatial reference point for subsequent registration. Fig.13 , which is the mask image for completing the annotation of the core contour edge, where the red dots are the annotations of the core contour edge; the two mask images are (1) the mask image corresponding to the coordinate matrix in the image feature annotation file that needs to be fine-tuned and corrected; (2) the mask image containing the expression matrix data of the physical coordinates in the RDS file.
[0288] The calculation of the center point helps in precise positioning and ensures the accuracy and consistency of the registration.
[0289] Step S32255, uses the geometric center point and marked edge of each mask image to perform coordinate translation transformation processing to match the direction of the mask image, and returns the mask image to execute step S3221, and generates a mask image for the polygonal contour point matrix corresponding to the coordinate matrix and the expression matrix data respectively for the outer coordinate points or the inner coordinate points.
[0290] As mentioned above, the coordinate translation transformation is performed using the geometric center point and the annotated edge to match the direction of the mask image. The mask image direction is matched to ensure that the image features are completely consistent with the gene expression data in space. Coordinate translation transformation is an effective method to correct spatial deviations and can optimize the consistency and accuracy between data sets.
[0291] If the coordinate translation transformation process is performed, the registered mask image is returned to execute the step S3221, that is, re-judgment is performed on whether the registration is qualified, until the qualified registration standard is met.
[0292] Example 4
[0293] Reference Fig.14 Embodiment 4 of the present invention provides a method for processing an intestinal spatiotemporal group curled image. The step S300 maps the coordinate pixel matrix in the image feature annotation file to the target image based on the RDS file. After obtaining the original coordinate matrix, the method further includes:
[0294] Step S700, filtering and removing redundancy of the outer contour lattice and the inner contour lattice of the polygonal contour lattice in the original coordinate matrix;
[0295] It should be noted that there is a lot of redundancy in the polygonal contour lattice of the original coordinate matrix, which will lead to increased data redundancy and complexity, because a large number of coordinate points that do not provide additional biological information are retained, thereby increasing the complexity of the data and storage requirements. At the same time, processing these redundant points will lead to low computational efficiency, increase the time and resource consumption required for analysis, especially when processing large-scale data. In addition, redundant points may also introduce errors and noise, reducing the accuracy and reliability of the analysis results. Data redundancy can also lead to poor visualization effects. Unnecessary points in the image will cover up or blur important biological features and patterns, making it difficult for analysts to accurately interpret and discover key information.
[0296] The main purpose of performing the redundancy removal processing step in this embodiment is to optimize the quality of the polygon outline point matrix, remove redundant data, and ensure the validity and accuracy of the analysis data.
[0297] As mentioned above, after obtaining the original coordinate matrix, the outer contour lattice and the inner contour lattice of the polygonal contour lattice are filtered and de-redundant respectively. The purpose of this process is to reduce redundant points and keep the data set concise and accurate. Through filtering and de-redundant processing, a more streamlined polygonal contour lattice is generated, retaining only those areas containing sufficient cell points to ensure that meaningful biological information is retained.
[0298] Removing unnecessary redundant points not only reduces the complexity of the data, but also improves the efficiency of subsequent analysis. Simplified data sets can be analyzed and processed faster and more accurately.
[0299] refer to Fig.15 , the filtering and redundancy removal process includes:
[0300] Step S710, for one of the outer contour dot matrix and the inner contour dot matrix, select three coordinate points arranged in sequence in the contour dot matrix in order, and form a triangular area based on the three coordinate points;
[0301] In the above steps, redundancy removal processing is performed on the outer contour dot matrix and the inner contour dot matrix respectively.
[0302] Specifically, three consecutive coordinate points in the polygonal contour dot matrix are selected in order to form a triangular region. By judging the number of cell points contained in these triangular regions, it is determined whether to retain these coordinate points. This step allows important structural features to be identified and retained, and unimportant redundant points to be removed.
[0303] By gradually screening and retaining key points, the simplicity and biological relevance of the data are ensured. The use of triangular regions can effectively localize the processing and reduce the computational complexity.
[0304] Step S720, based on the RDS file, determining whether the number of cell points contained in the triangular area is not less than a preset cell point number threshold;
[0305] Step S730, if yes, retain the first coordinate point of the three coordinate points, select three coordinate points arranged in sequence in the contour lattice from the second coordinate point, and form a triangular area again, and return to execute the RDS file based on the triangular area to determine whether the number of cell points contained in the triangular area is not less than the preset cell point number threshold until the coordinate points in the contour lattice are processed;
[0306] Step S740, if not, delete the coordinate point in the middle of the three coordinate points that constitute the triangle, and take the first coordinate point and the third coordinate point in the triangle as adjacent coordinate points, select the next coordinate point adjacent to the third coordinate point, and together form a triangle again, and return to execute based on the RDS file to determine whether the number of cell points in the triangle area is not less than the preset cell point number threshold.
[0307] Based on the RDS file, determine whether the number of cell points contained in the triangular area reaches the preset cell point number threshold. If the condition is met, keep the first coordinate point and continue to the next step of screening; otherwise, delete the intermediate coordinate points that do not meet the condition.
[0308] Only the key coordinate points of the triangular area containing enough cell points are retained to ensure that the biologically meaningful part is retained in the data set.
[0309] This method of judging based on the threshold of cell point number helps to ensure that only meaningful areas, rather than all points, are considered in the final analysis, thereby optimizing the accuracy and speed of the analysis.
[0310] For example, the cell point number threshold is preset, that is, Kn=5. Taking the outer contour dot matrix as an example, the processing method includes:
[0311] (1) Select two points A and B from the outer contour point matrix in order, and then add one point C to form a triangular area, which is defined as ABC;
[0312] (2) Determine whether the number of cell points K1 contained in the RDS file is not less than 5;
[0313] (3) If K1 ≥ 5, then keep point A and move ABC backwards one position in turn. At this time, the original B is used as the new first coordinate point, the original C is used as the second coordinate point, and a new coordinate point D adjacent to the original C is added as the third coordinate point. A new triangle is formed by BCD. Return to the above step (2) for judgment; and so on, until all coordinate points are analyzed and judged. Fig.15 (b) and (c) in .
[0314] (4) If K1 < 5, delete the middle point B. At this time, A and C are adjacent points, serving as the first coordinate point and the second coordinate point respectively. In addition, add a new coordinate point D adjacent to the original C as the third coordinate point, and ACD form a new triangle. Return to the above step (2) for a new round of judgment; and so on, until all coordinate points are analyzed and judged. Fig.16 (a) in the figure.
[0315] Similarly, all points in the inner contour dot matrix also execute the same operation steps as the outer contour dot matrix.
[0316] In summary, by filtering out redundant points in the polygonal contour lattice and retaining only points of important biological significance, data quality and simplicity can be optimized, thereby simplifying the data structure and reducing the amount of data, improving the efficiency and accuracy of the analysis. At the same time, by retaining only triangular areas containing sufficient cell points, it is ensured that subsequent analysis only focuses on biologically significant areas, avoiding errors and noise introduced by irrelevant data. Removing unnecessary coordinate points also reduces the complexity and processing time of calculations, significantly improving the computing speed and resource utilization in large-scale data processing, and making the analysis more efficient. In addition, this method enhances the visualization effect, makes the image clearer, highlights important areas and features, and facilitates researchers to analyze and interpret.
[0317] Example 5
[0318] Reference Fig.17 Embodiment 5 of the present invention provides a method for processing an intestinal spatiotemporal group curled image, wherein step S400 constructs a set of ordered bin regions according to the original coordinate matrix, and maps each cell in the RDS file to the bin region, including:
[0319] Step S410, using the outer contour dot matrix and the inner contour dot matrix in the polygon contour dot matrix of the original coordinate matrix, construct a bin set including bin areas that are sequentially connected and arranged in order; the bin area is the area where the polygon includes at least 3 sides;
[0320] As mentioned above, the bin area is the area where the polygon with at least 3 sides is located. A series of orderly arranged bin areas are built, each bin area represents a polygon area, and these bin areas can cover all parts of the target curling area.
[0321] By dividing the curled target area into multiple ordered bin areas, the cell data in each bin area can be accurately located and analyzed, enhancing the resolution capability of spatial data.
[0322] Specifically, a graphical algorithm, such as Delaunay triangulation or Voronoi diagram segmentation, can be used to segment the polygonal contour point matrix into multiple connected regions (bins). These algorithms can effectively construct spatial regions to ensure that there are no omissions or overlaps.
[0323] As mentioned above, each bin area is a polygon with at least 3 sides, for example, it can be a quadrilateral.
[0324] Step S420: Map each cell in the RDS file to the bin region in the bin set.
[0325] As mentioned above, each cell data in the RDS file is mapped to the bin area in the constructed bin set. By comparing the position of the cell with the position of each bin area, it is determined which bin area the cell belongs to. Thus, each cell is mapped to its corresponding bin area, forming a mapping of the orderly distribution of cells in space.
[0326] This method can help to more clearly understand the distribution of cells in different spatial regions, thereby revealing the relationship between cell functions and characteristics and their spatial location. In this way, it is easier to analyze the behavior and characteristics of cells in different tissue regions.
[0327] This mapping can be achieved using a spatial mapping algorithm, for example, by calculating the geometric relationship between each cell coordinate and the bin region boundary to determine the cell's affiliation.
[0328] The above steps help to analyze the spatial distribution characteristics of cells in tissues in more detail by dividing the target area into multiple ordered bin areas and mapping the cell data. This method can improve the spatial resolution and analysis capabilities of the data, reveal the spatial dependence of cell behavior, and provide important technical support for in-depth research on the relationship between cell function and tissue structure.
[0329] For further reference, Fig.18 The step S410, using the outer contour dot matrix and the inner contour dot matrix in the polygonal contour dot matrix of the original coordinate matrix, constructs a bin set containing bin areas that are sequentially connected and arranged in order, including:
[0330] Step S411, in the original coordinate matrix, select two adjacent outer coordinate points in the outer contour dot matrix in turn as the lower left point and the lower right point respectively; select the inner coordinate point corresponding to the lower left point in the inner contour dot matrix as the upper left point; or select the upper right point of the adjacent previous bin area as the current upper left point;
[0331] As mentioned above, in the original coordinate matrix, two adjacent outer coordinate points in the outer contour dot matrix are selected in turn as the lower left point and the lower right point respectively; then the inner coordinate point corresponding to the lower left point in the inner contour dot matrix is selected as the upper left point, or the upper right point of the adjacent previous bin area is selected as the current upper left point. Thus, the three boundary points (lower left point, lower right point, upper left point) constituting the bin area are determined, providing a basis for determining the fourth point (upper right point) and constructing the bin area.
[0332] In this way, each bin area is ensured to be connected sequentially and arranged in order, which helps to simplify the construction process and data mapping and improve efficiency.
[0333] The bin area can be constructed by traversing the outer and inner lattices in the data matrix in an iterative manner and selecting adjacent points in sequence.
[0334] Step S412, determining an upper right point according to the lower left point, the lower right point and the upper left point;
[0335] In the above, the position of the upper right point is determined based on the lower left point, lower right point and upper left point. The key to this step is to determine the fourth point through these three points so as to form a closed polygon bin area. Four coordinate points (lower left, lower right, upper left, upper right) are determined, and these four points define a bin area. Accurately define the boundary points of the bin area to ensure that each bin area is connected to each other and avoid missing any area. You can use geometric methods or interpolation algorithms to calculate the position of the fourth point based on the positions of the first three points to form a closed quadrilateral area.
[0336] Step S413, forming a bin area based on the lower left point, the lower right point, the upper left point and the upper right point;
[0337] In the above, a bin area is formed based on four coordinate points (lower left, lower right, upper left, and upper right). The bin area is a polygonal area that includes at least three sides. A well-defined bin area is constructed. This provides a basis for the subsequent mapping of cell data into these bin areas, and each bin area can accurately correspond to a part of the intestinal curl area.
[0338] Define a data structure in the program to store the four boundary points of each bin area, and then use these points to build the bin area.
[0339] Step S414, constructing the bin set based on the bin areas that are connected and arranged in order; wherein, in adjacent bin areas, the upper right point of the previous bin area is the upper left point of the next bin area; and the lower right point of the previous bin area is the lower left point of the next bin area.
[0340] In the above, a bin set is constructed based on the bin areas that are connected and arranged in order, wherein adjacent bin areas share the same boundary points.
[0341] Specifically, the upper right point of the previous bin area is the upper left point of the next bin area, and the lower right point of the previous bin area is the lower left point of the next bin area.
[0342] In this step, a set of all bin regions is constructed to ensure that these bin regions are connected to each other and cover the entire range of the target area. Building a bin set can better manage and process these regions, facilitating subsequent cell mapping and spatial analysis.
[0343] You can use a loop structure to traverse all outer and inner coordinate points in the program and build a continuous bin set by sharing boundary points.
[0344] For example, in this example, each bin area is a polygon, such as a quadrilateral.
[0345] Define the lower left point as C, the lower right point as A, the upper left point as D, and the upper right point as B.
[0346] Among them, points C and A are adjacent points in the outer contour dot matrix, and points B and D are points in the inner contour dot matrix. It should be noted that points B and D may overlap or may be different points.
[0347] Above, reference Fig.19 , two adjacent bin areas are defined as and , The outer point of the connecting boundary, i.e. the lower right point , upper right , and because and Connect in sequence, The lower right point yes The lower left point C k+1 ; Similarly, Upper right center It is also The upper left point D of , where k represents the kth bin.
[0348] Through these steps, the target curled area can be divided into multiple sequentially connected and orderly arranged bin area sets. This method ensures that each bin area accurately corresponds to a part of the target area, making subsequent data mapping and spatial analysis more accurate and effective. The process of constructing a bin set can help researchers better understand and analyze the distribution and behavior of cells in different regions, and reveal the relationship between spatial position and function. These steps can be implemented through geometric algorithms, interpolation methods and programming languages, which helps to automate data processing and analysis.
[0349] For further reference, Fig. 20 The step S412, determining the upper right point according to the lower left point, the lower right point and the upper left point, comprises:
[0350] Step S4121, determining a straight line passing through the lower right point and perpendicular to the line connecting the lower left point and the lower right point as the first straight line;
[0351] In the above, a straight line passing through the lower right point and perpendicular to the line between the lower left point and the lower right point is determined as the first straight line. The purpose of this step is to find a straight line perpendicular to the bottom edge of the bin area (the line segment formed by the lower left point and the lower right point), so as to obtain a straight line perpendicular to the bottom edge (the first straight line), which will be used for subsequent geometric calculations.
[0352] The vertical first straight line helps to accurately locate the height direction of the bin area and provides a geometric basis for the subsequent determination of the upper right point.
[0353] This can be achieved by calculating the point-slope equation of the line. Given two points (the lower left point and the lower right point), the slope of the base can be calculated, and then the equation of the first line can be obtained based on the perpendicular relationship.
[0354] For example, in a bin area, define the lower left point C, the lower right point A, the upper right point B and the upper left point D, and the line between the lower left point and the lower right point is defined as CA.
[0355] The straight line passing through the lower right point A and perpendicular to CA, that is, the first straight line, is defined as L.
[0356] Step S4122, determining a straight line passing through the upper left point and perpendicular to the first straight line as the second straight line; and taking the intersection of the first straight line and the second straight line as the intersection point;
[0357] In the above, a straight line passing through the upper left point and perpendicular to the first straight line is determined as the second straight line. This step aims to find a straight line perpendicular to the first straight line, passing through the upper left point, so as to further determine the position of the upper right point. Thus, a second straight line perpendicular to the first straight line and passing through the upper left point is obtained. The intersection of these two straight lines will help locate the upper right corner of the bin area.
[0358] The calculation of the second line provides an accurate geometric framework for forming a closed bin region.
[0359] Based on the equation of the first straight line, the equation of the straight line passing through the upper left point and perpendicular to the first straight line can be determined by the point-slope form or the standard straight line equation form.
[0360] In the above, the intersection point of the first straight line and the second straight line is calculated as the intersection point. The purpose of this step is to find the intersection point of the two straight lines. This point determines a reference position in the image space for further selecting the upper right point. After the intersection point is determined, the top position of the point in the bin area provides a candidate range for determining the upper right point.
[0361] The intersection point provides an initial geometric position for the subsequent optimization process, facilitating further screening and optimization.
[0362] For example, in this bin area, a straight line passing through the upper left point D and perpendicular to the first straight line L is defined as the second straight line.
[0363] The point where the first straight line L and the second straight line intersect is O, which is the intersection point.
[0364] Step S4123, selecting inner coordinate points whose horizontal coordinates fall between the upper left point and the intersection point in the inner contour dot matrix as a selected point set;
[0365] In the above, the inner coordinate points whose horizontal coordinates fall between the upper left point and the intersection point in the inner contour dot matrix are selected as the selected point set. This step is intended to narrow the range of possible upper right points and reduce the computational complexity. Thus, a set of candidate points that may be used as the upper right point is obtained, and these points are within the reasonable range of the inner contour. By limiting the range of candidate points, the best upper right point can be found faster while reducing unnecessary calculations.
[0366] Specifically, the points in the inner contour dot matrix can be traversed, and the points whose ordinates are within a specified range can be screened out.
[0367] The above steps are to find a set of continuous points between point D and point O in the inner contour dot matrix as the selected point set.
[0368] Step S4124, calculating the pixel distance between each coordinate point in the selected point set and the lower right point, and selecting the coordinate point with the smallest pixel distance as the upper right point.
[0369] In the above, the pixel distance between each point in the selected point set and the lower right point is calculated, and the point with the smallest distance is selected as the upper right point. The goal of this step is to find a point closest to the lower right point, ensuring that the top boundary of the bin area is the shortest distance to reduce distortion.
[0370] This step determines the final position of the upper right point, which is the valid inner contour point closest to the lower right point. This method can optimize the shape of the bin area to make it more consistent with the natural boundary of the curled area, ensuring the accuracy and effectiveness of the analysis.
[0371] Specifically, the Euclidean distance between the candidate point and the lower right point can be calculated, and the point with the minimum distance can be selected as the upper right point.
[0372] The above steps accurately determine the upper right point of each bin region by using geometric relationships and distance optimization methods, ensuring that the constructed bin region set can accurately represent the true structure of the intestinal spatiotemporal group curled image. This method optimizes the construction of the bin region so that each region in the image can be accurately spatially located and analyzed. These steps can be implemented by combining geometric and optimization algorithms in programming languages (such as Python, MATLAB).
[0373] For further reference, Fig.21 After the step S410 of constructing a bin set including bin areas that are sequentially connected and arranged in order, the step further includes:
[0374] Step S410-1, taking the length between the lower left point and the lower right point of all the bin areas as the bottom length; calculating the mean or median of the bottom lengths of all the bin areas in the bin set as the evaluation value;
[0375] It should be noted that the bin set constructed in the above method may have some potential uneven problems. First, uneven bin area size and shape may lead to uneven data distribution, affecting the statistical power of the analysis and the reliability of the results. In addition, bin areas that are too large or too small may lead to inefficient data processing, where too small areas may waste computing resources, while too large areas may mask important biological differences. This unevenness may also reduce the credibility of the analysis results, especially when the number of cells in certain bin areas is insufficient for effective statistical inference. Finally, uneven bin areas may also make it difficult to effectively visualize and interpret the analysis results, especially in studies that need to reveal complex expression patterns and spatial distributions. Therefore, performing these optimization steps is key to ensuring the consistency, efficiency, and accuracy of data analysis.
[0376] In this embodiment, the focus is on optimizing the constructed bin region set. These steps are implemented to ensure the consistency and effectiveness of data processing and the accuracy of analysis.
[0377] As mentioned above, the mean or median of the bottom edge lengths of all bin regions is calculated as the evaluation criterion. This helps to evaluate the size consistency of the bin regions in the entire image. Thus, a unified bottom edge length evaluation value is obtained for subsequent comparison and adjustment.
[0378] Unified evaluation criteria can help maintain the consistency of bin area specifications, which is beneficial for subsequent analysis and visualization.
[0379] Step S410-2, determining whether there is a bin region in the bin set whose bottom length is less than the evaluation value;
[0380] Step S410-3, if there is a bin region whose bottom length is less than the evaluation value, merge the bin region with the adjacent previous or next bin region until the bottom length of the merged bin region is not less than the evaluation value;
[0381] In the above, check whether there are bin regions whose bottom length is less than the evaluation value, and adjust these regions, for example, by merging adjacent bin regions. Thus, the bottom length of all bin regions is at least equal to the evaluation value. Ensure that there are no bin regions that are too small to avoid insufficient data or analysis errors caused by too small regions.
[0382] In addition, if there is no bin region whose bottom side length is less than the evaluation value, step S410 - 4 may be directly executed.
[0383] Step S410-4, calculating the average value of the bottom edge lengths of all bin regions in the bin set according to the formula as the average length value:
[0384] (Formula 3);
[0385] Among them, L 均 Represents the average length value; L 总 Represents the sum of the bottom lengths of all bin areas in the bin set; n bin集合 Represents the total number of bin areas in the bin set;
[0386] In the above, the average length of the bottom edge of all bin regions in the bin set is calculated as another uniformity measure, thereby obtaining the average length of the bottom edge of the bin region. The above steps provide a mean value based on actual data for further optimization and adjustment.
[0387] Step S410-5, determining whether there is a bin region in the bin set whose bottom length is less than the average length value;
[0388] As described above, the number of cells contained in each bin area is obtained, and it is determined whether the preset cell number threshold is met. It is ensured that there are enough cells in each bin area, which is suitable for biological analysis, so as to avoid statistical errors or invalid analysis caused by insufficient cell number.
[0389] Specifically, the number of cells in each bin area needs to be calculated and compared with the preset threshold, and adjusted if necessary.
[0390] Step S410-6: if there is a bin region whose bottom length is less than the average length value, merge the bin region with the adjacent previous or next bin region until the bottom length of the merged bin region is not less than the average length value;
[0391] In the above, in the comparison and judgment process of the base length and the average length value, it is determined whether there is an area whose base length is less than the average length value. If it is less than, the bin area is merged with the previous or next bin area until the merged bin area is ≥ the average length value.
[0392] In addition, if there is no bin region whose bottom side length is less than the average length value, step S410 - 7 can be directly executed.
[0393] Step S410-7, obtaining the number of cells contained in each of the bin regions of the bin set; and determining whether there is a bin region in the bin set whose cell number is less than a preset cell number threshold;
[0394] Step S410-8: If there is a bin region with a cell number less than a preset cell number threshold, the bin region is merged with the adjacent previous or next bin region until the cell number in the merged bin region is not less than the preset cell number threshold.
[0395] If there is no bin area with a cell number less than a preset cell number threshold, the optimization process can be stopped.
[0396] As mentioned above, the number of cells contained is then determined, and the number of cells present is compared with a preset cell number threshold. For example, the preset cell number threshold is 50. When the number of cells present is 49, the bin area is merged with the previous or subsequent bin area until the number of cells present is ≥50.
[0397] In this embodiment, the above steps enhance the uniformity and consistency of the processing process by ensuring that all bin areas have similar sizes and shapes, which is crucial for subsequent statistical analysis and biological interpretation, because uneven bin sizes may lead to analytical bias or errors in the interpretation of results. Ensuring that there are enough cells in each bin area provides a basis for reliable statistical analysis and avoids the inability to reflect true biological variations or patterns due to too small bin areas or insufficient cell numbers. In addition, by adjusting the bin areas that are too small or too large, computing resources can be used more effectively, and storage and processing speeds can be optimized, thereby improving the efficiency of the overall analysis. Uniform bin areas also make the visual representation clearer, making it easier to identify and interpret important biological features and patterns, thereby improving the quality of visualization and interpretation.
[0398] Example 6
[0399] Reference Fig. 22 Embodiment 6 of the present invention provides a method for processing a curled image of an intestinal spatiotemporal group, wherein step S500 performs spatial transformation on each bin region to form a straightened image, and obtains the transformed coordinates in the bin region, including:
[0400] Step S510, calculating the geometric center point of each of the bin areas, and calculating the rotation angle of each of the bin areas relative to the geometric center point;
[0401] The above steps are mainly to determine the spatial center of each bin area and the direction of its data. By calculating the geometric center point, that is, the centroid, the core position of the area can be determined, and the rotation angle describes the directionality of the area, which is very critical for subsequent spatial standardization.
[0402] The geometric center point can be obtained by calculating the mean value of all points in the bin area. The rotation angle can be determined by principal component analysis (PCA), which identifies the main directions in the data. The rotation angle is the direction of the first principal component.
[0403] The execution of this step ensures that the subsequent spatial transformation is consistent for all bin areas, facilitating comparison and analysis.
[0404] Step S520, based on the geometric center point and the rotation angle, mirror transform the bin area, and translate the geometric center point to the position of the transformed geometric center point;
[0405] The above steps adjust the direction of the bin area by mirroring the geometric center so that all areas have the same direction. After the mirroring transformation, the geometric center is translated to a new position to optimize the spatial layout of the data.
[0406] Mirror transformation can be achieved by calculating the rotation matrix, which corresponds to the rotation angle, and the transformation matrix can be calculated based on the angle. Translation is achieved by adding or subtracting specific coordinate values.
[0407] By using mirroring and translation transformations, all bin regions can be aligned into a common reference frame, making comparison of data across regions more consistent and accurate.
[0408] Step S530, performing affine transformation processing, and obtaining the converted coordinates in the bin area after the affine transformation processing.
[0409] As mentioned above, affine transformation is a linear transformation that can keep the relative position relationship between points, lines and planes unchanged, which is very important in image processing and geometric shape adjustment. Affine transformation can be achieved by combining basic transformations such as rotation, scaling, and translation. The specific affine transformation matrix can be designed according to the features that need to be maintained in the bin area, for example, maintaining area ratios, angles, etc.
[0410] The coordinates after affine transformation not only provide a unified perspective, but also preserve the essential features of the original data, such as scale and angle, which is crucial for subsequent analysis and interpretation.
[0411] Furthermore, the calculation formula of the geometric center point of the bin area is:
[0412] (Formula 4); (Formula 5);
[0413] Each bin area is defined as a polygon with 4 vertices, n represents the number of vertices of the polygon, n=4; i represents the bin area bin i The index of each vertex is (x i ,y i ), the vertices include: the lower left point is C (x iC ,y iC ), the lower right point is A (x iA ,y iA ), the upper left point is D (x iD ,y iD ) and the upper right point is B (x iB ,y iB ).
[0414] For further reference, Fig.23 The step S510 of calculating the rotation angle of each bin area relative to the geometric center point includes:
[0415] Step S511, taking the straight line from the lower left point to the lower right point in the bin area as the base straight line; taking the straight line perpendicular to the base straight line as the vertical straight line; determining the intersection point where the vertical straight line passing through the geometric center point O intersects with the base straight line as the intersection point P, and the coordinates of the intersection point are (x, y);
[0416] Step S512: Take the straight line passing through the geometric center point O and the intersection point P as OP; limit the vector of OP to be parallel to the positive direction of the y-axis, and calculate the rotation angle θ of the vector of OP along the geometric center point O.
[0417] Further, the calculation formula of the rotation angle θ of the vector of the OP along the geometric center point O is referred to in Table 1:
[0418] Table 1. Rotation angle calculation formula
[0419]
[0420] Among them, π represents pi; i represents the bin area bin i The index in; arccos function is the inverse cosine function; point (x iO ,y iO ) is the i-th bin i The coordinates of the geometric center point; point (x iP ,y iP ), represents the i-th bin i , passing through the geometric center point O i The point of intersection of the vertical line and the base line is P i The coordinates of the point (x iA ,y iA ) is the i-th The lower right point A i The coordinates of the point (x iC ,y iC ) is the i-th The lower left point C i The coordinates of .
[0421] The above formula aims to calculate the rotation angle of the bin area, which is the deviation between its geometric center point (O) and the baseline of the bin area (the line from the lower left point C to the lower right point A). The OP vector is the vector from the geometric center point O to the intersection point P (the intersection of the vertical line and the bottom line), which is used to determine the rotation angle of the bin area.
[0422] The calculation formula of the rotation angle θ is calculated by the arccosine function. There are many specific cases, and the calculation method is mainly determined by the relative positions of the four vertices in the bin area.
[0423] The above calculation formula can be used to calculate the rotation angle of each bin area relative to its geometric center. This method ensures accurate positioning and rotation transformation of the bin area, thus achieving high accuracy in further image processing (such as affine transformation and visual linearization).
[0424] For further reference, Fig.24 The step S520, based on the geometric center point and the rotation angle, performs a mirror transformation on the bin area, including:
[0425] Step S521, defining a rotation matrix according to the rotation angle, and rotating along the geometric center point of the bin area based on the rotation matrix, and calculating the coordinates of the intersection point P before the rotation and the intersection point P' after the rotation;
[0426] As mentioned above, by defining the rotation matrix and applying it to the bin area, the data in the bin area is aligned, thereby unifying the data direction for subsequent processing and analysis. The rotation matrix rotates each point in the bin area by the same angle based on the calculated rotation angle, centered on the geometric center.
[0427] Using a rotation matrix from linear algebra, where θ is the angle of the desired rotation, the new coordinates of each point are calculated by multiplying the rotation matrix by the original coordinate vector.
[0428] This makes all bin areas have the same orientation in space, which is convenient for group comparison and analysis. The rotation operation does not change the relative distance between points, thus preserving the spatial structure of the original data.
[0429] Step S522, based on the intersection point after rotation and all points in the bin area, a mirror transformation of the y=y0 symmetry line is performed.
[0430] As mentioned above, the coordinates of the new intersection point P' after the rotation operation are calculated, which is the key to determining the symmetry axis of the bin area in the new direction.
[0431] Specifically, the rotation matrix can also be used to transform the coordinates of the original intersection point P to the new position P'. If the coordinates of the original point P are (x, y), the coordinates after rotation will be calculated. This ensures that the symmetry of the mirror transformation is correct, and the mirror transformation will be performed relative to the correct axis, ensuring the symmetry and consistency of the data.
[0432] As mentioned above, the mirror transformation is to map the bin area to the other side of its symmetry axis. This can further standardize the direction of the area, especially when processing biological or medical image data with specific directionality.
[0433] First, we need to define y=y0 (the y coordinate of the new intersection point P') as the symmetry line, and then mirror each point. The new coordinates are , where y is the original y coordinate.
[0434] Mirroring ensures image symmetry, which is important when making comparisons and measurements because it eliminates directional bias.
[0435] Furthermore, the coordinates of the intersection point P' after the rotation are calculated as follows:
[0436] ;(Formula 14)
[0437] Among them, the cos function is the cosine function, and the sin function is the sine function; represents the rotation matrix; P represents the coordinates of the intersection point before rotation; O represents the coordinates of the geometric center point of the bin area; P` represents the coordinates of the intersection point after rotation.
[0438] Furthermore, the regular formula for the mirror transformation of the y=y0 symmetry line is:
[0439] y'=2×y0-y;A x <C x And y0≥y p , or, A x ≥C x And y0<y p ;(Formula 15)
[0440] Wherein, y0 represents the y-axis coordinate of the geometric center point O, y` represents the y-axis coordinate of the point after the mirror transformation; y represents the y-axis coordinate of the point before the mirror transformation; A x represents the x-axis coordinate of the lower right point A; C x represents the x-axis coordinate of the lower left point C; y0 represents the y-axis coordinate of the geometric center point O, y p Represents the y-axis coordinate of the intersection point P.
[0441] Furthermore, the step S520 of translating the geometric center point to the position of the transformed geometric center point includes:
[0442] Step S523, translating the geometric center point before the transformation to the position of the geometric center point after the transformation, requiring the following conditions to be met at the same time:
[0443] A. The current bin area bin i Move to the adjacent previous bin area bin i-1 after;
[0444] B. The bin area i The lower left point C and the previous bin area bin i-1 The lower right point A coincides with the
[0445] The above steps are used to ensure that consecutive bin areas are correctly aligned, especially after spatial transformations such as mirroring or rotation. Depending on the conditions that need to be met, the docking of the current bin area after translation with the previous bin area is checked to ensure that, for example, the lower left point C coincides with the lower right point A of the previous bin area, thereby achieving a continuous spatial layout.
[0446] This step improves data continuity and accuracy, ensuring that adjacent bin regions are not broken during visual and data analysis, which is critical for the interpretation of the spatial expression matrix.
[0447] Step S524, taking the straight line from the lower left point to the lower right point in the bin area as the base straight line; taking the straight line perpendicular to the base straight line as the vertical straight line; determining the intersection point where the vertical straight line passing through the geometric center point O intersects with the base straight line as the intersection point P, and the coordinates of the intersection point are (x, y);
[0448] The coordinates of the intersection point P before the transformation are transformed into the coordinates of P' after the transformation; the calculation formula for the transformation is: x'=x+(x O` -x O ); (Formula 15) y`=y+(y O` -y O ); (Formula 16)
[0449] Wherein, x and y are the horizontal and vertical coordinates of the intersection point P before transformation, respectively; x' and y' are the horizontal and vertical coordinates of the intersection point P' after transformation, respectively; x O and O are the horizontal and vertical coordinates of the geometric center point O before transformation; O` and O` are respectively the horizontal and vertical coordinates of the transformed geometric center point O'.
[0450] As mentioned above, after the spatial transformation, the coordinates of key points (such as the intersection point P) used for positioning and alignment purposes must be recalculated.
[0451] The coordinates of the intersection point P are converted to P' coordinates in the new coordinate system. This is done by adding the coordinate changes of the geometric center point to the intersection point coordinates, ensuring that the geometric and functional markers are correctly aligned in the image, enhancing the data parsing ability and image processing accuracy.
[0452] Furthermore, the geometric center point before the transformation is translated to the position of the geometric center point after the transformation, and the i-th bin area bin after the transformation i The calculation formulas for the coordinates of the lower left point C' and the geometric center point O' are:
[0453] For the lower left point C':
[0454] When i=1, the horizontal and vertical coordinates of the lower left point C' are both 0;
[0455] When i>1, the horizontal coordinate of the lower left point C' is ; The vertical coordinate is 0; (Formula 17)
[0456] Among them, i represents the bin area bin i Index in; x iC and iC Respectively represent the horizontal and vertical coordinates of the lower left point C' of the i-th bin area; iA and iA Respectively represent the horizontal and vertical coordinates of the lower right point A' of the i-th bin area;
[0457] For the geometric center point O`:
[0458] when :
[0459] When i=1, the horizontal coordinate of the geometric center point O' is ; The vertical axis is ;
[0460] When i>1, the horizontal coordinate of the geometric center point O' is ; The vertical axis is ;(Formula 18)
[0461] when :
[0462] When i=1, the horizontal coordinate of the geometric center point O' is ; The vertical axis is ;
[0463] When i>1, the horizontal coordinate of the geometric center point O' is; the vertical coordinate is ;
[0464] in, Represents the distance from the lower left point C' to the intersection point P' after transformation; Represents the distance from the geometric center point O to the intersection point P before transformation.
[0465] Furthermore, the step S530 of performing affine transformation processing includes:
[0466] Step S531, calculating the affine transformation matrix of the bin area based on the cv2.getPerspectiveTransform function in OpenCV;
[0467] The calculation method is:
[0468] M i = cv2.getPerspectiveTransform(CABD,C1A1B1D1); (Formula 19)
[0469] Among them, M irepresents the affine transformation matrix for the i-th bin area; C, A, B and D respectively represent the lower left point C, lower right point A, upper right point B and upper left point D of the bin area before transformation; C1, A1, B1 and D1 respectively represent the lower left point C1, lower right point A1, upper right point B1 and upper left point D1 of the bin area after transformation;
[0470] The above steps determine the corresponding corner points of the original bin area and the target bin area, and use the cv2.getPerspectiveTransform function in the OpenCV library to calculate the perspective transformation matrix from one quadrilateral to another.
[0471] Specifically, you can input the four corner points of the original bin area and the four corner points of the target bin area. The function returns a matrix that can map the original corner points to the target corner points to achieve correct positioning and shape adjustment of the graphics.
[0472] This transformation ensures that the image regions maintain their geometric and spatial relationships even after rotation, scaling or other morphological changes, which is critical for further analysis and processing of the image.
[0473] As mentioned above, by using the calculated affine transformation matrix, the coordinate points in the bin area are updated to achieve image correction and standardization. The affine transformation matrix is multiplied by the original coordinate point vector (including a homogeneous coordinate 1 to make it affine compatible) to obtain the transformed coordinate point. This step enables complex image transformations, including translation, scaling, rotation, etc., which is particularly important for image analysis because it allows images to be observed and analyzed from different angles or under different conditions.
[0474] The calculation formula of the converted coordinates in the bin area is:
[0475] ;(Formula 20)
[0476] Among them, M represents the affine transformation matrix; x and y represent the horizontal and vertical coordinates of the intersection point P of the bin area before the transformation; x` and y` represent the horizontal and vertical coordinates of the intersection point P` of the bin area after the transformation.
[0477] The above method provides a very flexible way to process images, and various spatial adjustments can be made to the images as needed. Using matrix transformation can reduce errors in the image processing process and improve processing efficiency.
[0478] Example 7
[0479] In order to better illustrate the processing method of the intestinal spatiotemporal group curled image provided in the embodiments of the present application and verify the technical feasibility and performance of the method, the following specific embodiments are used to demonstrate the steps of the method and the corresponding effects.
[0480] Experimental methods:
[0481] Step S1, using a 1cm×1cm spatiotemporal group chip to conduct experiments, and the biological tissue sample sequenced is a mouse intestinal organ sample.
[0482] Step S2: After obtaining the sequencing results, the SAW process, the standard spatiotemporal group delivery process published by BGI, was used to perform upstream bioinformatics analysis, and an expression matrix file in the gef format containing the physical position relationship of the chip was obtained.
[0483] At the same time, Stereopy and Seurat were combined for downstream biological information analysis to obtain the cell expression matrix in the RDS format required in this example.
[0484] Step S3, reducing the pixels of the ssDNA high-definition image scanned by the microscope, and then marking the contours of the image after the pixels are reduced.
[0485] Step S4, preprocessing is performed using the method in the above embodiment. The method may include:
[0486] (1) Obtaining a target image and sequencing data based on the spatiotemporal chip, and performing polygon annotation on the target curling region in the target image to obtain an image feature annotation file containing a coordinate pixel matrix of the target curling region;
[0487] (2) analyzing the sequencing data to obtain expression matrix data, and converting the data into an RDS file containing the expression matrix data in combination with the physical coordinates of the spatiotemporal group chip;
[0488] (3) Based on the RDS file, mapping the coordinate pixel matrix in the image feature annotation file to the target image to obtain an original coordinate matrix;
[0489] (4) constructing a set of ordered bin regions according to the original coordinate matrix, and mapping each cell in the RDS file to the bin region;
[0490] A spatial transformation is performed on each of the bin regions to form a straightened image, the transformed coordinates in the bin region are obtained, and a visualization image is constructed based on the transformed coordinates.
[0491] In the above processing, including coordinate registration ( Fig.25 )、bin area construction( Fig.26 ) and image straightening ( Fig. 27 ).
[0492] In this embodiment, the x-axis horizontal straightening of the cell expression matrix of the intestinal organ rolled into a spiral structure is demonstrated, which can intuitively show the distribution change pattern of intestinal genes at the distal and proximal ends of the intestine.
[0493] refer to Fig.29 In the conventional method used as a comparison, image expansion is based on a vertical coordinate system, in which the positions of coordinate points A and B after transformation will change the spatial distribution characteristics of the points and change the original layout; in contrast, the method used in this embodiment uses a bin area system, and the spatial distribution characteristics of the points do not change the edges and spatial layout, which can ensure the overall characteristics of the spatial distribution of the points while retaining the distribution law of the local area characteristics.
[0494] In addition, reference Fig.29 In an embodiment of the present application, a device for processing a curled image of an intestinal spatiotemporal group is also provided, comprising:
[0495] The acquisition and annotation module 10 is used to acquire the target image and sequencing data based on the spatiotemporal chip, and to perform polygon annotation on the target curling area in the target image to obtain an image feature annotation file containing a coordinate pixel matrix of the target curling area;
[0496] An analysis and conversion module 20 is used to analyze the sequencing data to obtain expression matrix data, and convert it into an RDS file containing the expression matrix data in combination with the physical coordinates of the spatiotemporal group chip;
[0497] A data mapping module 30 maps the coordinate pixel matrix in the image feature annotation file to the target image based on the RDS file to obtain an original coordinate matrix;
[0498] A set construction module 40 is used to construct a set of ordered bin regions according to the original coordinate matrix, and map each cell in the RDS file to the bin region;
[0499] The image conversion module 50 is used to perform spatial conversion on each of the bin regions to form a straightened image, obtain the converted coordinates in the bin region, and construct a visual image based on the converted coordinates.
[0500] In addition, an embodiment of the present application also provides a system for processing intestinal spatiotemporal group curled images, including a memory and a processor, wherein the memory stores a processing program for intestinal spatiotemporal group curled images, and the processor runs the processing program for intestinal spatiotemporal group curled images so that the system for processing intestinal spatiotemporal group curled images executes the method for processing intestinal spatiotemporal group curled images as described in any of the aforementioned embodiments.
[0501] In addition, a computer-readable storage medium is also provided in an embodiment of the present application, on which a processing program for the intestinal spatiotemporal group curled images is stored. When the processing program for the intestinal spatiotemporal group curled images is executed by a processor, a method for processing the intestinal spatiotemporal group curled images as described in any of the aforementioned embodiments is implemented.
[0502] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow chart, and the combination of boxes in the structure diagram and / or the flow chart, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0503] In addition, the functional modules or units in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0504] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0505] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A method for processing a curled image of an intestinal spatiotemporal group, characterized in that: include: Acquire a target image and sequencing data based on the spatiotemporal chip, and annotate the outer contour edge of the target curling area in the target image in a polygonal point drawing manner, connect the ends to form a closed loop, and obtain an outer contour annotation result; and annotate the inner contour edge of the target curling area, connect the ends to form a closed loop, and obtain an inner contour annotation result; construct a coordinate pixel matrix according to the outer contour annotation result and the inner contour annotation result, and construct an image feature annotation file according to the coordinate pixel matrix; Analyze the sequencing data to obtain expression matrix data, and convert the data into an RDS file containing the expression matrix data in combination with the physical coordinates of the spatiotemporal group chip; Based on the RDS file, mapping the coordinate pixel matrix in the image feature annotation file to the target image to obtain an original coordinate matrix; According to the original coordinate matrix, construct a set of ordered bin regions, and map each cell in the RDS file to the bin region; A spatial transformation is performed on each of the bin regions to form a straightened image, the transformed coordinates in the bin region are obtained, and a visualization image is constructed based on the transformed coordinates.
2. The method for processing the intestinal space-time group curled image according to claim 1, characterized in that: The step of mapping the coordinate pixel matrix in the image feature annotation file to the target image based on the RDS file to obtain the original coordinate matrix includes: The coordinate pixel matrix of the target image is inversely mapped to the intestinal spatiotemporal group curled image corresponding to the target image through a coordinate conversion formula, and the coordinates in the image feature annotation file are updated through the coordinates in the intestinal spatiotemporal group curled image; wherein the target image is an image obtained by reducing the pixel count of the intestinal spatiotemporal group curled image; Performing registration processing on the coordinate matrix formed by the coordinates in the image feature annotation file through the expression matrix data in the RDS file to obtain the original coordinate matrix after registration; The coordinate transformation formula includes: ; ; Among them, x new and new represents the horizontal and vertical coordinates of the point in the target image before transformation; old and old represents the horizontal and vertical coordinates of the points in the transformed intestinal spatiotemporal group curled image; h new represents the total height of pixel coordinates in the target image; h old represents the total height of pixel coordinates in the curled image of the intestinal spatiotemporal group; w new represents the total width of pixel coordinates in the target image; w old represents the total width of pixel coordinates in the curled image of the intestinal spatiotemporal group; The coordinate matrix formed by the coordinates in the image feature annotation file is registered by using the expression matrix data in the RDS file to obtain the registered original coordinate matrix, including: Perform contour extraction on the coordinate matrix in the image feature annotation file and the expression matrix data containing the physical coordinates in the RDS file, respectively, to obtain polygonal contour dot matrices corresponding to the coordinate matrix and the expression matrix data, respectively; wherein the polygonal contour dot matrix includes an outer contour dot matrix and an inner contour dot matrix; Performing registration processing of the outer contour point matrix and the inner contour point matrix in the polygonal contour point matrix respectively on the outer coordinate points and the inner coordinate points to obtain the original coordinate matrix after registration; The registering process of the outer coordinate points and the inner coordinate points respectively includes: For the peripheral coordinate points or the inner coordinate points, a mask image is generated for the polygonal contour dot matrix corresponding to the coordinate matrix and the expression matrix data respectively; wherein the mask image includes a core contour area of the polygon and a peripheral area surrounding the core contour area; Binarizing each of the mask images respectively to convert them into a binary image retaining the core contour area; the binary image includes a first image corresponding to the coordinate matrix and a second image corresponding to the expression matrix data; Determine the outer contour and geometric center point of the core contour area in each of the binary images; The first image and the second image are translated using the geometric center point to perform a coordinate translation transformation focus process; and based on the geometric center point and the outer contour, an image deflection angle of the first image relative to the second image in the coordinate translation transformation focus process is determined; Determining whether the image deflection angle is not greater than a preset angle threshold; If yes, it is determined that the registration process of the first image based on the second image is qualified; If not, it is determined that the registration processing of the first image based on the second image is unqualified; the coordinate matrix in the image feature annotation file and the expression matrix data containing the physical coordinates in the RDS file are respectively extracted to obtain the corresponding polygon contour point matrix; Generate a mask image for each polygonal contour dot matrix; wherein the mask image includes a core contour area of the polygon and a peripheral area of the core contour area; Marking the edge of the core contour area of the mask image and calculating the geometric center point of the core contour area; Coordinate translation transformation processing is performed using the geometric center point and annotated edge of each mask image to match the direction of the mask image, and the mask image is returned to execute the mask image generated by the polygonal contour dot matrix corresponding to the coordinate matrix and the expression matrix data respectively for the outer coordinate points or the inner coordinate points.
3. The method for processing the intestinal space-time group curled image according to claim 1, characterized in that: The step of mapping the coordinate pixel matrix in the image feature annotation file to the target image based on the RDS file to obtain the original coordinate matrix further includes: Performing filtering and redundancy removal processing on the outer contour dot matrix and the inner contour dot matrix of the polygonal contour dot matrix in the original coordinate matrix respectively; The filtering and redundancy removal process comprises: For one of the outer contour dot matrix and the inner contour dot matrix, three coordinate points arranged in sequence in the contour dot matrix are selected in order, and a triangular area is formed based on the three coordinate points; Based on the RDS file, determining whether the number of cell points contained in the triangular area is not less than a preset cell point number threshold; If yes, retain the first coordinate point of the three coordinate points, select three coordinate points arranged in sequence in the contour lattice from the second coordinate point, and form a triangular area again, and return to execute the RDS file based on the triangular area to determine whether the number of cell points contained in the triangular area is not less than the preset cell point number threshold until the coordinate points in the contour lattice are processed; If not, delete the coordinate point in the middle of the three coordinate points that constitute the triangle, and take the first coordinate point and the third coordinate point in the triangle as adjacent coordinate points, select the next coordinate point adjacent to the third coordinate point, and form a triangle together again, and return to execute based on the RDS file to determine whether the number of cell points in the triangle area is not less than the preset cell point number threshold.
4. The method for processing the intestinal space-time group curled image according to claim 1, characterized in that: The step of constructing a set of ordered bin regions according to the original coordinate matrix, and mapping each cell in the RDS file to the bin region, comprises: Using the outer contour dot matrix and the inner contour dot matrix in the polygon contour dot matrix of the original coordinate matrix, a bin set including bin areas that are sequentially connected and arranged in order is constructed; the bin area is the area where the polygon includes at least 3 sides; Mapping each cell in the RDS file to the bin region in the bin set; The method of using the outer contour dot matrix and the inner contour dot matrix in the polygonal contour dot matrix of the original coordinate matrix to construct a bin set including bin areas that are sequentially connected and arranged in order includes: In the original coordinate matrix, two adjacent outer coordinate points in the outer contour dot matrix are selected in sequence as the lower left point and the lower right point respectively; the inner coordinate point corresponding to the lower left point in the inner contour dot matrix is selected as the upper left point; or the upper right point of the adjacent previous bin area is selected as the current upper left point; Determine an upper right point according to the lower left point, the lower right point and the upper left point; A bin area is formed based on the lower left point, the lower right point, the upper left point and the upper right point; The bin set is constructed based on the bin areas that are connected and arranged in order; wherein, in adjacent bin areas, the upper right point of the previous bin area is the upper left point of the next bin area; and the lower right point of the previous bin area is the lower left point of the next bin area; The determining the upper right point according to the lower left point, the lower right point and the upper left point comprises: Determine a straight line passing through the lower right point and perpendicular to a line connecting the lower left point and the lower right point as a first straight line; Determine a straight line passing through the upper left point and perpendicular to the first straight line as a second straight line; and take the intersection of the first straight line and the second straight line as an intersection point; Selecting inner coordinate points whose horizontal coordinates fall between the upper left point and the intersection point in the inner contour dot matrix as a selected point set; Calculate the pixel distance between each coordinate point in the selected point set and the lower right point, and select the coordinate point with the smallest pixel distance as the upper right point; After constructing the bin set including the bin areas connected in sequence and arranged in order, the method further includes: The length between the lower left point and the lower right point of all the bin areas is used as the bottom edge length; the mean or median of the bottom edge lengths of all the bin areas in the bin set is calculated as the evaluation value; Determine whether there is a bin area in the bin set whose bottom length is less than the evaluation value; If there is a bin region whose bottom length is less than the evaluation value, merge the bin region with the adjacent previous or next bin region until the bottom length of the merged bin region is not less than the evaluation value; The average length of the bottom edges of all bin areas in the bin set is calculated according to the formula as the average length value: Among them, L 均 Represents the average length value; L 总 Represents the sum of the bottom lengths of all bin areas in the bin set; n bin集合 Represents the total number of bin areas in the bin set; Determine whether there is a bin region in the bin set whose bottom length is less than the average length value; If there is a bin region whose bottom length is less than the average length value, the bin region is merged with the adjacent previous or next bin region until the bottom length of the merged bin region is not less than the average length value; Obtaining the number of cells contained in each of the bin regions of the bin set; and determining whether there is a bin region in the bin set whose cell number is less than a preset cell number threshold; If there is a bin region with a cell number less than a preset cell number threshold, the bin region is merged with the adjacent previous or next bin region until the cell number in the merged bin region is not less than the preset cell number threshold.
5. The method for processing the intestinal space-time group curled image according to claim 1, characterized in that: The step of performing spatial transformation on each bin region to form a straightened image and obtaining the transformed coordinates in the bin region comprises: Calculating the geometric center point of each of the bin areas, and calculating the rotation angle of each of the bin areas relative to the geometric center point; Based on the geometric center point and the rotation angle, mirror transform the bin area, and translate the geometric center point to the position of the transformed geometric center point; Performing affine transformation processing and obtaining the transformed coordinates in the bin area after the affine transformation processing; The calculation formula of the geometric center point of the bin area is: ; ; Each bin area is defined as a polygon with 4 vertices, n represents the number of vertices of the polygon, n=4; i represents the bin area bin i The index of each vertex is (x i ,y i ), the vertices include: the lower left point is C (x iC ,y iC ), the lower right point is A (x iA ,y iA ), the upper left point is D (x iD ,y iD ) and the upper right point is B (x iB ,y iB ); The calculating the rotation angle of each bin area relative to the geometric center point comprises: The straight line between the lower left point and the lower right point in the bin area is used as the base straight line; the straight line perpendicular to the base straight line is used as the vertical straight line; the intersection point where the vertical straight line passing through the geometric center point O intersects with the base straight line is determined as the intersection point P, and the coordinates of the intersection point are (x, y); The straight line passing through the geometric center point O and the intersection point P is taken as OP; the vector of OP is limited to be parallel to the positive direction of the y-axis, and the rotation angle θ of the vector of OP along the geometric center point O is calculated; The calculation formula of the rotation angle θ of the vector of the OP along the geometric center point O is: when , , hour, ; when , , hour, ; when , , hour, ; when , , hour, ; when , , hour, ; when , , hour, ; when , , hour, ; when , , hour, ; Among them, π represents pi; i represents the bin area bin i The index in; arccos function is the inverse cosine function; point (x iO ,y iO ) is the i-th bin i The coordinates of the geometric center point; point (x iP ,y iP ), represents the i-th bin i , passing through the geometric center point O i The point of intersection of the vertical line and the base line is P i The coordinates of the point (x iA ,y iA ) is the i-th The lower right point A i The coordinates of the point (x iC ,y iC ) is the i-th The lower left point C i The coordinates of The mirroring of the bin area based on the geometric center point and the rotation angle includes: Define a rotation matrix according to the rotation angle, rotate along the geometric center point of the bin area based on the rotation matrix, and calculate the coordinates of the intersection point P before the rotation and the intersection point P' after the rotation; Based on the intersection point after rotation and all points in the bin area, a mirror transformation of the y=y0 symmetry line is performed.
6. The method for processing the intestinal space-time group curled image according to claim 5, characterized in that: The translating the geometric center point to the position of the transformed geometric center point includes: The geometric center point before the transformation is translated to the position of the geometric center point after the transformation, requiring the following conditions to be met at the same time: A. The current bin area bin i Move to the adjacent previous bin area bin i-1 after; B. The bin area i The lower left point C and the previous bin area bin i-1 The lower right point A coincides with the The straight line between the lower left point and the lower right point in the bin area is used as the base straight line; the straight line perpendicular to the base straight line is used as the vertical straight line; the intersection point where the vertical straight line passing through the geometric center point O intersects with the base straight line is determined as the intersection point P, and the coordinates of the intersection point P are (x, y); The coordinates of the intersection point P before the transformation are transformed into the coordinates of P' after the transformation; the calculation formula for the transformation is: x`=x+(x O` -x O );y`=y+(y O` -and O ); Wherein, x and y are the horizontal and vertical coordinates of the intersection point P before transformation, respectively; x' and y' are the horizontal and vertical coordinates of the intersection point P' after transformation, respectively; x O and O are the horizontal and vertical coordinates of the geometric center point O before transformation; O` and O` are respectively the horizontal and vertical coordinates of the geometric center point O' after transformation.
7. The method for processing the intestinal space-time group curled image according to claim 5, characterized in that: The affine transformation process comprises: The affine transformation matrix of the bin area is calculated based on the cv2.getPerspectiveTransform function in OpenCV; the calculation method is: M i = cv2.getPerspectiveTransform(CABD,C1A1B1D1); Among them, M i represents the affine transformation matrix for the i-th bin area; C, A, B and D respectively represent the lower left point C, lower right point A, upper right point B and upper left point D of the bin area before transformation; C1, A1, B1 and D1 respectively represent the lower left point C1, lower right point A1, upper right point B1 and upper left point D1 of the bin area after transformation; The calculation formula of the converted coordinates in the bin area is: ; Among them, M represents the affine transformation matrix; x and y represent the horizontal and vertical coordinates of the intersection point P of the bin area before the transformation; x` and y` represent the horizontal and vertical coordinates of the intersection point P` of the bin area after the transformation.
8. A device for processing intestinal space-time group curled images, characterized in that: include: Obtain annotation module, used to obtain target images and sequencing data based on spatiotemporal group chips, and Annotate the outer contour edge of the target curling area in a polygonal point drawing manner, connect the ends to form a closed loop, and obtain an outer contour annotation result; and annotate the inner contour edge of the target curling area, connect the ends to form a closed loop, and obtain an inner contour annotation result; construct a coordinate pixel matrix according to the outer contour annotation result and the inner contour annotation result, and construct an image feature annotation file according to the coordinate pixel matrix; An analysis and conversion module, used for analyzing the sequencing data to obtain expression matrix data, and converting the data into an RDS file containing the expression matrix data in combination with the physical coordinates of the spatiotemporal group chip; A data mapping module maps the coordinate pixel matrix in the image feature annotation file to the target image based on the RDS file to obtain an original coordinate matrix; A set construction module, used to construct a set of ordered bin regions according to the original coordinate matrix, and map each cell in the RDS file to the bin region; The image conversion module is used to perform spatial conversion on each of the bin areas to form a straightened image, obtain the converted coordinates in the bin area, and construct a visual image based on the converted coordinates.
9. A system for processing intestinal space-time group curled images, characterized in that: It comprises a memory and a processor, wherein the memory stores a processing program for intestinal spatiotemporal group curled images, and the processor runs the processing program for intestinal spatiotemporal group curled images to enable the processing system for intestinal spatiotemporal group curled images to execute the processing method for intestinal spatiotemporal group curled images as described in any one of claims 1-7.
Citation Information
Patent Citations
Method, device and equipment for straightening tubular object and storage medium
CN114419137A
Inter-species homologous gene conversion analysis method and system based on single cell transcriptome sequencing
CN116486914A