Engineering, Technology & Applied Science Research Vol. 7, No. 6, 2017, 2160-2166 2160 www.etasr.com Yilmaz and Turan: FahamecV1:A Low Cost Automated Metaphase Detection System FahamecV1:A Low Cost Automated Metaphase Detection System Hakan Yilmaz Computer Programming Department TOBB Tech. Sciences Vocational School Karabuk University Karabuk, Turkey hakanyilmaz@karabuk.edu.tr M. Kamil Turan Biology and Genetics Department Faculty of Medicine Karabuk University Karabuk, Turkey kamilturan@karabuk.edu.tr Abstract—In this study, FahamecV1 is introduced and investigated as a low cost and high accuracy solution for metaphase detection. Chromosome analysis is performed at the metaphase stage and high accuracy and automated detection of the metaphase stage plays an active role in decreasing analysis time. FahamecV1 includes an optic microscope, a motorized microscope stage, an electronic control unit, a camera, a computer and a software application. Printing components of the motorized microscope stage (using a 3D printer) is of the main reasons for cost reduction. Operations such as stepper motor calibration, are detection, focusing, scanning, metaphase detection and saving of coordinates into a database are automatically performed. To detect metaphases, a filter named Metafilter is developed and applied. Average scanning time per preparate is 77 sec/cm2. True positive rate is calculated as 95.1%, true negative rate is calculated as 99.0% and accuracy is calculated as 98.8%. Keywords-automation; metaphase detection system; focus; image processing; 3D printing; FahamecV1 I. INTRODUCTION Analysis of metaphase plate images by a computer aided application is a main method used in hospitals and laboratories. In this stage, accuracy plays an important role. Automatic metaphase detection and retrieval with high objective resolution for image analysis is quite beneficial [1]. Cytogenetic analysis includes two stages: detection of metaphase and karyotype analysis [2]. It is essential that all chromosomes are monitored and classified with high accuracy. These monitoring and classification processes are usually performed by clinical experts. This situation causes human- driven mistakes, wrong diagnosis and loss of time and thus automated systems are bound to be employed. Metaphase detection system is a system which automatically scans, detects and monitors metaphases [3]. A metaphase detection system generally includes a camera attached to the ocular piece and a computer controlled motorized microscope. In addition to this, artifacts of other cells and paint residues exist. Removing these artifacts and residues is the first step of a high qualified analysis [4]. The improving of diagnostic accuracy and consistency has been studied in [5, 6]. Researchers have developed many systems to detect metaphases [1-3, 7-11]. Authors in [1] have developed a system which detects metaphases painted with FISH and uses a fluorescent light source. Authors in [2] have released a metaphase detection system named Metafer2 which registers X-Y-Z coordinates of metaphases. Authors in [3] have produced a low-cost system to detect metaphases using morphological operations. Authors in [4] have utilized artificial neural network to identify metaphases and nuclei. In [10], author used a trained classifier to separate metaphases with non-metaphases. Authors in [12] have applied and test computer aided methods such as classical statistical methods, artificial neural networks, knowledge based fuzzy logic systems. Authors in [13] tested the performance of four commercial systems. There are two groups considered in metaphases detection systems assessment, the true positives (TP) and true negatives (TN). While TP stands for areas including metaphases, TN stands for areas not including metaphases. Under ideal conditions, these two groups are independent. However, independence is inattentive at metaphase detection systems since object detection is a complicated process. Consequently, results obtained by applications are evaluated by a clinical expert [14]. In this study, a metaphase detection system named FahamecV1 consisting of hardware and software has been implemented. FahamecV1 is low cost and modular, can be connected with different microscopes, provides high accuracy and high scan speed. Most components of FahamecV1 are printed by a 3D printer and can be reprinted and easily modified. FahamecV1 can be connected with a manual microscope in a fast manner. All components used in FahamecV1 are composed of single, independent and easily provided parts. In addition to hardware properties of FahamecV1, an application has been developed to self- calibrate, perform focus, detect metaphases and save coordinates of detected metaphases in a database. A filter named Metafilter was developed in this study and is applied to detect metaphases. FahamecV1 excels among other systems because of the easy use of hardware and software, low cost, high scan speed and high accuracy. Engineering, Technology & Applied Science Research Vol. 7, No. 6, 2017, 2160-2166 2161 www.etasr.com Yilmaz and Turan: FahamecV1:A Low Cost Automated Metaphase Detection System II. SYSTEM MATERIALS FahamecV1 is composed of an optic microscope, a motorized microscope stage, an electronic control unit, a camera, a computer and an application. Figure 1 depicts an overview of the system. Fig. 1. Overview of FahamecV1. A. Camera A DigiRetina16 USB camera produced by Tucsen is used to obtain images from the microscope. Images are captured using 25 frames per second (FPS), 4 megapixel (MP) resolutions, auto white balance and auto exposure time. B. Microscope The produced stage is connected to binocular Soif optic microscope. This microscope is selected because of its low cost. 4X, 10X, 40X and 100X objectives exist on the microscope and 10X ocular is attached. It is a manual microscope which has a halogen light source, focus and coaxial screws. The produced microscope stage is connected to the microscope by removing its original microscope stage. Halogen light source is replaced with led light source since halogen light source brings about noises on images. 10X objective is preferred as an active objective to scan. 0.45X connection mount is used to attach camera with ocular. C. Electronic Control Unit and Computer An electronic control unit is located in a metal box which has a 12 cm diameter fan. A socket structure is used. Hence, it is assured that FahamecV1 is easily assemblied and disassemblied in case of failure or transport. A power supply with output properties of 12V and 5A is selected. A4988 stepper motor drivers are selected to control stepper motors. Arduino Mega 2560 is selected as a main control card. Commands of the control card are sent by the application. “#” symbol is put between the numbers of the activated stepper motor, count of steps, delay time for steps and direction of rotation. The “$” symbol is put at the end of the command line. Hence, the command shown in Figure 2 is sent to the control card as a single command. Fig. 2. The command line sent to the control card. The used computer has an Intel i7 2.50 GHz CPU and 8 GB RAM. C and C# programming languages are preferred for the developing of the application. C programming language is used in Arduino IDE and C# programming language is used in Microsoft Visual Studio 2015. D. Produced Motorized Microscope Stage The automated motorized microscope stage produced in this study is composed of stepper motors, ball screws and nuts, miniature rails and runner blocks, end-stop modules, carrier component, main table, preparates carrier and connection materials. The main table is produced using aluminum materials by laser cutting. The carrier component used at the bottom to provide connection of motorized microscope stage to the microscope and the other plastic parts are produced using PLA materials by the 3D printer. 12 mm diameter ball screws, 4mm nuts and the stepper motors whose types are NEMA17 and 200 steps for a rotation are used. Heights of the miniature rails and the runner blocks which provide the main table with slipping on Y axis are 10 mm. Limited space between the microscope objective and the light source is effectively used. The motorized microscope stage height is 26 mm (Figure 3). As a result of this, enough space for focus is created. Single and triple preparates can be scanned. The end-stop modules exist on each axis to identify home location. The modules are selected as mechanic switches. The focus screw and shaft of the stepper motors are composed by a coupler (printed on 3D printer) to make Z axis move. Fig. 3. Overview of the 3D drawing of the produced motorized microscope stage. E. Preparates The preparates used in this study are not highly qualified for analysis, idle and need to be reprepared. Images are Engineering, Technology & Applied Science Research Vol. 7, No. 6, 2017, 2160-2166 2162 www.etasr.com Yilmaz and Turan: FahamecV1:A Low Cost Automated Metaphase Detection System captured at 2304x1728 resolutions using the preparates. Size of the preparates is 76x26 mm. The painted areas whose widths on the preparates are 28 mm are used for patient information and brand labels. The 48x26 mm2 areas on the preparates are transparent. 36x16 mm2 areas on the preparates are accepted as active scanning areas. The remaining areas are accepted as inactive areas and are not scanned because metaphases whose chromosomes are either rarely or excessively spread exist on inactive areas. III. METHODS The application was developed at four stages: scanning preparation, focus, detection of metaphases and saving coordinates of metaphases. The application automatically brings preparates to the initial point, communicates with the electronic control unit, calibrates axis, performs focus, detects metaphases and saves coordinates of metaphases in a database. A scanning name is the only one necessary parameter needed for one to start scanning. During scanning, metaphase images and parameters such as the number of detected metaphases, metaphase coordinates and frame scanning time are monitorized synchronously. One of the interfaces provides access to enter properties as: full step number for a rotation of the stepper motors, micro step levels of the stepper motor drivers and size of the ball screw pitch. A. Scanning Preparation The application sets a rectangle as the current scanning area. The rectangle width is 1.2 mm on X axis and the rectangle height is 0.9 mm on Y axis. To scan preparates, it is needed to scan 30 different image areas on X axis and 18 different image areas on Y axis. Hence, the preparates are split to a grid which contains 540 cells of 18 rows and 30 columns. The application detects metaphases by scanning each cell. An end-stop module which identifies home location on each axis is used. The application sets all coordinates to zero by moving to home location before each scanning. Therefore, FahamecV1 calibrates itself automatically. B. Converting the Stepper Motor Steps as Metric Units A specified step number is necessary for a full rotation. Although the stepper motors take 200 full steps for a rotation, the stepper motor drivers provide 3200 steps for a rotation. This rotation movement is converted to linear movement by the ball screws and can be used with different pitches. However, value of steps for a rotation is changed after either the stepper motors, the stepper motor drivers or the ball screws is replaced. Thus, it is needed to calculate metric changes of the preparate on X-Y-Z axis. Micro step level as M, full steps for a rotation as FS, distance as D and ball screw pitch as SP are used to obtain the equation which finds how many steps should be taken by the stepper motor (1). This equation explains how the application controls the stepper motors. This control is performed until the stepper motor moves to 0.01 mm on X-Y axis and 0.001 mm on Z axis. steps = (M x FS x D) / SP (1) C. Focus Since blurred images can directly affect diagnostic accuracy, it is critical to obtain focused high-resolution microscopic images efficiently. Thus, an autofocus technique is required for high efficiency microscopic system in clinical practice [15]. Capturing images and detecting metaphases with high accuracy depends on performing proper focusing. In the application, there are two focus functions: one-way focus and two-way focus. There are also first focus, main focus and short focus which are components of one-way and two-way focuses. FahamecV1 automatically decides which focus component should be applied. First focus and main focus use one-way focus function. Short focus uses two-way focus function. First focus is applied at the beginning of scanning. Short focus is applied once at every 10 cells. Main focus is applied when short focus fails, because short focus runs at a limited distance while main focus runs from home location of Z axis. All focus components are applied automatically by FahamecV1. Histograms of captured images are investigated at red, green, blue and intensity bands. It is proved that the best result is obtained at intensity band when the thresholding method is applied (Figure 4). Focus value is calculated when a comparison between all pixel counts and white pixel counts is made. Focus position is identified when the focus value is calculated as maximum. When main focus is performed, Z axis is located at home location and the stepper motor starts rotating counter-clockwise. The focus value is calculated at each 0.002 mm. When a new focus value is calculated, it is compared with the current focus value. If the new focus value is higher than the current focus value, the new focus value is replaced with the current focus value. When the new focus value is lower than the current focus value, calculation of focus value is stopped. As a result, the stepper motor rotates clockwise and is located at maximum focus position. Hence, necessary focus process is completed before FahamecV1 starts scanning (Figure 5). The shape of the preparate carrier can be deformed due to the ambient temperature changes because materials used as preparate carriers are produced using PLA materials. In this case, short focus is necessary to be applied. While short focus is applied, the stepper motor rotates until obtaining an image and a first local focus value is calculated as maximum of this period. After that, the stepper motor rotates by changing direction until obtaining a second image and a second local focus value is calculated as maximum of the second period. The two local maximum focus values are compared and the higher one is identified as a short focus value. Z axis is located at short focus position. Therefore, the best qualified image is obtained (Figure 6). D. Detection of Metaphases After focus is performed, FahamecV1 starts scanning cells. The images are converted to intensity band and contrast stretching method is applied. Bradley local thresholding method is applied on the images [16]. Sobel edge detection method, erosion and dilation processes are applied. As a result of that, metaphases and non-metaphases stay on the images. Metafilter is applied to detect metaphases and eliminate non- metaphases (Figures 7-8). Engineering, Technology & Applied Science Research Vol. 7, No. 6, 2017, 2160-2166 2163 www.etasr.com Yilmaz and Turan: FahamecV1:A Low Cost Automated Metaphase Detection System Fig. 4. Original image, b. Image view of R band and its histogram graph, c. Image view of G band and its histogram graph, d. Image view of B band and its histogram graph, e. Image view of Intensity band and its histogram graph. Fig. 5. Main focus graph(upper), overview of main focus (lower). Fig. 6. Short focus graph. Fig. 7. a. Original image, b. Contrast stretching and grayscale, c. Bradley local thresholding, d. Sobel, e. Morphological operations, f. Metafilter. E. Saving Coordinates of Metaphases Center coordinates of detected metaphases are calculated and saved in a database. Relocation can be applied for each detected metaphase whose coordinates are saved. Thus, preparations for chromosome scanning with 100X objective are to be completed. IV. RESULTS AND DISCUSSION This study is evaluated according to customizability, scanning time, cost, loss of relocation and accuracy. The fact that FahamecV1 can easily connect and disconnect with other microscopes enhances FahamecV1’s ease of use. FahamecV1 is faster than noncommercial systems based on scanning time per preparate. It is presented that FahamecV1 is quite cheap when the camera, the microscope and the computer are not considered. A. Customizability The stepper motors, the stepper motor drivers and the screw balls can be changed in case of failure. When the same materials cannot be found, different types of stepper motors, stepper motor drivers and screw balls can be used. By using one of the interfaces, properties of the different types of materials can be entered and saved. Hence, FahamecV1 continues scanning without data loss. The fact that many components are specially printed by a 3D printer makes material supply easier. The connection of FahamecV1 with the manual microscope is performed by using four screws for carrier components and one screw for Z axis. It is also possible that the microscope can be restored by removing the five screws. If FahamecV1 is requested to connect with another microscope, it can be done easily by suitable printed carrier components (Figure 9). B. Scanning Time Time interval is between 34 and 78 milliseconds per image during all image processing operations. The time interval is between 384 and 506 sec to perform scanning on active scanning areas (36x16 mm2). During scanning, focus is performed 54 times on average. The time passing while performing focus is included total scanning time. FahamecV1 needs 77 sec average time to scan per cm2. The average scanning speed of FahamecV1 is measured as 1.29 mm2/sec. Engineering, Technology & Applied Science Research Vol. 7, No. 6, 2017, 2160-2166 2164 www.etasr.com Yilmaz and Turan: FahamecV1:A Low Cost Automated Metaphase Detection System Fig. 8. The flow chart of Metafilter. Fig. 9. The carrier component. C. Cost Low cost materials are selected to produce FahamecV1. The expenditure was 600 dollars for the microscope, 1285 dollars for the camera, 285 dollars for the electronic control unit, 22 dollars for the filament used in 3D printer, 71 dollars for laser cutting and 28 dollars for other expenses. Total expenditure was 2291 dollars including taxes (Table I). D. Loss of Relocation The screw balls, the nuts, the miniature rails and the runner blocks used to produce the motorized microscope stages are generally preferred in industry area. Therefore, loss of relocation occurs when measurements in micron level are performed. The effect of these measurements on 100 micron steps is measured and modeled with a microscope micrometer (Figure 10). Spearman, Kendall Tau and Pearson correlation analysis are performed on obtained measurements. As a result of these analyses, coefficient of correlation is obtained as close to zero and P-values are very close to each other (Table II). TABLE I. COSTS Unit Price All system Camera, microscope, automatic motorized microscope stage Automatic motorized microscope stage Computer 700 + Microscope 600 + + Camera 1285 + + Electronic control unit and automatic motorized microscope stage 285 + + + 3D printing 22 + + + Laser cutting 71 + + + Other 28 + + + Total 2991 2291 406 All prices are in U. S. Dollars Fig. 10. Modeling of measured relocationing values. TABLE II. TABLE OF CORRELATIONS AND P-VALUES. Test Name Correlation P-Value Spearman -0.060 0.52 Kendall Tau -0.046 0.51 Pearson -0.096 0.34 When the measurements obtained on X and Y axis are investigated at the time-series plot and scatter plot of X versus Y, no correlated results are found. Hence, the obtained errors of relocation are not systematic and increased. Besides, it is seen that the obtained errors were realized randomly in a specific area (Figure 11). E. Accuracy A total of 3018 objects obtained as a result of scanned images and are randomly selected and evaluated by a cytogeneticist. 184 of 3018 objects are identified as metaphases by the application. 155 of 184 objects as metaphase and 29 of 184 objects as non-metaphase are marked by a cytogeneticist. True positive rate (TPR) is calculated as 95.1% and true negative rate (TNR) is calculated as 99.0%. Positive predictive value (PPV) is calculated as 84.2%. Negative predictive value (NPV) is calculated as 99.7%. The fact that TNR, PPV and NPV are quite high brings the application to the fore of detecting objects as a metaphase and a non-metaphase. Engineering, Technology & Applied Science Research Vol. 7, No. 6, 2017, 2160-2166 2165 www.etasr.com Yilmaz and Turan: FahamecV1:A Low Cost Automated Metaphase Detection System Accuracy is calculated as 98.8% and F1 Score is calculated as 0.893 (Table III). Fig. 11. Time series plot of X and Y(upper), scatter plot of X versus Y (lower). TABLE III. CONFUSION MATRIX OF SCANNING RESULTS. Total population= 3018 Human (Cytogeneticist) Metaphase Non- metaphase FahamecV1 Metaphase 155 29 Non- metaphase 8 2826 Accuracy = 98.8% TPR, Sensitivity= 95.1% TNR, Specificity= 99.0% F1 Score= 0.893 FDR=15.8% NPV= 99.0% PPV= 95.1% FNR, Miss rate= 4.9% FPR= 1.0% V. DISCUSSION The ball screws, the nuts, the miniature rails and the runner blocks used in FahamecV1 are selected from products used for solution of industrial type. The loss of relocation can be reduced by choosing more sensitive products. The scanning time obtained in FahamecV1 is compared with the scanning time in the literature in Table IV. The accuracy obtained in FahamecV1 is compared with the literature in Table V. The main reason why TPR is low in FahamecV1 is the obtaining of images using low-qualified preparates. Paint artifacts, metaphases which cannot be spread and paint loss are considered to be the causes. In future versions, all fixed parts will be produced with a 3D printer instead of laser cutting materials. Thus, the cost of FahamecV1 will be further reduced. The height and weight of the motorized microscope stage can be reduced by choosing thinner ball screws. The stepper motors can be replaced with smaller ones thus reducing the total weight and power consumption. VI. CONCLUSION A low cost and high accuracy solution for metaphase detection is investigated in this paper. The proposed system, FahamecV1, is described and the various aspects of its operation are investigated and compared to other systems described in the literature. Results show that FahamecV1 provides a fast, highly accurate and low cost solution. ACKNOWLEDGMENT This work was supported by Scientific Research Projects Coordination Unit of Karabük University. Project Number: KBÜ-BAP-15/2-DR-024 TABLE IV. TIME COMPARISON Metaphase Detection System Scanning speed (mm2/sec) Average Time Per Preparate (sec) [1] 0.16 * [7] 0.18 * [3] 0.10 * [10] 1.50 * [9] 0.45 * [8] * 1500 [2] * 1050 FahamecV1 1.29 445 *: not reported TABLE V. ACCURACY COMPARISON Metaphase Detection System True Positive Rate (TPR- Sensitivity) False Positive Rate (FPR) Accuracy [10] * 20.0% 80.0% [17] 84.0% 17.0% * [7] * 14.0% * [1] * 9.3% * [14] 74.0% 6.0% 89.0% [9] * 5.0% * [11] * 3.0% * [4] 91.8% 2.9% * FahamecV1 95.1% 1.0% 98,8% *: not reported REFERENCES [1] J. Piper, M. Poggensee, W. Hill, R. Jensen, L. Ji, I. Poole, M. Stark, D. Sudar, “Automatic fluorescence metaphase finder speeds translocation scoring in FISH painted chromosomes”, Cytometry, Vol. 16, No. 1, pp. 7–16, 1994 [2] R. Huber, U. Kulka, T. Lorch, H. Braselmann, M. Bauchinger, “Automated metaphase finding: an assessment of the efficiency of the METAFER2 system in a routine mutagenicity assay”, Mutation Research/Environmental Mutagenesis and Related Subjects, Vol. 334, No. 1, pp. 97–102, 1995 [3] A. Furukawa, M. Minamihisamatsu, I. Hayata, “Low-Cost Metaphase System”, Health Physics, Vol. 98, No. 2, pp. 269–275, 2010 [4] F. Arambula Cosío, L. Vega, A. Herrera Becerra, C. Prieto Meléndez, G. Corkidi, “Automatic identification of metaphase spreads and nuclei using neural networks”, Medical & Biological Engineering & Computing, Vol. 39, No. 3, pp. 391–396, 2001 [5] X. Wang, B. Zheng, S. Li, J. J. Mulvihill, M. C. Wood, H. Liu, “Automated classification of metaphase chromosomes: Optimization of an adaptive computerized scheme”, Journal of Biomedical Informatics, Vol. 42, No. 1, pp. 22–31, 2009 [6] Y. Qiu, J. Song, X. Lu, Y. Li, B. Zheng, S. Li, H. Liu, “Feature Selection for the Automated Detection of Metaphase Chromosomes: Performance Comparison Using a Receiver Operating Characteristic Method”, Analytical Cellular Pathology, Vol. 2014, pp. 1–9, 2014 [7] L. Roy, V. Durand, M. Delbos, I. Sorokine-Durm, F. Soussaline, P. Voisin, “A New Image Analysis System for Biological Dosimetry by Fluorescent in situ Hybridization. Step 1: Metaphase Finder and Engineering, Technology & Applied Science Research Vol. 7, No. 6, 2017, 2160-2166 2166 www.etasr.com Yilmaz and Turan: FahamecV1:A Low Cost Automated Metaphase Detection System Automatic Metaphase Acquisition Validation”, Journal of Radiation Research, Vol. 42, No. 2, pp. 165–177, 2001 [8] K. Odawara, K. Yamamoto, H. Kato, M. Hara, K. Shigefumi, F. Kishida, A. Yoshitake, I. Nakatsuka, “A new semi-automated chromosome analysis system for in vitro chromosomal aberration tests”, Mutation Research/Genetic Toxicology and Environmental Mutagenesis, Vol. 389, No. 2–3, pp. 207–212, 1997 [9] A. Furukawa, “The Project Of Another Low-Cost Metaphase Finder”, Radiation Protection Dosimetry, Vol. 172, No. 1–3, pp. 238–243, 2016 [10] K. R. Castleman, “The PSI Automatic Metaphase Finder”, Journal of Radiation Research, Vol. 33, Suplement, pp. 124–128, 1992 [11] J. Weber, W. Scheid, H. Traut, “Time-saving in biological dosimetry by using the automatic metaphase finder Metafer2”, Mutation Research/Environmental Mutagenesis and Related Subjects, Vol. 272, No. 1, pp. 31–34, 1992 [12] X. Wang, B. Zheng, M. Wood, S. Li, W. Chen, H. Liu, “Development and evaluation of automated systems for detection and classification of banded chromosomes: current status and future perspectives”, Journal of Physics D: Applied Physics, Vol. 38, No. 15, pp. 2536–2542, 2005 [13] G. Korthof, A. D. Carothers, “Tests of performance of four semiautomatic metaphase-finding and karyotyping systems”, Clinical Genetics, Vol. 40, No. 6, pp. 441–451, 2008 [14] J. R. N. McLean, F. Johnson, “Evaluation of a metaphase chromosome finder: Potential application to chromosome-based radiation dosimetry”, Micron, Vol. 26, No. 6, pp. 489–492, 1995 [15] Q. Yuchen, C. Xiaodong, L. Yuhua, C. Wei R., Z. Bin, L. Shibo, L. Hong, “Evaluations of auto-focusing methods under a microscopic imaging modality for metaphase chromosome image analysis”, Analytical Cellular Pathology, Vol. 36, No. 1-2, pp. 37–44, 2013 [16] D. Bradley, G. Roth, “Adaptive Thresholding using the Integral Image”, Journal of Graphics Tools, Vol. 12, No. 2, pp. 13–21, 2007 [17] G. Corkidi, L. Vega, J. Márquez, E. Rojas, P. Ostrosky-Wegman, “Roughness feature of metaphase chromosome spreads and nuclei for automated cell proliferation analysis”, Medical & Biological Engineering & Computing, Vol. 36, No. 6, pp. 679–685, 1998