Keywords

1 Introduction

Tuberculosis has affected mainly the population living in poor municipal and communal setups having lesser or negligible health infrastructure [1]. These setups lack access to the mainstream healthcare instruments and facilities.

Many patients are hesitant to visit the nearby health centers to give sputum samples due to various reasons. Economic and social factors influence the assessment process thereby depriving the continuity in the treatment even after a positive diagnosis of the TB cases. The follow up of the diagnosis is very challenging in such cases [2]. The probabilistic diagnosis is a lot made on the basis of a combination of clinical symptoms, signs, and radiological findings. Nonetheless the sensitivity and specificity of the diagnostic approaches are inadequate in the endemic population grappled with HIV, systemic viral or bacterial infections, parasitic infections, and bacterial, viral, or atypical pneumonia [3]. Many times the patients specifically children are not documented in registers or informed to the government agencies who are offering various schemes and programs tracking the disease making it difficult to account for the actual beneficiaries [4]. Given the nature of the disease, the microbiological identification of tuberculosis is quite perplexing. The paucibacillary pattern of the bacilli may not always help in concluding the bacilli of TB. With the diagnostic advancements, it is still challenging to conclude about the presence of tuberculosis as the suspect may have very few bacilli [5]. Hence, the childhood tuberculosis has been neglected by various entities like the health workers and researchers, because children often have paucibacillary disease that are not thought to be infectious. Children are considered as least risk disease infection agents for propagation of TB disease within a community [6].

2 Literature Review

Given the nature of the disease, the microbiological identification of tuberculosis is quite perplexing. The paucibacillary pattern of the bacilli may not always help in concluding the bacilli of TB. With the diagnostic advancements, it is still challenging to conclude about the presence of tuberculosis as the suspect may have very few bacilli [5].

Many times the patients specifically children are not documented in registers or informed to the government agencies who are offering various schemes and programs tracking the disease. Making it difficult to account for the actual beneficiaries [4].

There is a worldwide resurgence of tuberculosis including India. An estimate of 14 million of the population is infected with radiologically active TB. These are roughly estimated figures as most of the affected don’t visit nearby health centres. The public and private healthcare services suffer shortcomings like lack of accomplished experts, incorrect diagnosis and misjudged procedures. In the rural and urban slum population areas, specifically the children, women, and young adults are grappling with the contagious disease, due to malnutrition, unhygienic living and working conditions [7]. In the nascent stages, the probable disease affected people are often treated based on the initial symptoms of cough and fever. The actual diagnosis confirms the tuberculosis only after having done the sputum smear test. The suspect must undergo 2 sputum smear sample screening collected early in the morning. In the resource-constrained setting, especially rural areas the screening of these morning samples need expertise and precise modus operandi to confirm the tuberculosis.

The directly observed treatment, short course(DOTS) [8] and Dots Plus programs with an extended aim of extricating this disease has been conceptualized and rolled out across the globe. WHO has been primarily focusing on the African and Asian continents for the successful accomplishment of these programs over many years. Among the 5 components prescribed for DOTS program one of the critical constituent is case detection by sputum smear microscopy [9].

Culturing bacteria to test for TB is much more complex and expensive to carry out than sputum smear microscopy. This is because it requires specific equipment and laboratory facilities. Testing for and diagnosing TB using culture can also take weeks because of the slow growth of TB bacilli [10]. The increased community awareness leverages the successful implementation and wider reach out of DOTS program over the years. In a country as large as India, the complete eradication of Mycobacterium tuberculosis disease is plausible at low-cost infrastructure, administration, and governance. This is feasible by integrating the monitoring of DOTS program at the Rural Primary Health Centre with increased accountability and compliance [7].

