Multi-detector data acquisition method, coincidence processing method, reconstruction method and system, imaging equipment, electronic equipment and storage medium

By providing a unified memory pool and atomic variable-controlled data acquisition method for multi-detector systems, the problem of low efficiency in multi-detector data acquisition under high throughput is solved. It realizes time-series writing and efficient access of data, supports dynamic imaging requirements, and improves system performance and computing resource utilization.

CN121996566APending Publication Date: 2026-05-08RAYCAN TECH CO LTD SU ZHOU
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
RAYCAN TECH CO LTD SU ZHOU
Filing Date
2025-12-31
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Existing multi-detector data acquisition methods suffer from high network load, low processing efficiency, large computational resource consumption, and limited data access and computation efficiency when facing high throughput. In particular, in dynamic imaging applications where data needs to be filtered and processed by time period, existing methods cannot effectively utilize multi-core computing resources.

Method used

A unified memory pool mechanism is adopted to provide a shared memory pool for multiple detectors. Network data packets are processed asynchronously through the first and second acquisition threads. Atomic variables and read-write locks are used to write and read data in the order of arrival time. Combined with the timestamp recording by the marking thread to establish a data location mapping, efficient concurrent data processing is achieved.

Benefits of technology

It achieves efficient acquisition and processing of multi-detector data, reduces memory fragmentation, and improves data access efficiency. In particular, it significantly improves system performance in high-throughput and dynamic imaging scenarios, reduces CPU resource consumption, and supports parallel processing of multi-core computing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121996566A_ABST
    Figure CN121996566A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-detector data acquisition method, a coincidence processing method, a reconstruction method, a system, imaging equipment, electronic equipment and a storage medium. The multi-detector data acquisition method comprises the following steps: providing a unified memory pool for a plurality of detectors of imaging equipment; continuously receiving detection event data from the plurality of detectors; and writing the detection event data from the plurality of detectors into the unified memory pool according to the arrival time sequence. According to the scheme provided by the invention, time serialization writing and physical continuous storage of the data to the unified memory pool are realized, the calculation overhead of multi-path merging sorting is eliminated, the time complexity of data reading is remarkably reduced, and thus the data acquisition efficiency of a multi-detector system is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image imaging, specifically to a multi-detector data acquisition method, a coincidence processing method, a reconstruction method, a system, an imaging device, an electronic device, and a storage medium. Background Technology

[0002] In the field of medical imaging, positron emission tomography (PET) plays a crucial role in clinical diagnosis and scientific research as an important molecular imaging technique. A fully digital PET system employs multiple detectors to receive gamma-ray events and uses a data acquisition and processing subsystem to acquire and process the signals generated by the detectors in real time.

[0003] When processing high-throughput detector data, existing data acquisition methods have limitations in terms of network load, processing efficiency, and computational resource consumption when faced with ever-increasing data volumes. Furthermore, for applications such as dynamic imaging that require filtering and processing data by time period, existing methods suffer from significant limitations in data access and computational efficiency.

[0004] Therefore, it is desirable to provide a technical solution that can adapt to large-scale detector systems and improve data acquisition and processing efficiency.

[0005] The background art description is provided solely for the purpose of understanding the relevant technologies in this field and is not intended as an admission of prior art. Summary of the Invention

[0006] Therefore, the embodiments of this application aim to provide a multi-detector data acquisition method and system, a coincidence processing method and system, a reconstruction method and system, an imaging device, an electronic device, and a storage medium, which can solve or alleviate at least one of the aforementioned technical problems and improve the efficiency of multi-detector data acquisition.

[0007] In a first aspect, embodiments of this application provide a multi-detector data acquisition method, comprising: Provides a unified memory pool for multiple detectors in imaging devices; Continuously receive detection event data from the multiple detectors; The detection event data from the multiple detectors are written into the unified memory pool in order of arrival time.

[0008] In some embodiments, the unified memory pool includes: A total write atomic variable used to identify the total number of data packets written; Empty atomic variables used to identify the number of remaining writable data packets; A full status atomic flag used to identify whether the unified memory pool is full; and A read-write lock used to control concurrent access to write to or read from the unified memory pool.

[0009] In some embodiments, the unified memory pool further includes: A memory pool data array used to store probe event data; A length array used to store the length of each data packet; and An array used to store the offset of the starting position of each data packet in the data array.

[0010] In some embodiments, writing the detection event data from the plurality of detectors into the unified memory pool in order of arrival time includes: The first acquisition thread acquires the location metadata of data packets from each network interface connecting the multiple detectors. The location metadata is written to the first queue through the first acquisition thread; The second acquisition thread reads the location metadata from the first queue and obtains the detection event data in the data packet based on the location metadata; and The second acquisition thread writes the detected event data into the unified memory pool.

[0011] In some embodiments, the step of obtaining location metadata of data packets from each network interface connecting the plurality of detectors through a first acquisition thread includes: Data packets are acquired from the network interfaces of the multiple detectors; The network protocol stack of the data packet is parsed to determine whether the data packet conforms to a preset protocol type; According to the protocol format of the preset protocol type, the location metadata of the data packet is extracted from the data packet that conforms to the preset protocol type.

[0012] In some embodiments, parsing the network protocol stack of the data packet to determine whether the data packet conforms to a preset protocol type includes: The network protocol stack of the data packet is parsed sequentially according to the multi-layer protocol order of the preset protocol type; If the data packet satisfies the multi-layer protocol order, then the data packet is determined to conform to the preset protocol format; If the data packet does not satisfy any layer of the multi-layer protocol sequence, the data packet is discarded.

[0013] In some embodiments, the step of obtaining location metadata of data packets from each network interface connecting the plurality of detectors through a first acquisition thread further includes: Perform validity checks on data packets that conform to the preset protocol type to determine whether the data packet is a valid data packet, specifically including: Extract source address information from the data packet; Compare the source address information with the corresponding detector address information; If they match, the data packet is determined to be a valid data packet. If there is a discrepancy, the data packet is discarded.

[0014] In some embodiments, the step of obtaining location metadata from the network interface connecting the plurality of detectors via the first acquisition thread further includes: Write the location metadata into the stack buffer of the first acquisition thread; The step of writing the location metadata into the first queue through the first acquisition thread includes: When the write volume of the stack buffer of the first acquisition thread reaches a preset condition, multiple location metadata in the local stack buffer are written to the first queue in batches.

[0015] In some embodiments, the first queue is a circular queue, and the first queue includes: A first queue array, comprising multiple data spaces for accessing the location metadata, each data space having a first data read semaphore and a first data write semaphore; A first atomic variable used to identify the write position of the first queue; A second atomic variable used to identify the read position of the first queue; A first queue read semaphore used to identify the amount of available data in the first queue; A first queue write semaphore used to identify the number of free slots in the first queue.

[0016] In some embodiments, writing the location metadata into the first queue via the first acquisition thread includes: Obtain the write semaphore for the first queue to determine if there are any free slots in the first queue; If there is a free slot, perform an atomic increment operation on the first atomic variable and obtain the value before the increment to determine the write position in the first queue for this write. The location metadata is written into the data space of the first queue array corresponding to the writing location.

[0017] In some embodiments, determining the write position in the first queue for this write operation includes: The index of the write position is obtained by performing a modulo operation between the value of the first atomic variable before increment and the size of the first queue array.

[0018] In some embodiments, before writing the location metadata into the data space corresponding to the writing location, the step of writing the location metadata into the first queue through the first acquisition thread further includes: Obtain the first data write semaphore of the data space corresponding to the write position to ensure that the data space corresponding to the write position is not accessed by other threads.

[0019] In some embodiments, obtaining the first queue write semaphore to determine whether the first queue has free slots includes: If the value of the first queue write semaphore is not greater than zero, the corresponding first acquisition thread enters a blocked state; If the value of the write semaphore of the first queue is greater than zero, then it is determined that the first queue has an empty slot.

[0020] In some embodiments, writing the location metadata into the first queue via the first acquisition thread further includes: After writing the location metadata into the data space corresponding to the writing location, the first data read semaphore and the first queue read semaphore are released in sequence so that the location metadata in the data space can be read by the second acquisition thread.

[0021] In some embodiments, reading the location metadata from the first queue via a second acquisition thread includes: Obtain the first queue read semaphore to determine if there is available data in the first queue; If available data is available, perform an atomic increment operation on the second atomic variable and obtain the value before the increment to determine the read position in the first queue for this read. The location metadata is read from the data space in the first queue array corresponding to the read position.

[0022] In some embodiments, determining the read position in the first queue for this read includes: The index of the read position is obtained by performing a modulo operation between the value of the second atomic variable before its increment and the size of the first queue array.

[0023] In some embodiments, before reading the location metadata from the data space corresponding to the read location, the method further includes: Obtain the first data read semaphore of the data space corresponding to the read position to ensure that the data space corresponding to the read position is not accessed by other threads.

[0024] In some embodiments, obtaining the first queue read semaphore to determine whether the first queue has available data includes: If the value of the first queue read semaphore is not greater than zero, the corresponding second acquisition thread enters a blocked state; If the value of the first queue read semaphore is greater than zero, then the first queue is determined to have available data.

[0025] In some embodiments, obtaining the location metadata from the first queue via the second acquisition thread further includes: After reading the location metadata from the data space corresponding to the read location, the first data write semaphore and the first queue write semaphore are released in sequence so that the data space can be written with new location metadata by the first acquisition thread.

[0026] In some embodiments, obtaining the probe event data in the data packet based on the location metadata includes: Based on the starting address and length in the location metadata, the data packet is copied to the stack buffer of the second acquisition thread; The step of writing the probe event data into the unified memory pool through the second acquisition thread includes: writing the probe event data in the stack buffer of the second acquisition thread into the unified memory pool.

[0027] In some embodiments, writing the detection event data from the plurality of detectors into the unified memory pool in order of arrival time includes: The first acquisition thread acquires the location metadata of data packets from each network interface connecting the multiple detectors. The location metadata is written to the first queue through the first acquisition thread; The second acquisition thread reads the location metadata from the first queue and obtains the detection event data in the data packet based on the location metadata; and The second acquisition thread writes the detected event data into the unified memory pool.

[0028] In some embodiments, writing the detection event data from the plurality of detectors into the unified memory pool in order of arrival time includes: Data packets containing the detected event data are obtained directly from the network interface connecting the multiple detectors through multiple acquisition threads, and temporarily stored in the stack buffer of each acquisition thread. The probe event data is written to the unified memory pool from the stack buffers of the multiple acquisition threads.

[0029] In some embodiments, writing the detection event data from the plurality of detectors into the unified memory pool in order of arrival time includes: Data packets including the detection event data are received from the network interface connecting the multiple detectors via the socket interface; The detected event data is written into the unified memory pool.

[0030] In some embodiments, writing the probe event data into the unified memory pool includes: Based on the full status flag of the unified memory pool, determine whether the unified memory pool is full; If the unified memory pool is not full, a read lock is added to the read-write lock of the unified memory pool; Perform atomic operations on the total write atomic variables of the unified memory pool to determine the write position of this write in the unified memory pool; Write the detected event data to the write location; Release the read lock of the read-write lock.

[0031] In some embodiments, performing an atomic operation on the total write atomic variable of the unified memory pool to determine the write position of the current write in the unified memory pool includes: Perform an atomic increment operation on the total write atomic variable, with the increment value being the number of data packets written this time; Obtain the value before increment returned by the atomic increment operation; The starting position of this write in the unified memory pool is determined based on the value before the increment.

[0032] In some embodiments, determining the write position in the unified memory pool based on the value before the increment includes: The value before increment is moduloed by the size of the length array or the offset array to obtain the write index of the length array and the offset array; Use the write index of the length array and offset array as the starting position of this write in the unified memory pool.

[0033] In some embodiments, writing the probe event data into the unified memory pool further includes: Before determining the write location, perform an atomic decrement operation on the empty atomic variables of the unified memory pool, with the decrement value being the number of data packets to be written in this batch. Obtain the value before decrement returned by the atomic decrement operation to determine the current amount of free space in the unified memory pool.

[0034] In some embodiments, writing the probe event data into the unified memory pool further includes: After determining the available space, it is determined whether the available space is not greater than a preset early stop threshold. If the available space is not greater than the early stop threshold, then the full state flag is set to true.

[0035] In some embodiments, it also includes: Based on the storage location of the probe event data in the unified memory pool, the probe event data is read from the unified memory pool, wherein the storage location is determined according to the arrival time order.

[0036] In some embodiments, it also includes: The probe event data written within multiple consecutive time intervals are read sequentially from the unified memory pool.

[0037] In some embodiments, reading the probe event data written within multiple consecutive time intervals sequentially from the unified memory pool includes: By marking threads, the current total write volume and current time of the unified memory pool are obtained at preset time intervals; The marking thread writes the marking information, including the current total write volume and the current time, into the second queue. The data acquisition thread reads the tagging information from the second queue. The data acquisition thread sequentially reads the probe event data written within the multiple consecutive time intervals from the unified memory pool according to the tagging information, wherein the consecutive time intervals are determined based on the current time of the tagging information.

[0038] In some embodiments, the step of sequentially reading probe event data written within the plurality of consecutive time intervals from the unified memory pool according to the tagging information via the data acquisition thread includes: Add a write lock to the read-write lock of the unified memory pool; The tagging information is obtained from the second queue, and the storage location range of the probe event data read this time is determined based on the tagging information obtained this time and the tagging information obtained last time. The detection event data is read from the unified memory pool according to the storage location range; Release the write lock of the read-write lock.

[0039] In some embodiments, reading the probe event data from the unified memory pool according to the storage location range includes: The range of storage locations is moduloed by the size of the length array or offset array to obtain the read index range of the length array and offset array; Based on the read index range, the length of each data packet is obtained from the corresponding position in the length array; Based on the read index range, obtain the starting offset of each data packet in the data array from the corresponding position in the offset array; Based on the offset and length of each data packet, the probe event data of each data packet is read from the data array.

[0040] In some embodiments, the step of sequentially reading probe event data written within the plurality of consecutive time intervals from the unified memory pool according to the tagging information via the data acquisition thread further includes: Before acquiring a write lock for the read-write lock of the unified memory pool, the storage space occupied by the probe event data read last time is released based on the amount of data read last time. Specifically, this includes: Determine if the number of data packets read last time is greater than zero; If the number of data packets read last time is greater than zero, then perform an atomic increment operation on the empty atomic variable of the unified memory pool, incrementing the value by the number of data packets read last time, and set the full state atomic flag of the unified memory pool to false.

[0041] In some embodiments, the second queue is a circular queue, and the second queue includes: The second array includes multiple data spaces for accessing the tag information, and each data space has a second data read semaphore and a second data write semaphore. A third atomic variable used to identify the write position of the second queue; A fourth atomic variable used to identify the read position of the second queue; A second queue read semaphore used to identify the amount of available data in the second queue; Second queue write semaphore used to identify the number of free slots in the second queue.

