AI image-based diagnosis systems: how to implement them?

: Artificial intelligence (AI) is starting to be widely used in the medical field and has great potential benefits to help doctors and patients. However, it also raises new challenges and problems. This paper analyzed the existing capacities of AI to make a diagnosis and assessed the legal consequences. We present AI medical image analysis systems developed in Belarus. International practice on how AI-systems are implemented in medicine is analyzed. Russian experience in developing standards to test and use AI systems in hospitals is described. Finally, the paper put forward some suggestions on how to improve the legal framework of AI systems using in medicine.


Introduction
Artificial intelligence already has a great impact on the regulation of human rights in the workplace (robots, manipulators), in medicine (the use of robot surgeons, organ transplants, etc.), to some extent increasingly infringing on these rights. The widespread use of robots and AI systems poses challenges to the legislative system, the solution of which seems impossible without taking into account many technical, legal and human aspects.
It is clear that AI development and implementation should follow two main directions: technical and legal. From the first point of view, a robot is a complex of hardware and software, in which the software is sewn brain. It is created by scientists and engineers. But then robots begin to work in production and in medicine, that is, to live among people. And for such joint activities, it is necessary to have a well-developed legal framework that accurately defines the norms of behaviour in different situations [1].
The use of artificial intelligence systems faces some ethical challenges because in many cases, the decisions taken by AI are not understandable and intelligible to humans. When developing legislation, it is necessary to take into account the ethical norms of artificial intelligence, it is necessary to build an ethical AI. It is necessary to recognize and understand the potential ethical and moral problems that may be caused by the introduction and use of artificial intelligence systems [2]. At present, in many applications people prefer to delegate decisions to AI as compared to human agents. A good overview of this task is given in paper [3]. Authors examine if peoples' choice to delegate a decision to a human or an AI agent differs for two different decision contexts: (1) decisions that spur a high desire for control, as they could lead to potential losses and, conversely, (2) decisions that could lead to gains but entail lower desires for control. Their results illuminate the underlying psychological process involved and show that process transparency increases delegation to humans but not to AI.
The task to delegate decisions to AI is especially important when AI is starting to be widely used in medicine. All decisions taken by AI and proposed to doctors should be clear and understandable both for doctor and patient. Especially if we speak about making a diagnosis. Now more and more AI solutions for making diagnosis appeared at clinics and doctors in all countries and clinics should clearly understand how and when they can rely on AI decision.
There are many papers devoted to this task published last years. The paper [4] analysed the behaviour of clinicians when an AI module is present in a diagnostic system. Authors concluded that this behaviour has a direct impact in the clinicians workflow that is thoroughly addressed herein. Their results show a high level of acceptance of AI techniques from radiologists and point to a significant reduction of cognitive workload and improvement in diagnosis execution. The papers [5][6][7] analysed problems of AI diagnosis from points of view of accuracy, explainability and doctors' perceptions and perspectives on integration of AI-systems in diagnosis. The are many papers that analysed concrete diseases and diagnosis by AI. For example, the paper [8] analysed AI using for breast cancer screening procedure. Authors compared the diagnostic and observed the superiority of the Clinician-AI scenario and they obtained a decrease of 27% for False-Positives and 4% for False-Negatives. They concluded that the proposed design techniques positively impact the expectations and perceptive satisfaction of 91% clinicians, while decreasing the time-to-diagnose by 3 min per patient. A systematic literature review for using Artificial intelligence in disease diagnosis was made in paper [9]. Analysis of image-based systems in detecting diseases based on deep learning technology was made in paper [10].
In this paper, we investigated how to implement AI image-based systems for using in clinics. We showed the developed Belarusian AI-systems for making diagnosis and propose administrative and legal measures to regulate AI using in clinics.

