Tele-Ophthalmology Android Application : Design and Implementation

Diabetic retinopathy is the leading cause of blindness in the world population. Early detection and appropriate treatment can significantly reduce the risk of loss of sight. Medical authorities recommend an annual review of the fundus for diabetic patients. Several screening programs for diabetic retinopathy in the world have been made to implement this recommendation. The purpose of this paper is to implement the idea and principle to facilitate the detection of this disease using tele-ophthalmology and the latest telecommunications technologies. The present paper aims to develop an Android app named "RETINA" which captures retinal photographs using a microscopic lens, process them via several operators based on mathematical morphology after a filtering step by exploiting the library "OpenCV", and stores them in a local or remote MySQL database. The application also offers a small service and facilitates the task for the doctor and ophthalmologist by allowing the inspection of files of remote patients. Keywords—Diabetic retinopathy; Screening; Fundus; Teleophthalmology; Android; Mathematical morphology; OpenCV; Database


I. INTRODUCTION
The advent of information technology and communications (ICT) has revolutionized the field of health to support the transformation of care delivery approaches [1], [2], [3].In this sense, they represent an important asset allowing to provide answers to the new challenges health systems face [4], [5].Indeed, the literature refers to the fact that the sharing and exchange of information via the tools of ICT can contribute to improved safety of the care and quality of care ; that to the extent that these tools enable healthcare professionals to have access to relevant information at all times and where they practice [6], [7].For organizations, ICTs promise to improve their performance and efficiency, allowing them to manage, share and store large amounts of data [8], [9].The industrialized countries have invested in ICT as a strategic choice to try to remedy the problem of access to care and the lack and / or the geographical maldistribution of health professionals on their vast territories.Indeed, with the transformations of their health systems, these countries have adopted several sociohealth strategies and politico-economic converging towards the establishment of information highways and telemedicine.In fact, most no reform or health policy can be designed without taking into account the role that ICT can play, including telehealth, they appear as one of the essential conditions for the success of the reorganization [10].Telemedicine seems like a lever for transformation of the health system.Indeed, it is seen as a way to address the issue of territorial and economic disparities in access to care, because it eliminates geographical barriers while contributing to the emergence of another way of thinking about medical practice and offer of care [2], [11], [12].
Telemedicine is a new tool that gives very attractive to people in remote areas access to medical care and advanced technology from the rest of the population.If he no longer has to travel far for treatment, the patient is more likely to first consult the doctor [13], because, as we know early detection is crucial in many cases.
Simply, telemedicine is remote exchange of information and medical care.It has multiple uses.Essentially, it can be used for all aspects of medicine: prevention, diagnosis, treatment, education and research especially in sub specialties such as ophthalmology, dermatology, pathology and radiology where image is key to differential diagnosis.
In ophthalmology, we use the medicine in recent years in various ways.There was, in Europe, several research projects including the real-time video conferencing, visual electrodiagnostic, transmission of color photographs of the fundus and transmission of videotapes for evaluating the position and mobility of the eye.This technology allows specialists around the world to assess a case and discuss the treatment options field.This is particularly worthwhile when you have doubts about the diagnosis: several specialists in the world can then work together to examine the ambiguous images ophthalmology.
In 2001, Niewenhof et al. [14] concluded data they published on the use of telemedicine as a diagnostic tool for eye diseases that the new technology was an affordable and reliable instrument especially when the images transmitter knows pathologies in question.
In Canada, the Northwest Territories and Alberta are developing a teleophthalmology project that will use the new technology to detect early signs of retinal complications in diabetic natives.The technicians will train the regional health service of Stanton in Yellowknife to make annual retinal screening tests using portable digital devices.They will visit remote communities in turn, will test and transmit information in Alberta for diagnostic purposes.Whereas a native of ten suffers from diabetes may lead to retinopathy and blindness often, the project will significantly affect the everyday life not only for patients but also their families and the entire community [15].
Other challenges that will face telemedicine and teleophthalmology include the natural resistance of many health professionals and patients to changes brought by technological developments and the current limitations of robotic telesurgery [16].Ideally, the inevitable growth of the use of telemedicine will benefit a larger number of patients regardless of their geographical, social and economic situation.
Diabetic retinopathy is a public health problem worldwide.The latest estimates indicate that 382 million people or 8.3% of adults have diabetes worldwide and this number will exceed 592 million in less than 25 years [17].Almost 80% of people are in developing countries and nearly half of patients have some degree of diabetic retinopathy at some point.Diabetic retinopathy (DR), microvascular complication of diabetes, remains the leading cause of blindness and visual impairment in subjects under 60 years in all industrialized countries [18].Indeed, R & D is a silent disease for many years; it only becomes symptomatic stages of complications.Without treatment, it is causing a visual impairment up to blindness or the interests of early detection.
Diabetic retinopathy (DR) remains a cause too frequent visual impairment in industrialized countries, especially in the labor force.Its severity remains linked to its belated support because of inadequate screening [19].
Originally, the mobile phone is supposed to allow its user to call relatively anywhere.But in recent years, the market for feature phones -and smartphones -has gained ground and is necessary in our pockets or handbags.Under Android, iOS or BlackBerry, these devices are now almost forget the main function which is to them a call.
The arrival on the market of this new class of powerful and affordable terminals is the main vector of several innovations in various fields, particularly in the medical field.
The increased use of medical applications for smartphones offers new opportunities for doctors, including ophthalmologists.
The smartphone market is increasing worldwide in recent years.It is estimated that over one billion the number of outstanding smartphones in the world [20].Recent series, 74-98% of doctors own a smartphone and this percentage is probably going to increase in the coming years [21], [22], [23].
The arrival of smartphones and tablets in our daily practice sounds by the force of circumstances, and often unconsciously on how we handle our patients.The use of medical applications in smartphones attracting more and more interest.It changes the way in which we approach the care but also opens up new management perspectives [24], [25], [26], [27].
With its exponential success, the Smartphone has quickly become one of the essential links in the chain of telemedicine.This miniature tool with many sensors that can connect to almost all networks (Internet, GSM, 3G ...), is now seen as being ideal for different types of applications [28].
One of the most important preferential application areas that can be identified is the monitoring of chronic diseases such as heart disease, Alzheimer's, diabetes, etc.Among chronic diseases, our choice fell on the disease of diabetes, one of the most prevalent diseases in the world today which affects a very significant portion of the world population, which is described by some as "the disease of the XXI century".
The remainder of this paper is organized as follows: in Section II, basic concepts related to the image processing are presented such as filtering, morphological operators.The section III discusses all steps behind the realization of the application.Conclusion is presented in the last section.

