WO2024001051A1 - 空间组学单细胞数据获取方法及装置和电子设备 - Google Patents

空间组学单细胞数据获取方法及装置和电子设备 Download PDF

Info

Publication number
WO2024001051A1
WO2024001051A1 PCT/CN2022/136698 CN2022136698W WO2024001051A1 WO 2024001051 A1 WO2024001051 A1 WO 2024001051A1 CN 2022136698 W CN2022136698 W CN 2022136698W WO 2024001051 A1 WO2024001051 A1 WO 2024001051A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
gene expression
cell
stained
images
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2022/136698
Other languages
English (en)
French (fr)
Inventor
李美
刘焕林
李敏
岑伟轩
黄子睿
邓忠寒
苏奎
李泽鹏
冯柠
姜琪琛
吴逸文
康强
黎宇翔
张勇
徐讯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BGI Shenzhen Co Ltd
Original Assignee
BGI Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from PCT/CN2022/102505 external-priority patent/WO2024000313A1/zh
Priority claimed from PCT/CN2022/102360 external-priority patent/WO2024000268A1/zh
Priority claimed from PCT/CN2022/102424 external-priority patent/WO2024000288A1/zh
Priority claimed from PCT/CN2022/102443 external-priority patent/WO2024000295A1/zh
Priority claimed from PCT/CN2022/110779 external-priority patent/WO2024031219A1/zh
Application filed by BGI Shenzhen Co Ltd filed Critical BGI Shenzhen Co Ltd
Priority to CN202280097469.4A priority Critical patent/CN119422202A/zh
Publication of WO2024001051A1 publication Critical patent/WO2024001051A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16BBIOINFORMATICS, i.e. INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR GENETIC OR PROTEIN-RELATED DATA PROCESSING IN COMPUTATIONAL MOLECULAR BIOLOGY
    • G16B40/00ICT specially adapted for biostatistics; ICT specially adapted for bioinformatics-related machine learning or data mining, e.g. knowledge discovery or pattern finding
    • G16B40/30Unsupervised data analysis