AI systems in medicine
Today, artificial intelligence is widely used in medicine. Many counties started to develop and even use AI-systems in hospitals.
China is doing serious work on the introduction of technology AI in medical institutions. AI systems are used to analyze medical images, help in making medical decisions (Clinical Decision Support Systems from Baidu). We have to note the objective effectiveness of the Chinese approach in the fight against the COVID-19 pandemic. China has rapidly stepped up work on the rapid implementation of all necessary technologies AI was used to counter the pandemic and used AI systems to assess the risk of infection, to analyse medical images, to identify individuals, to recognize persons with elevated temperatures. Market size of AI for medical imaging industry in China is growing more than twice as much as in the previous each year [11].
In Russian Federation, the recent review [12] shows that there are 43 different AI systems for medicine and healthcare, created and promoted at the Russian market. Together with growing number of AI systems a big attention is paid in Russia to legal regulation of AIsystems using in medicine. The rules for the registration of AI systems as medical software have been recently approved (Decree of the Government of the Russian Federation No. 1906280 of 24.11.2020), standards for AI systems in clinical medicine have been developed, and rules for X-ray studies that address AI issues. (Order of the Ministry of Health of the Russian Federation of June 9, 2020 N 560n281) [13].
From last August, 2022 AI-systems started to being tested in Moscow hospitals. The world's first neural network for detecting cancer of the rectum and colon (Medical Neuronets) on a large flow of patients and technology for diagnosing prostate cancer (PathVision). They are tested on the basis of two city oncological hospitals: Moscow City Oncological Hospital No. 62 and the Moscow Clinical Scientific Center named after A.S.

Loginov. Doctors of the Diagnostic and Telemedicine
Center of the Moscow Department of Health have developed a single standard for conducting clinical trials of artificial intelligence in medicine for the whole of Russia [13].
The usage of AI in medicine have potential benefits to both doctors and patients. However, using of AI in medicine can also give some troubles for doctors connected with right of patients to privacy and confidentiality of personal data, the opacity of AI methods and for doctors is unclear how AI makes a diagnosis and how they can rely on AI decision, etc.
All of the above tells us that is necessary to have very well developed legal regulation of AI systems using in medicine. Medical doctors should have strong instructions and have clear knowledge how and when they can use AI results for their job.
Existing AI systems in medicine can be combined into several main groups: • Medical image analysis and digital diagnostics using computer vision technologies; • Prevention and treatment of conditions, diseases and complications; • Other directions.
Consider them in more details. The first group is the biggest one and let us consider it in more details.

AI image-based systems for diagnosis
AI image-based diagnosis is becoming an important technology for future diagnostic systems. But, such diagnostic systems need to be improved in several aspects. Obtaining of reliable and accurate model using deep-learning architecture requires big data. But mostly, medical images are technical and man-made. This fact makes it difficult to build big data systems. The next problematic aspect is that creation of a database of standardized and labelled medical images can be extremely time-consuming. People usually builds databases by manual pre-processing of all medical images for AI applications [14].
AI can especially help specialists in early detection of cancer. Using algorithms developed by the Ezra company team, it is possible to detect cancer at an early stage in 13% of people examined with this software. And this is a great success, because according to statistics, early detection of cancer provides 80% survival compared to less than 20% when cancer is detected at late stages [15].
Histopathological analysis is extremely time consuming and highly specialized procedure, the success of which depends on the experience of a specialist and is influenced by such factors as fatigue and lack of attention. Therefore, there is an urgent need to create methods for computer diagnostics, in order to reduce the load on pathologists, eliminating the most obvious benign sections of images, and thus freeing experts for much more laborious cases to diagnose [16].
Similar to the traditional diagnosis based on the aggregation of qualitative signs of typical cells, it is necessary to have a set of morphological parameters, reflecting the regularities of different sides of pathological processes occurring in an organ both at cell and population levels. The use of aggregation of quantitative signs of atypical cells as a criterion of tumor malignancy, will allow to improve the informativity of cancer diagnosis.
Diagnosis of cancer is usually based on the analysis of cell images. Recent results in computer science allowed almost full automatization of cell image analysis. The analysis of cell images is considered as image segmentation problem where cells or their kernels should be extracted. Being extracted, cell characteristics are then computed, analysed and used to make a diagnosis.
Analysing existed publications about medical image analysis for making diagnosis, we can say that at present, there exist scientific solutions to analyse practically all image types and make diagnosis for all illnesses. Let us consider several systems developed in the Republic of Belarus. We can show here examples of systems developed by Belarusian scientists separating them into two groups analysing static images and video sequences.