II. APPLICATION DESCRIPTION
The "RETINA" application helps fulfill the principle of remote tele-ophthalmology to allow early detection of diabetic retinopathy.It consists of two parts, one dedicated for patients and the other for doctors.
The first allows through a microscopic lens, which is connected to a smartphone, capturing the fundus of diabetic patients that may have a visual defect because of diabetes including diabetic retinopathy.The application then provides multiple choice of image processing (filters and morphological operators ...) to improve the quality of the captured fundus and thus facilitate the detection of these anomalies.Personal information of patients with fundus images are then processed in a secure MySQL database.
This application also provides information on the diabetic retinopathy, and its clinical signs.The second application dedicated to doctors allows to search in the database the processed images of the fundus of patients according to their ID numbers, display them on the interface to be viewed by the doctor, who will then give its diagnostic and recommendations to their patients by email.
The following section provides more informations about the different features that characterize our application.

A. Connection Establishment
In a first step, an interconnection between the mobile terminal and the server should be performed.It will therefore agree on the same tunnel (port, address, etc.) between this device and its corresponding so they can share data.About this connection, we have exploited the http protocol to manage the inputs/outputs of the server, including the personal information of patients.

B. Image Acquisition
After recording information related to the patient, the application gives us access to the smartphone's camera to capture the fundus.For this we use a microscopic lens with a universal clip, with a 60x and 100x zoom.But the result was not as reliable as expected so we used the e_ophtha_MA database to have retinal images.It was extracted from the telemedicine network OPHDIAT for screening of DR.This part does not require a particular study, it is only the library of Android that allows such manipulation.

