Coordinate registration method and device for medical image and electronic equipment
By acquiring the four positioning points and voxel coordinates of medical images, determining the direction and performing linear scanning and differential calculations, the problem of large and time-consuming coordinate registration calculation in the prior art is solved, and real-time display of medical images is realized.
Patent Information
- Application Number
- CN202510012734.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2045-01-03
AI Technical Summary
The existing coordinate registration methods for medical images are computationally expensive and time-consuming, and cannot meet the needs of real-time display.
By obtaining the four positioning points of the display image and their voxel coordinates in the voxel coordinate system, determining the first direction, the second direction and the third direction, performing straight line scanning and differential calculations, and combining the coordinate values to achieve coordinate registration.
It reduces the calculation and time-consuming of coordinate registration, improves the real-time display of medical images on the display interface, and meets the real-time needs of users.
Smart Images

Figure CN119941810A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer vision, and in particular to a coordinate registration method, device and electronic equipment for medical images. Background Art
[0002] Medical imaging multi-planar reconstruction (MPR) technology is a medical imaging technology that converts multi-layer medical imaging data into two-dimensional medical images at any angle. Among them, multi-layer medical imaging data refers to a series of continuous two-dimensional image slices with different depths obtained by medical imaging equipment, such as computed tomography (CT). At present, most medical imaging MPR technologies are real-time medical imaging technologies. Among them, real-time medical imaging technology is a medical imaging technology that stacks multi-layer medical imaging data into voxel cubes, renders the voxel cubes in real time through the graphics processing unit (GPU) ray projection algorithm, converts the voxel cubes into two-dimensional medical images of camera planes at different angles, and displays the two-dimensional medical images in real time on the display interface. That is, real-time medical imaging technology can obtain two-dimensional medical images at any angle by adjusting the position, direction and focus of the camera.
[0003] Coordinate registration of medical images refers to converting the pixels of a two-dimensional medical image (referred to as display image) displayed on a display interface into voxels in a voxel coordinate system. The display image can be a two-dimensional medical image at any angle. Through the coordinate registration of medical images, the precise voxel coordinates of the pixels of the display image in the voxel coordinate system can be obtained, which is conducive to accurately labeling the display image and helping users to identify medical images. For real-time medical imaging technology, since the resolution of the display interface may be different from the resolution of the two-dimensional medical image (referred to as camera image) of the camera plane, in order to display the camera image on the display interface, the resolution of the camera image needs to be scaled so that the resolution of the scaled camera image is the same as the resolution of the display interface. However, when real-time medical imaging technology uses the GPU ray casting algorithm for real-time rendering, it only needs to color the obtained color value on the display interface, and it is impossible to obtain the voxel coordinates of the pixels of the display image in the voxel coordinate system, that is, it is impossible to perform coordinate registration of medical images.
[0004] At present, the coordinate registration of medical images can be performed by coordinate conversion. The specific registration method is: obtaining the first rotation matrix and the first offset vector of the voxel coordinate system and the world coordinate system, and obtaining the first coordinate conversion formula of the voxel coordinate system and the world coordinate system. The voxel coordinates of each voxel in the voxel cube can be converted into the world coordinates in the world coordinate system by using the first coordinate conversion formula. Then, according to the second coordinate conversion formula of the world coordinate system and the camera coordinate system, the world coordinates corresponding to each voxel in the voxel cube are converted into the camera coordinates in the camera coordinate system. Then, according to the camera coordinates, the voxels that need to be displayed in the camera plane of the voxel cube are determined to obtain the camera image. Finally, the camera image is scaled to obtain the display image displayed on the display interface. That is, if the target pixel point of the display image is marked, each voxel in the voxel cube needs to be converted into the above coordinates, which is large in calculation and takes a long time to calculate, which makes the real-time display of the display image unable to meet the user's needs. Summary of the invention
[0005] The embodiments of the present application provide a coordinate registration method, device and electronic device for medical images, which are used to reduce the amount of calculation and time consumption during the coordinate registration of medical images and improve the real-time performance of the displayed images on the display interface.
[0006] In a first aspect, an embodiment of the present application provides a coordinate registration method for a medical image, the method comprising:
[0007] Acquire four positioning points of a displayed image and the voxel coordinates of the four positioning points in a voxel coordinate system; the displayed image is a rectangular image displayed by a camera image on a display interface, the camera image is a projection of a target voxel cube formed by stacking multiple layers of medical images under a current camera plane, and the four positioning points are four vertices of the displayed image;
[0008] Determine a first direction, a second direction, and a third direction according to the voxel coordinates of the four positioning points; the first direction is a coordinate axis direction in which the voxel coordinate change rate of the four positioning points is a first change rate, the second direction is a coordinate axis direction in which the voxel coordinate change rate of the four positioning points is a second change rate, and the third direction is a coordinate axis direction in which the voxel coordinate change rate of the four positioning points is a third change rate, the first change rate is greater than or equal to the second change rate, and the second change rate is greater than or equal to the third change rate;
[0009] By performing linear scanning in the first direction and the second direction, the coordinate values of the pixel points in the displayed image on the first coordinate axis and the coordinate values on the second coordinate axis are obtained; the coordinate values of the first coordinate axis are the coordinate values of the coordinate axis corresponding to the first direction, and the coordinate values of the second coordinate axis are the coordinate values of the coordinate axis corresponding to the second direction; by performing differential calculation in the third direction, the coordinate values of the pixel points in the displayed image on the third coordinate axis are obtained, and the coordinate values of the third coordinate axis are the coordinate values of the coordinate axis corresponding to the third direction;
[0010] The coordinate values of the coordinate axis corresponding to the first direction, the coordinate values of the coordinate axis corresponding to the second direction, and the coordinate values of the coordinate axis in the third direction are combined to obtain the voxel coordinates of at least one pixel point in the displayed image in the target voxel cube.
[0011] Exemplarily, the four positioning points include a first positioning point, a second positioning point, a third positioning point and a fourth positioning point, the first positioning point and the second positioning point are adjacent vertices, the first positioning point and the fourth positioning point are adjacent vertices, and the first positioning point and the third positioning point are diagonal vertices;
[0012] Obtaining the coordinate value of the pixel point in the displayed image on the first coordinate axis and the coordinate value on the second coordinate axis by performing linear scanning in the first direction and the second direction, including:
[0013] Determine a straight line direction of the scanning line; the straight line direction includes one of the first positioning point pointing to the second positioning point and the first positioning point pointing to the fourth positioning point;
[0014] According to the straight line direction and the preset scanning step length, a straight line scan is performed in the first direction and the second direction to determine the coordinate value of the pixel point of the displayed image on the first coordinate axis and the coordinate value on the second coordinate axis at each step; the straight line scan starts from the first positioning point and ends at the fourth positioning point.
[0015] Exemplarily, performing linear scanning in the first direction and the second direction includes:
[0016] Linear scanning is performed in the first direction and the second direction based on the Bresenham algorithm.
[0017] Exemplarily, determining the coordinate value of the pixel point of the displayed image on the first coordinate axis and the coordinate value of the pixel point on the second coordinate axis at each step includes:
[0018] Determine the perpendicular vectors of the two positioning points perpendicular to the direction of the straight line;
[0019] The vertical vector is reduced to obtain a unit vector, where the vector length of the unit vector is 1;
[0020] The scanning starting point of the scanning straight line of the nth step is obtained as the sum of the coordinate vector corresponding to the first positioning point and n×the unit vector;
[0021] According to the scanning starting point and the direction of the straight line, the coordinate value of the pixel point of the displayed image in the nth step on the first coordinate axis and the coordinate value on the second coordinate axis are determined; n is an integer greater than or equal to 1.
[0022] Exemplarily, determining the linear direction of the scanning line includes:
[0023] Obtain a first vector from the second positioning point to the first positioning point, and a second vector from the fourth positioning point to the first positioning point;
[0024] If the vector length of the first vector is greater than the vector length of the second vector, determining that the straight line direction of the scanning line is from the first positioning point to the fourth positioning point;
[0025] If the vector length of the first vector is less than or equal to the vector length of the second vector, the straight line direction of the scanning line is determined to be from the first positioning point to the second positioning point.
[0026] Exemplarily, the obtaining the coordinate value of the pixel point in the displayed image on the third coordinate axis by performing differential calculation in the third direction includes:
[0027] Obtaining a first coordinate difference between a first pixel point and a second pixel point on the first coordinate axis, and obtaining a second coordinate difference between the first pixel point and the second pixel point on the second coordinate axis; the first pixel point and the second pixel point are adjacent pixel points in the displayed image, and the coordinate value of the first pixel point on the third coordinate axis is known;
[0028] Acquire a target parameter value, where the target parameter value is a sum of a product of the first coordinate difference value and a first component of a unit normal vector of a current camera plane, and a product of the second coordinate difference value and a second component of a unit normal vector of the current camera plane;
[0029] According to the constraint equation of the first pixel point and the second pixel point, the coordinate value of the second pixel point on the third coordinate axis is determined; the constraint equation is that the absolute value of the sum of the target change amount and the target parameter value is less than a first preset value, and the target change amount is the product of the difference equation of the first pixel point and the second pixel point on the third coordinate axis and the third component of the unit normal vector of the current camera plane.
[0030] Exemplarily, the acquiring four positioning points of the display image and the voxel coordinates of the four positioning points in a voxel coordinate system includes:
[0031] Acquire multiple intersection points between the target voxel cube and the current camera plane and intersection coordinate values of the multiple intersection points;
[0032] According to the intersection coordinate values of the multiple intersection points, the four positioning points of the displayed image and the voxel coordinates of the four positioning points in the voxel coordinate system are determined; the four positioning points are the four vertices of the circumscribed polygon formed by the multiple intersection points, and the vertices of the polygon are the multiple intersection points.
[0033] Exemplarily, the acquiring a plurality of intersection points between the target voxel cube and the current camera plane and intersection coordinate values of the plurality of intersection points includes:
[0034] Obtaining eight vertices of the target voxel cube and voxel coordinate values of the eight vertices in the voxel coordinate system;
[0035] Determine the world coordinate values of the eight vertices in the world coordinate system according to the voxel coordinate values of the eight vertices and the transformation between the voxel coordinate system and the world coordinate system;
[0036] Determine the equation of a straight line between every two vertices of the eight vertices;
[0037] According to the straight line equation between each two vertices and the plane equation of the current camera plane, the multiple intersection points of the target voxel cube and the current camera plane and the intersection coordinate values of the multiple intersection points are determined, and the intersection coordinate values are the world coordinate values of the intersection points in the world coordinate system.
[0038] Exemplarily, after obtaining the intersection coordinate values of the plurality of intersection points, the method further includes:
[0039] Determine, according to the world coordinates of the eight vertices, an intersection point among the plurality of intersection points on the target voxel cube;
[0040] The step of determining the four positioning points of the displayed image and the voxel coordinates of the four positioning points in the voxel coordinate system according to the intersection coordinate values of the plurality of intersection points includes:
[0041] The four positioning points of the displayed image and the voxel coordinates of the four positioning points in the voxel coordinate system are determined according to the intersection coordinate values of the intersection points on the target voxel cube, and the four vertices are the four vertices of the circumscribed rectangle of the polygon formed by the intersection points on the target voxel cube.
[0042] Exemplarily, the four positioning points include a first positioning point, a second positioning point, a third positioning point and a fourth positioning point, the first positioning point and the second positioning point are adjacent vertices, the first positioning point and the fourth positioning point are adjacent vertices, and the first positioning point and the third positioning point are diagonal vertices;
[0043] The determining of the first direction, the second direction and the third direction according to the voxel coordinates of the four positioning points comprises:
[0044] Determine a positioning vector between the third positioning point and the first positioning point;
[0045] The coordinate axis direction corresponding to the component with the largest absolute value of the positioning vector is determined as the first direction, the coordinate axis direction corresponding to the component with the smallest absolute value of the positioning vector is determined as the third direction, and the coordinate axis directions corresponding to the remaining components in the positioning vector are determined as the second direction.
[0046] In a second aspect, an embodiment of the present application provides a coordinate registration device for a medical image, the device comprising:
[0047] A positioning point acquisition unit, used to acquire four positioning points of a display image and voxel coordinates of the four positioning points in a voxel coordinate system; the display image is a rectangular image displayed by a camera image on a display interface, the camera image is a projection of a target voxel cube formed by stacking multiple layers of medical images under a current camera plane, and the four positioning points are four vertices of the display image;
[0048] a direction determination unit, configured to determine a first direction, a second direction, and a third direction according to the voxel coordinates of the four positioning points; the first direction is a coordinate axis direction in which the voxel coordinate change rate of the four positioning points is a first change rate, the second direction is a coordinate axis direction in which the voxel coordinate change rate of the four positioning points is a second change rate, and the third direction is a coordinate axis direction in which the voxel coordinate change rate of the four positioning points is a third change rate, the first change rate is greater than or equal to the second change rate, and the second change rate is greater than or equal to the third change rate;
[0049] a coordinate value acquisition unit, configured to acquire the coordinate value of the pixel point in the displayed image on the first coordinate axis and the coordinate value of the pixel point in the displayed image on the second coordinate axis by performing linear scanning in the first direction and the second direction; the coordinate value of the first coordinate axis is the coordinate value of the coordinate axis corresponding to the first direction, and the coordinate value of the second coordinate axis is the coordinate value of the coordinate axis corresponding to the second direction; and acquire the coordinate value of the pixel point in the displayed image on the third coordinate axis by performing differential calculation in the third direction, and the coordinate value of the third coordinate axis is the coordinate value of the coordinate axis corresponding to the third direction;
[0050] A registration unit is used to combine the coordinate values of the coordinate axis corresponding to the first direction, the coordinate values of the coordinate axis corresponding to the second direction, and the coordinate values of the coordinate axis in the third direction to obtain the voxel coordinates of at least one pixel point in the displayed image in the target voxel cube.
[0051] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising a memory and a processor;
[0052] The memory is coupled to the processor;
[0053] The memory stores program instructions, and when the program instructions are executed by the processor, the electronic device executes the method as described in any one of the first aspects.
[0054] Beneficial effects:
[0055] The embodiment of the present application provides a coordinate alignment, device and electronic device for medical images. When executing the method, first obtain the four positioning points of the displayed image and the voxel coordinates of the four positioning points in the voxel coordinate system. The coordinate axis direction with the fastest voxel coordinate change rate among the four positioning points is taken as the first direction, the coordinate axis direction with the slowest voxel coordinate change rate among the four positioning points is taken as the third direction, and the coordinate axis direction with the second highest voxel coordinate change rate among the four positioning points is taken as the second direction. Perform a linear scan in the first direction and the second direction to obtain the coordinate value of the coordinate axis corresponding to the pixel point in the first direction, and the coordinate value of the coordinate axis corresponding to the second direction. Perform a differential calculation in the third direction to obtain the coordinate value of the coordinate axis corresponding to the pixel point in the third direction, and combine these three coordinate values to obtain the voxel coordinates of multiple pixels in the displayed image in the voxel cube. Therefore, the embodiment of the present application only needs to determine four positioning points, and then the coordinates of the pixel points of the displayed image in the voxel coordinate system can be obtained through linear scanning or differential calculation to achieve coordinate alignment. There is no need to traverse the voxels of the entire voxel cube for coordinate conversion, nor is there any need to perform complex matrix multiplication and / or vector multiplication operations. Therefore, it helps to reduce the computational workload and reduce the computational time, thereby helping to improve the real-time display of medical images on the display interface, so that the real-time display of medical images on the display interface meets user needs and improves user experience.
[0056] In addition, for the coordinate values of the blocks whose coordinate change rates are compared, a straight line scanning method is adopted, and the scanning lines will be closely adjacent to each other, further avoiding the existence of empty voxels between the scanning lines. Therefore, the embodiment of the present application further solves the technical problem of low accuracy of coordinate matching due to the existence of empty voxels. In addition, the coordinate change rate of the third direction is relatively slow, and there will be repeated voxel points. The embodiment of the present application adopts differential calculation between different pixels, and the voxel coordinates of one pixel point are inferred from the voxel coordinates of another pixel point, thereby avoiding the influence of repeated voxel points on coordinate matching, and further improving the accuracy of coordinate matching. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 A schematic diagram of an image of a voxel cube provided in an embodiment of the present application;
[0058] Figure 2 A flow chart of a coordinate registration method for medical images provided in an embodiment of the present application;
[0059] Figure 3 A schematic diagram of a display image of a target voxel cube provided in an embodiment of the present application;
[0060] Figure 4A A schematic diagram of a linear scan provided in an embodiment of the present application;
[0061] Figure 4B A schematic diagram of a method for providing ...
[0062] Figure 5 A flowchart of a coordinate registration method for medical images provided in an embodiment of the present application;
[0063] Figure 6 A schematic diagram of an intersection set provided in an embodiment of the present application;
[0064] Figure 7 A schematic diagram of obtaining a display image provided by an embodiment of the present application;
[0065] Figure 8 A schematic diagram of the structure of a coordinate registration device for medical images provided in an embodiment of the present application. DETAILED DESCRIPTION
[0066] As mentioned above, the coordinate registration of medical images refers to the conversion of the pixel points of the display image of the two-dimensional medical image converted from the multi-layer medical image data into voxels in the same voxel coordinate system. Among them, the display image refers to the image of the two-dimensional medical image displayed on the display interface. For example, in real-time medical imaging technology, the image of the two-dimensional medical image projected from the multi-layer medical image data to the current camera plane and displayed on the display interface is called the display image. For the convenience of description, the two-dimensional medical image projected from the multi-layer medical image data to the current camera plane is referred to as the camera image below.
[0067] In actual use, the resolution of the display interface may be different from the resolution of the camera image. For example, the resolution of the display interface is 1920×1080, while the resolution of the camera image is 1280×720. If the resolution of the camera image is higher than the resolution of the display interface, the camera interface will not be able to display all the details of the camera image. At this time, in order to make the display interface display the entire camera image, the camera image needs to be scaled or cropped to fit the display interface. If the resolution of the camera image is lower than the resolution of the display interface, the camera image displayed on the display interface will be blurred. At this time, it is necessary to fill the extra space by interpolating or enlarging pixels. Among them, the resolution of the camera image is adjusted to obtain an image that is adapted to the display interface, which is the display image.
[0068] However, the pixels of the displayed image do not match the pixels of the camera image. In addition, real-time medical imaging technology uses a GPU ray casting algorithm for real-time rendering, which only requires coloring the acquired color values on the display interface. It does not involve the position of the pixel points corresponding to the color value in the voxel coordinate system or the world coordinate system. This makes it impossible to obtain the relationship between the pixels and color values of the displayed image, that is, it is impossible to obtain the voxel coordinates of the pixel points of the displayed image in the voxel coordinate system.
[0069] At present, in the relevant scheme, the coordinate conversion method can be used to perform the coordinate registration of medical images. Specifically, the first rotation matrix and the first offset vector of the voxel coordinate system and the world coordinate system are obtained, and the first coordinate conversion formula of the voxel coordinate system and the world coordinate system is obtained. The voxel coordinates of each voxel in the voxel cube can be converted into the world coordinates in the world coordinate system using the first coordinate conversion formula. Then, according to the second coordinate conversion formula of the world coordinate system and the camera coordinate system, the world coordinates corresponding to each voxel in the voxel cube are converted into the camera coordinates in the camera coordinate system. Then, according to the camera coordinates, the voxels that need to be displayed in the camera plane of the voxel cube are determined to obtain the camera image. Finally, the camera image is scaled to obtain the display image displayed on the display interface. That is, if the target pixel point of the display image is marked, each voxel in the voxel cube needs to be converted to the above coordinates, which is large in calculation and takes a long time to calculate, which makes the real-time display of the display image unable to meet user needs. In addition, the inventors also found that when processing an image of a voxel cube of size 512*512*134, the computing time required to obtain a certain layer thereof is more than 3000ms, which greatly affects the real-time display of the displayed image.
[0070] In view of the above problems, an embodiment of the present application provides a coordinate registration method for medical images. First, four positioning points of the displayed image and the voxel coordinates of the four positioning points in the voxel coordinate system are obtained. The coordinate axis direction with the fastest voxel coordinate change rate among the four positioning points is taken as the first direction, the coordinate axis direction with the slowest voxel coordinate change rate among the four positioning points is taken as the third direction, and the coordinate axis direction with the second highest voxel coordinate change rate among the four positioning points is taken as the second direction. Linear scanning is performed in the first direction and the second direction to obtain the coordinate value of the coordinate axis corresponding to the pixel point in the first direction, and the coordinate value of the coordinate axis corresponding to the second direction. Differential calculation is performed in the third direction to obtain the coordinate value of the coordinate axis corresponding to the pixel point in the third direction. These three coordinate values are combined to obtain the voxel coordinates of multiple pixels in the displayed image in the voxel cube. Therefore, the embodiment of the present application only needs to determine four positioning points, and then the coordinates of the pixel points of the displayed image in the voxel coordinate system can be obtained through linear scanning or differential calculation to achieve coordinate alignment. There is no need to traverse the voxels of the entire voxel cube for coordinate conversion, nor is there any need to perform complex matrix multiplication and / or vector multiplication operations. This helps to reduce the computational workload and reduce the computational time. Further, it improves the real-time display of medical images on the display interface, so that the real-time display of medical images on the display interface meets user needs and improves user experience.
[0071] In order to enable those skilled in the art to better understand a coordinate registration method for a medical image provided in an embodiment of the present application, the professional terms involved in the embodiment of the present application are first introduced.
[0072] Voxel cube: a three-dimensional space structure composed of multiple voxels. Voxel, also known as volume element, is the smallest unit of image data in three-dimensional space. In the embodiment of the present application, the voxel cube is a cubic structure formed by stacking multiple layers of medical image data. The camera image is the image obtained by projecting the voxel cube onto the current camera plane.
[0073] Voxel coordinate system: a three-dimensional rectangular coordinate system that describes the position of voxels in three-dimensional space. In the embodiment of the present application, the voxel coordinate system takes the center of the voxel as the origin, and the directions of the three perpendicular sides of the voxel as the three coordinate axes of the voxel coordinate system. For the convenience of description, the three coordinate axes of the voxel coordinate system are respectively called the X1 axis, the Y1 axis, and the Z1 axis. In the embodiment of the present application, the voxel coordinate system is used to describe the three-dimensional medical images of medical images.
[0074] World coordinate system: also known as the cosmic coordinate system or global coordinate system. It is used to describe the position of a point in the display world. Before the user coordinate system is established, the coordinates of all points on the screen captured by the camera are determined by the origin of the world coordinate system. The three mutually perpendicular coordinate axes of the world coordinate system are defined as the X2 axis, the Y2 axis, and the Z2 axis. The X2 axis is the horizontal axis of the real world, and the Z2 axis is the vertical axis of the real world. The Y2 axis is the horizontal axis perpendicular to the X2 axis.
[0075] Camera coordinate system: A three-dimensional rectangular coordinate system with the camera's focal center (i.e., intersection) as the origin and the camera's optical axis as the Z3 axis. The X3 and Y3 axes of the camera coordinate system are parallel to the image's x-axis and y-axis.
[0076] Attached Figure 1 A schematic diagram of an image of a voxel cube provided in an embodiment of the present application. The voxel cube also shows a voxel coordinate system and a camera coordinate system. In the embodiment of the present application, the Z1 axis of the voxel coordinate system is in the same direction as the Y3 axis of the camera coordinate system, the Y1 axis of the voxel coordinate system is in the same direction as the X3 axis of the camera coordinate system, and the X1 axis of the voxel coordinate system is in the same direction as the Z3 axis of the camera coordinate system.
[0077] The following introduces different embodiments to introduce specific implementation methods of the embodiments of the present application.
[0078] In the embodiment of the present application, the executor of the coordinate registration method is an electronic device with medical image processing capability, which may be a server or a terminal device with processing capability, such as a laptop computer.
[0079] Embodiment 1
[0080] Attached Figure 2 A flow chart of a coordinate registration method for medical images provided in an embodiment of the present application. The method comprises the following steps:
[0081] S210: Acquire four positioning points of the display image and the voxel coordinates of the four positioning points in the voxel coordinate system.
[0082] The displayed image is the display image of the two-dimensional medical image of the target voxel cube in the current camera plane on the display interface. The target voxel cube is a cube stacked with multiple layers of image data to be processed. Multiple layers of medical image data refer to two-dimensional image slices acquired by medical imaging equipment at different depths and directions inside the user's body, such as two-dimensional image slices acquired in the cross section, two-dimensional image slices acquired in the coronal plane, and two-dimensional image slices acquired in the sagittal plane. The electronic device stacks multiple layers of medical image data into a target voxel cube to reshape the three-dimensional structure inside the user's body.
[0083] In the embodiment of the present application, the displayed image is a rectangular area image, and the four vertices of the rectangle are the four positioning points. That is, in the embodiment of the present application, the four positioning points include the first positioning point, the second positioning point, the third positioning point and the fourth positioning point, respectively, wherein the first positioning point and the second positioning point and the fourth positioning point are adjacent vertices, and the first positioning point and the third positioning point are diagonal vertices. Figure 3 A schematic diagram of a display image of a target voxel cube provided in an embodiment of the present application, wherein the display image is a rectangular area composed of vertices TL, TR, BR and BL. TL is the first positioning point, TR is the second positioning point, BR is the third positioning point, and BL is the fourth positioning point.
[0084] The voxel coordinates of the four positioning points in the voxel coordinate system can be obtained in the following manner: the electronic device obtains the world coordinates of the four positioning points in the world coordinate system, and the electronic device uses the first coordinate conversion formula between the world coordinate system and the voxel coordinate system to obtain the voxel coordinates of the four positioning points. Specifically, the first coordinate conversion formula is: In the embodiment of the present application, the electronic device can first obtain the first offset vector T and the first rotation matrix R of the voxel coordinate system and the world coordinate system, and obtain the coordinate conversion formula:
[0085] (X2, Y2, Z2)=(X1, Y1, Z1)*R+T (1)
[0086] Where (X2, Y2, Z2) are the coordinates of the world coordinate system. The world coordinate system includes the X2 axis, the Y2 axis, and the Z2 axis. (X1, Y1, Z1) are the coordinates of the voxel coordinate system. R is a 3×3 rotation matrix. To ensure that the volume of the target voxel cube remains unchanged during the rotation, the determinant value of R is 1. T is a three-dimensional vector.
[0087] The electronic device brings the world coordinates of the four positioning points into the above coordinate conversion formula (1), and can obtain the voxel coordinates of the four positioning points by calculation.
[0088] In addition, the embodiment of the present application can also obtain the voxel coordinates of the four positioning points by other means, such as using the automatic tracking function of the display device where the display interface is located to track the coordinates of the four positioning points in the display image, which is not specifically limited by the embodiment of the present application.
[0089] S220: Determine a first direction, a second direction, and a third direction according to the voxel coordinates of the four positioning points.
[0090] In the embodiment of the present application, the first direction is the coordinate axis direction of the voxel coordinate change rate of the four positioning points at the first change rate, the second direction is the coordinate axis direction of the voxel coordinate change rate of the four positioning points at the second change rate, and the third direction is the coordinate axis direction of the voxel coordinate change rate of the four positioning points at the third change rate. Among them, the first change rate is greater than or equal to the second change rate, and the second change rate is greater than or equal to the third change rate. For example, the voxel coordinate change rate of the four positioning points in the X1 axis direction of the voxel coordinate system is Dx, the voxel coordinate change rate in the Y1 axis direction of the voxel coordinate system is Dy, and the voxel coordinate change rate in the Z1 axis direction of the voxel coordinate system is Dz. If Dz>Dy>Dx, then the first change rate is Dz, the second change rate is Dy, and the third change rate is Dz. The first direction is the Z1 axis direction, the second direction is the Y1 axis direction, and the third direction is the X1 axis direction.
[0091] The voxel coordinate change rate of the four positioning points in the X1 axis direction refers to the difference between the maximum coordinate value and the minimum coordinate value of the four positioning points in the X1 axis direction. The voxel coordinate change rate of the four positioning points in the Y1 axis direction refers to the difference between the maximum coordinate value and the minimum coordinate value of the four positioning points in the Y1 axis direction. The voxel coordinate change rate of the four positioning points in the Z1 axis direction refers to the difference between the maximum coordinate value and the minimum coordinate value of the four positioning points in the Z1 axis direction. For example, for Figure 3 As shown, if the voxel coordinates of the four positioning points are TL (i1, j1, z1), TR (i2, j2, z2), BR (i3, j3, z3) and BL (i4, j4, z4), the maximum coordinate value in the X1 axis direction is i3, the minimum coordinate value is i1, the maximum coordinate value in the Y1 axis direction is j3, the minimum coordinate value is j1, the maximum coordinate value in the Z1 axis direction is z3, the minimum value is z1, then Dx = i3-i1, Dy = j3-j1, Dz = z3-z1.
[0092] In one example, the electronic device can calculate the coordinate change rate of each two positioning points in the three coordinate axis directions of the voxel coordinate system based on the voxel coordinates of the four positioning points. For example, the coordinate change rate of TL and RT in the three coordinate axis directions is (|i2-i1|, |j2-j1|, |z2-z1|). The coordinate change rate of TL and BR in the three coordinate axis directions is (|i4-i1|, |j4-j1|, |z4-z1|). The coordinate change rate of RT and BR in the three coordinate axis directions is (|i2-i3|, |j2-j3|, |z2-z3|). The coordinate change rate of BT and BR in the three coordinate axis directions is (|i4-i3|, |j4-j3|, |z4-z3|). The electronic device obtains the maximum coordinate change rate Dx in the X1 coordinate axis direction, the maximum coordinate change rate Dy in the Y1 coordinate axis direction, and the maximum coordinate change rate Dz in the Z1 coordinate axis direction. The electronic device uses the largest value among Dx, Dy and Dz as the first change rate, the coordinate axis direction corresponding to the first change rate as the first direction, the smallest value as the second change rate, the coordinate axis direction corresponding to the second change rate as the third direction, the intermediate value as the second change rate, and the coordinate axis direction corresponding to the second change rate as the second direction. Exemplary description: If Dx>Dy>Dz, the first direction is the X1 coordinate axis direction, the second direction is the Y1 coordinate axis direction, and the third direction is the Z1 coordinate axis direction.
[0093] In another example, the electronic device calculates the coordinate change rates of TL and BR in the three coordinate axis directions (|i3-i1|, |j3-j1|, |z3-z1|), wherein the maximum coordinate change rate Dx=|i3-i1| in the X1 coordinate axis direction, the maximum coordinate change rate Dy=|j3-j1| in the Y1 coordinate axis direction, and the maximum coordinate change rate Dz=|z3-z1| in the Z1 coordinate axis direction. The electronic device uses the largest value among Dx, Dy and Dz as the first change rate, the coordinate axis direction corresponding to the first change rate as the first direction, the smallest value as the second change rate, the coordinate axis direction corresponding to the second change rate as the third direction, the intermediate value as the second change rate, and the coordinate axis direction corresponding to the second change rate as the second direction. Exemplary description: If Dx>Dy>Dz, the first direction is the X1 coordinate axis direction, the second direction is the Y1 coordinate axis direction, and the third direction is the Z1 coordinate axis direction.
[0094] In addition, the same situation may exist in Dx, Dy and Dz. In one case, the two maximum coordinate change rates with higher change rates are the same, and the electronic device uses any one of the coordinate axis directions corresponding to the two maximum coordinate change rates with higher change rates as the first direction, and the other coordinate axis direction as the second direction. For example, if Dx=Dy>Dz, the first direction can be the X1 coordinate axis direction or the Y1 coordinate axis direction.
[0095] In another case, if the two maximum coordinate change rates with lower change rates are the same, the electronic device uses the coordinate axis direction corresponding to the maximum coordinate change rate with the highest change rate as the first direction, and any one of the coordinate axis directions corresponding to the two maximum coordinate change rates with lower change rates as the second direction, and the other as the third direction. For example, if Dx>Dy=Dz, the first direction is the X1 coordinate axis direction, and the second direction can be the Y1 coordinate axis direction or the Z1 coordinate axis direction, which can be adjusted according to needs.
[0096] In another case, when the three maximum coordinate change rates are the same, one of the coordinate axes is arbitrarily selected as the first direction, another coordinate axis is arbitrarily selected as the second direction, and the last coordinate axis is the third direction. For example, the first direction is the X1 coordinate axis direction, the second direction is the Y1 coordinate axis direction, and the third direction is the Z1 coordinate axis direction.
[0097] The purpose of determining the first direction, the second direction and the third direction in the embodiment of the present application is to perform a linear scan on the first direction and the second direction where the voxel coordinates change at the fastest rate to obtain the coordinate values in the voxel coordinate system, and to perform a differential calculation on the third direction where the voxel coordinates change at the slowest rate to obtain the coordinate values in the voxel coordinate system.
[0098] S230: Obtain coordinate values of pixel points in the displayed image on the first coordinate axis and coordinates on the second coordinate axis by performing linear scanning in the first direction and the second direction.
[0099] In the embodiment of the present application, the coordinate value of the first coordinate axis refers to the coordinate value of the coordinate axis corresponding to the first direction, the coordinate value of the second coordinate axis refers to the coordinate value of the coordinate axis corresponding to the second direction, and the coordinate value of the third coordinate axis refers to the coordinate value of the coordinate axis corresponding to the third direction. For example, the coordinate axis corresponding to the first direction is the Y1 coordinate axis, the coordinate axis corresponding to the second direction is the Z1 coordinate axis, and the coordinate axis corresponding to the third direction is the X1 coordinate axis. Then the coordinate value a1 of the first coordinate axis is the value of the Y1 coordinate axis, the coordinate value b1 of the second coordinate axis is the value of the Z1 coordinate axis, and the coordinate value c1 of the third coordinate axis is the value of the X1 coordinate axis, then the coordinates of the pixel point in the voxel coordinate system are (c1, a1, b1).
[0100] The electronic device can obtain the coordinate value of the pixel point on the first coordinate axis and the coordinate value on the second coordinate axis by performing linear scanning in the first direction and the second direction. Specifically, the electronic device performs linear scanning on the displayed image along the linear direction of the scanning line based on the scanning step length, and obtains the coordinate value of the voxel located in the displayed image on each scanning line on the first coordinate axis and the coordinate value of the voxel on the second coordinate axis. Figure 4AA schematic diagram of a linear scan provided in an embodiment of the present application. That is, a linear scan is performed line by line along a first direction and a second direction. Figure 4A Three line scans are shown.
[0101] It can be understood that linear scanning is to obtain the coordinate values of the pixels of the displayed image on the first coordinate axis and the coordinates on the second coordinate axis by translation. The operations involved in translation are addition and subtraction operations. Compared with the calculation of the coordinate conversion formula, the calculation workload of obtaining the voxel coordinate value is significantly reduced, and the calculation time is reduced.
[0102] The scanning interval refers to the distance between scanning lines. In the embodiment of the present application, the scanning interval is a preset value, for example, the scanning interval is 1. The straight line direction refers to the direction in which the scanning line is located. In the embodiment of the present application, the straight line direction can be preset, for example, the straight line direction is preset to be parallel to the first direction, or the straight line direction is parallel to the second direction.
[0103] Furthermore, in order to ensure that as many pixels of the displayed image as possible are scanned and the coordinates of as many pixels as possible in the voxel coordinate system are obtained, in an embodiment of the present application, the direction of the straight line can be the direction from the first positioning point to the second positioning point, or the direction from the first positioning point to the fourth positioning point.
[0104] Furthermore, to avoid scanning points outside the displayed image, the electronic device starts scanning from the first positioning point and ends scanning at the fourth positioning point.
[0105] Furthermore, the electronic device may use the Bresenham algorithm to perform linear scanning in the first direction and the second direction. The characteristics of the Bresenham algorithm are utilized to ensure that the drawn straight line is as close as possible to the mathematical straight line, determine the accuracy of the linear scanning, and do not generate any redundant points, that is, do not repeatedly draw the same voxel, thereby helping to improve drawing efficiency.
[0106] The embodiment of the present application may also use other methods to perform linear scanning, which is not specifically limited in the embodiment of the present application.
[0107] To sum up, since the rate of change of the first coordinate axis direction and the second coordinate axis direction is relatively fast, that is, the scanning lines are closely adjacent to each other, it is possible to avoid empty voxels between the scanning lines, thereby improving the accuracy of obtaining the coordinate values of the first coordinate axis and the second coordinate axis through straight line scanning.
[0108] S240: Obtaining coordinates of the pixel points of the displayed image on the third coordinate axis by performing differential calculation on the coordinate axis of the third direction.
[0109] The coordinate of the third coordinate axis refers to the value of the coordinate axis corresponding to the third change rate. For example, if the coordinate axis corresponding to the third change rate is the X1 coordinate axis, then the coordinate of the third coordinate axis is the value of the X1 coordinate axis.
[0110] Differential calculation refers to the operation of calculating the difference between two pixels. In the embodiment of the present application, any two pixels in the displayed image are obtained, specifically the first pixel k and the second pixel k+1, where the coordinates of k on the first coordinate axis, the second coordinate axis and the third coordinate axis are (x k ,y k , z k ), the coordinates of k+1 on the first coordinate axis, the second coordinate axis, and the third coordinate axis are (x k+1 ,y k+1 , z k+1 ). Among them, z k+1 The coordinates of the third coordinate axis to be solved are as follows. In the embodiment of the present application, the coordinates of the pixel point on the third coordinate axis can be obtained in the following manner.
[0111] Step 1: Obtain a first coordinate difference between a first pixel point and a second pixel point on a first coordinate axis, and a second coordinate difference between a first pixel point and a second pixel point on a second coordinate axis.
[0112] That is, the first coordinate difference Δx = x k+1 -x k , the second coordinate difference is Δy=y k+1 -y k .
[0113] Step 2: Get the target parameter value.
[0114] The target parameter value is the sum of the product of the first coordinate difference and the first component of the unit normal vector of the current camera plane, and the product of the second coordinate difference and the second component of the unit normal vector of the current camera plane. For example, the plane equation of the current camera plane is: Ax+By+Cz+D=0. The unit normal vector is<A,B,C> , The value of is 1. Then the target parameter value is: AΔx+BΔy.
[0115] Step 3: According to the preset constraint equation, determine the coordinate value of the second pixel point on the third coordinate axis.
[0116] The electronic device pre-sets a constraint equation, and the specific constraint equation is that the absolute value of the sum of the target change amount and the target parameter value is less than a first preset value, and the target change amount is the product of the difference equation of the first pixel point and the second pixel point on the third coordinate axis and the third component of the unit normal vector of the current camera plane. For example, for the example shown in step 2, the target change amount is CΔz, where Δz=z k+1 -z k, then the constraint equation is |AΔx+BΔy+CΔz|<m, where m is a preset value, such as 0.5, 0.6, etc.
[0117] Therefore, according to the constraint equation, and z k The value of can simplify complex calculations, thus helping to improve the running speed and obtain z k+1 efficiency.
[0118] The constraint equation is analyzed below, taking m as 0.5 as an example:
[0119] The distance formula from the known point k to the current camera plane is:
[0120]
[0121] Then the distance formula from point k+1 to the current camera plane is:
[0122]
[0123] From the above formula, we can get the difference equation between point k+1 and point k:
[0124]
[0125] in<A,B,C> is the index coordinate normal vector of the plane.
[0126] Among them, the unit normal vector<A,B,C> The length of is 1, that is The value of is 1. Then Δd=d k+1 -d k =|AΔx+BΔy+CΔz|. Since the length of the unit normal vector is 1, the point where the voxel Δd is less than 0.5 is on the tangent plane, that is, |AΔx+BΔy+CΔz|<0.5.
[0127] That is, the embodiment of the present application can ensure the acquisition of z by using the constraint equation while ensuring the improvement of the running speed and acquisition efficiency. k+1 In addition, since the third coordinate axis is the axis with the slowest voxel coordinate change rate, there will be repeated points in the direction of the third coordinate axis. Figure 4B A schematic diagram of a method for providing ... Figure 4B The first direction is called the X direction, the second direction is called the Y direction, and the third direction is called the Z direction. When a linear scan is performed in the XY direction, there will be repeated coordinates in the Z direction. For example, the columns corresponding to "7", "5" and "2" include two points, and the coordinates of these two points in the third direction are repeated. Using differential calculation can effectively avoid the influence of repeated coordinates, thereby further improving the accuracy of coordinate registration of medical images.
[0128] It should be noted that in the embodiment of the present application, steps S230 and S240 may be executed simultaneously, or S230 may be executed first and then S240, or S240 may be executed first and then S230, which is not specifically limited in the embodiment of the present application.
[0129] S250: Combining all the acquired coordinates of the first coordinate axis, the second coordinate axis, and the third coordinate axis to obtain voxel coordinates of a plurality of pixel points of the display image in the voxel cube.
[0130] For example, the coordinate values of all the first coordinate axes and the coordinate values of the second coordinate axes are obtained as (X (1) , Y (1) ), (X (2) , Y (2) ) and (X (3) , Y (3) ), the coordinate of the third coordinate axis is Z (1) , Z (2) and Z (3) Combining the correspondence between the first coordinate axis, the second coordinate axis and the third coordinate axis and the coordinate axis in the voxel coordinate system, all points are combined. For example, the first coordinate axis is the X1 coordinate axis in the voxel coordinate system, the second coordinate axis is the X2 coordinate axis in the voxel coordinate system, and the third coordinate axis is the Z1 coordinate axis in the voxel coordinate system. Then, the voxel coordinates of the multiple pixel points of the displayed image in the voxel cube are (X (1) , Y (1) , Z (1) ), (X (1) , Y (1) , Z (2) ), (X (1) , Y (1) , Z (3) ), (X (2) , Y (2) , Z (1) ), (X (2) , Y (2) , Z (2) ), (X (2) , Y (2) , Z (3) ), (X (3) , Y (3) , Z (1) ), (X (3) , Y (1) , Z (2) ), (X (3) , Y (3) , Z (3) ).
[0131] In summary, the embodiment of the present application first obtains the four positioning points of the displayed image and the voxel coordinates of the four positioning points in the voxel coordinate system. The coordinate axis direction with the fastest voxel coordinate change rate among the four positioning points is taken as the first direction, the coordinate axis direction with the slowest voxel coordinate change rate among the four positioning points is taken as the third direction, and the coordinate axis direction with the second highest voxel coordinate change rate among the four positioning points is taken as the second direction. A linear scan is performed in the first direction and the second direction to obtain the coordinate value of the coordinate axis corresponding to the pixel point in the first direction, and the coordinate value of the coordinate axis corresponding to the second direction. A differential calculation is performed in the third direction to obtain the coordinate value of the coordinate axis corresponding to the pixel point in the third direction, and these three coordinate values are combined to obtain the voxel coordinates of multiple pixel points in the displayed image in the voxel cube. Therefore, the embodiment of the present application only needs to determine four positioning points, and then the coordinates of the pixel points of the display image in the voxel coordinate system can be obtained by linear scanning or differential calculation to achieve coordinate registration. It is not necessary to traverse the voxels of the entire voxel cube for coordinate conversion, nor is it necessary to perform complex matrix multiplication and / or vector multiplication operations, so it helps to reduce the computational workload and reduce the computational time, thereby helping to improve the real-time display of medical images on the display interface, so that the real-time display of medical images on the display interface meets user needs and improves user experience. In addition, for the coordinate values of the blocks whose coordinate change rates are compared, a linear scanning method is adopted, and the scanning lines will be closely adjacent, further avoiding the existence of empty voxels between the scanning lines. Therefore, the embodiment of the present application further solves the technical problem of low coordinate matching accuracy due to the existence of empty voxels. In addition, the coordinate change rate of the third direction is relatively slow, and there will be repeated voxel points. The embodiment of the present application adopts differential calculation between different pixels, and the voxel coordinates of one pixel point are inferred from the voxel coordinates of another pixel point, thereby avoiding the influence of repeated voxel points on coordinate registration, and further improving the accuracy of coordinate registration.
[0132] Embodiment 2
[0133] To further improve the registration accuracy and efficiency, the embodiment of the present application changes the method of obtaining four positioning points and the voxel coordinates of the four positioning points in Embodiment 1, that is, the four positioning points and the voxel coordinates of the four positioning points are obtained through the eight vertices of the target voxel cube.
[0134] Attached Figure 5 A flowchart of a coordinate registration method for a medical image provided in an embodiment of the present application, the method comprising the following steps:
[0135] S510: Obtain voxel coordinate values of each vertex of the target voxel cube.
[0136] The target voxel cube includes multiple voxels. Voxel is the smallest unit of three-dimensional space segmentation, and voxel is also called voxel element. The number of voxels is related to the number of pixels of each two-dimensional image slice in the target voxel cube and the number of layers (i.e., the number of sheets or frames) of multi-layer medical imaging data. The number of pixels of each two-dimensional image slice is the height (i.e., the number of rows) × width (i.e., the number of columns) of the two-dimensional image slice. The number of layers of multi-layer medical imaging data refers to the total number of two-dimensional image slices that make up the target voxel cube. Exemplarily, if the width of each two-dimensional image slice is w, the height is h, and the number of layers of multi-layer medical imaging data is d, then the number of voxels in the target voxel cube is (w-1)×(h-1)×(d-1).
[0137] The target voxel cube includes 8 vertices, specifically A1, A2, ..., A8. The 8 vertices are used to define the boundary of the target voxel cube. It can be understood that according to the 8 vertices of the target voxel cube, it is possible to determine which voxels do not belong to the target voxel cube and which voxels belong to the target voxel cube.
[0138] In an embodiment of the present application, the electronic device can use any vertex of the target voxel cube as the origin of the voxel coordinate system, the height direction of the two-dimensional image slice as the X1 axis direction of the voxel coordinate system, the width direction of the two-dimensional image slice as the Y1 axis direction of the voxel coordinate system, and the number of layers as the Z1 axis direction of the voxel coordinate system. For example, the origin of the voxel cube is A1 (0, 0, 0), the direction from A1 to A2 is used as the X1 axis direction of the voxel coordinate system, the direction from A1 to A3 is used as the Y1 axis direction of the voxel coordinate system, and the direction from A1 to A5 is used as the Z1 axis direction of the voxel coordinate system. When the width of each two-dimensional image slice in the target voxel cube is w, the height is h, and the number of layers of multi-layer medical imaging data is d, A1 (0, 0, 0), A2 (w-1, 0, 0), A3 (0, h-1, 0), A4 (w-1, h-1, 0), A5 (0, 0, d-1), A6 (w-1, 0, d-1), A7 (0, h-1, d-1) and A8 (w-1, h-1, d-1).
[0139] S520: Obtain the world coordinates of each vertex of the target voxel cube.
[0140] The world coordinates of each vertex refer to the coordinates of each vertex in the world coordinate system. Since the camera is usually defined in the world coordinate system, for example, the position, orientation and internal parameters of the camera (such as focal length, principal point, etc.) are all based on the world coordinate system, so in order to obtain the projection of the target voxel cube on the camera plane, it is necessary to obtain the coordinates of the target voxel cube in the world coordinate system. In an embodiment of the present application, the electronic device obtains the world coordinates of each vertex in the target voxel cube. Thus, the electronic device can determine the execution equation of the target voxel cube in the world coordinate system according to each vertex, and use these straight line equations to combine with the camera plane equation to obtain the projection of the target voxel cube on the camera plane.
[0141] Substitute the voxel coordinates of each vertex in the target voxel cube into the coordinate transformation formula (1) to obtain the world coordinates of each vertex.
[0142] Exemplary explanation: If the voxel coordinates of the vertices of the target voxel cube are A1(0, 0, 0), A2(w-1, 0, 0), A3(0, h-1, 0), A4(w-1, h-1, 0), A5(0, 0, d-1), A6(w-1, 0, d-1), A7(0, h-1, d-1) and A8(w-1, h-1, d-1). The voxel coordinate system is rotated 90° around the z axis to obtain the world coordinate system.
[0143] That is, the rotation matrix The offset vector is T = [0, 0, 0]
[0144] Substituting the rotation matrix R, the offset vector T and the voxel coordinates of each vertex into the coordinate transformation formula (1), we can obtain the coordinates of each vertex in the world coordinate system, namely A1 (0, 0, 0), A2 (0, 1-w, 0), A3 (h-1, 0, 0), A4 (h-1, 1-w, 0), A5 (0, 0, d-1), A6 (0, 1-w, d-1), A7 (h-1, 0, d-1) and A8 (h-1, 1-w, d-1).
[0145] S530: Obtain straight line equations of the eight vertices of the target voxel cube in the world coordinate system.
[0146] The eight vertices of the target voxel cube form 12 straight lines, which are the 12 border lines of the target voxel cube. In the embodiment of the present application, the straight line equation of each of the 12 border lines follows the following parametric equation:
[0147]
[0148] Among them, x0 indicates the coordinate of the known point on the straight line in the X2-axis direction. For example, for the straight line composed of A1 and A2, x0 can be the coordinate 0 of A1 in the X2-axis direction, or the coordinate 0 of A2 in the X2-axis direction. For example, for the straight line composed of A1 and A3, x0 can be the coordinate 0 of A1 in the X2-axis direction, or the coordinate h-1 of A3 in the X2-axis direction.
[0149] y0 indicates the coordinate of a known point on the line in the Y2 direction. For example, for the line formed by A1 and A2, y0 can be the coordinate 0 of A1 in the Y2 direction, or the coordinate 1-w of A2 in the Y2 direction. For example, for the line formed by A1 and A3, x0 can be the coordinate 0 of A1 in the Y2 direction, or the coordinate 0 of A3 in the Y2 direction.
[0150] z0 indicates the coordinate of a known point on the line equation in the Z2 axis direction. For example, for a line formed by A1 and A2, z0 can be the coordinate of A1 in the Z2 axis direction, or the coordinate of A2 in the Z2 axis direction. For example, for a line formed by A1 and A3, x0 can be the coordinate 0 of A1 in the Z2 axis direction, or the coordinate 0 of A3 in the Z2 axis direction.
[0151] <m,n,p> is the direction vector of the line, that is, the difference between the two vertices of each edge. For example, for the line formed by A1 and A2,<m,n,p> = <0, w-1, 0>. For example, for the straight line formed by A1 and A3,<m,n,p> =<h-1,0,0> .
[0152] Thus, the electronic device can obtain the linear equations of the 12 border lines according to the world coordinates of the 8 vertices in the target voxel cube. It can be understood that the linear equation is a t-related function. The value of t is determined, and the point on the linear equation is determined. Therefore, the key to determining the world coordinates of the point on each border line is to determine the value of t in the linear equation corresponding to each border line.
[0153] S540: Calculate the coordinates of the intersection between the target voxel cube and the current camera plane.
[0154] In an embodiment of the present application, in order to obtain a projection image of a target voxel cube on a current camera plane, the electronic device may first determine the intersection of the target voxel cube and the current camera plane. The intersection of the target voxel cube and the current camera plane and the coordinates of the intersection are determined by the position and direction of the current camera plane. Specifically, according to the position and direction of the current camera plane, the number of intersections between the target voxel cube and the current camera plane may be 4, 3, 5, 6, etc.
[0155] Exemplary explanation: If the current camera plane is parallel to two opposite faces in the target voxel cube and intersects with other faces, then the number of intersection points between the target voxel cube and the current camera plane is 4, and the polygon formed by these four intersection points is a rectangle, which is the display image displayed on the display interface. Figure 6 A schematic diagram of an intersection point set provided in an embodiment of the present application, wherein the number of intersection points between the camera plane 301 and the target voxel cube 302 is 4, namely P0, P1, P2 and P3.
[0156] If there is no surface in the target voxel cube that is parallel to the current camera plane, the number of intersections between the target voxel cube and the current camera plane may be 5 or 3, etc., which is not specifically limited in the present embodiment. Figure 3 The number of intersection points between the current camera plane 301 and the target voxel cube 302 is 5, namely P0, P1, P2, P3 and P4.
[0157] The intersection coordinates of the target voxel cube and the current camera plane refer to the world coordinates of the intersection of the target voxel cube and the current camera plane in the world coordinate system. The following takes the equation of the current camera plane as Ax+By+Cz+D=0 as an example to describe in detail how to obtain the intersection coordinates.
[0158] It should be noted that for Ax+By+Cz+D=0,<A,B,C> is the normal vector of the current camera plane, that is, the camera normal vector of the current camera. The camera normal vector of the current camera is obtained through the camera intrinsic parameters and camera attitude of the current camera. The camera intrinsic parameters describe the mapping relationship between the camera coordinate system and the image coordinate system, including focal length, principal point, and distortion coefficient. The camera attitude describes the position and orientation of the camera in the world coordinate system, which is expressed by a rotation matrix and a translation vector. The parameter D can be calculated based on the camera normal vector and camera focus of the current camera.
[0159] Since the coordinates of the intersection of the current camera plane and the border line of the target voxel cube are located on the straight line where the border line is located, and are located on the plane of the current camera, that is, the coordinates of the intersection satisfy the equation of the straight line and the plane of the current camera, the coordinates of the intersection can be calculated by combining the equation of the straight line and the equation of the current camera plane. Assuming that the equation of the straight line is as shown in formula (2), the value of t obtained by combining formula (2) and Ax+By+Cz+D=0 is
[0160]
[0161] Substituting the value of t into the equation can obtain the coordinates of the intersection point.
[0162] In the embodiment of the present application, some intersections may be inside the target voxel cube, and some intersections may be outside the target voxel cube. There is no way to display the intersections outside the target voxel cube in the display interface. Therefore, in order to ensure that the rectangular image area of the display image is accurately obtained, the world coordinates of the eight vertices and the intersection coordinates are used to determine whether the intersection is inside the target voxel cube. For the intersections that are not inside the target voxel cube, they are removed and no subsequent processing is performed.
[0163] S550: Determine four positioning points of the displayed image and the world coordinates of the four positioning points according to the intersection coordinates.
[0164] Since the projection of the target voxel cube on the current camera plane, that is, the camera projection image of the current camera may be a rectangle, or it may be a triangle, a pentagon or a hexagon, therefore, in order to make the camera projection image of the current camera can be normally displayed on the display interface, the electronic device needs to process the camera projection image of the current camera so that the processed camera projection image is a display image. In an embodiment of the present application, the electronic device obtains the circumscribed rectangle of the camera projection image, and the circumscribed rectangle is the display image. The four positioning points of the circumscribed rectangle are the four positioning points of the target image. The four positioning points are the first positioning point, the second positioning point, the third point location and the fourth positioning point, respectively, wherein the first positioning point is adjacent to the second positioning point and the fourth positioning point, and the second positioning point is adjacent to the third positioning point.
[0165] Exemplary description: As attached Figure 6 The intersection point set shown in the figure, the target image is a rectangle composed of P0, P1, P2 and P3, and the four positioning points are P0 (the first positioning point), P1 (the second positioning point), P2 (the third positioning point) and P3 (the fourth positioning point). Figure 3 As shown, the target image is a rectangle composed of TL, TR, BR and BL. Among them, TL and TR are two adjacent vertices of the circumscribed rectangle, TL and BL are adjacent vertices of the circumscribed rectangle, TR and BR are adjacent vertices of the circumscribed rectangle, BR and BL are adjacent vertices of the circumscribed rectangle, and BR and TL are diagonal vertices of the circumscribed rectangle.
[0166] Example description: Attached Figure 7 A schematic diagram of obtaining a display image provided by an embodiment of the present application. Figure 7 As shown, the positive direction of the Yc axis of the camera 701 is shown by arrow 7001. The positive direction of the Zc axis of the camera 701 is shown by arrow 7002. When the camera 701 illuminates the target voxel cube 302, a display image 702 displayed on the display interface can be obtained. The target voxel cube 302 includes a plurality of voxels, each voxel is a cube, and the attached Figure 7 Voxels located on the camera plane 301 are represented by shaded squares. Figure 7 The number of voxels in the displayed target voxel cube is 7*7*7, that is, the number of rows, columns and layers of the target voxel cube is 8. The displayed image 702 includes four positioning points, namely, the first positioning point is TL, the second positioning point is TR, the third positioning point is BR and the fourth positioning point is BL.
[0167] In the embodiment of the present application, the electronic device can obtain the world coordinates of the four positioning points according to the intersection coordinates. Figure 7 As shown, first obtain the equation of the first straight line where TL and TR are located, determine the equation of the second straight line that is perpendicular to the first straight line equation and passes through P3, and combine the first straight line equation and the second straight line equation to obtain the world coordinates of TR. Similarly, obtain the equation of the third straight line that is parallel to the first straight line equation, and the third straight line equation passes through P4, and combine the third straight line equation and the second straight line equation to obtain the world coordinates of BR. Obtain the equation of the fourth straight line that is perpendicular to the first straight line equation and passes through P0, and combine the fourth straight line equation, the first straight line equation, and the third straight line equation to obtain the world coordinates of TL and BL.
[0168] S560: Determine the voxel coordinates of the four positioning points.
[0169] The voxel coordinates of the four positioning points refer to the voxel coordinates of the four positioning points in the voxel coordinate system. In the embodiment of the present application, the registration of medical image coordinates refers to converting the medical image coordinates into voxels in the same voxel coordinate system for comparison, analysis and fusion. Therefore, in order to understand the voxel corresponding to each pixel in the displayed image, the voxel coordinates of the four positioning points in the voxel coordinate system are first obtained. The four positioning points are the basis for converting the medical image coordinates into voxels in the voxel coordinate system.
[0170] In the embodiment of the present application, the electronic device obtains the voxel coordinates of the four positioning points in the voxel coordinate system based on the world coordinates of the four positioning points and the conversion formula (1) between the world coordinate system and the voxel coordinate system. It should be noted that
[0171] The electronic device uses the conversion formula (1) between the world coordinate system and the voxel coordinate system to directly obtain the coordinate values of the four positioning points in the voxel coordinate system, which may be non-integer values. In this case, the electronic device adjusts the non-integer coordinate values obtained by calculation by rounding, and uses the adjusted coordinate values as the voxel coordinates of the four positioning points.
[0172] S570: Determine a first direction, a second direction, and a third direction.
[0173] S580: Scan the first coordinate axis direction and the second coordinate axis direction line by line to obtain the coordinates of the voxel points of the target voxel cube on the first coordinate axis and the coordinates on the second coordinate axis.
[0174] In the embodiment of the present application, the scanning straight line direction may be the direction corresponding to any one of two adjacent sides in the displayed image. For example, the scanning straight line direction may be the direction from the first positioning point to the second positioning point, or may be the direction from the first positioning point to the fourth positioning point. Figure 3 For the first positioning point TL, the second positioning point TR, the third positioning point BR and the fourth positioning point BL shown, the direction of the scanning line can be the direction from TL to TR, or the direction from TL to BL.
[0175] In addition, the scanning line direction may also be the direction corresponding to the longer side of the two adjacent sides. Specifically, the electronic device may obtain a first vector from the first positioning point to the second positioning point, and a second vector from the first positioning point to the fourth positioning point, determine the vector length of the first vector and the vector length of the second vector, and define the vector direction corresponding to the vector with the shorter vector length as the scanning line direction. By considering the actual distance between the positioning points, the electronic device uses the longer distance as the scanning line direction, which enables the scanning line to cover more voxel points and avoids the presence of a large number of empty voxels during linear scanning, thereby improving the accuracy of the registration.
[0176] In the embodiment of the present application, the scanning step length between scanning lines is 1. If the scanning line direction is the direction from the first positioning point to the second positioning point, the number of scanning lines from the first positioning point to the fourth positioning point is positively correlated with the vector length of the first vector. If the scanning line direction is the direction from the first positioning point to the fourth positioning point, the number of scanning lines from the first positioning point to the second positioning point is positively correlated with the vector length of the second vector. Exemplarily, the vector length is L, and an integer of L is the number of scanning lines.
[0177] The coordinates of the voxels that each scanning line passes through in the first coordinate axis direction and the second coordinate axis direction can be obtained in the following manner: obtain the scanning starting point of each scanning line, and according to the scanning line direction, obtain the coordinates of other voxels of the scanning line in the first coordinate axis and obtain the coordinates of the second coordinate axis in combination with the Bresenham algorithm. In the embodiment of the present application, the Bresenham algorithm is used to ensure that the drawn line is as close to the mathematical line as possible, determine the accuracy of the straight line scanning, and will not generate any redundant points, that is, the same voxel will not be drawn repeatedly, thus helping to improve the drawing efficiency.
[0178] In order to determine the coordinates of the pixel point corresponding to the scanning line of the nth step on the first coordinate axis and the coordinates of the second coordinate axis, determine the vertical vector of the two positioning points perpendicular to the direction of the line, and reduce the vertical vector to obtain a unit vector, wherein the vector length of the unit vector is 1, and the scanning starting point of the scanning line of the nth step is the sum of the coordinate vector corresponding to the first positioning point and n×the unit vector. For example, if the direction of the scanning line is from the first positioning point to the second positioning point, then the scanning starting point of each scanning line is located on the vector from the first positioning point to the fourth positioning point. Among them, for the first scan, the scanning starting point is the first positioning point, for the second scan, the scanning starting point is the coordinate of the first positioning point + unit vector * 1, and for the nth scan, the scanning starting point is the coordinate vector of the first positioning point + unit vector * n. Among them, n is an integer greater than or equal to 1
[0179] Due to the nature of line-by-line scanning, gaps between scan lines are inevitable, but in the embodiment of the present application, since the direction of the scan line is selected based on the actual distance between the positioning points, these gaps will be minimized. In addition, since the scan step size is 1 and the vector length is taken into account to determine the number of scan lines, the voxel points between the scan lines will be covered as evenly as possible.
[0180] S590: Perform differential calculation in the direction of the third coordinate axis to determine the coordinates of the pixel point on the third coordinate axis.
[0181] S5100: Combine all acquired coordinates of the first coordinate axis, the second coordinate axis, and the third coordinate axis to obtain voxel coordinates of a plurality of pixel points of the displayed image in the voxel cube.
[0182] In summary, the embodiment of the present application obtains the intersection of the target voxel cube and the camera plane through the 8 vertices of the target voxel cube, and obtains the circumscribed rectangle formed by the intersection, and the four vertices of the circumscribed rectangle are the four positioning points. By utilizing the characteristic that the displayed image is the circumscribed rectangle of the camera image, the efficiency of obtaining the four positioning points can be simplified and the accuracy of obtaining the four positioning points can be improved, thereby further improving the registration efficiency of the medical image coordinates. The straight line is scanned line by line, and the scanning straight line direction is the direction from the first positioning point to the second positioning point, or the direction from the first positioning point to the fourth positioning point, which can ensure that more pixel points are scanned, thereby helping to further improve the registration accuracy of the medical image coordinates.
[0183] In addition, an embodiment of the present application also provides a coordinate registration device for medical images.
[0184] Attached Figure 8 A schematic diagram of the structure of a coordinate registration device for medical images provided in an embodiment of the present application. The device includes the following contents:
[0185] A positioning point acquisition unit 801 is used to acquire four positioning points of a display image and voxel coordinates of the four positioning points in a voxel coordinate system; the display image is a rectangular image displayed by a camera image on a display interface, the camera image is a projection of a target voxel cube formed by stacking multiple layers of medical images under a current camera plane, and the four positioning points are four vertices of the display image;
[0186] The direction determining unit 802 is used to determine a first direction, a second direction and a third direction according to the voxel coordinates of the four positioning points; the first direction is a coordinate axis direction in which the voxel coordinate change rate of the four positioning points is a first change rate, the second direction is a coordinate axis direction in which the voxel coordinate change rate of the four positioning points is a second change rate, and the third direction is a coordinate axis direction in which the voxel coordinate change rate of the four positioning points is a third change rate, the first change rate is greater than or equal to the second change rate, and the second change rate is greater than or equal to the third change rate;
[0187] A linear scanning unit 803 is used to obtain the coordinate value of the pixel point in the displayed image on the first coordinate axis and the coordinate value of the pixel point on the second coordinate axis by performing linear scanning in the first direction and the second direction; the coordinate value of the first coordinate axis is the coordinate value of the coordinate axis corresponding to the first direction, and the coordinate value of the second coordinate axis is the coordinate value of the coordinate axis corresponding to the second direction;
[0188] The difference calculation unit 804 is used to obtain the coordinate value of the pixel point in the displayed image on the third coordinate axis by performing a difference calculation in the third direction, and the coordinate value of the third coordinate axis is the coordinate value of the coordinate axis corresponding to the third direction;
[0189] The registration unit 805 is used to combine the coordinate values of the coordinate axis corresponding to the first direction, the coordinate values of the coordinate axis corresponding to the second direction, and the coordinate values of the coordinate axis in the third direction to obtain the voxel coordinates of at least one pixel point in the displayed image in the target voxel cube.
[0190] Exemplarily, the four positioning points include a first positioning point, a second positioning point, a third positioning point and a fourth positioning point, the first positioning point and the second positioning point are adjacent vertices, the first positioning point and the fourth positioning point are adjacent vertices, and the first positioning point and the third positioning point are diagonal vertices; the linear scanning unit 803 is specifically used for:
[0191] Determine a straight line direction of the scanning line; the straight line direction includes one of the first positioning point pointing to the second positioning point and the first positioning point pointing to the fourth positioning point;
[0192] According to the straight line direction and the preset scanning step length, a straight line scan is performed in the first direction and the second direction to determine the coordinate value of the pixel point of the displayed image on the first coordinate axis and the coordinate value on the second coordinate axis at each step; the straight line scan starts from the first positioning point and ends at the fourth positioning point.
[0193] Exemplarily, linear scanning is performed in the first direction and the second direction based on the Bresenham algorithm.
[0194] In one example, determining a perpendicular vector of two positioning points perpendicular to the straight line direction;
[0195] The vertical vector is reduced to obtain a unit vector, where the vector length of the unit vector is 1;
[0196] The scanning starting point of the scanning straight line of the nth step is obtained as the sum of the coordinate vector corresponding to the first positioning point and n×the unit vector;
[0197] According to the scanning starting point and the direction of the straight line, the coordinate value of the pixel point of the displayed image in the nth step on the first coordinate axis and the coordinate value on the second coordinate axis are determined; n is an integer greater than or equal to 1.
[0198] Wherein, determining the linear direction of the scanning line includes:
[0199] Obtain a first vector from the second positioning point to the first positioning point, and a second vector from the fourth positioning point to the first positioning point; if the vector length of the first vector is greater than the vector length of the second vector, determine that the linear direction of the scanning line is from the first positioning point to the fourth positioning point; if the vector length of the first vector is less than or equal to the vector length of the second vector, determine that the linear direction of the scanning line is from the first positioning point to the second positioning point.
[0200] The difference calculation unit 804 is specifically used to: obtain a first coordinate difference between a first pixel point and a second pixel point on the first coordinate axis, and obtain a second coordinate difference between the first pixel point and the second pixel point on the second coordinate axis; the first pixel point and the second pixel point are adjacent pixel points in the displayed image, and the coordinate value of the first pixel point on the third coordinate axis is known;
[0201] Acquire a target parameter value, where the target parameter value is a sum of a product of the first coordinate difference value and a first component of a unit normal vector of a current camera plane, and a product of the second coordinate difference value and a second component of a unit normal vector of the current camera plane;
[0202] According to the constraint equation of the first pixel point and the second pixel point, the coordinate value of the second pixel point on the third coordinate axis is determined; the constraint equation is that the absolute value of the sum of the target change amount and the target parameter value is less than a first preset value, and the target change amount is the product of the difference equation of the first pixel point and the second pixel point on the third coordinate axis and the third component of the unit normal vector of the current camera plane.
[0203] In one example, the positioning point acquisition unit 801 is specifically used to: acquire multiple intersection points between the target voxel cube and the current camera plane and intersection coordinate values of the multiple intersection points;
[0204] According to the intersection coordinate values of the multiple intersection points, the four positioning points of the displayed image and the voxel coordinates of the four positioning points in the voxel coordinate system are determined; the four positioning points are the four vertices of the circumscribed polygon formed by the multiple intersection points, and the vertices of the polygon are the multiple intersection points.
[0205] Among them, 8 vertices of the target voxel cube and the voxel coordinate values of the 8 vertices in the voxel coordinate system are obtained; according to the voxel coordinate values of the 8 vertices and the transformation of the voxel coordinate system and the world coordinate system, the world coordinate values of the 8 vertices in the world coordinate system are determined; the equation of the straight line between every two vertices among the 8 vertices is determined; according to the straight line equation between every two vertices and the plane equation of the current camera plane, the multiple intersection points of the target voxel cube and the current camera plane and the intersection coordinate values of the multiple intersection points are determined, and the intersection coordinate values are the world coordinate values of the intersection points in the world coordinate system.
[0206] In another example, the intersection points of the multiple intersection points on the target voxel cube are determined based on the world coordinates of the 8 vertices; the four positioning points of the displayed image and the voxel coordinates of the four positioning points in the voxel coordinate system are determined based on the intersection coordinate values of the multiple intersection points, including: the four positioning points of the displayed image and the voxel coordinates of the four positioning points in the voxel coordinate system are determined based on the intersection coordinate values of the intersection points on the target voxel cube, the four vertices being the four vertices of the circumscribed rectangle of the polygon formed by the intersection points on the target voxel cube.
[0207] In an example, the four positioning points include a first positioning point, a second positioning point, a third positioning point and a fourth positioning point, the first positioning point and the second positioning point are adjacent vertices, the first positioning point and the fourth positioning point are adjacent vertices, and the first positioning point and the third positioning point are diagonal vertices;
[0208] The direction determination unit 802 is specifically used to: determine the positioning vector of the third positioning point and the first positioning point; determine the coordinate axis direction corresponding to the component with the largest absolute value of the components of the positioning vector as the first direction, determine the coordinate axis direction corresponding to the component with the smallest absolute value of the components of the positioning vector as the third direction, and determine the coordinate axis directions corresponding to the remaining components in the positioning vector as the second direction.
[0209] The coordinate registration device of the medical image provided by the embodiment of the present application only needs to determine four positioning points, and then the coordinates of the pixel points of the display image in the voxel coordinate system can be obtained by linear scanning or differential calculation to realize coordinate registration. It is not necessary to traverse the voxels of the entire voxel cube for coordinate conversion, nor is it necessary to perform complex matrix multiplication and / or vector multiplication operations, so it helps to reduce the computational workload and reduce the computational time, thereby helping to improve the real-time display of the medical image on the display interface, so that the real-time display of the medical image on the display interface meets the user's needs and improves the user experience. In addition, for the coordinate values of the blocks whose coordinate change rates are compared, a linear scanning method is adopted, and the scanning lines will be closely adjacent, further avoiding the existence of empty voxels between the scanning lines. Thus, the embodiment of the present application further solves the technical problem of low coordinate registration accuracy due to the existence of empty voxels. In addition, the coordinate change rate of the third direction is relatively slow, and there will be repeated voxel points. The embodiment of the present application adopts differential calculation between different pixels, and the voxel coordinates of one pixel point are inferred from the voxel coordinates of another pixel point, thereby avoiding the influence of repeated voxel points on coordinate registration, and further improving the accuracy of coordinate registration.
[0210] The present application further provides an electronic device, which includes: a memory and a processor. The memory stores a computer program. The processor is used to execute the computer program in the memory to implement some or all of the steps in the coordinate registration method of medical images introduced in the above embodiment.
[0211] The present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements part or all of the steps in the coordinate registration method for medical images introduced in the aforementioned embodiment.
[0212] It should be noted that each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and equipment embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments. The device and equipment embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components indicated as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. A person of ordinary skill in the art can understand and implement it without paying creative labor.
Claims
1. A coordinate registration method for medical images, characterized in that: The method comprises: Acquire four positioning points of a displayed image and the voxel coordinates of the four positioning points in a voxel coordinate system; the displayed image is a rectangular image displayed by a camera image on a display interface, the camera image is a projection of a target voxel cube formed by stacking multiple layers of medical images under a current camera plane, and the four positioning points are four vertices of the displayed image; Determine a first direction, a second direction, and a third direction according to the voxel coordinates of the four positioning points; the first direction is a coordinate axis direction in which the voxel coordinate change rate of the four positioning points is a first change rate, the second direction is a coordinate axis direction in which the voxel coordinate change rate of the four positioning points is a second change rate, and the third direction is a coordinate axis direction in which the voxel coordinate change rate of the four positioning points is a third change rate, the first change rate is greater than or equal to the second change rate, and the second change rate is greater than or equal to the third change rate; By performing linear scanning in the first direction and the second direction, the coordinate values of the pixel points in the displayed image on the first coordinate axis and the coordinate values on the second coordinate axis are obtained; the coordinate values of the first coordinate axis are the coordinate values of the coordinate axis corresponding to the first direction, and the coordinate values of the second coordinate axis are the coordinate values of the coordinate axis corresponding to the second direction; by performing differential calculation in the third direction, the coordinate values of the pixel points in the displayed image on the third coordinate axis are obtained, and the coordinate values of the third coordinate axis are the coordinate values of the coordinate axis corresponding to the third direction; The coordinate values of the coordinate axis corresponding to the first direction, the coordinate values of the coordinate axis corresponding to the second direction, and the coordinate values of the coordinate axis in the third direction are combined to obtain the voxel coordinates of at least one pixel point in the displayed image in the target voxel cube.
2. The method according to claim 1, characterized in that: The four positioning points include a first positioning point, a second positioning point, a third positioning point and a fourth positioning point, the first positioning point and the second positioning point are adjacent vertices, the first positioning point and the fourth positioning point are adjacent vertices, and the first positioning point and the third positioning point are diagonal vertices; Obtaining the coordinate value of the pixel point in the displayed image on the first coordinate axis and the coordinate value on the second coordinate axis by performing linear scanning in the first direction and the second direction, including: Determine a straight line direction of the scanning line; the straight line direction includes one of the first positioning point pointing to the second positioning point and the first positioning point pointing to the fourth positioning point; According to the straight line direction and the preset scanning step length, a straight line scan is performed in the first direction and the second direction to determine the coordinate value of the pixel point of the displayed image on the first coordinate axis and the coordinate value on the second coordinate axis at each step; the straight line scan starts from the first positioning point and ends at the fourth positioning point.
3. The method according to claim 2, characterized in that: The step of determining the coordinate value of the pixel point of the displayed image on the first coordinate axis and the coordinate value of the pixel point on the second coordinate axis at each step includes: Determine the perpendicular vectors of the two positioning points perpendicular to the direction of the straight line; The vertical vector is reduced to obtain a unit vector, where the vector length of the unit vector is 1; The scanning starting point of the scanning straight line of the nth step is obtained as the sum of the coordinate vector corresponding to the first positioning point and n×the unit vector; According to the scanning starting point and the direction of the straight line, the coordinate value of the pixel point of the displayed image in the nth step on the first coordinate axis and the coordinate value on the second coordinate axis are determined; n is an integer greater than or equal to 1.
4. The method according to claim 2, characterized in that: The step of determining the straight line direction of the scanning line comprises: Obtain a first vector from the second positioning point to the first positioning point, and a second vector from the fourth positioning point to the first positioning point; If the vector length of the first vector is greater than the vector length of the second vector, determining that the straight line direction of the scanning line is from the first positioning point to the fourth positioning point; If the vector length of the first vector is less than or equal to the vector length of the second vector, the straight line direction of the scanning line is determined to be from the first positioning point to the second positioning point.
5. The method according to claim 1, characterized in that: The step of obtaining the coordinate value of the pixel point in the displayed image on the third coordinate axis by performing differential calculation in the third direction includes: Obtaining a first coordinate difference between a first pixel point and a second pixel point on the first coordinate axis, and obtaining a second coordinate difference between the first pixel point and the second pixel point on the second coordinate axis; the first pixel point and the second pixel point are adjacent pixel points in the displayed image, and the coordinate value of the first pixel point on the third coordinate axis is known; Acquire a target parameter value, where the target parameter value is a sum of a product of the first coordinate difference value and a first component of a unit normal vector of a current camera plane, and a product of the second coordinate difference value and a second component of a unit normal vector of the current camera plane; According to the constraint equation of the first pixel point and the second pixel point, the coordinate value of the second pixel point on the third coordinate axis is determined; the constraint equation is that the absolute value of the sum of the target change amount and the target parameter value is less than a first preset value, and the target change amount is the product of the difference equation of the first pixel point and the second pixel point on the third coordinate axis and the third component of the unit normal vector of the current camera plane.
6. The method according to claim 1, characterized in that: The step of acquiring four positioning points of the displayed image and voxel coordinates of the four positioning points in a voxel coordinate system includes: Acquire multiple intersection points between the target voxel cube and the current camera plane and intersection coordinate values of the multiple intersection points; According to the intersection coordinate values of the multiple intersection points, the four positioning points of the displayed image and the voxel coordinates of the four positioning points in the voxel coordinate system are determined; the four positioning points are the four vertices of the circumscribed polygon formed by the multiple intersection points, and the vertices of the polygon are the multiple intersection points.
7. The method according to claim 6, characterized in that: The obtaining of a plurality of intersection points between the target voxel cube and the current camera plane and intersection coordinate values of the plurality of intersection points includes: Obtaining eight vertices of the target voxel cube and voxel coordinate values of the eight vertices in the voxel coordinate system; Determine the world coordinate values of the eight vertices in the world coordinate system according to the voxel coordinate values of the eight vertices and the transformation between the voxel coordinate system and the world coordinate system; Determine the equation of a straight line between every two vertices of the eight vertices; According to the straight line equation between each two vertices and the plane equation of the current camera plane, the multiple intersection points of the target voxel cube and the current camera plane and the intersection coordinate values of the multiple intersection points are determined, and the intersection coordinate values are the world coordinate values of the intersection points in the world coordinate system.
8. The method according to claim 7, characterized in that: After obtaining the intersection coordinate values of the plurality of intersection points, the method further includes: Determine, according to the world coordinates of the eight vertices, an intersection point among the plurality of intersection points on the target voxel cube; The step of determining the four positioning points of the displayed image and the voxel coordinates of the four positioning points in the voxel coordinate system according to the intersection coordinate values of the plurality of intersection points includes: The four positioning points of the displayed image and the voxel coordinates of the four positioning points in the voxel coordinate system are determined according to the intersection coordinate values of the intersection points on the target voxel cube, and the four vertices are the four vertices of the circumscribed rectangle of the polygon formed by the intersection points on the target voxel cube.
9. The method according to claim 1, characterized in that: The four positioning points include a first positioning point, a second positioning point, a third positioning point and a fourth positioning point, the first positioning point and the second positioning point are adjacent vertices, the first positioning point and the fourth positioning point are adjacent vertices, and the first positioning point and the third positioning point are diagonal vertices; The determining of the first direction, the second direction and the third direction according to the voxel coordinates of the four positioning points comprises: Determine a positioning vector between the third positioning point and the first positioning point; The coordinate axis direction corresponding to the component with the largest absolute value of the positioning vector is determined as the first direction, the coordinate axis direction corresponding to the component with the smallest absolute value of the positioning vector is determined as the third direction, and the coordinate axis directions corresponding to the remaining components in the positioning vector are determined as the second direction.
10. A coordinate registration device for medical images, characterized in that: The device comprises: A positioning point acquisition unit, used to acquire four positioning points of a display image and voxel coordinates of the four positioning points in a voxel coordinate system; the display image is a rectangular image displayed by a camera image on a display interface, the camera image is a projection of a target voxel cube formed by stacking multiple layers of medical images under a current camera plane, and the four positioning points are four vertices of the display image; a direction determination unit, configured to determine a first direction, a second direction, and a third direction according to the voxel coordinates of the four positioning points; the first direction is a coordinate axis direction in which the voxel coordinate change rate of the four positioning points is a first change rate, the second direction is a coordinate axis direction in which the voxel coordinate change rate of the four positioning points is a second change rate, and the third direction is a coordinate axis direction in which the voxel coordinate change rate of the four positioning points is a third change rate, the first change rate is greater than or equal to the second change rate, and the second change rate is greater than or equal to the third change rate; a linear scanning unit, configured to obtain coordinate values of pixels in the displayed image on a first coordinate axis and on a second coordinate axis by performing linear scanning in the first direction and the second direction; the coordinate values of the first coordinate axis are the coordinate values of the coordinate axis corresponding to the first direction, and the coordinate values of the second coordinate axis are the coordinate values of the coordinate axis corresponding to the second direction; a differential calculation unit, configured to obtain a coordinate value of a pixel point in the displayed image on a third coordinate axis by performing differential calculation in the third direction, wherein the coordinate value of the third coordinate axis is a coordinate value of the coordinate axis corresponding to the third direction; A registration unit is used to combine the coordinate values of the coordinate axis corresponding to the first direction, the coordinate values of the coordinate axis corresponding to the second direction, and the coordinate values of the coordinate axis in the third direction to obtain the voxel coordinates of at least one pixel point in the displayed image in the target voxel cube.
11. An electronic device, characterized in that: The electronic device comprises a memory and a processor; The memory is coupled to the processor; The memory stores program instructions, and when the program instructions are executed by the processor, the electronic device executes the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
CT image pulmonary nodule detection method based on 3D residual neural network
CN107590797A
Projection transformation calculation method and device, equipment and storage medium
CN115205417A
Method and device for picking up vector center line of three-dimensional medical image and electronic equipment
CN118887277A
Image processing method and apparatus, and electronic device and computer-readable storage medium
WO2023029969A1