Analysis of static images for diagnosis
ImageWarp is used for analysis of histology images and contains more 160 various functions of image processing. There are many feature extraction functions: measurement of contours, lines, angles, points and areas, (about forty parameters in total). It can be executed in automatic and interactive modes. The measurement in an interactive mode is accompanied by a dialog box with a built-in spreadsheet [17]. Fig.1 shows system screenshot for cell image analysis and calculating their characteristics. Bioscan system represents a set of functions and toolkit which can create a required script by internal language for solving a particular histological and cytological tasks: • object (cell, nucleus) detection; • automatic and interactive feature extraction; • calculation of more than 100 built-in and user-defined geometrical, optical and topological parameters.
This system is successfully used for diagnostic in clinical oncology and pathology anatomy in Belarusian clinics and medical universities. In particularly, it was successfully used for diagnosis of thyroid cancer (Fig.2) [18]. Russian-Belarusian system for analysis of ophthalmology images has been developed to solve the following tasks: (1) identification of the lipid layer state in the intermarginal space of human eyelids; (2) analysis of the degree of cellular structure density (cellularity) in the corneal tissue of human eyes; (3) identification of the state of the retinal blood flow when analyzing fluorescent angiograms of the human fundus; and (4) morphometric analysis of the state of the epithelium posterius (endothelium) in the human eye cornea. For each task, the following results were obtained: (1) expectations and variances of pixel intensities on the imprint along a drawn line and over a selected region, as well as plots that characterize pixel intensity and change in the thickness of the imprint along a drawn line; (2) expectations and variances for the intensities of the selected regions and intensity histograms; (3) extracted vessels and ischemia zones with their statistical descriptions; and (4) detected cells of hexagonal, pentagonal, and other shapes, as well as a set of characteristics associated with the size of the cells detected [19]. Figure 3 shows determining the characteristics of blood flow in the vessels of eye conjunctiva, such as linear and volumetric blood speed, and topological characteristics of vascular net.  Algorithms and system for detecting acute appendicitis based on analysis of endoscopic images has been proposed in paper [20]. To solve this task, we first introduced image enhancement techniques, so that we can improve the quality of endoscopic images for further processing. Effective image segmentation techniques have been developed to detect vessels and vermiform appendix. The hierarchical set of features have been extracted and proposed for diagnosis of acute appendicitis. It includes geometric, colorimetric, densitometric, and topological features. For each appendicitis feature, discriminant indexes have been introduced for diagnosis. We detected the main features at three levels ( Figure 4) We introduced the discriminant indexes to detect appendicitis (Table 1). This method has achieved good results in clinical applications.

Analysis of microbiological video sequences
Another group of systems is connected with analysis of video-sequences and particularly with analysis of microbiological images. Independent cells, cell groups, tissue sections, separate fibers, and tissue inclusions are examined as objects in biological microscopy. To analyze steam cell movement, we have to monitor dynamical properties of cells, cell conglomerates and cellular interactions for many tasks like, for example, detection of spatiotemporal localization of mitosis events.
Chinese-Belarusian systems have been developed to analyze video cell sequences [21]. Cell monitoring algorithms have been developed that analyze behavior of the cells' population as a system of dynamical objects by using a concept of the integral optical flow. We determined the main types of motion which make it possible to separate the key moments of the motion of cells in the population and describe the stages of the cells' development and their interaction with each other.
The presented results are used for monitoring and quantitative analysis of the development of cell cultures, estimating the dynamic changes taking place in them, and determining the population's heterogeneity and viability (Fig.3).