C. Image Processing
Despite enormous progress in the image acquisition techniques, the retinal images taken at the clinic daily are often very noisy, they suffer from low contrast and illumination is not uniform.The reasons may be of varied origins: • Possible diseases (such as cataracts).
• Circumstances in which the picture is taken.
• Differences in the illumination of the eye, which depend not only on technology but also on the shape of the patient's eye.
Apply image enhancement algorithms, i.e. the contrast enhancement or filtering to remove noise.These algorithms have two possible purposes: 1) On one hand, this type of algorithm is used to facilitate the work of a specialist by giving it improved images to analyze the particular algorithms to increase contrast.2) On the other side, all methods of automatic analysis or semiautomatic begin with a pre-filtering of the image, therefore, improvement can be seen as a first step toward automatic analysis of retinal images.
In our application, with the library "OpenCV", we were able to integrate pretreatment methods, and morphological operators, which we will define later.

1) Pretreatment: a) Adaptive histogram equalization -:
To account for all the spatial distribution of gray levels in the image, a adaptive equalization is used as it is depicted in Figure 1.This technology is to divide the image into non-overlapping rectangular regions.b) Filtering -: Filtering is a basic operation in image processing, it allows the perception of certain details, reduce noise, compose the defects of the sensor.One of the filters used in image processing of our application is the Gaussian filter.This linear filter better handles cases or vessels appear darker than the background.Figure 2 shows an example of filtering with Gaussian filter.c) The Gaussian filter -: The intensity of a pixel depends on that of its neighbors: Let U (x), the gray level of a point x of the image to be processed and G the Gaussian kind given by the following formula.
2) Morphological operators: Mathematical morphology offers a large number of very powerful image processing and analysis tools that can be found under different headings in some image analysis software and even image editing, whose purpose is the study of objects according to their neighborhood, their texture and their grayscale or their color by the transformations it proposes.Mathematical morphology was invented in 1964 by GEORGES MATHEPON and JEAN SERRA in the laboratories of Paris Mines School.To analyze images using mathematical morphology, we rely on a certain number of operators that we specify and combine to arrive at the desired result.Morphological operators are divided into two types: • basic morphological operators: erosion and dilation.
• compound morphological operators: they are formed by a successive application of set operators that the union, the difference.
The basic principle of mathematical morphology is to compare the image to be analyzed with a set of known geometry called structuring element.

a) Morphologic erosion:
The morphological erosion of an object X by the structuring element B is defined by the principle of duality: The operation of the erosion of a set X by a structuring element B, is the set of points x of R 2 such that B is fully included in X when x is centered in x.
b) Morphologic dilation: The dilation operation denoted δB(X) is in fact the dual operation of erosion.We obtain the dilated of a set X by a structuring element B taking the totality of the covered surface when the origin of B successively occupies all the positions x ∈ X.Since erosion and dilation are elementary morphological operators, it comes Figure 4 shows the morphological opening operation.
d) Morphological closing: By reversing the order of the operations used to define the opening, we obtain a new operation called closing.This operation is performed by concatenation of a dilation followed by erosion of the structuring element.The morphological closing makes it possible to fill the holes in the image, it can connect two related particles to become one.
Figure 5 shows an example of morphological closing operation.
e) Top hat transformation: Top hats are used to locate structures in the image that are smaller than the structuring element.They are usually applied only to grayscale images (see Figure 6).So, it allows to extract all the details of an image that have removed by filtering (opening or closing).The top hat transformation can be divided into: • "White top hat": to detect what the opening has caused, it is calculated by the difference between the image and its opening.
• "Black top hat": allows you to extract valleys or dark structures from the image.It is calculated by the difference between the closing and the image.

