An endoscope lens automatic identification and configuration method and device, and a storage medium
Patent Information
- Application Number
- CN202611502811.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-24
- Publication Date
- 2026-10-30
AI Technical Summary
[0005]针对现有技术存在的固定阈值电平识别易漂移误判、纯二值编码可识别探头型号少、探头参数无法增量适配、参数配置流程可靠性低的缺陷,本申请提供一种内窥镜镜头自动识别与配置方法,实现多品类、多细分型号内窥镜探头精准识别,同时提升电平判定抗干扰能力,简化新型探头适配流程,保障临床设备运行稳定性
读取与所述二进制识别编码匹配的所述探头配套整机驱动参数,所述多组探头驱动参数包含图像传感配置参数、画质调节参数、曝光控制参数、光源驱动参数、姿态传感采集参数、设备通讯寄存器参数中的一种或多种;
Smart Images

Figure CN122997592A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of medical endoscope equipment control technology, specifically to a method for automatic identification and configuration of endoscope lenses. Background Technology
[0002] Medical endoscopes can be divided into three main categories based on clinical use: electronic endoscopes, arthroscopes, and ordinary optical endoscopes. Each type of endoscope has dozens of sub-specifications of probes. Different types and sub-models of probes have different built-in image sensors, light source modules, and posture sensing hardware parameters. The endoscope host must accurately identify the type and sub-model of the probe in order to load the corresponding drive parameters to achieve stable imaging and light source control.
[0003] Existing identification schemes only use fixed thresholds to determine GPIO pin levels. Due to the long-term heating of operating room equipment, oxidation of interface contacts, and transient power supply interference, the reference potential is prone to drift, resulting in a high probability of level determination errors. At the same time, relying solely on a single binary level code to distinguish probes limits pin hardware resources and the number of probe models that can be recognized is small.
[0004] In addition, the existing solution lacks a standardized parameter mapping and storage architecture. When adding a new probe model, the entire program needs to be re-burned, which cannot quickly adapt to incremental changes. The process of configuring the parameters of the entire machine after probe recognition is cumbersome and cannot meet the needs of batch clinical use of multi-specification probes. Summary of the Invention
[0005] To address the shortcomings of existing technologies, such as the susceptibility to drift and misjudgment due to fixed threshold level recognition, the limited number of probe models that can be identified by pure binary encoding, the inability to incrementally adapt probe parameters, and the low reliability of parameter configuration processes, this application provides an automatic identification and configuration method for endoscope lenses. This method enables accurate identification of multiple types and sub-types of endoscope probes, while improving the anti-interference capability of level determination, simplifying the adaptation process for new probes, and ensuring the operational stability of clinical equipment.
[0006] To achieve the above objectives, the first aspect of this application provides a method for automatic identification and configuration of endoscope lenses, comprising: The multi-channel GPIO identification pins are divided into a reference pin group and an encoding pin group. The real-time voltage of the reference pin group is collected as a dynamic judgment threshold, and a unique binary identification code is generated by combining the level difference relationship of the encoding pin group. Read the standardized mapping database of Flash, in which a one-to-one mapping relationship is established between binary identification code, probe model, and multiple sets of probe driving parameters; The binary identification code generated in real time is compared with the standardized mapping database one by one. After a successful match, the corresponding multiple sets of probe drive parameters are retrieved to complete the parameter configuration for the medical endoscope.
[0007] In this embodiment, the multi-channel general-purpose input / output identification pins are divided into independent reference pin groups and encoding pin groups. The reference pin group does not participate in the acquisition of probe encoding signals, but is only used to acquire the reference voltage under the operating conditions of the whole machine in real time. A dynamic level judgment threshold is generated based on the real-time voltage acquired by the reference pin group, replacing the fixed judgment threshold of the prior art. The voltage difference between each encoding pin and the reference pin group is used as the basis for level logic judgment, rather than directly comparing the absolute voltage value output by the encoding pin.
[0008] The potential shift caused by the heat generated during long-term operation of the whole machine and the oxidation of the probe interface contacts will be reflected in the signal lines corresponding to the reference pin group and the encoding pin group. The output voltage of the two sets of pins will float synchronously in the same direction, and the relative voltage difference between them can remain basically stable. This embodiment relies on the real-time acquisition of the reference pin voltage to continuously update the dynamic judgment threshold, which can synchronously match the overall potential shift state of the line, offset the level judgment deviation caused by potential drift, and solve the technical problem of probe model misjudgment caused by temperature drift and interface aging in the existing fixed threshold scheme from the bottom layer.
[0009] In one implementation, the encoding pin group includes multiple first encoding pins for characterizing the main category and multiple second encoding pins for characterizing the sub-model; the step of acquiring the real-time voltage of the reference pin group as a dynamic judgment threshold and generating a unique binary identification code by combining the level difference relationship of the encoding pin group includes: The real-time voltage of the reference pin group is collected, and the level determination threshold is updated based on the collected real-time voltage. The real-time voltages of the reference pin group and the encoding pin group are collected, the voltage difference between the two groups of pins is calculated, and the level logic corresponding to each pin is determined based on the obtained voltage difference. The logic level of all pins in the encoding pin group is collected in a loop. The results of multiple collections are compared. When the logic level obtained from multiple collections is consistent, the binary identification code to be generated is marked as valid. Extract the logic level corresponding to the first encoding pin and the logic level corresponding to the second encoding pin, and concatenate them to generate the composite binary identification code.
[0010] This implementation layered the encoding pins to distinguish between a first encoding pin that differentiates the major categories of probes and a second encoding pin that differentiates the sub-models within the same major category. The corresponding logic levels are collected by the layered pins and concatenated to form a composite code. This allows for dual identification of probe category and sub-specification using only existing hardware pin resources. Combined with dynamic thresholds and a multi-round sampling consistency verification mechanism, it ensures the distinguishability of the layered composite code recognition while avoiding encoding failures caused by instantaneous sampling interference. Without adding additional GPIO hardware pins, it significantly increases the number of probe specifications that the device can recognize, adapting to clinical scenarios where multiple categories and models of endoscopic probes are used together.
[0011] As one implementation method, the step of extracting the level logic corresponding to the first encoding pin and the level logic corresponding to the second encoding pin, and concatenating them to generate the composite binary identification code, includes: The main classification code segment is obtained by continuously concatenating the binary characters corresponding to all the first encoding pins. By continuously concatenating the binary characters corresponding to all the second encoding pins, a subdivided model encoding segment is obtained; The main classification code segment is placed at the front end of the encoding, and the subdivision model code segment is placed at the back end of the encoding. The two code segments are merged to obtain the composite binary identification code.
[0012] This implementation method concatenates the two coding segments sequentially, enabling the probe category information and subdivided model information to be stored in the same set of binary codes. When searching the standardized mapping database later, the main classification coding segment at the front end can be extracted first to quickly locate the probe category, and then the subdivided model coding segment at the back end can be retrieved to accurately match the specific specifications, shortening the database retrieval and matching time and improving the overall response speed of probe identification and parameter loading.
[0013] As one implementation method, the step of cyclically acquiring the level logic of all pins in the encoding pin group, comparing the results of multiple acquisitions, and marking the binary identification code to be generated as valid when the level logic obtained from multiple acquisitions is consistent, includes: A fixed-length sliding sampling window is opened, and the level logic of all encoding pins of the encoding pin group is continuously collected for multiple cycles and stored in the sliding sampling window; Iterate through the multiple sets of level logic stored in the sliding sampling window and remove abnormal sampling data that deviate from the majority of results; The frequency of occurrence of the remaining valid logic levels within the statistical window is counted, and the group of logic levels with the highest percentage is selected as the valid sampling result, which is used to generate the binary identification code.
[0014] This implementation uses a fixed-length sliding sampling window to continuously acquire the logic level of the encoded pins over multiple cycles. By statistically analyzing the sampling data frequency, it eliminates abnormal sampling values that deviate from the mainstream results, selecting only the logic level with the highest proportion as valid sampling data. This can filter out erroneous sampling signals caused by short-term random interference such as electromagnetic pulses in the operating room and momentary jitter during probe insertion and removal. It avoids problems such as disordered logic level judgment and invalid binary recognition encoding caused by momentary interference, further improving the reliability of probe recognition results. In conjunction with the dynamic reference threshold, it achieves dual anti-interference protection from two dimensions: long-term potential drift and momentary sudden interference.
[0015] As one implementation, the method further includes: constructing the standardized mapping database; the construction of the standardized mapping database includes: The Flash storage space is divided into independent parameter partitions, and the corresponding whole machine drive parameters of various probes are stored in the independent parameter partitions according to the probe model. Obtain the binary identification code and matching parameter data packet corresponding to the newly added probe, and incrementally write the data packet into the standardized mapping database after verifying it.
[0016] This implementation partitions the Flash storage space to store various probe driver parameters, and stores data for different probe models in isolated partitions to avoid mutual interference between parameters. It can quickly and directionally retrieve the matching whole-device driver parameters for the target probe. At the same time, for new probes, a data packet verification method is used to incrementally write the data to the database, eliminating the need to re-burn the entire firmware. This simplifies the adaptation process for new probes. The data packet verification mechanism can also intercept incomplete and illegal parameters from being added to the database, ensuring the integrity and accuracy of the standardized mapping database data. This effectively solves the shortcomings of existing technologies, such as cumbersome adaptation of new probes and easy parameter errors.
[0017] As one implementation method, the step of comparing the real-time generated binary recognition code with the standardized mapping database line by line, and retrieving the corresponding multiple sets of probe drive parameters after a successful match to complete the parameter configuration for the medical endoscope, includes: Read the probe's matching system drive parameters that match the binary recognition code. The multiple sets of probe drive parameters include one or more of the following: image sensing configuration parameters, image quality adjustment parameters, exposure control parameters, light source drive parameters, attitude sensing acquisition parameters, and device communication register parameters. According to the hardware module classification corresponding to the multiple sets of probe driving parameters, the multiple sets of probe driving parameters are written into the corresponding control registers in sequence to complete the initialization configuration of the whole machine.
[0018] This implementation method fully covers the driving parameter types of the entire link of endoscopic imaging, light source, sensing, and communication. The parameters are written to the corresponding control registers step by step according to the hardware module classification. The synchronous initialization configuration of multiple modules of the whole machine can be completed at one time, eliminating the need for manual debugging of equipment parameters one by one and simplifying the operation process of clinical equipment. The classified and organized storage and retrieval of various parameters can avoid confusion and mismatch of parameters of different hardware modules, ensuring the synchronous and stable operation of endoscopic imaging, light source, posture acquisition and other functions.
[0019] In one implementation, the encoding pin group includes a digital encoding pin subgroup for characterizing the main category and an analog encoding pin subgroup for characterizing the probe subcategory; the step of acquiring the real-time voltage of the reference pin group as a dynamic judgment threshold, and generating a unique binary identification code by combining the level difference relationship of the encoding pin group, includes: Collect the real-time voltage of the reference pin group and update the dynamic judgment threshold; The voltage difference between the digital encoding pin subgroup, the analog encoding pin subgroup and the reference pin group is calculated based on the dynamic determination threshold. Based on the voltage difference, determine the high and low levels of each pin in the digital encoding pin subgroup, and concatenate the logic levels of each pin in the order of pin arrangement to generate the main classification digital code; Read the analog voltage of each channel in the analog encoding pin subgroup, match the voltage range lookup table to obtain the segmented voltage divider code corresponding to each channel, and then concatenate the segmented voltage divider codes of multiple channels to form a subdivided model code. The main category numerical code and the sub-model code are concatenated and merged to output a complete composite binary identification code.
[0020] This implementation splits the encoding pins into digital encoding pin subgroups and analog encoding pin subgroups. It quickly distinguishes the major categories of probes by relying on the digital pin level signals, and expands the encoding capacity of subdivided models by using multi-level voltage division of analog pins. Without increasing the number of GPIO pins, it significantly increases the total number of identifiable probe specifications. Combined with the dynamic judgment threshold generated by the reference pin, it uniformly completes the voltage difference judgment of the two types of pins, and simultaneously adapts to the line potential drift condition. It forms a complete composite code by orderly splicing digital encoding and voltage division encoding, which takes into account the efficiency of major category distinction and the ability to identify subdivided models, and adapts to the batch use needs of multiple categories and subdivided probes of electronic endoscopes, arthroscopes, and ordinary optical endoscopes.
[0021] As one implementation method, it also includes: The real-time voltage of the reference pin group is collected at a preset fixed period. A smoothing reference value is calculated using real-time voltage data collected over multiple cycles. The level determination threshold is then updated based on the smoothing reference value and stored in the running cache. The level determination threshold stored in the running cache is called in the next probe insertion / removal identification process.
[0022] This implementation method periodically collects the reference pin voltage in the background during the normal operation of the device and calculates a smoothed reference value. The updated level judgment threshold is pre-stored in the running cache, which can continuously track the slow potential drift caused by the device working for a long time. When the next probe insertion or removal triggers recognition, the threshold in the cache, which has undergone multiple rounds of sampling and smoothing, can be used as the initial reference for recognition. This makes up for the defect that single instantaneous sampling is easily affected by random noise interference. In conjunction with the real-time acquisition and correction during the recognition stage, it suppresses the judgment error caused by temperature drift and contact oxidation, and further improves the accuracy of probe model recognition.
[0023] In one embodiment, the above method further includes: After the system is powered on, initialize the I2C communication interface; The identification information of the image sensor is read through the initialized I2C communication interface, and the validity of the read identification information is verified. If the verification result is valid, the corresponding resolution specification is matched based on the identity information. Load device configuration parameters that are compatible with the matched resolution specification; The image processing module is initialized based on the loaded device configuration parameters; When an abnormality occurs during the identity information reading and verification process or the module initialization process, the corresponding exception handling operation is triggered.
[0024] This application embodiment directly reads the identification information inside the image sensor through the I2C communication interface, which reduces the hardware design complexity of the probe end and reduces the wiring cost and hardware failure risk caused by external circuit devices.
[0025] By validating the identity information, invalid and erroneous read data can be filtered out, avoiding incorrect resolution matching and parameter loading based on abnormal identity information, thus improving the reliability of the recognition process. After matching the resolution specification based on the identity information, the corresponding device configuration parameters are loaded, automatically completing the image processing module initialization and realizing automated adaptation and configuration of the endoscope lens without manual intervention or debugging.
[0026] Meanwhile, an exception triggering mechanism is set up for the identity information reading and verification process and the module initialization process. Once a communication reading failure, identity verification failure, or module initialization error occurs in the process, the corresponding exception handling operation can be triggered in time, so that the system can detect the fault status in time and improve the stability of the whole machine operation.
[0027] A second aspect of this application provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the automatic identification and configuration method for endoscope lenses described in the first aspect.
[0028] According to a third aspect of this application, a computing device is provided, comprising: a processor and a memory connected in communication, wherein the memory stores instructions executable by the processor, and the instructions are executed by the processor to enable the processor to perform the steps of the automatic identification and configuration method for endoscope lenses described in the first aspect.
[0029] In summary, this application's embodiments set up an independent reference pin group to generate dynamic judgment thresholds, rely on the relative voltage difference between pins to judge the level logic, and combine a sliding sampling window to filter out instantaneous interference, effectively overcoming the probe misidentification problem caused by temperature drift and contact oxidation; through two hierarchical coding schemes, the recognition capacity of multi-category and multi-sub-category probes is expanded without adding hardware pins, and with partitioned storage and an incrementally updatable standardized mapping database, convenient probe parameter adaptation and automatic configuration of all modules are achieved. At the same time, the background periodically and smoothly updates the reference threshold cache for double correction in the next recognition, comprehensively improving the accuracy of endoscopic probe recognition and the convenience of clinical adaptation of the equipment. Attached Figure Description
[0030] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0031] Figure 1 This is a flowchart of the automatic identification and configuration method for endoscope lenses according to an embodiment of this application; Figure 2 This is a schematic diagram of the dual-encoding pin layered encoding generation process according to an embodiment of this application; Figure 3 This is a schematic diagram of the sliding window multi-round sampling and verification refinement process according to an embodiment of this application; Figure 4 This is a schematic diagram of the composite encoding segment splicing generation process according to an embodiment of this application; Figure 5 This is a schematic diagram of the digital and analog mixed pin code recognition process according to an embodiment of this application; Figure 6 This is a schematic diagram illustrating the process of automatic lens recognition and configuration implemented through the interface in an embodiment of this application. Figure 7 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0032] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0033] Clinical medical endoscope main units need to be compatible with various types of probes, including electronic endoscopes, arthroscopes, and optical endoscopes. Different types and sub-models of probes have significantly different image sensing, light source, and posture sensing drive parameters. The main unit must accurately identify the connected probe model to load the corresponding parameters and ensure imaging and equipment safety. Existing commercial endoscope probe identification solutions generally use fixed voltage thresholds on GPIO pins to distinguish high and low levels. Researchers discovered several core defects during long-term reliability testing under simulated operating room conditions: 1. When the equipment operates continuously for more than 3 hours, the light source and main control circuit board continue to heat up. After repeated disinfection and plugging and unplugging, the metal contacts of the probe interface oxidize. The overall reference potential of the circuit slowly drifts. The fixed threshold cannot follow the synchronous change of the potential. The absolute voltage judgment logic of the encoding pin is reversed. The probe model is frequently misidentified. In mild cases, the image may be distorted and the light source power may be abnormal. In severe cases, there may be potential safety hazards in clinical diagnosis and treatment.
[0034] 2. Relying solely on a single set of binary level encoding to distinguish probes limits the hardware resources of GPIO pins, enabling the differentiation of only a few major probe categories. It cannot identify dozens of sub-specifications within the same major category, resulting in a narrow range of device compatibility.
[0035] 3. The device firmware parameters are uniformly fixed and stored. Adding a new probe model requires re-burning the entire firmware, making the adaptation and debugging process cumbersome and difficult to meet the hospital's need for batch updates of multiple probe specifications.
[0036] 4. The threshold for judgment is generated by a single sampling of the pin voltage at the moment of probe insertion. This single sampling is susceptible to interference from electromagnetic pulses in the operating room and momentary jitter during insertion and removal, resulting in large fluctuations in the sampling data. This further increases the probability of identification errors. Moreover, the potential drift after long-term operation of the whole machine cannot be corrected in advance. Each time the probe is replaced, the identification relies on a single instantaneous sampling, resulting in significant accumulation of errors.
[0037] To address the aforementioned shortcomings, such as Figure 1 As shown, in one embodiment, an automatic endoscope lens identification and configuration method is provided, including: S100: Divide the multi-channel GPIO identification pins into a reference pin group and an encoding pin group, collect the real-time voltage of the reference pin group as a dynamic judgment threshold, and generate a unique binary identification code by combining the level difference relationship of the encoding pin group.
[0038] The GPIO identification pins are general-purpose input / output pins on the motherboard used for electrical connection to the probe interface and acquisition of voltage divider level signals, serving as the basic acquisition channel for hardware identification. The reference pin group is a dedicated set of acquisition pins that does not carry probe encoding information. The encoding pin group is a set of pins used to output voltage divider level signals characterizing the probe type and model. The dynamic judgment threshold is a non-fixed level judgment voltage value that updates synchronously with the real-time reference voltage. The level difference relationship represents the difference between the output voltage of a single encoding pin and the reference voltage of the reference pin group, serving as the standard for high / low level judgment. The binary identification code is a digital code uniquely corresponding to a single probe model, formed by the ordered concatenation of logic 0s and 1s from multiple pin levels.
[0039] This step first involves functionally isolating the hardware pins and setting up a separate reference acquisition channel to capture the reference potential under the current operating conditions of the entire device in real time, abandoning the industry-standard factory-fixed threshold. Instead of directly reading the absolute voltage of the encoding pin, the level is determined by the relative voltage difference between the encoding pin and the reference pin. Since potential drift caused by heat and contact oxidation will be simultaneously superimposed on the reference and encoding signal circuits, the voltage difference between the two remains basically constant. The dynamic threshold is updated synchronously with the real-time reference, automatically compensating for the overall potential shift and avoiding level misjudgment caused by the mismatch between the fixed threshold and the real-time potential. Finally, all pin levels are logically concatenated into a unique binary code, realizing a unique code identifier for each probe.
[0040] It is understood that the number of pin divisions is unlimited: the reference pin group can be configured with 1 to 3 channels, and the encoding pin group can be configured with 4 to 12 channels depending on the recognition capacity requirements. The dynamic threshold update timing can include two scenarios: the instant the probe is inserted for recognition and the system's background periodic refresh. The level difference judgment logic can include a single judgment rule of "record a high level if the voltage difference is greater than the threshold, and record a low level if the voltage difference is less than the threshold," adapting to all voltage divider encoding probes. The binary encoding length expands synchronously with the number of encoding pins and is not limited to a fixed number of bits.
[0041] In existing technologies, all GPIO pins are used as encoding pins without independent reference acquisition channels. Only a fixed threshold can be used to compare the absolute voltage of the encoding pins. This embodiment adopts a dual-pin grouping architecture and introduces a relative voltage difference discrimination mechanism to solve the identification error caused by temperature drift and interface oxidation from the hardware acquisition logic layer. This is different from the traditional improvement approach that only relies on software filtering to compensate for errors.
[0042] As an example, the host computer reserves 8 GPIO identification pins, assigning 1 pin as the reference pin group and the remaining 7 pins as the encoding pin group. The probe interface internally incorporates a voltage divider resistor network; when different probe models are connected, the 7 encoding pins output different voltage levels. For instance, during a 4-hour continuous surgery in the operating room, the host computer's light source module heats up, causing the overall circuit potential to rise by 0.3V. The reference pins simultaneously acquire this risen reference voltage and update the dynamic threshold; the encoding pin voltage also rises by 0.3V simultaneously. Since the voltage difference remains unchanged, the logic level will not reverse, and the electronic arthroscopic probe can still be accurately identified without being misidentified as an optical endoscope.
[0043] S200: Read the standardized mapping database of Flash, in which a one-to-one mapping relationship is established between binary identification code, probe model, and multiple sets of probe drive parameters.
[0044] Here, Flash refers to the non-volatile memory chip on the host motherboard, which retains data even after power failure and is used for long-term storage of probe matching parameters. The standardized mapping database is a structured storage area planned and divided within Flash, storing binding mapping entries for codes, models, and driver parameters. Specifically, each binary identification code matches only one probe model and its complete set of dedicated driver parameters.
[0045] In this step, the unique binary codes, text model identifiers, and complete set of whole-machine operation driving parameters of all compatible probes are bound as independent entries and stored in the Flash database in advance. During the probe identification stage, the database is read to establish an index association between the codes and hardware operation parameters, providing a standardized data source for subsequent automatic parameter configuration, and abandoning the existing storage mode of scattered and fixed technical parameters without a unified index mapping.
[0046] As an example, Flash can be built into the host or external SPI Flash; database mapping entries can be pre-set in batches at the factory or added incrementally later; there is no limit to the number of drive parameter groups bound to a single mapping relationship, which can include any one or more types of parameters such as imaging, light source, sensing, and communication.
[0047] This embodiment constructs a standardized one-to-one mapping database in Flash to achieve structured binding and storage of codes, models, and driving parameters, providing underlying storage architecture support for incremental adaptation to new probes and rapid retrieval of matching parameters.
[0048] As an example, a database entry might contain the binary code 0110101, the probe model "HD 1080P Electronic Gastroscope," and accompanying parameters including image exposure parameters, LED light source power parameters, and attitude sensor sampling frequency parameters. These three elements are bound together as a single, independent mapping entry. For instance, if a hospital adds a new ultra-thin nasopharyngoscope, it only needs to generate a data packet containing its unique binary code, model number, and drive parameters, verify it, and then write it into the database. There's no need to re-flash the entire firmware; the host computer can then recognize and retrieve the corresponding parameters.
[0049] S300: The binary identification code generated in real time is searched and compared with the standardized mapping database one by one. After a successful match, the corresponding multiple sets of probe drive parameters are retrieved to complete the parameter configuration for the medical endoscope.
[0050] First, let's explain the core technical terms involved in this step. It can be understood that the line-by-line search and comparison refers to performing character matching and verification between the real-time binary code generated by S100 and each stored code in the database in turn; the drive parameters are the register configuration values used to control the operation of the endoscope image, light source, sensor, and communication hardware; parameter configuration is to write the matched set of drive parameters into the control registers of each hardware module of the host to complete the initialization operation of the whole machine.
[0051] The implementation principle of this step is as follows: After the host recognizes the real-time binary code, it traverses and searches the standardized mapping database for a completely matching mapping entry; after a successful match, it retrieves all the matching driver parameters under the entry at once and writes them into the corresponding registers according to the hardware module classification, automatically completing the initialization of the endoscope, without requiring medical staff to manually adjust parameters such as screen brightness, light source power, and sensor sampling frequency.
[0052] Regarding the scope of protection in this step, the retrieval method includes two optional forms: sequential traversal and segmented fast index retrieval; the parameter configuration object covers all hardware modules of image sensor, light source driver, attitude sensor, and device communication. Operators can select some modules for configuration as needed, or perform complete configuration of all modules.
[0053] This embodiment relies on a standardized mapping database, which can retrieve all the multi-module driver parameters at once and complete automatic batch configuration, realizing the integrated automatic adaptation of the entire hardware link of the endoscope, significantly simplifying the clinical operation process, and achieving excellent automation adaptation effect.
[0054] To facilitate a full understanding of this solution, the following explanation is provided in conjunction with specific implementation examples and clinical usage scenarios: For example, if the identification code matches the "4K laparoscopy" entry in the database, the host will simultaneously retrieve the image noise reduction parameters, cold light source dimming parameters, and endoscope angle sensing acquisition parameters, and write them into the corresponding registers of the image processing chip, light source driver chip, and posture acquisition chip, respectively. In actual clinical scenarios, when changing the laparoscopic probe during surgery, the host can automatically complete all hardware parameter configurations in just 100ms after completing the code identification, without the need for nurses to manually adjust the image clarity and light source brightness, and the device can be directly put into diagnostic and treatment operations.
[0055] In this embodiment, the multi-channel general-purpose input / output identification pins are divided into independent reference pin groups and encoding pin groups. The reference pin group does not participate in the acquisition of probe encoding signals, but is only used to acquire the reference voltage under the actual operating conditions of the entire machine in real time. A dynamic level judgment threshold is generated based on the real-time voltage acquired by the reference pin group, replacing the fixed judgment threshold of the prior art. The voltage difference between each encoding pin and the reference pin group is used as the basis for level logic judgment, rather than directly comparing the absolute voltage value output by the encoding pin. The potential shift caused by the heat generated by the entire machine during long-term operation and the oxidation of the probe interface contacts will be synchronously reflected in the signal lines corresponding to the reference pin group and the encoding pin group. The output voltage of the two groups of pins will fluctuate synchronously in the same direction, and the relative voltage difference between them can remain basically stable. This embodiment relies on the real-time acquired reference pin voltage to continuously update the dynamic judgment threshold, which can synchronously match the overall potential shift state of the line, offset the level judgment deviation caused by potential drift, and fundamentally solve the technical problem of probe model misjudgment caused by temperature drift and interface aging in the existing fixed threshold scheme.
[0056] To further address the technical shortcomings of existing technologies, such as limited GPIO hardware pin resources, reliance on a single encoding method only allowing differentiation of a limited number of probe categories, inability to identify a massive number of subdivided probe models within the same category, susceptibility to transient interference in single sampling leading to unreliable encoding results, and insufficient model identification capacity, in one embodiment, the encoding pin group includes multiple first encoding pins for characterizing the main category and multiple second encoding pins for characterizing the subdivided model; such as Figure 2 As shown, the step of collecting the real-time voltage of the reference pin group as a dynamic judgment threshold and generating a unique binary identification code by combining the level difference relationship of the encoding pin group specifically includes the following sub-steps.
[0057] S110: Collect the real-time voltage of the reference pin group and update the level determination threshold based on the collected real-time voltage.
[0058] It is understandable that this step is a pre-reference calibration stage for encoding and recognition. The reference pin group consists of independent, dedicated voltage acquisition pins and does not participate in model encoding output. The level judgment threshold is a critical voltage parameter used to distinguish between high and low pin levels. During each probe recognition startup phase, the real-time voltage of the reference pin group under the current operating conditions is acquired first, and the level judgment threshold is updated in real time. This allows the judgment benchmark to dynamically and adaptively adjust to changes in operating conditions such as device temperature drift, interface aging, and environmental interference, rather than using a fixed factory threshold. This step is applicable to probe recognition scenarios under any operating duration and interface aging conditions of the endoscope. Compared to traditional fixed threshold schemes, this step can compensate for the overall system potential shift in real time, ensuring that the judgment benchmark for each recognition is completely matched with the current hardware operating conditions, providing accurate benchmark conditions for subsequent encoding and recognition. For example, when the device heats up during prolonged surgery, causing the overall line baseline potential to rise, this step synchronously updates the threshold to avoid misjudgments due to level logic reversal caused by reference shift.
[0059] S120: Collect the real-time voltage of the reference pin group and the encoding pin group, calculate the voltage difference between the two pin groups, and determine the level logic corresponding to each pin based on the obtained voltage difference.
[0060] Understandably, this step is the core determination step for single-channel coded pin level identification. The voltage difference is the real-time voltage difference between the coded pin and the reference pin, and the level logic corresponds to binary 0 and 1 encoded signals. This step abandons the traditional absolute voltage comparison method, using the relative voltage difference between the reference pin and the coded pin as the basis for level determination, utilizing the synchronous drift characteristic of their potentials to offset system common-mode potential deviations. This step covers all level acquisition scenarios for the first and second coded pins. Compared to existing technologies, this step completely avoids identification errors caused by overall potential drift, significantly improving the stability of single-channel pin level determination. For example, slight oxidation of the interface causes all pin voltages to drop synchronously, but their relative voltage difference remains unchanged, and the level logic can remain accurate.
[0061] S130: Cyclicly collect the level logic of all pins in the encoding pin group, compare the results of multiple collections, and mark the binary identification code to be generated as valid when the level logic obtained from multiple collections is consistent.
[0062] It is understandable that this step is an anti-interference filtering and verification step for the encoding result. The cyclic acquisition involves multi-cycle continuous sampling, and the effective encoding consists of stable encoded data after multiple rounds of consistent sampling results and the removal of transient interference. The principle of this step is to filter out random sampling errors caused by electromagnetic interference in the operating room, probe insertion / removal jitter, and transient power fluctuations by repeatedly sampling and comparing the results, using only stable and consistent sampling results as the source of effective encoding. This step is applicable to all probe encoding and recognition scenarios and can adapt to complex operating room electromagnetic environments. This step further eliminates transient abnormal interference at the software level, ensuring the final generated encoding is authentic and reliable. For example, if a single sampling experiences a brief level jump due to electromagnetic interference, multiple rounds of comparison can automatically filter out abnormal values, ensuring the stable and effective encoding result.
[0063] S140: Extract the level logic corresponding to the first encoding pin and the level logic corresponding to the second encoding pin, and concatenate them to generate the composite binary identification code.
[0064] It is understandable that this step involves generating a hierarchical composite code. The first encoding pin distinguishes the main category of the probe, while the second encoding pin distinguishes the sub-models within the same category. The composite code is a complete and unique code resulting from the orderly concatenation of the main category code and the sub-model code. The principle behind this step is to use the hierarchical pins to carry the main category information and the sub-model information respectively, and then orderly concatenate the two codes to form a composite binary code with hierarchical distinction. This step can significantly expand the number of recognizable probe models without increasing the number of GPIO pins. Compared to the traditional single encoding structure, this step achieves precise dual-layer distinction of "main category + sub-model," greatly improving hardware resource utilization and probe compatibility. For example, the first encoding pin distinguishes the main categories of electronic microscopes, arthroscopy, and optical microscopes, while the second encoding pin distinguishes sub-probes with different focal lengths, diameters, and pixel counts. By concatenating these sub-probes, a unique and precise identification of multiple sub-probes can be achieved.
[0065] This implementation layered the encoding pins to distinguish between a first encoding pin that differentiates the major categories of probes and a second encoding pin that differentiates the sub-models within the same major category. The corresponding logic levels are collected by the layered pins and spliced together to form a composite code. This allows for dual identification of probe category and sub-specification using only existing hardware pin resources. Combined with dynamic thresholds and a multi-round sampling consistency verification mechanism, it ensures the distinguishability of the layered composite code recognition while avoiding encoding failures caused by instantaneous sampling interference. Without adding additional GPIO hardware pins, it significantly increases the number of probe specifications that the device can recognize, adapting to clinical scenarios where multiple categories and models of endoscopic probes are used together.
[0066] To further enhance the anti-interference capability of the encoding sampling process, eliminate random sampling errors caused by instantaneous electromagnetic pulses in the operating room, probe insertion and removal jitter, and power fluctuations, and improve the stability and accuracy of binary code generation, this embodiment refines and optimizes the multi-round sampling verification process. For example... Figure 3 As shown, the step of cyclically collecting the level logic of all pins of the encoding pin group, comparing the results of multiple rounds of collection, and marking the binary identification code to be generated as valid when the level logic obtained from multiple rounds of collection is consistent, specifically includes three sub-steps: S131, S132, and S133.
[0067] S131: Open a fixed-length sliding sampling window, continuously collect the level logic of all encoding pins of the encoding pin group for multiple cycles and store them in the sliding sampling window.
[0068] It is understandable that the sliding sampling window is a cache storage area with a preset fixed data length, used to continuously cache multi-cycle pin level sampling data; multi-cycle continuous acquisition refers to continuously sampling and recording the level states of all coded pins at a fixed sampling frequency. For example, the window length is set to 8 frames of sampling data, continuously acquiring pin level logic for 8 cycles and caching it within the window to form a complete set of sampling datasets to be verified. The implementation principle of this step is to continuously and periodically sample and store the coded pin level signals by opening up a sliding data cache space, avoiding the shortcomings of traditional single-point instantaneous sampling, which can only acquire a single frame signal and cannot reflect stable level states. During implementation, the window length and sampling period can be flexibly configured according to the device's operating conditions, adapting to recognition scenarios with different electromagnetic interference intensities and different sampling accuracy requirements. This step accumulates multiple frames of valid data through continuous time-domain sampling, providing a sufficient data base for subsequent abnormal data removal and data statistical screening, ensuring the temporal stability of the recognition data from the sampling mechanism perspective.
[0069] S132: Traverse the multiple sets of level logic stored in the sliding sampling window and remove abnormal sampling data that deviate from the majority of results.
[0070] It is understandable that abnormal sampling data is sudden level data caused by instantaneous interference and has a significant deviation from the vast majority of sampling results within the window; traversal refers to sequentially reading all the buffered level logic datasets within the sliding sampling window.
[0071] This step applies to all cached data within the window. The data removal rules can be adjusted based on the interference intensity to determine the deviation threshold, adapting to different levels of signal disturbance scenarios.
[0072] It can be applied to working conditions that are prone to generating sudden sampling signals, such as mechanical vibration during probe insertion and removal, and instantaneous electromagnetic shocks generated by the start-up and shutdown of surrounding medical equipment.
[0073] For example, the window cache contains a total of 8 sets of logic levels, of which 7 sets maintain the same level state. Only one set of data has a level jump due to electric knife interference. This step identifies and deletes the deviation sample after traversing all the data.
[0074] This step cleans up distorted sampling information in the cache in advance, preventing erroneous data caused by momentary interference from flowing into the subsequent encoding and judgment stage, thereby improving the purity of the data participating in statistical calculations.
[0075] S133: Count the frequency of occurrence of the remaining valid logic levels within the statistical window, select the logic level group with the highest percentage as the valid sampling result, and use it to generate the binary identification code.
[0076] It is understandable that frequency statistics refer to counting the number of occurrences of each group of logic levels remaining after removing abnormal data; the group of logic levels with the highest percentage is the stable sampling result that appears most frequently within the window and closely matches the actual hardware voltage division state of the probe.
[0077] This step is not limited by window capacity or the number of encoding pins. Regardless of the number of layered encoding pins, a single effective level combination can be output using a frequency statistics filtering mechanism.
[0078] It can be applied to complex and complex interference conditions that take into account both baseline potential shifts caused by long-term continuous surgery and the superposition of short-term sudden electromagnetic disturbances.
[0079] For example, after removing abnormal data, the remaining 7 sets of sampled data in the window are all the same set of level logic. This set of data appears most frequently and is directly determined as the reference sampled result for generating binary recognition code.
[0080] This step relies on statistical screening of multiple sets of effective data to select stable level signals, weakening the identification deviation caused by single random disturbances. It works in conjunction with dynamic reference thresholds to form a dual-layer protection system against instantaneous signal interference and long-term line potential drift, significantly improving the fault tolerance of the overall identification process.
[0081] This implementation uses a fixed-length sliding sampling window to continuously acquire the logic level of the encoded pins over multiple cycles. By statistically analyzing the sampling data frequency, it eliminates abnormal sampling values that deviate from the mainstream results, selecting only the logic level with the highest proportion as valid sampling data. This can filter out erroneous sampling signals caused by short-term random interference such as electromagnetic pulses in the operating room and momentary jitter during probe insertion and removal. It avoids problems such as disordered logic level judgment and invalid binary recognition encoding caused by momentary interference, further improving the reliability of probe recognition results. In conjunction with the dynamic reference threshold, it achieves dual anti-interference protection from two dimensions: long-term potential drift and momentary sudden interference.
[0082] To achieve orderly integration of hierarchical encoding and shorten database retrieval time, this implementation method refines the design of the concatenation logic for composite binary encoding. For example... Figure 4 As shown, the step of extracting the level logic corresponding to the first encoding pin and the level logic corresponding to the second encoding pin, and splicing them to generate the composite binary recognition code, specifically includes three sub-steps: S141, S142, and S143.
[0083] S141: Concatenate all the binary characters corresponding to the first encoding pins to obtain the main classification encoding segment.
[0084] It is understandable that the binary character is a 0 or 1 identifier corresponding to the logic level of the first encoding pin of a single channel; the main classification encoding segment is a character sequence that integrates all the first encoding pin signals and is used to distinguish the major categories of probes.
[0085] This step is applicable to any number of first-encoded pins. The pin splicing order can be predefined and fixed in the program, and is not limited by the pin hardware layout order.
[0086] It can be applied to the entire identification process, including distinguishing different categories of probes such as electronic endoscopes, optical endoscopes, and arthroscopes. For example, three first encoding pins are configured, with the logic levels of the three pins being 1, 0, and 1 respectively. After being continuously spliced in a preset order, the main classification code segment "101" is generated to identify the electronic endoscope category.
[0087] This step centrally collects the level information of all main category pins, and independently forms a continuous encoding sequence for category identification information, realizing modular separation of major category identification information, and laying the data foundation for subsequent segmented and rapid retrieval.
[0088] S142: Concatenate all the binary characters corresponding to the second encoding pins to obtain the subdivided model encoding segment.
[0089] Understandably, the subdivided model code segment is a character sequence that integrates all the binary characters of the second encoding pins and is used to distinguish probes of different specifications within the same category.
[0090] This step is not limited by the number of second encoding pins. The more pins there are, the greater the total number of distinguishable probe specifications, and the more compatible it is with different capacity requirements of equipment models.
[0091] This can be applied to subdivided probes that differentiate between different pixels, scope diameters, and lens focal lengths within the same broad category. For example, by configuring four second encoding pins with logic levels of 0, 1, 0, and 0 in sequence, the subdivided model code segment "0100" is obtained, representing a 1080P ultra-thin gastroscopy probe.
[0092] This step separately collects detailed specification information to form an independent coding segment, which is physically separated from the main category coding segment to avoid mixing of category and model information and simplify the subsequent segmentation and parsing logic.
[0093] S143: Place the main classification code segment at the front end of the encoding and the subdivision model code segment at the back end of the encoding, and merge the two code segments to obtain the composite binary identification code.
[0094] It is understandable that the composite binary identification code is a complete code string that uniquely corresponds to a probe, formed by concatenating the main classification code segment and the subdivision model code segment in a fixed order.
[0095] This step applies to all layered pin combinations that generate two-segment codes. The lengths of the two code segments can be freely combined without fixed bit constraints.
[0096] It can be applied to surgical scenarios where hospitals use multiple types and sub-type probes, requiring rapid matching of probe parameters and shortening equipment response time. For example, the main category code segment "101" is placed first, and the sub-type code segment "0100" is placed last, resulting in the complete composite code "1010100", which uniquely corresponds to a 1080P ultra-thin electronic gastroscope.
[0097] This step fixes the order of the two code segments, forming a composite code with a unified structure and clear hierarchy. When parsing the code, it can be directly segmented without the need for full character traversal and comparison, effectively reducing the amount of computation required for database retrieval.
[0098] This implementation method concatenates the two coding segments sequentially, enabling the probe category information and subdivided model information to be stored in the same set of binary codes. When searching the standardized mapping database later, the main classification coding segment at the front end can be extracted first to quickly locate the probe category, and then the subdivided model coding segment at the back end can be retrieved to accurately match the specific specifications, shortening the database retrieval and matching time and improving the overall response speed of probe identification and parameter loading.
[0099] To address the issues of mixed firmware parameter storage, the need for complete reprogramming when adding new probes, and the potential for illegal or incomplete data to damage storage resources, this implementation adds a standardized mapping database construction process. As one implementation method, this approach also includes the step of constructing the standardized mapping database, which is specifically divided into two main operational stages.
[0100] The first step is to divide the Flash storage space into independent parameter partitions, and store the corresponding whole machine drive parameters of each type of probe into the independent parameter partitions according to the probe model.
[0101] It is understandable that Flash is a non-volatile storage medium that can permanently preserve data after power failure; independent parameter partitioning refers to dedicated storage blocks that are logically divided and isolated from each other within Flash; and the overall drive parameters of the probe are register configuration data adapted to the imaging, light source, and sensing functions of the corresponding probe.
[0102] This section applies to various host storage media, including built-in Flash and external SPI Flash. The number of partitions can be flexibly expanded according to the total scale of the hospital's probes, and the storage capacity of a single partition is not subject to uniform restrictions.
[0103] For example, the host Flash memory of 8M size is divided into 16 independent parameter partitions. One partition stores the complete set of driving parameters for 4K laparoscopy, and another partition stores the driving parameters for high-definition electronic gastroscopy separately. The data in each partition does not overlap with each other.
[0104] This step utilizes a partitioned and isolated storage architecture to achieve physical isolation of parameters for different probe models. When retrieving parameters for a target probe, the corresponding partition can be accessed directly, reducing the overhead of reading invalid data and avoiding the problems of cross-contamination, overwriting, and loss of parameters from different models at the storage level.
[0105] The second step involves obtaining the binary identification code and corresponding parameter data packet for the newly added probe, verifying the data packet, and incrementally writing it into the standardized mapping database.
[0106] It is understandable that the parameter data package is an integrated data file that integrates the binary identification code, model identifier, and complete set of driving parameters of a single new probe; data package verification refers to verifying and judging the integrity of the data package, the legality of the data format, and the rationality of the parameter values; incremental writing refers to adding only the data of this probe without changing all the original stored content in the database.
[0107] This step is not limited by the number or type of new probes. The verification rules can be customized according to the equipment safety standards. The incremental write channel supports two data entry methods: on-site offline import and online distribution from the host computer.
[0108] This technology can be applied to scenarios where hospitals purchase new endoscopic probes or where equipment manufacturers update and refine probe specifications. For example, when a hospital adds an ultra-thin nasopharyngoscope probe, the host computer sends a data packet integrating dedicated encoding and imaging and light source parameters. After the host verifies that the data packet is complete and the parameter values are compliant, it only adds this set of data to the idle parameter partition, while all existing probe parameters remain unchanged.
[0109] This step introduces a pre-verification combined with an incremental writing mechanism, which can complete the adaptation of the new probe without re-flashing the entire firmware of the device, greatly simplifying the on-site equipment debugging process. At the same time, the verification mechanism intercepts incomplete, tampered, and abnormal data packets from entering the database, continuously ensuring the integrity and reliability of the data stored in the database.
[0110] This implementation partitions the Flash storage space to store various probe driver parameters, and stores data for different probe models in isolated partitions to avoid mutual interference between parameters. It can quickly and directionally retrieve the matching whole-device driver parameters for the target probe. At the same time, for new probes, a data packet verification method is used to incrementally write the data to the database, eliminating the need to re-burn the entire firmware. This simplifies the adaptation process for new probes. The data packet verification mechanism can also intercept incomplete and illegal parameters from being added to the database, ensuring the integrity and accuracy of the standardized mapping database data. This effectively solves the shortcomings of existing technologies, such as cumbersome adaptation of new probes and easy parameter errors.
[0111] To further expand the probe's recognition capacity and ensure compatibility with more subdivided probe specifications within limited GPIO hardware resources, this embodiment employs a hybrid digital and analog layered coding architecture. For example... Figure 5 As shown, the encoding pin group includes a digital encoding pin subgroup for characterizing the main classification and an analog encoding pin subgroup for characterizing the probe subclass; the real-time voltage of the reference pin group is collected as a dynamic judgment threshold, and a unique binary identification code is generated by combining the level difference relationship of the encoding pin group, which specifically includes five sub-steps from S210 to S250.
[0112] S210: Collect the real-time voltage of the reference pin group and update the dynamic judgment threshold.
[0113] It is understandable that the reference pin group is an independent set of dedicated voltage acquisition pins; the dynamic judgment threshold is a critical voltage value that is refreshed in real time with the current line reference potential and used to determine the high or low state of the pin signal.
[0114] This step is applicable to all operating conditions, including normal temperature start-up, long-term high-temperature operation, and interface oxidation and aging. The number of reference pins can be set to 1 or more for average calibration, and the threshold update timing is tied to each probe recognition trigger operation.
[0115] For example, after the host operates continuously for 4 hours, the overall line baseline potential rises by 0.25V. In this step, the real-time voltage of the reference pin is collected and the dynamic judgment threshold is adjusted upwards simultaneously to make the judgment standard match the current actual line potential.
[0116] This step performs a unified benchmark calibration before identifying both digital and analog pin signals, providing a unified judgment benchmark adapted to the current operating conditions for the subsequent differential pressure calculation of the two subgroups, and eliminating systematic identification deviations caused by overall potential drift.
[0117] S220: Calculate the voltage difference between the digital encoding pin subgroup, the analog encoding pin subgroup and the reference pin group based on the dynamic determination threshold.
[0118] It is understandable that voltage difference refers to the difference between the voltage acquired by a single digital pin and a single analog pin and the voltage of the reference pin, which is the core calculation basis for distinguishing signal states.
[0119] This step applies to all digital and analog coded pins. The differential voltage calculation logic reuses the same set of dynamic judgment thresholds, eliminating the need to configure independent reference parameters for the two types of pins. It is applicable to composite probe identification systems that simultaneously incorporate digital voltage divider circuits and multi-level analog voltage divider circuits. For example, the difference between the output voltage of each digital pin and each analog pin and the reference voltage is calculated separately. All differential voltage calculations use the same dynamic judgment threshold updated by S210 as the reference standard.
[0120] This step uses a unified differential pressure judgment logic for the two types of encoding pins, simplifies the program operation architecture, ensures the consistency of the benchmark for digital category recognition and analog sub-category recognition, and avoids judgment logic conflicts caused by dual benchmarks.
[0121] S230: Determine the high and low levels of each pin in the digital encoding pin subgroup based on the voltage difference, and sequentially concatenate the logic levels of each pin according to the pin arrangement order to generate the main classification digital code.
[0122] It is understandable that high and low levels correspond to binary identifiers 0 and 1; the main category digital code is formed by logically concatenating all digital pin levels, used to distinguish the major categories of endoscopes.
[0123] This step is not limited by the number of pins in the digital encoding pin subgroup. The pin arrangement can be preset and fixed. The major categories can be quickly distinguished simply by the combination of 0 / 1.
[0124] For example, the corresponding application scenario is to quickly distinguish between the three basic categories of electronic endoscopes, arthroscopes, and optical endoscopes. For instance, three digital encoding pins are configured, and the voltage level is determined sequentially as 1, 1, and 0 based on the voltage difference. These are then concatenated to obtain the main classification digital code "110", which is used to identify the arthroscope category.
[0125] This step relies on the binary level signal of the digital pin to achieve rapid identification of major categories. The operation logic is simple and the identification response speed is fast, so as to complete the preliminary classification of probe categories first.
[0126] S240: Reads the analog voltage of each channel in the analog encoding pin subgroup, matches the voltage range lookup table to obtain the segmented voltage divider code corresponding to each channel, and splices the segmented voltage divider codes of multiple channels in sequence to form a subdivided model code.
[0127] Understandably, the voltage range lookup table is a mapping table between preset multi-level voltage dividers and their corresponding coded characters; the segmented voltage divider code is a multi-bit binary code corresponding to different voltage divider levels of a single analog pin; the detailed model code is composed of multi-level analog pin voltage divider codes spliced together, used to distinguish probes of different specifications under the same category.
[0128] This step is applicable to situations where the number of analog pin voltage divider levels can be freely set. The more analog pin levels a single channel has, the more subdivision models can be distinguished, which is not limited by the number of pins.
[0129] For example, it can be used to differentiate probes within the same category by focal length, endoscope diameter, pixel specifications, and operating length. For instance, a single analog pin can be configured with four voltage divider ranges, each corresponding to a 2-bit binary code. Two analog pins can then be combined to generate 16 different sub-codes, accurately distinguishing multiple electronic gastroscopes of varying specifications.
[0130] This step leverages the multi-level voltage divider characteristic of analog signals to expand the encoding capacity, carrying a large amount of detailed model identification information with a small number of hardware pins, thus significantly improving the utilization rate of hardware resources.
[0131] S250: The main category numerical code and the sub-model code are concatenated and merged to output a complete composite binary identification code.
[0132] It is understandable that the composite binary identification code is composed of a large category of digital codes and a subdivided voltage divider code combined in a fixed order, and a single code uniquely matches a specific model of probe.
[0133] This step is applicable to both main category numeric codes of any number of digits and subdivision codes of any length. The lengths of the two codes can be configured independently and combined freely.
[0134] For example, a corresponding application scenario is a clinical setting where a hospital is equipped with electronic endoscopes, arthroscopes, optical endoscopes, and dozens of probes with different specifications, requiring a complete and unique code for accurate matching. For instance, the main category digital code "110" is combined with the sub-sub-code "0110" to obtain the complete composite code "1100110," which corresponds only to a specific 4K high-definition arthroscopic probe.
[0135] This step fixes the coding hierarchy arrangement order, resulting in a clear and layered coding structure. During database retrieval, segments can be extracted and parsed, balancing fast filtering of broad categories with accurate matching of specific specifications, and achieving a balance between recognition speed and model differentiation accuracy.
[0136] This implementation splits the encoding pins into digital encoding pin subgroups and analog encoding pin subgroups. It quickly distinguishes the major categories of probes by relying on the digital pin level signals, and expands the encoding capacity of subdivided models by using multi-level voltage division of analog pins. It significantly increases the total number of identifiable probe specifications without increasing the number of GPIO pins. Combined with the dynamic judgment threshold generated by the reference pin, it uniformly completes the voltage difference judgment of the two types of pins, and simultaneously adapts to the line potential drift condition. It forms a complete composite code by orderly splicing digital encoding and voltage division encoding, which takes into account the efficiency of major category distinction and the ability to identify subdivided models, and adapts to the batch use needs of multiple categories and subdivided probes such as electronic endoscopes, arthroscopes, and ordinary optical endoscopes.
[0137] To further address the issues of traditional recognition schemes, which can only load a single imaging parameter, require manual step-by-step debugging of multiple hardware modules, and are prone to parameter confusion and mismatch, this implementation refines the overall parameter configuration process after database matching. The step of comparing the real-time generated binary recognition code with the standardized mapping database line by line, and retrieving the corresponding multiple sets of probe drive parameters after a successful match to complete the parameter configuration for the medical endoscope, is specifically divided into two operation stages.
[0138] The first step is to read the overall driving parameters of the probe that match the binary recognition code. The multiple sets of probe driving parameters include one or more of the following: image sensing configuration parameters, image quality adjustment parameters, exposure control parameters, light source driving parameters, attitude sensing acquisition parameters, and device communication register parameters.
[0139] Understandably, the probe's overall drive parameters are the register settings that drive the normal operation of each hardware unit of the endoscope; the image sensor configuration parameters, image quality adjustment parameters, and exposure control parameters are used to manage the output image effect of the imaging chip; the light source drive parameters manage the output power of the cold light source; the attitude sensor acquisition parameters are responsible for the acquisition of endoscope angle data; and the device communication register parameters are used for data interaction and transmission between the host and peripherals.
[0140] This section covers all types of endoscopic probes. It allows for the selection of simplified parameters based on probe function, or the retrieval of all six parameter categories. Parameter types can be added, deleted, or expanded as needed. It can be applied to various diagnostic and treatment scenarios, including routine surgical procedures, precise endoscopic diagnosis and treatment, and endoscope angle tracking. For example, after matching the code of an ultra-thin electronic gastroscope, it simultaneously retrieves a complete set of parameters for image noise reduction, automatic exposure, LED light source dimming, endoscope bending angle acquisition, and device serial communication, fully covering all hardware control data required for diagnosis and treatment.
[0141] This step integrates the control parameters required for the entire business chain of endoscope imaging, illumination, sensing, and communication, enabling a single code to bind the entire set of equipment operation configuration data, thus avoiding the cumbersome operation caused by multiple sets of parameters being stored separately and retrieved in multiple steps.
[0142] The second step: According to the classification of the hardware modules corresponding to the multiple sets of probe driving parameters, the multiple sets of probe driving parameters are written into the corresponding control registers in sequence to complete the initialization configuration of the whole machine.
[0143] It is understandable that the hardware module classification refers to the classification of parameters according to the imaging chip, light source driver chip, attitude sensor, and communication interface; the control register is the storage unit inside each hardware module used to store the operating configuration; the whole machine initialization configuration refers to the device entering the standard working state adapted to the probe after the parameters are written.
[0144] This section is applicable to all built-in hardware modules of the host computer. The parameter writing order can be customized according to the module startup logic, supporting independent configuration of a single module or batch configuration of all modules. For example, image quality and exposure parameters are written to the image processing chip first, then brightness control parameters are written to the light source driver chip, and finally the attitude sensing and communication registers are configured, completing all hardware initialization in an orderly manner module by module.
[0145] This step relies on the orderly distribution of parameters by module classification. The configuration data of different hardware units are independent and do not interfere with each other. From the execution process, the fault of writing parameters into the wrong register is eliminated, and the stable startup of each hardware unit is guaranteed.
[0146] This implementation method fully covers the driving parameter types of the entire link of endoscopic imaging, light source, sensing, and communication. The parameters are written to the corresponding control registers step by step according to the hardware module classification. The synchronous initialization configuration of multiple modules of the whole machine can be completed at one time, eliminating the need for manual debugging of equipment parameters one by one and simplifying the operation process of clinical equipment. The classified and organized storage and retrieval of various parameters can avoid confusion and mismatch of parameters of different hardware modules, ensuring the synchronous and stable operation of endoscopic imaging, light source, posture acquisition and other functions.
[0147] Part 1: Acquire the real-time voltage of the reference pin group at a preset fixed period.
[0148] It is understandable that the preset fixed period is the time interval for the background cyclic sampling of the main control program; the reference pin group is an independent set of hardware pins dedicated to collecting the baseline potential of the line; and the real-time voltage is the instantaneous voltage value output by the reference pin at each sampling moment.
[0149] This step applies to the entire operating period of the endoscope from startup to shutdown. The sampling cycle can be flexibly configured according to the equipment's heat dissipation conditions and the continuous working time of the operating room. The sampling process is not limited by the probe's plugging and unplugging status and can run independently in the background.
[0150] This step independently completes all-weather baseline potential monitoring without the need for probe recognition triggering conditions, continuously accumulating time-series voltage sampling data to provide sufficient and continuous data support for subsequent reference voltage smoothing calculations and threshold iterative updates, ensuring that baseline potential changes can be continuously captured.
[0151] Part Two: Calculate a smoothing reference value using real-time voltage collected over multiple cycles, update the level determination threshold based on the smoothing reference value, and store it in the running cache; wherein, the level determination threshold stored in the running cache is called in the next probe insertion / removal identification process.
[0152] Understandably, the smoothing reference value is a stable baseline voltage obtained after averaging and filtering multiple sets of periodically sampled voltages; the running cache is a high-speed temporary storage area of the main control chip, dedicated to storing real-time updated level judgment thresholds; the probe insertion and removal identification process is a complete coded identification logic that is started when the probe is detected to be connected.
[0153] This step is adaptable to periodic sampling sequences of any length and is compatible with various smoothing methods such as arithmetic average and weighted filtering. The internal threshold of the cache can be continuously refreshed in the background sampling process to always match the current equipment operating conditions.
[0154] This step relies on routine background sampling to complete baseline data smoothing preprocessing, pre-generating judgment thresholds adapted to the real-time operating conditions of the whole machine and caching them for later use. There is no need for temporary sampling and calibration at the moment of probe recognition. While ensuring recognition response speed, it realizes pre-compensation for baseline temperature drift, forming a two-layer error suppression system with the instantaneous voltage correction in the recognition stage, effectively reducing recognition deviation caused by long-term operating condition drift and random sampling noise.
[0155] This implementation method periodically collects the reference pin voltage in the background during the normal operation of the device and calculates a smoothed reference value. The updated level judgment threshold is pre-stored in the running cache, which can continuously track the slow potential drift caused by the device working for a long time. When the next probe insertion or removal triggers recognition, the threshold in the cache, which has undergone multiple rounds of sampling and smoothing, can be used as the initial reference for recognition. This makes up for the defect that single instantaneous sampling is easily affected by random noise interference. In conjunction with the real-time acquisition and correction during the recognition stage, it suppresses the judgment error caused by temperature drift and contact oxidation, and further improves the accuracy of probe model recognition.
[0156] like Figure 6 As shown, in one embodiment, the above method may further include the following steps: After the system is powered on, initialize the I2C communication interface; The identity information of the image sensor is read through the initialized I2C communication interface, and the validity of the read identity information is verified. If the verification result is valid, the corresponding resolution specification is matched based on the identity information. Load device configuration parameters that are compatible with the matched resolution specification; The image processing module is initialized based on the loaded device configuration parameters; When an abnormality occurs during the identity information reading and verification process or the module initialization process, the corresponding exception handling operation is triggered.
[0157] Understandably, the I2C communication interface is a serial digital communication hardware interface between the SOC and the image sensor. Optionally, in this solution, it is used by the host-side SOC to send read commands to the image sensor to obtain information pre-stored within the chip. The image sensor's identification information is fixed data stored in the image sensor chip's internal registers. Furthermore, this data is pre-programmed during the sensor's manufacturing process and can characterize the image sensor's hardware model and output resolution-related attributes. Validity verification is a judgment action performed by the SOC after obtaining the identification information. It is used to determine whether the read data belongs to the preset legal data, filtering out erroneous read data caused by communication interference or bus abnormalities, corresponding to the identification validity verification step in the process. The resolution specification refers to the pixel specifications of the image output by the image sensor. Furthermore, each piece of legal identification information is pre-associated with a corresponding resolution specification. Optionally, multiple different resolution specifications can be configured for matching and selection. Device configuration parameters are the working parameters used on the SOC side to drive the image sensor and realize image processing. Furthermore, these parameters correspond one-to-one with the resolution specifications. For example, they cover clock parameters, image output format parameters, basic image processing parameters, etc. After matching the corresponding resolution specifications, these parameters are loaded.
[0158] For example, the image processing module includes a VI (VideoInput) module and a VPPS (VideoProcessing Sub-System) module. The VI module is the video input module, used to receive image data streams from the image sensor. The VPPS module is a video preprocessing module, used to perform preprocessing operations on the input raw image data. Optionally, both the VI and VPPS modules are components of the image processing module and can be initialized in parallel. Furthermore, after the VI and VPPS modules are initialized, the initialization of subsequent image processing units is completed.
[0159] As is understood, exception handling operations refer to the system's actions taken in situations such as I2C communication read failure, identity verification failure, or VI module or VPPS module initialization failure. It is also understood that this application's embodiments do not limit the specific form of the handling; furthermore, this processing branch is entered when an exception occurs at any stage of the process.
[0160] Understandably, after the system powers on, it first initializes the I2C communication interface, establishing a digital communication path between the SOC and the image sensor. Then, the SOC sends a read command through the initialized I2C interface to retrieve the identification information stored in the image sensor's register. The system verifies the validity of the retrieved identification information, filtering out erroneous data generated during communication. Furthermore, if the verification result is valid, the system uses this identification information as an index to match the corresponding resolution specification. Understandably, the system retrieves and loads device configuration parameters compatible with this resolution specification. Relying on these loaded parameters, it initializes the VI module and VPPS module in parallel. After the VI and VPPS modules are initialized, it continues to initialize the remaining image processing modules, adapting the system to the currently connected image sensor. Furthermore, in the event of an anomaly during the identification information reading and verification process or the module initialization process, the system triggers corresponding exception handling operations to respond to the fault condition.
[0161] This application is not limited to a specific SOC hardware or a specific model of endoscope device. The VI module and VPPS module are specific hardware functional units listed in this embodiment. Optionally, depending on the selected chip platform, other hardware units with the same function can be used as substitutes. It is understood that the exception handling operation only limits the triggering behavior after an exception occurs, and does not restrict the specific handling methods. For example, error reporting, standby, retry, and other handling methods are all applicable.
[0162] In one embodiment, a storage medium is provided that stores a computer program, which, when executed by a processor, implements the steps of the above-described method for automatic identification and configuration of endoscope lenses.
[0163] In one embodiment, a computing device is provided, comprising: a processor and a memory connected in communication, the memory storing instructions executable by the processor, the instructions being executed by the processor to enable the processor to perform the steps of the above-described automatic identification and configuration method for endoscope lenses.
[0164] Figure 7 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. The aforementioned endoscopic image processing and display system can be implemented using the structure shown in the diagram, as follows: Figure 7As shown, the electronic device includes: One or more processors 610 and memory 620, Figure 7 Take the 610 processor as an example.
[0165] The electronic device may also include an input device 630 and an output device 640.
[0166] The processor 610, memory 620, input device 630, and output device 640 can be connected via a bus or other means. Figure 7 Taking the example of a connection between China and Israel via a bus.
[0167] The memory 620, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules corresponding to the automatic endoscope lens identification and configuration method in the embodiments of this application. The processor 610 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions, and modules stored in the memory 620, thereby realizing the automatic endoscope lens identification and configuration method of the above-described method embodiments.
[0168] The memory 620 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the endoscope lens automatic identification and configuration method, etc. Furthermore, the memory 620 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 620 may optionally include memory remotely located relative to the processor 610, and these remote memories can be connected to the electronic device via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0169] Input device 630 can receive input digital or character information and generate signals related to user settings and function control of the image processing device. Output device 640 may include a display device such as a display screen.
[0170] The one or more modules are stored in the memory 620, and when executed by the one or more processors 610, they execute the endoscope lens recognition and configuration method in any of the above method embodiments.
[0171] In summary, this application's embodiments set up an independent reference pin group to generate dynamic judgment thresholds, rely on the relative voltage difference between pins to judge the level logic, and combine a sliding sampling window to filter out instantaneous interference, effectively overcoming the probe misidentification problem caused by temperature drift and contact oxidation; through two hierarchical coding schemes, the recognition capacity of multi-category and multi-sub-category probes is expanded without adding hardware pins, and with partitioned storage and an incrementally updatable standardized mapping database, convenient probe parameter adaptation and automatic configuration of all modules are achieved. At the same time, the background periodically and smoothly updates the reference threshold cache for double correction in the next recognition, comprehensively improving the accuracy of endoscopic probe recognition and the convenience of clinical adaptation of the equipment.
[0172] The above-described products can execute the methods provided in the embodiments of this application, possessing the corresponding functional modules and beneficial effects for executing the methods. Technical details not described in detail in this embodiment can be found in the methods provided in the embodiments of this application. The above embodiments are only used to illustrate the technical solutions of this application, and not to limit them; although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to depart from the protection scope of the technical solutions of the embodiments of this application.
Claims
1. A method for automatic identification and configuration of endoscope lenses, characterized in that, include: The multi-channel GPIO identification pins are divided into a reference pin group and an encoding pin group. The real-time voltage of the reference pin group is collected as a dynamic judgment threshold, and a unique binary identification code is generated by combining the level difference relationship of the encoding pin group. Read the standardized mapping database of Flash, in which a one-to-one mapping relationship is established between binary identification code, probe model, and multiple sets of probe driving parameters; The binary identification code generated in real time is compared with the standardized mapping database one by one. After a successful match, the corresponding multiple sets of probe drive parameters are retrieved to complete the parameter configuration for the medical endoscope.
2. The method according to claim 1, characterized in that, The encoding pin group includes multiple first encoding pins for characterizing the main category and multiple second encoding pins for characterizing the sub-model; the real-time voltage of the reference pin group is collected as a dynamic judgment threshold, and a unique binary identification code is generated by combining the level difference relationship of the encoding pin group, including: The real-time voltage of the reference pin group is collected, and the level determination threshold is updated based on the collected real-time voltage. The real-time voltages of the reference pin group and the encoding pin group are collected, the voltage difference between the two groups of pins is calculated, and the level logic corresponding to each pin is determined based on the obtained voltage difference. The logic level of all pins in the encoding pin group is collected in a loop. The results of multiple collections are compared. When the logic level obtained from multiple collections is consistent, the binary identification code to be generated is marked as valid. Extract the logic level corresponding to the first encoding pin and the logic level corresponding to the second encoding pin, and concatenate them to generate the composite binary identification code.
3. The method according to claim 2, characterized in that, The step of extracting the level logic corresponding to the first encoding pin and the level logic corresponding to the second encoding pin, and concatenating them to generate the composite binary identification code, includes: The main classification code segment is obtained by continuously concatenating the binary characters corresponding to all the first encoding pins. By continuously concatenating the binary characters corresponding to all the second encoding pins, a subdivided model encoding segment is obtained; The main classification code segment is placed at the front end of the encoding, and the subdivision model code segment is placed at the back end of the encoding. The two code segments are merged to obtain the composite binary identification code.
4. The method according to claim 2, characterized in that, The process involves cyclically acquiring the logic levels of all pins in the encoding pin group, comparing the results of multiple acquisitions, and marking the binary identification code to be generated as valid when the logic levels obtained from multiple acquisitions are consistent. This includes: A fixed-length sliding sampling window is opened, and the level logic of all encoding pins of the encoding pin group is continuously collected for multiple cycles and stored in the sliding sampling window; Iterate through the multiple sets of level logic stored in the sliding sampling window and remove abnormal sampling data that deviate from the majority of results; The frequency of occurrence of the remaining valid logic levels within the statistical window is counted, and the group of logic levels with the highest percentage is selected as the valid sampling result, which is used to generate the binary identification code.
5. The method according to claim 1, characterized in that, Also includes: Construct the standardized mapping database; The construction of the standardized mapping database includes: The Flash storage space is divided into independent parameter partitions, and the corresponding whole machine drive parameters of various probes are stored in the independent parameter partitions according to the probe model. Obtain the binary identification code and matching parameter data packet corresponding to the newly added probe, and incrementally write the data packet into the standardized mapping database after verifying it.
6. The method according to claim 1, characterized in that, The process involves comparing the real-time generated binary identification code with the standardized mapping database line by line. Upon successful matching, the corresponding sets of probe drive parameters are retrieved to complete the parameter configuration for the medical endoscope, including: Read the probe-matched whole-machine drive parameters that match the binary recognition code. The multiple sets of probe drive parameters include one or more of the following: image sensing configuration parameters, image quality adjustment parameters, exposure control parameters, light source drive parameters, attitude sensing acquisition parameters, and device communication register parameters. According to the hardware module classification corresponding to the multiple sets of probe driving parameters, the multiple sets of probe driving parameters are written into the corresponding control registers in sequence to complete the initialization configuration of the whole machine.
7. The method according to claim 1, characterized in that, The encoding pin group includes a digital encoding pin subgroup for characterizing the main category and an analog encoding pin subgroup for characterizing the probe subcategory; the real-time voltage of the reference pin group is collected as a dynamic judgment threshold, and a unique binary identification code is generated by combining the level difference relationship of the encoding pin group, including: Collect the real-time voltage of the reference pin group and update the dynamic judgment threshold; The voltage difference between the digital encoding pin subgroup, the analog encoding pin subgroup and the reference pin group is calculated based on the dynamic determination threshold. Based on the voltage difference, determine the high and low levels of each pin in the digital encoding pin subgroup, and concatenate the logic levels of each pin in the order of pin arrangement to generate the main classification digital code; Read the analog voltage of each channel in the analog encoding pin subgroup, match the voltage range lookup table to obtain the segmented voltage divider code corresponding to each channel, and then concatenate the segmented voltage divider codes of multiple channels to form a subdivided model code. The main category numerical code and the sub-model code are concatenated and merged to output a complete composite binary identification code.
8. The method according to claim 1, characterized in that, Also includes: After the system is powered on, initialize the I2C communication interface; The identity information of the image sensor is read through the initialized I2C communication interface, and the validity of the read identity information is verified. If the verification result is valid, the corresponding resolution specification is matched based on the identity information. Load device configuration parameters that are compatible with the matched resolution specification; The image processing module is initialized based on the loaded device configuration parameters; When an abnormality occurs during the identity information reading and verification process or the module initialization process, the corresponding exception handling operation is triggered.
9. A storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the steps of the method described in any one of claims 1 to 8.
10. A computing device, characterized in that, include: A processor and a memory are communicatively connected, the memory storing instructions executable by the processor to enable the processor to perform the steps of the method according to any one of claims 1 to 8.