AI systems as medical devices: how to implement and use them in clinics
AI-based systems and models are started widely used in medical research and also in advanced medical centers to assist in making diagnosis. However, the practical implementation of the AI models in ordinary clinics is not incorporated. It is clear that these models need to be validated in a clinical setting to assist the medical practitioner in affirming the diagnosis verdicts [23].
For wide usage of AI-systems in clinics daily life, it is necessary to develop legal and medical regulations that allow to test all new systems and recommend them to doctors. The system required for medical practice can get into the healthcare system only after mandatory registration. This means that before that it will pass a number of checks and tests. Within the framework of the control system, certain software risk classes are also established, the assignment of which depends on the data and decisions made by the AI. The lowest class is the accounting medical systems that do not affect the patient in any way. The highest possible class is the system on which a person's life depends.
We can extract the following requirements to AIsystems. The first requirement is guarantees of absolute subordination of AI to the will of man, as well as ensuring maximum security with the use of all necessary technical measures. Secondly, the areas in which the development and application of AI should be prohibited should be clearly and uniformly defined. Thirdly, it is necessary to ensure that all AI systems related to the management of objects vital to humans comply with the requirement of a dual circuit, which means the ability of systems to function in the event of a shutdown of the AI included in it.
Regulation of the creation and use of AI systems in medicine should be carried out at the ministerial level, first of all.
We consider that it is necessary to develop standards for testing and application of artificial intelligence systems in medicine. The documents should regulate the requirements for testing and application of AI systems. Specialists should get an accurate assessment of whether the product meets the declared characteristics of accuracy, efficiency, and most importantly -whether it does not carry risks to human health.
To do this, it is necessary to test AI systems and evaluate their results. The evaluation of AI systems tests can include three stages. At the first stage, analytical validation confirms the ability of systems to process data accurately, reproducibly and reliably. Then the compliance of the output data of such systems with the declared functional purpose is checked. At the third stage, the effectiveness of the system is confirmed, namely the ability to produce meaningful results.
It is also necessary to develop and adopt Model Rules for the use of AI technologies. The rules should enshrine the ethical principles of using AI technologies. It is possible to take as a basis the principles set out in the European Ethical Charter on the Use of Artificial Intelligence in judicial systems and the realities surrounding them [24], including the principles of respect for fundamental rights, non-discrimination, quality and safety, transparency, impartiality and reliability, the principle of user control.
Structurally, the Model Rules for the use of AI technologies may include the following components: goals and objectives of the use of AI; the main directions of the use of AI; powers in the field of the use of AI, the procedure for planning and organizing work in the field of the use of AI, including the formation of plans and performance indicators, coordinating and advisory bodies, working groups, etc.; basic rules of use AI technologies in the department, as well as in organizations subordinate to them; control over the use of AI technologies; ethical principles of the use of AI technologies.
In Russian Federation, in 2021 new national standard was developed and started to use in March 2022 [25]. It is entitled: GOST R 59921 "Artificial intelligence systems in clinical medicine". The new GOST defines the methodology and procedure for conducting clinical trials of AI systems. This standard is applicable to artificial intelligence systems as software that is a medical device. It contains 6 parts. Let us briefly describe it. Part 1. Clinical evaluation. It clarifies terminology, includes AI performance indicators as part of clinical validation, and contains a recommended form of a report on the clinical component of trials. The document describes the quality control of the procedure for conducting clinical trials in three stages. Part 2. Program and methodology of technical validation. This standard establishes general approaches to conduct technical tests of artificial intelligence systems. Technical tests are carried out in accordance with the program and methodology to assess the compliance of the characteristics of the artificial intelligence system with the requirements of the manufacturer's technical and operational documentation, declared standards, applicable regulatory requirements, etc., including for the purpose of deciding on the possibility of conducting subsequent clinical trials.
Part 3. Change management in artificial intelligence systems with continuous learning. This standard is intended for the use by manufacturers (manufacturers) of artificial intelligence systems (AI) with continuous training to manage changes in terms of adaptations and the correct formation on this basis of the relevant sections of the technical and operational documentation of the AI.
Part 4. Evaluation and control of operational parameters. This standard establishes general requirements for the assessment and control of the operational parameters of AI-systems during commissioning and periodic monitoring, which allows for an unambiguously interpreted assessment of the characteristics and parameters of AI-systems.
Part 5. Requirements for the structure and order of application of a data set for training and testing algorithms. This standard establishes general requirements for the structure and procedure for the use of data sets that are used at the stages of the development of an artificial intelligence system (AI), including training and internal testing of artificial intelligence algorithms, its operation, as well as external testing (analytical and clinical validation). Part 6. General performance requirements. This standard establishes general requirements for the operation of artificial intelligence systems (AI) through the requirements for operational documentation, user training, the procedure for internal and external quality control and operation by users of AI.
Currently, all AI systems offered for diagnostics in Russian Federation have begun to undergo these tests.