III. REALIZATION OF THE APPLICATION
The pltaform of the application is represented by the Figure 7 where the different parts and the possible transitions between them are showed.This application is done under Android environment using the Open source software library Computer Vision (OpenCV).OpenCV has more than 2500 optimized algorithms.The library includes a complete set of computer vision algorithms and learning algorithms.It has been around for a decade and is released under the Berkeley Software Distribution (BSD) license, making it easy for users to use and modify the code.OpenCV for Android supports access to its functions through its native API and also its Java wrappers API.In the case of a native API, you will define your native library using Android NDK and include the OpenCV libraries that you are using.Then, you will call your native library from the Java code using Java Native Interface (JNI).The other option is to use the OpenCV Java wrappers directly in your Java code using the usual Java imports.What will happen is that the Java wrappers will channel your calls to the native OpenCV libraries using JNI [29].
Our application consists of two parts, a part dedicated to the patients named "RETINA PATIENT" and another dedicated to the doctor named "RETINA DOCTOR".

A. RETINA PATIENT
A flowchart of RETINA PATIENT is depicted in Figure 8.When launching the application, a home page is displayed, followed by an authentication phase asking the user for his login and password (see Figure 9).This step allows a single authentication of users of the application, which allows a RETINA system protection of malicious uses.If the authentication is wrong i.e. login or the password is incorrect, an error message will be displayed to the user to try again.If authentication is successful, a window appears with four buttons labeled "NOUVEAU PATIENT", "DOSSIER PATIENT", "RETINOPATHIE DIABETIQUE" and "RETOUR" (see Figure 10).The "DOSSIER PATIENT" button leads to a personal form where the user must fill in all the necessary details of the patient to be examined.Once all fields are filled, clicking on the "Ok" button creates a new line in the MySQL database, so a message informs us that the new patient has been successfully inserted Fig. 9. Authentication page into the database.The "RETOUR" button is used to return to the main menu, and thus cancel the registration of this patient.
After the patient registration phase, a menu is displayed, and gives us access to the smartphone camera, by pressing a button labeled "CAMERA" to take pictures of the fundus to the using the Smartphone camera or the small microscope connected to our Smartphone if the camera of the Smartphone has a low resolution.We can also load the fundus images if they are stored in the gallery (see Figure 11).After the selection, the image appears and it will be ready for processing.The latter makes it possible to: i) convert the image taken by the camera or loaded from the Smartphone gallery to gray level in order to apply other treatments, ii) improve the contrast, iii) select a filter among the three (Median, Average and Gauss), iv) or apply a morphological operator among the five (Tophat, Blackhat, Dilation, Erosion and Opening).All of these methods have been integrated through the "Opencv" library for Android.
From the button "DOSSIER PATIENT" of the main menu of RETINA, we have the possibility to change or modify the information's that are already registered in the database of our patients.These changes can be made after a file search by number to change either the patient's personal information or to update his fundus photo.A message informs us that the changes made have been saved successfully.The button "RETINOPATHIE DIABETIQUE" of the main menu, gives us some information about the disease, its definition, its symptoms and its causes.The "QUITTER" button allows us to leave the application in a secure way, and this after the confirmation message "Are you sure you want to leave?"

B. RETINA DOCTOR
The principle of RETINA DOCTOR application is described by the Figure 12.It allows the ophthalmologist to access the database, after a step of personal authentication, and have the opportunity to see the coordinates and the fundus photos of his patients, thanks to the file number, so to be able to make then its diagnosis, and its recommendations (see Figure 13).If the entered folder number is not correct or does not exist in the database, an error message is displayed.If necessary, the patient will be summoned by the ophthalmologist via his mailbox.Finally, we note that the design and implementation of the application RETINA was made in collaboration with experts and professionals in the field of health including specialists in ophthalomology.As the number of patients with this condition increases each year, therefore, screening for diabetic retinopathy is currently a major problem.In this paper, we have developed an Android diagnostic aid application for scanning fundus images remotely using telemedicine tools and techniques, thus reducing the number of patients that need to be examined by ophthalmologists.In addition, improve the quality of care provided to patients by maximizing the number of diabetics examined per year and by reducing patient waiting times.The application is divided into two parts, a part dedicated to the patients allowing them to record their images of the fundus in a database after taking them or loading them from the gallery of their smartphones, and a second part dedicated to doctors who will be able to consult these images from a distance by accessing the databases for an eventual diagnosis.

Fig. 2 .
Fig. 2. Retinian image filtering (a) Improved image (b) Filtering with gaussian of the improved image