Introductory screening and diagnosis of TB are the crucial phases. Primarily Fluorescent microscopy and Conventional (Brightfield) Microscope assisted techniques are used for screening of the bacteria (Mycobacterium). In fluorescent microscopy an acid-fast Fluorochrome (Auramine o) stain environment and the intense light source like halogen or high-pressure mercury vapor lamp are being used for the sputum samples, while the bright field microscopy uses ZN (Ziehl-Neelsen) staining technique on samples to find out sputum smears [11]. Thus the bright field microscopic examinations are way cheaper and accessible in countries like India. The fluorescent microscopes are not only costly but maintenance of equipment also has to be looked into and hence it is less preferred [12] in most of the countries of Asia Pacific region. Bright field/ZN-staining technique is the cheapest and widely used method of screening. In rural areas/remote locations, the ZN-stained microscopy test is the handy method for TB detection and monitoring. The milieu of Computer Assisted Diagnostic methods for well-organized and initial diagnosis of cancer (especially breast cancer), diabetic retinopathy, Chest X-Ray-based TB detection, chronic obstructive pulmonary disease (COPD), has fostered the development of algorithms and methods that will assist automatic detection of TB from ZN-stained slides in the resource-constrained setting [13].

Preemptive Research in the clinical morphology analysis of TB bacteria in India is being attempted by many researchers. Conventionally, the primitive screening and analysis of sputum smears are done manually constrained to various fatigue-related factors. In such scenarios assessment with precision becomes a crucial factor [14]. The programmed identification of TB Bacilli shall improve the accuracy in terms of sensitivity and specificity by lessening the burden of judgment load on the pathology staff in diagnosis [15].

Evolution of Computer Vision techniques for the laboratory diagnosis of tuberculosis assists in order to achieve quick, cheap, and more accurate results. Acid-fast staining and culture for mycobacteria remain at the core of any diagnostic algorithm [16]. The morphology of TB Bacillus is quite simple. These are a thin rod shape with a length of roughly 4 µm and a diameter of 0.5–1.0 µm. The waxy lipid in the cell wall of the bacilli appears red after acid-fast staining in high contrast to the blue background [17]. TB Diagnosis is specifically dependent on such morphology and color. The examination has confirmed 97.94% sensitivity and 83.65% specificity [18]. The performance of watershed segmentation method for detection and classification of bacilli from camera-enabled Smartphone microscopic images as tuberculosis bacilli positive or negative were 93.3% and 87%, respectively [9]. The sensitivity, specificity, and precision rate of watershed segmentation on different infection levels (Scanty, 1+, 2+, and 3+) provided a discordant rate of 3.73% with respect to tuberculosis positive and negative cases [19].

3 Methodology

The proposed system is to develop an automated system which will assist the concerned in counting the number of bacilli in each of the slides. This system is a web application which uses client server model for conveying the information. The important feature is its ability to predict the presence of bacilli in the ZN-stained slide image. In the given sample set of sputum smear images the detection of M.Tuberculosis bacilli is done using the two main features (a) Area and (b) Perimeter of bacilli. These features are processed after applying the morphological transformation using the canny edge detection method. The usability of this system is very high and can be used by primary healthcare center practitioners. The application may assist the technician with inadequate experience who are burdened with examining many samples throughout the day. Dependency and non-availability of an expert pathologist may be dodged. This application will grade the ZN slide based on the count of bacilli obtained from the system and analyze the effect of treatment based on difference in grading over the period of treatment. This system mainly assists the practitioners in counting the number of bacilli present in ZN slide and not to replace their human judgment in the procedure. The ZNSM-iDB [19] has been used for the development of the proposed system used in automated microscopy using computer vision techniques. In the developed system we take ZN slide images as the input and process them to obtain the bacilli count as the output.

The ZN slide image taken as the input and uploaded using Django framework. The transitional processing passes through multiple stages such as masking, morphological transformation, edge detection, area filtering, perimeter filtering, etc. (Fig. 1).

Fig. 1
figure 1

Client server architecture used in the application

These phases are applied to remove the unwanted background noise. The uploaded image can be previewed on the home page. Once the image is uploaded and the processing is done, the result along with the intermediate results can be viewed. The result is shown by displaying the bacilli count and the grading for the obtained bacilli count. The user interface also displays the grading scale on the result screen for reference.

3.1 Implementation Framework

The application comprises of 3 methods to grade the cells,

  • Divide and Conquer

  • Masking and Tracing

  • Canny Edge Detection.