[0042] In some embodiments, writing the marking information, including the current total write volume and the current time, into the second queue via the marking thread includes: Obtain the write semaphore for the second queue to determine if there are any free slots in the second queue; If there is an available slot, perform an atomic increment operation on the third atomic variable and obtain the value before the increment to determine the write position in the second queue for this write. The marking information is written into the data space of the second array corresponding to the writing position.

[0043] In some embodiments, reading the tag information from the second queue via the data acquisition thread includes: Acquire the second queue read semaphore to determine if there is available data in the second queue; If available data is available, perform an atomic increment operation on the fourth atomic variable and obtain the value before the increment to determine the read position in the second queue for this read. The marker information is read from the data space in the second array corresponding to the read position.

[0044] In a second aspect, embodiments of this application provide a conformity processing method, which includes: Using the multi-detector data acquisition method described in the first aspect, detection event data acquired from multiple detectors of the imaging device are written into a unified memory pool; The probe data written to the unified memory pool is subjected to conformance processing to obtain conformance event data.

[0045] In a third aspect, embodiments of this application provide a conformity processing method, which includes: Acquire probe event data stored in a unified memory pool, wherein the probe event data is stored in the unified memory pool in order of arrival time; Based on the spatial-temporal relationship between the storage location and arrival time of the detected event data, the detected event data is subjected to conformance processing to obtain conformance event data.

[0046] In a fourth aspect, embodiments of this application provide a reconstruction method, which includes: Using the multi-detector data acquisition method described in the first aspect, detection event data acquired from multiple detectors of the imaging device are written into a unified memory pool; The probe data written to the unified memory pool is subjected to conformance processing to obtain conformance event data; The event data is reconstructed using a preset reconstruction algorithm to obtain a reconstructed image.

[0047] In a fifth aspect, embodiments of this application provide a reconstruction method, which includes: Acquire probe event data stored in a unified memory pool, wherein the probe event data is stored in the unified memory pool in order of arrival time; Based on the spatial-temporal relationship between the storage location and arrival time of the detected event data, the detected event data is subjected to conformance processing to obtain conformance event data; The event data is reconstructed using a preset reconstruction algorithm to obtain a reconstructed image.

[0048] In a sixth aspect, embodiments of this application provide a multi-detector data acquisition system, which includes: A unified memory pool is configured to store detection event data from multiple detectors in the imaging device; The data receiving unit is configured to continuously receive detection event data from the plurality of detectors; The data writing unit is configured to write detection event data from the multiple detectors into the unified memory pool in order of arrival time.

[0049] In some embodiments, the unified memory pool includes: A total write atomic variable used to identify the total number of data packets written; Empty atomic variables used to identify the number of remaining writable data packets; A full status atomic flag used to identify whether the unified memory pool is full; and A read-write lock used to control concurrent access to write to or read from the unified memory pool.

[0050] In some embodiments, the unified memory pool further includes: A memory pool data array used to store probe event data; A length array used to store the length of each data packet; and An array used to store the offset of the starting position of each data packet in the data array.

[0051] In some embodiments, the multi-detector data acquisition system further includes: The data readout unit is used to read probe event data from the unified memory pool based on the storage location of the probe event data in the unified memory pool, wherein the storage location is determined according to the arrival time order.

[0052] In some embodiments, the multi-detector data acquisition system further includes: The first acquisition module is configured to acquire location metadata of data packets from each network interface connected to the multiple detectors through the first acquisition thread; The first writing module is configured to write the location metadata into a first queue through the first acquisition thread; The second acquisition module is configured to read the location metadata from the first queue via a second acquisition thread, and obtain the detection event data in the data packet based on the location metadata; and The second writing module is configured to write the probe event data into the unified memory pool through the second acquisition thread.

[0053] In some embodiments, the multi-detector data acquisition system further includes: The third acquisition module is configured to acquire the current total write volume and current time of the unified memory pool by marking threads at preset time intervals; The third writing module is configured to write the marking information, including the current total writing volume and the current time, into the second queue through the marking thread; The fourth acquisition module is configured to read the tagging information from the second queue via a data acquisition thread; The fourth writing module is configured to read probe event data written within the multiple consecutive time intervals from the unified memory pool according to the tag information through the data acquisition thread, wherein the consecutive time intervals are determined according to the current time of the tag information.

[0054] In a seventh aspect, embodiments of this application provide a conforming event handling system, comprising: The multi-detector data acquisition system as described in the sixth aspect; The matching processing module is configured to perform matching processing on probe data written to a unified memory pool to obtain matching event data.

[0055] In an eighth aspect, embodiments of this application provide a conforming event handling system, comprising: A unified memory pool is configured to store probe event data, wherein the probe event data is stored in the unified memory pool in order of arrival time; The matching processing module is configured to perform matching processing on the detected event data based on the spatial-temporal relationship between the storage location and arrival time of the detected event data, so as to obtain matching event data.

[0056] In a ninth aspect, embodiments of this application provide a reconstruction system, which includes: The multi-detector data acquisition system as described in the sixth aspect; The matching processing module is configured to perform matching processing on the probe data written to the unified memory pool to obtain matching event data. The reconstruction module is configured to use a preset reconstruction algorithm to perform image reconstruction on the event data to obtain a reconstructed image.

[0057] In a tenth aspect, embodiments of this application provide a reconstruction system, comprising: A unified memory pool is configured to store probe event data, wherein the probe event data is stored in the unified memory pool in order of arrival time; The matching processing module is configured to perform matching processing on the detected event data based on the spatial-temporal relationship between the storage location and arrival time of the detected event data to obtain matching event data; The reconstruction module is configured to use a preset reconstruction algorithm to perform image reconstruction on the event data to obtain a reconstructed image.

[0058] In the eleventh aspect, embodiments of this application provide an imaging device including a multi-detector data acquisition system according to the sixth aspect, a coincidence event processing system according to the seventh or eighth aspect, or a reconstruction system according to the ninth or tenth aspect.

[0059] In a twelfth aspect, embodiments of this application provide an electronic device including a processor and a memory, the memory storing computer program instructions, wherein the processor, when executing the computer program instructions, implements the method as described in any one of the first to fifth aspects.

[0060] In a thirteenth aspect, embodiments of this application provide a computer storage medium storing computer program instructions, wherein when the computer program instructions are executed by a processor, they implement the method described in any one of the first to fifth aspects.

[0061] The multi-detector data acquisition method provided in this application establishes a novel data acquisition architecture by providing a unified memory pool for multiple detectors in an imaging device and writing detection event data from multiple detectors into this unified memory pool in the order of arrival time. This solution solves the technical problems of traditional methods, such as low memory utilization efficiency, data fragmentation, and the need for multi-path merge sorting in subsequent processing, caused by setting up independent buffers for each detector. In particular, by employing a unified memory pool and a concurrent write mechanism controlled by atomic variables, this solution can automatically achieve time-sequential writing of data when multiple detectors generate data concurrently. This ensures that data is stored tightly and continuously in physical memory in the order of arrival, eliminating the computational overhead of subsequent multi-path merge sorting of data from different detectors required in traditional solutions, and significantly improving data access efficiency. This is particularly beneficial for dynamic imaging, such as dynamic PET imaging.

[0062] In a further embodiment of this application, by setting a first acquisition thread and a second acquisition thread, asynchronous pipelined processing of network packet reception and data copying is achieved, solving the thread-end blocking problem caused by binding network packet reception and data transfer to a single thread in traditional solutions. The first acquisition thread focuses on high-speed acquisition of the metadata (starting address and length) of the data packets from the network interface, while the actual data copying work is handled in parallel by the second acquisition thread. This allows the first acquisition thread to respond to network adapter (e.g., NIC) interrupts with minimal latency, preventing network adapter (e.g., NIC) hardware buffer overflow and packet loss, significantly improving the system's data reception capability in high-throughput scenarios (e.g., above 60Gbps), while reducing CPU resource consumption.

[0063] In a further embodiment of this application, the total amount of data written to the memory pool and the timestamp are recorded by the marking thread at preset time intervals, and the marking information is written to the readout identifier queue. This establishes a direct mapping relationship between time and storage location, realizing the ability to read out the detection data at the time. As a result, the data acquisition thread can directly locate the physical storage location range corresponding to the target time period based on the marking information. It can quickly locate the data without having to traverse and parse the data packets from the beginning, which greatly improves the flexibility and efficiency of subsequent data processing and further contributes to dynamic PET imaging.

[0064] In a further embodiment of this application, the unified memory pool includes a data array for storing probe event data, a length array for storing the length of each data packet, and an offset array for storing the starting position of each data packet. It achieves efficient concurrency control through mechanisms such as total write atomic variables, spare atomic variables, and read-write locks. This allows multiple write threads to write to the unified memory pool in parallel while ensuring thread safety, maximizing the system's concurrent processing capabilities. Furthermore, by using read-write locks in reverse (acquiring a read lock during writing and a write lock during reading), this scheme implements an access control strategy that allows multiple threads to write concurrently, but a single thread has exclusive access to reads. This ensures data consistency while avoiding frequent conflicts between write threads, thus maintaining high data throughput even in high-concurrency scenarios.

[0065] Optional features and other effects of the embodiments of this application are described in part below, and in part will be apparent from reading this document. Attached Figure Description

[0066] The embodiments of this application will be described in detail with reference to the accompanying drawings. The elements shown are not limited to the scale shown in the drawings, and the same or similar reference numerals in the drawings denote the same or similar elements, wherein: Figure 1 An exemplary structural diagram of a digital PET system is shown; Figure 2 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 3 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 4 An architecture diagram is shown that can implement a multi-detector data acquisition method according to embodiments of this application; Figure 5 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 6 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 7 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 8 A flowchart illustrating the network interface card (NIC) thread workflow is shown as a specific example. Figure 9 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 10 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 11 The flowchart of the write operation for the first queue is shown as a specific example; Figure 12 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 13 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 14 The flowchart of the read operation of the first queue is shown as a specific example; Figure 15 A flowchart illustrating the copy thread workflow is shown as a specific example; Figure 16 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 17 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 18 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 19 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 20 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 21 A flowchart illustrating a specific example of a memory pool write operation is shown. Figure 22 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 23 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 24 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 25 A flowchart illustrating a specific example of a tag thread workflow is shown; Figure 26A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 27 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 28 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 29 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 30 A flowchart illustrating a specific example of a memory pool read operation is shown. Figure 31 A flowchart of a multi-detector data acquisition method according to an embodiment of this application is shown; Figure 32 An exemplary flowchart of a conformity processing method according to an embodiment of this application is shown; Figure 33 An exemplary flowchart of a conformity processing method according to an embodiment of this application is shown; Figure 34 An exemplary flowchart of a reconstruction method according to an embodiment of this application is shown; Figure 35 An exemplary flowchart of a reconstruction method according to an embodiment of this application is shown; Figure 36 A schematic diagram of the structure of a multi-detector data acquisition system according to an embodiment of this application is shown; Figure 37 A schematic diagram of the structure of a multi-detector data acquisition system according to an embodiment of this application is shown; Figure 38 A schematic diagram of the structure of a multi-detector data acquisition system according to an embodiment of this application is shown; Figure 39 A schematic diagram of the structure of a multi-detector data acquisition system according to an embodiment of this application is shown; Figure 40 A schematic diagram of the structure of a conforming event processing system according to an embodiment of this application is shown; Figure 41 A schematic diagram of the structure of a conforming event processing system according to an embodiment of this application is shown; Figure 42 A schematic diagram of the reconstruction system according to an embodiment of this application is shown; Figure 43 A schematic diagram of the reconstruction system according to an embodiment of this application is shown; and Figure 44 A schematic diagram of an electronic device capable of implementing the methods of the embodiments of this application is shown. Detailed Implementation

[0067] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to specific embodiments and accompanying drawings. Here, the illustrative embodiments and descriptions of this application are used to explain this application, but are not intended to limit this application.

[0068] The term "comprising" and its variations as used herein signify open inclusion, i.e., "including but not limited to". Unless otherwise stated, the term "or" means "and / or". The term "based on" means "at least partially based on". The terms "one example embodiment" and "one embodiment" mean "at least one example embodiment". The term "another embodiment" means "at least one additional embodiment". The terms "first", "second", etc., may refer to different or the same objects.

[0069] The acquisition, processing, storage, transmission, and use of user data that may be involved in the embodiments of this application, such as patient health information, biometric information, and other sensitive personal information (hereinafter collectively referred to as "user data"), strictly comply with the laws and regulations of relevant countries and regions (such as, but not limited to, the Personal Information Protection Law, the Data Security Law, and the Regulations on the Supervision and Administration of Medical Devices) and industry standards. The collection, acquisition, and use of user data involved in the embodiments of this application are all conducted with the full knowledge, understanding, and separate authorization of the user / patient. In implementing the embodiments of this application, the user / patient will be informed of the types of user data or information that may be involved, the scope of use, and the usage scenarios through appropriate means, and authorization will be obtained. Any user data processing activity will be conducted with a legal basis (such as obtaining the separate consent of the personal information subject or being necessary for the performance of a contract), and will only be processed within the scope stipulated by laws and regulations or explicitly agreed upon by the user / patient. The user / patient's refusal to process personal information beyond the information necessary to achieve the basic functions will not affect the normal use of the core functions of the embodiments of this application.

[0070] Any artificial intelligence algorithms, decision-making models, or recommendation models (if applicable) involved in the embodiments of this application have been designed to be free from any discriminatory or biased factors. The input features and decision-making logic of the algorithms and models are strictly based on objective medical and technical indicators to ensure that they do not violate social morality, do not harm public interests, and comply with the principles of scientific and technological ethics.

[0071] As mentioned earlier, the data acquisition and computing subsystem of the all-digital PET system needs to handle high-throughput data streams from a large number of detectors.

[0072] like Figure 1As shown, in a typical all-digital PET system, the detector array comprises multiple detectors 110 (e.g., 12, 48, 144, or more) arranged in a ring to receive gamma rays emitted by the object being inspected. Each detector transmits detected event data via an Ethernet UDP protocol stack to the network interface 121 of a network adapter 120 (such as a switch or network card), and the data is then transmitted to a backend computer system 130 for processing. Figure 1 As shown, in systems with a large number of detectors, data is typically not directly connected to the backend computer. Instead, multiple data streams are aggregated into a smaller set via a switch before transmission. The data throughput required by a fully digital PET system is directly related to the system size, generally ranging from 10Gbps to 100Gbps or even higher. This high throughput demands extremely high data acquisition and processing performance from the data acquisition and computing subsystem.

[0073] Some known data acquisition schemes employ a dual (multi) buffering approach, using socket network programming to create a thread for each detector to capture UDP network packets and write them to the corresponding buffer. When the current buffer is full, it is switched to a backup buffer, and a backup task is initiated to transfer the data from the previously filled buffer, allowing it to be reused as quickly as possible. However, this architecture has several technical limitations.

