Noise identification method and device for spatial mass spectrum and electronic equipment
By dividing the ion layer into a grid and identifying noise regions in the spatial mass spectrum, the efficiency and accuracy problems of noise identification in the prior art are solved, achieving efficient noise removal and supporting subsequent tissue feature analysis.
Patent Information
- Application Number
- CN202210128782.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-11
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2042-02-11
AI Technical Summary
Existing technologies have failed to effectively identify pixel noise in non-sample areas on a whole two-dimensional slice in mass spectrometry imaging, hindering the discovery of regions of interest.
By extracting multiple ion layers from the spatial mass spectrum, dividing the ion layers into grids, determining the grid type and the number of pixels, identifying the background layer, and determining the noise region based on the frequency and distribution of pixel occurrences.
This improved the efficiency and accuracy of noise identification, laying the foundation for subsequent tissue feature region typing based on slice space.
Smart Images

Figure CN116642940B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, in particular, the present application relates to a noise identification method and device of spatial mass spectrum and electronic equipment. BACKGROUND
[0002] Mass spectrometry imaging (MSI) technology includes spatially resolved spectral information of a sample, and can perform unbiased qualitative analysis on chemical components on the surface of a sample slice.
[0003] In mass spectrometry imaging, regions with different signal distribution characteristics imply potential local physiological processes, such as tissue-specific accumulation of secondary metabolites or disease characteristics. Therefore, identifying "regions of interest" (ROI) is crucial in mass spectrometry imaging.
[0004] However, high background noise and false signals often hinder the discovery of ROI. The existing technology only focuses on signal noise within the spectrum, and there is currently no relevant research on detecting non-sample region pixels (noise pixels) on the entire two-dimensional slice for spatial metabolomics. SUMMARY
[0005] The embodiments of the present application provide a noise identification method and device of spatial mass spectrum, electronic equipment, computer readable storage medium and computer program product, which can solve the above problems. The technical scheme is as follows:
[0006] According to an aspect of the embodiments of the present application, a noise identification method of spatial mass spectrum is provided, the method comprising:
[0007] extracting a plurality of ion layers from the spatial mass spectrum, each ion layer corresponding to an ion with a mass-to-charge ratio, and the ion layer including all pixels corresponding to the ion in the spatial mass spectrum;
[0008] dividing the ion layer into grids, determining the type and number of pixels of each grid, and the type indicating whether the grid corresponds to only the sample region scanned by the spatial mass spectrum;
[0009] if the ion layer is determined to be a background layer according to the type and number of pixels of each grid in the ion layer, determining the pixel points with a number of occurrences exceeding a first preset value from all background layers as background pixels, and determining the noise region of the spatial mass spectrum according to the background pixels.
[0010] As an optional implementation, determining the noise region of the spatial mass spectrum according to the background pixels comprises:
[0011] For each background pixel point, determine the adjacent background pixel points of the background pixel point and the distance between each adjacent background pixel point and the background pixel point;
[0012] According to the distance, determine the target pixel point from the background pixel points, and take the distribution region of the target pixel point as the noise region.
[0013] As an optional implementation, if it is determined according to the types of all grids in the ion layer and the number of pixel points that the ion layer is a background layer, the method comprises:
[0014] For each grid in the ion layer, according to the number of pixel points in the grid and the size of the grid, obtain the pixel point probability of the grid;
[0015] According to the pixel point probability of each type of grid in the ion layer, determine whether the ion layer is a background layer.
[0016] As an optional implementation, according to the pixel point probability of each type of grid in the ion layer, determine whether the ion layer is a background layer, comprising:
[0017] Determine the first average pixel point probability of all grids of the first type and the second average pixel point probability of all grids of the second type in the ion layer;
[0018] If the ratio of the first average pixel point probability and the second average pixel point probability is not less than a second preset value, it is determined that the ion layer is a background layer;
[0019] The first type is used to represent that the grid corresponds to a blank area of the spatial mass spectrum image scan, or the grid corresponds to both a sample area and a blank area of the spatial mass spectrum image scan.
[0020] The second type is used to represent that the grid only corresponds to a sample area of the spatial mass spectrum image scan.
[0021] As an optional implementation, the method for determining the adjacent background pixel points of the background pixel point comprises:
[0022] According to the coordinates of all background pixel points, establish a KD tree;
[0023] Through the K-neighbor algorithm, determine the adjacent background pixel points of each background pixel point within a preset range from the KD tree.
[0024] As an optional implementation, the method for determining the target pixel point from the background pixel points according to the distance comprises:
[0025] According to the number of adjacent background pixel points corresponding to the background pixel point and the sum of the distances between each adjacent background pixel point and the background pixel point, obtain the density of the background pixel point;
[0026] The background pixel point with a density greater than a third preset value is taken as a target pixel point.
[0027] As an optional implementation, determining the noise region of the spatial mass spectrum based on the background pixel point further comprises:
[0028] The noise region is deleted from the spatial mass spectrum to obtain a denoised spatial mass spectrum.
[0029] According to another aspect of the embodiments of the present application, a device for noise identification of a spatial mass spectrum is provided, and the device comprises:
[0030] An ion layer acquisition module is configured to extract a plurality of ion layers from the spatial mass spectrum, each ion layer corresponding to ions with a mass-to-charge ratio, and the ion layer comprising all pixel points corresponding to the respective ions in the spatial mass spectrum;
[0031] A grid division module is configured to divide the ion layer into grids, determine the type and the number of pixel points of each grid, and the type being used to indicate whether the grid corresponds to only a sample region scanned by the spatial mass spectrum;
[0032] A noise region identification module is configured to determine, if the ion layer is determined to be a background layer according to the type and the number of pixel points of each grid in the ion layer, a pixel point with an occurrence frequency exceeding a first preset value from all background layers as a background pixel point, and determine the noise region of the spatial mass spectrum based on the background pixel point.
[0033] According to another aspect of the embodiments of the present application, an electronic device is provided, which comprises a memory, a processor and a computer program stored in the memory, and the processor executes the computer program to implement the steps of the above-mentioned noise identification method of the spatial mass spectrum.
[0034] According to still another aspect of the embodiments of the present application, a computer readable storage medium is provided, which stores a computer program, and the computer program is executed by a processor to implement the steps of the above-mentioned noise identification method of the spatial mass spectrum.
[0035] According to an aspect of the embodiments of the present application, a computer program product is provided, and the computer program is executed by a processor to implement the steps of the above-mentioned noise identification method of the spatial mass spectrum.
[0036] The technical scheme provided by the embodiments of the present application has the following beneficial effects:
[0037] By extracting a plurality of ion layers from the spatial mass spectrum, each ion layer corresponds to ions of a mass-to-charge ratio, and the ion layer includes all pixel points corresponding to the corresponding ions in the spatial mass spectrum. For each ion layer, the ion layer is divided into a grid, and the type and number of pixel points of the grid are determined. It is judged whether the ion layer is a background layer. Further, the pixel points with an occurrence frequency greater than a first preset value in the background layer are regarded as background pixel points. The noise region of the spatial mass spectrum is determined from the distribution region of the background pixel points. Since the scheme first divides the three-dimensional spatial mass spectrum into a plurality of two-dimensional ion layers, and then analyzes the ion layer belonging to the noise ion, that is, the background layer, and further realizes the pixel-level noise recognition from the occurrence frequency of the pixel points in all background layers, the noise recognition efficiency is improved, and the recognition accuracy is ensured. It lays a foundation for subsequent slice space related organization feature region typing. BRIEF DESCRIPTION OF DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the description of the embodiments of the present application will be briefly introduced.
[0039] Figure 1 The system architecture schematic diagram of the application environment provided by the embodiments of the present application;
[0040] Figure 2 The flowchart of the noise recognition method of the spatial mass spectrum provided by the embodiments of the present application;
[0041] Figure 3 The schematic diagram of determining the corresponding type of the grid in the ion layer provided by the embodiments of the present application;
[0042] Figure 4 The schematic diagram of determining the noise region from the background layer provided by the embodiments of the present application;
[0043] Figure 5 The distribution schematic diagram of a background pixel point in an ion layer provided by the embodiments of the present application;
[0044] Figure 6 The schematic diagram of a KD tree provided by the embodiments of the present application;
[0045] Figure 7 The flowchart of the noise recognition of the spatial mass spectrum provided by another embodiment of the present application;
[0046] Figure 8 The structure schematic diagram of the noise recognition device of the spatial mass spectrum provided by the embodiments of the present application;
[0047] Figure 9 The structure schematic diagram of the electronic device provided by the embodiments of the present application. DETAILED DESCRIPTION
[0048] Embodiments of the present application will be described below with reference to the accompanying drawings. It should be understood that the embodiments described below with reference to the accompanying drawings are exemplary descriptions of the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions of the embodiments of the present application.
[0049] Those skilled in the art can understand that, unless specifically stated, the singular forms "a", "an" and "the" used herein can also include the plural forms. It should be further understood that the terms "include" and "contain" used in the embodiments of the present application mean that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude other features, information, data, steps, operations, elements, components and / or their combinations supported by the present technology. It should be understood that when we say that an element is "connected" or "coupled" to another element, the element can be directly connected or coupled to the other element, or can mean that the element and the other element establish a connection relationship through an intermediate element. In addition, "connection" or "coupling" used herein can include wireless connection or wireless coupling. The term "and / or" used herein indicates that at least one of the items defined by the term, for example, "A and / or B" can be implemented as "A", or as "B", or as "A and B".
[0050] In order to make the purposes, technical solutions and advantages of the present application clearer, the embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
[0051] First, several terms related to the present application are introduced and explained:
[0052] 1) Mass spectrometry imaging (MSI) completes the imaging operation of the tissue section by converting the mass spectrometry scanning signal value into pixel color;
[0053] 2) Mass to Charge Ratio (m / z), the ratio of the accurate molecular mass of the metabolite to the charge amount.
[0054] 3) Centroid, refers to the discretization of continuous mass spectrometry data of the imaging peak shape into several main fragment signal information.
[0055] The noise recognition method, device, electronic equipment, computer readable storage medium and computer program product of the spatial mass spectrum provided by the present application aim to solve the above technical problems of the prior art.
[0056] The technical solutions of the embodiments of the present application and the technical effects brought by the technical solutions of the present application are described below through the description of several exemplary embodiments. It should be noted that the following embodiments can be mutually referenced, borrowed or combined. The same terms, similar features and similar implementation steps in different embodiments are not described repeatedly.
[0057] Figure 1 A schematic diagram of a system architecture of an exemplary application environment of a noise identification method and a noise identification device of a spatial mass spectrum is shown.
[0058] As shown in Figure 1 , the system architecture 100 can include one or more of terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a communication link medium between the terminal devices 101, 102, 103 and the server 105. The network 104 can include various connection types, such as wired, wireless communication links or optical fiber cables, etc. The terminal devices 101, 102, 103 can be various electronic devices with display screens, including but not limited to desktop computers, portable computers, smart phones and tablet computers, etc. It should be understood that Figure 1 The number of terminal devices, networks and servers in
[0059] The noise identification method provided by the embodiments of the present application is generally executed by the terminal devices 101, 102 or 103, and correspondingly, the noise identification device is generally arranged in the terminal devices 101, 102 or 103. However, it is easily understood by those skilled in the art that the noise identification method provided by the embodiments of the present application can also be executed by the server 105, and correspondingly, the noise identification device can also be arranged in the server 105, which is not specially limited in the present exemplary embodiment. For example, in an exemplary embodiment, the server 105 can extract a plurality of ion layers from a spatial mass spectrum, each ion layer corresponding to an ion of a mass-to-charge ratio, and the ion layer including all pixel points corresponding to the corresponding ion in the spatial mass spectrum; the ion layer is grid divided to determine the type and the number of pixel points of each grid, and the type is used to indicate whether the grid only corresponds to a sample area scanned by the spatial mass spectrum; if it is determined that the ion layer is a background layer according to the type and the number of pixel points of each grid in the ion layer, the pixel points with a number of occurrences exceeding a first preset value are determined as background pixel points from all background layers, and the noise region of the spatial mass spectrum is determined according to the background pixel points.
[0060] In the embodiments of the present application, a noise identification method of a spatial mass spectrum is provided, as shown inFigure 2 The method comprises:
[0061] S101, extracting a plurality of ion layers from the spatial mass spectrum, each ion layer corresponding to an ion with a mass-to-charge ratio, and the ion layer including all pixel points corresponding to the ion in the spatial mass spectrum.
[0062] The spatial imaging mass spectrum acquires the complete mass spectrum fingerprint of the sample through spatial coordinate arrays by scanning the sample on the slide row by row and point by point. Each scanning point produces a primary mass spectrum result, including the mass-to-charge ratio, signal value, and coordinate system of the ion. By signal superposition of all primary mass spectra produced by the scanning points, all signal characteristics in the sample can be obtained, thereby generating a spatial mass spectrum.
[0063] Since the spatial mass spectrum itself is not suitable for qualitative analysis, the embodiments of the present application first perform centering processing on the spatial mass spectrum. Specifically, the ions corresponding to all pixel points in the spatial mass spectrum can be centered according to a preset mass-to-charge ratio error and a response threshold, to obtain a set of non-repeated and discrete mass-to-charge ratios. For each mass-to-charge ratio, the corresponding ion layer is further extracted from the spatial mass spectrum according to a preset Dalton error and a response threshold.
[0064] It should be understood that each ion layer includes all pixel points corresponding to the corresponding ion in the spatial mass spectrum. For example, if the spatial mass spectrum is centered, and the obtained mass-to-charge ratio set has three mass-to-charge ratios: mass-to-charge ratios 1, 2, and 3, then the pixel points of the ions corresponding to the mass-to-charge ratios 1, 2, and 3 are extracted from the spatial mass spectrum to obtain an ion layer 1 including only the pixel points of the ions corresponding to the mass-to-charge ratio 1, an ion layer 2 including only the pixel points of the ions corresponding to the mass-to-charge ratio 2, and an ion layer 3 including only the pixel points of the ions corresponding to the mass-to-charge ratio 3.
[0065] The embodiments of the present application do not limit the specific size of the Dalton error and the response threshold. For example, the Dalton error can be 0.5, and the response threshold can be 5%.
[0066] S102, performing grid division on the ion layer to determine the type and the number of pixel points of each grid, and the type is used to indicate whether the grid corresponds to only the sample region scanned by the spatial mass spectrum.
[0067] Since the spatial imaging mass spectrometry scans the entire slide area, the signal of the blank area (blank slide area, non-biological sample area) is also collected, resulting in strong background noise. The ion distribution of the background noise area and the biological sample area will show a certain geometric rule. The sample is located in the center of the entire slide, and the sample is surrounded by blank background (blank slide area). The entire slide can be divided into a grid by an N x M grid method, please refer to Figure 3 which exemplarily shows a schematic diagram of determining the corresponding type of the grid in the ion layer by the embodiment of the application, wherein the grid marked with "√" in the figure belongs to the complete background noise area, and has no direct intersection with the sample; the grid marked with "?" belongs to the overlapping area, indicating that part of it belongs to the sample area and part of it belongs to the background noise area; and the grid without a symbol belongs to the complete sample area.
[0068] After the grid division, the embodiment of the application also needs to count the number of pixel points in each grid, which represents the number of corresponding mass-to-charge ratio ions in the coordinate range of the grid.
[0069] In S103, if it is determined according to the type and the number of pixel points of each grid in the ion layer that the ion layer is a background layer, the pixel points with an occurrence frequency greater than a first preset value are determined as background pixel points from all the background layers, and the noise area of the spatial mass spectrum is determined according to the background pixel points.
[0070] It should be understood that the number of pixel points can reflect the distribution of the ion corresponding to the ion layer in the grid, and further combined with the type of the grid, that is, whether the grid is a sample area, it can be judged whether the ion corresponding to the ion layer is an ion in the sample, that is, it can lay a foundation for judging whether the ion layer is a background layer. It can be understood that the background layer is the layer corresponding to the ion in the non-sample of the slide.
[0071] After obtaining all the background layers, the coordinates of each pixel point in each background layer are determined, and the occurrence frequency of the pixel points with the same coordinates in all the background layers is counted. The pixel points with an occurrence frequency greater than a first preset value are counted, and these pixel points have a high possibility of being ions in the non-sample of the slide. The pixel points are referred to as background pixel points in the embodiment of the application, and the background pixel points constitute the noise area.
[0072] Please refer to Figure 4Exemplarily, the schematic diagram of determining the noise region by the background layer according to the embodiments of the present application is shown in the figure, L1-L3 are background layers, and the filled part in each background layer represents a background pixel point. In the background layer L1, the pixel points Ci and Cj are background pixel points, while in the background layers L2 and L3, the pixel points Ci are background pixel points, and the pixel points Cj are not background pixel points. Thus, the occurrence frequency of the pixel point Ci is 3, and the occurrence frequency of the pixel point Cj is 1. If the first preset value is 2, the pixel point Ci is regarded as a background pixel point.
[0073] The noise recognition method of the spatial mass spectrum diagram according to the embodiments of the present application extracts a plurality of ion layers from the spatial mass spectrum diagram, each ion layer corresponds to an ion with a mass-to-charge ratio, and the ion layer includes all pixel points corresponding to the ion in the spatial mass spectrum diagram. For each ion layer, the ion layer is divided into grids, and the type and the number of pixel points of the grid are determined. It is judged whether the ion layer is a background layer. Further, the pixel point with an occurrence frequency exceeding a first preset value in the background layer is regarded as a background pixel point. The noise region of the spatial mass spectrum diagram is determined from the distribution region of the background pixel point. Since the three-dimensional spatial mass spectrum diagram is divided into a plurality of two-dimensional ion layers in the present scheme, the ion layer belonging to the noise ion, i.e., the background layer, is analyzed. Further, the pixel point level noise recognition is realized from the occurrence frequency of the pixel point in all background layers, which improves the efficiency of noise recognition and ensures the accuracy of recognition, and lays a foundation for subsequent slice space related organization feature region typing.
[0074] It should be noted that the background pixel points obtained through the above embodiments may contain a few sample pixel points. Therefore, further background detection can be performed through statistical analysis to obtain a more accurate noise region. As an optional embodiment based on the above embodiments, the noise region of the spatial mass spectrum diagram is determined according to the background pixel points, including:
[0075] S201, for each background pixel point, determining the adjacent background pixel points of the background pixel point and the distances between the adjacent background pixel points and the background pixel point.
[0076] The adjacent background pixel points of each background pixel point can be determined through a related adjacent point algorithm, such as a binary tree algorithm or a KD tree algorithm. After determining the adjacent background pixel points, the distance between the background pixel point and the adjacent background pixel points can be obtained according to the spatial coordinates of the two pixel points in the spatial mass spectrum diagram.
[0077] S202, determining a target pixel point from the background pixel points according to the distance, and taking the distribution region of the target pixel point as the noise region.
[0078] The closer the distance between a neighboring background pixel and its corresponding background pixel, the denser the pixel cluster formed by the background pixel and its neighboring background pixels, and the more likely it is to be a noise pixel. Therefore, this application can further determine the target pixel from the background pixels based on the distance, exclude pixels that belong to the sample, and obtain more accurate noise.
[0079] Based on the above embodiments, as an optional embodiment, if the ion layer is determined to be a background layer according to the type and number of pixels of all grids in the ion layer, the following is included:
[0080] S301. For each grid in the ion layer, obtain the pixel probability of the grid based on the number of pixels in the grid and the size of the grid.
[0081] Specifically, if the ion layer is divided into N×M grids, then the grid width W is... The height H of the grid cell is Where width and height represent the width and height of the ion layer, respectively. Furthermore, the pixel probability of a grid can be calculated as the ratio of the number of pixels in the grid to the area of the grid. The formula for calculating the pixel probability p is expressed as:
[0082]
[0083] S302. Determine whether the ion layer is a background layer based on the pixel probability of each type of grid in the ion layer.
[0084] Specifically, the first type is defined as a grid that corresponds to the blank area of the spatial mass spectrum scan, or a grid that corresponds to both the sample area and the blank area of the spatial mass spectrum scan; the second type is defined as a grid that corresponds only to the sample area of the spatial mass spectrum scan.
[0085] Determine the first average pixel probability of all grids of the first type and the second average pixel probability of all grids of the second type in the ion layer; if the ratio of the first average pixel probability to the second average pixel probability is not less than a second preset value, then determine the ion layer as the background layer.
[0086] by Figure 3 For example, grids marked with a √ or ? symbol belong to the first type of grid, while grids without a symbol belong to the second type of grid.
[0087] The average value p1 of the pixel point probability of all the grids marked by the square root or the symbol of the current ion layer is obtained, and the average value p2 of the pixel point probability of all the grids without the symbol mark (the probability of the sample layer) is obtained. The ratio p1 / p2 is calculated. If p1 / p2 is greater than a set multiple relationship (for example, 5 times), or equal to positive infinity (p2 is equal to zero), that is, the probability of the ion layer as the background layer is much greater than the probability as the sample layer, the current ion layer can be further marked as the background layer, and added to the background layer set.
[0088] On the basis of the above embodiments, as an optional embodiment, the adjacent background pixel points of the background pixel points are determined, including:
[0089] S401, a KD tree is established according to the coordinates of all the background pixel points.
[0090] The k-dimensional tree, that is, the KD tree, can efficiently find the K nearest training points of the test point, and no longer needs to calculate the distance between the test point and each data in the training set. The KD tree is a kind of binary tree, and is a kind of partition of k-dimensional space. The k-dimensional space is continuously cut by a hyperplane perpendicular to the coordinate axis to form a k-dimensional hyper-rectangular region. Each node of the kd tree corresponds to a k-dimensional hyper-rectangular region.
[0091] The method for establishing the KD tree in the embodiment of the application can include the following processes:
[0092] S1, the horizontal coordinate of the background pixel point is selected as the coordinate axis, the median of the horizontal coordinates of all the background pixel points is selected as the cutting point, the hyper-rectangular region is cut into two sub-regions, the cutting point is taken as the root node, the left and right child nodes with a depth of 1 are generated from the root node, the horizontal coordinate corresponding to the left node is less than the cutting point, and the horizontal coordinate corresponding to the right node is greater than the cutting point;
[0093] S2, for a node with a depth of j, the horizontal coordinate of the node is selected as the cutting coordinate axis, the median of the horizontal coordinates in the region of the node is selected as the cutting point, the region is divided into two sub-regions, and left and right child nodes with a depth of j+1 are generated. The horizontal coordinate corresponding to the left node is less than the cutting point, and the horizontal coordinate corresponding to the right node is greater than the cutting point;
[0094] S2 is repeated until the two sub-regions have no background pixel points.
[0095] Specifically, if the background pixel point set of the embodiment of the present application comprises: {(6, 5), (1, -3), (-6, -5), (-4, -10), (-2, -1), (-5, 12), (2, 13), (17, -12), (8, -22), (15, -13), (10, -6), (7, 15), (14, 1)}, the coordinates in the set are all coordinates of the background pixel points in the two-dimensional coordinate system of the ion layer, and the representation in the coordinate system is as shown in Figure 5 .
[0096] First, taking the horizontal coordinate as the coordinate axis and the median value 6 as the division point (6, 5), the region is divided again, and the horizontal coordinate is still taken as the coordinate axis, the median value is selected, and it is known that the left region is -3 and the right region is -12. The left region division point is (1, -3) and the right region division point coordinate is (17, -12). The region is divided again, and the last small region only has one point or no pixel point, and the final KD tree is obtained as shown in Figure 6 .
[0097] S402, determining each adjacent background pixel point of each background pixel point in a preset range through a K-neighbor algorithm.
[0098] Specifically, the KNN fast search of the KD tree is performed with the square size G and the maximum number of adjacent background pixel points k, and the adjacent background pixel points of each background pixel point can be obtained.
[0099] On the basis of the above embodiments, as an optional embodiment, the target pixel point is determined from the background pixel points according to the distance, comprising:
[0100] The density of the background pixel point is obtained according to the number of adjacent background pixel points corresponding to the background pixel point and the distance sum of each adjacent background pixel point and the background pixel point.
[0101] The background pixel point with a density greater than a third preset value is taken as the target pixel point.
[0102] Specifically, for each background pixel point, after determining all adjacent background pixel points, the distance sum of the background pixel point and all adjacent background pixel points is calculated, and the density of the background pixel point is obtained by dividing the number of adjacent background pixel points by the distance sum. The size of the third preset value is not specifically limited in the embodiment of the present application, for example, the median value of all densities can be used as the third preset value.
[0103] On the basis of the above embodiments, as an optional embodiment, the noise region of the spatial mass spectrum is determined according to the background pixel point, and then further comprising:
[0104] The noise region is removed from the spatial mass spectrum to obtain a denoised spatial mass spectrum.
[0105] The pixel point set B in the final noise region is complemented for the whole spatial mass spectrum I, and the remaining pixel point data is the sample data S. Based on the obtained sample data, subsequent spatial metabolomics data analysis can be performed.
[0106] See Figure 7 which exemplarily shows a flowchart of noise identification of a spatial mass spectrum of another embodiment of the present application, as shown in the figure, comprising:
[0107] S501, centering the ions of the pixel points in the spatial mass spectrum to obtain a plurality of mass-to-charge ratios;
[0108] S502, for each mass-to-charge ratio, extracting the corresponding ion layer from the spatial mass spectrum;
[0109] S503, performing grid division on each ion layer and determining the type of the grid; type 1 is used to represent that the grid corresponds to a blank region of the spatial mass spectrum scan, or the grid corresponds to both a sample region and a blank region of the spatial mass spectrum scan; type 2 is used to represent that the grid only corresponds to a sample region of the spatial mass spectrum scan;
[0110] S504, counting the pixel point probability in each grid, the pixel point probability being the ratio of the number of pixel points existing in the grid to the area of the grid;
[0111] S505, calculating the first average pixel point probability p1 of all grids of type 1 and the second average pixel point probability p2 of all grids of type 2, respectively;
[0112] S506, if p1 / p2 is greater than a second preset value, determining that the ion image is a background layer;
[0113] S507, counting the number of occurrences of the pixel points of each coordinate in all background layers, and marking the pixel points with a number of occurrences greater than a first preset value as background pixel points;
[0114] S508, establishing a KD tree in two dimensions of horizontal and vertical directions for all background pixel points;
[0115] S509, for each background pixel point, performing KNN search of the maximum number of adjacent points G of the target point through the KD tree to obtain the sum of distances between the adjacent background pixel points and the target point; based on the quotient of the number of adjacent points and the distance, obtaining the density of the background pixel point;
[0116] S510, taking the background pixel points with a density greater than a third preset value as target pixel points;
[0117] S511, delete the target pixel point from the spatial mass spectrum diagram, and obtain a denoised spatial mass spectrum diagram.
[0118] The embodiment of the present application provides a noise recognition device of a spatial mass spectrum diagram, as shown in the figure, the device can comprise: an ion layer acquisition module 801, a grid division module 802 and a noise area recognition module 803, wherein, Figure 8
[0119] The ion layer acquisition module 801 is used for extracting a plurality of ion layers from the spatial mass spectrum diagram, each ion layer corresponds to ions of one mass-to-charge ratio, and the ion layer comprises all pixel points corresponding to the corresponding ions in the spatial mass spectrum diagram.
[0120] The grid division module 802 is used for performing grid division on the ion layer, determining the type and the number of pixel points of each grid, and the type is used for indicating whether the grid corresponds to only a sample area scanned by the spatial mass spectrum diagram.
[0121] The noise area recognition module 803 is used for determining, if the ion layer is a background layer according to the type and the number of pixel points of each grid in the ion layer, pixel points with an occurrence frequency exceeding a first preset value from all background layers as background pixel points, and determining a noise area of the spatial mass spectrum diagram according to the background pixel points.
[0122] The device of the embodiment of the present application can execute the method provided by the embodiment of the present application, the implementation principles are similar, and the actions performed by each module in the device of the embodiment of the present application are corresponding to the steps in the method of the embodiment of the present application. The detailed function description of each module of the device can be referred to the description in the corresponding method in the foregoing description, and details are not described herein.
[0123] The embodiment of the present application provides an electronic device, including a memory, a processor and a computer program stored in the memory, and the processor executes the computer program to realize the steps of the noise identification method of the spatial mass spectrum, compared with the related art, the method can realize: by extracting a plurality of ion layers from the spatial mass spectrum, each ion layer corresponds to an ion with a mass-to-charge ratio, the ion layer includes all pixel points corresponding to the corresponding ion in the spatial mass spectrum, for each ion layer, by performing grid division on the ion layer and determining the type and the number of pixel points of the grid, it is judged whether the ion layer is a background layer, further, the pixel points with a number of occurrences exceeding a first preset value in the background layer are taken as background pixel points, and the noise region of the spatial mass spectrum is determined from the distribution region of the background pixel points, since the present scheme first divides the three-dimensional spatial mass spectrum into a plurality of two-dimensional ion layers, and then analyzes the ion layer belonging to the noise ion, that is, the background layer, and further realizes the pixel point level noise identification from the number of occurrences of the pixel points in all the background layers, which improves the efficiency of noise identification, ensures the accuracy of identification, and lays a foundation for subsequent slice space related organization feature region typing.
[0124] In an optional embodiment, an electronic device is provided, as shown in Figure 9 The electronic device 4000 shown in Figure 9 The electronic device 4000 shown in the embodiment of the present application includes a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, for example, through a bus 4002. Optionally, the electronic device 4000 can also include a transceiver 4004, which can be used for data interaction between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual application, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present application.
[0125] The processor 4001 can be a CPU (Central Processing Unit, central processing unit), a general-purpose processor, a DSP (Digital Signal Processor, data signal processor), an ASIC (Application Specific Integrated Circuit, application specific integrated circuit), an FPGA (Field Programmable Gate Array, field programmable gate array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can realize or execute various exemplary logical blocks, modules and circuits described in combination with the disclosure. The processor 4001 can also be a combination of computing functions, such as one or more microprocessor combinations, combinations of DSP and microprocessor, etc.
[0126] The bus 4002 can include a path that transmits information between the above-described components. The bus 4002 can be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, or the like. The bus 4002 can be divided into an address bus, a data bus, a control bus, and the like. For convenience of representation, Figure 9 Only one thick line is used to represent the bus in the middle, but it does not mean that there is only one bus or only one type of bus.
[0127] The memory 4003 can be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, a magnetic disk storage medium, other magnetic storage device, or any other medium that can be used to carry or store computer programs and that can be read by a computer, without limitation.
[0128] The memory 4003 is used to store a computer program for implementing the embodiments of the present application, and is controlled by the processor 4001 to perform. The processor 4001 is used to execute the computer program stored in the memory 4003 to realize the steps shown in the foregoing method embodiments.
[0129] The embodiments of the present application provide a computer readable storage medium, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to realize the steps and corresponding contents of the foregoing method embodiments.
[0130] The embodiments of the present application also provide a computer program product, which includes a computer program. The computer program is executed by a processor to realize the steps and corresponding contents of the foregoing method embodiments.
[0131] The terms "first", "second", "third", "fourth", "1", "2", etc. (if any) in the specification and claims of the present application and the above drawings are used to distinguish similar objects, and do not necessarily have to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that shown or described.
[0132] It should be understood that, although each operation step in the flowchart of the embodiments of the present application is indicated by an arrow, the implementation order of the steps is not limited to the order indicated by the arrow. Unless otherwise specified herein, in some implementation scenarios of the embodiments of the present application, the implementation steps in each flowchart can be executed in other orders as required. In addition, part or all of the steps in each flowchart can include multiple sub-steps or multiple stages based on the actual implementation scenario. Part or all of these sub-steps or stages can be executed at the same time, and each of these sub-steps or stages can also be executed at different times. In the scenario where the execution times are different, the execution order of these sub-steps or stages can be flexibly configured as required, and the embodiments of the present application do not limit this.
[0133] The above is only an optional implementation of some implementation scenarios of the present application. It should be pointed out that, for ordinary skilled persons in the technical field, other similar implementation means based on the technical idea of the present application without departing from the technical concept of the present application also belong to the protection scope of the embodiments of the present application.
Claims
1. A method of noise identification for a spatial mass spectrum, characterized in that, The method comprises the following steps: extracting a plurality of ion layers from a spatial mass spectrum, each ion layer corresponding to an ion of a mass-to-charge ratio, the ion layer comprising all pixel points corresponding to the ion in the spatial mass spectrum; dividing the ion layer into grids to determine the type and number of pixel points of each grid, the type being used to indicate whether the grid corresponds to only a sample region scanned by the spatial mass spectrum; if it is determined that the ion layer is a background layer according to the type and number of pixel points of each grid in the ion layer, determining, from all background layers, pixel points with a number of occurrences exceeding a first preset value as background pixel points, and determining a noise region of the spatial mass spectrum according to the background pixel points; wherein the step of determining that the ion layer is a background layer according to the type and number of pixel points of each grid in the ion layer comprises: for each grid in the ion layer, obtaining a pixel point probability of the grid according to the number of pixel points in the grid and the size of the grid; determining a first average pixel point probability of all grids of a first type and a second average pixel point probability of all grids of a second type in the ion layer; if a ratio of the first average pixel point probability and the second average pixel point probability is not less than a second preset value, determining that the ion layer is a background layer; the first type is used to indicate that the grid corresponds to a blank region scanned by the spatial mass spectrum, or the grid corresponds to both a sample region and a blank region scanned by the spatial mass spectrum; and the second type is used to indicate that the grid corresponds to only a sample region scanned by the spatial mass spectrum.
2. The method for noise identification of spatial mass spectra according to claim 1, characterized in that, the step of determining a noise region of the spatial mass spectrum according to the background pixel points comprises: for each background pixel point, determining adjacent background pixel points of the background pixel point and distances between each adjacent background pixel point and the background pixel point; determining a target pixel point from the background pixel points according to the distances, and taking a distribution region of the target pixel point as the noise region.
3. The method for noise identification of spatial mass spectra according to claim 2, characterized in that, the step of determining adjacent background pixel points of the background pixel point comprises: establishing a KD tree according to the coordinates of all background pixel points; determining, by a K-neighbor algorithm, each adjacent background pixel point within a preset range of each background pixel point from the KD tree.
4. The method for noise identification of spatial mass spectra according to claim 2, characterized in that, the step of determining a target pixel point from the background pixel points according to the distances comprises: obtaining a density of the background pixel point according to the number of adjacent background pixel points corresponding to the background pixel point and the sum of distances between each adjacent background pixel point and the background pixel point; taking the background pixel point with a density greater than a third preset value as the target pixel point.
5. The method for noise identification in spatial mass spectra according to any one of claims 1 to 4, characterized in that after the step of determining a noise region of the spatial mass spectrum according to the background pixel points, the method further comprises the following step: deleting the noise region from the spatial mass spectrum to obtain a denoised spatial mass spectrum.
6. A device for noise identification of a spatial mass spectrum, characterized in that The method comprises the following steps: an ion layer acquisition module is configured to extract a plurality of ion layers from a spatial mass spectrum, each ion layer corresponding to an ion of a mass-to-charge ratio, the ion layer comprising all pixel points corresponding to the ion in the spatial mass spectrum; a grid division module, configured to divide the ion layer into grids, determine a type and a number of pixel points of each grid, and determine whether the type indicates that the grid corresponds to only a sample region of the spatial mass spectrum image; a noise region identification module, configured to: if it is determined that the ion layer is a background layer according to the type and the number of pixel points of each grid in the ion layer, determine pixel points with a number of occurrences exceeding a first preset value from all background layers as background pixel points, and determine a noise region of the spatial mass spectrum image according to the background pixel points; wherein the noise region identification module determines that the ion layer is a background layer according to the type and the number of pixel points of each grid in the ion layer, including: for each grid in the ion layer, obtaining a pixel point probability of the grid according to the number of pixel points in the grid and a size of the grid; determining a first average pixel point probability of all grids of a first type and a second average pixel point probability of all grids of a second type in the ion layer; if a ratio of the first average pixel point probability and the second average pixel point probability is not less than a second preset value, determining that the ion layer is a background layer; the first type indicates that the grid corresponds to a blank region of the spatial mass spectrum image or the grid corresponds to both a sample region and a blank region of the spatial mass spectrum image, and the second type indicates that the grid corresponds to only the sample region of the spatial mass spectrum image.
7. An electronic device comprising a memory, a processor, and a computer program stored on the memory, wherein the computer program comprises instructions that, when executed by the processor, cause the electronic device to perform the method of any one of claims 1-6. The processor executes the computer program to implement the steps of the noise identification method of the spatial mass spectrum image according to any one of claims 1-5.
8. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the noise identification method of the spatial mass spectrum image according to any one of claims 1-5.
9. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the noise identification method of the spatial mass spectrum image according to any one of claims 1-5.