Definitions

  • the present application relates to the field of data processing technology, and in particular to a spatial omics single cell data acquisition method and device and electronic equipment.
  • Spatiomics technology can reveal the function of the internal space of tissue structures at different times and the heterogeneity between tissue structures, creating favorable conditions for in-depth study of organismal tissue structure and intercellular communication.
  • some spatial transcriptome technologies have been developed to capture the entire transcriptome, but in most cases the expression information matrix provided does not reach single-cell level resolution. Therefore, how to obtain single-cell data is an urgent problem that needs to be solved.
  • This application provides a spatial omics single cell data acquisition method, device, electronic equipment and storage medium.
  • a spatial omics single cell data acquisition method which includes:
  • the cells to which the background gene molecules of unknown cells in the gene expression visualization image belong are determined according to the cell mask map, and the cells to which they belong are marked to obtain a spatial component molecular expression matrix with cell markers.
  • obtaining stained images of biological samples includes:
  • a spliced stained image of the biological sample composed of multiple sub-stained images is obtained through a microscope;
  • Multiple sub-staining images of the biological sample are acquired through the microscope, and the multiple sub-staining images are spliced to obtain a spliced staining image.
  • obtaining stained images of biological samples includes:
  • obtaining multiple sub-stained images of the biological sample through the microscope, splicing the multiple sub-stained images to obtain the spliced stained image includes:
  • the portions of the multiple sub-staining images and the template image that are determined to be overlapping areas are respectively cropped into a plurality of staining image overlapping sub-images and a plurality of template image overlapping sub-images of the same number, so as to be paired into multiple overlapping sub-images. right;
  • Each of the sub-stained images is translated toward the direction of the template image by the offset amount, and spliced together with the template image.
  • obtaining multiple sub-stained images of the biological sample through the microscope, splicing the multiple sub-stained images to obtain the spliced stained image includes:
  • the offset between the coordinates, and the coordinates of the second reference image are adjusted based on the offset to splice and generate the spliced stained image.
  • registering the staining image with the gene expression visualization image to obtain the registered image includes:
  • the staining image and the gene expression visualization image include multiple trajectory lines and/or multiple A trajectory point is formed by the intersection of two of the trajectory lines, and each trajectory line in the plurality of trajectory lines has a corresponding index number;
  • the third reference image is moved based on the target offset to obtain the registered image.
  • the method further includes:
  • the position corresponding to the maximum similarity value is used as the rough registration result.
  • register the staining image with the gene expression visualization image, and obtain the registered image including:
  • the staining image and the gene expression visualization image each include multiple trajectory lines and multiple trajectory points.
  • the trajectory points are formed by the intersection of two of the trajectory lines.
  • Each The trajectory line has a corresponding index number;
  • a target image is processed based on the offset information to obtain a registered image, where the target image is an image in a candidate image set corresponding to the track point pair.
  • the method before performing cell segmentation on the registered images to obtain a cell mask, the method further includes:
  • the registered images are subjected to tissue segmentation to obtain a tissue mask map.
  • performing tissue segmentation on the registered images to obtain a tissue mask includes:
  • the gene expression matrix arranges the gene expression levels according to pixel positions;
  • the image data is determined by assigning the gene expression amount at each pixel position in the gene expression matrix to the corresponding pixel position in the registered image;
  • the tissue mask map is obtained by marking the connected areas of the image data according to the foreground pixel points.
  • the method further includes:
  • the outer contour image and inner contour image of the grayscale image corresponding to the tissue mask map are calculated respectively;
  • the pixel density ratio is an outer contour image and an inner contour image in each image combination.
  • the grayscale image quality corresponding to the tissue mask image is calculated and described based on the pixel density ratio.
  • performing cell segmentation on the registered images to obtain a cell mask includes:
  • the pixel points belonging to cells or cell outlines in the segmentation result are determined as pixel points belonging to cells, and the segmentation result of the registered image is output to obtain the cell mask map.
  • performing cell segmentation on the registered images to obtain a cell mask includes:
  • a watershed algorithm based on distance transformation is used to segment the connected domain where cell adhesion exists, and the segmented cell mask map is obtained.
  • performing cell segmentation on the registered images to obtain a cell mask includes:
  • the area of the sub-region to be processed included in each marked area is determined based on the cell area.
  • the area of the sub-region to be processed is positively related to the area of the cell.
  • the sub-region to be processed is used to characterize the corresponding said The smallest processing unit of the marked area;
  • grid processing is performed on the corresponding marked area to obtain the grid coordinates corresponding to each marked area;
  • Data corresponding to the grid coordinates are extracted from the gene expression visualization image and superimposed on the grid coordinates to obtain the cell processing results of the target object.
  • determining the cells to which background gene molecules of unknown cells in the gene expression visualization image belong based on the cell mask map include:
  • each gene expression feature of the gene expression visualization image is determined as a cell gene expression feature located within the cell and a background gene expression feature located outside the cell;
  • a probability distribution model is fitted based on the spatial position and the signal value of the gene expression characteristics
  • the correction result is output according to the probability value to correct the background gene expression characteristics.
  • determining the cells to which background gene molecules of unknown cells in the gene expression visualization image belong based on the cell mask map include:
  • the gene expression visualization image determine the initial gene molecules belonging to the target cell and the background gene molecules of the unknown cell
  • determining the cells to which background gene molecules of unknown cells in the gene expression visualization image belong based on the cell mask map include:
  • the cell to which the background gene molecule belongs is determined based on the gene molecule density and the background gene molecule density.
  • determining the cells to which background gene molecules of unknown cells in the gene expression visualization image belong based on the cell mask map include:
  • the spatial coordinates and the gene expression characteristic signal value are input into a probability distribution model to obtain the probability score that the background gene molecule belongs to the target cell; the probability distribution model is based on the probability score of the gene molecule sample belonging to the target cell.
  • the spatial coordinates and gene expression characteristic signal values are fitted;
  • the cell to which the background gene molecule belongs is determined based on the probability score.
  • the corresponding cell markers include:
  • the cells are stained with ssDNA staining solution and cell boundary fluorescent staining solution, wherein the ssDNA staining solution includes buffer and ssDNA reagent, and the cell boundary fluorescent staining solution includes fluorescent dye.
  • the method also includes:
  • the directed target detection network includes:
  • the backbone Backbone layer is configured to perform feature extraction on the staining image or gene expression visualization image to be tested to obtain multiple feature maps at different scales;
  • the Neck layer is configured to receive the multiple feature maps from the Backbone layer and perform cross-scale fusion on the multiple feature maps to obtain multiple fused feature maps;
  • the detection head Head layer is configured to predict the plurality of fused images to obtain target detection results regarding the staining image or gene expression visualization image to be tested,
  • the target detection results include: classification information, target frame coordinate prediction information, target prediction information and angle prediction information.
  • the stained image plane in which the stained image is located includes a first direction and a second direction perpendicular to the first direction, and the stained image includes a plurality of first straight tracks transverse to the second direction. and a plurality of second straight trajectory lines transverse to said first direction,
  • the method for determining point coordinates in the stained image includes:
  • the pixels in the sampling area of the stained image selected by the first sampling strip during the equal-spaced sampling period in the first direction are accumulated and summed according to the first direction to obtain a series of first pixel values.
  • the first candidate point set is formed by the first candidate points obtained by sampling at equal intervals in each first direction;
  • the pixels in the sampling area of the stained image selected by the second sampling strip during the second direction equally spaced sampling period are accumulated and summed in the second direction to obtain a series of second pixel values.
  • the second candidate point set is formed by the second candidate points obtained by equally spaced sampling in each second direction;
  • Grouping steps include:
  • Line fitting steps include:
  • Coordinate calculation steps include:
  • the method further includes:
  • the second image including stained genetic material of the biological sample
  • Gene expression information of cells of the biological sample is obtained based on the registration image of the first image and the gene expression amount information according to the cell boundary.
  • a spatial omics single cell data acquisition device including:
  • An acquisition unit used to acquire staining images of biological samples and obtain gene expression visualization images of the biological samples
  • a registration unit used to register the staining image and the gene expression visualization image to obtain a registered image
  • the first segmentation unit is used to perform cell segmentation on the registered image to obtain a cell mask
  • a correction unit configured to determine, based on the cell mask map, the cells to which the background gene molecules of unknown cells in the gene expression visualization image belong;
  • the labeling unit is used to label the corresponding cells to obtain a spatial component molecular expression matrix with cell labels.
  • the acquisition unit is also used for:
  • a spliced stained image of the biological sample composed of multiple sub-stained images is obtained through a microscope;
  • Multiple sub-staining images of the biological sample are acquired through the microscope, and the multiple sub-staining images are spliced to obtain a spliced staining image.
  • the acquisition unit includes:
  • a first acquisition module configured to acquire multiple sub-staining images of the biological sample through a microscope; perform a first splicing of the multiple sub-staining images of the biological sample to obtain a first staining image;
  • a judgment module configured to judge whether to perform a second splicing of multiple sub-stained images of the biological sample based on the image quality of the first stained image
  • a determination module configured to determine the first stained image as the stained image if not
  • the second acquisition module is configured to, if so, perform a second splicing of multiple sub-staining images of the biological sample to obtain the staining image.
  • the first acquisition module is also used for:
  • the portions of the multiple sub-staining images and the template image that are determined to be overlapping areas are respectively cropped into a plurality of staining image overlapping sub-images and a plurality of template image overlapping sub-images of the same number, so as to be paired into multiple overlapping sub-images. right;
  • Each of the sub-stained images is translated toward the direction of the template image by the offset amount, and spliced together with the template image.
  • the first acquisition module is also used for:
  • the offset between the coordinates, and the coordinates of the second reference image are adjusted based on the offset to splice and generate the spliced stained image.
  • the registration unit includes:
  • An acquisition module configured to acquire a trajectory line in the staining image, and rotate the staining image based on the angle between the trajectory line and the horizontal direction; wherein the staining image and the gene expression visualization image include multiple trajectory lines And/or a plurality of trajectory points, the trajectory points are formed by the intersection of two of the trajectory lines, and each of the multiple trajectory lines has a corresponding index number;
  • a processing module configured to enlarge or reduce the staining image to obtain a third reference image, where the third reference image has the same proportion as the gene expression visualization image;
  • a first determination module configured to determine a target offset based on the gene expression visualization image and the third reference image
  • a registration module configured to move the third reference image based on the target offset to obtain the registered image.
  • the registration unit also includes:
  • a second determination module configured to determine the similarity between the third reference image and the gene expression visualization image after the processing module enlarges or reduces the staining image to obtain a third reference image
  • the coarse registration module is used to use the position corresponding to the maximum similarity value as the coarse registration result.
  • the registration unit is also used for:
  • the staining image and the gene expression visualization image each include multiple trajectory lines and multiple trajectory points.
  • the trajectory points are formed by the intersection of two of the trajectory lines.
  • Each The trajectory line has a corresponding index number;
  • a target image is processed based on the offset information to obtain a registered image, where the target image is an image in a candidate image set corresponding to the track point pair.
  • the device also includes:
  • the second segmentation unit is configured to perform tissue segmentation on the registered image to obtain a tissue mask map before the first segmentation unit performs cell segmentation on the registered image to obtain a cell mask map.
  • the second dividing unit is also used for:
  • the gene expression matrix arranges the gene expression levels according to pixel positions;
  • the image data is determined by assigning the gene expression amount at each pixel position in the gene expression matrix to the corresponding pixel position in the registered image;
  • the tissue mask map is obtained by marking the connected areas of the image data according to the foreground pixel points.
  • the device also includes:
  • a calculation unit configured to perform tissue segmentation on the registered image in the second segmentation unit, and after obtaining the tissue mask map, respectively calculate the outer contour image and the inner contour of the grayscale image corresponding to the tissue mask map. image;
  • a pairing unit configured to divide the outer contour image and the inner contour image into N segments respectively, and pair the outer contour image of each segment with the inner contour image of each segment in pairs to obtain N image combinations, Each of the image combinations includes an outer contour image and an inner contour image;
  • the calculation unit is also used to separately calculate the pixel density ratio of an outer contour image and an inner contour image in each of the image combinations to obtain N pixel density ratios, and the pixel density ratio is for each of the image combinations.
  • the calculation unit is also configured to calculate and describe the grayscale image quality corresponding to the tissue mask image according to the pixel density ratio.
  • the first dividing unit is also used for:
  • the pixel points belonging to cells or cell outlines in the segmentation result are determined as pixel points belonging to cells, and the segmentation result of the registered image is output to obtain the cell mask map.
  • the first dividing unit is also used for:
  • a watershed algorithm based on distance transformation is used to segment the connected domain where cell adhesion exists, and the segmented cell mask map is obtained.
  • the first dividing unit is also used for:
  • the area of the sub-region to be processed included in each marked area is determined based on the cell area.
  • the area of the sub-region to be processed is positively related to the area of the cell.
  • the sub-region to be processed is used to characterize the corresponding said The smallest processing unit of the marked area;
  • grid processing is performed on the corresponding marked area to obtain grid coordinates corresponding to each marked area;
  • Data corresponding to the grid coordinates are extracted from the gene expression visualization image and superimposed on the grid coordinates to obtain the cell processing results of the target object.
  • correction unit is also used for:
  • each gene expression feature of the gene expression visualization image is determined as a cell gene expression feature located within the cell and a background gene expression feature located outside the cell;
  • a probability distribution model is fitted based on the spatial position and the signal value of the gene expression characteristics
  • the correction result is output according to the probability value to correct the background gene expression characteristics.
  • correction unit is also used to include:
  • the gene expression visualization image determine the initial gene molecules belonging to the target cell and the background gene molecules of the unknown cell
  • correction unit is also used to include:
  • the cell to which the background gene molecule belongs is determined based on the gene molecule density and the background gene molecule density.
  • correction unit is also used to include:
  • the spatial coordinates and the gene expression characteristic signal values are input into a probability distribution model to obtain the probability score that the background gene molecule belongs to the target cell; the probability distribution model is based on the probability score of the gene molecule sample belonging to the target cell.
  • the spatial coordinates and gene expression characteristic signal values are fitted;
  • the cell to which the background gene molecule belongs is determined based on the probability score.
  • the marking unit is also used for:
  • the cells are stained with ssDNA staining solution and cell boundary fluorescent staining solution, wherein the ssDNA staining solution includes buffer and ssDNA reagent, and the cell boundary fluorescent staining solution includes fluorescent dye.
  • the device also includes a detection unit, including:
  • the directed target detection network includes:
  • the backbone Backbone layer is configured to perform feature extraction on the staining image or gene expression visualization image to be tested to obtain multiple feature maps at different scales;
  • the Neck layer is configured to receive the multiple feature maps from the Backbone layer and perform cross-scale fusion on the multiple feature maps to obtain multiple fused feature maps;
  • the detection head Head layer is configured to predict the plurality of fused images to obtain target detection results regarding the staining image or gene expression visualization image to be tested,
  • the target detection results include: classification information, target frame coordinate prediction information, target prediction information and angle prediction information.
  • the stained image plane in which the stained image is located includes a first direction and a second direction perpendicular to the first direction, and the stained image includes a plurality of first straight tracks transverse to the second direction. and a plurality of second straight trajectory lines transverse to said first direction,
  • the method for determining point coordinates in the stained image includes:
  • the pixels in the sampling area of the stained image selected by the first sampling strip during the equal-spaced sampling period in the first direction are accumulated and summed according to the first direction to obtain a series of first pixel values.
  • the first candidate point set is formed by the first candidate points obtained by sampling at equal intervals in each first direction;
  • the pixels in the sampling area of the stained image selected by the second sampling strip during the second direction equally spaced sampling period are accumulated and summed in the second direction to obtain a series of second pixel values.
  • the second candidate point set is formed by the second candidate points obtained by equally spaced sampling in each second direction;
  • Grouping steps include:
  • Line fitting steps include:
  • Coordinate calculation steps include:
  • the device further includes: an analysis unit, the analysis unit is used for:
  • Gene expression information of cells of the biological sample is obtained based on the registration image of the first image and the gene expression amount information according to the cell boundary.
  • an electronic device including:
  • the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can perform the method described in the first aspect.
  • a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the method described in the first aspect.
  • a computer program product including a computer program that, when executed by a processor, implements the method described in the first aspect.
  • the spatial omics single cell data acquisition method, device, electronic equipment and storage medium acquire staining images of biological samples, acquire gene expression visualization images of the biological samples; visualize the staining images and the gene expression
  • the images are registered to obtain a registered image; the registered image is subjected to cell segmentation to obtain a cell mask map; the background of the unknown cells in the gene expression visualization image is determined based on the cell mask map
  • the cells to which the gene molecules belong are identified, and the corresponding cells are marked to obtain a spatial component expression matrix with cell markers.
  • the embodiments of the present application obtain high-precision spatial single-cell data through the processing flow of gene expression matrix diagram, splicing, registration, segmentation and correction.
  • Figure 1 is a schematic flow chart of a spatial omics single cell data acquisition method provided by an embodiment of the present application
  • Figure 2 is a schematic diagram of obtaining single cell data for spatial omics provided by an embodiment of the present application
  • Figure 3 is a schematic flow chart of a method for obtaining stained images of biological samples provided by an embodiment of the present application
  • Figure 4 is a schematic flow chart of a method for splicing multiple sub-stained images provided by an embodiment of the present application
  • Figure 5 is a schematic flow chart of another method for splicing multiple sub-stained images provided by an embodiment of the present application.
  • Figure 6 is a schematic diagram of the spatial distribution of multiple fields of view provided by an embodiment of the present application.
  • Figure 7 is a schematic diagram of the pre-stitching results of an image splicing method provided by an embodiment of the present application.
  • Figure 8a is a schematic diagram of the positional relationship between two row-wise adjacent dyed images scanned in the horizontal direction during pre-stitching provided by an embodiment of the present application;
  • Figure 8b is a schematic diagram of the positional relationship between two adjacent stained images scanned in the vertical direction during pre-stitching according to an embodiment of the present application
  • Figure 9 is a schematic diagram of a single field of view template for splicing biological samples provided by an embodiment of the present application.
  • Figure 10 is a schematic diagram of the construction process of a single field of view template for splicing biological samples provided by an embodiment of the present application;
  • Figure 11 is a schematic flow chart of a method for registering staining images and gene expression visualization images provided by embodiments of the present application;
  • Figure 12 is a schematic diagram of a dyeing image provided by an embodiment of the present application.
  • Figure 13 is a schematic diagram of a third reference image provided by an embodiment of the present application.
  • Figure 14a is a third reference image with multiple periods provided by the embodiment of the present application.
  • Figure 14b is a multiple-cycle gene expression visualization image provided by the embodiment of the present application.
  • Figure 15 is a schematic diagram of a preset period determined with the first offset as the center provided by an embodiment of the present application.
  • Figure 16 is a schematic flow chart of another method for registering staining images and gene expression visualization images provided by embodiments of the present application.
  • Figure 17a is a schematic diagram of a candidate image provided by an embodiment of the present application.
  • Figure 17b is a schematic diagram of an initial binary image provided by the embodiment of the present application.
  • Figure 17c is a schematic diagram of a target binary image provided by the embodiment of the present application.
  • Figure 18 is a schematic flow chart of another method for registering staining images and gene expression visualization images provided by embodiments of the present application.
  • Figure 19 is a flow chart for determining image data of a tissue segmentation method for sample images provided by an embodiment of the present application.
  • Figure 20 is a schematic diagram of image data of a tissue segmentation method for sample images provided by an embodiment of the present application.
  • Figure 21 is a 2D convolution schematic diagram of a tissue segmentation method for sample images provided by an embodiment of the present application.
  • Figure 22 is a schematic diagram of low-level features of a tissue segmentation method for sample images provided by an embodiment of the present application.
  • Figure 23 is a schematic flow chart of a method for calculating grayscale image quality corresponding to a tissue mask map provided by an embodiment of the present application
  • Figure 24 is a schematic structural diagram of the relationship between an external contour image and an internal contour image provided by an embodiment of the present application.
  • Figure 25 is a schematic diagram of the relationship between another external contour image and an internal contour image provided by an embodiment of the present application.
  • Figure 26 is a schematic flow chart of a method for cell segmentation on registered images provided by an embodiment of the present application.
  • Figure 27 shows the segmentation effect of an image segmentation model provided by the embodiment of the present application on a mouse brain image
  • Figure 28 is a schematic flow chart of another method for cell segmentation on registered images provided by an embodiment of the present application.
  • Figure 29 shows a schematic flow chart of another cell segmentation processing method provided by an embodiment of the present application.
  • Figure 30 shows an example flow diagram based on the method of this embodiment provided by the embodiment of this application.
  • Figure 31 shows an example of the effect of the gene expression map provided by the embodiment of the present application.
  • Figure 32 shows an example of the effect of a sharpened image obtained through sharpening processing provided by the embodiment of the present application
  • Figure 33 shows a schematic diagram of the effect of the initial mask image provided by the embodiment of the present application.
  • Figure 34 shows a schematic diagram of the effect of the output mask image provided by the embodiment of the present application.
  • Figure 35 is a schematic flow chart of another method for cell segmentation on registered images provided by an embodiment of the present application.
  • Figure 36 is a schematic flowchart of a method for determining the cells to which background gene molecules of unknown cells in a gene expression visualization image belong, provided by an embodiment of the present application;
  • Figure 37 is a schematic diagram of the corresponding relationship between DNB and cell membrane provided by the embodiment of the present application.
  • Figure 38 is a schematic diagram of the correction result of a corrected background DNB provided by the embodiment of the present application.
  • Figure 39 is a schematic flowchart of another method for determining the cells to which background gene molecules of unknown cells in the gene expression visualization image belong, provided by the embodiments of the present application;
  • Figure 40 is a schematic flowchart of another method for determining the cell to which the background gene molecule of the unknown cell belongs in the gene expression visualization image according to the embodiment of the present application;
  • Figure 41 is a schematic diagram of the center point of a target cell provided by an embodiment of the present application.
  • Figure 42 is a schematic flowchart of another method for determining the cells to which background gene molecules of unknown cells in the gene expression visualization image belong, provided by the embodiments of the present application;
  • Figure 43 is a schematic flow chart of a method for determining point coordinates in a stained image provided by an embodiment of the present application.
  • Figure 44 is a schematic diagram of a dyeing image provided by an embodiment of the present application.
  • Figure 45 is a schematic flow chart of a directed target detection method provided by an embodiment of the present application.
  • Figure 46 is a schematic flow chart of a method for obtaining cell gene expression information from biological samples provided by an embodiment of the present application.
  • Figure 47 is a schematic structural diagram of a spatial omics single cell data acquisition device provided by an embodiment of the present application.
  • Figure 48 is a schematic structural diagram of another spatial omics single cell data acquisition device provided by an embodiment of the present application.
  • Figure 49 is a schematic block diagram of an example electronic device provided by an embodiment of the present application.
  • Figure 1 is a schematic flow chart of a spatial omics single cell data acquisition method provided by an embodiment of the present application.
  • the method consists of the following steps:
  • Step 101 Obtain the stained image of the biological sample and obtain the gene expression visualization image of the biological sample;
  • SOP spatial resolved technology
  • staining can be achieved through but not limited to the following technologies, such as: Hematoxylin and Eosin Staining (HE), ssDNA and DAPI. Specifically, this application does not limited.
  • HE Hematoxylin and Eosin Staining
  • ssDNA ssDNA
  • DAPI DAPI
  • the obtained microscope photograph is generally in tif format, including but not limited to 16 bit or 8 bit, and can be either a color image or a grayscale image. Specifically, the embodiments of this application are not limited.
  • the biological samples are spatially sequenced, and the gene expression matrix of the biological samples is obtained through standard processes such as sequencing sequence comparison analysis, and the gene expression matrix is converted into a gene expression visualization image.
  • each site can capture the gene sequence of the biological sample.
  • the number of gene sequences of the site is used as the value of the element in the gene expression matrix, so that the elements of the gene expression matrix correspond to the sites of the spatiotemporal chip (for example, one element corresponds to one site, the first row and the first column of the gene expression matrix The elements correspond to the position in the upper left corner of the space-time chip) and so on to obtain the gene expression matrix, and then draw a gene expression visualization image based on the gene expression matrix.
  • the pixels in the gene expression visualization image correspond to the elements of the gene expression matrix
  • the pixel values of the pixels correspond to the values of the elements. Therefore, the gene expression visualization image contains spatial information of the same biological sample.
  • Obtaining the gene expression visualization image of the biological sample includes but is not limited to the following methods: performing spatial omics sequencing sequence processing on the biological sample to obtain a gene expression matrix; converting the gene expression matrix into a corresponding gene expression visualization image .
  • Step 102 register the staining image and the gene expression visualization image to obtain a registered image
  • registration is achieved based on line features in the stitched stained images
  • accurate automatic registration at pixel level accuracy is achieved through coordinate calculation through track points on the image and using tissue contours as reference objects;
  • registration is achieved by stitching tissue masks of stained images.
  • the embodiments of this application do not limit the registration method.
  • Step 103 Perform cell segmentation on the registered image to obtain a cell mask
  • the registered images are input into the image segmentation model to output a cell mask that contains cell nuclei.
  • tissue segmentation before performing cell segmentation, tissue segmentation can also be performed first. After tissue segmentation, only the tissue region can be focused and no attention is paid to the outside of the tissue, thereby improving the signal-to-noise ratio of the sample data.
  • Step 104 Determine the cells to which the background gene molecules of unknown cells belong in the gene expression visualization image according to the cell mask map, and label the cells to obtain a spatial component molecular expression matrix with cell labels;
  • step 103 After the cell segmentation is completed in step 103, at least the cell nucleus is included, but there are still scenarios where some background gene molecules are not labeled as a cell.
  • the probability threshold is set to mark the cell belonging. When the probability is too low, the belonging cell is not marked. There is no specific limit on the probability threshold.
  • Figure 1 has explained the spatial omics single cell data acquisition method. Please refer to Figure 2.
  • Figure 2 is a schematic diagram of a method for obtaining spatial omics single cell data provided by an embodiment of the present application. This figure takes mouse brain slices as an example. Schematic diagram of the process, where A corresponds to step 101, C corresponds to step 102, D corresponds to step 103, and E corresponds to step 104.
  • Cell segmentation is used to obtain a cell mask map; according to the cell mask map, the cells to which the background gene molecules of unknown cells in the gene expression visualization image belong are determined, and the cells are marked to obtain spatial component expression with cell labels.
  • matrix Compared with related technologies, the embodiments of the present application obtain high-precision spatial single-cell data through the processing flow of gene expression matrix diagram, splicing, registration, segmentation and correction.
  • Method 1 Obtain a stained image of the biological sample through a microscope
  • Method 2 Obtain a spliced stained image of the biological sample composed of multiple sub-stained images through a microscope;
  • Method 3 Acquire multiple sub-staining images of the biological sample through the microscope, and splice the multiple sub-staining images to obtain a spliced staining image.
  • Methods 1 and 2 are the results of splicing under a microscope.
  • Method 1 is to obtain a large image (stained image) directly through the microscope.
  • Method 2 is to use a microscope to acquire multiple small images (sub-stained images).
  • the sub-stained images are spliced to obtain a stained image;
  • the third method is to splice the stained images through a preset algorithm when the results of the microscope splicing do not meet the requirements.
  • the acquisition method of the stained image is not limited.
  • FIG. 3 is a schematic flowchart of a method for obtaining stained images of biological samples provided by embodiments of the present application. include:
  • Step 1011 Obtain multiple sub-stained images of the biological sample through a microscope; perform a first splicing of the multiple sub-stained images of the biological sample to obtain a first stained image.
  • Splicing can be performed in but not limited to the following ways, as shown in Figure 4, including:
  • Step 10111 determine the overlapping areas of multiple sub-stained images and template images respectively;
  • determining the overlapping area of the sub-stained image and the template image may include: determining a matching direction of the sub-stained image and the template image; and selecting adjacent ones in the sub-stained image and the template image in the determined matching direction. Areas of the same size are used as overlapping areas.
  • the matching direction may be determined based on the moving direction of the shooting device when the two images are captured. If the sub-stained image and the template image are two images shot sequentially when the shooting device moves horizontally, the matching direction between the two images can be determined as the horizontal direction.
  • other available methods can also be used to determine the relative positional relationship between the two images and thereby determine the matching direction, which will not be described again here.
  • the overlapping area is selected such that the ratio of the actual overlapping portions in the sub-stained image and the template image in the overlapping area is greater than a predetermined threshold.
  • the predetermined threshold is determined to be 10%, or 30%, etc. Note that this value is used as an example only. In some other examples, the predetermined threshold may also take other larger or smaller values.
  • Step 10112 Cut the portions of the multiple sub-staining images and the template image that are determined to be overlapping areas into multiple staining image overlapping sub-images and multiple template image overlapping sub-images of the same number, respectively, to pair them into multiple overlapping sub-images. Overlapping subgraph pairs;
  • this operation may include: performing noise reduction and/or windowing on the portions of the sub-stained image and the template image that are determined to be overlapping areas respectively; in a direction perpendicular to the matching direction, denoising and/or windowing are performed.
  • the noise reduction processing in the above operation can be performed by, for example, Gaussian filtering, but other noise reduction methods used in the field of image processing can also be used for this processing.
  • Windowing can be used to obtain images that suppress spectral leakage.
  • the windows used include but are not limited to Hanning windows, Hamming windows, etc.
  • a sliding window approach may be used to perform the above resampling.
  • the sliding window method can set a certain overlapping area. Multiple stacked small sub-images correspond to ensure that the cropping areas of the source image and the template image are in the overlapping area and in the same coordinate system. Resampling can be achieved using any available method, such as using target detection methods to crop areas with more features, and is not limited to the above-mentioned sliding window method.
  • the method shown in FIG. 1 may also optionally include removing overlapping sub-image pairs with features less than a specific standard and/or noise greater than a specific standard from the multiple overlapping sub-image pairs.
  • gradient detection can be used to filter subgraph pairs with fewer features and/or more noise.
  • the gradient detection methods used include but are not limited to Sobel, Canny and other methods.
  • any other method that can be used to detect the number of features and/or noise in the image can be used here, and is not limited to gradient detection methods.
  • Step 10113 Obtain the offset between each sub-stained image and the template image by performing frequency domain calculation on the multiple overlapping sub-image pairs;
  • the overlapping sub-image pairs for superposition resonance in the frequency domain are the overlapping sub-image pairs obtained after removing the sub-image pairs with fewer features and/or more noise in the above optional step.
  • this step can be performed using the Dirac function. For example, it includes: stacking the cross-power spectrum of the multiple overlapping sub-graph pairs, and using the Dirac function to obtain the offset from the stacked cross-power spectrum.
  • each overlapping sub-image in the plurality of overlapping sub-image pairs may be transformed from a position coordinate system to a frequency domain. This transformation can be accomplished, for example, by discrete Fourier transform of the two-dimensional image, or by any other means that can achieve domain transformation, which will not be described again here.
  • the mutual power spectrum corresponding to each overlapping sub-image pair in the multiple overlapping sub-image pairs can be calculated; perform an inverse discrete Fourier transform on the mutual power spectrum corresponding to each obtained overlapping sub-image pair, To obtain a Dirac function representation of the overlapping area; and determine the coordinates where the maximum peak of the obtained Dirac function representation in the overlapping area is located as an offset.
  • the features in the overlapping sub-image pair may also be improved to Make it more visible.
  • the overlapping sub-image pair can be transformed into a position coordinate system, and the overlapping sub-image transformed into the position coordinate system can be windowed to enhance features in the overlapping sub-image.
  • the window function used here can be a Hanning window or a Hamming window, or any other function that can enhance features in the image. Enhancing features in overlapping sub-images can effectively improve the success rate of image registration for images with unobvious features.
  • the method used to enhance image features may not be limited to windowing processing, but may also be any other method capable of enhancing image features.
  • performing an inverse discrete Fourier transform on the cross-power spectrum corresponding to each obtained overlapping sub-image pair to obtain the Dirac function representation of the overlapping region may include: The overlapping subgraph performs an inverse discrete Fourier transform on the corresponding cross power spectrum to obtain a stacked Dirac function representation; and performs weighted accumulation of the obtained stacked Dirac function representations to obtain a Dirac function representation of the overlapping region .
  • overlapping subgraph pairs with more obvious features can be assigned larger weighting coefficients.
  • the weighting coefficient of each overlapping subgraph pair may depend on the energy spectrum of the overlapping subgraph pair (for example, the energy intensity of the maximum peak of the Dirac function) and/or the matching number of the feature points of the overlapping subgraph pair. /or the image sharpness of the overlapping sub-image pair, or may be based on any other metric that can characterize whether the overlapping sub-image pair has more distinct features.
  • Step 10114 Translate each of the sub-stained images by the offset amount toward the direction of the template image, and splice them together with the template image.
  • Step 1012 Determine whether to perform a second splicing of multiple sub-stained images of the biological sample based on the image quality of the first stained image;
  • the image quality of the first stained image needs to be set according to spatial omics single cell data acquisition requirements, which is not limited by the embodiments of this application.
  • step 1013 If not, perform step 1013; if yes, perform step 1014.
  • Step 1013 determine the first stained image as the stained image
  • Step 1014 Perform a second splicing of multiple sub-stained images of the biological sample to obtain the stained image.
  • Figure 5 is a flow chart of another method for splicing multiple sub-stained images to obtain a spliced stained image provided by an embodiment of the present application, including:
  • Step 10115 Obtain the multiple sub-staining images and template information about the trajectory lines or trajectory points of the biological sample
  • trajectory lines can be converted to each other; trajectory points can be obtained based on two intersecting trajectory lines; trajectory lines can be obtained based on collinear trajectory points.
  • the template information may include index numbers of multiple trajectory lines on the biological sample. As known to those skilled in the art, the distribution pattern of trajectory lines on a biological sample has been specified at the beginning of the design of the biological sample.
  • trajectory lines in the vertical direction of the biological sample there are 10 trajectory lines in the vertical direction of the biological sample, among them
  • the spacing between them can be, for example, 1, 2, 3, 4, 5, 4, 3, 2, 1 respectively.
  • the position of the first trajectory line is taken as the starting point (coordinate is 0)
  • the horizontal axis (x-axis) coordinates of the above 10 trajectory lines are 0, 1, 3, 6, 10, 15, 19, 22 respectively. ,24,25.
  • the index numbers in the template information of the biological sample can be associated with the arrangement of the trajectory lines in the biological sample.
  • the index numbers of the above 10 trajectory lines can be artificially specified as 0, 1, 2, 3, 4, 5, and 6 respectively. ,7,8,0.
  • the acquired template information of the biological sample may also include periodicity.
  • the acquired template information of the biological sample may also include periodicity.
  • the above-mentioned 10 trajectory lines in the vertical direction of the biological sample they may be extended to the left and right by one or more periods respectively.
  • the spacing between the trajectory lines formed by one period of left and right expansion from left to right is 1, 2, 3, 4, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 4, 3, 2, 1.
  • the index number of a biological sample corresponding to a certain trajectory line is unique, and a certain index number on a biological sample will correspond to multiple trajectory lines. This is when designing trajectory lines on biological samples. determined by the periodicity.
  • a microscope can take an image of a biological sample, for example, by scanning the biological sample line by line or column by column.
  • the spatial distribution of multiple images after scanning can be shown in Figure 6.
  • the multiple images can share, for example, n+1 columns and m+1 rows, including images from the first row to the first column (r0, c0)
  • the image (rm,cn) to the last row and last column.
  • the image can have up to 8 adjacent images.
  • the microscope when it takes an image, it can also record the camera position information at the time of shooting. Subsequently, based on the camera position information recorded at the time of shooting for any image, the corresponding position of the image can be determined and its adjacent images can be determined for the image.
  • Figure 7 is a schematic diagram of the pre-stitching results of the image stitching method according to one embodiment of the present invention.
  • Step 10116 Pre-stitch the multiple sub-stained images to obtain the pre-stitched coordinates of the multiple sub-stained images
  • the left neighbor and right neighbor images of the current stained image can be determined using, for example, 2-nearest neighbor methods based on the scanning order or the camera position information when the image is captured, and then the stained image and the left and right neighbors can be determined. Offset and overlap between images.
  • FFT fast Fourier transform
  • SIFT scale-invariant feature transform
  • the pre-stitching coordinates of the multiple stained images can be obtained.
  • Figure 8a is a schematic diagram of the positional relationship between two adjacent stained images scanned in the horizontal direction during pre-stitching
  • Figure 8b is a schematic diagram of the positional relationship between two adjacent stained images scanned in the vertical direction during pre-stitching. Schematic diagram of the positional relationship between stained images.
  • Figures 8a and 8b respectively show the amount of deviation and overlap between adjacent stained images obtained after scanning the stained images in the horizontal direction and the vertical direction.
  • the distance between the two adjacent images obtained in the row direction that overlaps in the horizontal direction is called the overlap in the horizontal direction (overlap), and the distance that deviates in the vertical direction is called It is called the deviation in the vertical direction (offset).
  • the distance in which two adjacent dyed images in the column direction overlap in the vertical direction is called the overlap in the vertical direction.
  • the distance of deviation in the horizontal direction is called the offset in the horizontal direction.
  • the deviation amount matrix A and the overlap amount matrix B of the plurality of stained images in the corresponding directions can be obtained.
  • the spatial coordinates of each stained image can be mapped, thereby completing a pre-stitched image of multiple stained images as shown in Figure 7.
  • Step 10117 Select at least one first reference image from the plurality of sub-stained images according to the characteristics of the trajectory line or trajectory point, and derive a global template based on the template information of the biological sample and the pre-stitching coordinates of the first reference image; as well as
  • the selected first reference image may be the image with the most obvious trajectory line features or the image with the most trajectory points among the plurality of stained images.
  • the first reference image is, for example, the highlighted image (rm-1, cn-1) in Figures 6 and 7, and then the trajectory line detection is performed on the selected image (rm-1, cn-1), And match the distance between the detected adjacent trajectory lines with the distance between the trajectory lines specified during the chip design mentioned above, and then determine the distance corresponding to the trajectory line in the selected first reference image.
  • the index number That is to say, the index number corresponding to each trajectory line in the first reference image can be determined according to the distance between adjacent trajectory lines in the first reference image.
  • a global template may be derived based on the index number of the first reference image and the pre-stitching coordinates of the first reference image.
  • the tissue slices on the biological sample will cover the trajectory line, and some trajectory points may be revealed at the location of the tissue cavity, the probability of complete trajectory points appearing in an image is compared to that of the complete trajectory line. will be higher, so it is also preferable to select the image with the most trajectory points as the first reference image.
  • the index number corresponding to each trajectory line in the first reference image is determined based on the distance between adjacent trajectory lines in the first reference image, and based on the The index number and the pre-stitching coordinates of the first reference image are used to derive a global template.
  • FIG. 9 is a schematic diagram showing a global template for splicing biological samples according to one embodiment of the present invention
  • FIG. 10 is a schematic diagram of the construction process of the global template for splicing biological samples according to one embodiment of the present invention.
  • the global template (or global reference system) based on the first reference image (rm-1, cn-1) is obtained by performing left and right bidirectional periodic expansion in the vertical direction and up and down bidirectional periodic expansion in the vertical direction.
  • the adjustment of the coordinates of the second reference image other than the selected first reference image (rm-1, cn-1) can be divided into two categories, namely, coordinate adjustment of the second reference image containing the trajectory point and Coordinate adjustment is performed for the second reference image that does not contain trajectory points.
  • the coordinate adjustment for the second reference image containing the trajectory point is performed by adding the pre-stitching coordinates of each second reference image containing the trajectory point to the respective unique offset of the second reference image containing the trajectory point.
  • the offset of the second reference image is a vector formed by a trajectory point on the second reference image pointing to a template point in the global template corresponding to the trajectory point on the second reference image. Referring to Figure 9, the offset is shown by an arrow in the partially enlarged schematic diagram. The offset represents the template line trajectory corresponding to the trajectory point on the global template derived from the trajectory point point on the biological sample. Vector of points.
  • Step 10118 For the second reference image other than the first reference image among the plurality of sub-stained images, calculate the pre-stitching coordinates of the second reference image and the second reference image in the global template. The offset between the corresponding template coordinates, and coordinate adjustment is performed on the second reference image based on the offset to generate the spliced stained image.
  • the value of the second reference image containing the trajectory point can be obtained. adjusted coordinates.
  • the neighbor adjustment method includes: for each second reference image that does not contain trajectory points, adjust the coordinates of the second reference image that does not contain trajectory points according to the distance to the second reference image that does not contain trajectory points.
  • the unique offset of the nearest second reference image that contains trajectory points and the deviation and overlap between the second reference image that does not contain trajectory points and the nearest second reference image that contains trajectory points for The coordinate adjustment is performed on the second reference image that does not contain trajectory points.
  • a second reference image that does not contain trajectory points can be used.
  • the second reference image not containing the trajectory point is aligned with the offset and overlap between the adjacent or closest adjusted second reference image containing the trajectory point.
  • the measure of the nearest distance is Manhattan distance, not Euclidean distance.
  • the coordinate adjustment of the second reference image also includes performing seam fusion processing between adjacent second reference images.
  • a linear weighted fusion method can be used.
  • Figure 11 is a schematic flow chart of a method for registering staining images and gene expression visualization images provided by embodiments of the present application, including:
  • Step 1021 obtain the trajectory line in the staining image, and rotate the staining image based on the angle between the trajectory line and the horizontal direction; wherein the staining image and the gene expression visualization image include multiple trajectory lines and/or Or multiple trajectory points, the trajectory points are formed by the intersection of two of the trajectory lines, and each of the multiple trajectory lines has a corresponding index number;
  • the trajectory lines in the microscope image are not necessarily in the horizontal and vertical directions. Therefore, the first trajectory line in the microscope image can be selected as the benchmark to calculate the relationship between the first trajectory line and the horizontal direction.
  • the included angle of the microscope image is rotated through the above included angle and positioned in the horizontal direction.
  • Figure 12 a schematic diagram of a stained image is shown. It can be seen from Figure 12 that the stained image is not located in the horizontal direction, and there is an angle between the first trajectory line and the horizontal direction. Therefore, the stained image can be rotated to the horizontal direction after calculating the angle.
  • the gene expression visualization image is generated by the gene expression matrix, which appears as many discrete points, it has a weak ability to express aggregated features or edge features of biological samples.
  • tissue segmentation can be performed on the gene expression visualization image to obtain the biological sample outline displayed by gene expression, and convolution enhancement processing is performed on the approximate area where the sample outline is located to enhance the edge features of the gene expression visualization image. , to facilitate subsequent registration of microscope images and gene expression visualization images.
  • Step 1022 enlarge or reduce the staining image to obtain a third reference image, where the third reference image has the same proportion as the gene expression visualization image;
  • the gene expression visualization image can be used as a reference image, there may be a difference in the scaling ratio between the staining image taken by the microscope and the gene expression visualization image.
  • the scaling ratio of the staining image can be determined based on the distance between the staining image and the trajectory line corresponding to the index number in the gene expression visualization image. Specifically, the second trajectory line in the staining image is obtained, and the first distance is determined based on the first trajectory line and the second trajectory line of the staining image; the third trajectory line and the fourth trajectory line in the gene expression visualization image are obtained, wherein, The index number of the third trajectory line is the same as the index number of the first trajectory line, the index number of the fourth trajectory line is the same as the index number of the second trajectory line, and the second distance is determined based on the third trajectory line and the fourth trajectory line.
  • the scaling ratio value between the staining image and the gene expression visualization image is determined based on the first spacing and the second spacing, and the staining image is enlarged or reduced according to the above scaling value to obtain a third reference image with the same ratio as the gene expression visualization image.
  • the first trajectory line and the second trajectory line are parallel; the third trajectory line and the fourth trajectory line are parallel.
  • the first distance When the first distance is determined based on the first trajectory line and the second trajectory line, it can be calculated using the trajectory points on the first trajectory line and the trajectory points on the second trajectory line.
  • the two trajectory points When coordinates are used, the difference between the corresponding ordinates or the abscissas can be used as the first spacing.
  • the second spacing between the third trajectory line and the fourth trajectory line can be determined based on the same principle. It should be noted that the method for calculating the scaling ratio of the staining image and the gene expression visualization image provided in the above embodiments is only an exemplary description and is not limited to the above implementation.
  • Step 1023 determine the target offset based on the gene expression visualization image and the third reference image
  • the target offset can be determined based on the gene expression visualization image and the third reference image. It can be seen from the above embodiment that after the original staining image is rotated to the horizontal direction, there may be a 90-degree angle difference between the staining image and the gene expression visualization image. In order to further improve the accuracy of image processing, the staining image is scaled to be consistent with the gene expression. After expressing the third reference image with the same proportion of the visual image, the third reference image can be rotated according to a preset rotation angle, and the corresponding target offset is determined at each rotation angle. The following will be explained with a specific application scenario.
  • S represents the third reference image
  • V represents the gene expression visualization image
  • the black point represents the center of gravity of the third reference image
  • the gray point represents the center of gravity of the gene expression visualization image.
  • the four areas in Figure 13 represent respectively The original third reference image and the image after rotating the third reference image clockwise by 90 degrees, 180 degrees, and 270 degrees. After the third reference image is rotated, it can be aligned according to the origin coordinates of the third reference image and the origin coordinates of the gene expression visualization image, and then the target offset is determined based on the origin-aligned third reference image and the gene expression visualization image. .
  • this embodiment provides an optimal implementation method, that is, first, the third reference image can be converted into the third reference image according to the center of gravity coordinates of the third reference image and the gene expression visualization image.
  • the image is initially positioned to roughly the same position as the gene expression visualization image, and then the target offset is calculated based on the moved third reference image for precise positioning.
  • the staining image is enlarged or reduced to obtain a fifth reference image, where the fifth reference image has the same proportion as the gene expression visualization image.
  • a density centroid algorithm based on pixel gray values can be used, which is not limited in this embodiment.
  • the processing process can be implemented on the temporary image of the copied stained image, that is, the stained image is not moved and registered. After the calculation is completed and the final target offset is obtained, Move the stained image in one go and register it with the gene expression visualization image.
  • the target offset can be determined based on the fourth reference image and the gene expression visualization image.
  • the trajectory line on the space-time chip may have multiple periods, so the microscope image and gene expression visualization image obtained based on the space-time chip may also have multiple periods, that is, the fourth reference image and the gene expression visualization image have multiple cycles.
  • the number of trajectory lines and trajectory points in each sub-image is the same, and the index numbers of the trajectory lines between the sub-images correspond one to one.
  • Figure 14a and 14b Figure 14a shows a third reference image with multiple cycles
  • Figure 14b shows a gene expression visualization image with multiple cycles.
  • FIG 14a only the sub-images of the first period and the second period are shown. It can be seen that the sub-images of each period have the same number of index lines and index points, and each index line corresponds to an index number.
  • the sub-images corresponding to the first period and the second period are also shown in Figure 14b.
  • the schematic diagram of the third reference image and the gene expression visualization image provided in the above embodiment is only a possible implementation manner, and does not impose any limitation on the specific form of the image. Therefore, when determining the target offset based on the fourth reference image and the gene expression visualization image, the influence of the period needs to be considered.
  • the first offset may be determined based on the fourth reference image and the gene expression visualization image, where the first offset is the undetermined offset between the fourth reference image and the gene expression visualization image, and then the first offset may be determined based on the fourth reference image and the gene expression visualization image.
  • An offset is the center, and a plurality of second offsets corresponding to the first offset within the preset period are determined, that is, each period within the preset period corresponds to a second offset. For any second offset, move the fourth reference image based on the second offset to obtain a sixth reference image, and then calculate the first similarity between the sixth reference image and the gene expression visualization image, thereby obtaining The first similarity corresponding to each period within the preset period.
  • the above determined similarity is obtained at any rotation angle, it is necessary to re-execute the above steps at other preset rotation angles to obtain multiple first similarities corresponding to each rotation angle.
  • a first maximum similarity is determined, and a sixth reference image corresponding to the first maximum similarity is determined as a third reference image. Then the second offset corresponding to the third reference image can be determined as the target offset.
  • one possible implementation is to first obtain multiple sets of trajectory points, where each set of trajectory points includes a first trajectory point and a second set of trajectory points.
  • the first trajectory point is located in the fourth reference image
  • the second trajectory point is located in the gene expression visualization image
  • the first trajectory point and the second trajectory point have the same index identifier. Since a trajectory point is formed by two intersecting trajectory lines, and each trajectory line has an index number, the index identification of the trajectory point can be composed of the index numbers of the two intersecting trajectory lines of the trajectory point.
  • the fourth offset may be determined based on the coordinates of the first track point and the coordinates of the second track point, and then the first offset may be determined based on a plurality of fourth offsets. Shift amount.
  • the first trajectory point and the second trajectory point obtained with the same index identification may not belong to the corresponding cycle, so the determined There may be multiple second trajectory points.
  • any first trajectory point in the fourth reference image can be first selected, and the index of the first trajectory point with the same A plurality of second trajectory points identified.
  • the Euclidean distance between the first trajectory point and each second trajectory point can be calculated separately. After calculating multiple Euclidean distances, obtain the Euclidean distance corresponding to the minimum Euclidean distance.
  • the second trajectory point is the second trajectory point corresponding to the first trajectory point.
  • the fourth offset is determined based on the coordinate difference between the second trajectory point corresponding to the minimum Euclidean distance and the first trajectory point. Since there are multiple trajectory points in the fourth reference image, that is, corresponding to multiple groups of trajectory point sets, it is necessary to traverse all the trajectory point sets, and determine the corresponding trajectory point set for each group according to the above method of determining the basic offset.
  • the fourth offset of may be first excluded, and then the target offset is determined based on the remaining fourth offsets.
  • the median of multiple fourth offsets can be selected as the target offset, or the average of all fourth offsets can be calculated as the target offset to maximize the accuracy of determining the offset. sex. It should be noted that this embodiment does not limit the specific manner of determining the target offset based on the fourth offset.
  • Figure 15 is a schematic diagram of a preset period determined with the first offset as the center.
  • the gene expression visualization image is used as the benchmark.
  • the middle gray area represents the period in which the second trajectory point is located.
  • the fourth reference image can be moved according to the second offset corresponding to any period to obtain a sixth reference image, and the similarity between the sixth reference image and the gene expression visualization image can be calculated.
  • this embodiment provides a possible implementation method, that is, perform frequency domain transformation on the sixth reference image to obtain the first frequency domain image, and perform frequency domain transformation on the gene expression visualization image to obtain the second frequency domain image.
  • the Hamming distance between the first frequency domain image and the second frequency domain image is calculated as the similarity. When the Hamming distance is smaller, it indicates that the similarity between the first frequency domain image and the second frequency domain image is greater. After determining the Hamming distances corresponding to all preset rotation angles and all preset periods, the minimum Hamming distance is used as the first maximum similarity.
  • the discrete cosine transform can be used to obtain the frequency domain image, that is, the discrete cosine transform is performed on the moved third reference image to obtain the first frequency domain image, and the discrete cosine transform is performed on the gene expression visualization image to obtain the second frequency domain image, and then from The low-frequency frequency domain image is intercepted from the first frequency domain image. Based on the low-frequency frequency domain image, the pixel mean of the low-frequency frequency domain image is calculated. In the low-frequency frequency domain image, the pixel value of the pixel point with a pixel value higher than the pixel mean is set to 1.
  • the fourth reference image can be initially moved and positioned according to the offset of the center of gravity of the gene expression visualization image.
  • the fourth reference image is not initially positioned.
  • the fourth reference image is moved according to each period within the preset period to obtain a seventh reference image corresponding to each period.
  • the third barycenter coordinate of the fourth reference image can be calculated first, and the fourth reference image can be moved according to each period within the preset period with the period where the third barycenter coordinate is located as the center to obtain the seventh reference image.
  • the second similarity between the seventh reference image and the gene expression visualization image is calculated, thereby obtaining the second similarity corresponding to each period within the preset period.
  • the seventh reference image corresponding to the second maximum similarity is used as the third reference image, and then the target offset is determined based on the third reference image and the gene expression visualization image.
  • a plurality of third offsets may be determined based on the gene expression visualization image and the third reference image, and the target offset may be determined based on the plurality of third offsets.
  • the calculation principle of the third offset is the same as the calculation principle of the fourth offset in the above embodiment. That is, multiple sets of trajectory point sets are obtained, where each set of trajectory point sets includes a third trajectory point and a fourth trajectory point, the third trajectory point is located in the third reference image, the fourth trajectory point is located in the gene expression visualization image, and the third trajectory point is located in the gene expression visualization image.
  • the track point has the same index identifier as the fourth track point.
  • a third offset is determined based on the coordinates of the third trajectory point and the coordinates of the fourth trajectory point.
  • the third offsets that exceed the preset range can be first excluded, and then selected from a plurality of third offsets that meet the preset range.
  • the median is used as the target offset, or the average of multiple third offsets is calculated as the target offset to maximize the accuracy of determining the offset.
  • Step 1024 Move the third reference image based on the target offset to obtain the registered image.
  • a preset rotation angle corresponding to the target offset is determined, and the third reference image is moved based on the preset rotation angle and the target offset.
  • the image movement in the intermediate process is a process implemented on the temporary image of the copied stained image, that is, the stained image is not moved and registered. After the calculation is completed and the final target offset is obtained, Then move the stained image all at once and register it with the gene expression visualization image.
  • the dyeing image and the gene expression visualization image can be registered based on the image coordinates with pixel-level accuracy, thereby improving the accuracy of image processing and facilitating subsequent use of the registered images for research and development. analyze.
  • the third reference image and the gene expression visualization image have multiple periods, since the offset corresponding to the preset period is derived from the calculated offset using the theoretical period width, errors may exist in the actual image.
  • the third reference image and the gene expression visualization image can be reused to determine the corrected offset as the final offset, and the third reference image can be continued to be moved based on the determined final offset to combine the third reference image with the gene expression visualization image.
  • Expression visualization images are registered to improve the accuracy of registration.
  • each set of trajectory point sets includes a fifth trajectory point and a sixth trajectory point
  • the fifth trajectory point is located in the third reference image.
  • Image the sixth trajectory point is located in the gene expression visualization image
  • the fifth trajectory point has the same index identifier as the sixth trajectory point.
  • a fifth offset is determined based on the coordinates of the fifth trajectory point and the coordinates of the sixth trajectory point.
  • the final offset is determined based on the plurality of fifth offsets.
  • the implementation of determining the fifth offset and determining the final offset based on multiple fifth offsets may refer to the above embodiments and will not be described again here.
  • the step of enlarging or reducing the staining image to obtain a third reference image it further includes: determining the similarity between the third reference image and the gene expression visualization image; The position corresponding to the maximum similarity value is used as the rough registration result. This similarity is used as coarse registration, and the method shown in Figure 11 is used as fine registration.
  • Figure 16 is a schematic flow chart of a method for registering staining images and gene expression visualization images provided by embodiments of the present application, including:
  • Step 1025 preprocess the stained image to obtain a candidate image set
  • the staining image Before registering the staining image with the gene expression visualization image, since the staining image is an image actually taken by a microscope, it is affected by external factors and other factors, and there are certain differences from the gene expression visualization image. For example, the staining image is not in a horizontal position, so In order to facilitate subsequent image registration, the stained images can be preprocessed first.
  • the first trajectory line and the second trajectory line of the dyeing image are obtained, and the first trajectory line and the second trajectory line may be randomly determined trajectory lines.
  • the stained image is then rotated based on the angle between the first trajectory line and the horizontal direction, that is, the stained image is rotated to a horizontal position. and determine a first spacing between the two trajectory lines based on the first trajectory line and the second trajectory line.
  • the rotated stained image is adjusted based on the ratio of the first spacing and the second spacing, and the candidate image is obtained. That is, there may be a scaling difference in the distance between the trace lines of the staining image and the gene expression visualization image.
  • the staining image can be scaled to the same scale as the gene expression visualization image.
  • the candidate image After obtaining the candidate image, since the candidate image is in a horizontal position at this time, but may be 90° different from the gene expression visualization image, multiple rotation angles can be determined, and the candidate image can be rotated based on each rotation angle, thus The rotated images corresponding to each rotation angle are composed into a candidate image set.
  • the plurality of rotation angles may be 90°, 180°, and 270°. After rotation, any image in the candidate image set still has the same index number as the stained image.
  • Step 1026 determine the binary image set corresponding to the candidate image set
  • Binary image is image binarization, which is to set the gray value of each pixel on the image to 0 or 255, so that the entire image presents an obvious black and white effect, which facilitates subsequent image registration.
  • the binary image set may be determined in the following manner: segment any fourth image in the candidate image set based on the tissue contour of the fourth image to obtain a tissue segmentation image.
  • tissue segmentation when tissue segmentation is performed, it can be achieved based on the tissue segmentation algorithm, or it can be obtained by manually encircling the tissue outline using a tissue segmentation tool. Then the tissue segmentation image is binarized to obtain the initial binary image.
  • the target binary map For any boundary among the multiple boundaries of the initial binary map, determine the boundary point closest to the boundary in the tissue outline, and determine the boundary trajectory line closest to the boundary point among the trajectory lines parallel to the boundary, and ensure the boundary trajectory The line does not pass through the tissue contour, thereby determining the target binary map based on the boundary trajectory line corresponding to each boundary.
  • the target binary images corresponding to the plurality of fourth images in the candidate image set form a binary image set. That is, the target binary map is a minimum binary map including the entire biological tissue, and the boundary of the target binary map is composed of trajectory lines.
  • FIG 17a is a schematic diagram of a fourth image provided by an embodiment of the present application
  • a tissue segmentation image is obtained, and then the tissue segmentation image is binarized to obtain
  • the initial binary map of is shown in Figure 17b.
  • the minimum binary map including all tissues is determined based on the initial binary map, that is, the target binary map is shown in Figure 17c.
  • Step 1027 Based on the similarity between the binary map set and the gene expression visualization image, determine the trajectory point pairs that have a corresponding relationship between the binary map set and the gene expression visualization image;
  • the gene expression visualization image may have multiple periods, and the gene expression visualization image in each period is the same. That is, the index number of the gene expression visualization image may have multiple periods. Based on this, when determining the trajectory point pair, for any binary graph in the binary graph set, based on the coordinates corresponding to the vertices of the binary graph and the coordinates corresponding to the trajectory points of the gene expression visualization image, in the gene expression Multiple regions corresponding to the binary image are determined in the visual image. The multiple determined areas correspond to multiple periods one-to-one.
  • the vertex of the binary graph is the trajectory point in the binary graph, and the coordinates corresponding to the vertex can be determined by the index numbers corresponding to the two trajectory lines that intersect to form the vertex.
  • the similarity index between the binary image and the region is determined, so that multiple similarity indicators between the multiple binary images and the multiple regions can be determined.
  • the trajectory point pairs that have a corresponding relationship between the binary map set and the gene expression visualization image are determined.
  • the similarity index can represent the degree of similarity between the image corresponding to the binary image and the image corresponding to the region. The greater the similarity index, the higher the degree of similarity.
  • the similarity index between the binary image and the region it can be achieved by determining the binary image matrix corresponding to the binary image. Since the gray value of the pixel point of the binary image can only be 0 or 255, optionally, you can set the elements of the binary image matrix of the pixels with a gray value of 0 to 0, and set the elements of the binary image matrix of the pixels with a gray value of 255 to 1, also That is, a binary graph is a matrix composed of 0s and 1s.
  • the gene expression visualization image is a gene expression visualization image
  • the gene expression matrix corresponding to the gene expression visualization image can be determined, and each pixel of the gene expression visualization image corresponds to a gene expression amount in the gene expression matrix.
  • the binary image matrix and the gene expression matrix corresponding to the region are then used to determine the similarity index. For example, you can do a dot multiplication of the binary graph matrix and the gene expression matrix, that is, multiply the binary graph matrix by the elements at the corresponding positions in the gene expression matrix, and then sum all the elements in the matrix obtained by the dot multiplication to obtain a similar degree indicator.
  • the corresponding trajectory point pairs can be determined based on the similarity index between the binary map set and multiple areas of the gene expression visualization image.
  • the stained image can be obtained by processing the first original image using a trajectory line positioning algorithm, or can be obtained by scaling the first original image according to a preset ratio and then processing it using a trajectory line positioning algorithm. of.
  • the following will introduce the methods of determining trajectory point pairs based on multiple similarity indicators for the above two methods of obtaining staining images and gene expression visualization images.
  • the trajectory line positioning algorithm When using the trajectory line positioning algorithm to process the first original image and the second original image to obtain staining images and gene expression visualization images, multiple similarities between multiple binary images and multiple regions in the binary image set are obtained. After the degree index, the maximum value among multiple similarity indicators can be obtained, the binary image corresponding to the maximum value is determined to be the first target image, and the area corresponding to the maximum value is determined to be the first target area. Then, the first vertex in the first target image and the first index point in the first target area that have the same coordinates as the first vertex can be obtained, and the first vertex and the first index point can be determined to be a track point pair with a corresponding relationship. The first vertex can be any vertex in the first target image.
  • the trajectory line positioning algorithm is used to process the scaled first original image and the scaled second original image to obtain the staining image and the gene expression visualization image.
  • the sorting results of the multiple similarity indicators can be determined, and a preset number of similarities can be obtained based on the sorting results. degree index, and determine multiple binary images corresponding to a preset number of similarity indicators and multiple corresponding regions. For example, a preset number of similarity indicators with the largest values can be selected.
  • the embodiment of the present application does not limit the specific value of the preset number, which can be determined in combination with actual application scenarios.
  • the image before scaling of the binary image corresponding to a preset number of similarity indicators can be obtained. That is, after determining multiple binary images corresponding to the preset number of similarity indicators, the multiple binary images are enlarged according to the reciprocal of the preset scaling ratio to determine multiple second target images, that is, before scaling. image. Then, multiple candidate similarity indicators are determined based on the binary image matrices corresponding to the multiple second target images and the gene expression matrices corresponding to the multiple regions. Obtain the maximum value among multiple candidate similarity indicators, and determine that the binary image corresponding to the maximum value is the third target image, and the area corresponding to the maximum value is the third target area.
  • the second vertex can be any vertex in the third target image.
  • Step 1028 determine offset information based on the trajectory point pair
  • the coordinates corresponding to the two trajectory points of the rule point pair can be obtained, and the difference between the abscissa and the ordinate is determined as the offset information, that is, the offset.
  • Step 1029 Process a target image based on the offset information to obtain a registered image, where the target image is an image in the candidate image set corresponding to the track point pair.
  • the target image can be moved based on the offset information. That is, the image registration can be achieved by matching the trajectory points to the image corresponding to the trajectory point in the candidate image set.
  • the image processing and movement in the intermediate process are all processes implemented on the temporary image of the copied stained image, that is, the stained image is not moved and registered. After the calculation is completed, the final offset information is obtained. , based on the rotation direction and offset information of the target image, the stained image can be moved and aligned with the gene expression visualization image.
  • image processing at pixel level precision can be achieved without manual image registration, thereby improving the accuracy of image processing.
  • the method further includes: Step 105 of performing tissue segmentation on the registered image to obtain a tissue mask map.
  • Figure 18 is a schematic flowchart of a method for tissue segmentation on registered images provided by an embodiment of the present application, including:
  • Step 1051 Obtain the gene expression level of the target tissue to be segmented in the registered image and determine the gene expression matrix of the registered image.
  • the gene expression matrix evaluates the gene expression level according to the pixel position. arrangement;
  • the target tissue may include, but is not limited to, any one or more of sample tissue, biological tissue, muscle tissue, bone tissue, and cell tissue.
  • the gene expression matrix represents the expression of genes at different positions (corresponding to the row and column positions of the gene expression matrix).
  • Each piece of gene expression data includes gene identifier, gene coordinates and gene expression level, which represents the expression level of the gene at a location.
  • the gene expression level of the cell tissue can be determined by transcribing the DNA of the cell tissue.
  • gene expression quantities are usually in UTF-8 format.
  • the gene expression amount is obtained at each pixel position in the sample image, and the gene expression amount is arranged according to the row coordinates and column coordinates of the pixel position to obtain the gene expression matrix.
  • the gene expression matrix is consistent with the size of the sample image. When the gene expression amount at each pixel position is 0, it means that there is no gene of the target tissue at that pixel position.
  • the gene expression level at each pixel position in the gene expression matrix can represent the gene expression level of one or more genes. If the sizes of the gene expression matrix and the sample image are inconsistent, both images or one of the images can be scaled.
  • Step 1052 determine the image data by assigning the gene expression amount at each pixel position in the gene expression matrix to the corresponding pixel position in the registered image;
  • the gene expression amount at each pixel position in the gene expression matrix is assigned to the corresponding pixel position in the image matrix, and all pixel positions are normalized to obtain image data of the sample image.
  • the gene expression amount at each pixel position in the gene expression matrix is stored in the dictionary with the row coordinates and column coordinates of each pixel position as keys and the gene expression amount as the value.
  • the amount is the same as the gene expression amount at the same pixel position in the gene expression matrix.
  • the assigned image matrix is normalized so that the pixel value of each pixel position is within the [0,255] interval, thereby obtaining more accurate image data relative to the sample image and reducing the impact on subsequent tissue segmentation images.
  • the image data is shown in Figure 20.
  • the format of the image data is preferably TIFF format, or it can also be JPG format, etc. It is not limited to a specific form of expression and can be selected according to the actual situation.
  • a gene expression matrix is generated by obtaining the gene expression amount that determines the position of each pixel, and converting the gene expression matrix into image data, thereby reducing the process of repeated shooting and correction of tissue images through the original microscope, and improving segmentation efficiency, and makes the image data display the target tissue more accurately than the initial sample image, and the segmentation effect of the target tissue is better.
  • Step 1053 Determine the foreground pixels of the image data by performing image processing on the image data
  • the tissue segmentation method further includes: referring to Figure 21, convolving the image data to extract low-frequency features of the image data.
  • the convolution method is preferably 2d convolution. Convolution methods such as atrous convolution and depth-separable convolution can also be used to improve the calculation virtuality and expand the perceptual field of view.
  • the image data after convolution is shown in Figure 22.
  • the foreground pixels of the image data are determined by image processing on the convolved image data.
  • Step 1054 Mark the connected areas of the image data according to the foreground pixel points to obtain the tissue mask map.
  • the connected area refers to an image area composed of foreground pixels with the same pixel value and adjacent positions in the image data, that is, the segmentation area of the target tissue.
  • Figure 23 is a schematic flow chart of a method for calculating and describing the grayscale image quality corresponding to the tissue mask map provided by an embodiment of the present application. include:
  • Step 1061 Calculate the outer contour image and inner contour image of the grayscale image corresponding to the tissue mask image respectively;
  • the outer contour image and the inner contour image of the target area tissue grayscale image can be obtained respectively based on matrix operations.
  • the outer contour image and the inner contour image are strip-shaped annular contours.
  • the inner contour image can be enclosed.
  • Step 1062 Divide the outer contour image and the inner contour image into N segments respectively, and pair the outer contour image of each segment with the inner contour image of each segment in pairs to obtain N image combinations, each The image combination includes an outer contour image and an inner contour image;
  • Figure 24 is a schematic structural diagram of the relationship between the outer contour image and the inner contour image provided by an embodiment of the present disclosure.
  • Figure 25 is a schematic diagram of the relationship between the outer contour image and the inner contour image provided by an embodiment of the present disclosure.
  • Step 1063 Calculate the pixel density ratio of an outer contour image and an inner contour image in each image combination, and obtain N pixel density ratios.
  • the pixel density ratio is the outer contour image of a segment in each image combination.
  • Calculating the pixel ratio of the outer contour image of a segment includes using the outer contour image of the segment.
  • the number of pixels within the segment is divided by the total number of pixels within the segment's outer contour image.
  • the pixels are pixels with a grayscale value greater than 127.
  • the ratio is the pixel density ratio. Assuming that an inner contour image exists in an image combination, that is, the two are paired with each other, and the ratio of the pixel ratio of an outer contour image to the pixel ratio of an inner contour image in all image combinations is calculated, and finally N is obtained pixel density ratio.
  • Step 1064 Calculate and describe the grayscale image quality corresponding to the tissue mask image according to the pixel density ratio.
  • the calculation and description of the grayscale image quality of the target area tissue based on the pixel density ratio includes but is not limited to the following implementation methods, for example: substituting the average value of the pixel density ratio into a preset function to calculate the description of the target area tissue.
  • the preset function can be a linear function or a nonlinear function.
  • the average value of the effective pixel density ratio is x.
  • x is greater than 0 and less than 200, it can be substituted into the formula (1)
  • the formula (1) is as follows:
  • Figure 26 is a schematic flowchart of a method for cell segmentation on registered images provided by an embodiment of the present application, including:
  • Step 1031 input the registered image into the image segmentation model, and obtain the segmentation results of each pixel in the registered image.
  • the segmentation result includes pixels belonging to cells and pixels belonging to cell outlines. Points or pixels of the image background.
  • the initial segmentation result of points is to determine whether each pixel in the registered image belongs to a cell pixel, a cell outline pixel, or an image background pixel.
  • the registered image can be expanded to a three-channel (such as RGB three-channel) image, input the image segmentation model, and obtain the initial segmentation result of each pixel in each channel image, that is, each channel image
  • the pixels belong to the target object, the outline of the target object, or the image background, and then the initial segmentation results of each pixel point in each channel image are combined to determine the initial segmentation result of each pixel point in the registered image.
  • Step 1032 Determine the pixels belonging to cells based on the pixels that the segmentation result belongs to cells or the pixels of cell outlines, and output the segmentation results of the registered image to obtain the cell mask map.
  • Fusion of pixels belonging to cells or cell outlines is used to achieve cell segmentation, that is, pixels of cell objects or cell outlines are determined as pixels belonging to cells, image segmentation is performed, and the segmentation results of the registered image are output.
  • the watershed algorithm can also be used to filter the target objects whose area is smaller than the threshold in the segmentation result of the registered image, and/or to repair the incomplete target objects.
  • the target object By filtering target objects with an area smaller than the threshold and/or repairing incomplete target objects, the target object is corrected, the post-processing of the segmentation results of the registered image is completed, and the accuracy of image segmentation is improved.
  • the target object is cells
  • algorithms such as cell filtering and correction are used to filter very small cells and correct incomplete cells to make cell segmentation more accurate.
  • the image segmentation model used in the embodiments of this application adopts a pyramid squeeze attention module in the encoder module, which improves the feature extraction capability of the encoder module and enables the image segmentation model to pay more attention to target objects with salient features, thereby improving improve the segmentation accuracy of the image segmentation model.
  • the embodiment of the present application is applied to cell segmentation in spatiotemporal omics, as shown in Figure 27, which demonstrates the segmentation effect of the image segmentation model of the embodiment of the present application on mouse brain images.
  • a part of the mouse brain image above has been intercepted for display.
  • the lower right image can be achieved using the image segmentation model proposed in the embodiment of this application. Separate independent cells from adherent cells and provide more reliable boundaries.
  • Figure 28 is a schematic flow chart of a method for cell segmentation on registered images provided by an embodiment of the present application, including:
  • Step 1033 preprocess the gene expression visualization image to obtain a preprocessed image
  • the gene expression visualization image is a scatter plot, which is not convenient for cell segmentation, preprocessing is required to process the gene expression visualization image of cells to obtain a preprocessed image with enhanced boundary effects.
  • Step 1034 Binarize the preprocessed image to obtain an initial mask image
  • the Otsu method can be used to binarize the preprocessed image to obtain the initial mask image.
  • Step 1035 According to the initial mask map, use the watershed algorithm based on distance transformation to segment the connected domain with cell adhesion to obtain the segmented cell mask map.
  • the Watershed Algorithm considers image segmentation based on the composition of the watershed.
  • the Watershed Algorithm considers image segmentation based on the composition of the watershed.
  • this embodiment provides a specific method as shown in Figure 29, which method includes:
  • Step 201 Obtain a gene expression matrix containing spatial positions.
  • Gene expression data may include gene identifiers, coordinate positions of multiple genes, and total gene expression amounts at corresponding coordinate positions.
  • Step 202 Generate a visualization image of gene expression of the cell based on the gene expression matrix.
  • step 202 may specifically include: first obtaining the coordinate position of the expressed gene in the gene expression matrix and the total gene expression amount at the corresponding coordinate position; and then obtaining the coordinate position of the expressed gene and the total gene expression amount at the corresponding coordinate position.
  • the amount is generated to generate a gene expression visualization image, where the gene expression visualization image is a grayscale image, and the grayscale value of a pixel in the gene expression visualization image is the total gene expression amount corresponding to the coordinate position of the pixel.
  • a gene expression matrix containing spatial positions is input, and an expression image is generated based on the coordinate position of the expressed gene and the total gene expression amount at the corresponding position.
  • the specific form of the image is a grayscale image, and the grayscale of the coordinate points is The degree value is the total amount of gene expression at this coordinate.
  • step 202 may specifically include: drawing a gene expression visualization image of the cell according to the gene expression matrix and the segmented mask map, wherein the spatial position in the gene expression matrix is consistent with the segmented mask map. corresponding to the spatial position.
  • a cell-based expression map is drawn based on a gene expression matrix and a segmented mask map, and the spatial position in the gene expression matrix can correspond to the spatial position in the segmented mask map.
  • step 203 Since the generated gene expression visualization image is a scatter plot, which is not easy to segment, it needs to be processed. Specifically, the process shown in step 203 can be performed.
  • Step 203 Preprocess the gene expression visualization image to obtain a median map, and sharpen the median map to obtain a sharpened map.
  • the visualized gene expression image is a scatter plot, which is inconvenient for cell segmentation, preprocessing is required.
  • the visualized gene expression image of the cell is first processed into a median plot. Then the Laplacian operator (laplacian operator) can be used to sharpen the median image to enhance the boundary effect of the median image, thereby obtaining a sharpened image.
  • preprocess the gene expression visualization image to obtain the median map may include: first using a convolution kernel of preset size (such as 13*13) to perform a convolution operation on the gene expression visualization image to visualize the gene expression.
  • the scattered points in the image are adhered to obtain the first convolution map; then the local maximum point of the first convolution map is detected based on the two-dimensional grayscale peak value of the image; the p-th percentile of the local maximum point is obtained, where, p is a preset value, for example, the p-th percentile can be the 98% percentile value, or the 99% percentile value, etc.; if the p-th percentile is within the preset range, the first median filter is used Perform median filtering on the first convolution map to obtain a median map, where the filter size of the first median filter is determined based on the preset size.
  • a convolution kernel of preset size such as 13*13
  • the method in this embodiment may also include: if the p-th percentile is outside the preset range, based on the p-th percentile and the preset size to determine the new size of the convolution kernel; use the convolution kernel of the new size to perform a convolution operation on the gene expression visualization image, so that the scattered points in the gene expression visualization image are adhered to obtain the second convolution map; use the second The median filter performs median filtering on the second convolution map to obtain a median map, where the filter size of the second median filter is determined based on the new size.
  • Kernel reprocess the original image to obtain the second convolution map; if the R value is within the allowed range, the first convolution map will be used.
  • the convolution image is in the form of stacked squares of different grayscales.
  • the grayscale span is relatively sharp, and some expression images have holes in the center of clusters.
  • the numerical value (decimals are rounded down) is the filter size (if K needs to be calculated, the kernel size here is K*2.7). Perform median filtering on the second convolution map to obtain the median map.
  • the median filter used above is relatively large, and the gray-scale boundary of the median image may be blurred.
  • Step 204 Binarize the sharpened image to obtain an initial mask image.
  • Step 205 Filter the connected domains in the initial mask map whose areas do not meet the preset conditions to obtain the filtered mask map.
  • step 205 may specifically include: filtering connected domains with an area greater than a first preset threshold or a connected domain with an area smaller than a second preset threshold in the initial mask map to obtain a filtered mask map, where: A preset threshold is greater than the second preset threshold.
  • a preset threshold is greater than the second preset threshold.
  • an empirical threshold is used to filter connected domains that are too small or too large in the initial mask to obtain a filtered mask map.
  • Step 206 Traverse each connected domain in the filtered mask map, extract the area where the connected domain is located based on the minimum circumscribed rectangle of the connected domain, and use the watershed algorithm to segment the connected domain with cell adhesion to obtain a segmented mask map.
  • step 206 may specifically include: setting the gray value of the pixels within each connected domain in the filter mask map to the first value, and setting the gray value of the pixels outside each connected domain to The second value; for each target pixel whose gray value is the first value in the connected domain, remap the gray value of the target pixel to the nearest pixel whose gray value is the second value.
  • distance obtain the distance map of the connected domain; perform binarization processing on the distance map of the connected domain, and obtain the preset number of pixels in the connected domain that are farthest from the pixels whose gray value is the second value; convert the preset The number of pixels is used as the water injection point of the watershed algorithm.
  • the watershed function is used to perform watershed segmentation on the original mask of the connected domain in the filter mask map to obtain the segmented target connected domain and cover the target connected domain to the filtered mask map. Get the segmented mask image.
  • each connected domain in the filter mask map For example, traverse each connected domain in the filter mask map, extract the area where the connected domain is located based on the minimum circumscribed rectangle of the connected domain, and use the watershed algorithm based on distance transformation to further segment the connected domain where cell adhesion may exist.
  • the specific steps are as follows:
  • Step a For each extracted connected domain area, the gray value of the point within the target connected domain is set to 1, and the gray value of the point outside the connected domain is set to 0 (including the background and non-target connected domain). For each value: Distance transformation is performed on the point of 1, and its gray value is remapped to the distance from the point to the point with the nearest value of 0 (the distance between adjacent points is 1), and the distance map of the connected domain is obtained.
  • Step b Use an empirical threshold to binarize the distance map and obtain the points furthest from the point with a distance value of 0 in the connected domain (the number of each is variable due to different conditions in each connected domain).
  • Step c Use the several points obtained in the previous step as watershed points for the watershed algorithm, use the watershed function in opencv to perform watershed segmentation on the original mask of the connected domain, obtain the segmented target connected domain, and overwrite the result to the filter mask. Mockup.
  • Step d Perform the above steps for each connected domain traversed to obtain the segmented mask map.
  • Step 207 Perform a closure operation on the segmented mask image to obtain a mask image of the cell segmentation result.
  • the final mask image can be output and saved for subsequent biological analysis at the cell level in combination with the original expression matrix.
  • the gene expression matrix can be input, and a gene expression visualization image can be generated based on the matrix, as shown in Figure 31.
  • a 13*13 convolution kernel is used to perform a convolution operation on the gene expression visualization image, so that the scattered points in the gene expression visualization image are adhered to obtain the first convolution image.
  • judgment needs to be made through a threshold that is, the local maximum point of the first convolution map is detected based on the two-dimensional grayscale peak value of the image, and the 99% quantile value R of all the obtained local maximum points is taken out.
  • the R value is related to a set value.
  • the 13*13 convolution kernel processes the original image to obtain the second convolution image, uses this ratio to calculate the median filter size, and then uses the median filter of this size to process the second convolution image to obtain the median image. If the R value is within the allowed range, the first convolution map is used, and a median filter of size 35 is used to process the first convolution map to obtain the median map.
  • this embodiment provides a solution for cell segmentation directly based on gene expression visualization images, which uses a combination of multiple image processing methods to provide more reliable cell segmentation results.
  • Cell segmentation does not rely on image images, and does not require the introduction of additional technology for registering image images with gene expression visualization images. This eliminates the introduction of additional errors, saves overall operating time and technical costs, and improves the efficiency and efficiency of cell segmentation processing. accuracy.
  • Figure 35 is a schematic flow chart of a method for cell segmentation on registered images provided by an embodiment of the present application, including:
  • Step 1036 Determine the labeled area and cell area corresponding to each tissue type of the target object based on the stained image
  • the tissue information provided by the staining map and the prior knowledge related to the target object can be combined to determine the labeled areas corresponding to each tissue type contained in the target object based on the staining map.
  • the prior knowledge related to the target object can be which cell tissues the target object contains, or the cell morphology of these tissues.
  • the tissue outline of each cell tissue of the target object can be drawn with a specific manual tool, and the areas corresponding to different tissues can be marked with different colors.
  • the specific manual tool can be the open source tool 3Dslicer, which supports manual annotation, and can also be combined with the open source tool plant-seg network to annotate tissue areas.
  • the cell area in this step may be a reference cell area preset for the tissue type of the target object. That is to say, the cell area of each tissue type is set in advance.
  • the set cell area can be set based on experience, or can be set based on the average value of tissue cells of the same type in different subjects. Therefore, when this step is performed, the preset cell area can be directly obtained and used as the cell area corresponding to the marked area, and then subsequent processing can be performed.
  • Step 1037 Determine the area of the sub-region to be processed included in each marked area based on the area of the cell.
  • the area of the sub-region to be processed is positively related to the area of the cell.
  • the sub-region to be processed is used to characterize the corresponding The minimum processing unit of the marked area;
  • the sub-region to be processed corresponding to the marked area can be used as the minimum processing unit of the marked area for processing and analyzing tissue cells.
  • a sub-region to be processed is regarded as a unit.
  • the positional relationship between the sub-regions to be processed is used to characterize the positional relationship between cells in the annotated area. Because the area of the sub-region to be processed is positively correlated with the cell area, that is to say, the larger the cell area of the annotated area determined in the previous step, the larger the sub-region to be processed that is divided from the annotated area. Therefore, the positional relationship between cells in the annotated domain corresponding to different tissue types can be better expressed.
  • Step 1038 Grid the corresponding marked area according to the area of each sub-area to be processed, and obtain the grid coordinates corresponding to each marked area;
  • an optional way to perform grid processing on the marked area may be to divide each marked area into grids with an area equal to the area of the corresponding sub-area to be processed, and obtain the grid coordinates.
  • the coordinates of the center point of the grid can also be used as the grid coordinates of the grid.
  • the coordinates of the grid center point can be calculated by obtaining the coordinate interval where the grid is located from the coordinates established by the capture unit.
  • the coordinates of the center point are determined as the coordinates of the center point of the grid.
  • Step 1039 Extract the data corresponding to the grid coordinates from the gene expression visualization image and superimpose it onto the grid coordinates to obtain the cell processing results of the target object.
  • the data corresponding to each grid coordinate is extracted from the gene expression data to obtain the tissue cell processing data of the target object, which includes the expression levels of different genes of the target object in the cell tissues of each tissue type, and is further combined with the corresponding Grid coordinates to generate the tissue cell processing results of the target object.
  • the gene expression data includes gene identifier ID, gene coordinate data x, y, and gene expression amount MIDCount. Since the grid coordinates have been determined at this time, the coordinate range of each grid can be determined through the grid coordinates. Then compare the gene coordinate data x, y of each data with the coordinate range of each grid. If the gene coordinate data x, y falls within the coordinate range of which grid, it means that the data will be superimposed on this grid. , at this time, the corresponding grid ID, that is, Cell ID, can be set for the data in the expression data. When the data is superimposed later, according to the added Cell ID, it can be clear which grid each data falls in. , that is, the center point coordinates of which grid the data needs to be superimposed on.
  • Figure 36 is a schematic flowchart of a method for determining the cells to which background gene molecules of unknown cells in a gene expression visualization image belong, provided by embodiments of the present application, including:
  • Step 1041 based on the cell mask map, determine each gene expression feature of the gene expression visualization image as a cell gene expression feature located within the cell and a background gene expression feature located outside the cell;
  • each gene expression feature of the gene image is determined as a cell gene expression feature located within the cell and a background gene expression feature located outside the cell.
  • the gene expression feature is DNB, as shown in Figure 37.
  • Figure 37 is a schematic diagram of the corresponding relationship between DNB and cell membrane, where x and y are DNB coordinates respectively, geneID and MIDCount respectively represent gene information, and label represents cells. logo.
  • each DNB of the Stereo-seq spatial transcriptome data is obtained to obtain the cell information to which the DNB belongs, and the remaining DNBs that are not within the cell are used as background DNBs.
  • Step 1042 For each cell gene expression feature, fit a probability distribution model based on the spatial position and the signal value of the gene expression feature;
  • a probability distribution model is fitted based on the spatial position and the signal value of the gene expression characteristics.
  • the probability distribution model can be a Gaussian mixture model, but different probability distribution models can be used, and in determining the cells to which the background signal belongs, the Bayesian model can be used to determine the cells to which it belongs. Corresponding selection and adjustment can be made according to actual needs.
  • a Gaussian mixture model is fitted through the coordinates (x, y) and the DNB signal value.
  • Step 1043 based on the probability distribution model, determine the probability value that the target background gene expression feature located within the preset range of a target cell belongs to the target cell;
  • the probability value that the target background gene expression feature located within a preset range of a target cell belongs to the cell is determined.
  • the target cells may be all cells contained in the biological sample, or may be some cells contained in the biological sample.
  • the target cell is cell a as an example.
  • the Gaussian mixture model is used to calculate the background DNB within the central range of 50x50 pixels of cell a that belongs to cell a. probability value.
  • Step 1044 Output the correction result according to the probability value to correct the background gene expression characteristics.
  • this step it is determined whether the probability value is greater than or equal to the preset probability value. If so, the target background gene expression characteristics are used as the cell gene expression characteristics located in the target cell to correct the background gene expression characteristics. , the target background gene expression features continue to be used as background gene expression features.
  • Figure 32 is a schematic diagram of the correction result of correcting background DNB.
  • background DNB those smaller than the preset probability value are regarded as background DNBs, and those greater than or equal to the preset probability value are regarded as DNBs of cells.
  • the preset probability value is not specifically limited, and can be selected and adjusted accordingly according to actual needs.
  • a probability value belonging to each corresponding target cell is determined respectively; from the determined at least two probability values The highest probability value is selected as the probability value of the output correction result, and the target cell corresponding to the highest probability value is used as the cell to which the target background gene expression feature belongs.
  • the background gene expression feature A is within the central range of 50x50 pixels of cell a and cell b at the same time, calculate the probability value that the background gene expression feature A belongs to cell a as x1, The probability value that background gene expression feature A belongs to cell b is x2. If x1 is greater than x2, then the background gene expression feature A is determined to be the gene expression feature of cell a.
  • Figure 39 is a schematic flow chart of a method for determining the cells to which background gene molecules of unknown cells in a gene expression visualization image belong, provided by embodiments of the present application, including:
  • Step 1045 Determine the initial gene molecules belonging to the target cell and the background gene molecules of the unknown cell according to the gene expression visualization image
  • Step 1046 obtain the coordinate information of the initial gene molecule
  • Step 1047 determine the center point coordinates of the target cell based on the coordinate information
  • Step 1048 Construct a Voronoi diagram based on the center point coordinates and the coordinate information
  • Voronoi diagram (Voronoi diagram, also called Thiessen polygon or Dirichlet diagram) is composed of a set of continuous polygons composed of perpendicular bisectors of straight lines connecting two adjacent points. N points that are different on the plane divide the plane according to the nearest neighbor principle; each point is associated with its nearest neighbor area.
  • Step 1049 Determine the cells to which the background gene molecules within the Voronoi diagram range belong.
  • the background gene molecules within the Voronoi diagram range can be determined to belong entirely to the target cell, to partially belong to the target cell, or to not belong to the target cell at all.
  • the coordinate information of the initial gene molecule belonging to the target cell is used to determine the center point coordinates of the target cell, and then a Voronoi diagram is constructed based on the center point coordinates of the target cell to determine the background gene molecules within the Voronoi diagram range.
  • the cells to which it belongs improves the correction efficiency and also improves the accuracy of the correction.
  • this embodiment only needs to be able to determine the initial gene molecules in the target cells, without knowing the outline map of the target cells. Therefore, it reduces the requirement for high-precision cell segmentation, reduces the dependence on the target cell morphological image map, and improves the the robustness of the correction scheme.
  • the step of determining the initial gene molecules belonging to the target cell and the background gene molecules of the unknown cell based on the gene image includes:
  • the initial gene molecules belonging to the target cell and the background gene molecules of the unknown cell are determined.
  • the step of determining the coordinates of the center point of the target cell based on the coordinate information includes:
  • the first ratio is determined as the abscissa value of the center point coordinate; the first ratio is the ratio of the sum of the abscissa values of the initial gene molecules to the number of the molecules;
  • the second ratio is determined as the ordinate value of the center point coordinate; the second ratio is the ratio of the sum of the ordinate values of the initial gene molecules to the number of the molecules.
  • the step of determining the coordinates of the center point of the target cell based on the coordinate information includes:
  • the third ratio is determined as the abscissa value of the center point coordinate; the third ratio is one-half of the difference between the largest abscissa value and the smallest abscissa value;
  • the fourth ratio is determined as the ordinate value of the center point coordinate; the fourth ratio is half of the difference between the largest ordinate value and the smallest ordinate value.
  • the genetic image data correction method further includes:
  • the background gene molecules are within different Voronoi diagram ranges, then input the background gene molecules into a Gaussian mixture model to determine the probability score that the background gene molecules belong to the target cells within the preset distance range;
  • the background gene molecules are corrected to gene molecules belonging to the target cells with a high probability score.
  • the step of determining the cell to which the background gene molecule within the Voronoi diagram range belongs includes:
  • Gene expression information of the target cell is generated based on the corrected result of the gene molecules belonging to the target cell.
  • the step of constructing a Voronoi diagram based on the center point coordinates and the coordinate information includes:
  • Figure 40 is a schematic flowchart of a method for determining the cells to which background gene molecules of unknown cells in a gene expression visualization image belong, provided by embodiments of the present application, including:
  • Step 10410 determine the initial number of molecules of the gene molecules belonging to the target cell in the gene expression visualization image and the initial outline area of the target area occupied by the gene molecules belonging to the target cell;
  • the convex hull algorithm is used to calculate the cell segmentation results to determine the initial outline area of the target area occupied by the gene molecules belonging to the target cells.
  • the convex hull algorithm (Convex Hull Algorithm) searches for the convex hull of N points in the target area based on the cell segmentation results. The connection between these N points surrounds the initial contour area.
  • Step 10411 determine the gene molecule density of the target cell based on the number of molecules and the initial contour area
  • the ratio of the number of molecules and the initial contour area is determined as the gene molecule density of the target cell.
  • Step 10412 determine the number of background gene molecules within the preset region of the target region and the area of the preset region;
  • the background gene molecules are gene molecules whose cell cannot be determined based on the gene image.
  • the preset area range is outside the target area, but cannot exceed the area occupied by the gene molecules belonging to neighboring cells.
  • the optional area area is 5 pixels * 5 pixels as the default area range.
  • the preset area range may be an area determined based on the center point of the target cell.
  • the center point of the target cell is determined by the gene image. See Figure 41 for a schematic diagram of the center point of the target cell.
  • Step 10413 determine the density of background gene molecules based on the number of molecules and area of the background gene molecules;
  • the ratio of the number of background gene molecules to the area is determined as the background gene molecule density.
  • Step 10414 Determine the cell to which the background gene molecule belongs based on the gene molecule density and the background gene molecule density.
  • the above cell characteristics are used to determine the gene molecule density of the target cell based on the initial number of molecules of the gene molecules belonging to the target cell in the gene image and the initial outline area of the target cell. Compare the gene molecule density of the target cell and the background gene molecule density, and determine the cell to which the background gene molecule belongs based on the gene molecule density and the background gene molecule density, which greatly improves the efficiency of correcting the gene molecules in the target cell and also increases the number of correction targets. The precision of genetic molecules within cells.
  • Figure 42 is a schematic flow chart of a method for determining the cells to which background gene molecules of unknown cells in a gene expression visualization image belong, provided by embodiments of the present application, including:
  • Step 10415 determine the target area occupied by the gene molecules belonging to the target cells in the gene expression visualization image
  • Step 10416 determine the spatial coordinates and gene expression characteristic signal values of the background gene molecules of the unknown cells within the preset correction range of the target area;
  • the gene expression feature in this embodiment is DNB.
  • the cell information to which the DNB belongs can be obtained, and the remaining DNBs that are not within the cell are used as background DNBs.
  • the spatial coordinates of the background gene molecules can be expressed by the coordinates of the background DNB.
  • Step 10417 input the spatial coordinates and the gene expression characteristic signal value into a probability distribution model to obtain the probability score that the background gene molecule belongs to the target cell; the probability distribution model is based on the gene to which the target cell belongs.
  • the spatial coordinates of the molecular sample and the gene expression characteristic signal values are obtained by fitting;
  • GMM model When fitting the GMM model (Gaussian mixture model), there are three independent variables: spatial coordinates (x, y) and signal values.
  • the dependent variable, the output, is the probability score of each gene molecule belonging to the target cell.
  • the specific implementation process is: introducing Gaussian Mixture (Gaussian Mixture) in the Scikit-learn (a machine learning library) library, using the input data to automatically fit the parameter information of the GMM model to obtain the final probability model.
  • Gaussian Mixture Gaussian Mixture
  • Scikit-learn a machine learning library
  • the probability distribution model is fitted based on the spatial coordinates of the gene molecule samples belonging to the target cells and the gene expression characteristic signal value samples.
  • the probability distribution model may be a Gaussian mixture model.
  • Step 10418 Determine the cell to which the background gene molecule belongs based on the probability score.
  • the background gene molecules are corrected to gene molecules belonging to the target cell. If the probability score is less than the probability threshold, the background gene molecules are still background molecules of unknown cells.
  • the third quartile between the first probability score and the second probability score is determined as the probability threshold.
  • the first probability score is the probability score with the highest value among the probability scores; the second probability score is the probability score with the lowest value among the probability scores.
  • the probability score of the background gene molecule of the unknown cell belonging to the target cell within the preset correction range is calculated, and the belonging of the background gene molecule is determined based on the probability score. cell. It reduces the large errors in genetic image data caused by the diffusion of gene molecules and improves the correction efficiency. At the same time, it does not rely on high-precision cell segmentation results, which enhances the robustness of the correction scheme.
  • this application also provides detection of track crosses on the chip, mainly for subsequent splicing correction and registration. Both splicing and registration use track detection results.
  • Figure 43 shows a flowchart of a method 100 for determining point coordinates in a stained image according to one embodiment of the present invention.
  • the method 100 may include a sampling step 1001, a grouping step 1002, a straight line fitting step 1003 and a coordinate calculation step 1004.
  • FIG. 44 shows an example stained image to which the present invention is applicable.
  • the stained image can be acquired by a camera, a stained image sensor, etc.
  • the stained image may be, for example, a stained image of a mechanical structure, a carrier, a slide or a biochip with straight trace lines. As shown in FIG.
  • the stained image plane in which the stained image is located may include a first direction X and a second direction Y perpendicular to the first direction
  • a straight trajectory line ie, a plurality of dark lines in the stained image that is generally parallel to the first direction X
  • a plurality of second straight trajectory lines transverse to the first direction Multiple dark lines parallel to the second direction Y.
  • there are 6 first straight trajectory lines and 8 second straight trajectory lines in this example stained image. Since every first straight trajectory line intersects every second straight trajectory line, there are a total of 6 ⁇ 8 48 intersection points in this example stained image.
  • the stained image may have a pixel length L and a pixel width W.
  • An example second sampling strip is also shown in Figure 38.
  • the pixel length of the sampling bar is the same as the pixel length of the example dyeing image, which is L, and the pixel width of the sampling bar is smaller than the pixel width of the example dyeing image, which is W2.
  • a straight trajectory line transverse to any direction means that the straight trajectory line is parallel to a direction perpendicular to the any direction or the angle between the straight trajectory line and a direction perpendicular to the any direction is less than a preset value.
  • the range of the preset value may include 1 to 10 degrees, 10 to 20 degrees, 20 to 30 degrees, 30 to 40 degrees or 40 to 50 degrees, etc.
  • the preset value may be 1 degree, 2 degrees, 3 Degrees, 4 degrees, 5 degrees, 6 degrees, 7 degrees, 8 degrees, 9 degrees, 10 degrees.
  • the sampling step 1001 includes a first direction sampling step and a second direction sampling step.
  • a first sampling strip is used to perform first direction equally spaced sampling on the stained image along the first direction to determine a first candidate point set, wherein for each first direction equal spaced sampling, Perform the following first direction sampling sub-step one and first direction sampling sub-step two.
  • the first direction sampling sub-step includes: accumulating pixel values in the first direction for the pixels in the sampling area of the stained image selected by the first sampling strip during the equal-spaced sampling period in the first direction. and to obtain a series of first pixel value sums, wherein the series of first pixel value sums at any second direction position in the second direction are equal to the values in the sampling area at the second The sum of pixel values of each pixel aligned along the first direction at the direction position.
  • the second step of the first direction sampling sub-step includes: determining the extreme points of the series of first pixel value sums, and for each determined extreme point: determining a corresponding first value obtained by equal intervals sampling in the first direction. candidate point, the coordinate of the corresponding first candidate point in the second direction is the coordinate of the second direction position corresponding to the extreme point in the second direction, the corresponding first candidate point is in the second direction
  • the coordinates in one direction are determined based on the position of the first sampling strip in the first direction during the equally spaced sampling period in the first direction. In this way, the first candidate points obtained by sampling at equal intervals in each first direction form the first candidate point set.
  • a second sampling strip is used to perform second direction equally spaced sampling on the stained image along the second direction to determine a second candidate point set, wherein for each second direction equal spaced sampling, Perform the following second direction sampling sub-step one and second direction sampling sub-step two.
  • the first step of second direction sampling includes: accumulating pixel values in the second direction for the pixels in the sampling area of the stained image selected by the second sampling strip during the second direction equally spaced sampling period. and to obtain a series of second pixel value sums, wherein the value of the series of second pixel value sums at any first direction position in the first direction is equal to the value in the sampling area at the first direction position. The sum of pixel values of each pixel aligned along the second direction at the direction position.
  • the second direction sampling sub-step includes: determining the extreme points of the series of second pixel value sums, and for each determined extreme point: determining a corresponding second point obtained by equal intervals sampling in the second direction. candidate point, the coordinate of the corresponding second candidate point in the first direction is the coordinate of the first direction position corresponding to the extreme point in the first direction, the corresponding second candidate point is in the first direction
  • the coordinates in the two directions are determined based on the position of the second sampling strip in the second direction during the equally spaced sampling period in the second direction. In this way, the second candidate points obtained by sampling at equal intervals in each second direction form the second candidate point set.
  • All extreme value points used in the sampling step 1001 may be the same maximum value point or the same minimum value point. For example, if the straight trajectory line is a dark line, all the extreme value points used can be the minimum value points; if the straight trajectory line is a bright line, all the extreme value points used can be the maximum value points. .
  • the first candidate points in the first candidate point set are divided into a plurality of first candidate point groups; and the second candidate points in the second candidate point set are divided into a plurality of second candidates. Click group.
  • the first candidate points in the first candidate point set are divided into a plurality of first candidate point groups in a first grouping manner, wherein the first grouping manner is configured such that each first candidate point Each first candidate point in the point group is substantially arranged in a straight line transverse to the second direction.
  • the second candidate points in the second candidate point set are divided into a plurality of second candidate point groups in a second grouping manner, wherein the second grouping manner is configured such that the second candidate points in each second candidate point group are Each second candidate point is substantially arranged in a straight line transverse to the first direction.
  • the straight line fitting step 1003 perform straight line fitting on the first candidate point in each first candidate point group to obtain a corresponding first straight line analytical formula; and perform straight line fitting on the first candidate point in each second candidate point group.
  • the two candidate points are subjected to straight line fitting to obtain a corresponding second straight line analytical formula.
  • straight line fitting based on multiple points with known coordinates to obtain a straight line analytical formula is known in the art and will not be described in detail here.
  • Commonly used straight line fitting methods include: least squares method; gradient descent method; Gauss-Newton and column-horse methods.
  • the coordinates of the intersection points of each first linear analytical expression and each second linear analytical expression are calculated.
  • the method of finding the coordinates of the intersection point of two known analytical expressions of straight lines is known in the art and will not be described in detail here.
  • Figure 45 is a directional target detection method provided by an embodiment of the present application, including:
  • Step 1005 Obtain the staining image or gene expression visualization image to be tested.
  • Step 1006 Input the staining image or gene expression visualization image to be tested into a directed target detection network to obtain target detection results.
  • the dyeing image to be tested or the gene expression visualization image is input into the trained YOLOV6-based directed target detection model, and the multi-level convolutional neural network trained in the directed target detection model is used to perform a convolution operation on the image to be detected.
  • fusion of feature maps, and output feature fusion maps of different scales; for feature fusion maps of different scales, corresponding predictors are used to predict category confidence, target frame positioning confidence, target detection confidence, and angle classification confidence.
  • the Backbone layer adopts RepVGG architecture
  • the Neck layer adopts FPN-PAN architecture
  • the Head layer adopts a decoupling head, so that category analysis is performed via the classification branch to obtain the classification information, and regression analysis is performed via the regression branch to obtain the target frame coordinate prediction information, the target prediction information and the angle respectively.
  • Forecast information Classification information used to represent the category analysis results, target frame coordinate prediction information used to determine the position of the target detection frame, target prediction information used to determine whether there is a corresponding target in the target detection frame, and angle used to determine the angle of the target detection frame Forecast information, the corresponding target can include track lines or track crosses (also called track intersections).
  • Embodiments of the present application provide a method for training a directed target detection network based on YOLOV6.
  • the method includes: acquiring multiple training images and label information including labels in the multiple training images; and converting the multiple training images.
  • a training image and the label information are input into the YOLOV6-based directed target detection network to obtain the setting parameters of the YOLOV6-based directed target detection network through training; wherein the YOLOV6-based directed target detection network includes :
  • the backbone Backbone layer is configured to perform feature extraction on the training image to obtain multiple feature maps of different scales; the neck Neck layer is configured to receive the multiple feature maps from the Backbone layer and perform the feature extraction on the multiple feature maps.
  • the feature maps are fused across scales to obtain a plurality of fused feature maps; and a detection head Head layer is configured to predict the plurality of fused images to obtain a prediction result about the training image, wherein the prediction result Including: classification information, target frame coordinate prediction information, target prediction information and angle prediction information.
  • the Backbone layer adopts RepVGG architecture
  • the Neck layer adopts FPN-PAN architecture
  • the Head layer uses a decoupling head, so that category analysis is performed via the classification branch to obtain the classification information, and regression analysis is performed via the regression branch to obtain the target frame coordinate prediction information, the target prediction information and the angle prediction information.
  • inputting the plurality of training images and the label information into the YOLOV6-based directed target detection network to obtain the setting parameters of the YOLOV6-based directed target detection network through training includes: in each During this training,
  • the method further includes: preprocessing the acquired tag information in the first data form to process the tag information into data in the form of [x, y, w, h, ⁇ , classID], And input the processed data into the directed target detection network based on YOLOV6,
  • (x, y) represents the position of the center of the target detection frame
  • w represents the long side width of the target detection frame
  • h represents the short side height of the target detection frame
  • represents the long side of the target detection frame.
  • classID represents the category of the target detection frame.
  • the first data form of the tag information is [x1, y1, x2, y2, x3, y3, x4, y4, classID], where, (x1, y1), (x2, y2), (x3, y3) and (x4, y4) respectively define the positions of the four vertices of the target detection frame.
  • the method further includes: post-processing the obtained prediction results in the form of [x, y, w, h, ⁇ , conf, classID] to process the prediction results into a second data form. data, and presenting the data in the second data form to the user,
  • (x, y) represents the position of the center of the target detection frame
  • w represents the long side width of the target detection frame
  • h represents the short side height of the target detection frame
  • represents the long side of the target detection frame.
  • the angle of rotation relative to the horizontal axis, conf indicates the confidence that the target detection frame has the corresponding target
  • classID indicates the category of the target detection frame.
  • the second data form is [x1, y1, x2, y2, x3, y3, x4, y4, conf, classID], where (x1, y1), (x2, y2), ( x3, y3) and (x4, y4) respectively define the positions of the four vertices of the target detection frame.
  • Figure 46 is a method for obtaining cell gene expression information of biological samples provided by an embodiment of the present application, including:
  • Step 1101 Obtain a first image of the biological sample, where the first image includes the stained cell boundaries of the biological sample;
  • Step 1102 Obtain a second image of the biological sample, where the second image includes the stained genetic material of the biological sample;
  • Step 1103 obtain the gene expression information of the biological sample
  • Step 1104 register the second image with the first image to obtain a registration image of the second image and the first image;
  • Step 1105 register the second image with the gene expression information to obtain a registered image of the second image and the gene expression information
  • Step 1106 Obtain the registration image of the first image and the gene expression information based on the registration image of the second image and the first image, and the registration image of the second image and the gene expression information;
  • Step 1107 Obtain the cell boundaries of the biological sample based on the registered image of the first image and the gene expression information
  • Step 1108 Obtain the gene expression information of the cells of the biological sample according to the cell boundaries based on the registered image of the first image and the gene expression amount information.
  • the cells of the biological sample are stained with ssDNA staining solution and a cell boundary fluorescent staining solution, wherein the ssDNA staining solution includes a buffer and an ssDNA reagent, and the cell boundary fluorescent staining solution includes a fluorescent dye.
  • ssDNA staining solution can stain the genetic material of cells
  • cell boundary fluorescent staining solution can stain the boundaries of cells.
  • the cell boundary includes a cell wall or cell membrane.
  • the gene expression information of the cells of the tissue sample includes position information, gene expression amount and cell type of each site on the chip carrying the tissue sample.
  • registering the second image and the gene expression information to obtain a registered image of the second image and the gene expression information includes:
  • the second image and the gene expression information are aligned according to the track line in the second image and the track line of the gene expression information to obtain the alignment of the second image and the gene expression information. accurate image.
  • the tissue sample is stained with a cell staining reagent and then imaged, the imaging is performed to obtain a second image of the tissue sample through a FITC channel, and the first image of the tissue sample is obtained through a DAPI channel
  • the cell staining reagent includes: ssDNA staining solution and cell boundary fluorescent staining solution; the ssDNA staining solution includes buffer and ssDNA reagent; the cell boundary fluorescent staining solution includes fluorescent dye.
  • the present invention also proposes a spatial omics single cell data acquisition device. Since the device embodiment of the present invention corresponds to the above-mentioned method embodiment, details not disclosed in the device embodiment can be referred to the above-mentioned method embodiment, and will not be described again in the present invention.
  • Figure 47 is a schematic structural diagram of a spatial omics single cell data acquisition device provided by an embodiment of the present application. As shown in Figure 47, it includes:
  • the acquisition unit 21 is used to acquire staining images of biological samples and obtain gene expression visualization images of the biological samples;
  • the registration unit 22 is used to register the staining image and the gene expression visualization image to obtain a registered image
  • the first segmentation unit 23 is used to perform cell segmentation on the registered image to obtain a cell mask map
  • the correction unit 24 is configured to determine the cells to which the background gene molecules of unknown cells in the gene expression visualization image belong based on the cell mask map;
  • the labeling unit 25 is used to label the corresponding cells to obtain a spatial component molecular expression matrix with cell labels.
  • Cell segmentation is used to obtain a cell mask map; according to the cell mask map, the cells to which the background gene molecules of unknown cells in the gene expression visualization image belong are determined, and the cells are marked to obtain spatial component expression with cell labels.
  • matrix Compared with related technologies, the embodiments of the present application obtain high-precision spatial single-cell data through the processing flow of gene expression matrix diagram, splicing, registration, segmentation and correction.
  • the acquisition unit 21 is also used to:
  • a spliced stained image of the biological sample composed of multiple sub-stained images is obtained through a microscope;
  • Multiple sub-staining images of the biological sample are acquired through the microscope, and the multiple sub-staining images are spliced to obtain a spliced staining image.
  • the acquisition unit 21 includes:
  • a first acquisition module configured to acquire multiple sub-staining images of the biological sample through a microscope; perform a first splicing of the multiple sub-staining images of the biological sample to obtain a first staining image;
  • a judgment module configured to judge whether to perform a second splicing of the plurality of sub-stained images of the biological sample based on the image quality of the first stained image
  • a determination module configured to determine the first stained image as the stained image if not
  • the second acquisition module is configured to, if so, perform a second splicing of multiple sub-staining images of the biological sample to obtain the staining image.
  • the first acquisition module is also used to:
  • the portions of the multiple sub-staining images and the template image that are determined to be overlapping areas are respectively cropped into a plurality of staining image overlapping sub-images and a plurality of template image overlapping sub-images of the same number, so as to be paired into multiple overlapping sub-images. right;
  • Each of the sub-stained images is translated toward the direction of the template image by the offset amount, and spliced together with the template image.
  • the first acquisition module is also used to:
  • the offset between the coordinates, and the coordinates of the second reference image are adjusted based on the offset to splice and generate the spliced stained image.
  • the registration unit 22 includes:
  • An acquisition module configured to acquire a trajectory line in the staining image, and rotate the staining image based on the angle between the trajectory line and the horizontal direction; wherein the staining image and the gene expression visualization image include multiple trajectory lines And/or a plurality of trajectory points, the trajectory points are formed by the intersection of two of the trajectory lines, and each of the multiple trajectory lines has a corresponding index number;
  • a processing module configured to enlarge or reduce the staining image to obtain a third reference image, where the third reference image has the same proportion as the gene expression visualization image;
  • a first determination module configured to determine a target offset based on the gene expression visualization image and the third reference image
  • a registration module configured to move the third reference image based on the target offset to obtain the registered image.
  • the registration unit 22 further includes:
  • a second determination module configured to determine the similarity between the third reference image and the gene expression visualization image after the processing module enlarges or reduces the staining image to obtain a third reference image
  • the coarse registration module is used to use the position corresponding to the maximum similarity value as the coarse registration result.
  • the registration unit 22 is also used to:
  • the staining image and the gene expression visualization image each include multiple trajectory lines and multiple trajectory points.
  • the trajectory points are formed by the intersection of two of the trajectory lines.
  • Each The trajectory line has a corresponding index number;
  • a target image is processed based on the offset information to obtain a registered image, where the target image is an image in a candidate image set corresponding to the track point pair.
  • the device further includes:
  • the second segmentation unit 26 is configured to perform tissue segmentation on the registered image to obtain a tissue mask before the first segmentation unit performs cell segmentation on the registered image to obtain a cell mask map. picture.
  • the second dividing unit 26 is also used to:
  • the gene expression matrix arranges the gene expression levels according to pixel positions;
  • the image data is determined by assigning the gene expression amount at each pixel position in the gene expression matrix to the corresponding pixel position in the registered image;
  • the tissue mask map is obtained by marking the connected areas of the image data according to the foreground pixel points.
  • the device further includes:
  • the calculation unit 27 is configured to perform tissue segmentation on the registered image in the second segmentation unit, and after obtaining the tissue mask map, respectively calculate the outer contour image and inner contour image of the grayscale image corresponding to the tissue mask map. outline image;
  • the pairing unit 28 is used to divide the outer contour image and the inner contour image into N segments respectively, and pair the outer contour image of each segment with the inner contour image of each segment in pairs to obtain N image combinations.
  • each of the image combinations includes an outer contour image and an inner contour image;
  • the calculation unit 27 is also used to separately calculate the pixel density ratio of a segment of the outer contour image and a segment of the inner contour image in each of the image combinations to obtain N pixel density ratios.
  • the pixel density ratio is for each of the image combinations.
  • the calculation unit is also used to calculate and describe the grayscale image quality corresponding to the tissue mask map according to the pixel density ratio.
  • the first dividing unit 23 is also used to:
  • the pixel points belonging to cells or cell outlines in the segmentation result are determined as pixel points belonging to cells, and the segmentation result of the registered image is output to obtain the cell mask map.
  • the first dividing unit 23 is also used to:
  • a watershed algorithm based on distance transformation is used to segment the connected domain where cell adhesion exists, and the segmented cell mask map is obtained.
  • the first dividing unit 23 is also used to:
  • the area of the sub-region to be processed included in each marked area is determined according to the cell area.
  • the area of the sub-region to be processed is positively related to the area of the cell.
  • the sub-region to be processed is used to characterize the corresponding said The smallest processing unit of the marked area;
  • grid processing is performed on the corresponding marked area to obtain the grid coordinates corresponding to each marked area;
  • Data corresponding to the grid coordinates are extracted from the gene expression visualization image and superimposed on the grid coordinates to obtain the cell processing results of the target object.
  • correction unit 24 is also used to:
  • each gene expression feature of the gene expression visualization image is determined as a cell gene expression feature located within the cell and a background gene expression feature located outside the cell;
  • a probability distribution model is fitted based on the spatial position and the signal value of the gene expression characteristics
  • the correction result is output according to the probability value to correct the background gene expression characteristics.
  • the correction unit 24 is also configured to include:
  • the gene expression visualization image determine the initial gene molecules belonging to the target cell and the background gene molecules of the unknown cell
  • the correction unit 24 is also configured to include:
  • the cell to which the background gene molecule belongs is determined based on the gene molecule density and the background gene molecule density.
  • the correction unit 24 is also configured to include:
  • the spatial coordinates and the gene expression characteristic signal values are input into a probability distribution model to obtain the probability score that the background gene molecule belongs to the target cell; the probability distribution model is based on the probability score of the gene molecule sample belonging to the target cell.
  • the spatial coordinates and gene expression characteristic signal values are fitted;
  • the cell to which the background gene molecule belongs is determined based on the probability score.
  • the marking unit 25 is also used to:
  • the cells are stained with ssDNA staining solution and cell boundary fluorescent staining solution, wherein the ssDNA staining solution includes buffer and ssDNA reagent, and the cell boundary fluorescent staining solution includes fluorescent dye.
  • the device further includes a detection unit 29, including:
  • the directed target detection network includes:
  • the backbone Backbone layer is configured to perform feature extraction on the staining image or gene expression visualization image to be tested to obtain multiple feature maps at different scales;
  • the Neck layer is configured to receive the multiple feature maps from the Backbone layer and perform cross-scale fusion on the multiple feature maps to obtain multiple fused feature maps;
  • the detection head Head layer is configured to predict the plurality of fused images to obtain target detection results regarding the staining image or gene expression visualization image to be tested,
  • the target detection results include: classification information, target frame coordinate prediction information, target prediction information and angle prediction information.
  • a determining unit 210 is also included, and the determining unit 210 is used for:
  • the dyeing image plane in which the dyeing image is located includes a first direction and a second direction perpendicular to the first direction, and the dyeing image includes a plurality of first straight tracks transverse to the second direction and a plurality of first straight tracks transverse to the second direction. a plurality of second straight trajectory lines in the first direction,
  • the pixels in the sampling area of the stained image selected by the first sampling strip during the equal-spaced sampling period in the first direction are accumulated and summed according to the first direction to obtain a series of first pixel values.
  • the first candidate point set is formed by the first candidate points obtained by sampling at equal intervals in each first direction;
  • the pixels in the sampling area of the stained image selected by the second sampling strip during the second direction equally spaced sampling period are accumulated and summed in the second direction to obtain a series of second pixel values.
  • the second candidate point set is formed by the second candidate points obtained by equally spaced sampling in each second direction;
  • Grouping steps include:
  • Line fitting steps include:
  • Coordinate calculation steps include:
  • the device further includes: an analysis unit 211, the analysis unit is used to:
  • Gene expression information of cells of the biological sample is obtained based on the registration image of the first image and the gene expression amount information according to the cell boundary.
  • the present application also provides an electronic device, a readable storage medium and a computer program product.
  • Figure 49 shows a schematic block diagram of an example electronic device 300 that may be used to implement embodiments of the present application.
  • Electronic devices are intended to refer to various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers.
  • Electronic devices may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices.
  • the components shown herein, their connections and relationships, and their functions are examples only and are not intended to limit the implementation of the present application as described and/or claimed herein.
  • the device 300 includes a computing unit 301, which can be loaded into a RAM (Random Access Memory) according to a computer program stored in a ROM (Read-Only Memory) 302 or from a storage unit 308. Access the computer program in the memory) 303 to perform various appropriate actions and processes. In the RAM 303, various programs and data required for the operation of the device 300 can also be stored.
  • Computing unit 301, ROM 302 and RAM 303 are connected to each other via bus 304.
  • An I/O (Input/Output, input/output) interface 305 is also connected to the bus 304.
  • I/O interface 305 Multiple components in the device 300 are connected to the I/O interface 305, including: input unit 306, such as a keyboard, mouse, etc.; output unit 307, such as various types of displays, speakers, etc.; storage unit 308, such as a magnetic disk, optical disk, etc. ; and communication unit 309, such as a network card, modem, wireless communication transceiver, etc.
  • the communication unit 309 allows the device 300 to exchange information/data with other devices through computer networks such as the Internet and/or various telecommunications networks.
  • Computing unit 301 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of the computing unit 301 include but are not limited to CPU (Central Processing Unit, Central Processing Unit), GPU (Graphic Processing Units, Graphics Processing Unit), various dedicated AI (Artificial Intelligence, artificial intelligence) computing chips, various running The computing unit of the machine learning model algorithm, DSP (Digital Signal Processor, digital signal processor), and any appropriate processor, controller, microcontroller, etc.
  • the computing unit 301 performs various methods and processes described above, such as spatial omics single cell data acquisition methods.
  • the spatial omics single cell data acquisition method can be implemented as a computer software program, which is tangibly embodied in a machine-readable medium, such as the storage unit 308.
  • part or all of the computer program may be loaded and/or installed onto device 300 via ROM 302 and/or communication unit 309.
  • the computer program When the computer program is loaded into RAM 303 and executed by computing unit 301, one or more steps of the method described above may be performed.
  • the computing unit 301 may be configured to perform the aforementioned spatial omics single cell data acquisition method in any other suitable manner (eg, by means of firmware).
  • These various embodiments may include implementation in one or more computer programs executable and/or interpreted on a programmable system including at least one programmable processor, the programmable processor
  • the processor which may be a special purpose or general purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
  • An output device may be a special purpose or general purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
  • An output device may be a special purpose or general purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
  • Program code for implementing the methods of the present application may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that the program codes, when executed by the processor or controller, cause the functions specified in the flowcharts and/or block diagrams/ The operation is implemented.
  • the program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in connection with an instruction execution system, apparatus, or device.
  • the machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • Machine-readable media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any suitable combination of the foregoing.
  • machine-readable storage media would include electrical connections based on one or more wires, laptop disks, hard drives, RAM, ROM, EPROM (Electrically Programmable Read-Only-Memory, Erasable Programmable Read-Only Memory) Or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory, portable compact disk read-only memory), optical storage device, magnetic storage device, or any suitable combination of the above.
  • the systems and techniques described herein may be implemented on a computer having a display device (eg, CRT (Cathode-Ray Tube, cathode ray tube) or LCD (Cathode-Ray Tube)) for displaying information to the user.
  • a display device eg, CRT (Cathode-Ray Tube, cathode ray tube) or LCD (Cathode-Ray Tube)
  • LCD Liquid Crystal Display
  • keyboard and pointing device e.g., a mouse or a trackball
  • Other kinds of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and may be provided in any form, including Acoustic input, voice input or tactile input) to receive input from the user.
  • the systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., A user's computer having a graphical user interface or web browser through which the user can interact with implementations of the systems and technologies described herein), or including such backend components, middleware components, or any combination of front-end components in a computing system.
  • the components of the system may be interconnected by any form or medium of digital data communication (eg, a communications network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.
  • Computer systems may include clients and servers. Clients and servers are generally remote from each other and typically interact over a communications network. The relationship of client and server is created by computer programs running on corresponding computers and having a client-server relationship with each other.
  • the server can be a cloud server, also known as cloud computing server or cloud host. It is a host product in the cloud computing service system to solve the problem of traditional physical host and VPS service ("Virtual Private Server", or "VPS" for short) Among them, there are defects such as difficult management and weak business scalability.
  • the server can also be a distributed system server or a server combined with a blockchain.
  • artificial intelligence is the study of using computers to simulate certain human thinking processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.). It has both hardware-level technology and software-level technology.
  • Artificial intelligence hardware technology generally includes technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing, etc.; artificial intelligence software technology mainly includes computer vision technology, speech recognition technology, natural language processing technology, and machine learning/depth Learning, big data processing technology, knowledge graph technology and other major directions.