AI systems: how to make diagnosis and who is responsible
There are two main questions that arise when using AIsystems to make diagnosis are: -How to teach and train doctors to use them; -Can a doctor rely entirely on AI?
It is very important to properly train doctors and other medical professionals to ensure that they do not blindly trust artificial intelligence algorithms, and to exercise due care to ensure the accuracy of the results, taking into account other possible options. We think that special short courses should be organised for doctors. Then, the strict instructions for AI-system implementation should be developed and used.
In the result of intelligent image processing AI-system will produce valuable data that will be further used for final diagnosis. We propose to consider the processing of medical images and clinical data about a patient as such an interpretation, as a result of which new, clinically significant information is produced (formed), which is missing from the initial data, which is necessary and used when making a diagnosis.
However, we know that AI-systems job is based on training on large dataset to produce a result. The datasets for training may be incomplete, contain errors, inaccuracies, and non-standard terms. Effective mechanisms for collecting this information and building datasets do not yet exist.
From other side, AI algorithms are mainly considered as black box in which the decision-making process is hidden in network layers. It can give problems especially in situations when we use not-verified datasets to train AI algorithms, which will likely result in inaccurate AI decisions.
Thus, the use of artificial intelligence in healthcare raises concerns when we think about possible liability issues. We agree with studies that state that, although it may be quite easy to identify an illegal act or an effect resulting from the use of an artificial intelligence system, it is often less easy to identify guilty subjects [26]. In particular, criminal liability usually requires a demonstration of the knowledge or intent of the relevant subjects, and it is clear that artificial intelligence systems do not have such a mental state [26].
If artificial intelligence itself is not legally responsible, who will be responsible? What criteria should we use to choose the culprit? Could there be a doctor who relied on the help of artificial intelligence? Or a technical worker who inserted, perhaps unintentionally, incorrect data that led to incorrect results? Or should we put the blame on the software developer who didn't think about the possible options and didn't train the artificial intelligence system properly? All this raises concerns and leads to a certain degree of unpredictability.
However, it is clear that legal solutions to these issues need further discussion. One of the possible ways that some scientists suggest is to rethink the principles of responsibility, in order to possibly share responsibility between manufacturers of artificial intelligence systems (they may be responsible for their product causing harm in accordance with the general product liability regime), doctors and patients [27].
Artificial intelligence systems, of course, differ from each other by their nature. However, the approaches described above can be taken into account when developing legal norms on responsibility for decisions and actions of artificial intelligence systems. If the responsibility for the error lies with the AI developer, then the authors of the software themselves will not go for it. If the responsibility remains with the doctor, then he will not blindly follow the instructions of the machine. That is why we are now talking not in terms of "robot doctors", but in terms of "decision support systems". The algorithm advises, but the final decision remains with the doctor.
One of the existing directions in the scientific discussion is the question of endowing artificial intelligence with legal personality, therefore, being a subject of tort liability. There are enough arguments against such a position and the author supports them and sees no possible grounds in the existing political and legal field to endow artificial intelligence with legal personality. In addition, the positions of scientists who believe that at present the legal structure of artificial intelligence does not have sufficiently defined features and boundaries to distinguish those cases when a robot can be an independent subject of legal relations, and when it is a program and, accordingly, an object of legal relations deserve attention.
Nevertheless, for legal systems where there is a construction of a legal entity that is a full-fledged subject of legal relations, the introduction of a new legal structure that will have a similar legal nature does not seem to be something impossible in the near future [28].
According to Article 1096 of the Civil Code of the Russian Federation, the damage caused due to the shortcomings of the service is subject to compensation by the person who provided the service [13]. If we consider a situation in which the provision of the service met all the requirements and standards of medical care, claims for harm caused by the work of artificial intelligence should be presented separately either to the medical institution (as the person who uses the program) or to the developer (as the person responsible for the content and algorithms of the work). It turns out that if there is no fault of the doctor in the wrong treatment and (or) diagnosis, there should be an independent requirement for both the medical organization and the developer.
The most expedient, in our opinion, would be to hold the developer accountable as the person who wrote the code and formed the algorithms of work. This approach is very common, while the arguments in its favor seem quite convincing.
It should be noted that there is no doubt that mistakes in diagnosis are inevitable [29]. As some studies shown, not even, according to data collected in several EU countries, medical errors and health-related adverse events occur in eight to twelve percent of hospitalization cases; preventing such errors could help prevent more than 3.2 million days of hospitalization per year in the EU [30].
Thus, the use of artificial intelligence by doctors should be carried out in such a way as to minimize the possibility of error (both by AI and doctor).
Having said that, it is important to note that legal norms should also be aimed at properly taking into account situations where artificial intelligence technologies are used for evil purposes. It is necessary to introduce appropriate precautions to ensure that patients are not at risk when doctors use artificial intelligence technologies. This can be achieved by introducing specific forms of notification to authorities and a monitoring mechanism. And, of course, it is necessary to raise awareness of patients so that they know the signs that may indicate that contacting a particular medical institution may pose a danger [31].

