Automatic cell body identification and segmentation method and device based on two-photon calcium imaging data
Technical Field
The invention relates to the technical field of image processing and neurobiological data analysis, in particular to a method and a device for automatically identifying and dividing cell bodies based on two-photon calcium imaging data.
Background
The brain is a very important and complex organ, and many countries have already listed brain science and brain-like research as strategic level science and technology of the country, and the development of brain science has not been separated from the efficient and high-resolution neural activity recording technology. Two-photon calcium imaging technology is currently the standard tool for monitoring large numbers of neurons, recording the activity of large numbers of neurons in vivo at single cell resolution levels. However, due to the huge data volume generated by the two-photon calcium imaging technology, low signal-to-noise ratio of the data and the characteristic of simultaneously imaging hundreds or thousands of neurons, the difficulty in data analysis is brought about by the fact that the identification of cells manually is time-consuming and the standard is difficult to unify, and a plurality of algorithms are currently used for automatically, accurately and rapidly identifying the positions and the outlines of single nerve cells.
Aiming at the difficulty that the data volume of calcium imaging is huge, some cell identification and segmentation algorithms compress three-dimensional calcium imaging video into a two-dimensional abstract image by a method related to time sequence mean value, time sequence maximum value or time sequence, so that the data volume is only related to the size of an imaging area and is irrelevant to imaging time, and then cells are identified or segmented on the abstract image by using a traditional mode identification and image segmentation algorithm, but the method has the defects that neurons in the abstract image overlap due to the fact that the time dimension is abandoned, and the difficulty of cell identification and segmentation is increased.
Some cell identification and segmentation algorithms are directly based on calcium imaging video data, and the calcium imaging video data are regarded as spatial combinations of calcium fluorescence signals with different components, signals are clustered or calcium imaging videos are subjected to matrix decomposition, so that cell identification and segmentation are realized, but the method has the defects of large data storage amount and low operation efficiency, and the result of identification and segmentation is not the cell body of a neuron which is more interesting in research, and may also comprise structures such as axons, dendrites and the like of the neuron.
Disclosure of Invention
The invention aims to overcome the defects of the prior art, and provides an automatic cell body recognition and segmentation method based on two-photon calcium imaging data, which can improve the operation efficiency and reduce the data storage capacity, and solves the problems that cells are easy to leak out in cell recognition and the cell body recognition and segmentation result contains structures such as axons, dendrites and the like besides cells.
The invention aims at realizing the following technical scheme that in a first aspect, the invention provides a cell body automatic identification and segmentation method based on two-photon calcium imaging data, which comprises the following steps:
step 1, acquiring a two-photon calcium imaging video of a cell, and carrying out image denoising and image enhancement on each frame of video image;
Step 2, calculating time sequence correlation coefficients of fluorescent calcium signals of coordinates of each pixel point in the two-photon calcium imaging video and fluorescent calcium signals of a plurality of coordinate points in a neighborhood around the fluorescent calcium signals, solving an average value to serve as gray values of the pixel points, reducing the dimension of the two-photon calcium imaging video into a locally relevant abstract image, enhancing a circular structure with diameters in a certain range in the image by constructing a function related to characteristic values of hessian matrix on the locally relevant abstract image based on a cell recognition algorithm enhanced by multi-scale dots, and calculating center coordinates of circular structures with different dimensions in an imaging area, namely seed points of cell bodies;
Step 3, according to the seed points obtained in the step 2, cutting the two-photon calcium imaging video into block videos with fixed sizes taking the seed points as centers for each seed point, and applying a cell segmentation algorithm based on an elliptic shape constraint movable contour model on the block videos to obtain the contour of cell bodies, wherein the method comprises the steps of constructing a function related to a level set Energy function of (2)In the process of minimizingIs (are) simultaneously evolvedWherein the function isCorresponding to the contour of the cell, in order to construct an energy functionFirstly, constructing a data driving item according to the characteristics of two-photon calcium imaging data, measuring the difference of correlation vectors inside and outside the outline, and obtaining the correlation vector I (u) of each coordinate point u by calculating the correlation values of the fluorescent calcium signal of the position and the fluorescent calcium signals of all coordinate points v in the block:
wherein the pixel points u= (x, y) in the image, I (u) is a one-dimensional correlation vector, As a new feature of the pixel, N is the total number of pixel points in the block, v is all coordinate points in the block, Ω is defined as an image domain, and an image I is defined on the image domain, Ω -R N, secondly, an elliptical shape constraint term is added in an energy function by using a priori value of elliptical shape of a cell body, so that the finally obtained cell outline tends to be elliptical, and the method specifically comprises the following steps:
in the level set evolution process, fitting the contour into a parameterized ellipse, and limiting the level set evolution by using the ellipse, so that the contour of the final level set is also close to an ellipse, and alternately evolving as follows:
(1) Initializing level set functions And an elliptical shape phi (x, y);
(2) At the position of In the determined case, the evolution equation of phi (x, y) is obtained by minimizing the energy function by the gradient descent method, and since phi (x, y) is a parameterized ellipse, the evolution equation is determined by the center coordinate (x 0,y0) of the ellipse, the semi-major axis a of the ellipse, the semi-minor axis b of the ellipse, and the angle θ of rotation of the ellipse:
thus evolving phi (x, y), i.e., the update parameters (x 0,y0, a, b, θ);
(3) Determining phi (x, y), minimizing energy function by gradient descent method, and updating
(4) Repeating the steps (2) and (3) until reaching convergence condition, namely level set functionIs less than a set value or the iteration number is greater than the set value.
Further, the image denoising adopts an anisotropic filtering algorithm.
Further, the image enhancement adopts top-hat transformation to obtain a region with brighter gray scale in the original image.
Further, in step 2, based on the multi-scale dot enhanced cell recognition algorithm, the specific steps of calculating the center coordinates of the near-circular structures with different sizes in the imaging region are as follows:
(2.1) setting an upper limit sigma min and a lower limit sigma max of the scale parameter according to the upper limit and the lower limit of the cell radius in the locally relevant abstract image;
(2.2) calculating a eigenvalue lambda 1、λ2 of the Hessian matrix of each pixel point (x, y) in the single-scale gaussian space for each scale parameter sigma in the upper and lower limits of the scale parameter;
(2.3) introducing eigenvalues lambda 3, wherein the eigenvalues of the Hessian matrix corresponding to the spherical structure in the three-dimensional space meet lambda 1≈λ2≈λ3 <0, the eigenvalues of the Hessian matrix corresponding to the tubular structure meet |lambda 2|≈|λ3|≥λ1, and setting a parameter tau to regularize lambda ρ;
(2.4) calculating a spherical Structure similarity function
(2.5) Repeating the steps (2.2) to (2.4), and calculating VR (x, y, sigma) corresponding to all scale parameters sigma;
(2.6) taking the maximum value of VR (x, y, sigma) of each pixel point (x, y) under all scale parameters to obtain a multiscale spherical structure similarity function VR (x, y), and obtaining a spherical structure enhanced image;
(2.7) setting a threshold value TH according to a3 sigma principle of normal distribution in a probability theory, and binarizing the spherical structure enhanced image, wherein the pixel points belonging to the spherical structure have values of 1 and the other pixel points have values of 0;
(2.8) removing the structure with the area which does not meet the requirement in the figure by using a morphological filtering method;
(2.9) calculating the gravity center of each spherical structure in the graph to obtain the coordinates of the seed points.
In a second aspect, the invention further provides an automatic cell body recognition and segmentation device based on two-photon calcium imaging data, which comprises a memory and one or more processors, wherein executable codes are stored in the memory, and the automatic cell body recognition and segmentation method based on the two-photon calcium imaging data is realized when the executable codes are executed by the processors.
In a third aspect, the present invention further provides a computer readable storage medium having a program stored thereon, which when executed by a processor, implements the method for automatically identifying and dividing cell bodies based on two-photon calcium imaging data.
The invention has the beneficial effects that:
1. The automatic processing of the visual cortex neuron fluorescence activity data acquired by the two-photon fluorescence microscope is realized, the positions of hundreds or thousands of neurons in an imaging area are automatically identified, the outline of a cell body is segmented, and the fluorescence calcium signals of the neurons are subsequently extracted for analyzing the neural mechanism of the cognitive function by combining behaviors, so that the method has important value for promoting the development of brain science.
2. Firstly, compressing a three-dimensional calcium imaging video into a two-dimensional abstract image, then identifying seed points of cells on the abstract image, making the data size of a cell identification algorithm only related to the size of an imaging area and not related to imaging time, then cutting the calcium imaging video into a block video by taking the seed points as the center, and then dividing the outline of the cells on the block video, so that the data size and the operation amount of a cell division algorithm are greatly reduced.
3. The cell recognition algorithm based on multi-scale dot enhancement is provided, so that the cell bodies of the pericytes with different sizes in an imaging area can be recognized, and structures such as axons, dendrites and the like of neurons are not recognized.
4. The cell segmentation algorithm based on the elliptic constraint movable contour model is provided, and the data driving term based on the correlation vector structure enables the segmented contour to be more accurate, the introduced elliptic constraint term enables the zero level set contour to be close to an ellipse, and therefore the segmented contour only comprises cell bodies, and structures such as axons, dendrites and the like are excluded.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of an automatic cell body recognition and segmentation method based on two-photon calcium imaging data;
FIG. 2 is a graph showing the results of cell recognition;
FIG. 3 is a graph showing the results of cell segmentation;
FIG. 4 is a schematic diagram showing the action of elliptic constraint terms in a cell segmentation method;
fig. 5 is a block diagram of an automatic cell body recognition and segmentation device based on two-photon calcium imaging data.
Detailed Description
The following describes the embodiments of the present invention in further detail with reference to the drawings.
As shown in fig. 1, the method for automatically identifying and dividing cell bodies based on two-photon calcium imaging data provided by the invention comprises the following specific steps:
Step 1, acquiring two-photon calcium imaging video of cells, and carrying out image denoising and image enhancement on each frame of video image.
And 1.1, denoising the image, namely an anisotropic filtering algorithm.
And 1.2, enhancing the image, namely changing the top cap to obtain a region with brighter gray scale in the original image.
Step 2, calculating time sequence correlation coefficients of fluorescent calcium signals of coordinates of each pixel point in a two-photon calcium imaging video and fluorescent calcium signals of a plurality of coordinate points in a neighborhood around the fluorescent calcium signals, solving an average value to serve as gray values of the pixel points, reducing the dimension of the two-photon calcium imaging video into a locally relevant abstract image, enhancing a circular structure with diameters in a certain range in the image on the locally relevant abstract image based on a cell recognition algorithm enhanced by multi-scale dots by constructing a function (Frangi A F,Niessen W J,Vincken K L,et al.Multiscale vessel enhancement filtering[C].International conference on medical image computing and computer-assisted intervention.Springer,Berlin,Heidelberg,1998:130-137.) related to characteristic values of hessian matrixes, and calculating center coordinates of the circular structures with different dimensions in an imaging area, namely seed points of cell bodies, wherein the method comprises the following steps:
And 2.1, for all coordinate points in a two-photon calcium imaging video imaging region, respectively calculating time sequence correlation coefficients of fluorescent calcium signals of each coordinate point (x, y) and fluorescent calcium signals of 8 coordinate points in the surrounding vicinity thereof, taking the average value of the 8 time sequence correlation coefficients as the gray value of the pixel point, and finally obtaining a local correlation abstract image.
Step 2.2, a cell identification algorithm based on multi-scale dot enhancement enhances a circular structure with a diameter within a certain range in an image by constructing a function related to a characteristic value of hessian matrix, and calculates the center of the circular structure as a position coordinate of a cell body, wherein the specific steps are as follows:
(2.1) setting an upper limit sigma min and a lower limit sigma max of the scale parameter according to the upper limit and the lower limit of the cell radius in the locally relevant abstract image;
(2.2) calculating a eigenvalue lambda 1、λ2 of the Hessian matrix of each pixel point (x, y) in the single-scale gaussian space for each scale parameter sigma in the upper and lower limits of the scale parameter;
(2.3) introducing eigenvalues lambda 3, wherein the eigenvalues of the Hessian matrix corresponding to the spherical structure in the three-dimensional space meet lambda 1≈λ2≈λ3 <0, the eigenvalues of the Hessian matrix corresponding to the tubular structure meet |lambda 2|≈|λ3|≥λ1, and setting a parameter tau to regularize lambda ρ;
(2.4) calculating a spherical Structure similarity function
(2.5) Repeating the steps (2) to (4), and calculating VR (x, y, sigma) corresponding to all scale parameters sigma;
(2.6) taking the maximum value of VR (x, y, sigma) of each pixel point (x, y) under all scale parameters to obtain a multiscale spherical structure similarity function VR (x, y), and obtaining a spherical structure enhanced image;
(2.7) setting a proper threshold value TH according to the 3 sigma principle of normal distribution in the probability theory, and binarizing the spherical structure enhanced image, wherein the pixel points belonging to the spherical structure have values of 1 and the other pixel points have values of 0;
(2.8) removing the structure with the area smaller than 176um 2 in the figure by using a morphological filtering method;
(2.9) calculating the gravity center of each spherical structure in the graph to obtain the coordinates of the seed points.
And 3, according to the seed points obtained in the step 2, cutting the two-photon calcium imaging video into block videos with fixed sizes by taking the seed points as the center, and applying a cell segmentation algorithm based on an elliptic shape constraint movable contour model on the block videos to obtain the contour of a cell body, wherein the contour is shown in fig. 2 and 3.
Step 3.1, the length and width of the block video are determined by the diameter of cell bodies in the imaging area of the two-photon calcium imaging video, and 41 multiplied by 41.
And 3.2, a cell segmentation algorithm based on an elliptic shape constraint active contour model is an improvement on a distance regularized level set evolution model, and after the level set evolution is finished, a zero level set contour converges to the edge of a cell body, wherein the contour is the contour of the cell body. In particular, constructing a function about a level setEnergy function of (2)In the process of minimizingIs (are) simultaneously evolvedWherein the function isCorresponding to the contour of the cell, in order to construct an energy functionFirstly, constructing a data driving item according to the characteristics of two-photon calcium imaging data, secondly, because the neuron consists of structures such as a cell body, an axon, a dendrite and the like, the invention only wants to divide the outline of the cell body to calculate the fluorescence signal of the cell body in a subsequent step, and the invention adds an elliptic shape constraint item in an energy function by utilizing the priori value of the elliptical shape of the cell body, so that the finally obtained cell outline tends to be elliptical. The improvement of the level set evolution model of distance regularization comprises the following two points:
The improvement 1 is that the data driving item is not based on gray value any more, but the difference of correlation vectors inside and outside the outline is measured, the correlation vector I (u) of each coordinate point u is obtained by calculating the correlation value of the fluorescent calcium signal of the position and the fluorescent calcium signals of all coordinate points v in the block:
the improvement 2 is that an ellipse constraint term is added in the energy function, in the process of level set evolution, the contour is fitted into a parameterized ellipse, and the ellipse is used for limiting the evolution of the level set, so that the contour of the final level set is also close to an ellipse, and the steps of alternating evolution are as follows:
(1) Initializing level set functions And an elliptical shape phi (x, y);
(2) At the position of In the determined case, the evolution equation of phi (x, y) is obtained by minimizing the energy function by the gradient descent method, and since phi (x, y) is a parameterized ellipse, the evolution equation is determined by the center coordinate (x 0,y0) of the ellipse, the semi-major axis a of the ellipse, the semi-minor axis b of the ellipse, and the angle θ of rotation of the ellipse:
Thus evolving phi (x, y), i.e., the update parameters (x 0,y0, a, b, θ);
(3) Determining phi (x, y), minimizing energy function by gradient descent method, and updating
(4) Repeating the steps (2) and (3) until reaching convergence condition, namely level set functionIs less than a set value or the iteration number is greater than the set value.
The role of the elliptic constraint term in the cell segmentation method, as shown in a in fig. 4, b in fig. 4, and c in fig. 4, 3 columns show the results of the cell segmentation algorithm with and without elliptic constraint terms applied to 3 sets of data, respectively. The left side is where no elliptical constraint is used, while the right side uses elliptical constraint. The results of the three rows above show that the introduction of the elliptic constraint term can limit the segmentation result to the neuron cell body without considering the axons and dendrites of the neurons, while the results of the last row show that for overlapping neurons, the introduction of the elliptic constraint term can also prevent the segmentation result from overflowing the boundary of the real cells.
Corresponding to the embodiment of the automatic cell body identification and segmentation method based on the two-photon calcium imaging data, the invention also provides an embodiment of the automatic cell body identification and segmentation device based on the two-photon calcium imaging data.
Referring to fig. 5, the device for automatically identifying and dividing a cell body based on two-photon calcium imaging data according to the embodiment of the present invention includes a memory and one or more processors, wherein executable codes are stored in the memory, and when the processor executes the executable codes, the processor is configured to implement the method for automatically identifying and dividing a cell body based on two-photon calcium imaging data according to the above embodiment.
The embodiment of the automatic cell body identification and segmentation device based on the two-photon calcium imaging data can be applied to any equipment with data processing capability, and the equipment with data processing capability can be equipment or a device such as a computer. The apparatus embodiments may be implemented by software, or may be implemented by hardware or a combination of hardware and software. Taking software implementation as an example, the device in a logic sense is formed by reading corresponding computer program instructions in a nonvolatile memory into a memory by a processor of any device with data processing capability. From the hardware level, as shown in fig. 5, a hardware structure diagram of an apparatus with optional data processing capability, where the automatic cell body recognition and segmentation apparatus based on two-photon calcium imaging data is located, is provided in the present invention, and in addition to the processor, the memory, the network interface, and the nonvolatile memory shown in fig. 5, the apparatus with optional data processing capability in the embodiment generally includes other hardware according to the actual function of the apparatus with optional data processing capability, which is not described herein again.
The implementation process of the functions and roles of each unit in the above device is specifically shown in the implementation process of the corresponding steps in the above method, and will not be described herein again.
For the device embodiments, reference is made to the description of the method embodiments for the relevant points, since they essentially correspond to the method embodiments. The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purposes of the present invention. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
The embodiment of the invention also provides a computer readable storage medium, on which a program is stored, which when executed by a processor, implements the automatic cell body recognition and segmentation method based on two-photon calcium imaging data in the above embodiment.
The computer readable storage medium may be an internal storage unit, such as a hard disk or a memory, of any of the data processing enabled devices described in any of the previous embodiments. The computer readable storage medium may also be an external storage device of any device having data processing capabilities, such as a plug-in hard disk, a smart memory card (SMART MEDIA CARD, SMC), an SD card, a flash memory card (FLASH CARD), etc. provided on the device. Further, the computer readable storage medium may include both internal storage units and external storage devices of any data processing device. The computer readable storage medium is used for storing the computer program and other programs and data required by the arbitrary data processing apparatus, and may also be used for temporarily storing data that has been output or is to be output.
The above-described embodiments are intended to illustrate the present invention, not to limit it, and any modifications and variations made thereto are within the spirit of the invention and the scope of the appended claims.