Landscapes

  • Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Medical Informatics (AREA)
  • Epidemiology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Databases & Information Systems (AREA)
  • Bioethics (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Public Health (AREA)
  • Software Systems (AREA)
  • Biophysics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Biotechnology (AREA)
  • Evolutionary Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Spectroscopy & Molecular Physics (AREA)
  • Theoretical Computer Science (AREA)
  • Investigating Or Analysing Biological Materials (AREA)

Abstract

一种空间组学单细胞数据获取方法及装置、电子设备和存储介质,获取生物样本的染色图像,获取所述生物样本的基因表达可视化图像;将所述染色图像与所述基因表达可视化图像进行配准,得到配准后的图像;对所述配准后的图像进行细胞分割,得到细胞掩模图;根据所述细胞掩模图确定所述基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞,并对所属细胞标记,得到带细胞标记的空间组分子表达矩阵。与相关技术相比,本申请通过基因表达矩阵图、拼接、配准、分割和校正的处理流程,以获得高精度的空间单细胞数据。

Description

空间组学单细胞数据获取方法及装置和电子设备
相关技术的交叉引用
本申请基于申请号为PCT/CN2022/102505、申请日为2022年6月29日的PCT专利申请提出、基于申请号为PCT/CN2022/102424、申请日为2022年6月29日的PCT专利申请提出、基于申请号为PCT/CN2022/102360、申请日为2022年6月29日的PCT专利申请提出、基于申请号为PCT/CN2022/102443、申请日为2022年6月29日的PCT专利申请提出、基于申请号为PCT/CN2022/110779、申请日为2022年8月8日的PCT专利申请提出,并要求上述PCT专利申请的优先权,上述PCT专利申请的全部内容在此引入本申请作为参考。
技术领域
本申请涉及数据处理技术领域,尤其涉及一种空间组学单细胞数据获取方法及装置和电子设备。
背景技术
空间组学技术可以揭示出不同时期组织结构内部空间的机能和组织结构之间的异质性,为深入研究生物体组织结构和细胞间通信创造了有利的条件。目前,部分空间转录组技术已经发展到可以捕获整个转录组,但是大部分情况下提供的表达信息矩阵还达不到单细胞层次的分辨率。因此如何实现对单细胞数据的获取是目前亟需解决的问题。
发明内容
本申请提供了一种空间组学单细胞数据获取方法、装置、电子设备和存储介质。
根据本申请的第一方面,提供了一种空间组学单细胞数据获取方法,其中,包括:
获取生物样本的染色图像,获取所述生物样本的基因表达可视化图像;
将所述染色图像与所述基因表达可视化图像进行配准,得到配准后的图像;
对所述配准后的图像进行细胞分割,得到细胞掩模图;
根据所述细胞掩码图确定所述基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞,并对所属细胞标记,得到带细胞标记的空间组分子表达矩阵。
可选的,所述获取生物样本的染色图像包括:
通过显微镜获取所述生物样本的一个染色图像;或
通过显微镜获取所述生物样本的由多个子染色图像拼接的拼接染色图像;或
通过所述显微镜获取所述生物样本的多个子染色图像,对所述多个子染色图像进行拼接,得到拼接染色图像。
可选的,所述获取生物样本的染色图像包括:
通过显微镜获取所述生物样本的多个子染色图像;对所述生物样本的多个子染色图像进行第一拼接,得到第一染色图像;
根据所述第一染色图像的图像质量判断是否对所述生物样本的多个子染色图像进行第二拼接;
若否,将所述第一染色图像确定为所述染色图像;
若是,对所述生物样本的多个子染色图像进行第二拼接,得到所述染色图像。
可选的,所述通过所述显微镜获取所述生物样本的多个子染色图像,对所述多个子染色图像进行拼接,得到拼接染色图像包括:
分别确定多个子染色图像和模板图像的重叠区域;
将所述多个子染色图像和所述模板图像的被确定为重叠区域的部分分别裁剪为多个染色图像重叠子图和数量相同的多个模板图像重叠子图,以配对为多个重叠子图对;
通过对所述多个重叠子图对进行频域计算,分别获得各子染色图像和所述模板图像之间的偏移量;以及
将所述各子染色图像分别朝向所述模板图像的方向平移所述偏移量,并与所述模板图像拼接在一起。
可选的,所述通过所述显微镜获取所述生物样本的多个子染色图像,对所述多个子染色图像进行拼接,得到拼接染色图像包括:
获取所述多个子染色图像以及关于所述生物样本的轨迹线或轨迹点的模板信息;
对所述多个子染色图像进行预拼接得到所述多个子染色图像的预拼接坐标;
根据轨迹线或轨迹点的特征从所述多个子染色图像中选取至少一个第一参考图像,根据所述生物样本的模板信息和所述第一参考图像的预拼接坐标推导全局模板;以及
对于所述多个子染色图像中除了所述第一参考图像之外的第二参考图像,计算所述第二参考图像的预拼接坐标与所述第二参考图像在所述全局模板中的相应模板坐标之间的偏移量,并基于所述偏移量对所述第二参考图像进行坐标调整以拼接生成所述拼接染色图像。
可选的,所述将所述染色图像与所述基因表达可视化图像进行配准,得到配准后的图像包括:
获取所述染色图像中的轨迹线,基于所述轨迹线与水平方向的夹角旋转所述染色图像;其中,所述染色图像和所述基因表达可视化图像包括多条轨迹线和/或多个轨迹点,所述轨迹点是由两条所述轨迹线相交形成的,所述多条轨迹线中的每条轨迹线具有对应的索引号;
将所述染色图像进行放大或缩小得到第三参考图像,所述第三参考图像与所述基因表达可视化图像具有相同的比例;
基于所述基因表达可视化图像和所述第三参考图像确定目标偏移量;
基于所述目标偏移量移动所述第三参考图像,得到所述配准后的图像。
可选的,在将所述染色图像进行放大或缩小得到第三参考图像之后,所述方法还包括:
确定所述第三参考图像与基因表达可视化图像之间的相似度;
将相似度最大值对应的位置作为粗配准结果。
可选的,将所述染色图像与所述基因表达可视化图像进行配准,得到配准后的图像包括:
获取染色图像和基因表达可视化图像,所述染色图像和所述基因表达可视化图像均包括多条轨迹线和多个轨迹点,所述轨迹点是由两条所述轨迹线相交形成的,每条所述轨迹线具有对应的索引号;
对所述染色图像进行预处理,获取候选图像集合;
确定所述候选图像集合对应的二值图集合;
基于所述二值图集合与所述基因表达可视化图像之间的相似度,确定所述二值图集合与所述基因表达可视化图像中具有对应关系的轨迹点对;
基于所述轨迹点对确定偏移信息;
基于所述偏移信息处理目标图像,以得到配准后的图像,所述目标图像为所述轨迹点对所对应的候选图像集合中的图像。
可选的,在对所述配准后的图像进行细胞分割,得到细胞掩模图之前,所述方法还包括:
对所述配准后的图像进行组织分割,得到组织掩模图。
可选的,所述对所述配准后的图像进行组织分割,得到组织掩模图包括:
获取所述配准后的图像中待分割的目标组织的基因表达量并确定所述配准后的图像的基因表达矩阵,所述基因表达矩阵按照像素位置对所述基因表达量进行排列;
通过将所述基因表达矩阵中每一像素位置的基因表达量赋值于配准后的图像中对应的像素位置确定图像数据;
通过对所述图像数据进行图像处理以确定所述图像数据的前景像素点;
根据所述前景像素点对所述图像数据的连通区域进行标记得到所述组织掩模图。
可选的,在对所述配准后的图像进行组织分割,得到组织掩模图之后,所述方法还包括:
分别计算得到组织掩模图对应的灰度图像的外轮廓图像与内轮廓图像;
将所述外轮廓图像与所述内轮廓图像分别分为N段,并将每段所述外轮廓图像与每段所述内轮廓图像两两配对,得到N个图像组合,每个所述图像组合包括一段外轮廓图像与一段内轮廓图像;
分别计算每个所述图像组合中一段外轮廓图像与一段内轮廓图像的像素密度比值,得到N个所述像素密度比值,所述像素密度比值为每个所述图像组合中一段外轮廓图像与一段内轮廓图像的像素占比的比值,所述像素占比为像素点与总像素点的比值;
根据所述像素密度比值计算描述所述组织掩模图对应的灰度图像质量。
可选的,所述对所述配准后的图像进行细胞分割,得到细胞掩模图包括:
将所述配准后的图像输入所述图像分割模型,获得所述配准后的图像中各个像素点的分割结果,所述分割结果包括属于细胞、属于细胞轮廓或者图像背景;
将所述分割结果属于细胞或细胞轮廓的像素点确定属于细胞的像素点,输出所述配准后的图像的分割结果,得到所述细胞掩模图。
可选的,所述对所述配准后的图像进行细胞分割,得到细胞掩模图包括:
对所述基因表达可视化图像进行预处理,得到预处理图;
将所述预处理图进行二值化处理,得到初始掩模图;
根据所述初始掩模图,利用基于距离变换的分水岭算法对存在细胞粘连的连通域进行分割,得到分割后的所述细胞掩模图。
可选的,所述对所述配准后的图像进行细胞分割,得到细胞掩模图包括:
基于所述染色图像确定所述目标对象的各个组织类型对应的标注区域和细胞面积;
依据所述细胞面积确定每个所述标注区域包含的待处理子区域的面积,所述待处理子区域的面积与所述细胞面积正相关,所述待处理子区域用于表征对应的所述标注区域的最小处理单元;
依据每个所述待处理子区域的面积,将对应的所述标注区域进行网格化处理,得到每个所述标注区域对应的网格化坐标;
从所述基因表达可视化图像中提取所述网格化坐标对应的数据,并叠加至所述网格化坐标,得到所述目标对象的细胞处理结果。
可选的,所述根据所述细胞掩码图确定所述基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞包括:
基于所述细胞掩模图,将所述基因表达可视化图像的每个基因表达特征分别确定为位于细胞内的细胞基因表达特征及位于细胞外的背景基因表达特征;
对每个所述细胞基因表达特征,通过空间位置和基因表达特征的信号值拟合出概率分布模型;
基于所述概率分布模型,确定出针对位于一目标细胞的预设范围内的目标背景基因表达特征属于所述目标细胞的概率值;
根据所述概率值输出校正结果以进行背景基因表达特征的校正。
可选的,所述根据所述细胞掩码图确定所述基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞包括:
根据所述基因表达可视化图像,确定所属于目标细胞的初始基因分子以及未知所属细胞的背景基因分子;
获取所述初始基因分子的坐标信息;
根据所述坐标信息,确定所述目标细胞的中心点坐标;
根据所述中心点坐标和所述坐标信息,构建维诺图;
确定所述维诺图范围内的背景基因分子的所属细胞。
可选的,所述根据所述细胞掩码图确定所述基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞包括:
确定所述基因表达可视化图像中所属于目标细胞的基因分子的初始分子数量以及所述所属于目标细胞的基因分子所占的目标区域的初始轮廓面积;
根据所述分子数量和所述初始轮廓面积,确定所述目标细胞的基因分子密度;
确定所述目标区域的预设区域范围内的背景基因分子的分子数量以及所述预设区域范围的区域面积;
根据所述背景基因分子的分子数量和区域面积,确定背景基因分子密度;
根据所述基因分子密度与所述背景基因分子密度确定所述背景基因分子的所属细胞。
可选的,所述根据所述细胞掩码图确定所述基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞包括:
确定所述基因表达可视化图像中所属于目标细胞的基因分子所占的目标区域;
确定所述目标区域的预设校正范围内的未知所属细胞的背景基因分子的空间坐标及基因表达特征信号值;
将所述空间坐标和所述基因表达特征信号值输入概率分布模型,以得到所述背景基因分子所属于所述目标细胞的概率分数;所述概率分布模型根据所属于目标细胞的基因分子样本的空间坐标及基因表达特征信号值拟合得到;
根据所述概率分数确定所述背景基因分子的所属细胞。
可选的,所述对所属细胞标记包括:
以ssDNA染液和细胞边界荧光染色液对所属细胞进行染色,其中,所述ssDNA染液包括缓冲液和ssDNA试剂,所述细胞边界荧光染色液包括荧光染料。
可选的,所述方法还包括:
获取待测染色图像或基因表达可视化图像;以及
将所述待测染色图像或基因表达可视化图像输入有向目标检测网络,以获得目标检测结果,
其中所述有向目标检测网络包括:
主干Backbone层,被配置为对待测染色图像或基因表达可视化图像执行特征提取,以获得不同尺度的多个特征图;
颈部Neck层,被配置为从Backbone层接收所述多个特征图,并对所述多个特征图进行跨尺度融合,以获得多个融合特征图;以及
检测头Head层,被配置为对所述多个融合图像进行预测,以获得关于所述待测染色图像或基因表达可视化图像的目标检测结果,
其中所述目标检测结果包括:分类信息、目标框坐标预测信息、目标预测信息和角度预测信息。
可选的,所述染色图像所在的染色图像平面包括第一方向和与所述第一方向垂直的第二方向,所述染色图像包括横向于所述第二方向的多个第一直轨迹线和横向于所述第一方向的多个第二直轨迹线,
所述染色图像中的点坐标的确定方法包括:
采样步骤,包括:
应用第一采样条沿所述第一方向对所述染色图像进行第一方向等间隔采样以确定第一候选点集合,其中对于每次第一方向等间隔采样,执行以下子步骤:
将所述第一采样条在该次第一方向等间隔采样期间所选中的所述染色图像的采样区域内的像素按所述第一方向进行像素值累加求和以得到一系列第一像素值和;以及
确定所述一系列第一像素值和的极值点,并且对于确定的每个极值点:确定该次第一方向等间隔采样所获得的一个对应第一候选点,该对应第一候选点在所述第二方向上的坐标为该极值点所对应的第二方向位置在所述第二方向上的坐标,该对应第一候选点在所述第一方向上的坐标基于在该次第一方向等间隔采样期间所述第一采样条在所述第一方向上的位置确定,
其中,由每次第一方向等间隔采样所获得的第一候选点形成所述第一候选点集合;
应用第二采样条沿所述第二方向对所述染色图像进行第二方向等间隔采样以确定第二候选点集合,其中对于每次第二方向等间隔采样,执行以下子步骤:
将所述第二采样条在该次第二方向等间隔采样期间所选中的所述染色图像的采 样区域内的像素按所述第二方向进行像素值累加求和以得到一系列第二像素值和;以及
确定所述一系列第二像素值和的极值点,并且对于确定的每个极值点:确定该次第二方向等间隔采样所获得的一个对应第二候选点,该对应第二候选点在所述第一方向上的坐标为该极值点所对应的第一方向位置在所述第一方向上的坐标,该对应第二候选点在所述第二方向上的坐标基于在该次第二方向等间隔采样期间所述第二采样条在所述第二方向上的位置确定,
其中,由每次第二方向等间隔采样所获得的第二候选点形成所述第二候选点集合;
分组步骤,包括:
将所述第一候选点集合中的第一候选点分成多个第一候选点组;以及
将所述第二候选点集合中的第二候选点分成多个第二候选点组;
直线拟合步骤,包括:
对每个第一候选点组中的第一候选点进行直线拟合以得到一个相应的第一直线解析式;以及
对每个第二候选点组中的第二候选点进行直线拟合以得到一个相应的第二直线解析式;以及
坐标计算步骤,包括:
计算每个第一直线解析式与每个第二直线解析式的交点的坐标。
可选的,在对所属细胞标记,得到带细胞标记的空间组分子表达矩阵之后,所述方法还包括:
获取生物样本的第一图像,所述第一图像包括所述生物样本经染色的细胞边界;
获取所述生物样本的第二图像,所述第二图像包括所述生物样本经染色的遗传物质;
获取所述生物样本的基因表达量信息;
将所述第二图像与所述第一图像配准,得到第二图像与第一图像的配准图像;
将所述第二图像与所述基因表达量信息进行配准,得到第二图像与第基因表达量信息的配准图像;
根据第二图像与第一图像的配准图像、第二图像与基因表达量信息的配准图像获取第一图像与基因表达量信息的配准图像;
根据第一图像与基因表达量信息的配准图像获取所述生物样本的细胞边界;
基于第一图像与基因表达量信息的配准图像根据所述细胞边界获取所述生物样本的细胞的基因表达信息。
第二方面,还提供一种空间组学单细胞数据获取装置,包括:
获取单元,用于获取生物样本的染色图像,获取所述生物样本的基因表达可视化图像;
配准单元,用于将所述染色图像与所述基因表达可视化图像进行配准,得到配准后的图像;
第一分割单元,用于对所述配准后的图像进行细胞分割,得到细胞掩模图;
修正单元,用于根据所述细胞掩码图确定所述基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞;
标记单元,用于对所属细胞标记,得到带细胞标记的空间组分子表达矩阵。
可选的,所述获取单元,还用于:
通过显微镜获取所述生物样本的一个染色图像;或
通过显微镜获取所述生物样本的由多个子染色图像拼接的拼接染色图像;或
通过所述显微镜获取所述生物样本的多个子染色图像,对所述多个子染色图像进行拼接,得到拼接染色图像。
可选的,所述获取单元包括:
第一获取模块,用于通过显微镜获取所述生物样本的多个子染色图像;对所述生物样本的多个子染色图像进行第一拼接,得到第一染色图像;
判断模块,用于根据所述第一染色图像的图像质量判断是否对所述生物样本的多 个子染色图像进行第二拼接;
确定模块,用于若否,将所述第一染色图像确定为所述染色图像;
第二获取模块,用于若是,对所述生物样本的多个子染色图像进行第二拼接,得到所述染色图像。
可选的,所述第一获取模块,还用于:
分别确定多个子染色图像和模板图像的重叠区域;
将所述多个子染色图像和所述模板图像的被确定为重叠区域的部分分别裁剪为多个染色图像重叠子图和数量相同的多个模板图像重叠子图,以配对为多个重叠子图对;
通过对所述多个重叠子图对进行频域计算,分别获得各子染色图像和所述模板图像之间的偏移量;以及
将所述各子染色图像分别朝向所述模板图像的方向平移所述偏移量,并与所述模板图像拼接在一起。
可选的,所述第一获取模块,还用于:
获取所述多个子染色图像以及关于所述生物样本的轨迹线或轨迹点的模板信息;
对所述多个子染色图像进行预拼接得到所述多个子染色图像的预拼接坐标;
根据轨迹线或轨迹点的特征从所述多个子染色图像中选取至少一个第一参考图像,根据所述生物样本的模板信息和所述第一参考图像的预拼接坐标推导全局模板;以及
对于所述多个子染色图像中除了所述第一参考图像之外的第二参考图像,计算所述第二参考图像的预拼接坐标与所述第二参考图像在所述全局模板中的相应模板坐标之间的偏移量,并基于所述偏移量对所述第二参考图像进行坐标调整以拼接生成所述拼接染色图像。
可选的,所述配准单元包括:
获取模块,用于获取所述染色图像中的轨迹线,基于所述轨迹线与水平方向的夹角旋转所述染色图像;其中,所述染色图像和所述基因表达可视化图像包括多条轨迹线和/或多个轨迹点,所述轨迹点是由两条所述轨迹线相交形成的,所述多条轨迹线中的每条轨迹线具有对应的索引号;
处理模块,用于将所述染色图像进行放大或缩小得到第三参考图像,所述第三参考图像与所述基因表达可视化图像具有相同的比例;
第一确定模块,用于基于所述基因表达可视化图像和所述第三参考图像确定目标偏移量;
配准模块,用于基于所述目标偏移量移动所述第三参考图像,得到所述配准后的图像。
可选的,所述配准单元还包括:
第二确定模块,用于在所述处理模块将所述染色图像进行放大或缩小得到第三参考图像之后,确定所述第三参考图像与基因表达可视化图像之间的相似度;
粗配准模块,用于将相似度最大值对应的位置作为粗配准结果。
可选的,所述配准单元还用于:
获取染色图像和基因表达可视化图像,所述染色图像和所述基因表达可视化图像均包括多条轨迹线和多个轨迹点,所述轨迹点是由两条所述轨迹线相交形成的,每条所述轨迹线具有对应的索引号;
对所述染色图像进行预处理,获取候选图像集合;
确定所述候选图像集合对应的二值图集合;
基于所述二值图集合与所述基因表达可视化图像之间的相似度,确定所述二值图集合与所述基因表达可视化图像中具有对应关系的轨迹点对;
基于所述轨迹点对确定偏移信息;
基于所述偏移信息处理目标图像,以得到配准后的图像,所述目标图像为所述轨迹点对所对应的候选图像集合中的图像。
可选的,所述装置还包括:
第二分割单元,用于在所述第一分割单元对所述配准后的图像进行细胞分割,得 到细胞掩模图之前,对所述配准后的图像进行组织分割,得到组织掩模图。
可选的,所述第二分割单元还用于:
获取所述配准后的图像中待分割的目标组织的基因表达量并确定所述配准后的图像的基因表达矩阵,所述基因表达矩阵按照像素位置对所述基因表达量进行排列;
通过将所述基因表达矩阵中每一像素位置的基因表达量赋值于配准后的图像中对应的像素位置确定图像数据;
通过对所述图像数据进行图像处理以确定所述图像数据的前景像素点;
根据所述前景像素点对所述图像数据的连通区域进行标记得到所述组织掩模图。
可选的,所述装置还包括:
计算单元,用于在所述第二分割单元对所述配准后的图像进行组织分割,得到组织掩模图之后,分别计算得到组织掩模图对应的灰度图像的外轮廓图像与内轮廓图像;
配对单元,用于将所述外轮廓图像与所述内轮廓图像分别分为N段,并将每段所述外轮廓图像与每段所述内轮廓图像两两配对,得到N个图像组合,每个所述图像组合包括一段外轮廓图像与一段内轮廓图像;
所述计算单元,还用于分别计算每个所述图像组合中一段外轮廓图像与一段内轮廓图像的像素密度比值,得到N个所述像素密度比值,所述像素密度比值为每个所述图像组合中一段外轮廓图像与一段内轮廓图像的像素占比的比值,所述像素占比为像素点与总像素点的比值;
所述计算单元,还用于根据所述像素密度比值计算描述所述组织掩模图对应的灰度图像质量。
可选的,所述第一分割单元,还用于:
将所述配准后的图像输入所述图像分割模型,获得所述配准后的图像中各个像素点的分割结果,所述分割结果包括属于细胞、属于细胞轮廓或者图像背景;
将所述分割结果属于细胞或细胞轮廓的像素点确定属于细胞的像素点,输出所述配准后的图像的分割结果,得到所述细胞掩模图。
可选的,所述第一分割单元,还用于:
对所述基因表达可视化图像进行预处理,得到预处理图;
将所述预处理图进行二值化处理,得到初始掩模图;
根据所述初始掩模图,利用基于距离变换的分水岭算法对存在细胞粘连的连通域进行分割,得到分割后的所述细胞掩模图。
可选的,所述第一分割单元,还用于:
基于所述染色图像确定所述目标对象的各个组织类型对应的标注区域和细胞面积;
依据所述细胞面积确定每个所述标注区域包含的待处理子区域的面积,所述待处理子区域的面积与所述细胞面积正相关,所述待处理子区域用于表征对应的所述标注区域的最小处理单元;
依据每个所述待处理子区域的面积,将对应的所述标注区域进行网格化处理,得到每个所述标注区域对应的网格化坐标;
从所述基因表达可视化图像中提取所述网格化坐标对应的数据,并叠加至所述网格化坐标,得到所述目标对象的细胞处理结果。
可选的,所述修正单元,还用于:
基于所述细胞掩模图,将所述基因表达可视化图像的每个基因表达特征分别确定为位于细胞内的细胞基因表达特征及位于细胞外的背景基因表达特征;
对每个所述细胞基因表达特征,通过空间位置和基因表达特征的信号值拟合出概率分布模型;
基于所述概率分布模型,确定出针对位于一目标细胞的预设范围内的目标背景基因表达特征属于所述目标细胞的概率值;
根据所述概率值输出校正结果以进行背景基因表达特征的校正。
可选的,所述修正单元,还用于包括:
根据所述基因表达可视化图像,确定所属于目标细胞的初始基因分子以及未知所属细胞的背景基因分子;
获取所述初始基因分子的坐标信息;
根据所述坐标信息,确定所述目标细胞的中心点坐标;
根据所述中心点坐标和所述坐标信息,构建维诺图;
确定所述维诺图范围内的背景基因分子的所属细胞。
可选的,所述修正单元,还用于包括:
确定所述基因表达可视化图像中所属于目标细胞的基因分子的初始分子数量以及所述所属于目标细胞的基因分子所占的目标区域的初始轮廓面积;
根据所述分子数量和所述初始轮廓面积,确定所述目标细胞的基因分子密度;
确定所述目标区域的预设区域范围内的背景基因分子的分子数量以及所述预设区域范围的区域面积;
根据所述背景基因分子的分子数量和区域面积,确定背景基因分子密度;
根据所述基因分子密度与所述背景基因分子密度确定所述背景基因分子的所属细胞。
可选的,所述修正单元,还用于包括:
确定所述基因表达可视化图像中所属于目标细胞的基因分子所占的目标区域;
确定所述目标区域的预设校正范围内的未知所属细胞的背景基因分子的空间坐标及基因表达特征信号值;
将所述空间坐标和所述基因表达特征信号值输入概率分布模型,以得到所述背景基因分子所属于所述目标细胞的概率分数;所述概率分布模型根据所属于目标细胞的基因分子样本的空间坐标及基因表达特征信号值拟合得到;
根据所述概率分数确定所述背景基因分子的所属细胞。
可选的,所述标记单元,还用于:
以ssDNA染液和细胞边界荧光染色液对所属细胞进行染色,其中,所述ssDNA染液包括缓冲液和ssDNA试剂,所述细胞边界荧光染色液包括荧光染料。
可选的,所述装置还包括检测单元,包括:
获取待测染色图像或基因表达可视化图像;以及
将所述待测染色图像或基因表达可视化图像输入有向目标检测网络,以获得目标检测结果,
其中所述有向目标检测网络包括:
主干Backbone层,被配置为对待测染色图像或基因表达可视化图像执行特征提取,以获得不同尺度的多个特征图;
颈部Neck层,被配置为从Backbone层接收所述多个特征图,并对所述多个特征图进行跨尺度融合,以获得多个融合特征图;以及
检测头Head层,被配置为对所述多个融合图像进行预测,以获得关于所述待测染色图像或基因表达可视化图像的目标检测结果,
其中所述目标检测结果包括:分类信息、目标框坐标预测信息、目标预测信息和角度预测信息。
可选的,所述染色图像所在的染色图像平面包括第一方向和与所述第一方向垂直的第二方向,所述染色图像包括横向于所述第二方向的多个第一直轨迹线和横向于所述第一方向的多个第二直轨迹线,
所述染色图像中的点坐标的确定方法包括:
采样步骤,包括:
应用第一采样条沿所述第一方向对所述染色图像进行第一方向等间隔采样以确定第一候选点集合,其中对于每次第一方向等间隔采样,执行以下子步骤:
将所述第一采样条在该次第一方向等间隔采样期间所选中的所述染色图像的采样区域内的像素按所述第一方向进行像素值累加求和以得到一系列第一像素值和;以及
确定所述一系列第一像素值和的极值点,并且对于确定的每个极值点:确定该次第一方向等间隔采样所获得的一个对应第一候选点,该对应第一候选点在所述第二方向上的坐标为该极值点所对应的第二方向位置在所述第二方向上的坐标,该对应第一候选点在所述第一方向上的坐标基于在该次第一方向等间隔采样期间所述第一采样条 在所述第一方向上的位置确定,
其中,由每次第一方向等间隔采样所获得的第一候选点形成所述第一候选点集合;
应用第二采样条沿所述第二方向对所述染色图像进行第二方向等间隔采样以确定第二候选点集合,其中对于每次第二方向等间隔采样,执行以下子步骤:
将所述第二采样条在该次第二方向等间隔采样期间所选中的所述染色图像的采样区域内的像素按所述第二方向进行像素值累加求和以得到一系列第二像素值和;以及
确定所述一系列第二像素值和的极值点,并且对于确定的每个极值点:确定该次第二方向等间隔采样所获得的一个对应第二候选点,该对应第二候选点在所述第一方向上的坐标为该极值点所对应的第一方向位置在所述第一方向上的坐标,该对应第二候选点在所述第二方向上的坐标基于在该次第二方向等间隔采样期间所述第二采样条在所述第二方向上的位置确定,
其中,由每次第二方向等间隔采样所获得的第二候选点形成所述第二候选点集合;
分组步骤,包括:
将所述第一候选点集合中的第一候选点分成多个第一候选点组;以及
将所述第二候选点集合中的第二候选点分成多个第二候选点组;
直线拟合步骤,包括:
对每个第一候选点组中的第一候选点进行直线拟合以得到一个相应的第一直线解析式;以及
对每个第二候选点组中的第二候选点进行直线拟合以得到一个相应的第二直线解析式;以及
坐标计算步骤,包括:
计算每个第一直线解析式与每个第二直线解析式的交点的坐标。
可选的,所述装置还包括:分析单元,所述分析单元用于:
获取生物样本的第一图像,所述第一图像包括所述生物样本经染色的细胞边界;
获取所述生物样本的第二图像,所述第二图像包括所述生物样本经染色的遗传物质;
获取所述生物样本的基因表达量信息;
将所述第二图像与所述第一图像配准,得到第二图像与第一图像的配准图像;
将所述第二图像与所述基因表达量信息进行配准,得到第二图像与第基因表达量信息的配准图像;
根据第二图像与第一图像的配准图像、第二图像与基因表达量信息的配准图像获取第一图像与基因表达量信息的配准图像;
根据第一图像与基因表达量信息的配准图像获取所述生物样本的细胞边界;
基于第一图像与基因表达量信息的配准图像根据所述细胞边界获取所述生物样本的细胞的基因表达信息。
根据本申请的第三方面,提供了一种电子设备,包括:
至少一个处理器;以及
与所述至少一个处理器通信连接的存储器;其中,
所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行前述第一方面所述的方法。
根据本申请的第四方面,提供了一种存储有计算机指令的非瞬时计算机可读存储介质,其中,所述计算机指令用于使所述计算机执行前述第一方面所述的方法。
根据本申请的第五方面,提供了一种计算机程序产品,包括计算机程序,所述计算机程序在被处理器执行时实现如前述第一方面所述的方法。
本申请提供的空间组学单细胞数据获取方法、装置、电子设备和存储介质,获取生物样本的染色图像,获取所述生物样本的基因表达可视化图像;将所述染色图像与所述基因表达可视化图像进行配准,得到配准后的图像;对所述配准后的图像进行细胞分割,得到细胞掩模图;根据所述细胞掩码图确定所述基因表达可视化图像中未知 所属细胞的背景基因分子的所属细胞,并对所属细胞标记,得到带细胞标记的空间组分子表达矩阵。与相关技术相比,本申请实施例通过基因表达矩阵图、拼接、配准、分割和校正的处理流程,以获得高精度的空间单细胞数据。
应当理解,本部分所描述的内容并非旨在标识本申请的实施例的关键或重要特征,也不用于限制本申请的范围。本申请的其它特征将通过以下的说明书而变得容易理解。
附图说明
附图用于更好地理解本方案,不构成对本申请的限定。其中:
图1为本申请实施例所提供的一种空间组学单细胞数据获取方法的流程示意图;
图2为本申请实施例提供的一种执行空间组学单细胞数据的获取示意图;
图3为本申请实施例提供的一种获取生物样本的染色图像方法的流程示意图;
图4为本申请实施例提供的一种对多个子染色图像进行拼接方法的流程示意图;
图5为本申请实施例提供的另一种对多个子染色图像进行拼接方法的流程示意图;
图6为本申请实施例提供的一种多个视场在空间上的分布的示意图;
图7为本申请实施例提供的一种图像拼接方法的预拼接结果示意图;
图8a为本申请实施例提供的一种预拼接时在水平方向上扫描得到的行向相邻的两个染色图像之间的位置关系示意图;
图8b为本申请实施例提供的一种预拼接时在竖直方向上扫描得到的列向相邻的两个染色图像之间的位置关系示意图;
图9为本申请实施例提供的一种用于拼接生物样本的单个视场模板的示意图;
图10为本申请实施例提供的一种用于拼接生物样本的单个视场模板的构造过程示意图;
图11为本申请实施例提供的一种将染色图像与基因表达可视化图像进行配准的方法流程示意图;
图12为本申请实施例提供的一种染色图像的示意图;
图13为本申请实施例提供的一种第三参考图像的示意图;
图14a为本申请实施例提供的一种具有多个周期的第三参考图像,
图14b为本申请实施例提供的一种多个周期的基因表达可视化图像;
图15为本申请实施例提供的一种以第一偏移量为中心所确定的预设周期的示意图;
图16为本申请实施例提供的另一种将染色图像与基因表达可视化图像进行配准的方法流程示意图;
图17a为本申请实施例提供的一种候选图像的示意图;
图17b为本申请实施例提供的一种初始二值图的示意图;
图17c为本申请实施例提供的一种目标二值图的示意图;
图18为本申请实施例提供的另一种将染色图像与基因表达可视化图像进行配准的方法流程示意图;
图19为本申请实施例提供的一种样本图像的组织分割方法的确定图像数据的流程图;
图20为本申请实施例提供的一种样本图像的组织分割方法的图像数据示意图;
图21为本申请实施例提供的一种样本图像的组织分割方法的2d卷积示意图;
图22为本申请实施例提供的一种样本图像的组织分割方法的低级特征示意图;
图23为本申请实施例提供的一种计算描述组织掩模图对应的灰度图像质量的方法流程示意图;
图24为本申请实施例提供的一种外部轮廓图像与内部轮廓图像的关系结构示意图;
图25为本申请实施例提供的另一种外部轮廓图像与内部轮廓图像的关系结构示意图;
图26为本申请实施例提供的一种对配准后的图像进行细胞分割的方法流程示意 图;
图27为本申请实施例提供的一种图像分割模型在鼠脑图像上的分割效果;
图28为本申请实施例提供的另一种对配准后的图像进行细胞分割的方法流程示意图;
图29示出了本申请实施例提供的另一种细胞分割的处理方法的流程示意图;
图30示出了本申请实施例提供的基于本实施例方法的示例流程示意图;
图31示出了本申请实施例提供的基因表达图的效果示例图;
图32示出了本申请实施例提供的经锐化处理得到锐化图的效果示例图;
图33示出了本申请实施例提供的初始掩模图的效果示意图;
图34示出了本申请实施例提供的输出掩模图的效果示意图;
图35为本申请实施例提供的另一种对配准后的图像进行细胞分割的方法流程示意图;
图36为本申请实施例提供的一种确定基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞的方法流程示意图;
图37为本申请实施例提供的一种DNB与细胞膜的对应关系示意图;
图38为本申请实施例提供的一种校正背景DNB的校正结果示意图;
图39为本申请实施例提供的另一种确定基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞的方法流程示意图;
图40为本申请实施例提供的另一种确定基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞的方法流程示意图;
图41为本申请实施例提供的一种目标细胞的中心点的示意图;
图42为本申请实施例提供的另一种确定基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞的方法流程示意图;
图43为本申请实施例提供的一种染色图像中的点坐标的确定方法的流程示意图;
图44为本申请实施例提供的一种染色图像的示意图;
图45为本申请实施例提供的一种有向目标检测方法流程示意图;
图46为本申请实施例提供的一种生物样本的细胞基因表达信息获取方法流程示意图;
图47为本申请实施例提供的一种空间组学单细胞数据获取装置的结构示意图;
图48为本申请实施例提供的另一种空间组学单细胞数据获取装置的结构示意图;
图49为本申请实施例提供的示例电子设备的示意性框图。
具体实施方式
以下结合附图对本申请的示范性实施例做出说明,其中包括本申请实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本申请的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。
下面参考附图描述本申请实施例的空间组学单细胞数据获取方法、装置、电子设备和存储介质。
图1为本申请实施例所提供的一种空间组学单细胞数据获取方法的流程示意图。
如图1所示,该方法包含以下步骤:
步骤101,获取生物样本的染色图像,获取所述生物样本的基因表达可视化图像;
依据空间组学技术(Spatial resolved technology,SOP),对生物样本进行染色拍图,由显微镜拍摄时空芯片上的生物样本而得到的,得到染色图像。
作为本申请实施例的一种可行方式,染色可以通过但不限于下述技术实现,例如:苏木素伊红染色(Hematoxylin and Eosin Staining,HE)、ssDNA及DAPI,具体的,本申请实施例不做限定。
获取的显微镜拍照图(染色图像),一般为tif格式,包含但不限于16bit或8bit,彩色图和灰度图均可,具体的,本申请实施例不进行限定。
将生物样本进行空间测序,并通过测序序列比对分析等标准流程获取到生物样本的基因表达矩阵,并将基因表达矩阵转换成基因表达可视化图像。
时空芯片上有用于采集生物样本基因的规则排列的位点,每个位点可以捕获生物样本的基因序列,通过基因测序可以获得每个位点的基因序列或碱基的数量,然后可以将该位点的基因序列的数量作为基因表达矩阵中元素的值,从而使基因表达矩阵的元素与时空芯片的位点相对应(如一个元素对应一个位点,基因表达矩阵的第一行第一列的元素对应时空芯片左上角的位点)依次类推就可以得到基因表达矩阵,然后根据基因表达矩阵绘制基因表达可视化图像。其中,基因表达可视化图像中的像素点对应基因表达矩阵的元素,像素点的像素值对应元素的值,所以基因表达可视化图像包含同一生物样本的空间信息。
有关测序序列比对分析的实现方法可参阅相关技术中的方法,本申请实施例在此不再进行一一赘述。
获取所述生物样本的基因表达可视化图像,包含但不限于以下方式:对所述生物样本进行空间组学测序序列处理,得到基因表达矩阵;将所述基因表达矩阵转换为对应的基因表达可视化图像。
步骤102,将所述染色图像与所述基因表达可视化图像进行配准,得到配准后的图像;
在一些实施例中,基于拼接染色图像中的线特征实现配准;
或者,在一些实施例中,通过图像上的轨迹点(track点),以及利用组织轮廓作为参照物,通过坐标计算实现在像素级别精度的准确自动配准;
或者,在一些实施例中,通过拼接染色图像的组织掩模实现配准。具体的,本申请实施例对配准方式不进行限定。
步骤103,对所述配准后的图像进行细胞分割,得到细胞掩模图;
将配准后的图像输入图像分割模型,以输出细胞掩模图,该细胞掩膜图中包含细胞核。
作为本申请实施例的一种可行方式,在执行细胞分割之前,还可以先执行组织分割,做完组织分割后可以只关注组织区域不关注组织外,提升样本数据的信噪比。
步骤104,根据所述细胞掩码图确定所述基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞,并对所属细胞标记,得到带细胞标记的空间组分子表达矩阵;
步骤103中在完成细胞分割后,至少包含细胞核,但是还存在一些背景基因分子未被标记为一个细胞的场景。
对未分配到细胞的DNA纳米球(DNB)位置上的背景基因进行重分配。以该位置为中心,圈选一定的区域(例如100*100pixel),对其中包含的细胞分别进行高斯混合模型拟合,假设,其中包含N个细胞,那对于该位置会有N个概率值,选取最大的概率的细胞作为该位置归属的细胞。每个未归属的有表达的位置都进行以上操作。通过二次修正,能够提升信噪比,缓解细胞分割,配准等的精度问题。
实际应用中,为了防止过分配,在选取最大的概率的细胞作为归属细胞时通过设定概率阈值的方式,实现细胞归属标记,当概率太低时,不对归属的细胞进行标记。具体的对概率阈值不做限定。
图1已说明空间组学单细胞数据获取方法,参阅图2,图2为本申请实施例提供的一种执行空间组学单细胞数据的获取示意图,其中,该图是以鼠脑切片为例进行的示意,其中A对应步骤101,C对应步骤102,D对应步骤103,E对应步骤104。
获取生物样本的染色图像,获取所述生物样本的基因表达可视化图像;将所述染色图像与所述基因表达可视化图像进行配准,得到配准后的图像;对所述配准后的图像进行细胞分割,得到细胞掩模图;根据所述细胞掩码图确定所述基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞,并对所属细胞标记,得到带细胞标记的空间组分子表达矩阵。与相关技术相比,本申请实施例通过基因表达矩阵图、拼接、配准、分割和校正的处理流程,以获得高精度的空间单细胞数据。
作为本申请实施例的一种可行方式,在步骤101中执行获取生物样本的染色图像时,可以通过但不局限于以下三种方式获取:
方式一:通过显微镜获取所述生物样本的一个染色图像;
方式二:通过显微镜获取所述生物样本的由多个子染色图像拼接的拼接染色图像;
方式三:通过所述显微镜获取所述生物样本的多个子染色图像,对所述多个子染色图像进行拼接,得到拼接染色图像。
其中方式一和方式二是显微镜下执行拼接的结果,方式一是直接通过显微镜获取到一个大图(染色图像),方式二是在获取多个小图(子染色图像)后,采用显微镜对多个子染色图像进行拼接,得到染色图像;方式三是在显微镜拼接的结果不符合需求时,通过预设算法进行拼接所得到的染色图像的拼接结果。在具体本申请实施例对染色图像的获取方式不进行限定。
在一些实施例,如图3所示,图3为本申请实施例所提供的获取生物样本的染色图像方法的流程示意图。包括:
步骤1011,通过显微镜获取所述生物样本的多个子染色图像;对所述生物样本的多个子染色图像进行第一拼接,得到第一染色图像。
可以采用但不局限于以下方式执行拼接,如图4所示,包括:
步骤10111,分别确定多个子染色图像和模板图像的重叠区域;
在一些示例中,确定子染色图像和模板图像的重叠区域可以包括:确定子染色图像与模板图像的匹配方向;以及在所确定的匹配方向上,在子染色图像和模板图像中选择相邻的相同尺寸的区域来作为重叠区域。
例如,可以基于在拍摄该两个图像时拍摄设备的移动方向来确定匹配方向(或称为拼接方向)。如子染色图像和模板图像是拍摄设备在水平移动时顺序拍摄的两个图像,则该两个图像之间的匹配方向可以确定为水平方向。当然,也可以采用其他可用的方式来确定该两个图像之间的相对位置关系,并从而确定匹配方向,在此不再赘述。
在一些示例中,重叠区域被选择为使得子染色图像和模板图像中的实际重叠部分在重叠区域中的比率大于预定阈值。
在一些示例中,该预定阈值被确定为10%,或30%等。需要注意的是,该值仅是被用作示例的值。在其他一些示例中,预定阈值也可以取更大或更小的其他值。
请继续参阅图2,该步骤对应图2中的步骤B。
步骤10112,将所述多个子染色图像和所述模板图像的被确定为重叠区域的部分分别裁剪为多个染色图像重叠子图和数量相同的多个模板图像重叠子图,以配对为多个重叠子图对;
在一些示例中,该操作可以包括:将子染色图像和模板图像的被确定为重叠区域的部分分别进行降噪和/或加窗处理;在垂直于匹配方向的方向上,将经过降噪和/或加窗处理的子染色图像和模板图像进行合并,并以相同的图像裁剪大小对子染色图像和模板图像的进行了降噪和/或加窗处理的部分分别进行重采样,以获得该多个子染色图像重叠子图和该多个模板图像重叠子图;以及在垂直于匹配方向的方向上,将该多个子染色图像重叠子图和该多个模板图像重叠子图顺序地一一配对,以形成该多个重叠子图对。
上述操作中的降噪处理可通过例如高斯滤波来进行,但图像处理领域中所使用的其他降噪方式也可用于该处理。加窗处理可获得抑制频谱泄露的图像。所使用的窗口包括但不限于Hanning窗口、Hamming窗口等。
在本申请的一些示例中,可采用滑窗的方式来执行上述的重采样。滑窗方式可设定一定的重叠区域,多个堆叠的小子图对应保证源图和模板图的裁剪区域位于重叠区域且位于同一坐标系位置。可使用任何可用的方式来实现重采样,例如利用目标检测方式裁剪特征较多区域等,而不限于上述的滑窗方式。
在获得多个重叠子图对之后,图1所示的方法还可以可选地包括从该多个重叠子图对中去除特征少于特定标准和/或噪声大于特定标准的重叠子图对。例如,可用利用梯度检测来过滤特征较少和/或噪声较多的子图对。所使用的梯度检测方法包括但不限于Sobel、Canny等方法。此外,其他任何能够用于检测图像中的特征数量和/或噪声 的方法都能够用在此处,而不限于梯度检测方法。
步骤10113,通过对所述多个重叠子图对进行频域计算,分别获得各子染色图像和所述模板图像之间的偏移量;以及
可选地,在此进行频域的叠加共振的重叠子图对是上述可选步骤中去除了特征较少和/或噪声较多的子图对之后得到的重叠子图对。
在一些示例中,该步骤可以采用狄拉克函数来执行。例如,包括:对该多个重叠子图对进行互功率频谱的堆叠,并利用狄拉克函数来从堆叠的互功率频谱中获得偏移量。具体地,在一些示例中,可以将该多个重叠子图对中的每个重叠子图从位置坐标系变换到频域。该变换例如可以通过二维图像离散傅里叶变换来完成,或通过能实现域变换的任何其他方式来完成,在此不再赘述。然后,可以计算该多个重叠子图对中的每个重叠子图对所对应的互功率频谱;对所获得的每个重叠子图对所对应的互功率频谱执行离散傅里叶逆变换,以获得重叠区域的狄拉克函数表示;以及将获得的所述重叠区域中的狄拉克函数表示的最大峰所在的坐标确定为偏移量。
在一些示例中,在将所获得的每个重叠子图对所对应的互功率频谱进行累加之前,针对所获得的每个重叠子图对,还可以改善该重叠子图对中的特征,以使其更加明显。例如,可以将该重叠子图对变换到位置坐标系,并对变换到位置坐标系的重叠子图进行加窗处理,以增强该重叠子图中的特征。这里所使用的窗口函数可以是汉宁窗Hanning窗或汉明窗Hamming窗,或者是可增强图像中的特征的任何其他函数。增强重叠子图中的特征可以有效提高特征不明显图像的图像配准的成功率。在此,所使用的增强图像特征的方式可以不限于加窗处理,也可以是能够增强图像特征的任何其他方法。
在一些实施例中,对所获得的每个重叠子图对所对应的互功率频谱执行离散傅里叶逆变换,以获得所述重叠区域的狄拉克函数表示可以包括:对所获得的每个重叠子图对所对应的互功率频谱执行离散傅里叶逆变换以获得堆叠的狄拉克函数表示;以及将所获得的堆叠的狄拉克函数表示进行加权累加,以获得重叠区域的狄拉克函数表示。在该方案中,具有更明显特征的重叠子图对可被赋予更大的加权系数。例如,每个重叠子图对的加权系数可以取决于该重叠子图对的能量频谱(例如,狄拉克函数的最大峰的能量强度)和/或该重叠子图对的特征点的匹配数和/或该重叠子图对的图像清晰度,或者可基于能够表征重叠子图对是否具有更明显特征的其他任何度量。
步骤10114,将所述各子染色图像分别朝向所述模板图像的方向平移所述偏移量,并与所述模板图像拼接在一起。
步骤1012,根据所述第一染色图像的图像质量判断是否对所述生物样本的多个子染色图像进行第二拼接;
在一些实施例中,第一染色图像的图像质量需要根据空间组学单细胞数据获取需求进行设定,本申请实施例不进行限定。
若否,则执行步骤1013;若是,则执行步骤1014。
步骤1013,将所述第一染色图像确定为所述染色图像;
步骤1014,对所述生物样本的多个子染色图像进行第二拼接,得到所述染色图像。
第二拼接方式的具体实现过程可参阅图4的相关说明,故在此不再进行赘述。
如图5所示,图5为本申请实施例提供的另一种对多个子染色图像进行拼接,得到拼接染色图像的方法流程图,包括:
步骤10115,获取所述多个子染色图像以及关于所述生物样本的轨迹线或轨迹点的模板信息;
在测序过程中,对单个生物样本的局部可以依次拍摄若干幅图像。每个视野的图像的水平方向与竖直方向上可以各分布有若干条轨迹线,轨迹线(track line)的交点为轨迹点(track cross,或者称“轨迹交叉点”)。轨迹线和轨迹点可以相互转换;根据交叉的两个轨迹线可以得到轨迹点;根据共线的轨迹点可以得到轨迹线。所述模板信息可以包括所述生物样本上的多条轨迹线的索引号。如本领域技术人员已知的,生物样本上的轨迹线的分布规律在生物样本设计之初就已经被规定好,举例来说,假设生物样本的竖直方向上有10条轨迹线,它们之间的间距可以分别为例如1、2、3、4、5、4、3、2、1。假设以第一条轨迹线所在的位置为起始点(坐标为0),则上述10 条轨迹线的横轴(x轴)坐标分别是0、1、3、6、10、15、19、22、24、25。生物样本的模板信息中的索引号可以与生物样本中的轨迹线的排布相关联,上述10条轨迹线的索引号可以人为规定为分别是0、1、2、3、4、5、6、7、8、0。
此外,所获取的生物样本的模板信息还可以包括周期性,例如对于上述生物样本的竖直方向上的10条轨迹线,它们可以向左和向右分别扩展一个或多个周期。例如,左右扩展各一个周期所形成的轨迹线之间的间距从左到右依次为1、2、3、4、5、4、3、2、1、1、2、3、4、5、4、3、2、1、1、2、3、4、5、4、3、2、1,由此可以得到扩展后的28条轨迹线的横轴(x轴)坐标分别是-25、-24、-22、-19、-15、-10、-6、-3、-1、0、1、3、6、10、15、19、22、24、25、26、28、31、35、40、44、47、49、50,它们对应的索引号分别为:0、1、2、3、4、5、6、7、8、0、1、2、3、4、5、6、7、8、0、1、2、3、4、5、6、7、8、0。
值得注意的是,一般而言,某条轨迹线对应的生物样本的索引号是惟一的,而生物样本上的某个索引号会对应多条轨迹线,这是生物样本上的轨迹线设计时的周期性决定的。
显微镜可以例如通过对生物样本进行逐行扫描或逐列扫描来拍摄生物样本的图像。扫描后多个图像在空间上的分布可以如图6所示,所述多个图像可以共有例如n+1列,m+1行,包括从第一行第一列的图像(r0,c0)到最后一行最后一列的图像(rm,cn)。对于如图3中所例示的图像(rm-1,cn-1),该图像最多可以有8个相邻的图像。另外,显微镜在拍摄图像时也可以记录下拍摄时的相机位置信息,后续可以根据任一图像记录的拍摄时的相机位置信息,确定该图像的对应位置并且为该图像确定其相邻的图像。
图7是根据本发明的一个实施方案的图像拼接方法的预拼接结果示意图。
步骤10116,对所述多个子染色图像进行预拼接得到所述多个子染色图像的预拼接坐标;
可以通过对多个染色图像进行扫描,根据扫描顺序或者图像拍摄时的相机位置信息采用例如2-近邻的方式确定当前染色图像的左邻居和右邻居的图像,并进而确定染色图像和左右相邻图像之间的偏移量和重叠量。在扫描过程中,结合生物样本的模板信息可以优选地采用快速傅里叶变换(FFT)或者尺度不变特征变换(SIFT)获取相邻染色图像之间的偏离量以及重叠量。基于扫描图像过程中获取的相邻染色图像之间的偏离量和重叠量,可以得到所述多个染色图像的预拼接坐标。
图8a是预拼接时在水平方向上扫描得到的行向相邻的两个染色图像之间的位置关系示意图;图8b是预拼接时在竖直方向上扫描得到的列向相邻的两个染色图像之间的位置关系示意图。
具体地,图8a和8b分别示出了在水平方向和竖直方向对染色图像进行扫描后得到的相邻染色图像之间的偏离量和重叠量。对于水平方向扫描来说(参考图8a),所得到的行向相邻的两个图像在水平方向重叠的距离被称为水平方向上的重叠量(overlap),在竖直方向偏离的距离被称为竖直方向上的偏离量(offset)。类似的,对于竖直方向扫描来说(参考图8b),所得到的列向相邻的两个染色图像在竖直方向重叠的距离被称为竖直方向上的重叠量(overlap),在水平方向偏离的距离被称为水平方向上的偏离量(offset)。水平方向和竖直方向扫描分别完成后可以得到所述多个染色图像在对应方向上的偏离量矩阵A及重叠量矩阵B。利用偏离量矩阵A和重叠量矩阵B,可映射出各个染色图像在空间上的坐标,从而完成如图7所示出的多个染色图像的预拼接图像。
但是,仅对染色图像进行预拼接处理并不能达到像素级别的精度,因此还需要在此基础上在S10117和S10118步骤中继续对染色图像的坐标进行进一步精确调整。
步骤10117,根据轨迹线或轨迹点的特征从所述多个子染色图像中选取至少一个第一参考图像,根据所述生物样本的模板信息和所述第一参考图像的预拼接坐标推导全局模板;以及
所选取的所述第一参考图像(或者说基准图像)可以是所述多个染色图像中轨迹线特征最明显的图像或者轨迹点最多的图像。所述第一参考图像例如是图6和图7中所突出显示的图像(rm-1,cn-1),然后对所选取的该图像(rm-1,cn-1)进行轨迹 线检测,并将检测到的相邻轨迹线之间的间距与上面提到的芯片设计时所规定好的轨迹线之间的间距进行匹配,进而确定所选取的该第一参考图像中的轨迹线对应的索引号。也就是说,根据所述第一参考图像中的相邻轨迹线之间的距离可以确定所述第一参考图像中的各个轨迹线所对应的索引号。然后,可以基于所述第一参考图像的所述索引号以及所述第一参考图像的预拼接坐标推导出全局模板。
在一个实施例中,由于生物样本上的组织切片会覆盖轨迹线,而部分轨迹点可以在组织空腔的位置显露出来,因此在一个图像内,完整轨迹点相较于完整轨迹线出现的概率会更高,因此也可以优选地选择轨迹点最多的图像作为第一参考图像。
在一个实施例中,根据所述第一参考图像中的相邻轨迹线之间的距离确定所述第一参考图像中的各个轨迹线所对应的索引号,并且基于所述第一参考图像的所述索引号以及所述第一参考图像的预拼接坐标推导全局模板。
图9是示出根据本发明的一个实施方案的用于拼接生物样本的全局模板的示意图;图10是根据本发明的一个实施方案的用于拼接生物样本的全局模板的构造过程示意图。
参考图10所示出的全局模板的构造示例,根据得到的所选取的第一参考图像(rm-1,cn-1)在预拼接阶段的位置坐标以及轨迹线的索引号,可以通过沿水平方向进行左右双向周期扩展以及在竖直方向进行上下双向周期扩展得到以第一参考图像(rm-1,cn-1)为基准的全局模板(或者称全局参考系)。
对于除所选取的第一参考图像(rm-1,cn-1)之外的第二参考图像的坐标的调整,可以分为两类,即对于包含轨迹点的第二参考图像进行坐标调整以及对于不包含轨迹点的第二参考图像进行坐标调整。
对于包含轨迹点的第二参考图像进行坐标调整是通过将每个所述包含轨迹点的第二参考图像的预拼接坐标与该包含轨迹点的第二参考图像的各自的唯一偏移量相加。所述第二参考图像的所述偏移量是该第二参考图像上的轨迹点指向所述全局模板中的与该第二参考图像上的轨迹点对应的模板点所形成的矢量。可参考图9在局部放大的示意图中用箭头所示出的偏移量,该偏移量表示从生物样本上的轨迹点指向推导出的全局模板上的与该轨迹点相对应的模板线轨迹点的矢量。
步骤10118,对于所述多个子染色图像中除了所述第一参考图像之外的第二参考图像,计算所述第二参考图像的预拼接坐标与所述第二参考图像在所述全局模板中的相应模板坐标之间的偏移量,并基于所述偏移量对所述第二参考图像进行坐标调整以拼接生成所述拼接染色图像。
获取每个所述包含轨迹点的第二参考图像中的每个轨迹点的各自的偏移量,对于每个所述第二参考图像选取所述偏移量中的具有中值角度或中值距离的偏移量作为该第二参考图像的所述唯一偏移量;或者,
获取每个所述包含轨迹点的第二参考图像中的每个轨迹点的各自的偏移量,根据所述偏移量的矢量长度对所述偏移量进行排序,选择预设排序位置的偏移量作为该第二参考图像的所述唯一偏移量。
将每个所述包含轨迹点的第二参考图像的唯一偏移量与所述包含轨迹点的第二参考图像的各自的唯一偏移量相加,可以得到包含轨迹点的第二参考图像的调整后的坐标。
对于不包含轨迹点的第二参考图像进行坐标调整可以采用近邻调整法,近邻调整法包括:对于每个所述不包含轨迹点的第二参考图像,根据距离该不包含轨迹点的第二参考图像最近的包含轨迹点的第二参考图像的唯一偏移量以及该不包含轨迹点的第二参考图像与所述最近的包含轨迹点的第二参考图像之间的偏离量和重叠量,对该不包含轨迹点的第二参考图像进行坐标调整。
具体而言,由于组织覆盖、芯片特征被污染以及显微相机的拍摄质量等问题,存在一些其上并没有轨迹点的图像,在这种情况下,可以基于不包含轨迹点的第二参考图像与和它相邻或者距离最近的调整后的包含轨迹点的第二参考图像之间的偏离量和重叠量对齐该不包含轨迹点的第二参考图像。需要说明的是,该最近距离的度量为曼哈顿距离,而非欧式距离。
所述对第二参考图像进行坐标调整还包括对相邻的第二参考图像之间进行接缝 融合处理,例如,可以采用线性加权融合方法等。
在一些实施例中,如图11所示,图11为本申请实施例提供的一种将染色图像与基因表达可视化图像进行配准的方法流程示意图,包括:
步骤1021,获取所述染色图像中的轨迹线,基于所述轨迹线与水平方向的夹角旋转所述染色图像;其中,所述染色图像和所述基因表达可视化图像包括多条轨迹线和/或多个轨迹点,所述轨迹点是由两条所述轨迹线相交形成的,所述多条轨迹线中的每条轨迹线具有对应的索引号;
由于染色图像是由显微镜图像拍摄得到的,所以显微镜图像中的轨迹线并不一定处于水平方向和垂直方向,所以可以选取显微镜图像中的第一轨迹线作为基准,计算第一轨迹线与水平方向的夹角,将显微镜图像旋转上述夹角后位于水平方向。参见图12,展示了一种染色图像的示意图。由图12可知,染色图像没有位于水平方向,第一轨迹线与水平方向存在一个夹角。所以可以计算出所述夹角后将染色图像旋转至水平方向。
由于基因表达可视化图像是由基因表达矩阵生成的,表现为许多离散的点,对表达聚集特征或生物样本的边缘特征的能力较弱。在一种优选的实现方式中,可以对基因表达可视化图像进行组织分割以获取基因表达展现出的生物样本轮廓,对样本轮廓所在的大致区域进行卷积增强处理,增强基因表达可视化图像的边缘特征,方便后续将显微镜图像与基因表达可视化图像进行配准。
步骤1022,将所述染色图像进行放大或缩小得到第三参考图像,所述第三参考图像与所述基因表达可视化图像具有相同的比例;
当染色图像是由显微镜拍摄的图像时,由于基因表达可视化图像可以作为基准图像,而显微镜拍摄的染色图像与基因表达可视化图像的缩放比例可能存在差异。为了实现将染色图像与基因表达可视化图像的配准,所以需要将染色图像进行放大或缩小后得到与基因表达可视化图像大小相同的第三参考图像。
在一种可能的实现方式中,可以根据染色图像与基因表达可视化图像中对应索引号的轨迹线之间的间距确定染色图像的缩放比例。具体地,获取染色图像中的第二轨迹线,基于染色图像的第一轨迹线和第二轨迹线确定第一间距;获取基因表达可视化图像中的第三轨迹线和第四轨迹线,其中,第三轨迹线的索引号与第一轨迹线的索引号相同,第四轨迹线的索引号与第二轨迹线的索引号相同,基于第三轨迹线和第四轨迹线确定第二间距。然后基于第一间距和第二间距确定染色图像和基因表达可视化图像之间的缩放比例值,将染色图像按照上述比例值进行放大或缩小,得到与基因表达可视化图像相同比例的第三参考图像。其中,第一轨迹线和第二轨迹线平行;第三轨迹线和第四轨迹线平行。
当基于第一轨迹线和第二轨迹线确定第一间距时,可以利用第一轨迹线上的轨迹点与第二轨迹线上的轨迹点计算,当两个轨迹点具有相同的横坐标或者纵坐标时,对应的纵坐标的差值或者横坐标的差值即可作为第一间距。同理,可以基于相同的原理确定第三轨迹线和第四轨迹线之间的第二间距。需要说明的是,上述实施例所提供的计算染色图像和基因表达可视化图像的缩放比例的方法仅为示例性的说明,并非仅限于上述实现方式。
步骤1023,基于所述基因表达可视化图像和所述第三参考图像确定目标偏移量;
当染色图像缩放至第三参考图像,具有与基因表达可视化图像相同的比例后,后续即可以根据基因表达可视化图像和第三参考图像确定目标偏移量。通过上述实施例可知,将原始染色图像旋转至水平方向后,染色图像与基因表达可视化图像之间可能存在90度倍角的差异,为了进一步提高图像处理的准确性,在将染色图像缩放至与基因表达可视化图像相同比例的第三参考图像后,可以将第三参考图像按照预设旋转角度进行旋转,在每个旋转角度下确定对应的目标偏移量。下面将结合一种具体应用场景进行说明。
如图13所示,S表示第三参考图像,V表示基因表达可视化图像,黑色点表示第三参考图像的重心,灰色点表示基因表达可视化图像的重心,图13中四个区域的图分别表示了原始第三参考图像以及将第三参考图像顺时针旋转90度、180度、270度后的图像。在将第三参考图像进行旋转后,可以根据第三参考图像的原点坐标和基因表 达可视化图像的原点坐标进行对齐,然后根据原点对齐后的第三参考图像和基因表达可视化图像确定目标偏移量。
针对任一预设旋转角度,为了更方便、更准确地处理图像,本实施例提供一种优选的实现方式,即首先可以根据第三参考图像与基因表达可视化图像的重心坐标,将第三参考图像进行初步定位到与基因表达可视化图像大致相同的位置,然后再根据移动后的第三参考图像计算目标偏移量,进行精准定位。具体实现时,将染色图像进行放大或缩小得到第五参考图像,其中第五参考图像与基因表达可视化图像具有相同的比例。然后分别计算第五参考图像的第一重心坐标和基因表达可视化图像的第二重心坐标,基于第一重心坐标和第二重心坐标确定重心偏移量,并基于该重心偏移量移动第五参考图像,得到第四参考图像,即得到初步定位的第四参考图像。其中,在计算第五参考图像和基因表达可视化图像的重心坐标时,可以利用基于像素灰度值的密度质心算法实现,本实施例对此并不做限定。
需要说明的是,关于中间过程中的图像移动,可以在复制染色图像的临时图像上实现的处理过程,即并非将染色图像进行移动配准,当计算完成得到最终的目标偏移量之后,再一次性移动染色图像,与基因表达可视化图像进行配准。
在得到初步定为的第四参考图像后,可以根据第四参考图像和基因表达可视化图像确定目标偏移量。在实际应用中,时空芯片上自带的轨迹线可能具有多个周期,因此基于时空芯片得到的显微镜图像和基因表达可视化图像也可能具有多个周期,即第四参考图像和基因表达可视化图像具有多个周期。每个周期内具有一个对应的子图像,每个子图像中的轨迹线和轨迹点数目相同,并且子图像之间轨迹线的索引号一一对应。如图14a和图14b所示,图14a展示了具有多个周期的第三参考图像,图14b展示了多个周期的基因表达可视化图像。在图14a中,仅表示了第一周期和第二周期的子图像,可以得知每个周期的子图像中,具有相同数目的索引线和索引点,每条索引线均对应一个索引号。图14b中也表示了第一周期和第二周期对应的子图像。上述实施例所提供的第三参考图像和基因表达可视化图像的示意图仅为一种可能的实现方式,并非对图像的具体形式做任何限定。所以基于第四参考图像和基因表达可视化图像确定目标偏移量时,需要考虑周期的影响。
具体实现时,首先可以根据第四参考图像和基因表达可视化图像确定第一偏移量,该第一偏移量为第四参考图像与基因表达可视化图像之间的待定偏移量,然后以第一偏移量为中心,确定第一偏移量在预设周期内所对应的多个第二偏移量,即在预设周期内的每个周期对应一个第二偏移量。针对任意一个第二偏移量,基于该第二偏移量移动第四参考图像,得到第六参考图像,然后计算第六参考图像与基因表达可视化图像之间的第一相似度,从而得到在预设周期内的每个周期所对应的第一相似度。由于上述确定相似度是在任意一个旋转角度下所得到的,所以需要在其他预设旋转角度下,重新执行上述步骤,得到每个旋转角度下所对应的多个第一相似度。基于所有旋转角度和所有周期所确定的多个第一相似度,确定第一最大相似度,将该第一最大相似度所对应的第六参考图像确定为第三参考图像。然后可以确定第三参考图像所对应的第二偏移量为目标偏移量。
其中,根据第四参考图像和基因表达可视化图像确定第一偏移量时,一种可能的实现方式为,首先获取多组轨迹点集合,其中每组轨迹点集合包括第一轨迹点和第二轨迹点,第一轨迹点位于第四参考图像,第二轨迹点位于基因表达可视化图像,第一轨迹点与第二轨迹点具有相同的索引标识。由于轨迹点是由两条相交的轨迹线形成的,每条轨迹线都具有索引号,所以轨迹点的索引标识可以由该轨迹点的两条相交轨迹线的索引号组成。在本实施例中,由于在第四参考图像和基因表达可视化图像中均具有多个轨迹点,所以需要获取具有对应关系的轨迹点才可以作为一组轨迹点集合,即相同索引号的轨迹点。针对多组轨迹点集合中的任一组轨迹点集合,可以根据第一轨迹点的坐标和第二轨迹点的坐标确定第四偏移量,然后基于多个第四偏移量确定第一偏移量。
为便于更清楚地理解本方案,在介绍第三偏移量的实现方式之前,首先对第四偏移量的实现方式进行说明。
具体实现时,由于基因表达可视化图像存在多个周期,即具有多个子图像,由此 所获取的具有相同索引标识的第一轨迹点和第二轨迹点可能不属于对应的周期,所以所确定的第二轨迹点可能有多个。在基于第一轨迹点的坐标和第二轨迹点的坐标确定第四偏移量时,可以首先选取第四参考图像中的任一第一轨迹点,根据第一轨迹点的索引标识确定具有相同标识的多个第二轨迹点。为了获取与第一轨迹点相对应的第二轨迹点,可以分别计算第一轨迹点与每一个第二轨迹点的欧式距离,在计算得到多个欧式距离后,获取欧式距离最小时所对应的第二轨迹点,即为与第一轨迹点相对应的第二轨迹点。然后根据最小欧式距离所对应的第二轨迹点以及第一轨迹点的坐标差值确定为第四偏移量。由于在第四参考图像中具有多个轨迹点,即对应多组轨迹点集合,所以需要遍历所有的轨迹点集合,按照上述确定基本偏移量的方法,确定与每一组轨迹点集合相对应的第四偏移量。在一种可能的实现方式中,在确定的多个第四偏移量中,可以首先排除超出预设范围的第四偏移量,然后根据剩余的第四偏移量确定目标偏移量。例如,可以选择多个第四偏移量中的中位数作为目标偏移量,或者计算所有第四偏移量的平均值作为目标偏移量,以尽可能地提高确定偏移量的准确性。需要说明的是,本实施例对根据第四偏移量确定目标偏移量的具体方式不做限定。
下面将结合一种具体应用场景对预设周期内的图像移动进行说明。
参见图15,图15为以第一偏移量为中心所确定的预设周期的示意图。
在一种可能的实现方式,以基因表达可视化图像作为基准,由图15可知,中间灰色区域表示第二轨迹点所在的周期,根据第一轨迹点和第二轨迹点确定第一偏移量后,以该第一偏移量(对应的第二轨迹点所属的周期)为中心选择附近5*5个周期,确定每个周期所对应的第二偏移量,相邻周期所对应的第二偏移量的差值为子图像的宽度,以此类推,可以确定每个周期所对应的第二偏移量。
然后可以针对任一周期所对应的第二偏移量移动第四参考图像得到第六参考图像,并计算第六参考图像与基因表达可视化图像之间的相似度。在计算相似度时,本实施例提供一种可能的实现方式,即对第六参考图像进行频域变换得到第一频域图像,对基因表达可视化图像进行频域变换得到第二频域图像,计算第一频域图像和第二频域图像之间的汉明距离作为相似度。当汉明距离越小时,表明第一频域图像与第二频域图像的相似度越大。在确定所有的预设旋转角度和所有预设周期所对应的汉明距离之后,将最小汉明距离作为第一最大相似度。
其中,可以利用离散余弦变换获取频域图像,即对移动后的第三参考图像进行离散余弦变换得到第一频域图像,对基因表达可视化图像进行离散余弦变换得到第二频域图像,然后从第一频域图像中截取低频频域图像,以低频频域图像为基准,计算低频频域图像的像素均值,在低频频域图像中将像素值高于像素均值的像素点的像素值置为1,将像素值低于像素均值的像素点的像素值置为0,将像素值等于像素均值的像素点的像素值置为0或1,然后根据重新置值后的低频频域图像获取哈希指纹。按照同样的执行步骤,获取第二频域图像的哈希指纹。然后基于第一频域图像的哈希指纹和第二频域图像的哈希指纹确定两个哈希指纹对比有多少位不同的值,即作为第一频域图像和第二频域图像的汉明距离。需要说明的是,上述实施例中计算相似度的方法仅为示例性的实现方式,并非仅限于上述实现方式,其他可实现的计算图像相似度的方法也在本申请的保护范围内。
在本申请的上述实施例中,可以首先将第四参考图像按照与基因表达可视化图像的重心偏移量进行初步移动定位,在另一种可能的实现方式中,在确定第三参考图像时,并不对第四参考图像进行初定位,针对任一预设旋转角度,将第四参考图像分别按照预设周期内的每个周期进行移动,得到每个周期所对应的第七参考图像。例如,可以先计算第四参考图像的第三重心坐标,以第三重心坐标所在的周期为中心,分别按照预设周期内的每个周期移动第四参考图像,得到第七参考图像。然后计算第七参考图像与基因表达可视化图像之间的第二相似度,从而得到预设周期内每个周期所对应的第二相似度。然后根据其他的预设旋转角度,重复执行上述步骤,获取在每个预设旋转角度以及每个周期内所对应的第二相似度,并基于上述多个第二相似度确定第二最大相似度。将第二最大相似度所对应的第七参考图像作为第三参考图像,然后基于该第三参考图像和基因表达可视化图像确定目标偏移量。
具体地,首先可以根据基因表达可视化图像和第三参考图像确定多个第三偏移 量,基于该多个第三偏移量确定目标偏移量。其中,该第三偏移量的计算原理与上述实施例中计算第四偏移量的原理相同。即,获取多组轨迹点集合,其中,每组轨迹点集合包括第三轨迹点和第四轨迹点,第三轨迹点位于第三参考图像,第四轨迹点位于基因表达可视化图像,并且第三轨迹点与第四轨迹点具有相同的索引标识。针对任一组轨迹点集合,基于第三轨迹点的坐标和第四轨迹点的坐标确定第三偏移量。其中,基于第三轨迹点的坐标和第四轨迹点的坐标确定第三偏移量的具体实现方式可以参见基于第一轨迹点的坐标和第二轨迹点的坐标确定第四偏移量的具体实现方式,在此不再赘述。
同样地,在确定多组轨迹点集合所对应的第三偏移量之后,可以首先排除超出预设范围的第三偏移量,然后在满足预设范围的多个第三偏移量中选择中位数作为目标偏移量,或者计算多个第三偏移量的平均值作为目标偏移量,以尽可能地提高确定偏移量的准确性。
步骤1024,基于所述目标偏移量移动所述第三参考图像,得到所述配准后的图像。
基于上述实施例提供的方法确定目标偏移量之后,确定该目标偏移量所对应的预设旋转角度,基于该预设旋转角度和目标偏移量移动第三参考图像。
需要说明的是,关于中间过程中的图像移动,均为在复制染色图像的临时图像上实现的处理过程,即并非将染色图像进行移动配准,当计算完成得到最终的目标偏移量之后,再一次性移动染色图像,与基因表达可视化图像进行配准。
本申请实施例所提供的图像处理方法中,可以基于像素级精度的图像坐标,将染色图像与基因表达可视化图像进行配准,提高图像处理的准确性,便于后续利用配准的图像进行研发和分析。
当第三参考图像和基因表达可视化图像具有多个周期时,由于预设周期对应的偏移量是由计算得到的偏移量利用理论周期宽度推理得到的,在实际图像中可能存在误差。为了修正理论推理的误差,进一步提高图像处理的准确性,在一种优选的实现方式中,当基于目标偏移量移动第三参考图像之后,基于移动后的第三参考图像以及基因表达可视化图像,可以重新利用该第三参考图像和基因表达可视化图像确定修正偏移量作为最终偏移量,并基于所确定的最终偏移量继续移动该第三参考图像,将该第三参考图像与基因表达可视化图像进行配准,提高配准的准确性。例如,基于移动后的第三参考图像以及基因表达可视化图像,获取多组轨迹点集合,其中,每组轨迹点集合包括第五轨迹点和第六轨迹点,第五轨迹点位于该第三参考图像,第六轨迹点位于基因表达可视化图像,并且第五轨迹点与六轨迹点具有相同的索引标识。针对任一组轨迹点集合,基于第五轨迹点的坐标和第六轨迹点的坐标确定第五偏移量。在确定多组轨迹点集合中每组轨迹点集合所对应的第五偏移量之后,基于多个第五偏移量确定最终偏移量。其中,确定第五偏移量以及基于多个第五偏移量确定最终偏移量的实现方式可以参见上述实施例,在此不再赘述。
作为本申请实施例的一种可行方式,在步骤将所述染色图像进行放大或缩小得到第三参考图像之后,还包括:确定所述第三参考图像与基因表达可视化图像之间的相似度;将相似度最大值对应的位置作为粗配准结果。该相似度作为粗配准,图11所示的方法作为精细配准。
在一些实施例中,如图16所示,图16为本申请实施例提供的一种将染色图像与基因表达可视化图像进行配准的方法流程示意图,包括:
步骤1025,对所述染色图像进行预处理,获取候选图像集合;
在将染色图像与基因表达可视化图像进行配准之前,由于染色图像为显微镜实际拍摄的图像,受外界等因素影响,与基因表达可视化图像存在一定的差异,例如,染色图像未处于水平位置,所以为了方便后续的图像配准,可以首先对染色图像进行预处理。
具体地,获取染色图像的第一轨迹线和第二轨迹线,该第一轨迹线和第二轨迹线可以为随机确定的轨迹线。然后基于第一轨迹线与水平方向的夹角旋转染色图像,也就是,将染色图像旋转至水平位置。并基于第一轨迹线和第二轨迹线确定两条轨迹线之间的第一间距。获取基因表达可视化图像中的第三轨迹线和第四轨迹线,其中,第三轨迹线的索引号与第一轨迹线的索引号相同,第四轨迹线的索引号与第二轨迹线的 索引号相同。并基于第三轨迹线和第四轨迹线两条轨迹线之间的确定第二间距,基于第一间距和第二间距的比值调整旋转后的染色图像,获取候选图像。也就是,染色图像和基因表达可视化图像的轨迹线间距可能存在缩放比例差异,为了实现准确地图像配准,可以将染色图像缩放至与基因表达可视化图像相同的比例。其中,当基于第一轨迹线和第二轨迹线确定两条轨迹线之间的第一间距时,可以获取第一轨迹线和第二轨迹线中具有相同横坐标的两个轨迹点,则两个轨迹线的纵坐标的差值即为第一间距。或者,获取第一轨迹线和第二轨迹线中具有相同纵坐标的两个轨迹点,则两个轨迹线的横坐标的差值即为第一间距。
在获取候选图像后,由于此时候选图像为处于水平位置的图像,但是可能与基因表达可视化图像存在90°倍角的差异,所以可以确定多个旋转角度,基于每个旋转角度旋转候选图像,从而将每个旋转角度所对应的旋转后的图像组成候选图像集合。例如,该多个旋转角度可以为90°、180°以及270°。经过旋转后,该候选图像集合中的任一图像与染色图像仍具有相同的索引号。
步骤1026,确定所述候选图像集合对应的二值图集合;
二值图即为图像二值化,就是将图像上每个像素点的灰度值设置为0或255,使整个图像呈现出明显的黑白效果,方便后续的图像配准。可选地,可以通过以下方式确定二值图集合,针对候选图像集合中的任一第四图像,基于第四图像的组织轮廓进行分割,获取组织分割图像。其中,进行组织分割时,可以基于组织分割算法实现,也可以使用组织分割工具手动圈出组织轮廓获得。然后对组织分割图像进行二值化处理,获取初始二值图。针对初始二值图的多个边界中的任一边界,确定组织轮廓中距离边界最近的边界点,并在与边界平行的轨迹线中,确定距离边界点最近的边界轨迹线,并且保证边界轨迹线不经过组织轮廓,从而基于每个边界对应的边界轨迹线确定目标二值图。候选图像集合中的多个第四图像所对应的目标二值图组成二值图集合。也就是,目标二值图为包括整个生物组织的最小二值图,并且目标二值图的边界由轨迹线组成。参见图17a所示,为本申请实施例提供的一种第四图像的示意图,对第四图像的组织轮廓进行分割处理后,得到组织分割图像,然后对组织分割图像进行二值化处理,得到的初始二值图如图17b所示。然后基于初始二值图确定包括所有组织的最小二值图,即目标二值图如图17c所示。
步骤1027,基于所述二值图集合与所述基因表达可视化图像之间的相似度,确定所述二值图集合与所述基因表达可视化图像中具有对应关系的轨迹点对;
在实际应用中,基因表达可视化图像可能具有多个周期,每个周期的基因表达可视化图像为相同的,也就是,基因表达可视化图像的索引号可能具有多个周期。基于此,在确定轨迹点对时,针对二值图集合中的任一二值图,基于该二值图的顶点所对应的坐标和基因表达可视化图像的轨迹点所对应的坐标,在基因表达可视化图像中确定与二值图所对应的多个区域。其中,所确定的多个区域与多个周期一一对应。二值图的顶点即为二值图中的轨迹点,顶点所对应的坐标可以由相交形成顶点的两条轨迹线对应的索引号确定。针对上述多个区域中的任一区域,确定二值图与该区域之间的相似度指标,从而可以确定多个二值图与多个区域两两之间的多个相似度指标。基于多个相似度指标,确定二值图集合与基因表达可视化图像中具有对应关系的轨迹点对。其中,该相似度指标可以表示二值图所对应的图像与区域对应的图像之间的相似程度,相似度指标越大,表明相似程度越高。
其中,在确定二值图与区域之间的相似度指标时,可以通过以下方式实现,确定二值图对应的二值图矩阵,由于二值图的像素点的灰度值只能为0或255,可选地,可以将灰度值为0的像素点在二值图矩阵中的元素设置为0,将灰度值为255的像素点在二值图矩阵中的元素设置为1,也就是,二值图为由0和1组成的矩阵。当基因表达可视化图像为基因表达可视化图像时,可以确定该基因表达可视化图像对应的基因表达矩阵,基因表达可视化图像的每个像素点在基因表达矩阵中对应一个基因表达量。然后利用该二值图矩阵和该区域对应的基因表达矩阵确定相似度指标。例如,可以将二值图矩阵与基因表达矩阵进行点乘,即二值图矩阵与基因表达矩阵中对应位置的元素相乘,然后对点乘得到的矩阵中的所有元素进行求和,得到相似度指标。从而可以根据二值图集合与基因表达可视化图像的多个区域之间的相似度指标,确定具有对应关 系的轨迹点对。
根据上述实施例可知,染色图像可以为利用轨迹线定位算法对第一原始图像进行处理得到的,也可以为将第一原始图像按照预设比例进行缩放后,再利用轨迹线定位算法进行处理得到的。下面将针对上述两种获取染色图像和基因表达可视化图像的方式,分别介绍基于多个相似度指标确定轨迹点对的方式。
当利用轨迹线定位算法处理第一原始图像和第二原始图像,获取染色图像和基因表达可视化图像时,在获取二值图集合中的多个二值图与多个区域之间的多个相似度指标之后,可以获取多个相似度指标中的最大值,确定该最大值所对应的二值图为第一目标图像,确定该最大值所对应的区域为第一目标区域。然后可以获取第一目标图像中的第一顶点以及第一目标区域中与第一顶点的坐标相同的第一索引点,并确定第一顶点与第一索引点为具有对应关系的轨迹点对。其中,该第一顶点可以为第一目标图像中的任一顶点。
当将第一原始图像和第二原始图像按照预设比例进行缩放后,利用轨迹线定位算法处理缩放后的第一原始图像和缩放后的第二原始图像,获取染色图像和基因表达可视化图像时,在获取二值图集合中的多个二值图与多个区域之间的多个相似度指标之后,可以确定多个相似度指标的排序结果,并基于该排序结果获取预设数量的相似度指标,并确定预设数量的相似度指标所对应的多个二值图,以及所对应的多个区域。例如,可以选择数值最大的前预设数量的相似度指标。其中,本申请实施例并不限定预设数量的具体数值,可以结合实际应用场景进行确定。由于利用缩放后的图像进行配准时可能存在误差,为了进一步提高图像处理的准确性,可以获取预设数量的相似度指标对应的二值图缩放前的图像。也就是,确定该预设数量的相似度指标所对应的多个二值图之后,将多个二值图按照缩放预设比例的倒数进行放大,确定多个第二目标图像,即缩放前的图像。然后基于多个第二目标图像对应的二值图矩阵和多个区域对应的基因表达矩阵,确定多个候选相似度指标。获取多个候选相似度指标中的最大值,并确定该最大值所对应的二值图为第三目标图像,以及该最大值所对应的区域为第三目标区域。获取第三目标图像中的第二顶点以及第三目标区域中与第二顶点的坐标相同的第二索引点,确定第二顶点与第二索引点为具有对应关系的轨迹点对。其中,该第二顶点可以为第三目标图像中的任一顶点。
步骤1028,基于所述轨迹点对确定偏移信息;
可选地,可以获取规矩点对的两个轨迹点所对应的坐标,确定横坐标的差值和纵坐标的差值为偏移信息,即偏移量。
步骤1029,基于所述偏移信息处理目标图像,以得到配准后的图像,所述目标图像为所述轨迹点对所对应的候选图像集合中的图像。
在确定偏移信息之后,可以基于偏移信息移动目标图像,也就是,轨迹点对中属于候选图像集合中的轨迹点所对应的图像,即可实现图像的配准。
需要说明的是,关于中间过程中的图像处理以及移动,均为在复制染色图像的临时图像上实现的处理过程,即并非将染色图像进行移动配准,当计算完成得到最终的偏移信息之后,可以根据目标图像的旋转方向以及偏移信息,再移动染色图像,与基因表达可视化图像进行配准。
通过本申请所提供的图像处理方法,无需通过人工配准图像,可以实现在像素级精度的图像处理,从而提高图像处理的准确性。
在对所述配准后的图像进行细胞分割,得到细胞掩模图之前,所述方法还包括:步骤105,对所述配准后的图像进行组织分割,得到组织掩模图。
在一些实施例中,如图18所示,图18为本申请实施例提供的一种对配准后的图像进行组织分割的方法流程示意图,包括:
步骤1051,获取所述配准后的图像中待分割的目标组织的基因表达量并确定所述配准后的图像的基因表达矩阵,所述基因表达矩阵按照像素位置对所述基因表达量进行排列;
在一个实施例中,目标组织可以包括但不限于样本组织、生物组织、肌肉组织、骨骼组织、细胞组织中任一项或多项。基因表达矩阵表征基因在不同位置(对应基因表达矩阵的行列位置)的表达。每一条基因表达量数据包括基因标识符、基因坐标和 基因表达量,表征基因在一个位置的表达量。以细胞组织为例,可以通过对细胞组织的DNA进行转录处理以确定细胞组织的基因表达量。此外,基因表达量通常为utf-8格式。
本实施中,通过获取样本图像中每一个像素位置的基因表达量,并按照像素位置的行坐标、列坐标对基因表达量进行排列以得到基因表达矩阵,基因表达矩阵与样本图像的大小一致,当每个像素位置的基因表达量为0时表征在该像素位置不存在目标组织的基因。基因表达矩阵中每个像素位置的基因表达量可以表征一个或多个基因的基因表达量。若基因表达矩阵与样本图像的大小不一致,可以对两个图像或其中的一个图像进行缩放。
步骤1052,通过将所述基因表达矩阵中每一像素位置的基因表达量赋值于配准后的图像中对应的像素位置确定图像数据;
确定与所述基因表达矩阵相同大小的图像矩阵;
将所述基因表达矩阵中每一像素位置的基因表达量赋值于图像矩阵中对应的像素位置并对所有像素位置进行归一化处理得到样本图像的图像数据。
参见图19,将基因表达矩阵中每一像素位置的基因表达量以每个像素位置的行坐标与列坐标为键、基因表达量为值存储至字典中。创建一个与基因表达矩阵相同大小的全0图像矩阵,并按照字典中存储的基因表达量的行坐标与列坐标的位置赋值于图像矩阵中的相同位置,即图像矩阵中相同像素位置的基因表达量与基因表达矩阵中相同像素位置的基因表达量相同。对赋值后的图像矩阵进行归一化,使每一像素位置的像素值在[0,255]区间内,得到相对样本图像更为准确的图像数据,并减少对于后续组织分割图像的影响。图像数据参见图20所示,图像数据的格式优选为TIFF格式,也可以为JPG格式等,并不局限于某一具体表现形式,可根据实际情况进行选择。
在一个实施例中,通过获取确定每一像素位置的基因表达量生成基因表达矩阵,并将基因表达矩阵转换为图像数据,而减少通过原始显微镜对组织图像进行反复拍摄和校正的过程,提高分割效率,并使得图像数据相较于初始的样本图像对于目标组织的展示更为准确,且对于目标组织的分割效果更好。
步骤1053,通过对所述图像数据进行图像处理以确定所述图像数据的前景像素点;
在一个实施例中,步骤S1053之前,组织分割方法还包括:参见图21,对图像数据进行卷积,以提取图像数据的低频特征。其中,卷积方法优选采用2d卷积,也可以采用空洞卷积、深度可分离卷积等卷积方式来提升计算虚度和扩大感受视野,卷积后的图像数据参见图22所示。
通过对进行卷积后的图像数据图像处理以确定图像数据的前景像素点。
步骤1054,根据所述前景像素点对所述图像数据的连通区域进行标记得到所述组织掩模图。
在一个实施例中,连通区域指图像数据中具有相同像素值且位置相邻的前景像素点组成的图像区域,即目标组织的分割区域。
在一些实施例中,在组织分割得到组织掩模图后,如图23所示,图23为本申请实施例提供的一种计算描述组织掩模图对应的灰度图像质量的方法流程示意图,包括:
步骤1061,分别计算得到组织掩模图对应的灰度图像的外轮廓图像与内轮廓图像;
可基于矩阵运算分别得到所述目标区域组织灰度图像的外轮廓图像与内轮廓图像,在本实施例中所述外部轮廓图像与所述内轮廓图像为带状环形轮廓,所述外轮廓图像可包围住所述内轮廓图像。
步骤1062,将所述外轮廓图像与所述内轮廓图像分别分为N段,并将每段所述外轮廓图像与每段所述内轮廓图像两两配对,得到N个图像组合,每个所述图像组合包括一段外轮廓图像与一段内轮廓图像;
为了更直观的展示所述外轮廓图像与所述内轮廓图像的关系,图24为本公开实施例提供的一种外部轮廓图像与内部轮廓图像的关系结构示意图,图25为本申请实施例提供的另一种外部轮廓图像与内部轮廓图像的关系结构示意图,如图24所示,所述将所述外轮廓图像与所述内轮廓图像分别分为N段即将所述外轮廓图像均匀分割成N 段,将所述内轮廓图像均匀分割成N段,在所述N段外轮廓图像中取一段与所述N段内轮廓图像中的一段进行配对,形成图像组合,配对完成后便可以得到N个图像组合。
步骤1063,分别计算每个所述图像组合中一段外轮廓图像与一段内轮廓图像的像素密度比值,得到N个所述像素密度比值,所述像素密度比值为每个所述图像组合中一段外轮廓图像与一段内轮廓图像的像素占比的比值,所述像素占比为像素点与总像素点的比值;
在计算所述像素密度比值之前,需要先计算每段所述外轮廓图像与每段所述内轮廓图像的像素占比,计算一段所述外轮廓图像的像素占比包括使用该段外轮廓图像内的像素点的数量除以该段外轮廓图像内的像素点的总数量,在本实施例中所述像素点为灰度值大于127的像素点,计算一段内轮廓图像的像素占比与计算一段所述外轮廓图像的像素占比的方法一致,即使用该段内轮廓图像内的像素点的数量除以该段内轮廓图像内的像素点的总数量,以此类推最终计算完成所有段的外轮廓图像的像素占比和所有段的内轮廓图像的像素占比。
在完成上述像素占比的计算之后,还需计算一段外轮廓图像的像素占比与一段内轮廓图像的像素占比的比值,所述比值即为像素密度比值,所述一段外轮廓图像与所述一段内轮廓图像存在于一个图像组合,即二者之间相互配对,完成所有图像组合中的一段外轮廓图像的像素占比与一段内轮廓图像的像素占比的比值的计算,最终得到N个像素密度比值。
步骤1064,根据所述像素密度比值计算描述所述组织掩模图对应的灰度图像质量。
所述根据所述像素密度比值计算描述所述目标区域组织灰度图像质量包括但不限于以下实现方式,例如:将所述像素密度比值的平均值代入预设函数计算出描述所述目标区域组织灰度图像质量的数值,所述预设函数可以为线性函数也可为非线性函数。
为了便于理解上述细化的内容,本实施例提供了一种结合公式的示例性说明,例如:所述效像素密度比值的平均值为x,当所述x大于0小于200时,可代入公式(1)得到描述所述目标区域组织灰度图像质量的数值,公式(1)如下所示:
F(x)=100*x^0.7(0<x<200)  公式(1)
F(x)=0(x<=0)    公式(2)
F(x)=100(x>=200)    公式(3)
上述公式仅为示例性说明,其可以被任意函数替换,本申请实施例对公式不进行限定。
在一些实施例中,如图26所示,图26为本申请实施例提供的一种对配准后的图像进行细胞分割的方法流程示意图,包括:
步骤1031,将所述配准后的图像输入所述图像分割模型,获得所述配准后的图像中各个像素点的分割结果,所述分割结果包括属于细胞的像素点、属于细胞轮廓的像素点或者图像背景的像素点。
将配准后的图像输入上述图像分割模型,可以得到配准后的图像中各个像素点属于细胞、细胞轮廓或者图像背景的概率值,根据概率值是否大于阈值确定配准后的图像中各个像素点的初始分割结果,即确定配准后的图像中各个像素点属于细胞的像素点、细胞轮廓的像素点或者图像背景的像素点。在实际应用中,可以将配准后的图像扩展为三通道(如RGB三通道)图像,输入图像分割模型,得到每一通道图像中各个像素点的初始分割结果,即每一通道图像中各个像素点属于目标对象、目标对象轮廓或者图像背景,再综合各通道图像中各个像素点的初始分割结果,确定配准后的图像中各个像素点的初始分割结果。
步骤1032,将所述分割结果属于细胞的像素点或细胞轮廓的像素点确定属于细胞的像素点,输出所述配准后的图像的分割结果,得到所述细胞掩模图。
将属于细胞或者细胞轮廓的像素点进行融合,实现细胞的分割,即将细胞对象或者细胞轮廓的像素点确定为属于细胞的像素点,进行图像分割,输出配准后的图像的分割结果。
在本申请实施例中,还可以利用分水岭算法过滤配准后的图像的分割结果中面积小于阈值的目标对象,和/或,对不完整的目标对象进行修复。
通过过滤面积小于阈值的目标对象和/或修复不完整的目标对象,实现对目标对象的修正,完成配准后的图像的分割结果的后处理,提高图像分割的准确性。例如,目标对象为细胞时,通过细胞过滤和修正等算法,过滤非常小的细胞,以及修正不完整的细胞,使细胞分割更为准确。
本申请实施例使用的图像分割模型,在编码器模块中采用了金字塔挤压注意力模块,提高了编码器模块的特征提取能力,使图像分割模型更加关注具有显著性特征的目标对象,从而提高了图像分割模型的分割准确性。
将本申请实施例应用于时空组学中的细胞分割,参见图27所示,展示了本申请实施例的图像分割模型在鼠脑图像上的分割效果。截取了上图鼠脑图像的一部分作为展示,从左下图中可以看出,鼠脑图像中存细胞黏连情况,部分细胞边界严重模糊,右下图利用本申请实施例提出的图像分割模型可以从黏连细胞中分割出独立细胞,并提供比较可靠的边界。
在一些实施例中,如图28所示,图28为本申请实施例提供的一种对配准后的图像进行细胞分割的方法流程示意图,包括:
步骤1033,对所述基因表达可视化图像进行预处理,得到预处理图;
由于基因表达可视化图像为散点图,不便于进行细胞分割,因此需要进行预处理,将细胞的基因表达可视化图像处理得到边界效果增强的预处理图。
步骤1034,将所述预处理图进行二值化处理,得到初始掩模图;
本实施例可使用大津法对预处理图进行二值化处理,得到初始掩模图。
步骤1035,根据所述初始掩模图,利用基于距离变换的分水岭算法对存在细胞粘连的连通域进行分割,得到分割后的所述细胞掩模图。
分水岭算法(Watershed Algorithm),是根据分水岭的构成来考虑图像的分割。分水岭算法(Watershed Algorithm),是根据分水岭的构成来考虑图像的分割。
进一步的,作为上述实施例的细化和扩展,为了完整说明本实施例方法的具体实现过程,本实施例提供了如图29所示的具体方法,该方法包括:
步骤201、获取包含空间位置的基因表达矩阵。
从细胞的基因表达数据中获取包含空间位置的基因表达矩阵。基因表达数据可以包括多个基因的基因标识符、坐标位置及相应坐标位置的总基因表达量。
步骤202、基于基因表达矩阵,生成细胞的基因表达可视化图像。
作为一种可选方式,步骤202具体可包括:首先获取基因表达矩阵中的表达基因的坐标位置及相应坐标位置的总基因表达量;再根据表达基因的坐标位置及相应坐标位置的总基因表达量,生成基因表达可视化图像,其中,基因表达可视化图像为灰度图,基因表达可视化图像中像素点的灰度值为与像素点对应坐标位置的总基因表达量。通过这种可选方式,可准确生成得到细胞的基因表达可视化图像。
例如,在具体的细胞分割使用中,输入含空间位置的基因表达矩阵,根据表达基因的坐标位置及相应位置的总基因表达量生成表达图像,该图像具体形式为灰度图,坐标点的灰度值为该坐标上基因表达的总量。
作为另一种可选方式,步骤202具体还可包括:根据基因表达矩阵和分割的掩码图,绘制细胞的基因表达可视化图像,其中,基因表达矩阵中的空间位置与分割的掩码图中的空间位置相对应。例如,根据基因表达矩阵和分割的掩码图绘制基于细胞的表达量图,该基因表达矩阵中的空间位置与分割的掩码图中的空间位置可以相对应。通过这种可选方式,可准确生成得到细胞的基因表达可视化图像。
由于生成的基因表达可视化图像为散点图,不便于分割,需要进行处理,具体可执行步骤203所示的过程。
步骤203、对基因表达可视化图像进行预处理,得到中值图,并将中值图进行锐化处 理,得到锐化图。
由于基因表达可视化图像为散点图,不便于进行细胞分割,因此需要进行预处理,在本实施例中,首先将细胞的基因表达可视化图像处理成中值图。然后可使用拉普拉斯算子(laplacian算子)对中值图进行锐化处理,以增强中值图的边界效果,进而得到锐化图。
可选的,对基因表达可视化图像进行预处理,得到中值图,具体可包括:首先利用预设尺寸(如13*13)的卷积核对基因表达可视化图像进行卷积操作,使得基因表达可视化图像中的散点粘连,得到第一卷积图;再根据图像二维灰度峰值检测第一卷积图的局部最大值点;获取局部最大值点中的第p百分位数,其中,p为预设数值,如第p百分位数可为98%分位值、或99%分位值等;若第p百分位数在预设范围内,则利用第一中值滤波器对第一卷积图进行中值过滤,得到中值图,其中,第一中值滤波器的滤波器大小是根据预设尺寸确定得到的。
进一步可选的,在获取局部最大值点中的第p百分位数之后,本实施例方法还可包括:若第p百分位数在预设范围外,则根据第p百分位数和预设尺寸,确定卷积核的新尺寸;利用新尺寸的卷积核对基因表达可视化图像进行卷积操作,使得基因表达可视化图像中的散点粘连,得到第二卷积图;利用第二中值滤波器对第二卷积图进行中值过滤,得到中值图,其中,第二中值滤波器的滤波器大小是根据新尺寸确定得到的。
示例性的,根据第p百分位数和预设尺寸,确定卷积核的新尺寸,具体可包括:按照公式K=N*(N/R),计算得到卷积核的新尺寸,其中,K*K表示卷积核的新尺寸,N*N表示预设尺寸,R表示第p百分位数。
例如,首先使用大小13*13(经验数值)的卷积核,对基因表达可视化图像的原图进行卷积操作使散点图粘连,得到第一卷积图;再根据图像二维灰度峰值检测第一卷积图的局部最大值点,取出所得所有局部最大值点中的99%分位值R,如R值与一个设定好的经验阈值差距过大(过高或过低,均会影响后续处理),则认为13*13卷积核不适用于原图,此时计算K=13*(13/R),将原本13*13的卷积核改为K*K的卷积核,重新处理原图,得到第二卷积图;如R值在允许范围内,则沿用第一卷积图。卷积图表现为不同灰度的方块层叠的形式,灰度跨度较剧烈,且部分表达图像存在聚集点簇中心空洞的现象,为消除这一问题,使用13*2.7=35(2.7可为经验数值,小数向下取整)为滤波器大小(如需要计算K,则此处核大小为K*2.7)对第二卷积图进行中值滤波,得到中值图。
为了填充点簇空洞,上述所用中值滤波器较大,中值图的灰度边界可能较为模糊,使用laplacian算子对中值图进行锐化以增强灰度边界,得到锐化图,完成预处理,下面执行细胞分割的过程,具体可执行步骤204至207所示的过程。
步骤204、将锐化图进行二值化处理,得到初始掩模图。
使用大津法对上一步得到的锐化图进行二值化,得到初始掩模图。
步骤205、过滤初始掩模图中面积不符合预设条件的连通域,得到过滤掩模图。
可选的,步骤205具体可包括:将初始掩模图中面积大于第一预设阈值的连通域、或面积小于第二预设阈值的连通域进行过滤,得到过滤掩模图,其中,第一预设阈值大于第二预设阈值。例如,使用经验阈值对初始掩模中面积过小或过大的连通域进行过滤,得到过滤掩模图。
步骤206、遍历过滤掩模图中的每个连通域,基于连通域的最小外接矩形提取连通域所在区域,利用分水岭算法对存在细胞粘连的连通域进行分割,得到分割后的掩模图。
可选的,步骤206具体可包括:将过滤掩模图中的每个连通域内的像素点的灰度值设置为第一数值,并将在每个连通域外的像素点的灰度值设置为第二数值;针对连通域内每个灰度值为第一数值的目标像素点,将目标像素点的灰度值重新映射为目标像素点到距其最近的灰度值为第二数值的像素点的距离,得到连通域的距离图谱;对连通域的距离图谱进行二值化处理,获得连通域中距离灰度值为第二数值的像素点最远的预设个数像素点;将预设个数像素点作为分水岭算法的注水点,利用分水岭函数对过滤掩模图中连通域的原 始掩模进行分水岭分割,得到分割后的目标连通域,并将目标连通域覆盖到过滤掩模图,得到分割后的掩模图。
例如,遍历过滤掩模图中的每个连通域,基于连通域的最小外接矩形提取连通域所在区域,使用基于距离变换的分水岭算法对可能存在细胞粘连的连通域进行进一步分割,具体步骤如下:
步骤a、对每个提取出的连通域区域,目标连通域内的点灰度值设置为1,连通域外的点灰度值设置为0(包括背景和非目标连通域),对每个值为1的点进行距离变换,将其灰度值重新映射为该点到距其最近的值为0的点的距离(相邻点距离为1),得到该连通域的距离图谱。
步骤b、使用一个经验阈值对距离图谱进行二值化,得到连通域中距离值为0的点最远的数个点(由于每个连通域情况不同,各自数量不定)。
步骤c、将上一步得到的数个点作为分水岭算法的注水点,使用opencv中的分水岭函数对连通域的原始掩模进行分水岭分割,得到分割后的目标连通域,将该结果覆盖至过滤掩模图。
步骤d、对遍历的每个连通域进行上述步骤,得到分割后的掩模图。
步骤207、对分割后的掩模图进行闭包操作,得到细胞分割结果的掩模图。
为使细胞边界更规则,对分割后的掩模进行闭包操作,得到最终掩模图。最后可输出并保存最终掩模图,用于后续结合原始表达矩阵进行细胞层面的生物学分析。
例如,如图30所示,为基于本实施例方法的示例流程示意图。首先可输入基因表达矩阵,基于矩阵可生成基因表达可视化图像,如图31所示。然后利用13*13卷积核对基因表达可视化图像进行卷积操作,使得基因表达可视化图像中的散点粘连,得到第一卷积图。此时需要通过阈值进行判断,即根据图像二维灰度峰值检测第一卷积图的局部最大值点,取出所得所有局部最大值点中的99%分位值R,如R值与一个设定好的经验阈值差距过大(过高或过低,均会影响后续处理),则认为13*13卷积核不适用于原图,使用比例计算新的卷积核大小,然后使用新的卷积核处理原图得到第二卷积图,使用这一比例计算中值过滤器大小,然后用这个大小的中值过滤器处理第二卷积图得到中值图。而如果R值在允许范围内,则沿用第一卷积图,使用大小为35的中值过滤器处理第一卷积图得到中值图。
在得到中值图之后,使用laplacian算子对中值图进行锐化处理,得到锐化图,如图32所示。采用大律法对锐化图进行二值化处理得到初始掩模图,如图33所示,然后通过面积过滤和分水岭算法分割粘连细胞。最后输出并保存细胞掩模图像,如图34所示。
与目前现有的细胞分割方式相比,本实施例提供一种直接基于基因表达可视化图像进行细胞分割的方案,使用多种图像处理方法相结合,可提供较为可靠的细胞分割结果。细胞分割不依赖影像图,不需要额外引入将影像图与基因表达可视化图像进行配准的技术,排除了引入的额外误差,同时节省了整体操作时间和技术成本,可提高细胞分割处理的效率和准确性。
在一些实施例中,如图35所示,图35为本申请实施例提供的一种对配准后的图像进行细胞分割的方法流程示意图,包括:
步骤1036,基于所述染色图像确定所述目标对象的各个组织类型对应的标注区域和细胞面积;
具体地,可以结合染色图提供的组织信息和目标对象相关先验知识,基于染色图确定目标对象所包含的各个组织类型对应的标注区域。其中,目标对象相关先验知识可以是目标对象包含哪些细胞组织,也可以是这些组织的细胞形态。在一种可选的情况下,可以通过特定的手动工具画出目标对象各个细胞组织的组织轮廓,并且可以通过不同颜色对不同组织对应的区域进行标注。其中,特定的手动工具可以是开源工具3Dslicer,支持手动标注,还可以结合开源工具plant-seg网络进行组织区域的标注。
本步骤中的细胞面积可以是预先为目标对象的组织类型设定的参考细胞面积。也就是说,预先将各个组织类型的细胞面积进行设定,该设定好的细胞面积可以根据经验设定, 也可以根据不同对象的同一类型的组织细胞的平均值来设定。所以在执行到本步骤时,可以直接获取该预先设定好的细胞面积,将其作为标注区域对应的细胞面积,进而执行后续的处理。
步骤1037,依据所述细胞面积确定每个所述标注区域包含的待处理子区域的面积,所述待处理子区域的面积与所述细胞面积正相关,所述待处理子区域用于表征对应的所述标注区域的最小处理单元;
其中,标注区域对应的待处理子区域可以作为该标注区域的最小处理单元进行组织细胞的处理和分析,在利用基因芯片提取目标对象内细胞的位置信息时,将一个待处理子区域作为一个单元来进行提取,以待处理子区域之间的位置关系来表征该标注区域内细胞间的位置关系。因为待处理子区域的面积与细胞面积呈正相关,也就是说,上一步骤中确定出的标注区域的细胞面积越大,该标注区域被划分出的待处理子区域就越大。所以能够更好的表达出不同组织类型所对应的标注去域内细胞间的位置关系。
步骤1038,依据每个所述待处理子区域的面积,将对应的所述标注区域进行网格化处理,得到每个所述标注区域对应的网格化坐标;
具体地,对标注区域进行网格化处理的一种可选方式可以通过在每个标注区域中分别划分面积大小为对应的待处理子区域面积的网格,并得到网格化坐标。
可选地,还可以将网格的中心点坐标作为该网格的网格化坐标,其中,网格中心点坐标可以通过在捕获单元建立的坐标中获取网格所在的坐标区间,计算坐标区间的中心点坐标,确定为该网格的中心点坐标。
步骤1039,从所述基因表达可视化图像中提取所述网格化坐标对应的数据,并叠加至所述网格化坐标,得到所述目标对象的细胞处理结果。
具体地,在基因表达数据中提取各个网格化坐标对应的数据,得到目标对象的组织细胞处理数据,其中,包含目标对象的不同基因在各个组织类型的细胞组织中的表达水平,进一步结合对应的网格化坐标,生成目标对象的组织细胞处理结果。
在一种可能的实现方式中,基因表达数据包括基因标识符ID、基因坐标数据x、y,以及基因表达量MIDCount。由于此时已经确定网格化坐标,则可通过网格化坐标,确定每个网格的坐标范围。然后对比每个数据的基因坐标数据x,y与每个网格的坐标范围,如果基因坐标数据x,y落在了哪个网格的坐标范围内,则意味着该数据要叠加至这个网格,此时,可以在表达数据中为该数据设置其对应的网格的ID,即Cell ID,在后续进行数据叠加时,根据添加的Cell ID,就可以明确每个数据落在哪个网格中,也就是需要将数据叠加至哪个网格的中心点坐标上。
在一些实施例中,如图36所示,图36为本申请实施例提供的一种确定基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞的方法流程示意图,包括:
步骤1041,基于所述细胞掩模图,将所述基因表达可视化图像的每个基因表达特征分别确定为位于细胞内的细胞基因表达特征及位于细胞外的背景基因表达特征;
在本步骤中,基于所述细胞掩模图,将基因图像的每个基因表达特征分别确定为位于细胞内的细胞基因表达特征及位于细胞外的背景基因表达特征。
在本实施例中,基因表达特征为DNB,参考图37所示,图37为DNB与细胞膜的对应关系示意图,其中,x和y分别为DNB坐标,geneID、MIDCount分别表征基因信息,label表征细胞标识。将Stereo-seq空间转录组数据的每个DNB通过对应关系,得到DNB所属的细胞信息,其余不在细胞内的DNB作为背景DNB。
步骤1042,对每个所述细胞基因表达特征,通过空间位置和基因表达特征的信号值拟合出概率分布模型;
在本步骤中,对每个所述细胞基因表达特征,通过空间位置和基因表达特征的信号值拟合出概率分布模型。
作为优选实施方式,在本实施例中,概率分布模型可以为高斯混合模型,但可以采用通过不同的概率分布模型,以及对背景信号所属细胞判断中,可通过贝叶斯模型进行所属细胞判断,可根据实际需求进行相应的选择及调整。
在本步骤中,对每个细胞内的DNB,通过坐标(x,y)以及DNB信号值拟合出高斯混合模型。
步骤1043,基于所述概率分布模型,确定出针对位于一目标细胞的预设范围内的目 标背景基因表达特征属于所述目标细胞的概率值;
在本步骤中,基于概率分布模型,确定出针对位于一目标细胞的预设范围内的目标背景基因表达特征属于该细胞的概率值。其中,目标细胞可以是生物样本包含的所有细胞,也可以是生物样本包含的部分细胞。
具体地,作为可选实施方式,在本步骤中,以目标细胞为细胞a为例,对于细胞a,通过高斯混合模型计算以细胞a的中心范围50x50像素点内的背景DNB属于该细胞a的概率值。
步骤1044,根据所述概率值输出校正结果以进行背景基因表达特征的校正。
基于概率值进行背景基因表达特征的校正。
具体地,在本步骤中,判断概率值是否大于或等于预设概率值,若是,将目标背景基因表达特征作为位于目标细胞内的细胞基因表达特征,以进行背景基因表达特征的校正,若否,将目标背景基因表达特征继续作为背景基因表达特征。
参考图38所示,图32校正背景DNB的校正结果示意图,对于背景DNB,将小于预设概率值的作为背景DNB,大于或等于预设概率值的作为细胞的DNB。
在本实施例中,并不具体限定预设概率值,可根据实际需求进行相应的选择及调整。
作为可选实施方式,在本步骤中,响应于目标背景基因表达特征同时位于至少两个目标细胞外,分别确定出属于每一个对应的目标细胞的概率值;从确定出的至少两个概率值中选取最高的概率值作为输出校正结果的概率值,并且将最高的概率值对应的目标细胞作为目标背景基因表达特征所属的细胞。
以目标细胞为细胞a和细胞b为例,假设对于背景基因表达特征A同时在细胞a和细胞b的中心范围50x50像素点内,计算背景基因表达特征A所属于细胞a的概率值为x1,背景基因表达特征A所属于细胞b的概率值为x2,若x1大于x2,则确定背景基因表达特征A为细胞a的基因表达特征。
在一些实施例中,如图39所示,图39为本申请实施例提供的一种确定基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞的方法流程示意图,包括:
步骤1045,根据所述基因表达可视化图像,确定所属于目标细胞的初始基因分子以及未知所属细胞的背景基因分子;
步骤1046,获取所述初始基因分子的坐标信息;
将显微镜图像和基因图像按照坐标进行对齐,通过显微镜图的细胞分割边界,即可以获取细胞内初始基因分子的坐标信息。
步骤1047,根据所述坐标信息,确定所述目标细胞的中心点坐标;
步骤1048,根据所述中心点坐标和所述坐标信息,构建维诺图;
其中,维诺图(Voronoi图,又叫泰森多边形或Dirichlet图)是由一组由连接两邻点直线的垂直平分线组成的连续多边形组成。N个在平面上有区别的点,按照最邻近原则划分平面;每个点与它的最近邻区域相关联。
步骤1049,确定所述维诺图范围内的背景基因分子的所属细胞。
根据对维诺图范围内的背景基因分子设置的标签,可以将维诺图范围内的背景基因分子确定完全属于目标细胞,也可以确定部分属于目标细胞,也可以确定完全不属于目标细胞。
在本实施例中,通过所属于目标细胞的初始基因分子的坐标信息,确定目标细胞的中心点坐标,再根据目标细胞的中心点坐标构建维诺图,确定维诺图范围内的背景基因分子的所属细胞,提高了校正效率,同时也提高了校正的精确度。另外,本实施例只要能确定目标细胞内的初始基因分子即可,无需了解目标细胞的轮廓图,因此,降低了对细胞分割高精度的要求,减少对目标细胞形态影像图的依赖程度,提高了校正方案的稳健性。
在一些实施例中,所述根据基因图像,确定所属于目标细胞的初始基因分子以及未知所属细胞的背景基因分子的步骤包括:
获取生物样本的显微镜图像及基因图像;
对生物样本的显微镜图像及基因图像进行图像配准;
对所述显微镜图像进行细胞分割以获取细胞分割结果;
基于所述细胞分割结果和所述基因图像的图像配准结果,确定目标细胞的基因图像;
根据所述目标细胞的基因图像,确定所属于目标细胞的初始基因分子以及未知所属细 胞的背景基因分子。
在一些实施例中,所述根据所述坐标信息,确定所述目标细胞的中心点坐标的步骤包括:
统计所述初始基因分子的分子数量;
计算所述初始基因分子的横坐标数值总和以及纵坐标数值总和;
将第一比值确定为所述中心点坐标的横坐标值;所述第一比值为所述初始基因分子的横坐标数值总和与所述分子数量的比值;
将第二比值确定为所述中心点坐标的纵坐标值;所述第二比值为所述初始基因分子的纵坐标数值总和与所述分子数量的比值。
在一些实施例中,所述根据所述坐标信息,确定所述目标细胞的中心点坐标的步骤包括:
获取所述初始基因分子中最大的横坐标值、最小的横坐标值、最大的纵坐标值以及最小的纵坐标值;
将第三比值确定为所述中心点坐标的横坐标值;所述第三比值为最大的横坐标值与最小的横坐标值之差的二分之一;
将第四比值确定为所述中心点坐标的纵坐标值;所述第四比值为最大的纵坐标值与最小的纵坐标值之差的二分之一。
在一些实施例中,所述基因图像数据校正方法还包括:
若所述背景基因分子在不同的维诺图范围内,则将所述背景基因分子输入高斯混合模型,分别确定所述背景基因分子属于距离预设范围内的目标细胞的概率分数;
将所述背景基因分子校正为所属于所述概率分数高的目标细胞的基因分子。
在一些实施例中,所述确定所述维诺图范围内的背景基因分子的所属细胞的步骤后包括:
根据校正后所属于所述目标细胞的基因分子的结果生成目标细胞基因表达信息。
在一些实施例中,所述根据所述中心点坐标和所述坐标信息,构建维诺图的步骤包括:
对所有所述中心点坐标构建多边形网;
根据所述多边形网,确定维诺图的边;
根据所述维诺图的边,构建维诺图。
在一些实施例中,如图40所示,图40为本申请实施例提供的一种确定基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞的方法流程示意图,包括:
步骤10410,确定所述基因表达可视化图像中所属于目标细胞的基因分子的初始分子数量以及所述所属于目标细胞的基因分子所占的目标区域的初始轮廓面积;
采用凸包算法,对细胞分割结果进行运算确定所属于目标细胞的基因分子所占的目标区域的初始轮廓面积。其中,凸包算法(Convex Hull Algorithm)即根据细胞分割结果,在目标区域内寻找N个点的凸包,这N个点之间的连接包围的是就是初始轮廓面积。
步骤10411,根据所述分子数量和所述初始轮廓面积,确定所述目标细胞的基因分子密度;
在一个可选的实施方式中,将分子数量和初始轮廓面积的比值确定为目标细胞的基因分子密度。
步骤10412,确定所述目标区域的预设区域范围内的背景基因分子的分子数量以及所述预设区域范围的区域面积;
其中,背景基因分子为根据基因图像不能确定所属细胞的基因分子,预设区域范围位于目标区域外,但不能超过所属于邻近细胞的基因分子所占的区域。可选区域面积为5像素*5像素作为预设区域范围。
在一个可选的实施方式中,预设区域范围可以是以根据目标细胞的中心点为中心确定的区域。目标细胞的中心点由基因图像确定,目标细胞的中心点的示意图参见图41。
步骤10413,根据所述背景基因分子的分子数量和区域面积,确定背景基因分子密度;
在一个可选的实施方式中,将背景基因分子的分子数量和区域面积的比值确定为背景基因分子密度。
步骤10414,根据所述基因分子密度与所述背景基因分子密度确定所述背景基因分子的所属细胞。
在本实施例中,利用上述细胞特性,根据基因图像中所属于目标细胞的基因分子的初始分子数量与目标细胞初始轮廓面积,确定目标细胞的基因分子密度。比较目标细胞的基因分子密度和背景基因分子密度,根据基因分子密度与背景基因分子密度确定背景基因分子的所属细胞,大幅度提高了校正目标细胞内的基因分子的效率,同时也增加了校正目标细胞内的基因分子的精确度。
在一些实施例中,如图42所示,图42为本申请实施例提供的一种确定基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞的方法流程示意图,包括:
步骤10415,确定所述基因表达可视化图像中所属于目标细胞的基因分子所占的目标区域;
步骤10416,确定所述目标区域的预设校正范围内的未知所属细胞的背景基因分子的空间坐标及基因表达特征信号值;
其中,本实施例的基因表达特征为DNB,将Stereo-seq空间转录组数据的每个DNB通过对应关系,可以得到DNB所属的细胞信息,其余不在细胞内的DNB作为背景DNB。背景基因分子的空间坐标可以用背景DNB的坐标表示。
步骤10417,将所述空间坐标和所述基因表达特征信号值输入概率分布模型,以得到所述背景基因分子所属于所述目标细胞的概率分数;所述概率分布模型根据所属于目标细胞的基因分子样本的空间坐标及基因表达特征信号值拟合得到;
拟合GMM模型(高斯混合模型)时,自变量有三个:空间坐标(x,y)和信号值。因变量即输出是每个基因分子属于目标细胞的概率分数。具体实现过程为:引入了Scikit-learn(一种机器学习库)库中的Gaussian Mixture(高斯混合),利用输入数据自动拟合GMM模型的参数信息,得到最终的概率模型。
其中,概率分布模型根据所属于目标细胞的基因分子样本的空间坐标及基因表达特征信号值样本拟合得到。作为优选实施方式,在本实施例中,概率分布模型可以为高斯混合模型。
步骤10418,根据所述概率分数确定所述背景基因分子的所属细胞。
比较概率分数是否大于或者等于概率阈值。
若概率分数大于或者等于概率阈值,则执行将背景基因分子校正为所属于目标细胞的基因分子。若概率分数小于概率阈值,背景基因分子仍然是未知所属细胞的背景分子。
在一个可选的实施方式中,将第一概率分数与第二概率分数之间的第三四分位数确定为概率阈值。
其中,第一概率分数为概率分数中分数值最高的概率分数;第二概率分数为概率分数中分数值最低的概率分数。
在本实施例中,在大致了解目标细胞的目标区域前提下,计算预设校正范围内的未知所属细胞的背景基因分子的所属于目标细胞的概率分数,并根据概率分数确定背景基因分子的所属细胞。减少了因基因分子扩散的原因导致基因图像数据误差大的情况,提高了校正效率。同时不依赖于高精度的细胞分割结果,增强了校正方案的稳健性。
进一步的,本申请还提供芯片上的track cross的检测,主要是为了后续的拼接修正和配准。拼接和配准都有用track的检测结果。
图43示出了根据本发明的一个实施例的染色图像中的点坐标的确定方法100的流程图。所述方法100可以包括采样步骤1001、分组步骤1002、直线拟合步骤1003以及坐标计算步骤1004。
为了便于理解本发明的确定方法,现在参考图44示例性说明本文所涉及的染色图像。图38示出了本发明适用的一个示例染色图像。该染色图像可以通过摄像机、染色图像传感器等获取。该染色图像可以是具有直轨迹线的例如机械结构、载体、载片或生物芯片的染色图像。如图38中所示出的,该染色图像所在的染色图像平面可包括第一方向X和与第一方向X垂直的第二方向Y,该染色图像包括横向于第二方向Y的多个第一直轨迹线(即,该染色图像中的大体上平行于第一方向X的多个暗线)和横向于第一方向X的多个第二直轨迹线(即,该染色图像中的大体上平行于第二方向Y的多个暗线)。具体地,在该示例染色图像中存在6个第一直轨迹线和8个第二直轨迹线。由于每个第一直轨迹线与每个第二直轨迹线相交,因此在该示例染色图像中存在共6×8=48个交点。如图38中所示出的,该 染色图像可以具有像素长度L和像素宽度W。在图38中还示出了示例第二采样条。作为例示而非限制,该采样条的像素长度与该示例染色图像的像素长度相同,即为L,并且该采样条的像素宽度小于该示例染色图像的像素宽度,为W2。在本文中,一直轨迹线横向于任一方向是指该直轨迹线平行于垂直于该任一方向的方向或与垂直于该任一方向的方向的夹角小于一预设值。所述预设值的范围可以包括1到10度、10到20度、20到30度、30到40度或40到50度等,例如所述预设值可以是1度、2度、3度、4度、5度、6度、7度、8度、9度、10度。
采样步骤1001包括第一方向采样步骤和第二方向采样步骤。
在第一方向采样步骤中,应用第一采样条沿所述第一方向对所述染色图像进行第一方向等间隔采样以确定第一候选点集合,其中对于每次第一方向等间隔采样,执行以下第一方向采样子步骤一和第一方向采样子步骤二。第一方向采样子步骤一包括:将所述第一采样条在该次第一方向等间隔采样期间所选中的所述染色图像的采样区域内的像素按所述第一方向进行像素值累加求和以得到一系列第一像素值和,其中所述一系列第一像素值和在所述第二方向上的任一第二方向位置处的值等于所述采样区域内的、在该第二方向位置处沿所述第一方向对准的各像素的像素值之和。第一方向采样子步骤二包括:确定所述一系列第一像素值和的极值点,并且对于确定的每个极值点:确定该次第一方向等间隔采样所获得的一个对应第一候选点,该对应第一候选点在所述第二方向上的坐标为该极值点所对应的第二方向位置在所述第二方向上的坐标,该对应第一候选点在所述第一方向上的坐标基于在该次第一方向等间隔采样期间所述第一采样条在所述第一方向上的位置确定。如此,由每次第一方向等间隔采样所获得的第一候选点形成所述第一候选点集合。
在第二方向采样步骤中,应用第二采样条沿所述第二方向对所述染色图像进行第二方向等间隔采样以确定第二候选点集合,其中对于每次第二方向等间隔采样,执行以下第二方向采样子步骤一和第二方向采样子步骤二。第二方向采样子步骤一包括:将所述第二采样条在该次第二方向等间隔采样期间所选中的所述染色图像的采样区域内的像素按所述第二方向进行像素值累加求和以得到一系列第二像素值和,其中所述一系列第二像素值和在所述第一方向上的任一第一方向位置处的值等于所述采样区域内的、在该第一方向位置处沿所述第二方向对准的各像素的像素值之和。第二方向采样子步骤二包括:确定所述一系列第二像素值和的极值点,并且对于确定的每个极值点:确定该次第二方向等间隔采样所获得的一个对应第二候选点,该对应第二候选点在所述第一方向上的坐标为该极值点所对应的第一方向位置在所述第一方向上的坐标,该对应第二候选点在所述第二方向上的坐标基于在该次第二方向等间隔采样期间所述第二采样条在所述第二方向上的位置确定。如此,由每次第二方向等间隔采样所获得的第二候选点形成所述第二候选点集合。
在采样步骤1001中所用的所有极值点可以同为极大值点或同为极小值点。例如,若所述直轨迹线为暗线,则所用的所有极值点可同为极小值点;若所述直轨迹线为亮线,则所用的所有极值点可同为极大值点。
在分组步骤1002中,将所述第一候选点集合中的第一候选点分成多个第一候选点组;以及将所述第二候选点集合中的第二候选点分成多个第二候选点组。
在一个实施例中,以第一分组方式将所述第一候选点集合中的第一候选点分成多个第一候选点组,其中所述第一分组方式被配置成使得每个第一候选点组中的各第一候选点基本上呈横向于所述第二方向的一直线排列。并且,以第二分组方式将所述第二候选点集合中的第二候选点分成多个第二候选点组,其中所述第二分组方式被配置成使得每个第二候选点组中的各第二候选点基本上呈横向于所述第一方向的一直线排列。
在直线拟合步骤1003中,对每个第一候选点组中的第一候选点进行直线拟合以得到一个相应的第一直线解析式;以及对每个第二候选点组中的第二候选点进行直线拟合以得到一个相应的第二直线解析式。
基于已知坐标的多个点进行直线拟合以得到直线解析式是本领域已知的,在此不作赘述。常用的直线拟合方法包括:最小二乘法;梯度下降法;高斯牛顿、列-马法。
在坐标计算步骤1004中,计算得到的每个第一直线解析式与每个第二直线解析式的交点的坐标。对于已知的两个直线解析式求其交点的坐标的方法是本领域已知的,在此不作赘述。
图45为本申请实施例提供的一种有向目标检测方法,包括:
步骤1005,获取待测染色图像或基因表达可视化图像。
步骤1006,将所述待测染色图像或基因表达可视化图像输入有向目标检测网络,以获得目标检测结果。
具体地,待测染色图像或基因表达可视化图像输入到训练后的基于YOLOV6的有向目标检测模型中,利用有向目标检测模型中训练好的多级卷积神经网络对待检测图像进行卷积操作、特征图的融合,输出不同尺度的特征融合图;对于不同尺度的特征融合图,分别采用对应的预测器来预测类别置信度、目标框定位置信度、目标检测置信度和角度分类置信度。
其中,所述Backbone层采用RepVGG架构,并且所述Neck层采用FPN-PAN架构。
所述Head层采用解耦头,使得经由分类分支执行类别分析以获得所述分类信息,并经由回归分支执行回归分析以分别获得所述目标框坐标预测信息、所述目标预测信息和所述角度预测信息。用于表示类别分析结果的分类信息、用于确定目标检测框位置的目标框坐标预测信息、用于确定目标检测框内是否存在对应目标的目标预测信息和用于确定目标检测框的角度的角度预测信息,对应目标可以包括track线或track cross(也称轨迹交叉点)。本申请实施例提供一种用于训练基于YOLOV6的有向目标检测网络的方法,所述方法包括:获取多个训练图像和所述多个训练图像中包括标签的标签信息;以及将所述多个训练图像和所述标签信息输入所述基于YOLOV6的有向目标检测网络以通过训练获得所述基于YOLOV6的有向目标检测网络的设置参数;其中,所述基于YOLOV6的有向目标检测网络包括:主干Backbone层,被配置为对训练图像执行特征提取,以获得不同尺度的多个特征图;颈部Neck层,被配置为从Backbone层接收所述多个特征图,并对所述多个特征图进行跨尺度融合,以获得多个融合特征图;以及检测头Head层,被配置为对所述多个融合图像进行预测,以获得关于所述训练图像的预测结果,其中所述预测结果包括:分类信息、目标框坐标预测信息、目标预测信息和角度预测信息。
在一些实施例中,所述Backbone层采用RepVGG架构,并且所述Neck层采用FPN-PAN架构。
在一些实施例中,所述Head层采用解耦头,使得经由分类分支执行类别分析以获得所述分类信息,并经由回归分支执行回归分析以分别获得所述目标框坐标预测信息、所述目标预测信息和所述角度预测信息。
在一些实施例中,将所述多个训练图像和所述标签信息输入所述基于YOLOV6的有向目标检测网络以通过训练获得所述基于YOLOV6的有向目标检测网络的设置参数包括:在每次训练中,
获取针对当前训练的相应训练图像和相应标签信息;
使用所述基于YOLOV6的有向目标检测网络对所述相应训练图像中的目标进预测,以获得相应预测结果;
根据相应标签信息和相应预测结果,计算所述基于YOLOV6的有向目标检测网络的损失函数;以及
基于所述损失函数的计算结果,调整所述基于YOLOV6的有向目标检测网络的设置参数,直到所述损失函数的计算结果收敛为止。
在一些实施例中,还包括:对所获取的具有第一数据形式的标签信息进行预处理,以将所述标签信息处理为[x,y,w,h,θ,classID]形式的数据,并将经处理的数据输入所述基于YOLOV6的有向目标检测网络,
其中,(x,y)表示目标检测框的中心的位置,w表示所述目标检测框的长边宽度,h表示所述目标检测框的短边高度,θ表示所述目标检测框的长边相对于水平轴旋转的角度,且classID表示所述目标检测框的类别。
在一些实施例中,所述标签信息的第一数据形式为[x1,y1,x2,y2,x3,y3,x4,y4,classID],其中,(x1,y1)、(x2,y2)、(x3,y3)和(x4,y4)分别定义目标检测框的四个顶点的位置。
在一些实施例中,还包括:对所获得的[x,y,w,h,θ,conf,classID]形式的预测结果进行后处理,以将所述预测结果处理为具有第二数据形式的数据,并将所述具有第二数据形式的数据呈现给用户,
其中,(x,y)表示目标检测框的中心的位置,w表示所述目标检测框的长边宽度,h 表示所述目标检测框的短边高度,θ表示所述目标检测框的长边相对于水平轴旋转的角度,conf表示所述目标检测框具有相应目标的置信度,且classID表示所述目标检测框的类别。
在一些实施例中,所述第二数据形式为[x1,y1,x2,y2,x3,y3,x4,y4,conf,classID],其中,(x1,y1)、(x2,y2)、(x3,y3)和(x4,y4)分别定义所述目标检测框的四个顶点的位置。
进一步的,如图46所示,图46为本申请实施例提供的一种生物样本的细胞基因表达信息获取方法包括:
步骤1101,获取生物样本的第一图像,所述第一图像包括所述生物样本经染色的细胞边界;
步骤1102,获取所述生物样本的第二图像,所述第二图像包括所述生物样本经染色的遗传物质;
步骤1103,获取所述生物样本的基因表达量信息;
步骤1104,将所述第二图像与所述第一图像配准,得到第二图像与第一图像的配准图像;
步骤1105,将所述第二图像与所述基因表达量信息进行配准,得到第二图像与第基因表达量信息的配准图像;
步骤1106,根据第二图像与第一图像的配准图像、第二图像与基因表达量信息的配准图像获取第一图像与基因表达量信息的配准图像;
步骤1107,根据第一图像与基因表达量信息的配准图像获取所述生物样本的细胞边界;
步骤1108,基于第一图像与基因表达量信息的配准图像根据所述细胞边界获取所述生物样本的细胞的基因表达信息。
在一些实施例中,以ssDNA染液和细胞边界荧光染色液对生物样本的细胞进行染色,其中,所述ssDNA染液包括缓冲液和ssDNA试剂,所述细胞边界荧光染色液包括荧光染料。ssDNA染液可以对细胞的遗传物质进行染色,细胞边界荧光染色液可以对细胞的边界进行染色。
在一些实施例中,所述细胞边界包括细胞壁或细胞膜。
在一些实施例中,所述组织样本的细胞的基因表达信息包括载有所述组织样本的芯片上每个位点的位置信息、基因表达量和细胞类型。
在一些实施例中,将所述第二图像与所述基因表达量信息进行配准,得到第二图像与基因表达量信息的配准图像包括:
根据所述第二图像中的track线和所述基因表达量信息的track线对所述第二图像和所述基因表达量信息进行配准,得到所述第二图像与基因表达量信息的配准图像。
在一些实施例中,通过细胞染色试剂对组织样本进行染色后进行呈像,所述呈像通过FITC通道获取所述组织样本的第二图像,通过DAPI通道获取所述组织样本的第一图像,所述细胞染色试剂包括:ssDNA染液和细胞边界荧光染色液;所述ssDNA染液包括缓冲液和ssDNA试剂;所述细胞边界荧光染色液包括荧光染料。
需要说明的是,上述序号的顺序不代表具体的执行步骤。
与上述的空间组学单细胞数据获取方法相对应,本发明还提出一种空间组学单细胞数据获取装置。由于本发明的装置实施例与上述的方法实施例相对应,对于装置实施例中未披露的细节可参照上述的方法实施例,本发明中不再进行赘述。
图47为本申请实施例提供的一种空间组学单细胞数据获取装置的结构示意图,如图47所示,包括:
获取单元21,用于获取生物样本的染色图像,获取所述生物样本的基因表达可视化图像;
配准单元22,用于将所述染色图像与所述基因表达可视化图像进行配准,得到配准后的图像;
第一分割单元23,用于对所述配准后的图像进行细胞分割,得到细胞掩模图;
修正单元24,用于根据所述细胞掩码图确定所述基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞;
标记单元25,用于对所属细胞标记,得到带细胞标记的空间组分子表达矩阵。
获取生物样本的染色图像,获取所述生物样本的基因表达可视化图像;将所述染色图像与所述基因表达可视化图像进行配准,得到配准后的图像;对所述配准后的图像进行细胞分割,得到细胞掩模图;根据所述细胞掩码图确定所述基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞,并对所属细胞标记,得到带细胞标记的空间组分子表达矩阵。与相关技术相比,本申请实施例通过基因表达矩阵图、拼接、配准、分割和校正的处理流程,以获得高精度的空间单细胞数据。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述获取单元21,还用于:
通过显微镜获取所述生物样本的一个染色图像;或
通过显微镜获取所述生物样本的由多个子染色图像拼接的拼接染色图像;或
通过所述显微镜获取所述生物样本的多个子染色图像,对所述多个子染色图像进行拼接,得到拼接染色图像。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述获取单元21包括:
第一获取模块,用于通过显微镜获取所述生物样本的多个子染色图像;对所述生物样本的多个子染色图像进行第一拼接,得到第一染色图像;
判断模块,用于根据所述第一染色图像的图像质量判断是否对所述生物样本的多个子染色图像进行第二拼接;
确定模块,用于若否,将所述第一染色图像确定为所述染色图像;
第二获取模块,用于若是,对所述生物样本的多个子染色图像进行第二拼接,得到所述染色图像。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述第一获取模块,还用于:
分别确定多个子染色图像和模板图像的重叠区域;
将所述多个子染色图像和所述模板图像的被确定为重叠区域的部分分别裁剪为多个染色图像重叠子图和数量相同的多个模板图像重叠子图,以配对为多个重叠子图对;
通过对所述多个重叠子图对进行频域计算,分别获得各子染色图像和所述模板图像之间的偏移量;以及
将所述各子染色图像分别朝向所述模板图像的方向平移所述偏移量,并与所述模板图像拼接在一起。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述第一获取模块,还用于:
获取所述多个子染色图像以及关于所述生物样本的轨迹线或轨迹点的模板信息;
对所述多个子染色图像进行预拼接得到所述多个子染色图像的预拼接坐标;
根据轨迹线或轨迹点的特征从所述多个子染色图像中选取至少一个第一参考图像,根据所述生物样本的模板信息和所述第一参考图像的预拼接坐标推导全局模板;以及
对于所述多个子染色图像中除了所述第一参考图像之外的第二参考图像,计算所述第二参考图像的预拼接坐标与所述第二参考图像在所述全局模板中的相应模板坐标之间的偏移量,并基于所述偏移量对所述第二参考图像进行坐标调整以拼接生成所述拼接染色图像。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述配准单元22 包括:
获取模块,用于获取所述染色图像中的轨迹线,基于所述轨迹线与水平方向的夹角旋转所述染色图像;其中,所述染色图像和所述基因表达可视化图像包括多条轨迹线和/或多个轨迹点,所述轨迹点是由两条所述轨迹线相交形成的,所述多条轨迹线中的每条轨迹线具有对应的索引号;
处理模块,用于将所述染色图像进行放大或缩小得到第三参考图像,所述第三参考图像与所述基因表达可视化图像具有相同的比例;
第一确定模块,用于基于所述基因表达可视化图像和所述第三参考图像确定目标偏移量;
配准模块,用于基于所述目标偏移量移动所述第三参考图像,得到所述配准后的图像。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述配准单元22还包括:
第二确定模块,用于在所述处理模块将所述染色图像进行放大或缩小得到第三参考图像之后,确定所述第三参考图像与基因表达可视化图像之间的相似度;
粗配准模块,用于将相似度最大值对应的位置作为粗配准结果。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述配准单元22还用于:
获取染色图像和基因表达可视化图像,所述染色图像和所述基因表达可视化图像均包括多条轨迹线和多个轨迹点,所述轨迹点是由两条所述轨迹线相交形成的,每条所述轨迹线具有对应的索引号;
对所述染色图像进行预处理,获取候选图像集合;
确定所述候选图像集合对应的二值图集合;
基于所述二值图集合与所述基因表达可视化图像之间的相似度,确定所述二值图集合与所述基因表达可视化图像中具有对应关系的轨迹点对;
基于所述轨迹点对确定偏移信息;
基于所述偏移信息处理目标图像,以得到配准后的图像,所述目标图像为所述轨迹点对所对应的候选图像集合中的图像。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述装置还包括:
第二分割单元26,用于在所述第一分割单元对所述配准后的图像进行细胞分割,得到细胞掩模图之前,对所述配准后的图像进行组织分割,得到组织掩模图。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述第二分割单元26还用于:
获取所述配准后的图像中待分割的目标组织的基因表达量并确定所述配准后的图像的基因表达矩阵,所述基因表达矩阵按照像素位置对所述基因表达量进行排列;
通过将所述基因表达矩阵中每一像素位置的基因表达量赋值于配准后的图像中对应的像素位置确定图像数据;
通过对所述图像数据进行图像处理以确定所述图像数据的前景像素点;
根据所述前景像素点对所述图像数据的连通区域进行标记得到所述组织掩模图。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述装置还包括:
计算单元27,用于在所述第二分割单元对所述配准后的图像进行组织分割,得到组织掩模图之后,分别计算得到组织掩模图对应的灰度图像的外轮廓图像与内轮廓图像;
配对单元28,用于将所述外轮廓图像与所述内轮廓图像分别分为N段,并将每段所述外轮廓图像与每段所述内轮廓图像两两配对,得到N个图像组合,每个所述图像组合包括一段外轮廓图像与一段内轮廓图像;
所述计算单元27,还用于分别计算每个所述图像组合中一段外轮廓图像与一段内轮廓图像的像素密度比值,得到N个所述像素密度比值,所述像素密度比值为每个所述图像组合中一段外轮廓图像与一段内轮廓图像的像素占比的比值,所述像素占比为像素点与总像素点的比值;
所述计算单元,还用于根据所述像素密度比值计算描述所述组织掩模图对应的灰 度图像质量。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述第一分割单元23,还用于:
将所述配准后的图像输入所述图像分割模型,获得所述配准后的图像中各个像素点的分割结果,所述分割结果包括属于细胞、属于细胞轮廓或者图像背景;
将所述分割结果属于细胞或细胞轮廓的像素点确定属于细胞的像素点,输出所述配准后的图像的分割结果,得到所述细胞掩模图。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述第一分割单元23,还用于:
对所述基因表达可视化图像进行预处理,得到预处理图;
将所述预处理图进行二值化处理,得到初始掩模图;
根据所述初始掩模图,利用基于距离变换的分水岭算法对存在细胞粘连的连通域进行分割,得到分割后的所述细胞掩模图。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述第一分割单元23,还用于:
基于所述染色图像确定所述目标对象的各个组织类型对应的标注区域和细胞面积;
依据所述细胞面积确定每个所述标注区域包含的待处理子区域的面积,所述待处理子区域的面积与所述细胞面积正相关,所述待处理子区域用于表征对应的所述标注区域的最小处理单元;
依据每个所述待处理子区域的面积,将对应的所述标注区域进行网格化处理,得到每个所述标注区域对应的网格化坐标;
从所述基因表达可视化图像中提取所述网格化坐标对应的数据,并叠加至所述网格化坐标,得到所述目标对象的细胞处理结果。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述修正单元24,还用于:
基于所述细胞掩模图,将所述基因表达可视化图像的每个基因表达特征分别确定为位于细胞内的细胞基因表达特征及位于细胞外的背景基因表达特征;
对每个所述细胞基因表达特征,通过空间位置和基因表达特征的信号值拟合出概率分布模型;
基于所述概率分布模型,确定出针对位于一目标细胞的预设范围内的目标背景基因表达特征属于所述目标细胞的概率值;
根据所述概率值输出校正结果以进行背景基因表达特征的校正。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述修正单元24,还用于包括:
根据所述基因表达可视化图像,确定所属于目标细胞的初始基因分子以及未知所属细胞的背景基因分子;
获取所述初始基因分子的坐标信息;
根据所述坐标信息,确定所述目标细胞的中心点坐标;
根据所述中心点坐标和所述坐标信息,构建维诺图;
确定所述维诺图范围内的背景基因分子的所属细胞。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述修正单元24,还用于包括:
确定所述基因表达可视化图像中所属于目标细胞的基因分子的初始分子数量以及所述所属于目标细胞的基因分子所占的目标区域的初始轮廓面积;
根据所述分子数量和所述初始轮廓面积,确定所述目标细胞的基因分子密度;
确定所述目标区域的预设区域范围内的背景基因分子的分子数量以及所述预设区域范围的区域面积;
根据所述背景基因分子的分子数量和区域面积,确定背景基因分子密度;
根据所述基因分子密度与所述背景基因分子密度确定所述背景基因分子的所属细胞。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述修正单元24,还用于包括:
确定所述基因表达可视化图像中所属于目标细胞的基因分子所占的目标区域;
确定所述目标区域的预设校正范围内的未知所属细胞的背景基因分子的空间坐标及基因表达特征信号值;
将所述空间坐标和所述基因表达特征信号值输入概率分布模型,以得到所述背景基因分子所属于所述目标细胞的概率分数;所述概率分布模型根据所属于目标细胞的基因分子样本的空间坐标及基因表达特征信号值拟合得到;
根据所述概率分数确定所述背景基因分子的所属细胞。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述标记单元25,还用于:
以ssDNA染液和细胞边界荧光染色液对所属细胞进行染色,其中,所述ssDNA染液包括缓冲液和ssDNA试剂,所述细胞边界荧光染色液包括荧光染料。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述装置还包括检测单元29,包括:
获取待测染色图像或基因表达可视化图像;以及
将所述待测染色图像或基因表达可视化图像输入有向目标检测网络,以获得目标检测结果,
其中所述有向目标检测网络包括:
主干Backbone层,被配置为对待测染色图像或基因表达可视化图像执行特征提取,以获得不同尺度的多个特征图;
颈部Neck层,被配置为从Backbone层接收所述多个特征图,并对所述多个特征图进行跨尺度融合,以获得多个融合特征图;以及
检测头Head层,被配置为对所述多个融合图像进行预测,以获得关于所述待测染色图像或基因表达可视化图像的目标检测结果,
其中所述目标检测结果包括:分类信息、目标框坐标预测信息、目标预测信息和角度预测信息。
可选的,还包括确定单元210,确定单元210用于:
所述染色图像所在的染色图像平面包括第一方向和与所述第一方向垂直的第二方向,所述染色图像包括横向于所述第二方向的多个第一直轨迹线和横向于所述第一方向的多个第二直轨迹线,
采样步骤,包括:
应用第一采样条沿所述第一方向对所述染色图像进行第一方向等间隔采样以确定第一候选点集合,其中对于每次第一方向等间隔采样,执行以下子步骤:
将所述第一采样条在该次第一方向等间隔采样期间所选中的所述染色图像的采样区域内的像素按所述第一方向进行像素值累加求和以得到一系列第一像素值和;以及
确定所述一系列第一像素值和的极值点,并且对于确定的每个极值点:确定该次第一方向等间隔采样所获得的一个对应第一候选点,该对应第一候选点在所述第二方向上的坐标为该极值点所对应的第二方向位置在所述第二方向上的坐标,该对应第一候选点在所述第一方向上的坐标基于在该次第一方向等间隔采样期间所述第一采样条在所述第一方向上的位置确定,
其中,由每次第一方向等间隔采样所获得的第一候选点形成所述第一候选点集合;
应用第二采样条沿所述第二方向对所述染色图像进行第二方向等间隔采样以确定第二候选点集合,其中对于每次第二方向等间隔采样,执行以下子步骤:
将所述第二采样条在该次第二方向等间隔采样期间所选中的所述染色图像的采样区域内的像素按所述第二方向进行像素值累加求和以得到一系列第二像素值和;以及
确定所述一系列第二像素值和的极值点,并且对于确定的每个极值点:确定该次第二方向等间隔采样所获得的一个对应第二候选点,该对应第二候选点在所述第一方 向上的坐标为该极值点所对应的第一方向位置在所述第一方向上的坐标,该对应第二候选点在所述第二方向上的坐标基于在该次第二方向等间隔采样期间所述第二采样条在所述第二方向上的位置确定,
其中,由每次第二方向等间隔采样所获得的第二候选点形成所述第二候选点集合;
分组步骤,包括:
将所述第一候选点集合中的第一候选点分成多个第一候选点组;以及
将所述第二候选点集合中的第二候选点分成多个第二候选点组;
直线拟合步骤,包括:
对每个第一候选点组中的第一候选点进行直线拟合以得到一个相应的第一直线解析式;以及
对每个第二候选点组中的第二候选点进行直线拟合以得到一个相应的第二直线解析式;以及
坐标计算步骤,包括:
计算每个第一直线解析式与每个第二直线解析式的交点的坐标。
进一步地,在本实施例一种可能的实现方式中,如图48所示,所述装置还包括:分析单元211,所述分析单元用于:
获取生物样本的第一图像,所述第一图像包括所述生物样本经染色的细胞边界;
获取所述生物样本的第二图像,所述第二图像包括所述生物样本经染色的遗传物质;
获取所述生物样本的基因表达量信息;
将所述第二图像与所述第一图像配准,得到第二图像与第一图像的配准图像;
将所述第二图像与所述基因表达量信息进行配准,得到第二图像与第基因表达量信息的配准图像;
根据第二图像与第一图像的配准图像、第二图像与基因表达量信息的配准图像获取第一图像与基因表达量信息的配准图像;
根据第一图像与基因表达量信息的配准图像获取所述生物样本的细胞边界;
基于第一图像与基因表达量信息的配准图像根据所述细胞边界获取所述生物样本的细胞的基因表达信息。
根据本申请的实施例,本申请还提供了一种电子设备、一种可读存储介质和一种计算机程序产品。
图49示出了可以用来实施本申请的实施例的示例电子设备300的示意性框图。电子设备旨在表示各种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。电子设备还可以表示各种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本申请的实现。
如图49所示,设备300包括计算单元301,其可以根据存储在ROM(Read-Only Memory,只读存储器)302中的计算机程序或者从存储单元308加载到RAM(Random Access Memory,随机访问/存取存储器)303中的计算机程序,来执行各种适当的动作和处理。在RAM 303中,还可存储设备300操作所需的各种程序和数据。计算单元301、ROM 302以及RAM 303通过总线304彼此相连。I/O(Input/Output,输入/输出)接口305也连接至总线304。
设备300中的多个部件连接至I/O接口305,包括:输入单元306,例如键盘、鼠标等;输出单元307,例如各种类型的显示器、扬声器等;存储单元308,例如磁盘、光盘等;以及通信单元309,例如网卡、调制解调器、无线通信收发机等。通信单元309允许设备300通过诸如因特网的计算机网络和/或各种电信网络与其他设备交换信息/数据。
计算单元301可以是各种具有处理和计算能力的通用和/或专用处理组件。计算单元301的一些示例包括但不限于CPU(Central Processing Unit,中央处理单元)、GPU(Graphic Processing Units,图形处理单元)、各种专用的AI(Artificial  Intelligence,人工智能)计算芯片、各种运行机器学习模型算法的计算单元、DSP(Digital Signal Processor,数字信号处理器)、以及任何适当的处理器、控制器、微控制器等。计算单元301执行上文所描述的各个方法和处理,例如空间组学单细胞数据获取方法。例如,在一些实施例中,空间组学单细胞数据获取方法可被实现为计算机软件程序,其被有形地包含于机器可读介质,例如存储单元308。在一些实施例中,计算机程序的部分或者全部可以经由ROM 302和/或通信单元309而被载入和/或安装到设备300上。当计算机程序加载到RAM 303并由计算单元301执行时,可以执行上文描述的方法的一个或多个步骤。备选地,在其他实施例中,计算单元301可以通过其他任何适当的方式(例如,借助于固件)而被配置为执行前述空间组学单细胞数据获取方法。
本文中以上描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、FPGA(Field Programmable Gate Array,现场可编程门阵列)、ASIC(Application-Specific Integrated Circuit,专用集成电路)、ASSP(Application Specific Standard Product,专用标准产品)、SOC(System On Chip,芯片上系统的系统)、CPLD(Complex Programmable Logic Device,复杂可编程逻辑设备)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。
用于实施本申请的方法的程序代码可以采用一个或多个编程语言的任何组合来编写。这些程序代码可以提供给通用计算机、专用计算机或其他可编程数据处理装置的处理器或控制器,使得程序代码当由处理器或控制器执行时使流程图和/或框图中所规定的功能/操作被实施。程序代码可以完全在机器上执行、部分地在机器上执行,作为独立软件包部分地在机器上执行且部分地在远程机器上执行或完全在远程机器或服务器上执行。
在本申请的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、RAM、ROM、EPROM(Electrically Programmable Read-Only-Memory,可擦除可编程只读存储器)或快闪存储器、光纤、CD-ROM(Compact Disc Read-Only Memory,便捷式紧凑盘只读存储器)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
为了提供与用户的交互,可以在计算机上实施此处描述的系统和技术,该计算机具有:用于向用户显示信息的显示装置(例如,CRT(Cathode-Ray Tube,阴极射线管)或者LCD(Liquid Crystal Display,液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给计算机。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。
可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:LAN(Local Area Network,局域网)、WAN(Wide Area Network,广域网)、互联网和区块链网络。
计算机系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通 过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。服务器可以是云服务器,又称为云计算服务器或云主机,是云计算服务体系中的一项主机产品,以解决了传统物理主机与VPS服务("Virtual Private Server",或简称"VPS")中,存在的管理难度大,业务扩展性弱的缺陷。服务器也可以为分布式系统的服务器,或者是结合了区块链的服务器。
其中,需要说明的是,人工智能是研究使计算机来模拟人的某些思维过程和智能行为(如学习、推理、思考、规划等)的学科,既有硬件层面的技术也有软件层面的技术。人工智能硬件技术一般包括如传感器、专用人工智能芯片、云计算、分布式存储、大数据处理等技术;人工智能软件技术主要包括计算机视觉技术、语音识别技术、自然语言处理技术以及机器学习/深度学习、大数据处理技术、知识图谱技术等几大方向。
应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本申请中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本申请公开的技术方案所期望的结果,本文在此不进行限制。
上述具体实施方式,并不构成对本申请保护范围的限制。本领域技术人员应该明白的是,根据设计要求和其他因素,可以进行各种修改、组合、子组合和替代。任何在本申请的精神和原则之内所作的修改、等同替换和改进等,均应包含在本申请保护范围之内。

Claims (26)

  1. 一种空间组学单细胞数据获取方法,其特征在于,包括:
    获取生物样本的染色图像,获取所述生物样本的基因表达可视化图像;
    将所述染色图像与所述基因表达可视化图像进行配准,得到配准后的图像;
    对所述配准后的图像进行细胞分割,得到细胞掩模图;
    根据所述细胞掩码图确定所述基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞,并对所属细胞标记,得到带细胞标记的空间组分子表达矩阵。
  2. 根据权利要求1所述的方法,其特征在于,所述获取生物样本的染色图像包括:
    通过显微镜获取所述生物样本的一个染色图像;或
    通过显微镜获取所述生物样本的由多个子染色图像拼接的拼接染色图像;或
    通过所述显微镜获取所述生物样本的多个子染色图像,对所述多个子染色图像进行拼接,得到拼接染色图像。
  3. 根据权利要求2所述的方法,其特征在于,所述获取生物样本的染色图像包括:
    通过显微镜获取所述生物样本的多个子染色图像;对所述生物样本的多个子染色图像进行第一拼接,得到第一染色图像;
    根据所述第一染色图像的图像质量判断是否对所述生物样本的多个子染色图像进行第二拼接;
    若否,将所述第一染色图像确定为所述染色图像;
    若是,对所述生物样本的多个子染色图像进行第二拼接,得到所述染色图像。
  4. 根据权利要求3所述的方法,其特征在于,所述通过所述显微镜获取所述生物样本的多个子染色图像,对所述多个子染色图像进行拼接,得到拼接染色图像包括:
    分别确定多个子染色图像和模板图像的重叠区域;
    将所述多个子染色图像和所述模板图像的被确定为重叠区域的部分分别裁剪为多个染色图像重叠子图和数量相同的多个模板图像重叠子图,以配对为多个重叠子图对;
    通过对所述多个重叠子图对进行频域计算,分别获得各子染色图像和所述模板图像之间的偏移量;以及
    将所述各子染色图像分别朝向所述模板图像的方向平移所述偏移量,并 与所述模板图像拼接在一起。
  5. 根据权利要求3所述的方法,其特征在于,所述通过所述显微镜获取所述生物样本的多个子染色图像,对所述多个子染色图像进行拼接,得到拼接染色图像包括:
    获取所述多个子染色图像以及关于所述生物样本的轨迹线或轨迹点的模板信息;
    对所述多个子染色图像进行预拼接得到所述多个子染色图像的预拼接坐标;
    根据轨迹线或轨迹点的特征从所述多个子染色图像中选取至少一个第一参考图像,根据所述生物样本的模板信息和所述第一参考图像的预拼接坐标推导全局模板;以及
    对于所述多个子染色图像中除了所述第一参考图像之外的第二参考图像,计算所述第二参考图像的预拼接坐标与所述第二参考图像在所述全局模板中的相应模板坐标之间的偏移量,并基于所述偏移量对所述第二参考图像进行坐标调整以拼接生成所述拼接染色图像。
  6. 根据权利要求1所述的方法,其特征在于,所述将所述染色图像与所述基因表达可视化图像进行配准,得到配准后的图像包括:
    获取所述染色图像中的轨迹线,基于所述轨迹线与水平方向的夹角旋转所述染色图像;其中,所述染色图像和所述基因表达可视化图像包括多条轨迹线和/或多个轨迹点,所述轨迹点是由两条所述轨迹线相交形成的,所述多条轨迹线中的每条轨迹线具有对应的索引号;
    将所述染色图像进行放大或缩小得到第三参考图像,所述第三参考图像与所述基因表达可视化图像具有相同的比例;
    基于所述基因表达可视化图像和所述第三参考图像确定目标偏移量;
    基于所述目标偏移量移动所述第三参考图像,得到所述配准后的图像。
  7. 根据权利要求6所述的方法,其特征在于,在将所述染色图像进行放大或缩小得到第三参考图像之后,所述方法还包括:
    确定所述第三参考图像与基因表达可视化图像之间的相似度;
    将相似度最大值对应的位置作为粗配准结果。
  8. 根据权利要求1所述的方法,其特征在于,将所述染色图像与所述基因表达可视化图像进行配准,得到配准后的图像包括:
    对所述染色图像进行预处理,获取候选图像集合;
    确定所述候选图像集合对应的二值图集合;
    基于所述二值图集合与所述基因表达可视化图像之间的相似度,确定所述二值图集合与所述基因表达可视化图像中具有对应关系的轨迹点对;
    基于所述轨迹点对确定偏移信息;
    基于所述偏移信息处理目标图像,以得到配准后的图像,所述目标图像为所述轨迹点对所对应的候选图像集合中的图像。
  9. 根据权利要求1所述的方法,其特征在于,在对所述配准后的图像进行细胞分割,得到细胞掩模图之前,所述方法还包括:
    对所述配准后的图像进行组织分割,得到组织掩模图。
  10. 根据权利要求9所述的方法,其特征在于,所述对所述配准后的图像进行组织分割,得到组织掩模图包括:
    获取所述配准后的图像中待分割的目标组织的基因表达量并确定所述配准后的图像的基因表达矩阵,所述基因表达矩阵按照像素位置对所述基因表达量进行排列;
    通过将所述基因表达矩阵中每一像素位置的基因表达量赋值于配准后的图像中对应的像素位置确定图像数据;
    通过对所述图像数据进行图像处理以确定所述图像数据的前景像素点;
    根据所述前景像素点对所述图像数据的连通区域进行标记得到所述组织掩模图。
  11. 根据权利要求10所述的方法,其特征在于,在对所述配准后的图像进行组织分割,得到组织掩模图之后,所述方法还包括:
    分别计算得到组织掩模图对应的灰度图像的外轮廓图像与内轮廓图像;
    将所述外轮廓图像与所述内轮廓图像分别分为N段,并将每段所述外轮廓图像与每段所述内轮廓图像两两配对,得到N个图像组合,每个所述图像组合包括一段外轮廓图像与一段内轮廓图像;
    分别计算每个所述图像组合中一段外轮廓图像与一段内轮廓图像的像素密度比值,得到N个所述像素密度比值,所述像素密度比值为每个所述图像组合中一段外轮廓图像与一段内轮廓图像的像素占比的比值,所述像素占比为像素点与总像素点的比值;
    根据所述像素密度比值计算描述所述组织掩模图对应的灰度图像质量。
  12. 根据权利要求1所述的方法,其特征在于,所述对所述配准后的图像进行细胞分割,得到细胞掩模图包括:
    将所述配准后的图像输入所述图像分割模型,获得所述配准后的图像中各个像素点的分割结果,所述分割结果包括属于细胞的像素点;
    将所述分割结果属于细胞的像素点或细胞轮廓的像素点确定属于细胞的像素点,输出所述配准后的图像的分割结果,得到所述细胞掩模图。
  13. 根据权利要求1所述的方法,其特征在于,所述对所述配准后的图像进行细胞分割,得到细胞掩模图包括:
    对所述基因表达可视化图像进行预处理,得到预处理图;
    将所述预处理图进行二值化处理,得到初始掩模图;
    根据所述初始掩模图,利用基于距离变换的分水岭算法对存在细胞粘连的连通域进行分割,得到分割后的所述细胞掩模图。
  14. 根据权利要求1所述的方法,其特征在于,所述对所述配准后的图像进行细胞分割,得到细胞掩模图包括:
    基于所述染色图像确定所述目标对象的各个组织类型对应的标注区域和细胞面积;
    依据所述细胞面积确定每个所述标注区域包含的待处理子区域的面积,所述待处理子区域的面积与所述细胞面积正相关,所述待处理子区域用于表征对应的所述标注区域的最小处理单元;
    依据每个所述待处理子区域的面积,将对应的所述标注区域进行网格化处理,得到每个所述标注区域对应的网格化坐标;
    从所述基因表达可视化图像中提取所述网格化坐标对应的数据,并叠加至所述网格化坐标,得到所述目标对象的细胞处理结果。
  15. 根据权利要求1所述的方法,其特征在于,所述根据所述细胞掩码图确定所述基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞包括:
    基于所述细胞掩模图,将所述基因表达可视化图像的每个基因表达特征分别确定为位于细胞内的细胞基因表达特征及位于细胞外的背景基因表达特征;
    对每个所述细胞基因表达特征,通过空间位置和基因表达特征的信号值拟合出概率分布模型;
    基于所述概率分布模型,确定出针对位于一目标细胞的预设范围内的目标背景基因表达特征属于所述目标细胞的概率值;
    根据所述概率值输出校正结果以进行背景基因表达特征的校正。
  16. 根据权利要求1所述的方法,其特征在于,所述根据所述细胞掩码图确定所述基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞包括:
    根据所述基因表达可视化图像,确定所属于目标细胞的初始基因分子以及未知所属细胞的背景基因分子;
    获取所述初始基因分子的坐标信息;
    根据所述坐标信息,确定所述目标细胞的中心点坐标;
    根据所述中心点坐标和所述坐标信息,构建维诺图;
    确定所述维诺图范围内的背景基因分子的所属细胞。
  17. 根据权利要求1所述的方法,其特征在于,所述根据所述细胞掩码图确定所述基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞包括:
    确定所述基因表达可视化图像中所属于目标细胞的基因分子的初始分子数量以及所述所属于目标细胞的基因分子所占的目标区域的初始轮廓面积;
    根据所述分子数量和所述初始轮廓面积,确定所述目标细胞的基因分子密度;
    确定所述目标区域的预设区域范围内的背景基因分子的分子数量以及所述预设区域范围的区域面积;
    根据所述背景基因分子的分子数量和区域面积,确定背景基因分子密度;
    根据所述基因分子密度与所述背景基因分子密度确定所述背景基因分子的所属细胞。
  18. 根据权利要求1所述的方法,其特征在于,所述根据所述细胞掩码图确定所述基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞包括:
    确定所述基因表达可视化图像中所属于目标细胞的基因分子所占的目标区域;
    确定所述目标区域的预设校正范围内的未知所属细胞的背景基因分子的空间坐标及基因表达特征信号值;
    将所述空间坐标和所述基因表达特征信号值输入概率分布模型,以得到所述背景基因分子所属于所述目标细胞的概率分数;所述概率分布模型根据所属于目标细胞的基因分子样本的空间坐标及基因表达特征信号值拟合得到;
    根据所述概率分数确定所述背景基因分子的所属细胞。
  19. 根据权利要求1所述的方法,其特征在于,所述对所属细胞标记包括:
    以ssDNA染液和细胞边界荧光染色液对所属细胞进行染色,其中,所述ssDNA染液包括缓冲液和ssDNA试剂,所述细胞边界荧光染色液包括荧光染料。
  20. 根据权利要求5或6所述的方法,其特征在于,所述方法还包括:
    获取待测染色图像或基因表达可视化图像;以及
    将所述待测染色图像或基因表达可视化图像输入有向目标检测网络,以获得目标检测结果,
    其中所述有向目标检测网络包括:
    主干Backbone层,被配置为对待测染色图像或基因表达可视化图像执行特征提取,以获得不同尺度的多个特征图;
    颈部Neck层,被配置为从Backbone层接收所述多个特征图,并对所述 多个特征图进行跨尺度融合,以获得多个融合特征图;以及
    检测头Head层,被配置为对所述多个融合图像进行预测,以获得关于所述待测染色图像或基因表达可视化图像的目标检测结果,
    其中所述目标检测结果包括:目标框坐标预测信息、目标预测信息和角度预测信息。
  21. 根据权利要求5或6所述的方法,其特征在于,所述染色图像所在的染色图像平面包括第一方向和与所述第一方向垂直的第二方向,所述染色图像包括横向于所述第二方向的多个第一直轨迹线和横向于所述第一方向的多个第二直轨迹线,
    所述染色图像中的点坐标的确定方法包括:
    采样步骤,包括:
    应用第一采样条沿所述第一方向对所述染色图像进行第一方向等间隔采样以确定第一候选点集合,其中对于每次第一方向等间隔采样,执行以下子步骤:
    将所述第一采样条在该次第一方向等间隔采样期间所选中的所述染色图像的采样区域内的像素按所述第一方向进行像素值累加求和以得到一系列第一像素值和;以及
    确定所述一系列第一像素值和的极值点,并且对于确定的每个极值点:确定该次第一方向等间隔采样所获得的一个对应第一候选点,该对应第一候选点在所述第二方向上的坐标为该极值点所对应的第二方向位置在所述第二方向上的坐标,该对应第一候选点在所述第一方向上的坐标基于在该次第一方向等间隔采样期间所述第一采样条在所述第一方向上的位置确定,
    其中,由每次第一方向等间隔采样所获得的第一候选点形成所述第一候选点集合;
    应用第二采样条沿所述第二方向对所述染色图像进行第二方向等间隔采样以确定第二候选点集合,其中对于每次第二方向等间隔采样,执行以下子步骤:
    将所述第二采样条在该次第二方向等间隔采样期间所选中的所述染色图像的采样区域内的像素按所述第二方向进行像素值累加求和以得到一系列第二像素值和;以及
    确定所述一系列第二像素值和的极值点,并且对于确定的每个极值点:确定该次第二方向等间隔采样所获得的一个对应第二候选点,该对应第二候选点在所述第一方向上的坐标为该极值点所对应的第一方向位置在所述第一方向上的坐标,该对应第二候选点在所述第二方向上的坐标基于在该次第二方向等间隔采样期间所述第二采样条在所述第二方向上的位置确定,
    其中,由每次第二方向等间隔采样所获得的第二候选点形成所述第二候 选点集合;
    分组步骤,包括:
    将所述第一候选点集合中的第一候选点分成多个第一候选点组;以及
    将所述第二候选点集合中的第二候选点分成多个第二候选点组;
    直线拟合步骤,包括:
    对每个第一候选点组中的第一候选点进行直线拟合以得到一个相应的第一直线解析式;以及
    对每个第二候选点组中的第二候选点进行直线拟合以得到一个相应的第二直线解析式;以及
    坐标计算步骤,包括:
    计算每个第一直线解析式与每个第二直线解析式的交点的坐标。
  22. 根据权利要求19所述的方法,其特征在于,在对所属细胞标记,得到带细胞标记的空间组分子表达矩阵之后,所述方法还包括:
    获取生物样本的第一图像,所述第一图像包括所述生物样本经染色的细胞边界;
    获取所述生物样本的第二图像,所述第二图像包括所述生物样本经染色的遗传物质;
    获取所述生物样本的基因表达量信息;
    将所述第二图像与所述第一图像配准,得到第二图像与第一图像的配准图像;
    将所述第二图像与所述基因表达量信息进行配准,得到第二图像与第基因表达量信息的配准图像;
    根据第二图像与第一图像的配准图像、第二图像与基因表达量信息的配准图像获取第一图像与基因表达量信息的配准图像;
    根据第一图像与基因表达量信息的配准图像获取所述生物样本的细胞边界;
    基于第一图像与基因表达量信息的配准图像根据所述细胞边界获取所述生物样本的细胞的基因表达信息。
  23. 一种空间组学单细胞数据获取装置,其特征在于,包括:
    获取单元,用于获取生物样本的染色图像,获取所述生物样本的基因表达可视化图像;
    配准单元,用于将所述染色图像与所述基因表达可视化图像进行配准,得到配准后的图像;
    第一分割单元,用于对所述配准后的图像进行细胞分割,得到细胞掩模图;
    修正单元,用于根据所述细胞掩码图确定所述基因表达可视化图像中未知所属细胞的背景基因分子的所属细胞;
    标记单元,用于对所属细胞标记,得到带细胞标记的空间组分子表达矩阵。
  24. 一种电子设备,其特征在于,包括:
    至少一个处理器;以及
    与所述至少一个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行权利要求1-22中任一项所述的方法。
  25. 一种存储有计算机指令的非瞬时计算机可读存储介质,其特征在于,所述计算机指令用于使所述计算机执行根据权利要求1-22中任一项所述的方法。
  26. 一种计算机程序产品,其特征在于,包括计算机程序,所述计算机程序在被处理器执行时实现根据权利要求1-22中任一项所述的方法。
PCT/CN2022/136698 2022-06-29 2022-12-05 空间组学单细胞数据获取方法及装置和电子设备 Ceased WO2024001051A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202280097469.4A CN119422202A (zh) 2022-06-29 2022-12-05 空间组学单细胞数据获取方法及装置和电子设备

Applications Claiming Priority (10)

Application Number Priority Date Filing Date Title
PCT/CN2022/102505 WO2024000313A1 (zh) 2022-06-29 2022-06-29 基因图像数据校正方法、电子设备和介质
CNPCT/CN2022/102443 2022-06-29
CNPCT/CN2022/102424 2022-06-29
PCT/CN2022/102360 WO2024000268A1 (zh) 2022-06-29 2022-06-29 一种图像处理方法、装置、设备及介质
PCT/CN2022/102424 WO2024000288A1 (zh) 2022-06-29 2022-06-29 图像拼接方法、基因测序系统及相应的基因测序仪
CNPCT/CN2022/102360 2022-06-29
CNPCT/CN2022/102505 2022-06-29
PCT/CN2022/102443 WO2024000295A1 (zh) 2022-06-29 2022-06-29 图像中的点坐标的确定方法和装置及相应设备和介质
PCT/CN2022/110779 WO2024031219A1 (zh) 2022-08-08 2022-08-08 一种图像分割模型的训练方法、图像分割方法及装置
CNPCT/CN2022/110779 2022-08-08

Publications (1)

Publication Number Publication Date
WO2024001051A1 true WO2024001051A1 (zh) 2024-01-04

Family

ID=89383934

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/136698 Ceased WO2024001051A1 (zh) 2022-06-29 2022-12-05 空间组学单细胞数据获取方法及装置和电子设备

Country Status (2)

Country Link
CN (1) CN119422202A (zh)
WO (1) WO2024001051A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119169012A (zh) * 2024-11-21 2024-12-20 北京大学人民医院 一种多重免疫组织荧光染色图像的分析方法及相关设备
CN119887766A (zh) * 2025-03-27 2025-04-25 辽宁省人民医院 一种磁敏感加权序列中脑静脉侧支循环快速标注方法

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN121708010A (zh) * 2026-02-11 2026-03-20 宁波财经学院 一种骨髓瘤显微细胞图像癌细胞计数方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110047107A (zh) * 2018-01-13 2019-07-23 深圳华大智造科技有限公司 相机标定方法及图像配准方法、基因测序仪及系统
WO2019196019A1 (zh) * 2018-04-10 2019-10-17 深圳华大智造科技有限公司 荧光图像配准方法、基因测序仪及系统、存储介质
WO2020155043A1 (zh) * 2019-01-31 2020-08-06 深圳华大生命科学研究院 荧光图像配准方法、基因测序仪及系统、存储介质
CN113781530A (zh) * 2021-10-09 2021-12-10 上海衡道医学病理诊断中心有限公司 一种染色切片的图像配准方法及系统
US20220068438A1 (en) * 2020-08-27 2022-03-03 The Broad Institute, Inc. Deep learning and alignment of spatially-resolved whole transcriptomes of single cells

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110047107A (zh) * 2018-01-13 2019-07-23 深圳华大智造科技有限公司 相机标定方法及图像配准方法、基因测序仪及系统
WO2019196019A1 (zh) * 2018-04-10 2019-10-17 深圳华大智造科技有限公司 荧光图像配准方法、基因测序仪及系统、存储介质
WO2020155043A1 (zh) * 2019-01-31 2020-08-06 深圳华大生命科学研究院 荧光图像配准方法、基因测序仪及系统、存储介质
US20220068438A1 (en) * 2020-08-27 2022-03-03 The Broad Institute, Inc. Deep learning and alignment of spatially-resolved whole transcriptomes of single cells
CN113781530A (zh) * 2021-10-09 2021-12-10 上海衡道医学病理诊断中心有限公司 一种染色切片的图像配准方法及系统

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
CHENG MENGNAN, WU LIANG, HAN LEI, HUANG XIN, LAI YIWEI, XU JIANGSHAN, WANG SHUAI, LI MEI, ZHENG HUIWEN, FENG WEIMIN, HUANG ZIRUI, : "A Cellular Resolution Spatial Transcriptomic Landscape of the Medial Structures in Postnatal Mouse Brain", FRONTIERS IN CELL AND DEVELOPMENTAL BIOLOGY, FRONTIERS MEDIA, CH, vol. 10, CH , XP093124994, ISSN: 2296-634X, DOI: 10.3389/fcell.2022.878346 *
ZUBAIR ASIF, CHAPPLE RICHARD H, NATARAJAN SIVARAMAN, WRIGHT WILLIAM C, PAN MIN, LEE HYEONG-MIN, TILLMAN HEATHER, EASTON JOHN, GEEL: "Cell type identification in spatial transcriptomics data can be improved by leveraging cell-type-informative paired tissue images using a Bayesian probabilistic model", NUCLEIC ACIDS RESEARCH, OXFORD UNIVERSITY PRESS, GB, vol. 50, no. 14, 12 August 2022 (2022-08-12), GB , pages e80, XP093121475, ISSN: 0305-1048, DOI: 10.1093/nar/gkac320 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119169012A (zh) * 2024-11-21 2024-12-20 北京大学人民医院 一种多重免疫组织荧光染色图像的分析方法及相关设备
CN119887766A (zh) * 2025-03-27 2025-04-25 辽宁省人民医院 一种磁敏感加权序列中脑静脉侧支循环快速标注方法

Also Published As

Publication number Publication date
CN119422202A (zh) 2025-02-11

Similar Documents

Publication Publication Date Title
US11681418B2 (en) Multi-sample whole slide image processing in digital pathology via multi-resolution registration and machine learning
US10127675B2 (en) Edge-based local adaptive thresholding system and methods for foreground detection
CN103400151B (zh) 一体化的光学遥感影像与gis自动配准与水体提取方法
EP2987142B1 (en) Systems and methods for multiplexed biomarker quantitation using single cell segmentation on sequentially stained tissue
WO2024001051A1 (zh) 空间组学单细胞数据获取方法及装置和电子设备
CN109426814B (zh) 一种发票图片特定板块的定位、识别方法、系统、设备
CN110781885A (zh) 基于图像处理的文本检测方法、装置、介质及电子设备
CN107392141B (zh) 一种基于显著性检测和lsd直线检测的机场提取方法
Vanetti et al. Gas meter reading from real world images using a multi-net system
CN104751093B (zh) 用于获取宿主设备显示的图像识别码的方法和装置
CN113537026B (zh) 建筑平面图中的图元检测方法、装置、设备及介质
Liu et al. Road centerlines extraction from high resolution images based on an improved directional segmentation and road probability
CN115272887A (zh) 基于无人机检测的海岸带垃圾识别方法、装置以及设备
CN118520893B (zh) 一种应用于aoi的条形码标签识别的方法、装置及存储介质
CN110659637A (zh) 一种结合深度神经网络和sift特征的电能表示数与标签自动识别方法
CN116612478A (zh) 一种脱机手写汉字的评分方法、装置及存储介质
CN114511862A (zh) 表格识别方法、装置及电子设备
CN104268550A (zh) 特征提取方法及装置
CN117372937B (zh) 一种基于指针仪表的数据读取方法
CN118608917A (zh) 一种图像敏感信息的识别方法、系统、设备及介质
CN115393337A (zh) 工业缺陷检测方法、装置、设备及计算机可读存储介质
Rahi Contour Detection of Growing Plant Roots
CN108573258B (zh) 一种快速的复杂背景图像中维语文字定位方法
Zeng et al. Ellipse-CenterNet: Ellipse Detection in Complex Environments
CN116469109A (zh) 一种数字仪表的测量结果识别方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22949128

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 202280097469.4

Country of ref document: CN

NENP Non-entry into the national phase

Ref country code: DE

WWP Wipo information: published in national office

Ref document number: 202280097469.4

Country of ref document: CN

122 Ep: pct application non-entry in european phase

Ref document number: 22949128

Country of ref document: EP

Kind code of ref document: A1