Future directions
It is possible to identify areas that in the future will allow you to realize all the possibilities of neural networks and ensure their convenient use by doctors: • Achieving a sufficient level of AI transparency. When using algorithms, the doctor should know how the neural network received the diagnosis and whether he or she can be trusted. Scientists note the importance of introducing human cause-and-effect relationships into algorithms and developing an explanatory interface.
• Integration of artificial intelligence into information systems. It is necessary to overcome the existing barriers in data exchange. At the same time, the system must not only collect information, but also effectively extract clinical information.
• Development of interdisciplinary strategies. Algorithms should help the entire diagnostic process, not just the detection of a specific disease. Concluding, we can say that we move in a smart medicine era when AI decisions will be widely used to improve clinical decision-making. However, we are sure artificial intelligence now can only be used as a means of help to doctors. It is important to state that medical professional intelligence, not artificial intelligence, must always be at the heart of patient care and be central to strategies that move medicine forward. At least at the moment, no one wants their radiograph data to be taken and diagnosed by Artificial intelligence without any further control and analysis by medical professional. However, we think that in not far future, in some simple medical cases we can fully rely on AI conclusion. But is should be clearly defined by legal rules.

Conclusion
We considered AI use in healthcare from both sides: information technologies and legislation. We are sure that information technologies will make medicine much more effective and will help people to have healthier life.
We think, to further improve the legal framework of future healthcare, it is necessary to study and develop the following aspects of the legislation: • develop and use strict standards to check and implement AI systems in clinics; • define responsibility rules for medical doctor and AI in making diagnosis and choosing the treatment; • protect patient's personal data; • define rights of patients about their possibility to access data about their health and participate together with doctors in decision making. So, triad: medical achievements, information technologies and developed legislation will change future medicine.

Conflict of interest
The process of writing and the content of the article does not give grounds for raising the issue of a conflict of interest.

Compliance with ethical standards
This article is a completely original work of its authors; it has not been published before and will not be sent to other publications until the journal editorial board decides not to accept it for publication. Informed consent was obtained from all individual participants involved in the study.

Ethics declarations
All procedures performed in studies involving human participants were in accordance with the ethical standards of the institutional and/or national research committee and with the 1964 Helsinki Declaration and its later amendments or comparable ethical standards.