[0074] As an explanation, not a limitation, the core problem facing this dual (multi) buffer architecture is high network load and low network card utilization efficiency. When data throughput is high (e.g., reaching 60Gbps and above), CPU resource consumption skyrockets, making it almost impossible for the computer to perform additional computing tasks without data loss, and throughput can reach up to about 90% of the network card's nominal performance. Furthermore, this dual (multi) buffer architecture incurs additional data copying overhead. Due to network fluctuations and processing speed limitations of computing units, when a data buffer is full, the system needs to move the data to a spare area as quickly as possible so that the previously filled buffer can be reused. This process introduces additional, large-scale memory copy operations, with each copy typically reaching GB levels. Unnecessary data movement significantly consumes valuable memory bandwidth and CPU resources, reducing the overall system throughput. Additionally, this dual (multi) buffer architecture suffers from low data computation efficiency. Typical timing-based acquisition algorithms (such as the dual-buffering scheme mentioned above) cannot determine the corresponding timestamp of data packets within the computer. Dynamic imaging is a particularly attractive feature of PET. To achieve dynamic imaging, data within the target time period needs to be filtered out. In timed readout schemes, this step requires unpacking and traversing, typically implemented in a single thread, which cannot fully utilize the parallel computing potential of multi-core and many-core computing units. Furthermore, when processing this data in chronological order, such as performing composite processing, the challenge of multi-way merge sorting arises.

[0075] In addition, some known solutions attempt to improve data transfer efficiency by introducing shared memory mechanisms. However, the underlying architecture of these solutions still maintains the design pattern of "allocating an independent memory block for each detector." In this architecture, the system opens N independent shared memory regions for N detectors, and the data of each detector is marked and written into its corresponding memory block. Specifically, this solution is essentially still a distributed storage of data, only the storage medium has been changed from ordinary process memory to shared memory, and the data is still physically distributed among the memory blocks corresponding to different detectors. Therefore, when data needs to be processed in chronological order, this solution still faces the aforementioned problems, such as the multi-way merge sort problem: the processor must simultaneously access N independent shared memory regions, compare the timestamps of the data in each memory block, and perform merge sort to obtain a time-ordered data stream.

[0076] To address these issues, this application provides a multi-detector data acquisition scheme based on a unified memory pool, which effectively alleviates or overcomes the aforementioned problems. As an explanation, and not a limitation, this application recognizes that by providing a unified memory pool for all detectors and utilizing the global serialization characteristics of atomic operations, time-ordered physical spatial adjacency storage can be completed instantly upon data writing, achieving the effect of "writing as sorting, writing as merging." Furthermore, by adopting an asynchronous pipeline architecture that separates control flow and data flow, this application not only leverages the parallel computing potential of computers but also decouples network packet reception from data copying. This allows lightweight network interface card (NIC) threads to respond to NIC interrupts at extremely high frequencies, avoiding the line-end blocking problem caused by binding reception and copying in traditional schemes. This significantly improves data reception capabilities under high loads and enables extremely high data throughput. Moreover, by combining a timing readout strategy, this application establishes a direct mapping relationship between time and physical storage location, fully utilizing the parallel computing potential of computers to quickly read detector data for subsequent processing, thereby efficiently achieving high-quality dynamic PET imaging.

[0077] Therefore, this application proposes a multi-detector data acquisition method and corresponding data acquisition system, a coincidence processing method and system, a reconstruction method and system, as well as an electronic device and computer storage medium for implementing the method. The technical solution will be described in detail below with reference to the accompanying drawings.

[0078] The multi-detector data acquisition method of this application embodiment will be described in detail below with reference to the accompanying drawings.

[0079] See Figure 2 The multi-detector data acquisition method of this application embodiment may include the following steps S210, S220 and S230: S210: Provides a unified memory pool for multiple detectors in an imaging device.

[0080] As mentioned above, refer to Figure 1 Imaging equipment (such as a digital PET system) may include multiple detectors 110 (e.g., 12 or more) arranged in a ring to receive gamma rays emitted by the object being inspected. In some embodiments, each detector, upon detecting a gamma ray event, transmits the detection event data via a network adapter 120 (e.g., a network card) through a network interface 121 to a backend computer system 130. In embodiments of this application, the data acquisition system can continuously and uninterruptedly receive detection event data from these multiple detectors to support the real-time imaging requirements of the PET system.

[0081] Preferably, the multiple detectors of the imaging device are all the detectors of the imaging device.

[0082] In some embodiments, the unified memory pool includes a pre-allocated contiguous physical memory space for receiving and storing detection event data from multiple detectors. For explanation, unlike traditional schemes that set up independent buffers for each detector, the unified memory pool in this embodiment is a single memory region shared by all detectors.

[0083] In this embodiment, the unified memory pool may include a total write atomic variable to identify the total number of written data packets, a spare atomic variable to identify the number of remaining writable data packets, a full status atomic flag to identify whether the unified memory pool is full, and a read-write lock to control concurrent access to write to or read from the unified memory pool. In some embodiments, the initial value of the total write atomic variable may be set to zero, the initial value of the spare atomic variable may be set to the maximum number of data packets that the unified memory pool can store, and the initial value of the full status atomic flag may be set to false. In this embodiment, a concurrent write mechanism controlled by atomic operations can be implemented. Specifically, when data packets from different detectors arrive concurrently, the concurrent write requests can be globally serialized at the hardware level using atomic increment operations of atomic variables (such as the total write atomic variable), as further described below.

[0084] In some embodiments, the unified memory pool may further include a memory pool data array for storing probe event data, a length array for storing the length of each data packet, and an offset array for storing the starting position of each data packet in the data array. In some embodiments, the size of the length array and the offset array may be equal to the size of the data array divided by a preset maximum data packet size, used to provide index information for each data packet. In some embodiments, each element of the length array may correspond to a data packet, recording the actual byte length of the data packet; each element of the offset array may correspond to a data packet, recording the offset of the first byte of the data packet relative to the starting position of the data array. This will be further explained below.

[0085] S220: Continuously receives detection event data from multiple detectors.

[0086] In this embodiment of the application, the backend computer system 130 can continuously receive detection event data from the plurality of detectors via the network interface 121 through the network adapter 120 (such as a network card), for example, the data can be received in the kernel buffer of the backend computer system.

[0087] S230: Write detection event data from multiple detectors into a unified memory pool in order of arrival time.

[0088] In the embodiments of this application, step S230 described above can be implemented in various ways. The following describes several main implementation methods in detail with reference to the accompanying drawings.

[0089] In some embodiments, step S230 can be executed concurrently by multiple acquisition threads to fully utilize the parallel processing capabilities of a multi-core processor. That is, step S230 may include step S230' (not shown): concurrently writing detection event data from the multiple detectors into the unified memory pool using multiple acquisition threads.

[0090] In some preferred embodiments, step S230 can be implemented by using functionally separated threads to achieve efficient writing of probe event data.

[0091] Reference Figure 3 and Figure 4 The illustrated embodiment demonstrates how a cooperative structure consisting of a first acquisition thread, a first queue, and a second acquisition thread can be used to efficiently write probe event data into a unified memory pool.

[0092] Specifically, refer to Figure 4 The architecture for this real-time embodiment may include a first acquisition thread, a first queue, a second acquisition thread, a unified memory pool, a tagging thread, and a data acquisition thread. In some embodiments, the first acquisition thread is, for example, a network interface card (NIC) thread, and the first queue is, for example, a NIC resource queue; the second acquisition thread is, for example, a copy thread; the second queue is, for example, a readout identifier queue, and the data acquisition thread may also be referred to as a user thread. In some embodiments, the first acquisition thread (e.g., the NIC thread) is responsible for acquiring the metadata of data packets at high speed from the network interface, and the second acquisition thread (e.g., the copy thread) is responsible for copying the actual payload of the data packets to the unified memory pool. These threads are coordinated and synchronized with each other through the first queue (e.g., the NIC resource queue). In some embodiments, the tagging thread is responsible for recording the state of the memory pool at time intervals, and the data acquisition thread (e.g., the user thread) is responsible for reading data from the unified memory pool for subsequent processing. These threads are coordinated and synchronized with each other through the second queue (e.g., the readout identifier queue). Figure 4 The preferred embodiment shown illustrates the architecture of the unified memory pool's write side (front end) and read side (back end), the relevant features of which will be further described below. Furthermore, it will be understood here that although... Figure 4 The architecture of the write side (front end) and read side (back end) of the unified memory pool is shown. However, the architecture of the write side (front end) and read side (back end) can be independent. Therefore, it is conceivable that in some embodiments only one side as shown in the figure is included, which still falls within the scope of this application. For example, in some embodiments, only one side may be included. Figure 4 The architecture shown is for the front-end write side, and it adopts the same... Figure 4 Different read architectures. For example, in some embodiments, the architecture of the front-end write side can differ from... Figure 4 As shown, for example, below Figure 22 and Figure 23 The embodiment shown is still employed. Figure 4 The architecture of the back-end read side is shown.

