CN-122023114-A - Image stitching and edge optimization method and system based on Ashlar registration
Abstract
The invention discloses an image stitching and edge optimization method and system based on Ashlar registration, which relate to the technical field of spatial transcriptomics image processing and comprise the steps of initializing a mask matrix which is blank and contains all visual fields; based on the splicing type configured by the field to be spliced and the relative offset of the field to be spliced and the adjacent spliced fields, calculating the position of the field to be spliced in the spliced result and splicing the position to a mask matrix, performing union calculation and edge optimization on the overlapped area between the field to be spliced and the adjacent spliced fields, thereby obtaining a full-field cell segmentation spliced image, wherein the optimization method is used for splicing the cell segmentation result and eliminating the problem of abnormal or lost cell morphology of the spliced field edge.
Inventors
- DAI DAHAI
- WEI MIN
- LIU LILI
- LI XIN
- ZHANG XINYANG
- YU YUKE
Assignees
- 合肥北冥空间生物科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20251223
Claims (10)
- 1. An image stitching and edge optimization method based on Ashlar registration, comprising: initializing a mask matrix which is blank and contains the whole field of view; Calculating the position of the view to be spliced in a spliced result based on the splicing type configured by the view to be spliced and the relative offset of the view to be spliced and the adjacent spliced view, and splicing the position of the view to be spliced to a mask matrix; and performing union calculation and edge optimization on the overlapping area between the vision field to be spliced and the adjacent spliced vision field, thereby obtaining the full vision field cell segmentation spliced image.
- 2. The method of claim 1, wherein the view to be stitched is configured with a stitching type, wherein the stitching type comprises: The vision field to be spliced is arranged at the right, left and lower sides of the spliced vision field; the view to be spliced is positioned at the left lower corner and the right lower corner of the spliced view; There is no spliced field of view around the field of view to be spliced.
- 3. The method of claim 1, wherein the relative offset between the field of view to be stitched and the adjacent stitched field of view is calculated as follows: And registering the DAPI staining results by using Ashlar registration algorithm, and extracting the offset coefficients of all the visual fields to serve as the relative offset.
- 4. The method according to claim 1, wherein the calculating the position of the field of view to be stitched in the post-stitching result is performed by stitching the position to a mask matrix, specifically: Maintaining a maximum value of cell id in the splicing process, wherein the maximum value records the maximum cell id in the current mask matrix; The cell id newly added to the mask matrix is renamed as the original cell id+the maximum cell id in the current matrix.
- 5. The method according to claim 1, wherein the union calculation and edge optimization of the overlapping area between the field of view to be spliced and the adjacent spliced field of view is performed by: positioning an overlapping region between the vision field to be spliced and the adjacent spliced vision field according to the splicing type, the vision field position information and the relative offset of the vision field to be spliced; Performing union operation and edge processing on cells of the mask matrix in the overlapping area: and storing the mapping relation of cell ids before and after splicing, and recording the change of the cell ids in the process of splicing the cell ids to the mask matrix.
- 6. The method according to claim 5, wherein the cells of the mask matrix in the overlapping region are subjected to a union operation and an edge processing, wherein the union operation is specifically: If the area of the overlapping region of cells exceeds the set proportion of the sum of the areas of the cells Combining the cells into one cell, wherein Is a set constant parameter.
- 7. The method according to claim 1, wherein the cells of the mask matrix in the overlapping region are subjected to a union operation and an edge processing operation, wherein the edge processing operation is specifically: combining the at least partially aligned cells into the same cell; for the cells which are not aligned at all, calculating the average cell area in a certain range around the cells, combining the cells into one cell if the average cell area is larger than or equal to the average cell area around the cells, and discarding the cells if the average cell area around the cells is smaller than or equal to the average cell area around the cells.
- 8. The method of claim 1, wherein after performing union computation and edge optimization on the overlapping area between the to-be-stitched field of view and the adjacent stitched field of view, calculating the similarity between the full-field stitched DAPI stained image and the binarized full-field cell segmentation stitched image as an index for measuring the stitching effect.
- 9. The method of claim 1, wherein the index for measuring the splicing effect is cosine similarity and pearson correlation coefficient.
- 10. A computer system comprising a memory, a processor and a computer program stored on the memory, wherein the processor executes the computer program to implement the method of any one of claims 1-9.
Description
Image stitching and edge optimization method and system based on Ashlar registration Technical Field The invention relates to the technical field of spatial transcriptomics image processing, in particular to an image stitching and edge optimization method and system based on Ashlar registration. Background The space transcriptome (Spatial Transcriptomics) technology is an important biological research method, and combines the traditional single cell sequencing technology, in situ hybridization technology and other histology technologies, so that the gene expression data can be obtained while the space position information of the sample is reserved. Currently, space transcriptome technology is implemented in two major technical paths, sequencing-based and imaging-based. Compared with the sequencing-based technology, the imaging-based method has higher requirements on equipment and operation, but has high resolution, can easily realize single-cell precision, has relatively low cost, and has the advantages of high precision and low cost because the cost of a single sample is reduced along with the increase of the number of samples. In imaging-based spatial transcriptome experiments, large-area tissue sections need to be imaged multiple times, multiple channels, by microscopy to obtain image data for thousands of fields of view. Because of the limited single-view imaging area of the microscope, the views must be spliced into a global image by an image splicing technology, so that subsequent steps of point identification, cell segmentation, decoding, gene distribution and the like can be performed. When the fields including overlap (overlapping region between fields of view) are spliced, cells located on the cutting line when the fields of view are cut into a plurality of pieces, and then erroneous division occurs when the cells are divided. When a microscope is used to image a sample, the microscope is scanned across each field of view in a Z-or snake-type order. However, during the movement, the position of the actual imaging result is horizontally shifted from the divided view range due to the precision problem of the microscope movement module. This offset can affect the accuracy of the subsequent stitched single field cell segmentation results and point recognition results at the edges of the field of view. Specifically, the problem of overlapping or losing cells at the edges of the field of view, abnormal cell morphology, etc. occurs, resulting in inaccurate end results. Therefore, an efficient and accurate algorithm for image stitching and edge optimization is needed to solve the problem of post-stitching visual field edge imaging, so as to achieve accurate matching of sequencing data and spatial information, and further better reveal the distribution rule of gene expression in space Disclosure of Invention Based on the technical problems in the background art, the invention provides an image splicing and edge optimization method and system based on Ashlar registration, which are used for splicing cell segmentation results and eliminating the problem of abnormal or lost morphology of visual field edge cells after splicing. The image stitching and edge optimization method based on Ashlar registration provided by the invention comprises the following steps: initializing a mask matrix which is blank and contains the whole field of view; Calculating the position of the view to be spliced in a spliced result based on the splicing type configured by the view to be spliced and the relative offset of the view to be spliced and the adjacent spliced view, and splicing the position of the view to be spliced to a mask matrix; and performing union calculation and edge optimization on the overlapping area between the vision field to be spliced and the adjacent spliced vision field, thereby obtaining the full vision field cell segmentation spliced image. Further, the splicing type configured by the field of view to be spliced includes: The vision field to be spliced is arranged at the right, left and lower sides of the spliced vision field; the view to be spliced is positioned at the left lower corner and the right lower corner of the spliced view; There is no spliced field of view around the field of view to be spliced. Further, the relative offset between the to-be-spliced visual field and the adjacent spliced visual field is calculated as follows: And registering the DAPI staining results by using Ashlar registration algorithm, and extracting the offset coefficients of all the visual fields to serve as the relative offset. Further, the calculating the position of the to-be-spliced field of view in the spliced result and splicing the to-be-spliced field of view to the mask matrix specifically comprises: Maintaining a maximum value of cell id in the splicing process, wherein the maximum value records the maximum cell id in the current mask matrix; The cell id newly added to the mask matrix is renamed as the original ce