3.1.1 Divide and Conquer

This is the first module implemented which divides the entire image (Fig. 2) into multiple segments similar to the divide and conquer method where a solution is found by recursively dividing a problem into its sub-problems and combining these results to obtain a final complete result of the original problem.

3.1.2 Masking and Tracing

In this module the whole image is masked and morphological transformations are applied to it. This provides us with a grayscale image of the ZN slide with bacilli in white on black background. Contours are applied on this to count the white segment which is present on the black background.

Fig. 2
figure 2

Original image

3.1.3 Canny Edge Detection

This functionality is used to find out the bacilli present in the image. This technique works in phases to detect edges in a given image. First, a Gaussian filter is used to reduce the noise in the image. In the second phase edges are detected horizontally, vertically, and diagonally by finding the intensity gradient of the image. This is done by applying a pair of convolutional masks. In the subsequent stage, the pixels which are not edges are suppressed (or removed) from the image. Thus, only the candidate edges which constitute the edges will remain and move on to the next stage. In the last concluding stage, the algorithm uses two threshold values: upper threshold and lower threshold. If the pixel gradient is higher than the upper threshold, then it is accepted as an edge. If the pixel gradient is lower than lower threshold, then it is rejected. For the pixel gradient which lies between these two values, if the pixel is connected to a pixel with upper gradient, then it is accepted or else it is rejected. The developed system systematically utilizes all the above phases. It filters out unwanted background noise by methods such as area-based filtering (Fig. 3) and perimeter-based filtering (Fig. 4) which has a predefined threshold value and anything which was detected by Canny Edge Detection method which does not fall into the defined threshold value will be removed and will not be considered during the counting process (Fig. 5).

Fig. 3
figure 3

Perimeter filtered image

Fig. 4
figure 4

Area filtered image

Fig. 5
figure 5

Output of the canny edge detection method

3.2 Outcome

The number of bacilli seen in a smear reflects disease severity and patient infectivity. Therefore, it is important to record the number of bacilli seen on each smear. The grading of bacilli is done according to the grading scheme mentioned in the Table 1.

Table 1 Grading of sputum smears

Here +++ (pronounced as three plus) is the most severe case of the disease. One positive specimen out of the two is enough to declare a patient as smear-positive TB. Sputum smear microscopy for bacilli is positive when there are at least 10,000 organisms present per ml of sputum. In the application 84 images were used as input from the ZNSM-iDB dataset. These images were picked up from Autofocusing Dataset, viewfields with overlapping (occluded) bacilli, viewfields with single or few bacilli, and viewfields without bacilli. All the images were put through the test and validation. The final result was taken based on the average of all the three aforementioned methods. These methods mainly use OpenCV functions for analyzing and computing the results. Averaging is done since there might a loss of bacilli in one of the methods and a background noise may be considered as some additional bacilli in a different method. The grading application has shown the tolerance of up to 20% on all the assorted images. The tuberculosis bacilli were graded based on the 5-point grade scale mentioned in the above table. The system has classified the number of bacilli present with 80% accuracy.

4 Conclusion

All the present diagnostic methods like Serology, Microscopy, X-ray, and Culture-NNAT have their pros and cons. The usage of these methods is solely dependent on the resource demographics. The limitations of existing diagnostic methods used in most of the developing countries like India 1. Sputum Smear Microscopy, 2. Chest X-ray, 3. Genexpert/CB-NAAT, and 4. TrueNat paves advances in the automated TB diagnostic research. Genesis of upgradation in the rudimentary diagnostic technique may preempt the cost factor required in the infrastructure setup of various diagnostic routines. Quick implementation of new assessment techniques will address the growing requirements of affordable public health in developing countries. Keeping this in mind we are attempting at discovering an algorithm with an aid of computer vision technique. Manual diagnostics finding in tandem supported by automated tools may pull more and more rural patients toward continuation of the treatment of the disease. The developed application is designed at utilizing the open-source platforms which are cost-effective and shall help the government agencies in resource-laden countries.