[0093] See Figure 3 Step S230 (as in step S230') may include the following steps: S310: Obtains location metadata of data packets from each network interface connecting multiple detectors through the first acquisition thread.

[0094] As mentioned above, the first acquisition thread is, for example, a network interface card (NIC) thread, which can acquire data packets at high speed from the network interface and extract location metadata. In the embodiments of this application, the first acquisition thread, for example, a NIC thread, can be set on the host side (such as the computer system 130 side) or on the network adapter (such as the NIC) side, both of which fall within the scope of this application.

[0095] like Figure 1 As shown, each detector can send data to the computer system via network interface S121, and the first acquisition thread obtains raw data packets from these network interfaces.

[0096] As an explanation and not a limitation, the location metadata may include the packet's starting address (i.e., the starting memory address of the packet in the network card buffer or kernel buffer) and the packet length (i.e., the actual number of bytes in the packet). In some embodiments, the first acquisition thread can perform the necessary protocol stack parsing and metadata extraction, but does not perform memory copy operations, thus enabling it to respond to network card interrupts at a very high frequency and ensuring that the network card's hardware buffer does not overflow and lose packets due to insufficient processing time.

[0097] In some embodiments, see Figure 5 Step S310 may include sub-steps S510, S250, and S530: S510: Acquires data packets from the network interfaces of multiple detectors.

[0098] In this embodiment, the first acquisition thread can cyclically acquire raw data packets from the network interface. In some embodiments, the raw data packets are acquired directly from the network card driver buffer, and their protocol stack has not yet been parsed.

[0099] S520: Parses the network protocol stack of data packets to determine whether the data packets conform to the preset protocol type.

[0100] In this embodiment of the application, the first acquisition thread can perform protocol stack parsing on the received raw data packets to filter out valid data packets that conform to a preset protocol type.

[0101] In some embodiments, see [reference]. Figure 6The above step S520 may further include the following steps S610, S620 and S630.

[0102] S610: The network protocol stack that parses data packets sequentially according to the multi-layer protocol order of the preset protocol type.

[0103] In this embodiment of the application, in step S610, the first acquisition thread unpacks the raw binary stream obtained from the network interface layer by layer. As an explanation, and not a limitation, the detectors of a digital PET system typically send data via an Ethernet UDP protocol stack. Therefore, in some embodiments, the preset protocol type is a multi-layer protocol combination of "Ethernet → Network Layer Protocol (IP) → User Datagram Protocol (UDP)". Accordingly, the multi-layer protocol order is to parse the Ethernet frame header, IP packet header, and UDP packet header sequentially.

[0104] S620: If the data packet meets the multi-layer protocol sequence, then the data packet is determined to conform to the preset protocol format.

[0105] Specifically, when a data packet can be successfully parsed in the above order and the header information of each protocol layer is complete, the system determines that the data packet conforms to the format requirements. For example, after successfully parsing the UDP header, the thread can further obtain information such as the length of the data packet and the address of its first byte.

[0106] S630: If a data packet does not meet the requirements of any layer in the multi-layer protocol sequence, the data packet is discarded, and it is determined that the data packet does not conform to the preset protocol format.

[0107] For example, if the parsing reveals that the data packet is not a UDP protocol (such as a TCP protocol or other broadcast packet), the first acquisition thread will directly discard the data packet without further processing.

[0108] In a further embodiment, business-level validity verification can also be performed on the data packets. For example... Figure 7 As shown, in some embodiments, step S310 may further include the following steps S710, S720, S730 and S740.

[0109] S710: Extract source address information from data packets.

[0110] In some embodiments, the source address information specifically includes IP address and port information. The first acquisition thread can extract the source IP address and source port number that sent the data packet from the parsed IP packet header and UDP packet header.

[0111] S720: Compare the source address information with the corresponding detector address information.

[0112] In this embodiment, the system pre-stores a list of valid detector addresses (e.g., the detector's IP configuration table). The thread compares the extracted source IP address and port with the preset detector address information.

[0113] S730: If they match, the data packet is determined to be a valid data packet.

[0114] When the extracted address information matches an item in the preset list, it indicates that the data packet indeed comes from the correct detector, and it can be marked as a valid data packet, allowing subsequent metadata extraction and storage operations.

[0115] S740: If there is a discrepancy, discard the data packet and determine that the data packet is invalid.

[0116] If the source address is not in the allowed list, it means the data packet may have come from an incorrect network source. In this case, the data packet should be discarded.

[0117] Therefore, through Figure 6 Protocol format checksum Figure 7 To verify the source address, this application embodiment constructs a dual filtering mechanism, which effectively eliminates non-detector data and abnormal format data, significantly improving the purity of data acquisition.

[0118] S530: Extract location metadata of data packets from data packets that conform to the preset protocol type according to the protocol format of the preset protocol type.

[0119] In some embodiments, after confirming that the data packet conforms to a preset protocol type, the first acquisition thread can extract the starting address and packet length information from the data packet according to the UDP protocol format. By way of explanation and not limitation, the UDP header contains a packet length field, which can be parsed to obtain the packet length; the starting address of the data packet is the starting address of the packet payload in memory, which can be obtained through pointer arithmetic.

[0120] Furthermore, in some embodiments, the first acquisition thread also employs a local caching strategy. Specifically, the first acquisition thread maintains a stack buffer, which can only be accessed by the first acquisition thread. After acquiring the location metadata (such as the packet's starting address, length, etc.) of a valid data packet, the thread does not immediately write it to a global first queue (such as a network interface card resource queue), but instead first writes the location metadata to the stack buffer. When the write volume of the stack buffer reaches a preset condition, multiple location metadata packets in the stack buffer are written to the first queue in batches. By way of explanation and not limitation, this preset condition can be that the stack buffer is full (for example, the buffer size is set to the capacity of 64 packet information packets). When the buffer is full, the first acquisition thread requests a write lock or semaphore for the first queue at once (as described below), and pushes the metadata of these 64 packets into the queue in batches.

[0121] Here, Figure 8 A flowchart illustrating the network interface card (NIC) thread workflow is shown as a specific example.

[0122] After the first acquisition thread starts, a continuous data acquisition loop will begin. This process specifically includes: First, determine if the program is in an exit state. If the program has not exited, the thread obtains a raw data packet from the network card hardware or driver.

[0123] Next, protocol stack verification and address matching verification are performed on the original data packet. (As mentioned earlier...) Figure 6 and Figure 7 The thread determines whether the data packet conforms to the IP / UDP protocol format under the Ethernet protocol stack, and further determines whether the parsed IPv4 address and port number match the preset detector configuration. If the protocol format does not conform or the address does not match, the data packet is discarded and the loop returns to the starting point to prepare to obtain the next packet.

[0124] Once the data packet is confirmed as a valid packet through the above verification, the first acquisition thread parses the UDP protocol data and obtains the packet length and the address of the first byte of the data field (i.e., the location metadata).

[0125] Here, the first acquisition thread writes the obtained packet length and first byte address into a local stack buffer. This local stack buffer is a private memory area that can only be accessed by the current first acquisition thread. It contains two array fields: packet start address and packet length. The capacity can be preset according to system performance (e.g., set to a capacity of 64 packet information).

[0126] Finally, the first acquisition thread determines whether the stack local buffer is full. If the stack local buffer is full, all data packet location metadata temporarily stored in the buffer is written in batches to the first queue (i.e., the network card resource queue) (as further described in step S320 below), and then the stack local buffer is cleared for reuse; if the stack local buffer is not full, it directly returns to the loop start point to continue receiving the next data packet.

[0127] S320: The location metadata is written to the first queue through the first acquisition thread.

[0128] In this embodiment, the first queue, such as a network interface card (NIC) resource queue, can transmit location metadata between the first acquisition thread (NIC thread) and the second acquisition thread (copy thread). For explanation, the first acquisition thread can act as a producer, writing the extracted location metadata into the first queue; the second acquisition thread can act as a consumer, reading the location metadata from the first queue and obtaining the actual payload of the data packet based on the location metadata.

[0129] As mentioned above, when the write volume of the stack buffer of the first acquisition thread reaches the preset condition (e.g., the stack buffer is full), the first acquisition thread writes multiple location metadata in the local stack buffer into the first queue in batches.

[0130] In this embodiment, the first queue is, for example, a circular queue. In some embodiments, the first queue may include a first queue array, a first atomic variable for identifying the write position of the first queue, a second atomic variable for identifying the read position of the first queue, a first queue read semaphore for identifying the amount of available data in the first queue, and a first queue write semaphore for identifying the amount of free slots in the first queue.

[0131] In some embodiments, the first queue array may include multiple data spaces for accessing location metadata. In one example, each data space is a slot in the first queue array for storing location metadata (including its starting address and length). In some embodiments, each data space may have a storage area (memory region) for accessing the location metadata, and each data space has a first data read semaphore and a first data write semaphore. Accordingly, the first data read semaphore and the first data write semaphore are used to control concurrent access to the data space, avoiding data contention caused by the first acquisition thread and the second acquisition thread accessing the same data space simultaneously. The initial value of the first data read semaphore is set to 0, indicating that the data space is initially empty and unreadable; the initial value of the first data write semaphore is set to 1, indicating that the data space is initially empty and writable.

[0132] In some embodiments, the first atomic variable may record the total number of writes to the first queue. When the first acquisition thread needs to write data to the first queue, a unique write sequence number can be obtained by performing an atomic increment operation on the first atomic variable, and the position of this write in the first queue array can be determined based on the sequence number. In one example, the initial value of the first atomic variable is set to 0.

[0133] In some embodiments, the second atomic variable may record the total number of reads from the first queue. When the second acquisition thread needs to read data from the first queue, it can obtain a unique read sequence number by performing an atomic increment operation on the second atomic variable, and determine the position of this read in the first queue array based on the sequence number. In one example, the initial value of the second atomic variable is set to 0.

[0134] In some embodiments, the first queue read semaphore can indicate how many data spaces in the first queue have been written to and are in a readable state. In one example, the initial value of the first queue read semaphore is set to 0, indicating that the first queue is initially empty.

[0135] In some embodiments, the first queue write semaphore can indicate how many data spaces in the first queue are free and writable. In one example, the initial value of the first queue write semaphore is set to the size of the first queue array (i.e., the total number of slots).

[0136] In some embodiments, reference Figure 9 Step 320 may include the following steps S910, S920 and S930.

[0137] S910: Obtain the first queue write semaphore to determine if there are any free slots in the first queue.

[0138] In this embodiment, the first acquisition thread may attempt to acquire the first queue write semaphore before writing data to the first queue. In this embodiment, this operation can be used, for example, to confirm whether there is free data space available for writing in the first queue.

[0139] In this embodiment, the first queue can implement automatic flow control based on semaphores: when the first queue is full (the first queue write semaphore is 0), the first acquisition thread will be blocked, waiting for the second acquisition thread to consume data. Correspondingly, when the first queue is empty (the first queue read semaphore is 0), the second acquisition thread will be blocked, waiting for the first acquisition thread to produce data, as further described below.

[0140] In some embodiments, reference Figure 10 Step S910 may include the following steps S1010 and S1020.

[0141] S1010: If the value of the first queue write semaphore is not greater than zero, the corresponding first acquisition thread enters a blocked state.

[0142] S1020: If the value of the write semaphore of the first queue is greater than zero, it means that the first queue has an empty slot.

[0143] If the value of the first queue write semaphore is not greater than zero, it indicates that the first queue is full, meaning there are no free slots. In this case, the thread can be suspended until the second acquisition thread reads data from the first queue and releases the first queue write semaphore, at which point the first acquisition thread will be awakened.

[0144] In some embodiments, the atomicity of semaphore acquisition operations (also known as P operations or wait operations) can be guaranteed by the operating system, so that even in a multi-threaded concurrent environment, there will be no race conditions caused by multiple threads acquiring the same semaphore at the same time.

[0145] S920: If there is a free slot, perform an atomic increment operation on the first atomic variable and obtain the value before the increment to determine the write position in the first queue.

[0146] In this embodiment, upon confirming that there is an available slot in the first queue, the first acquisition thread may perform an atomic increment operation on the first atomic variable. In some embodiments, the step of incrementing the value of the first atomic variable may simultaneously return the value before the increment. For explanation, the value before the increment is equal to the total number of writes to the first queue, reflecting how much data had been written to the first queue before this write.

[0147] In some embodiments, the step of determining the write position in the first queue may include performing a modulo operation between the value of the first atomic variable before increment and the size of the first queue array to obtain the index of the write position. As an explanation, and not a limitation, since the first queue is a circular queue, when the number of writes exceeds the array size, the modulo operation can be used to map it back to a valid index range.

[0148] S930: Write the location metadata into the data space of the first queue array corresponding to the write location.

[0149] In some embodiments, before writing the location metadata into the data space, a first data write semaphore of the data space corresponding to the write location can be obtained to ensure that the data space corresponding to the write location is not accessed by other threads (other first acquisition threads or second acquisition threads).

[0150] In some embodiments, after determining the index of the write location, the first acquisition thread can acquire a first data write semaphore for the data space at the index position in the first queue array. In this embodiment, acquiring the first data write semaphore ensures that the data space will not conflict with read operations during writing.

[0151] In some embodiments, after successfully acquiring the first data write semaphore, the first acquisition thread can write the location metadata (including the starting address and length) into the storage area of ​​the data space. In some embodiments, this write operation can be passed in via a callback function.

[0152] In some embodiments, as described above, the first acquisition thread can write multiple location metadata in batches.

[0153] In some embodiments, after data writing is completed, the first acquisition thread may sequentially release the first data read semaphore and the first queue read semaphore of the data space, so that the location metadata stored in the first queue can be read by the second acquisition thread. In some embodiments, if there is a second acquisition thread that is blocked because the first queue read semaphore is not greater than zero, the second acquisition thread may be automatically woken up so that it can read data from the first queue.

[0154] Here, Figure 11The flowchart of the write operation for the first queue is shown.

[0155] When the first acquisition thread needs to write location metadata to the first queue, it first attempts to acquire the write semaphore of the first queue. If the semaphore is not greater than zero, it indicates that the queue is full, and the thread automatically enters a blocked state; if the semaphore is greater than zero, it continues to execute subsequent operations.

[0156] Next, the first acquisition thread performs an atomic increment operation on the first atomic variable and retrieves the value before the increment. This value is equal to the total number of writes to the queue. Taking the remainder of this value with the size of the first queue array gives the index of the position where the write should occur.

[0157] Then, the thread attempts to acquire the first data write semaphore of the data space corresponding to the index position. This is to avoid concurrent conflicts caused by simultaneous access by read and write threads.

[0158] After successfully acquiring the semaphore, execute the function to write data, and write the location metadata to the storage area of ​​the data space.

[0159] Finally, the first data read semaphore and the first queue read semaphore of the data space at the index position are released sequentially. If a second acquisition thread is blocked because the read semaphore is not greater than zero, the thread is woken up, making the data space readable, and then the write operation is completed.

[0160] In this embodiment, through the above steps, the first acquisition thread (such as the network card thread) can efficiently write the location metadata of the data packets obtained from the network interface into the first queue, thereby preparing for subsequent processing by the second acquisition thread (copy thread). Since the first acquisition thread only handles lightweight metadata extraction and writing operations and does not involve copying the actual data payload, it can respond to network card interrupts at extremely high speed.

[0161] S330: Reads location metadata from the first queue through the second acquisition thread, and obtains the detection event data in the data packet based on the location metadata.

[0162] In this embodiment of the application, the second acquisition thread, such as the copy thread, can read the location metadata from the first queue and obtain the actual payload (i.e., probe event data) of the data packet from the network card buffer or kernel buffer based on this metadata.

[0163] In some embodiments, step S330 may include the following steps S1210, S1220 and S1230.

[0164] S1210: Obtain the first queue read semaphore to determine if there is available data in the first queue.

[0165] In some embodiments, reference Figure 13 Step S1210 may include the following steps S1310 and S1320.

[0166] S1310: If the value of the first queue read semaphore is not greater than zero, the corresponding second acquisition thread enters a blocked state.

[0167] S1320: If the value of the first queue read semaphore is greater than zero, then the first queue is determined to have available data.

[0168] S1220: If data is available, perform an atomic increment operation on the second atomic variable and obtain the value before the increment to determine the read position in the first queue for this read.

[0169] In this embodiment, step S1220 may include: performing a modulo operation between the value of the second atomic variable before increment and the size of the first queue array to obtain the index of the read position. Since the first queue is a circular queue, when the number of reads exceeds the array size, the modulo operation can be used to map it back to a valid index range.

[0170] S1230: Read the location metadata from the data space in the first queue array corresponding to the read position.

[0171] In some embodiments, before reading the location metadata from the data space, the method may further include: obtaining a first data read semaphore for the data space corresponding to the read location to ensure that the data space corresponding to the read location is not accessed by other threads.

[0172] In some embodiments, the step of obtaining location metadata from the first queue through the second acquisition thread may further include: after reading the location metadata from the data space corresponding to the read location, sequentially releasing the first data write semaphore and the first queue write semaphore of the data space, so that the data space can be written with new location metadata by the first acquisition thread. If any first acquisition thread is blocked because the first queue write semaphore is not greater than zero, the first acquisition thread is woken up.

[0173] Here, Figure 14 The flowchart illustrating the second acquisition thread's read operation from the first queue is shown. This read operation process is similar to that described above. Figure 11 The write operation processes shown are mirror images of each other.

[0174] When the second acquisition thread needs to read location metadata from the first queue, it first attempts to acquire the read semaphore of the first queue. If the semaphore is not greater than zero, it indicates that the queue is empty, and the thread automatically enters a blocked state; if the semaphore is greater than zero, it continues to execute subsequent operations.

[0175] Next, the second acquisition thread performs an atomic increment operation on the second atomic variable and retrieves the value before the increment. This value equals the total number of reads from the queue. Taking the remainder of this value with the size of the first queue array gives the index of the position to be read.

[0176] Then, the thread attempts to acquire the first data read semaphore of the data space corresponding to the index position. This is to avoid concurrent conflicts caused by simultaneous access by read and write threads.

[0177] After successfully acquiring the semaphore, the function for reading data is called to read the location metadata (including the starting address and length) from the data space.

[0178] Finally, the first data write semaphore and the first queue write semaphore of the data space at the index position are released in sequence. If the first acquisition thread is blocked because the write semaphore is not greater than zero, the thread is woken up, making the data space writable, and then the read operation is completed.

[0179] Through the above read operation process, the second acquisition thread can efficiently obtain location metadata from the first queue.

[0180] In this embodiment of the application, the step of obtaining the probe event data in the data packet according to the positioning metadata in step S330 may include: copying the data packet to the stack buffer of the second acquisition thread according to the starting address and length in the positioning metadata.

[0181] Specifically, the location metadata includes the address of the first byte of the data packet in the kernel buffer and the packet length information. The second acquisition thread uses this information to copy the actual payload of the data packet (probe event data) from the kernel buffer to the second acquisition thread's private stack buffer through a memory copy operation.

[0182] Furthermore, to improve writing efficiency, the second acquisition thread can adopt a batch writing strategy. When the amount of data written to the stack buffer reaches a preset condition (e.g., the stack buffer is full), the probe event data of multiple data packets in the stack buffer are written to a unified memory pool in batches.

[0183] Here, Figure 15 A complete workflow diagram of the second acquisition thread (such as the copy thread) is shown.

[0184] Once the copy thread starts, it will enter a continuous data processing loop. First, it will check whether the program has exited. If the program has exited, the thread will end; if the program has not exited, it will retrieve information (location metadata) from the network card resource queue (first queue).

[0185] Next, based on the acquired location metadata, the contents of the data packet are copied into the thread-private stack buffer.

[0186] Then, the memory occupied by network interface card (NIC) packets in the kernel buffer is released.

[0187] Then, it is determined whether the stack buffer is full. If the stack buffer is not full, the loop returns to the beginning to continue to obtain the next data packet; if the stack buffer is full, the data in the stack buffer is written in batches to a unified memory pool (as further described in step S340 below).

[0188] With this design, the copy thread can efficiently retrieve location metadata in batches from the first queue, copy the actual data to the private stack buffer, and write it to the unified memory pool in batches at the appropriate time, thereby improving the overall data processing throughput.

[0189] S340: The probe event data is written to a unified memory pool through the second acquisition thread.

[0190] In this embodiment of the application, the probe event data can be written to a unified memory pool through a second acquisition thread. As mentioned above, the unified memory pool may include a total write atomic variable for identifying the total number of data packets written, a spare atomic variable for identifying the number of remaining writable data packets, a full status atomic flag for identifying whether the unified memory pool is full, and a read-write lock for controlling concurrent access to write to or read from the unified memory pool.

[0191] See Figures 16 to 21 The step of writing the probe event data into a unified memory pool may include the following steps S1610 to S1650: S1610: Determine whether the unified memory pool is full based on the full status flag of the unified memory pool.

[0192] In some embodiments, the full status atomic flag of the unified memory pool can be checked before writing begins. If the flag is true, it indicates that the unified memory pool is full, and the write operation fails and terminates; if the flag is false, it indicates that the unified memory pool is not full, and the write operation can continue.

[0193] S1620: When the unified memory pool is not full, add a read lock to the read-write lock of the unified memory pool.

[0194] In this embodiment, the write operation of the unified memory pool allows multiple acquisition threads, such as a second acquisition thread (copy thread), to write in parallel. In some embodiments, a read-write lock mechanism can be used, and a read lock is acquired during the write phase.

[0195] In this embodiment of the application, in the scenario of writing and reading from a unified memory pool, a scheme of adding a read lock during writing and adding a write lock during reading is adopted to ensure data consistency and concurrency performance.

[0196] S1630: Perform an atomic operation on the total write atomic variable of the unified memory pool to determine the write position in the unified memory pool for this write.

[0197] In some embodiments, reference Figures 17 to 20 The above step S1630 may include the following steps S1710, S1720 and S1730.

[0198] S1710: Perform an atomic increment operation on the total write atomic variable, with the increment value being the number of data packets written this time.

[0199] In this embodiment, the second acquisition thread includes batch writing of multiple data packets. In some embodiments, the increment operation on the total write atomic variable includes incrementing the number of data packets written in this batch.

[0200] S1720: Get the value before increment returned by the atomic increment operation.

[0201] In some embodiments, the value before incrementing may represent the total number of data packets that have been written to the unified memory pool before this write, in other words, it may represent the sequence number of the starting packet for this write.

[0202] S1730: Determine the starting position of this write in the unified memory pool based on the value before increment.

[0203] In some embodiments, reference Figures 18 to 20 Step 1730 may include the following steps S1810 and S1820.

[0204] S1810: Perform a modulo operation between the value before increment and the size of the length array or offset array to obtain the write index of the length array or offset array.

[0205] In some embodiments, the packet number can be mapped back to a valid index range by performing a modulo operation between the value before increment and the size of the length array or offset array.

[0206] S1820: Use the write index of the length array and offset array as the starting position of this write in the unified memory pool.

[0207] Continue to refer to Figure 19 The step of writing the probe event data into a unified memory pool may further include steps S1910 and S1920: S1910: Before determining the write location, perform an atomic decrement operation on the empty atomic variables of the unified memory pool. The decrement value is the number of data packets to be written in this batch.

[0208] In this embodiment, step S1910 can be performed before step S1630. In some embodiments, the decrement operation can be used to "pre-deduct" the space required for this write operation. For explanation, the atomic decrement operation ensures that, in the case of concurrent multi-threaded writes, multiple threads will not simultaneously occupy more space than is actually available.

[0209] S1920: Get the value before the decrement returned by the atomic decrement operation to determine the current amount of free space in the unified memory pool.

[0210] In some embodiments, the value before the decrement may represent how many data packet slots are still available in the unified memory pool before this decrement operation.

[0211] Continue to refer to Figure 20 The step of writing the probe event data into a unified memory pool may further include steps S2010 and S2020: S2010: After determining the available space, determine whether the available space is not greater than the preset early stop threshold.

[0212] S2020: If the available space is not greater than the early stop threshold, then set the full status flag to true.

[0213] In this embodiment, an "early stop" mechanism is introduced to ensure the safety of multi-threaded concurrent writing. In some embodiments, the early stop threshold is not less than the product of the number of second acquisition threads and the maximum number of data packets written in a single instance.

[0214] As an explanation, and not a limitation, in a multi-threaded concurrent environment, multiple second-level acquisition threads may simultaneously pass the full-state check in step S1610, all considering the unified memory pool not full and starting to write. If the full-state flag is only set when the available space actually drops to 0 or a low value, these concurrent threads may all write data, causing the actual write volume to exceed the capacity of the unified memory pool. By introducing an early-stop mechanism and setting the full-state flag in advance (when the available space drops below the early-stop threshold), the risk of memory pool capacity overflow can be reduced even if multiple threads are writing simultaneously.

[0215] S1640: Write the probe event data to the write location.

[0216] In some embodiments, after determining the write position (the starting index of the length array and the offset array), the second acquisition thread begins the actual data writing operation.

[0217] In some embodiments, for each data packet written in this batch, the second acquisition thread performs the following operations: A1: Calculate the index of the data packet in the length array and offset array (starting index + current packet offset in the batch); A2: Write the actual length of the data packet to the corresponding position in the length array; A3: Calculate the starting offset of the data packet in the data array (based on the cumulative length of previously written data packets) and write it to the corresponding position in the offset array; A4: Copy the actual byte content of the data packet to the corresponding position in the data array.

[0218] Here, the length array and offset array record the metadata of each data packet, enabling subsequent read operations to accurately locate the length of each data packet and the starting position for reading.

[0219] S1650: Release the read lock of the read-write lock.

[0220] In some embodiments, after the data writing is complete, the previously acquired read lock can be released, allowing other threads to access the unified memory pool.

[0221] Here, Figure 21 The flowchart for the write operation of the unified memory pool is shown.

[0222] When the second acquisition thread needs to write the probe event data to the unified memory pool, it first checks whether the full state atomic flag is true. If the flag is true, it indicates that the memory pool is full, the write operation fails, and the process ends directly; if the flag is false, the subsequent operations continue.

[0223] Next, a read lock is added to the read-write lock to allow multiple write threads to write in parallel, while excluding concurrent access by read threads.

[0224] Then, the current free space and write position in the memory pool are calculated. The free space is calculated by atomically decrementing the free atomic variable to obtain the value before decrementing; the write position is calculated by atomically incrementing the total write atomic variable to obtain the value before incrementing.

[0225] Next, it is determined whether the available space is greater than the early stopping threshold. If the available space is not greater than the early stopping threshold, the full state atomic flag is set to true, indicating that the memory pool is full in a thread-safe manner; if the available space is greater than the early stopping threshold, the writing continues.

[0226] After passing the above checks, the data is written to the corresponding location in the memory pool, including updating the length array, offset array, and data array.

[0227] Finally, release the read lock on the read-write lock to end this write operation.

[0228] This concludes the complete process of writing the probe event data into the unified memory pool via the second acquisition thread. Through the detailed writing process described above, this embodiment of the application enables multiple second acquisition threads (copy threads) to concurrently, efficiently, and sequentially write probe event data from multiple detectors into the unified memory pool according to their arrival time.

[0229] In this application embodiment, in addition to providing the aforementioned asynchronous pipeline unified memory pool write-side (front-end) architecture (implemented by separating the first acquisition thread and the second acquisition thread), alternative solutions can also be provided to write detection event data from multiple detectors into a unified memory pool in the order of arrival time.

[0230] In some embodiments, reference Figure 22 Step S230, such as step S230', may include the following steps S2210 and S2220.

[0231] S2210: Data packets containing probe event data are obtained directly from the network interface connecting multiple detectors through multiple acquisition threads, and temporarily stored in the stack buffer of each acquisition thread.

[0232] In these embodiments, a single type of acquisition thread can simultaneously perform packet acquisition and data copying. Each acquisition thread directly acquires raw data packets from the network interface, performs protocol stack parsing and validity verification, extracts probe event data, and temporarily stores it in its own private stack buffer. In some embodiments, this single type of acquisition thread can, for example, simultaneously implement the functions of the aforementioned first acquisition thread (network card thread) and second acquisition thread (copy thread).

[0233] S2220: Writes probe event data from the stack buffers of multiple acquisition threads to a unified memory pool.

[0234] In some embodiments, when the stack buffer of the acquisition thread reaches a preset condition (e.g., the stack buffer is full), the acquisition thread writes the probe event data in the stack buffer to a unified memory pool in batches. In this embodiment, the specific process of writing to the unified memory pool is the same as the aforementioned step S340 (more specifically...). Figure 12 The scheme shown (i.e., steps S1210-S1230) is similar, including steps such as checking the full status flag, acquiring a read lock, performing atomic operations to determine the write position, writing data, and releasing the read lock, except that step S2220 is implemented through the acquisition thread of this embodiment. Therefore, steps S340, especially steps S1210-S1230, and related sub-steps, features, components, and embodiments can be combined here in a non-contradictory manner.

[0235] In other embodiments, reference is made to... Figure 23The step S230 can adopt a socket scheme, for example, it may include the following steps S2310 and S2320.

[0236] S2310: Receives data packets containing probe event data from a network interface that connects multiple detectors via a socket interface.

[0237] In some embodiments, the standard socket interface provided by the operating system can be used to receive data packets. Specifically, in some embodiments, data packets received by the network interface can be stored in a kernel buffer, and data packets can be retrieved from the kernel buffer by calling socket receive functions (such as recv() or recvfrom()).

[0238] S2320: Write the probe event data to a unified memory pool.

[0239] In some embodiments, after obtaining a data packet through a socket interface, the probe event data therein can be written to a unified memory pool. In this embodiment, the specific process of writing to the unified memory pool is the same as the aforementioned step S340 (more specifically). Figure 12 The scheme shown is similar to steps S1210-S1230, including steps such as checking the full status flag, acquiring a read lock, performing atomic operations to determine the write position, writing data, and releasing the read lock, except for... Figure 23 The solution of the illustrated embodiment is implemented via sockets. Therefore, S340, especially steps S1210-S1230 and related sub-steps, features, components, and embodiments can be incorporated herein in a non-contradictory manner.

[0240] In this embodiment, the multi-detector data acquisition method may further include a step S240 (not shown) of reading out detection event data: reading detection event data from the unified memory pool based on the storage location of the detection event data in the unified memory pool. In this embodiment, the storage location may be determined according to the arrival time order.

[0241] In some embodiments, the above-mentioned reading of probe event data can be performed using a timed reading method, so step S240 may include S240' (not shown): sequentially reading probe event data written in multiple consecutive time intervals from a unified memory pool.

[0242] It should be understood that step S240 (reading probe event data) is not a necessary step. In some embodiments, only the aforementioned data acquisition and writing steps (steps S210 to S230) may be performed, without reading the data immediately, for example, storing the data in a unified memory pool for subsequent offline analysis. In other embodiments, other reading methods different from the timing readout strategy described below may also be used, such as direct index reading based on packet sequence numbers.

[0243] In some embodiments, the current state of the unified memory pool (total writes and timestamps) can be periodically recorded by a marker thread, and a mapping relationship between time and storage location can be established.

[0244] In some embodiments, reference Figures 24 to 31 Step S240, such as S240', may include the following steps S2410, S2420, S2430 and S2440.

[0245] S2410: By marking threads, obtain the current total write volume and current time of the unified memory pool at preset time intervals.

[0246] In some embodiments, the marking thread may obtain the current total write volume and current time of the unified memory pool at preset time intervals, and write them as marking information into a second queue (such as a read-out marking queue).

[0247] In some embodiments, the marking thread may perform a marking operation at fixed time intervals (e.g., every second as set by the user). In this embodiment, at each marking moment, the marking thread may read the current value of the total write atomic variable of the unified memory pool, which represents the total number of data packets written to the unified memory pool from system startup to the current moment. In some embodiments, the marking thread may also record the timestamp of the current moment (e.g., a timestamp in milliseconds).

[0248] refer to Figure 25 This illustrates a specific example of the workflow of a marking thread, which may include the following steps: The marking thread first determines whether the program has ended. If the program has ended, the marking thread exits the loop and terminates its work; if the program has not ended, the marking thread continues to execute subsequent operations.

[0249] While the program is not terminated, the marking thread records the total amount of data written to the unified memory pool at the current moment (i.e., the current value of the total write atomic variable) and the current timestamp, and writes it to the second queue (as described below). This total amount of data written represents the total number of data packets that have been written to the unified memory pool from system startup to the current moment.

[0250] After recording is complete, the marking thread enters a waiting state, waiting for a preset time interval (e.g., 1 second). After the waiting time is up, the marking thread will restart the loop, check again whether the program has ended, and execute the next marking operation.

[0251] S2420: By marking the thread, write the marking information, including the current total write volume and the current time, into the second queue.

[0252] In some embodiments, the tagging thread can encapsulate the acquired current total write volume and current time into tagging information and write it to a second queue. In this embodiment, the tagging information is formatted, for example, as a data structure including a timestamp and a total write volume field.

[0253] In some embodiments, the second queue is a circular queue similar to the first queue.

[0254] In some embodiments, the second queue may include a second array, a third atomic variable for identifying the write position of the second queue, a fourth atomic variable for identifying the read position of the second queue, a second queue read semaphore for identifying the amount of available data in the second queue, and a second queue write semaphore for identifying the amount of free slots in the second queue.

[0255] In some embodiments, the second array may include multiple data spaces for accessing tag information. For explanation, each data space is a slot in the second array that can be used to store a tag information (including a timestamp and total writes). In some embodiments, each data space may have a second data read semaphore and a second data write semaphore. In one example, the initial value of the second data read semaphore is set to 0, and the initial value of the second data write semaphore is set to 1.

[0256] In some embodiments, the third atomic variable may record the total number of writes to the second queue, used to determine the position in the second array when the marking thread next writes marking information. In one example, the initial value of the third atomic variable is set to 0.

[0257] In some embodiments, the fourth atomic variable may record the total number of reads from the second queue, which can then be used to determine the position in the second array when the user thread next reads the marker information. In one example, the initial value of the fourth atomic variable is set to 0.

[0258] In some embodiments, the second queue read semaphore can indicate how many data spaces in the second queue have been written with tag information (are in a readable state). In one example, the initial value of the second queue read semaphore is set to 0.

[0259] In some embodiments, the second queue write semaphore can indicate how many data spaces in the second queue are free (in a writable state). In one example, the initial value of the second queue write semaphore is set to the size of the second array.

[0260] In some embodiments, reference Figure 26 Step 2420 may include the following steps S2610, S2620 and S2630.

[0261] S2610: Obtain the second queue write semaphore to determine if there are any free slots in the second queue.

[0262] In some embodiments, the marking thread may attempt to acquire the second queue write semaphore before writing the marking information. In some embodiments, if the value of the second queue write semaphore is not greater than zero, it indicates that the second queue is full and the marking thread enters a blocked state; if the value of the second queue write semaphore is greater than zero, it indicates that the second queue has free slots and the write operation can continue.

[0263] S2620: If there is a free slot, perform an atomic increment operation on the third atomic variable and obtain the value before the increment to determine the write position in the second queue.

[0264] In some embodiments, the marking thread can perform an atomic increment operation on the third atomic variable, and can also return the value before increment and perform a modulo operation between the value and the size of the second array to obtain the index position of the current write in the second array.

[0265] S2630: Write the tag information into the data space of the second array corresponding to the write position.

[0266] In some embodiments, the tagging information includes, for example, a timestamp and the total amount written. In some embodiments, after writing is complete, the second data read semaphore and the second queue read semaphore of the data space can be released in sequence, making the tagging information readable for data acquisition threads, such as user threads.

[0267] In the embodiments of this application, the write operation of the marker thread writing to the second queue can refer to the write operation of the first acquisition thread writing to the first queue, and its features, steps, composition and embodiments can be referred to in a non-contradictory manner.

[0268] S2430: Reads the tag information from the second queue through the data acquisition thread.

[0269] In some embodiments, reference Figure 27 Step S2430 may include the following steps S2710, S2720 and S2730.

[0270] S2710: Obtain the second queue read semaphore to determine if there is available data in the second queue.

[0271] In some embodiments, an attempt may be made to acquire the second queue read semaphore. In some embodiments, if the value of the second queue read semaphore is not greater than zero, it indicates that the second queue is empty, and the user thread enters a blocked state, waiting for the marking thread to write new marking information; if the value of the second queue read semaphore is greater than zero, it indicates that the second queue has available data, and the read operation can continue.

[0272] S2720: If data is available, perform an atomic increment operation on the fourth atomic variable and obtain the value before the increment to determine the read position in the second queue for this read.

[0273] In some embodiments, an atomic increment operation can be performed on the fourth atomic variable. In some embodiments, the value before increment can also be returned and moduloed by the size of the second array to obtain the index position of the current read in the second array.

[0274] S2730: Read the marker information from the data space in the second array corresponding to the read position.

[0275] In some embodiments, for example, after determining the read position, the second data read semaphore of the data space corresponding to that position can be acquired first to ensure that the data space has been written with valid data. Then, the tag information (including timestamp and total write amount) is read from the storage area of ​​the data space. After the read is completed, the second data write semaphore and the second queue write semaphore of the data space are released in sequence, making the data space writable for the tagging thread to write new tag information.

[0276] In the embodiments of this application, the read operation of the data acquisition thread reading from the second queue can refer to the read operation of the second acquisition thread reading from the first queue, and its features, steps, composition and embodiments can be referred to in a non-contradictory manner.

[0277] S2440: Through the data acquisition thread, probe event data written in multiple consecutive time intervals are read sequentially from a unified memory pool based on the tag information.

[0278] In this embodiment of the application, the continuous time interval can be determined based on the current timestamp and the previous timestamp of the marker information.

[0279] In this embodiment of the application, the data of the probe event can be read sequentially by time period by reading the tag information from the second queue in turn and determining the storage location range of the data in the unified memory pool within the corresponding time interval based on the tag information.

[0280] In some embodiments, see Figure 28 Step S2440 may include the following steps S2810, S2820, S2830 and S2840.

[0281] S2810: Adds a write lock to the read-write lock of the unified memory pool.

[0282] In some embodiments, a write lock can be acquired on the read-write lock before reading data from the unified memory pool. By way of explanation and not limitation, acquiring a write lock ensures that all secondary acquisition threads (copy threads) cannot write data to the unified memory pool during data reading, thereby guaranteeing the consistency of the read data.

[0283] S2820: Obtain the tag information from the second queue, and determine the storage location range of the probe event data to be read this time based on the tag information obtained this time and the tag information obtained last time.

[0284] In some embodiments, the tagging information may include the current timestamp and the current total write volume index(n). In some embodiments, tagging information from the last read may also be retained, including the last timestamp and the last total write volume index(n-1).

[0285] In some embodiments, the storage location range for this read can be determined based on the total write volume in the currently acquired tag information and the total write volume in the previously acquired tag information. In one example, the total write volume index(n-1) in the previously acquired tag information can be used as the starting position for this read; and the total write volume index(n) in the currently acquired tag information can be used as the ending position for this read. Therefore, the storage location range for this read is [index(n-1), index(n)), representing all data packets with sequence numbers from index(n-1) to index(n)-1.

[0286] S2830: Read probe event data from a unified memory pool based on the storage location range.

[0287] After determining the storage location range, the user thread reads all data packets within that range from the unified memory pool. As mentioned earlier, the unified memory pool consists of a data array, a length array, and an offset array. The user thread can extract the corresponding data from these three arrays based on the storage location range.

[0288] In some embodiments, since the length array and offset array adopt a circular array structure, the user thread can map the storage location range (represented by packet sequence number) to the effective index range of the length array and offset array through a modulo operation. Then, based on this index range, the user thread sequentially obtains the length information of each data packet from the length array and the starting position information of each data packet in the data array from the offset array. Finally, based on the obtained offset and length information, the user thread reads the actual byte content of the probe event data packet by packet from the data array.

[0289] In some specific embodiments, reference is made to Figure 29Step S2830 may include the following steps S2910, S2920, S2930 and S2940.

[0290] S2910: Perform a modulo operation between the storage location range and the size of the length array or offset array to obtain the read index range of the length array and offset array.

[0291] As an explanation rather than a limitation, since the length array and offset array are circular arrays, when the packet number exceeds the array size, it can be mapped to a valid index range using the modulo operation.

[0292] S2920: Based on the read index range, obtain the length of each data packet from the corresponding position in the length array.

[0293] In some specific embodiments, for each index i in the read index range, the length of the data packet stored at the i-th position of the length array is read, denoted as length[i].

[0294] S2930: Based on the read index range, obtain the starting offset of each data packet in the data array from the corresponding position in the offset array.

[0295] In some specific embodiments, for each index i within the read index range, the offset stored at that position is read from the i-th position of the offset array, denoted as offset[i]. This offset represents the offset of the first byte of the i-th data packet relative to the start position of the data array.

[0296] S2940: Read the probe event data of each data packet from the data array based on the offset and length of each data packet.

[0297] In some embodiments, for each index within the read index range, the user thread first obtains the packet length corresponding to the index from the length array, then obtains the starting offset of the packet corresponding to the index in the data array from the offset array, and finally reads the probe event data of the packet from the data array based on the starting offset and the packet length.

[0298] Specifically, for index i: the starting address of the data packet = the starting address of the data array + offset[i]; the byte range of the data packet = [starting address, starting address + length[i]). The user thread reads the probe event data of the data packet from this byte range.

[0299] S2840: Release the write lock of the read-write lock.

[0300] In this embodiment of the application, after the data reading is completed, the user thread releases the write lock of the previously acquired read-write lock, so that the second acquisition thread can continue to write new data to the unified memory pool.

[0301] See Figure 30 In some embodiments, before adding a write lock to the read-write lock of the unified memory pool, step S2440 may also include step B1: the user thread may also release the storage space occupied by the probe event data read last time according to the amount of data read last time, which may specifically include the following steps S3010 and S3020.

[0302] S3010: Determine if the number of data packets read last time is greater than zero.

[0303] In this embodiment, if this is the first time a user thread reads data, the number of data packets read previously is 0, and no space needs to be released. If at least one read has already been performed, the number of data packets read previously is greater than zero.

[0304] S3020: If the number of data packets read last time is greater than zero, then perform an atomic increment operation on the empty atomic variable of the unified memory pool, with the increment value being the number of data packets read last time, and set the full state atomic flag of the unified memory pool to false.

[0305] In this embodiment, by performing an atomic increment operation on the available atomic variables, the number of slots occupied by the previously read data packets is returned to the unified memory pool, making these slots available again and allowing write threads to reuse the previously read storage space. Simultaneously, because the number of available slots increases, the unified memory pool is no longer full, so the full-state atomic flag is set to false, allowing blocked write threads to continue writing data.

[0306] refer to Figure 31 This illustrates a specific example of the read operation flow of a unified memory pool.

[0307] First, release the storage space used in the last read. At the start of a read operation, the user thread first determines the number of data packets read in the last read. If the number of data packets read in the last read is greater than zero (i.e., at least one read operation has been performed), then an atomic increment operation is performed on the available atomic variable in the unified memory pool, incrementing it by the number of data packets read in the last read.

[0308] If this is the first read (the number of data packets read last time was zero), skip this step and proceed directly to the next step.

[0309] Secondly, a write lock is added to the read-write lock to exclude concurrent access from all write threads, ensuring that during data reading, all secondary acquisition threads (copy threads) cannot write data to the unified memory pool.

[0310] Next, the tag information is retrieved from the read tag queue, and the read result is obtained. The user thread retrieves the tag information from the read tag queue (second queue). This tag information includes the timestamp of the tagging time and the total write volume index(n) of the unified memory pool at that time. The user thread also retains the total write volume index(n-1) recorded at the last read. Based on the total write volume index(n) obtained this time and the total write volume index(n-1) recorded last time, the storage location range for this read is determined to be [index(n-1), index(n)].

[0311] Next, the user thread retrieves the read results. Since the unified memory pool consists of three arrays: a data array, a length array, and an offset array, the user thread can extract data from these three arrays. Specifically, this includes: First, perform a modulo operation between the storage location range [index(n-1), index(n)) and the size of the length array (or offset array) to obtain the read index range of the length array and the offset array.

[0312] Second, for each index within the read index range, obtain the data packet length L corresponding to that index from the length array, and obtain the starting offset O of the data packet corresponding to that index in the data array from the offset array.

[0313] Third, based on the offset O and length L, read the actual byte content of the data packet from the data array. The byte range of the data packet is from the starting address offset O to the starting address offset O+L (left-closed, right-open interval) of the data array.

[0314] Using the above method, the user thread calculates and reads the address and length of the first byte of the target data segment packet by packet, thereby obtaining the complete read result.

[0315] Finally, the read-write lock is released. After completing the data reading, the user thread releases the write lock of the previously acquired read-write lock, allowing the second collection thread to continue writing new data to the unified memory pool.

[0316] This completes the read operation.

[0317] The above describes a multi-detector data acquisition method according to numerous embodiments of this application. This multi-detector data acquisition method can efficiently acquire and store detection event data from multiple detectors into a unified memory pool.

[0318] In this application embodiment, a conformity processing method is also provided, see [link to relevant documentation]. Figure 32 The compliance processing method provided in this application embodiment may include: S3210: Employs a multi-detector data acquisition method to write detection event data acquired from multiple detectors of the imaging device into a unified memory pool.

[0319] In this embodiment, in step S3210, the multi-detector data acquisition method described in the foregoing embodiments can be used to write the detection event data acquired from multiple detectors of the imaging device (e.g., a fully digital PET scanner) into a unified memory pool in chronological order of arrival. As mentioned above, the detection event data is stored continuously in the unified memory pool according to the time order in which the data packets arrive at the computer system, and detection events with similar arrival times are also adjacent in physical memory address.

[0320] S3220: Performs conformance processing on the probe data written to the unified memory pool to obtain conformance event data.

[0321] After the probe event data is written to a unified memory pool, the matching processing module performs matching processing on this data. In some embodiments, the matching processing includes reading the probe event data from the unified memory pool and performing time matching and energy matching. Specific matching processing methods can be any known or novel matching processing methods, which will not be elaborated here. However, since the probe event data in this embodiment is stored in the unified memory pool in order of arrival time, and data with similar times are physically adjacent, the matching processing algorithm can use an efficient sequential scanning method to search for matching event candidates in adjacent memory regions. This eliminates the need for multi-way merge sorting of data from different detectors and reduces the data merging, thread copying, or global traversal that other schemes might require. This significantly improves the efficiency of matching processing and reduces the computational and bandwidth overhead during matching processing.

[0322] See Figure 33 Another embodiment of this application also provides a conformity processing method, including: S3310: Obtain probe event data stored in a unified memory pool, wherein the probe event data is stored in the unified memory pool in order of arrival time.

[0323] In this embodiment, the unified memory pool already stores probe event data arranged in chronological order of arrival. This data is written to the unified memory pool, for example, by the aforementioned multi-detector data acquisition method, but this application is not limited thereto.

[0324] S3320: Based on the spatial-temporal relationship between the storage location and arrival time of the detected event data, perform conformance processing on the detected event data to obtain conformance event data.

[0325] In this embodiment, since the detected event data is stored in order of arrival time, and data with similar arrival times are adjacent in physical address, the matching processing algorithm can also obtain the above-mentioned spatial-temporal relationship. Figure 32 The illustrated embodiments offer numerous benefits.

[0326] Through the above-described conformance processing method, the embodiments of this application have achieved optimization from the acquisition of detection event data to conformance processing.

[0327] In this application embodiment, an image reconstruction algorithm is also provided.

[0328] See Figure 34 This application provides a reconstruction method, including: S3410: Using a multi-detector data acquisition method, detection event data acquired from multiple detectors of the imaging device is written into a unified memory pool.

[0329] In this embodiment of the application, in step S3410, the multi-detector data acquisition method described in the foregoing embodiment can be used to write the detection event data obtained from multiple detectors of the imaging device (e.g., a fully digital PET scanner) into a unified memory pool in the order of arrival time, which will not be elaborated here.

[0330] S3420: Perform conformance processing on the probe data written to the unified memory pool to obtain conformance event data.

[0331] In the embodiments of this application, the features of this step can be referred to in step S3220, and will not be repeated here.

[0332] S3430: Use a preset reconstruction algorithm to reconstruct the image from the event data to obtain the reconstructed image.

[0333] After obtaining the event data, image reconstruction can be performed on this data using a preset reconstruction algorithm. In the embodiments of this application, the reconstruction algorithm may include, but is not limited to, analytical reconstruction algorithms (such as the filtered back projection FBP algorithm), iterative reconstruction algorithms (such as the maximum likelihood expectation maximization MLEM algorithm, the ordered subset expectation maximization OSEM algorithm, etc.), or deep learning-based reconstruction algorithms.

[0334] See Figure 35 Another embodiment of this application provides a reconstruction method, including: S3510: Obtain probe event data stored in a unified memory pool, wherein the probe event data is stored in the unified memory pool in order of arrival time.

[0335] In the embodiments of this application, the features of this step can be referred to step S3310, and will not be repeated here.

[0336] S3520: Based on the spatial-temporal relationship between the storage location and arrival time of the detected event data, perform conformance processing on the detected event data to obtain conformance event data.

[0337] In the embodiments of this application, the features of this step can be referred to step S3320, and will not be repeated here.

[0338] S3530: Use a preset reconstruction algorithm to reconstruct the image from the event data to obtain the reconstructed image.

[0339] In the embodiments of this application, the features of this step can be referred to in step S3430, and will not be repeated here.

[0340] Through the reconstruction method described above, the embodiments of this application realize the optimization of the entire process from detection event data acquisition and coincidence processing to image reconstruction, providing an efficient and high-quality data processing and image reconstruction solution for all-digital PET imaging systems.

[0341] Accordingly, the solutions provided in the embodiments of this application can have many beneficial effects.

[0342] (1) In traditional multi-detector data acquisition schemes, each detector is typically allocated an independent buffer. When data needs to be read in chronological order, the user thread must access multiple buffers simultaneously, continuously comparing the timestamps of the data at the head of different buffers to find the earliest data output. The computational complexity of this multi-way merge sort algorithm increases with the number of detectors, and the more detectors there are, the more severe the performance degradation. This application embodiment achieves "writing as sorting" and "writing as merging" through a unified memory pool architecture. When data from multiple detectors arrive concurrently, this application embodiment, through a unified memory pool architecture combined with a concurrent write mechanism controlled by atomic operations, ensures that the data arriving first obtains a smaller write position, and the data arriving later obtains a larger write position. This allows the data to be naturally stored in the unified memory pool in chronological order of arrival, significantly reducing the sorting cost of post-processing after reading the detector data, and reducing or eliminating the computational overhead of multi-way merge sort.

[0343] (2) In the method of this application embodiment, when the user thread reads the data, the data can be directly handed over to the address of the user data area without copying it. The locking mechanism is used to prevent other threads from modifying the current area. The user can directly use this memory area, avoiding the extra overhead of copying data from the buffer to the user space in the traditional solution and reducing memory bandwidth usage.

[0344] In particular, in coincidence event processing for PET imaging, it is necessary to find the responses of different detectors within a very short time window. Traditional methods store data in blocks by detector, requiring the aggregation of data from different detectors but with similar timings into a unified processing buffer before coincidence processing, introducing additional data transfer overhead. In this embodiment, data is stored sequentially in a unified memory pool, with data from similar timings naturally adjacent in physical address. The coincidence processing algorithm can directly access data in-place within the unified memory pool, eliminating the intermediate data aggregation and copying steps, reducing memory bandwidth usage, and improving coincidence processing efficiency.

[0345] (3) In traditional solutions, data is scattered across multiple independent buffers, requiring access to jump between different physical memory regions during reading. This random access mode leads to frequent processor cache invalidation and low memory access efficiency. In this embodiment, data is stored compactly and continuously in a unified memory pool in chronological order, transforming read operations into sequential memory access. Thus, the unified memory pool method improves memory utilization efficiency. The method in this embodiment can ideally utilize pre-allocated memory, especially under conditions where different detectors have varying detection efficiencies. It significantly reduces memory access latency and improves data processing efficiency.

[0346] (4) The preferred method in this application embodiment can offload the network card load to a separate thread, avoiding the thread being responsible for both copying data and retrieving data from the network card, thus improving the network card utilization efficiency under high load conditions. The first acquisition thread (such as the network card thread) only performs lightweight protocol parsing and metadata extraction, which can quickly respond to network card interrupts and avoid packet loss caused by network card hardware buffer overflow. The data copying work is completed independently by the second acquisition thread (such as the copy thread), realizing pipelined parallel processing of receiving and copying.

[0347] (5) By employing a timed readout strategy, the generated data does not require subsequent global traversal to meet the needs of dynamic imaging, making it suitable for efficient access to large-scale data. The marking thread records the total write volume and timestamp of a unified memory pool at preset time intervals, establishing a direct mapping relationship between time and storage location. This ensures that the generated data does not require subsequent global traversal to meet the needs of dynamic imaging, making it suitable for efficient access to large-scale data.

[0348] In the embodiments of this application, reference is made to Figure 36Furthermore, a multi-detector data acquisition system 3600 is provided, which may include: a unified memory pool 3610, a data receiving unit 3620, and a data writing unit 3630. The unified memory pool 3610 is configured to store detection event data from multiple detectors of an imaging device; the data receiving unit 3620 is configured to continuously receive detection event data from the multiple detectors; and the data writing unit 3630 is configured to write the detection event data from the multiple detectors into the unified memory pool in order of arrival time.

[0349] In some embodiments, the unified memory pool 3610 may include: a total write atomic variable for identifying the total number of written data packets; a spare atomic variable for identifying the number of remaining writable data packets; a full status atomic flag for identifying whether the unified memory pool is full; and a read-write lock for controlling concurrent access to write to or read from the unified memory pool.

[0350] In some embodiments, the unified memory pool 3610 may further include: a memory pool data array for storing probe event data; a length array for storing the length of each data packet; and an offset array for storing the starting position of each data packet in the data array.

[0351] In some embodiments, reference Figure 37 The multi-detector data acquisition system 3600 may further include: a data reading unit 3640, used to read detection event data from the unified memory pool based on the storage location of the detection event data in the unified memory pool, wherein the storage location is determined according to the arrival time order.

[0352] In some embodiments, reference Figure 38 The multi-detector data acquisition system 3600, such as the data receiving unit 3620, may further include a first acquisition module 3621 and a second acquisition module 3622; the data writing unit 3630 may further include a first writing module 3631 and a second writing module 3632. Specifically, the first acquisition module 3621 is configured to acquire location metadata of data packets from each network interface connecting the multiple detectors via a first acquisition thread; the first writing module 3631 is configured to write the location metadata into a first queue via the first acquisition thread; the second acquisition module 3622 is configured to read the location metadata from the first queue via a second acquisition thread and acquire detection event data from the data packets based on the location metadata; the second writing module 3632 is configured to write the detection event data into the unified memory pool via the second acquisition thread.

[0353] In some embodiments, reference Figure 39The multi-detector data acquisition system 3600, such as the data receiving unit 3620, may further include: a third acquisition module 3623 and a fourth acquisition module 3624; the data writing unit 3630 may further include a third writing module 3633 and a fourth writing module 3634. The third acquisition module 3623 is configured to acquire the current total write volume and current time of the unified memory pool at preset time intervals via a marking thread; the third writing module 3633 is configured to write marking information including the current total write volume and current time into a second queue via the marking thread; the fourth acquisition module 3624 is configured to read the marking information from the second queue via a data acquisition thread; the fourth writing module 3634 is configured to sequentially read detection event data written within the multiple consecutive time intervals from the unified memory pool according to the marking information via the data acquisition thread, wherein the consecutive time intervals are determined based on the current time of the marking information.

[0354] In the embodiments of this application, reference is made to Figure 40 Furthermore, a coincidence event processing system 4000 is provided, which may include: a multi-detector data acquisition system 4010 and a coincidence processing module 4020. The multi-detector data acquisition system 4010 is the multi-detector data acquisition system according to any embodiment of this application; the coincidence processing module 4020 is configured to perform coincidence processing on the probe data written to a unified memory pool to obtain coincidence event data.

[0355] In the embodiments of this application, reference is made to Figure 41 Furthermore, a conformance event processing system 4100 is provided, which may include: a unified memory pool 4110 and a conformance processing module 4120. The unified memory pool 4110 is configured to store probe event data, wherein the probe event data is stored in the unified memory pool in order of arrival time; the conformance processing module 4120 is configured to perform conformance processing on the probe event data according to the spatial-temporal relationship between the storage location and arrival time of the probe event data to obtain conformance event data.

[0356] In the embodiments of this application, reference is made to Figure 42 Furthermore, a reconstruction system 4200 is provided, which may include: a multi-detector data acquisition system 4210, a coincidence processing module 4220, and a reconstruction module 4230. The multi-detector data acquisition system 4210 is the multi-detector data acquisition system according to any embodiment of this application; the coincidence processing module 4220 is configured to perform coincidence processing on the detection data written to a unified memory pool to obtain coincidence event data; the reconstruction module 4230 is configured to perform image reconstruction on the coincidence event data using a preset reconstruction algorithm to obtain a reconstructed image.

[0357] In the embodiments of this application, reference is made to Figure 43 A reconstruction system 4300 is also provided, which may include: a unified memory pool 4310, a conformance processing module 4320, and a reconstruction module 4330. The unified memory pool 4310 is configured to store probe event data, wherein the probe event data is stored in the unified memory pool in order of arrival time; the conformance processing module 4320 is configured to perform conformance processing on the probe event data according to the spatial-temporal relationship between the storage location and arrival time of the probe event data to obtain conformance event data; the reconstruction module 4330 is configured to perform image reconstruction on the conformance event data using a preset reconstruction algorithm to obtain a reconstructed image.

[0358] In this application embodiment, an imaging device is also provided, which may include a multi-detector data acquisition system according to any embodiment of this application, a coincidence event processing system according to any embodiment of this application, or a reconstruction system according to any embodiment of this application.

[0359] The steps and sub-steps described in the embodiments of this application can be executed independently or separately, or they can be combined or merged without contradiction. Furthermore, the order of steps in the embodiments of this application is not absolutely limited; the execution order of some steps can be adjusted or they can be executed in parallel according to actual needs, provided that the technical solution is not affected.

[0360] The steps, sub-steps, and features of the methods described in the embodiments of this application can be combined with the system of the system embodiments of this application in a non-contradictory manner to obtain new embodiments. Conversely, the components, modules, units, or features of the system described in the system embodiments of this application can also be combined with the methods of the method embodiments of this application in a non-contradictory manner to obtain new embodiments.

[0361] In this application embodiment, an electronic device is also provided, which may include a processor and a memory storing a computer program, the processor being configured to execute the method of any embodiment of this application when running the computer program.

[0362] Figure 44 A schematic diagram of an exemplary electronic device 4400 that can implement the methods of embodiments of this application is shown. In some embodiments, it may include more or fewer electronic devices than shown. In some embodiments, it may be implemented using a single or multiple electronic devices. In some embodiments, it may be implemented using cloud-based or distributed electronic devices.

[0363] like Figure 44As shown, the electronic device 4400 includes a processor 4401, which can perform various appropriate operations and processes based on programs and / or data stored in read-only memory (ROM) 4402 or programs and / or data loaded from storage portion 4408 into random access memory (RAM) 4403. The processor 4401 can be a single-core or multi-core processor, or may contain multiple processors. In some embodiments, the processor 4401 may include a general-purpose main processor (such as a CPU) and one or more special coprocessors, such as a graphics processing unit (GPU), a neural network processor (NPU), a digital signal processor (DSP), or other general-purpose or application-specific integrated circuits. Various programs and data required for the operation of the electronic device 4400 are also stored in RAM 4403. The processor 4401, ROM 4402, and RAM 4403 are interconnected via bus 4404. An input / output (I / O) interface 4405 is also connected to bus 4404.

[0364] The processor and memory described above are used together to execute a program stored in the memory. When the program is executed by a computer, it can implement the steps or functions of the methods described in the above embodiments.

[0365] The following components are connected to I / O interface 4405: an input section 4406 including a keyboard, mouse, etc.; an output section 4407 including a monitor and speakers, etc.; a storage section 4408 including a hard disk, etc.; and a communication section 4409 including a network interface card such as a LAN card and a modem, etc. The communication section 4409 performs communication processing via a network such as the Internet. Drive 4410 is also connected to I / O interface 4405 as needed. Removable media 4411, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 4410 as needed so that computer programs read from them can be installed into storage section 4408 as needed.

[0366] Figure 44 The electronic device shown is merely illustrative, but the electronic device according to embodiments of this application may include more than [other components]. Figure 44 The electronic device shown has more or fewer components or has more or fewer components than the one shown. Figure 44 The embodiments shown have the same, partially the same, or different architectures.

[0367] In the embodiments of this application, the electronic device can also be combined with various components to obtain methods, apparatus and systems with the advantages of this application.

[0368] Although not shown, this application also provides a computer-readable storage medium storing a computer program configured to execute the methods of any of the embodiments of this application. The computer program includes various program modules / units constituting the apparatus according to the embodiments of this application. When executed, the computer program, composed of the various program modules / units, can perform the functions corresponding to the various steps in the methods described in the above embodiments. The computer program can also run on electronic devices as described in the embodiments of this application.

[0369] Although not shown, some embodiments also provide a program product comprising a computer program configured to be run to perform the methods of any of the embodiments of this application.

[0370] The storage medium in embodiments of this application includes non-volatile and / or volatile articles that can store information by any method or technology. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.

[0371] Those skilled in the art will understand that the embodiments of this specification can be implemented in various forms, such as methods, systems, or computer program products. Therefore, those skilled in the art will realize that the functional modules / units or controllers and related method steps described in the above embodiments can be implemented in software, hardware, or a combination of software and hardware.

[0372] Unless explicitly stated otherwise, the actions or steps of the methods and procedures described in the embodiments of this application do not necessarily have to be performed in a specific order and can still achieve the desired results. In some implementations, multitasking and parallel processing are also possible or may be advantageous.

[0373] This document describes several embodiments, but for the sake of brevity, the descriptions of the embodiments are not exhaustive, and identical or similar features or parts between the embodiments may be omitted. In this document, "one embodiment," "some embodiments," "example," "specific example," or "some examples" refers to at least one embodiment or example applicable to this application, but not all embodiments. The above terms do not necessarily mean referring to the same embodiment or example. Without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of the different embodiments or examples.

[0374] The exemplary systems and methods of this application have been specifically shown and described with reference to the above embodiments, which are merely examples of the best mode for implementing the systems and methods. Those skilled in the art will understand that various changes can be made to the embodiments of the systems and methods described herein without departing from the spirit and scope of this application as defined in the appended claims when implementing the systems and / or methods.

Claims

1. A multi-detector data acquisition method, characterized in that, include: Provides a unified memory pool for multiple detectors in imaging devices; Continuously receive detection event data from the multiple detectors; The detection event data from the multiple detectors are written into the unified memory pool in order of arrival time.

2. The method according to claim 1, characterized in that, The unified memory pool includes: A total write atomic variable used to identify the total number of data packets written; Empty atomic variables used to identify the number of remaining writable data packets; A full status atomic flag used to identify whether the unified memory pool is full; and A read-write lock used to control concurrent access to write to or read from the unified memory pool.

3. The method according to claim 2, characterized in that, The unified memory pool also includes: A memory pool data array used to store probe event data; A length array used to store the length of each data packet; and An array used to store the offset of the starting position of each data packet in the data array.

4. The method according to claim 1, characterized in that, The step of writing the detection event data from the multiple detectors into the unified memory pool in order of arrival time includes: The first acquisition thread obtains the location metadata of data packets from each network interface connecting the multiple detectors. The location metadata is written to the first queue through the first acquisition thread; The second acquisition thread reads the location metadata from the first queue and obtains the detection event data in the data packet based on the location metadata; and The second acquisition thread writes the detected event data into the unified memory pool.

5. The method according to claim 4, characterized in that, The step of acquiring location metadata from each network interface connecting the multiple detectors via the first acquisition thread includes: Data packets are acquired from the network interfaces of the multiple detectors; The network protocol stack of the data packet is parsed to determine whether the data packet conforms to a preset protocol type; According to the protocol format of the preset protocol type, the location metadata of the data packet is extracted from the data packet that conforms to the preset protocol type.

6. The method according to claim 5, characterized in that, The network protocol stack for parsing data packets to determine whether the data packet conforms to a preset protocol type includes: The network protocol stack of the data packet is parsed sequentially according to the multi-layer protocol order of the preset protocol type; If the data packet satisfies the multi-layer protocol order, then the data packet is determined to conform to the preset protocol format; If the data packet does not satisfy any layer of the multi-layer protocol sequence, the data packet is discarded.

7. The method according to claim 5, characterized in that, The step of acquiring location metadata from each network interface connecting the multiple detectors via the first acquisition thread also includes: Perform validity checks on data packets that conform to the preset protocol type to determine whether the data packet is a valid data packet, specifically including: Extract source address information from the data packet; Compare the source address information with the corresponding detector address information; If they match, the data packet is determined to be a valid data packet. If there is a discrepancy, the data packet is discarded.

8. The method according to claim 4, characterized in that, The step of acquiring location metadata from each network interface connecting the multiple detectors via the first acquisition thread also includes: Write the location metadata into the stack buffer of the first acquisition thread; The step of writing the location metadata into the first queue through the first acquisition thread includes: When the write volume of the stack buffer of the first acquisition thread reaches a preset condition, multiple location metadata in the local stack buffer are written to the first queue in batches.

9. The method according to claim 4, characterized in that, The first queue is a circular queue, and the first queue includes: A first queue array, comprising multiple data spaces for accessing the location metadata, each data space having a first data read semaphore and a first data write semaphore; A first atomic variable used to identify the write position of the first queue; A second atomic variable used to identify the read position of the first queue; A first queue read semaphore used to identify the amount of available data in the first queue; A first queue write semaphore used to identify the number of free slots in the first queue.

10. The method according to claim 9, characterized in that, The step of writing the location metadata into the first queue through the first acquisition thread includes: Obtain the write semaphore for the first queue to determine if there are any free slots in the first queue; If there is a free slot, perform an atomic increment operation on the first atomic variable and obtain the value before the increment to determine the write position in the first queue for this write. The location metadata is written into the data space of the first queue array corresponding to the writing location.

11. The method according to claim 10, characterized in that, Determining the write position in the first queue for this write operation includes: The index of the write position is obtained by performing a modulo operation between the value of the first atomic variable before increment and the size of the first queue array.

12. The method according to claim 10, characterized in that, Before writing the location metadata into the data space corresponding to the writing location, the step of writing the location metadata into the first queue through the first acquisition thread further includes: Obtain the first data write semaphore of the data space corresponding to the write position to ensure that the data space corresponding to the write position is not accessed by other threads.

13. The method according to claim 10, characterized in that, The step of obtaining the write semaphore of the first queue to determine whether the first queue has an empty slot includes: If the value of the first queue write semaphore is not greater than zero, the corresponding first acquisition thread enters a blocked state; If the value of the write semaphore of the first queue is greater than zero, then it is determined that the first queue has an empty slot.

14. The method according to claim 10, characterized in that, The step of writing the location metadata into the first queue through the first acquisition thread further includes: After writing the location metadata into the data space corresponding to the writing location, the first data read semaphore and the first queue read semaphore are released in sequence so that the location metadata in the data space can be read by the second acquisition thread.

15. The method according to claim 9, characterized in that, The step of reading the location metadata from the first queue through the second acquisition thread includes: Obtain the first queue read semaphore to determine if there is available data in the first queue; If available data is available, perform an atomic increment operation on the second atomic variable and obtain the value before the increment to determine the read position in the first queue for this read. The location metadata is read from the data space in the first queue array corresponding to the read position.

16. The method according to claim 15, characterized in that, Determining the read position in the first queue for this read includes: The index of the read position is obtained by performing a modulo operation between the value of the second atomic variable before its increment and the size of the first queue array.

17. The method according to claim 15, characterized in that, Before reading the location metadata from the data space corresponding to the read location, the method further includes: Obtain the first data read semaphore of the data space corresponding to the read position to ensure that the data space corresponding to the read position is not accessed by other threads.

18. The method according to claim 15, characterized in that, The step of obtaining the first queue read semaphore to determine whether the first queue has available data includes: If the value of the first queue read semaphore is not greater than zero, the corresponding second acquisition thread enters a blocked state; If the value of the first queue read semaphore is greater than zero, then the first queue is determined to have available data.

19. The method according to claim 15, characterized in that, The step of obtaining the location metadata from the first queue through the second acquisition thread further includes: After reading the location metadata from the data space corresponding to the read location, the first data write semaphore and the first queue write semaphore are released in sequence so that the data space can be written with new location metadata by the first acquisition thread.

20. The method according to claim 4, characterized in that, The step of obtaining the probe event data in the data packet based on the location metadata includes: Based on the starting address and length in the location metadata, the data packet is copied to the stack buffer of the second acquisition thread; The step of writing the probe event data into the unified memory pool through the second acquisition thread includes: writing the probe event data in the stack buffer of the second acquisition thread into the unified memory pool.

21. The method according to claim 2, characterized in that, The step of writing the detection event data from the multiple detectors into the unified memory pool in order of arrival time includes: The first acquisition thread obtains the location metadata of data packets from each network interface connecting the multiple detectors. The location metadata is written to the first queue through the first acquisition thread; The second acquisition thread reads the location metadata from the first queue and obtains the detection event data in the data packet based on the location metadata; and The second acquisition thread writes the detected event data into the unified memory pool.

22. The method according to claim 2, characterized in that, The step of writing the detection event data from the multiple detectors into the unified memory pool in order of arrival time includes: Data packets containing the detected event data are obtained directly from the network interface connecting the multiple detectors through multiple acquisition threads, and temporarily stored in the stack buffer of each acquisition thread. The probe event data is written to the unified memory pool from the stack buffers of the multiple acquisition threads.

23. The method according to claim 2, characterized in that, The step of writing the detection event data from the multiple detectors into the unified memory pool in order of arrival time includes: Data packets including the detection event data are received from the network interface connecting the multiple detectors via the socket interface; The detected event data is written into the unified memory pool.

24. The method according to any one of claims 21 to 23, characterized in that, The step of writing the detected event data into the unified memory pool includes: Based on the full status flag of the unified memory pool, determine whether the unified memory pool is full; If the unified memory pool is not full, a read lock is added to the read-write lock of the unified memory pool; Perform atomic operations on the total write atomic variables of the unified memory pool to determine the write position of this write in the unified memory pool; Write the detected event data to the write location; Release the read lock of the read-write lock.

25. The method according to claim 24, characterized in that, The step of performing atomic operations on the total write atomic variables of the unified memory pool to determine the write position of this write in the unified memory pool includes: Perform an atomic increment operation on the total write atomic variable, with the increment value being the number of data packets written this time; Obtain the value before increment returned by the atomic increment operation; The starting position of this write in the unified memory pool is determined based on the value before the increment.

26. The method according to claim 25, characterized in that, Determining the write position in the unified memory pool based on the value before the increment includes: The value before increment is moduloed by the size of the length array or the offset array to obtain the write index of the length array and the offset array; Use the write index of the length array and offset array as the starting position of this write in the unified memory pool.

27. The method according to claim 24, characterized in that, The step of writing the detected event data into the unified memory pool further includes: Before determining the write location, perform an atomic decrement operation on the empty atomic variables of the unified memory pool, with the decrement value being the number of data packets to be written in this batch. Obtain the value before decrement returned by the atomic decrement operation to determine the current amount of free space in the unified memory pool.

28. The method according to claim 27, characterized in that, The step of writing the detected event data into the unified memory pool further includes: After determining the available space, it is determined whether the available space is not greater than a preset early stop threshold. If the available space is not greater than the early stop threshold, then the full state flag is set to true.

29. The method according to any one of claims 1 to 23 and 25 to 28, characterized in that, Also includes: Based on the storage location of the probe event data in the unified memory pool, the probe event data is read from the unified memory pool, wherein the storage location is determined according to the arrival time order.

30. The method according to claim 2, characterized in that, Also includes: The probe event data written within multiple consecutive time intervals are read sequentially from the unified memory pool.

31. The method according to claim 30, characterized in that, The step of sequentially reading probe event data written within multiple consecutive time intervals from the unified memory pool includes: By marking threads, the current total write volume and current time of the unified memory pool are obtained at preset time intervals; The marking thread writes the marking information, including the current total write volume and the current time, into the second queue. The data acquisition thread reads the tagging information from the second queue. The data acquisition thread sequentially reads the probe event data written within the multiple consecutive time intervals from the unified memory pool according to the tagging information, wherein the consecutive time intervals are determined based on the current time of the tagging information.

32. The method according to claim 31, characterized in that, The step of reading probe event data written within the multiple consecutive time intervals sequentially from the unified memory pool through the data acquisition thread according to the tagging information includes: Add a write lock to the read-write lock of the unified memory pool; The tagging information is obtained from the second queue, and the storage location range of the probe event data read this time is determined based on the tagging information obtained this time and the tagging information obtained last time. The detection event data is read from the unified memory pool according to the storage location range; Release the write lock of the read-write lock.

33. The method according to claim 32, characterized in that, The step of reading the probe event data from the unified memory pool according to the storage location range includes: The range of storage locations is moduloed by the size of the length array or offset array to obtain the read index range of the length array and offset array; Based on the read index range, the length of each data packet is obtained from the corresponding position in the length array; Based on the read index range, obtain the starting offset of each data packet in the data array from the corresponding position in the offset array; Based on the offset and length of each data packet, the probe event data of each data packet is read from the data array.

34. The method according to claim 32, characterized in that, The step of sequentially reading probe event data written within the multiple consecutive time intervals from the unified memory pool through the data acquisition thread according to the marking information also includes: Before acquiring a write lock for the read-write lock of the unified memory pool, the storage space occupied by the probe event data read last time is released based on the amount of data read last time. Specifically, this includes: Determine if the number of data packets read last time is greater than zero; If the number of data packets read last time is greater than zero, then perform an atomic increment operation on the empty atomic variable of the unified memory pool, incrementing the value by the number of data packets read last time, and set the full state atomic flag of the unified memory pool to false.

35. The method according to claim 31, characterized in that, The second queue is a circular queue, and the second queue includes: The second array includes multiple data spaces for accessing the tag information, and each data space has a second data read semaphore and a second data write semaphore. A third atomic variable used to identify the write position of the second queue; A fourth atomic variable used to identify the read position of the second queue; A second queue read semaphore used to identify the amount of available data in the second queue; Second queue write semaphore used to identify the number of free slots in the second queue.

36. The method according to claim 35, characterized in that, The step of writing the marking information, including the current total write volume and the current time, into the second queue through the marking thread includes: Obtain the write semaphore for the second queue to determine if there are any free slots in the second queue; If there is an available slot, perform an atomic increment operation on the third atomic variable and obtain the value before the increment to determine the write position in the second queue for this write. The marking information is written into the data space of the second array corresponding to the writing position.

37. The method according to claim 35, characterized in that, The step of reading the tag information from the second queue via the data acquisition thread includes: Acquire the second queue read semaphore to determine if there is available data in the second queue; If available data is available, perform an atomic increment operation on the fourth atomic variable and obtain the value before the increment to determine the read position in the second queue for this read. The marker information is read from the data space in the second array corresponding to the read position.

38. A method for processing conformity, characterized in that, include: The multi-detector data acquisition method according to any one of claims 1 to 37 is used to write detection event data acquired from multiple detectors of the imaging device into a unified memory pool; The probe data written to the unified memory pool is subjected to conformance processing to obtain conformance event data.

39. A method for processing conformity, characterized in that, include: Acquire probe event data stored in a unified memory pool, wherein the probe event data is stored in the unified memory pool in order of arrival time; Based on the spatial-temporal relationship between the storage location and arrival time of the detected event data, the detected event data is subjected to conformance processing to obtain conformance event data.

40. A reconstruction method, characterized in that, include: Using any one of the multi-detector data acquisition methods according to claims 1 to 37, detection event data acquired from multiple detectors of an imaging device are written into a unified memory pool; The probe data written to the unified memory pool is subjected to conformance processing to obtain conformance event data; The event data is reconstructed using a preset reconstruction algorithm to obtain a reconstructed image.

41. A reconstruction method, characterized in that, include: Acquire probe event data stored in a unified memory pool, wherein the probe event data is stored in the unified memory pool in order of arrival time; Based on the spatial-temporal relationship between the storage location and arrival time of the detected event data, the detected event data is subjected to conformance processing to obtain conformance event data; The event data is reconstructed using a preset reconstruction algorithm to obtain a reconstructed image.

42. A multi-detector data acquisition system, characterized in that, include: A unified memory pool is configured to store detection event data from multiple detectors in the imaging device; The data receiving unit is configured to continuously receive detection event data from the plurality of detectors; The data writing unit is configured to write detection event data from the multiple detectors into the unified memory pool in order of arrival time.

43. The multi-detector data acquisition system according to claim 42, characterized in that, The unified memory pool includes: A total write atomic variable used to identify the total number of data packets written; Empty atomic variables used to identify the number of remaining writable data packets; A full status atomic flag used to identify whether the unified memory pool is full; and A read-write lock used to control concurrent access to write to or read from the unified memory pool.

44. The system according to claim 43, characterized in that, The unified memory pool also includes: A memory pool data array used to store probe event data; A length array used to store the length of each data packet; and An array used to store the offset of the starting position of each data packet in the data array.

45. The multi-detector data acquisition system according to claim 42, characterized in that, Also includes: The data readout unit is used to read probe event data from the unified memory pool based on the storage location of the probe event data in the unified memory pool, wherein the storage location is determined according to the arrival time order.

46. ​​The multi-detector data acquisition system according to claim 42, characterized in that, Also includes: The first acquisition module is configured to acquire location metadata of data packets from each network interface connected to the multiple detectors through the first acquisition thread; The first writing module is configured to write the location metadata into a first queue through the first acquisition thread; The second acquisition module is configured to read the location metadata from the first queue through the second acquisition thread, and acquire the detection event data in the data packet based on the location metadata; and The second writing module is configured to write the probe event data into the unified memory pool through the second acquisition thread.

47. The multi-detector data acquisition system according to claim 45, characterized in that, Also includes: The third acquisition module is configured to acquire the current total write volume and current time of the unified memory pool by marking threads at preset time intervals; The third writing module is configured to write the marking information, including the current total writing volume and the current time, into the second queue through the marking thread; The fourth acquisition module is configured to read the tagging information from the second queue via a data acquisition thread; The fourth writing module is configured to read probe event data written within the multiple consecutive time intervals from the unified memory pool according to the tag information through the data acquisition thread, wherein the consecutive time intervals are determined according to the current time of the tag information.

48. A conformal event handling system, characterized in that, include: The multi-detector data acquisition system according to any one of claims 42 to 47; The matching processing module is configured to perform matching processing on probe data written to a unified memory pool to obtain matching event data.

49. A conformal event handling system, characterized in that, include: A unified memory pool is configured to store probe event data, wherein the probe event data is stored in the unified memory pool in order of arrival time; The matching processing module is configured to perform matching processing on the detected event data based on the spatial-temporal relationship between the storage location and arrival time of the detected event data, so as to obtain matching event data.

50. A reconstruction system, characterized in that, include: The multi-detector data acquisition system according to any one of claims 42 to 47; The matching processing module is configured to perform matching processing on the probe data written to the unified memory pool to obtain matching event data. The reconstruction module is configured to use a preset reconstruction algorithm to perform image reconstruction on the event data to obtain a reconstructed image.

51. A reconstruction system, characterized in that, include: A unified memory pool is configured to store probe event data, wherein the probe event data is stored in the unified memory pool in order of arrival time; The matching processing module is configured to perform matching processing on the detected event data based on the spatial-temporal relationship between the storage location and arrival time of the detected event data to obtain matching event data; The reconstruction module is configured to use a preset reconstruction algorithm to perform image reconstruction on the event data to obtain a reconstructed image.

52. An imaging device, characterized in that, Includes the multi-detector data acquisition system according to any one of claims 42 to 47, the coincidence event processing system according to claim 48 or 49, or the reconstruction system according to claim 50 or 51.

53. An electronic device, characterized in that, It includes a processor and a memory, wherein the memory stores computer program instructions, and the processor, when executing the computer program instructions, implements the method as described in any one of claims 1 to 41.

54. A computer storage medium, characterized in that, The system stores computer program instructions, wherein when the computer program instructions are executed by a processor, the method as described in any one of claims 1 to 41 is implemented.