Disclosure of Invention
One of the technical problems to be solved by the embodiments of the present application is to provide a method and an apparatus for establishing a matching model in robot spatial registration, which do not need to calibrate a body part before matching, reduce the complexity of matching steps, and establish a matching model free from interference of internal tissues wrapped by epidermis, thereby reducing the rate of mismatching and improving the matching efficiency.
In one aspect, an embodiment of the present invention provides a method for establishing a matching model in robot spatial registration, including:
obtaining coordinates of a pixel point of which the first gray value in each pixel row is greater than or equal to the extracted value in a stereo coordinate system of the medical image according to pixel rows parallel to the sagittal axis direction in all images in the medical image and the obtained gray values sequentially read for the pixel points in the pixel rows;
and generating a matching model according to the coordinates in the obtained stereoscopic coordinate system of the medical image.
Optionally, the manner of sequentially reading the gray values obtained by reading the pixels in the pixel row is as follows:
when the orientation of the sagittal axis is from the back of a human body to the front, taking a pixel point at the maximum sagittal axis coordinate value in a pixel column parallel to the sagittal axis direction as an initial pixel point, and sequentially reading the pixel points in the pixel column to obtain the gray value of the pixel points in the pixel column;
when the orientation of the sagittal axis is from the front of the human body to the back, taking the pixel point at the minimum position of the sagittal axis coordinate value in the pixel column parallel to the direction of the sagittal axis as an initial pixel point, and sequentially reading the pixel points in the pixel column to obtain the gray value of the pixel points in the pixel column.
Optionally, the manner of sequentially reading the gray values obtained by reading the pixels in the pixel row further includes:
and stopping reading operation on other pixel points in the pixel column when the pixel point of which the first gray value is greater than or equal to the extracted value in the pixel column is read.
Optionally, the extracted values are used to distinguish between tables and internal tissues within the body.
Optionally, the extracted values are used to distinguish between a human face and brain tissue.
Optionally, the determination method of the extracted value is:
obtaining the gray level X of the medical image according to the gray value range of the medical image;
and adding the product of the gray level X and the extraction coefficient S and the minimum gray value M of the medical image to obtain an extraction value T, wherein T is X S + M.
Optionally, the extraction coefficient has a value range of 0-0.0995.
Optionally, the size of the extraction coefficient is 0.0199.
On the other hand, the embodiment of the present application further provides a device for establishing a matching model in robot spatial registration, including:
the coordinate acquisition module is used for sequentially reading the obtained gray values according to pixel columns parallel to the sagittal axis direction in all images in the medical image and pixel points in the pixel columns to obtain the coordinates of the pixel points of which the first gray value in each pixel column is greater than or equal to the extracted value in a stereo coordinate system of the medical image;
and the matching model generation module is used for generating a matching model according to the coordinates in the obtained three-dimensional coordinate system of the medical image.
Optionally, the coordinate obtaining module is specifically configured to:
when the orientation of the sagittal axis is from the back of a human body to the front, taking a pixel point at the maximum sagittal axis coordinate value in a pixel column parallel to the sagittal axis direction as an initial pixel point, and sequentially reading the pixel points in the pixel column to obtain the gray value of the pixel points in the pixel column;
when the orientation of the sagittal axis is from the front of the human body to the back, taking the pixel point at the minimum position of the sagittal axis coordinate value in the pixel column parallel to the direction of the sagittal axis as an initial pixel point, and sequentially reading the pixel points in the pixel column to obtain the gray value of the pixel points in the pixel column.
Compared with the existing method for establishing the matching model, the method and the device for establishing the matching model in the robot space registration do not need to calibrate the specific part before matching, so that the complexity of the registration step is reduced, the condition that the same part is not accurately calibrated on the part to be matched and the same point on the three-dimensional model can be avoided, and the mismatching rate is reduced.
Detailed Description
Of course, it is not necessary for any particular embodiment of the invention to achieve all of the above advantages at the same time.
In order to make those skilled in the art better understand the technical solutions in the embodiments of the present invention, the technical solutions in the embodiments of the present invention will be described clearly and completely with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. All other embodiments that can be derived by one of ordinary skill in the art from the embodiments given herein are intended to be within the scope of the embodiments given herein.
Aiming at the problems of complicated steps, time consumption and low efficiency in the existing spatial registration technology, as shown in fig. 2, the embodiment of the present application provides a method for establishing a matching model in robot spatial registration, which includes steps S200-S201, specifically:
s200: and obtaining the coordinates of the pixel points of which the first gray value is greater than or equal to the extracted value in the stereo coordinate system of the medical image according to the pixel rows parallel to the sagittal axis direction in all images in the medical image and the gray values obtained by sequentially reading the pixel points in the pixel rows.
In the embodiment of the present application, the medical image is described by taking a CT image as an example, the CT image is a medical image obtained by scanning a human body with an X-ray beam, and each of a plurality of images in the medical image is a layer, and all scanned images constitute the medical image.
As can be seen from the above, the medical image may be a medical image of a specific part such as a head, a chest, an abdomen, or a whole body of a human body, and the embodiment of the present application describes the medical image by taking a head medical image as an example, the head medical image is a medical image including a head tissue, a plurality of tomographic images can be obtained by scanning the head with a CT machine, these images contain information about each tissue in the header, and the CT machine generates information about the range of the gray scale values of these images, the number of images, and the like, and in addition, since information of the entire head is reflected on a plurality of tomographic images scanned by the CT machine, the CT machine also generates a three-dimensional coordinate system of the images, from which coordinates of each pixel in the image in the three-dimensional coordinate system, directions of respective coordinate axes in the three-dimensional coordinate system, and the like can be obtained.
In the embodiment of the application, a extraction value is set before the matching model is established, and is used for comparing the gray value of the pixel points in the pixel columns parallel to the sagittal axis direction in all images in the medical image with the extraction value. The extracted values may be used to distinguish between tables and internal tissues within the body. For example, if an abdomen matching model is established, an extraction value capable of distinguishing the internal tissues of the belly and the belly needs to be preset before the abdomen matching model is established, and if a head matching model is established, an extraction value capable of distinguishing the face and the brain needs to be preset before the head matching model is established.
Optionally, the determination method of the extracted value is: obtaining the gray level X of the medical image according to the gray value range of the medical image; and adding the product of the gray level X and the extraction coefficient S and the minimum gray value M of the medical image to obtain an extraction value T, wherein T is X S + M. Here, the minimum gray scale value of the medical image refers to a minimum value in the gray scale range of the medical image. For example, the range of the gray-scale value of the image generated by the CT machine is 0 to 65535, and the minimum gray-scale value of the medical image is 0.
Optionally, the value range of the extraction coefficient S is 0-0.0995.
Further, the size of the extraction coefficient S is 0.0199.
It should be noted that, because the CT machine manufacturers are different, the gray scale value ranges of the generated images are also different; there are gray scale values in the range of 0 to 65535, i.e. the generated image has 65536 gray scale levels; some gray levels range from-1000 to 1000, i.e. the generated image has 2001 gray levels. And when the extraction coefficient S takes a value of 0.0199 and the gray value range of the head medical image generated by the CT machine is-1000, namely the generated image has 2001 gray levels, obtaining an extracted value T-2001X 0.0199-1000-960.1801 according to the calculation formula T-X X S + M of the extracted value. When step S200 is executed, according to pixel rows parallel to the sagittal axis direction in all images in the medical image, pixels in the pixel rows may be sequentially read, so as to obtain gray values of the pixels read in the pixel rows, and through comparison, a pixel having a first gray value in each pixel row of-960.1801 or more and coordinates of the pixel in the stereoscopic coordinate system of the medical image may be obtained.
Optionally, when a pixel point of which the first gray value is greater than or equal to the extracted value in the pixel column is read, the reading operation of other pixel points in the pixel column is stopped.
It should be noted that, in the process of sequentially reading the pixels in the pixel column, a situation that after all the pixels in the current pixel column are read, no pixel having a gray value greater than or equal to the extracted value is found may occur, and in this situation, after the gray values of all the pixels in the current pixel column are read, and under the condition that all the pixel columns in the current image are not completely read, the next pixel column which is not read is continuously read, or under the condition that all the pixel columns in the current image are completely read, the next image which is not read is continuously read.
The manner of sequentially reading the gray values obtained by sequentially reading the pixels in the pixel row may include: and reading the gray values of the pixel points one by one along a certain direction in a pixel column parallel to the sagittal axis direction.
It should be noted that, for reading pixel columns parallel to the sagittal axis direction in all images in the medical image, the pixel columns may be read sequentially or randomly, for example, if one of the images in the medical image has 10 pixel columns parallel to the sagittal axis direction, the pixel columns may be read sequentially according to the 1 st column, the 2 nd column, the 3 rd column … … th column 10, or the pixel columns may be read sequentially according to the first reading of the 1 st column, the 3 rd column, the 5 th column, the 7 th column, the 9 th column, the second reading of the 2 nd column, the 4 th column, the 6 th column, the 8 th column, and the 10 th column, but for any one of the pixel columns, when the gray value of the pixel points in the pixel columns is read sequentially, for example, if there are 256 pixel points in one pixel column, the reading direction of the pixel points is along the 1 st pixel point, the 2 nd pixel point, the 3 rd pixel point, the 4 th pixel point … … are up to the 256 th pixel point, or along the 256 th pixel point, the 255 th pixel point, the 254 th pixel point, the 253 th pixel point … … is up to the 1 st pixel point.
Optionally, the manner of sequentially reading the gray values obtained by reading the pixels in the pixel row is as follows:
when the orientation of the sagittal axis is from the back of a human body to the front, sequentially reading the pixel points in the pixel column parallel to the direction of the sagittal axis at the maximum sagittal axis coordinate value as initial pixel points to obtain the gray values of the pixel points in the pixel column, namely, reading the pixel points from the pixel point at the maximum sagittal axis coordinate value to the pixel point at the minimum sagittal axis coordinate value one by one;
when the orientation of the sagittal axis is from the front to the back of a human body, taking the pixel point at the minimum position of the sagittal axis coordinate axis in the pixel column parallel to the direction of the sagittal axis as an initial pixel point, and sequentially reading the pixel points in the pixel column to obtain the gray value of the pixel points in the pixel column, namely, reading the pixel points from the pixel point at the minimum position of the sagittal axis coordinate value to the pixel point at the maximum position of the sagittal axis coordinate value one by one.
It should be noted that the orientation of the sagittal axis in the present embodiment refers to the orientation of the positive axis of the sagittal axis. Because the sagittal axis, the coronal axis and the vertical axis in the stereo coordinate system of the image generated by the CT machine are determined by the sagittal plane, the coronal plane and the cross section, wherein the sagittal axis direction is the front-back direction of the human body, the coronal axis direction is the left-right direction of the human body, and the vertical axis direction is the up-down direction of the human body, in the embodiment of the application, the gray value obtaining mode of the pixel points is determined according to the orientation of the sagittal axis, the gray value of the pixel points can be read from one side close to the human face, and then the gray value is compared with the preset extraction value, so that the computation amount and the time for generating the matching model.
According to the above manner of sequentially reading the gray values of the pixels in the pixel rows, after one pixel row is read, another pixel row which is not read in the image is continuously read, and when all the pixel rows in the image are read, another image … … which is not read is read until all the images in the medical image are read (that is, all the pixel rows in the medical image parallel to the sagittal axis direction are read).
S201: and generating a matching model according to the coordinates in the obtained stereoscopic coordinate system of the medical image.
When all images in the medical image are traversed once, point cloud data in the medical image can be obtained, and in the process of reading the gray value of the pixel point, the coordinates of the pixel point with the gray value larger than or equal to the extracted value are recorded, so that a matching model can be generated by combining a stereo coordinate system of the medical image according to the specific coordinates of the point cloud data, namely the matching model is generated according to the coordinates of the first pixel point with the gray value larger than or equal to the extracted value in the stereo coordinate system of the medical image.
Taking the establishment of the head matching model as an example, the method for establishing a matching model in the robot spatial registration provided in the embodiment of the present application includes, as shown in fig. 3, steps S300-S305.
S300: an unread image of the medical image of the head is acquired.
The manner of acquiring the image may be random acquisition, sequential acquisition, or other acquisition manners, and the embodiment of the present application does not specifically limit the manner of acquiring the image. In addition, the read state of the image may be represented by an identification bit, for example, the identification bit of the unread image is set to "0", and the identification bit of the read image is set to "1".
After an unread image is obtained from the head medical image, that is, after an image with the identification position of "0" is obtained, according to the resolution of the obtained image, the number of pixel columns in the image parallel to the sagittal axis direction and the number of pixel points in each pixel column can be obtained, so that the pixel points in the pixel columns in the current image parallel to the sagittal axis direction can be read, that is, the pixel points in each pixel column in the coronal axis in the current image can be read, and the gray value of the pixel points in each pixel column in the coronal axis can be obtained.
S301: the method comprises the steps of obtaining an unread pixel column parallel to the sagittal axis direction in a current image, determining initial pixel points of the current pixel column according to the orientation of the sagittal axis, and sequentially reading the pixel points in the current pixel column by taking the initial pixel points as the initial pixel points.
And determining initial pixel points according to the direction of a sagittal axis and the principle of reading the pixel points from the side close to the human face. When the orientation of the sagittal axis is from the back of the human body to the front, taking the pixel point of the pixel column parallel to the direction of the sagittal axis where the sagittal axis coordinate value is maximum as an initial pixel point; when the orientation of the sagittal axis is from the front of the human body to the back, the pixel point at the minimum position of the sagittal axis coordinate value in the pixel column parallel to the sagittal axis direction is taken as an initial pixel point.
As shown in fig. 4, if the forward axis of the sagittal axis is oriented towards the front of the human body (i.e. the sagittal axis is oriented from the back of the human body to the front), and there are 10 pixel columns in the current image parallel to the sagittal axis, and there are 10 pixel points in each pixel column, and a pixel point in one pixel column in the current image is represented by a box with oblique lines in fig. 4, then the pixel points in the pixel columns are read from the side close to the human face, i.e. the pixel point represented by the triangle "Δ" in the image is used as the initial pixel point, and the gray values of the pixel points in the pixel columns are sequentially read along the direction opposite to the orientation of the sagittal axis.
S302: when the gray value of the current pixel point is larger than or equal to the extracted value, recording the coordinate of the current pixel point in the three-dimensional coordinate system, and stopping reading other pixel points in the current pixel column; or, all the pixel points in the current pixel column are read in sequence.
Still referring to fig. 4, when a pixel point whose gray value is equal to or greater than the extracted value is encountered, that is, a pixel point indicated by a circle "o" shown in the figure is encountered, the reading operation of other pixel points in the current pixel column is stopped, and the coordinates of the pixel point whose gray value is equal to or greater than the extracted value are recorded; or all the pixels in the current pixel column are read (not shown in the figure).
Optionally, the coordinates of the pixel points with the gray values greater than or equal to the extracted values are recorded in a face point cloud data file of the head medical image.
S303: whether all pixel columns in the current image parallel to the sagittal axis direction have been read.
And judging whether all pixel columns parallel to the sagittal axis direction in the current image are read or not after one pixel column is read. In a case where all pixel columns of the current image are not read in their entirety, the process returns to step S301. In the case where all the pixel columns of the current image are read, the identification position of the current image is set to "1", and step S304 is performed.
S304: whether all images in the medical image of the head are read.
If it is determined that all the images in the medical head image have not been read, the process returns to step S300. If it is determined that all the images in the medical image of the head have been read, step S305 is executed.
S305: and generating a face matching model according to the coordinates in the obtained three-dimensional coordinates of the medical image.
Before step S305 is executed, all images in the medical image of the head have been traversed, and the point cloud data of the human face in the medical image of the head has been obtained. According to the specific coordinates of the obtained human face point cloud data, a human face matching model can be generated by combining a stereo coordinate system of the head medical image.
Fig. 5 shows a face matching model created by a method for creating a matching model in robot spatial registration according to an embodiment of the present application. Compared with the prior art, the face matching model has the advantages that the situation that the face point cloud and the brain tissue features are matched together cannot occur, and the matching accuracy of the face point cloud and the three-dimensional model is improved.
Based on the same inventive concept, as shown in fig. 6, an embodiment of the present application further provides an apparatus for establishing a matching model in robot spatial registration, including:
the coordinate acquisition module 601: the system comprises a pixel array, a pixel acquisition unit, a pixel extraction unit, a pixel comparison unit and a pixel comparison unit, wherein the pixel array is used for reading obtained gray values in sequence according to pixel arrays parallel to the sagittal axis direction in all images in the medical image and pixel points in the pixel arrays to obtain coordinates of a pixel point of which the first gray value in each pixel array is greater than or equal to an extracted value in a stereo coordinate system of the medical image;
a matching model generating module 602, configured to generate a matching model according to coordinates in the obtained stereoscopic coordinate system of the medical image.
Optionally, the coordinate obtaining module 601 is specifically configured to:
when the orientation of the sagittal axis is from the back of a human body to the front, taking a pixel point at the maximum sagittal axis coordinate value in a pixel column parallel to the sagittal axis direction as an initial pixel point, and sequentially reading the pixel points in the pixel column to obtain the gray value of the pixel points in the pixel column;
when the orientation of the sagittal axis is from the front of the human body to the back, taking the pixel point at the minimum position of the sagittal axis coordinate value in the pixel column parallel to the direction of the sagittal axis as an initial pixel point, and sequentially reading the pixel points in the pixel column to obtain the gray value of the pixel points in the pixel column.
In this embodiment of the application, the coordinate obtaining module 601 and the matching model generating module 602 are configured to execute corresponding steps in the foregoing method embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately processed, or two or more units may be integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the embodiments of the present application, and are not limited thereto; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.