Elektrotehniški vestnik 76(1-2): 79-84, 2009 Electrotechnical Review, Ljubljana, Slovenija Gelcard illumination enhancement in Gelscope 80 by LED distribution optimization Marko MeZa, Andrej Košir Univerza v Ljubljani, Fakulteta za elektrotehniko, Tržaška 25, 1000 Ljubljana, Slovenija E-pošta: marko.meza@fe.uni-lj.si Abstract. The paper describes an uneven gel card illumination problem in the gel card image capture device Gelscope 32. The problematic illuminator of the device was analyzed and optimized in such a way, that it illuminated the gel card evenly. Since the illuminator was build using white LEDs, we were able to control the distribution of its luminance by rearranging the LEDs positions. A second order gradient algorithm, implemented in Wolfram Mathematica was used to compute the optimal positions of the LEDs. A minimized objective function was a variation of the illumination produced by a preselected number of LEDs in a general positions. Specific constraints related to the hardware realization were taken into account. The LED distribution obtained was used in the construction of the Gelscope 80 device. Key words: Gelscope32, Gelscope80, illumination, gel card, LED illumination with a diffuser, illumination optimization Optimizacija osvetlitve gelskih kartic z optimiranjem poloZajev LED v napravi za zajem slik gelskih kartic Gelscope 80 Povzetek. Opisujemo reševanje problema neenakomerne osvetlitve gelskih kartic v napravi za zajem slik gleskih kartic, napravi Gelscope 32. Gelske kartice v napravi osvetli linijsko svetilo. Problematično svetilo v napravi smo analizirali in ga spremenili tako, da je njegova porazdelitev svetilnosti takšna, da enakomerno osvetli gelsko kartico. Ker je svetilo sestavljeno iz belih svetlecih diod - LED, smo na porazdelitev svetilnosti lahko vplivali s polozaji le teh. V programskem okolju Wolfram Mathematica smo razvili gradientni algoritem drugega reda, s katerim smo izracunali njihove optimalne polozaje. Pri tem smo ob uposštevanju omejitev naprave Gelscope minimizirali variacijo osvetlitve, ki jo je povzrocalo izbrano število LED. Z dobljeno porazdelitvijo LED smo zgradili napravo Gelscope 80. Ključne besede: Gelscope32, Gelscope80, osvetlitev, gelska kartica, svetilo LED z difuzorjem, optimizacija enakomernosti osvetlitve 1 Introduction We have introduced a teleconsulting system to the blood transfusion practice of Slovenija [1][2][3][4][5]. The main motivation for the system development was to remedy the ever increasing need for blood transfusion specialists, who would be satisfied with relative difficulties. Another motivation was the unification of the level of quality of the transfusion service across all eleven institutions, that offer transfusion services in the country [6][7][8]. Received 5 January 2009 Accepted 16 January 2009 The introduced system provides the remote interpretation of the pre-transfusion serological testing [1][5], performed by means of the micro-tube gel agglutination detection method - gel method [9]. The authors of the paper are unaware of the existence of any similar system in the transfusion practice. Pre-transfusion serological testing is obligatory and therefore performed prior to any blood transfusion [1][3][5]. The gel method is performed using the micro-tube gel card diagnostic tools [10]. The micro-tube gel cards are used to determine the level of the red blood cells agglutination. The determination of the red blood cells agglutination is the standardized and widely used diagnostic procedure of the pre-transfusion serological testing system [9]. An important part of the teleconsulting system is the the gelcard image capture device - Gelscope device, which we have developed specially for this purpose entirely on our own. The first version of the device, Gelscope 32, see Figure 1, left, was manufactured in the prototype series. Manufactured devices, Gelscope 32 were introduced to the transfusion laboratories practice. Professional users have identified several problems during the usage of the Gelscope 32 devices. We have removed the issues causing the problems in the new version of the gel card image capture device - Gelscope 80, see Figure 1, right. In this paper we have described the issue of the uneven illumination of the gel cards. In the Gelscope 32 device, the gel cards are illuminated using the illuminator which is built using an array of white LEDs and an appropriate light diffuser. We have performed and described the analysis of the gel card illumination, caused by the illuminator used. This analysis has served as the basis for the gel card illumination optimization by optimizing the LED distribution within the new illuminator. 2 Background Pre-transfusion serological testing is based on the detection of red cell antigen-antibody reactions. These reactions are usually detected by the agglutination tests, in saline or macromollecular media, with unmodified or enzyme-treated red blood cells, and with or without the use of low ionic media, antiglobulin sera and/or potentiators and polycations [9]. Tests are performed using the the gel method, which was developed to be standardized and able to fix the agglutinates enabling the interpretation of the test several hours after it was performed. The gel method is sensitive and simple to use [10]. It is performed using the gel cards. Gel cards are made of transparent plastic with six micro tubes containing the test specific reagents embedded into them. The dimension of the gel card is 70 x 55mm. The micro tubes are 15mm long and have a 2mm radius. Figure 2 depicts the gel card with red blood cells administered to them. During the test, the transfusion specialist visually determines the red blood cells distribution across the microtubes. Based on the distribution, the final result of the test is determined. It is crucial for the specialist to be accurate, especially in the case of weak reactions [10]. To be able to perform the pre-transfusion test interpretation remotely, a high enough quality of the colour gel card images must be available [8]. In order to capture these images, we have developed special purpose hardware and software [3]. The requirement for the equipment was repeatability and a high enough quality of the image capture results. To achieve this, the image capture procedure must be standardized. Captured images must contain no reflections, geometric and colour aberrations [11]. Another requirement for the device is its simplicity of use [8]. To capture the image of the gel card, it must be correctly illuminated. In our design of the gel card image capture device Gelscope, we have used three illuminators to illuminate the gel card. The illuminators were made of an array of white LEDs and a light diffuser, made of plexi glass [3]. The image of the gel card is captured by the digital camera, built into the device. The setup of the illuminators, the gel card and the camera is illustrated in Figure 3. Two illuminators are used to illuminate the front side of the gel card and the third illuminator is used to backlight the transparent gel card. Using this illuminator setup we have the achieved an efficient illumination of all gel card components: the gel card label and the micro tubes with their content. Figure 1. Picture of Gelscope 32 device (left) and Gelscope 80 device (right). Slika 1. Sliki naprav za zajem slik gelskih kartic Gelscope 32 (levo) in Gelscope 80 (desno). Figure 2. Image of AB0 RH typing gel card with fixed agglutinates. Slika 2. Slika gelske kartice za določanje krvne skupine AB0 RH s fiksiranimi aglutinati. The front illuminators must not cause any with built in digital camera visible reflections of the gel-card. This request is satisfied if the illuminators illuminate the gel card at a steep enough angle. Figure 3 depicts the worst angles of the reflections with dashed lines. It is obvious, that the gel card, illuminator and camera locations cause no reflections to the camera lens [12]. 3 LED distribution problem statement During the usage of the Gelscope 32 we discovered, that the captured images of the gel cards are illuminated unevenly. Since the images are intended for further digital image processing it is required to have evenly illuminated images of the gel cards. We have described the even illumination criteria in section 5. The central sections of the gel cards were more illuminated compared to the edge sections. Uneven illumination was not clearly visible with the naked eye, but it became obvious when we processed those images. Uneven illumination was caused by the Figure 3. Schematic display of the Gelscope device regarding illumination, gel card and camera positions. From the left: rear illuminator, gel card, front illuminators and camera. Slika 3. Položaj svetil v napravi za zajem slik gelskih kartic. Skrajno levo je zadnje svetilo, sledi gelska kartica, sprednji svetili in kamera. 90 -60 -30 0 30 BO 90 Off axis angle [degrees] Figure 4. LED relative luminous intensity diagram io obtained from the LW520 LED datasheet. Slika 4. Sevalni diagram LED io. Vir: LW520 LED datasheet. front side illuminator. Its length was similar to the gel card length. Since the distribution of the LEDs was even, the radiance distribution of the illuminator was also even. It would be possible to achieve an even illumination of the gel card with evenly distributed radiance illuminators if the illuminators were much longer than the gel card. But since we are limited by the device's dimensions, the usage of such an illuminator is impossible. Therefore we needed to alter the illuminator radiance distribution to achieve an even illumination distribution of the gel card. We can influence the illuminator radiance distribution by rearranging the LED distribution behind the light diffuser of the illuminator. During the process of illuminator optimization we have had to determine the illumination of the gel card caused by a single LED behind the diffuser. After that we had to choose the right criteria for an even illumination. The criteria was then used to optimize the distribution of a pre-chosen number of LEDs, comprising the illuminator's light source. 4 Analysis of illumination distribution function In order to eliminate uneven illumination we analyzed the illumination of the gel card caused by the front illuminator. Since the front illuminators are relatively long and narrow (see Figure 3), we simplified the analysis by assuming that the illuminator performs as a linear light source. We also assumed that the light diffuser used -plexi glass performs as an ideal light diffuser, diffusing the light evenly in every direction. Therefore we have observed each point on the diffuser as a Huygens light source [13]. We determined the radiance of each point of the diffuser by using the used LED relative luminous intensity chart (see Figure 4), obtained from the LED datasheet, provided by the LED manufacturer [14]. The computation of the illumination caused by the ar- Figure 5. Derivation of illumination through a diffuser. Slika 5. Izpeljava osvetlitve preko difuzorja. bitrary LED distribution follows the denotation from Figure 5. Arbitrary LED distribution is given by the vector of LED locations p = (pk), k = 1,... ,N, where N is the number of LEDs used. Because we can assume the linear response of the diffuser, we can sum up the illuminations, caused by the LEDs, placed on locations p and obtain the illumination n(p, x) = ^N=1 n(Pk, x). Gel card illumination n(p,x), caused by only one LED in position p, (see Figure 5, axis z) depends on the LED's relative luminous intensity i0 (Figure 4), diffuser and the device geometry (distances v1 in v2 on Figure 5). We are limited in the selection of the device geometry and partially LED distribution by the device Gelscope device design limitations. We can determine the illumination caused by the single LED positioned in position p by determining how that single LED illuminates the diffuser and how the diffuser, illuminated by the single LED, illuminates the gel card. The position of the diffuser illumination is determined by the z coordinate (see Figure 5, z axis, middle). Based on the geometry, we can determine that the LED illuminates the part of the diffuser Az at the angle p Az = v1 Ap cos2(p) = v1(1 +tan2(p))Ap (1) Illumination angle p and diffuser coordinate z are related through the equation p = arctan((z - p)/v1), where the part of the diffuser is given by the equation Az = v1(l + ((z - p)/v1)2)Ap = v2l+(^p)2 Ap. Illumination of the part of the diffuser Az on the coordinate z, caused by the single LED is ) „ i0(P)AP „ v1i0(arctan((z - p)/v1)) Í(p,z) = K-;- = K~ Az v2 + (z - p)2 (2) where K is constant. £(p, z) determines the illumination of the diffuser caused by the single LED positioned on location p. Let us determine the illumination of the gel card n(p, x) on position x caused by the diffuser, illuminated by the illumination £(p, z), see Figure 5. The length Al of the ideal diffuser from location z radiates light evenly at all angles Analogue to the above calculations we can determine the illumination Ar/(p, z, x) of the gel card element Ax = Cos^) > caused by the Az part of the diffuser An(p, z, x) = B v2Š(p,z)Az v2 + (x - z)2 ' (3) We use the equation 2, which leads to An(p, z, x) = KB v1v2i0(arctan((z -p)/v1))Az (v2 + (z -p)2)(v| + (x - z)2)' n (p, x) /K Bv1 v2 i0 ^arctan zjf-) 4l (v2 + (z - p)2) (v22 + (x - z)2) dz N n(p,x) = 53 n (pk,x) ' k=1 (6) To illustrate the gel card illumination analysis, the Figure 6 represents the gel card illumination caused by one LED with a relative luminous intensity io, positioned in the middle of the gel card location p = 0, computed by the equation 6. (4) The illumination of the gel card r/(p, x) on the coordinate x, caused by the LED at position p is determined by the integration n(p, x) = / dn(p, z, x) of the elements of Ai diffuser Az radiance. Figure 6. Illumination of the gel card using only one LED in the centre position. Slika 6. Osvetlitev gelske kartice z eno samo LED v središčni legi. 5 Determination of the optimal LED distribution We have performed the optimization process using the Lagrange multipliers [16] which is based on the first order gradient method [15]. We have used the following optimization constraints: • Solution parametrization: The optimization goal was the determination of the LED distribution to achieve an even gel card illumination. Based on previous experience, we selected the number of 8 LEDs as a sufficient light source. The physical design of the device limits the use of LED in the centre position of the illuminator. It is obvious, that a symmetrical LED distribution is optimal, hence we optimized only one half side of the illuminator. We selected the right side of the illuminator and marked the LED positions p = (pi,... ,p4). • Criteria function: We estimated an even illumination by observing the illumination r/(p,x) variance (5) Integration interval I covers whole the diffuser length, which is A1 = [—50,50]mm. The illumination of the gel card caused by the array of N LEDs positioned on the locations, given by the vector p = (pi, • • •,pn) is av(p) = J ^tâ x) — n(p)) dx• A2 We discovered, that the usage of this criteria function alone yielded an unusable result pi ^ œ for all i, since it produced illumination 0 with zero variance. Therefore we have extended the criteria with predefined illumination I0. We selected a predefined illumination level empirically. The value of I0 was similar to the illumination obtained by evenly distributed LEDs. Illumination of the gel card with given LED positions is defined by I = / r/(p,x)dx. Consid- A-2 ering this we set up the criteria function using the Lagrange multipliers [16] c(p, A) = av(p)2 + A ^/0 -J n(p, x)dxj . The integration interval A2 = [-35, 35]mm was selected so that the whole gel card was included. • Optimization step: Classical Lagrange function gradient method step is (Pn+1, An+l) = (Pn, An ) - Cp, An). We selected the multiplication factor / based on the initial LED distribution and illumination. • Initial LED distribution and optimization halt criteria: As the initial LED distribution we used empirically obtained distribution p0 and A = 0 5. As optimization halt criteria we have observed the illumination variance. The optimization process was halted, when the illumination variance fell below a certain threshold, that is \av (pn+1)2 - (pn)2| < e. The threshold e was defined based on the further image processing requirements. We discovered, that by using the described optimization parameters, the algorithm achieves a minimum when the difference of two consecutive variances is practically negligible. 6 Optimization results The results demonstrate the optimized LED distribution obtained considering the Gelscope device's design limitations. We obtained the distribution using the optimization method, described in chapter 5 which was implemented in the Wolfram Mathematica environment [17]. We described the optimization space in chapter 5. Based on the the illumination requirements, we chose N = 8 LEDs. After the application of the LED position symmetry we have described the LED positions using the vector p = (p1,p2,p3,p4). The centre position contains no LEDs. The dimensions, regarding Figure 5 are: v1 = 6 mm and v2 = 70 mm. The gel card is 70 mm long which defines the integration interval A1 = [-35, 35] mm. The diffuser is 100 mm long which defines the integration interval A2 = [-50,50] mm. We have set the initial optimization approximation to the empirically obtained values p = (32 0, 34 5, 37 0, 39 5). In Figure 7, the dashed line presents the illumination of the gel card n(po, x), using the optimization initial approximation p0. Using this illumination, a relatively good image quality can be obtained regardless of the fact it seems quite uneven. ■n p °p° 106 104 102 n(p*,x) --- 100 -30 -20 -10 10 20 30 X Figure 7. Osvetlitev gelske kartice z zacetno razporeditvijo LED po (crtkano) in razporeditvijo po optimizaciji p* (polno). Ilustrirani sta tudi zacetna razporeditev LED (zgoraj - crtkano) in razporeditev po optimizaciji (spodaj - polno). Figure 7. The illumination of the gel card using initial LED distributions p0 (dashed) and optimized LED distribution p* (solid). Initial (top - dashed) and optimized (bottom - solid) LED distribution is also illustrated. The gradient method using the initial value p0 required n = 16 steps to satisfy the stop criteria which was a consecutive illumination variance difference av (pi+l )2 - (pi)2 below the prescribed threshold. Therefore p* = pl6 = (43 4,45'3,46 2,491). Since the symmetry was used, the actual LED distribution is described by pp* = (-491, -46 2, -45 3, -43 4,43 4, 45 3,46 2,49' 1). In Figure 7, the solid line presents the gel card illumination n(p* ,x) obtained using the optimized LED distribution. We can notice the decreased illumination variance, which satisfies the further image processing requirements. It must be stressed, that the graph, presented in Figure 7 is biased and does not start at 0 value. The optimization method course can be observed on the Figure 8 on the graph illustrating the illumination variance av (pn)2 after each consecutive optimization step. The optimization process performs the majority of the work in the first four steps. After the initial four steps it only slightly improved the result. During our experiments, we discovered, that after step 16 the method does not improve the result. 7 Conclusion We have successfully optimized the LED distribution of the Gelscope gel card image capture device illuminator. The optimization process yielded LED distribution, where the LEDs were positioned near the outer edges of the illuminator. When the illuminator with a computed LED distribution is used it illuminates the gel card evenly. We have described the empirically obtained LED distribution in the paper [12]. The empirically obtained distribution is very similar to the distribution computed by the 8.45 8.4 8.35 8.3 8.25 8.2 8.15 o,(p)2 step 24 6 8 10 12 14 Figure 8. Varianca osvetlitve gelske kartice po posameznih korakih optimizacije. Figure 8. Illumination variation after consecutive optimization steps. optimization process, as described in this paper. Based on the obtained distribution, we have designed and built a new version of the device Gelscope 80 device (see Figure 1, right), where the issue of uneven gel card illumination is eliminated. 8 Acknowledgements This project was supported by the Blood Transfusion Centre of Slovenia and the Faculty of Electrical Engineering, University of Ljubljana. We are grateful to the people who participated in the project. We would like to thank prof. Jurij F. Tasic Ph.D., Marko Breskvar M.Sc., asst. prof. Primož Rožman Ph.D., prim. Irena Bricl B.Sc., Polonca Stopar B.Sc., asst. prof. Matjaž Jeras Ph.D., Stefan Dobravc M.Sc., asst. prof. Matevž Pogačnik Ph.D. and Andarž Jere M.Sc.. 9 References [1] M. Meža, M. Breskvar, A. Košir, I. Bricl, J. F. Tasic, P. Rožman. Telemedicine in the blood transfusion laboratory - remote interpretation of pre-transfusion tests. Journal of telemedicine and telecare 13(7), October 2007, pp. 357-62. [2] M. Meža, M. Tkalcic, M. Breskvar, I. Bricl, P. Rožman, J. F. Tasic. Registracija rotacije slik gelskih kartic. Zbornik petnajste mednarodne Elektrotehniške in računalniške konference ERK 2006, zvezek B, Portorož, Slovenija, September 2006, pp. 209-12. [3] M. Meža, M. Pogacnik, M. Tkalcic, A. Jere, M. Breskvar, P. Rožman, I. Bricl, J. F. Tasic, M. Leban,. Description of pilot implementation of telemedicine system in blood transfusion practice. Proceedings of the COST 276. Thessaloniki: Informatics and Telematics Institute, Centre for Research and Technology,Thessaloniki, 2004, pp. 61-5. [4] M. Meža. Support of the blood transfusion diagnostic process with telemedicine. Proceedings EUROCON 2005 -The International Conference on Computer as a Tool, Srbija, Beograd, November 2005, pp. 195-8. [5] M. Meža. Samodejna interpretacija režultatov predtrans-fužijskih testiranj na slikah gelskih kartic. Doktorska disertacija na Fakulteti za Elektrotehniko, Univerza v Ljubljani, Ljubljana, Slovenija, 2007. [6] M. Breskvar, I. Bricl, J. F. Tasic, M. Meza, P. Rozman. Telekonzultacije v transfuzijski sluzbi. Zdravniški vestnik 73, 2004, pp. 105-8. [7] P. Rozman, M. Meza, M. Breskvar, I. Bricl, B. Voljc, J. F. Tasic. Closing the information loops in the algorhitms of transfusion medicine part 1: teleconsultation. Book of abstracts Makedonski Medicinski Pregled 58(63), Skopje, Makedonija, 2004, pp. 33-7. [8] P. Rozman, I. Bricl, M. Urbajs, M. Macek, M. Breskvar, M. Meza, J. F. Tasic. A new teleconsultation system for pretransfusion testing. Vox Sanguinus 91(3), 2006, pp. 311-2. [9] Y. Lapierre , D. Rigal, J. Adam , D. Josef, F. Meyer, S. Greber, C. Drot. The gel test: a new way to detect red cell antigen-antibody reactions. Transfusion 30(2), February 1990, pp. 109-13. [10] M. M. Langston, J. L. Procter, K. M. Cipolone, D. F. Stroncek. Evaluation of the gel system for abo grouping and d typing. Transfusion, 39(3), March 1999, pp. 300-5. [11] S. Grbec, M. Tkalcic, J. Diaci. The influence of inertial loading on color gamut properties of a TFT LCD dispaly. Displays 29(1), January 2008, pp. 18-24. [12] M. Meza, M. Breskvar, P. Rozman, I. Bricl, T. Certanc, M. Tkalcic, J. F. Tasic, S. Dobravec, A. Košir. Izboljšava osvetlitve gelskih kartic v napravi za zajem slik gel-skih kartic Gelscope 80 v primerjavi z napravo Gelscope 32. Zbornik šestnajste mednarodne Elektrotehniške in računalniške konference ERK 2007 zvezek B, Portoroz, Slovenija, September 2007, pp. 213-16. [13] Wikipedia. Huygens - Fresnel principle. Avaliable on http://en.wikipedia.org/wiki/Huygens-Fresnelprinciple, accessed on: 28. 11. 2008. [14] M. Burmen, F. Pernuš, B. Likar. LED light sources: a survey of quality-affecting factors and methods for their assessment. Measurement science and technology 19(12), December 2008. [15] E. Issacson, H. B. Keller, Analysis of Numerical Methods, John Wiley & Sons, New York, 1966. [16] Fleming, W. H., Functions of several variables Springer Corp., New York, 1971. [17] Wolfram, S. Spletna stran paketa Mathematica Available on http://www.wolfram.com/, accessed: 01.12.2008. Marko Meza has received his B.Sc. in 2001 and his Ph.D. in 2007 from the Faculty of Electrical Engineering, University of Ljubljana, both in electrical engineering. Currently he is working as a research scientist in LDOS, Faculty of Electrical Engineering, University of Ljubljana. Areas of his research include telemedicine, application of the machine learning algorithms to the specific problems in medicine and digital signal processing. Andrej Kosir received a B.S. degree in theoretical mathematics, 1993, an M.S. degree in probability theory in 1996, and a Ph. D. degree in electrical engineering from the University of Ljubljana, in 1999. After joining the Laboratory for digital signal, image and video processing laboratory of Faculty of Electrical engineering, University of Ljubljana, he was engaged in the research of digital image understanding, digital data coding, statistical data modelling and operational research in telecommunications.