The ultra sonic imaging scan conversion method of realizing based on GPU
Technical field
The present invention relates to the medical ultrasound imaging technology, particularly based on GPU(Graphics Process Unit) the ultra sonic imaging scan conversion method realized of graph processing technique.
Background technology
The transducer of most Abdominal B type ultrasonography probe is fan-shaped, so be polar coordinate system from the resulting scan-data of transducer.When showing on screen, we need to convert polar coordinate to rectangular coordinate and could show.Scan conversion is a process that transforms to rectangular coordinate system from polar coordinate system in essence.As illustrated in fig. 1 and 2, the scanning probe direction is θ, and depth direction is d, and the data of scanning gained are s (θ, d), by coordinate transform, data conversion is arrived to the i (x, y) under the xy plane, and concrete transformation for mula is:
x=?(d0+d)sin(θ)
y=?(d0+d)cos(θ)
Coordinate transform is an operation very consuming time.In order to reach the requirement of real-time, even adopt look-up table, to the burden of CPU, be also very heavy.Usually need very high performance CPU, do not adopt bilinear interpolation, or adopt DSP or FPGA to assist.
But these methods have shortcoming: 1) the common cost of high performance CPU is very high, and can't make device miniaturization; 2) do not adopt bilinear interpolation can save a part of amount of calculation, but make picture quality that obvious decline is arranged yet; 3) adopt DSP or FPGA not only to increase cost, also increased the complexity of system simultaneously.
Summary of the invention
For the problems referred to above, the invention provides a kind of quick, low-cost, high performance ultra sonic imaging scan conversion method of realizing based on GPU of realizing.
The present invention is that the technical scheme that its technical problem of solution adopts is:
The ultra sonic imaging scan conversion method of realizing based on GPU, comprise the following steps: obtain scan-data s (θ, d); Scan-data s (θ, d) is divided into to the n equal portions in the θ direction, in the d direction, is divided into the m equal portions, form the rectangle of n*m part; Rectangle triangulation by obtaining, calculate the triangular apex coordinate on xy plane corresponding with the triangle on s (θ, d) plane, and coordinate transform is closed and is: x=(d0+d) sin (θ), y=(d0+d) cos (θ); S (θ, d) as the texture of GPU, the u coordinate that the θ direction is texture, the v coordinate that the d direction is texture, the coordinate of xy plane triangle is as the apex coordinate of GPU, the u coordinate that the xy plane triangle is corresponding and v coordinate are texture coordinate, and each triangle is drawn successively, obtain scan conversion image later.
Further, the value of n and m is to be not less than 10 integer.
Become two trianglees according to the rectangle diagonal division when further, rectangle is divided into triangle.
Further, obtain scan-data s (θ, d) first create the texture of corresponding size after, scan-data s (θ, d) calculates each vertex of a triangle and texture coordinate after being divided into triangle, and summit and texture coordinate exist in internal memory, open the bilinear interpolation switch of GPU during drafting, the scan-data received is uploaded to the texture be pre-created, bind this texture, with precalculated summit and texture coordinate, draw one by one triangle.
The invention has the beneficial effects as follows: the present invention is based on GPU under the prerequisite that does not increase system cost and complexity, complete scan conversion, better real-time and picture quality are provided, method of the present invention can be used the most cheap hardware to complete, and not only reduce costs, and hardware configuration is simple, be more suitable for miniaturization, because hardware configuration is simple, overall power also can be little more a lot of than system in the past, meet the theory of environmental protection simultaneously.
The accompanying drawing explanation
Below in conjunction with the drawings and specific embodiments, be further detailed:
Fig. 1 is the front polar coordinate system scan-data figure of conversion;
Fig. 2 is the rectangular coordinate system scan-data figure after converting;
Fig. 3 is divided into leg-of-mutton scan-data figure for the front polar coordinate system of conversion;
Fig. 4 is divided into leg-of-mutton scan-data figure for the rectangular coordinate system after converting.
The specific embodiment
With reference to Fig. 1,2,3 and 4, the ultra sonic imaging scan conversion method of realizing based on GPU of the present invention, for converting the scan-data from the resulting polar coordinate system of transducer to can show at screen rectangular coordinate system data.Below detailed step of the present invention is described.
Obtain the step of scan-data s (θ, d), as shown in Figure 1, because these data are generated by slanted transducer, therefore this scan-data s (θ, d) got is under polar coordinate system, and these data must be transformed under rectangular coordinate system and could show.
The step that scan-data is divided: scan-data s (θ, d) is divided into to the n equal portions in the θ direction, in the d direction, is divided into the m equal portions, form the rectangle of n*m part.Usually, the number needs of division is wanted enough greatly, could form the rectangle of n*m part, in general embodiment, the data optimization of n, m be not less than 10 integer.
Divide triangle and the step of calculating the triangular apex coordinate: by the rectangle triangulation obtained, calculate and s (θ, d) the triangular apex coordinate on the xy plane corresponding to the triangle on plane, coordinate transform is closed: x=(d0+d) sin (θ), y=(d0+d) cos (θ).4) work as m, when n is enough large, we can think that, in triangle, the coordinate transform of each point is linear distribution.GPU why is divided into triangle, because generally can only be drawn by diabolo.As preferred embodiment, when being divided into triangle, rectangle becomes two trianglees according to the rectangle diagonal division.The schematic diagram be divided into as shown in Figure 3.
The step of drawing: s (θ, d) as the texture of GPU, the u coordinate that the θ direction is texture, the v coordinate that the d direction is texture, the coordinate of xy plane triangle is as the apex coordinate of GPU, and the u coordinate that the xy plane triangle is corresponding and v coordinate are texture coordinate, and each triangle is drawn successively, obtain scan conversion image later, as shown in Figure 4.
In specific implementation process, the API that can select Direct3D to accelerate as GPU.When the API that selects Direct3D to accelerate as GPU realizes this method, generally carry out in the following ways: obtain scan-data s (θ, d) first create the texture of corresponding size after, scan-data s (θ, d) calculate each vertex of a triangle and texture coordinate after being divided into triangle, summit and texture coordinate exist in internal memory, open the bilinear interpolation switch of GPU during drafting, the scan-data received is uploaded to the texture be pre-created, bind this texture, with precalculated summit and texture coordinate, draw one by one triangle.
Embodiments of the present invention are not restricted to the described embodiments, as long as it reaches technique effect of the present invention with essentially identical means, all should belong to protection scope of the present invention.