Image Anal Stereol 2001;20:27-34 Original Research Paper A NEW, OTHER THAN ACOUSTIC, QUANTIFICATION METHOD FOR ENDOCARDIUM DETECTION IN ECHOCARDIOGRAPHIC IMAGES Leszek wojnar1, leslawSzydlowski2and Teresa marek-Szydlowska3 1nstitute of Materials Science, Krakow University of Technology, AI. Jana Pawla II 37, 31-864 Kraków, Poland, 2Department of Cardiology, 3Department of Paediatrics, Polish-American Children’s Hospital, Faculty of Medicine, Jagiellonian University, 265 Wielicka St., 30-663 Kraków, Poland e-mail: wojnar@mech.pk.edu.pl (Accepted February 14, 2001) ABSTRACT A new, semiautomatic algorithm for tracing outlines of endocardium of newborns that are detectable in echocardiographic images is presented. The main advantage of the method proposed is its low sensitivity to operator errors. Moreover, in contrast to the acoustic quantification method (AQ), an analysis of archive and low quality images is available, as well as the traces obtained are smooth and free of artefacts. Thus, the new solution allows for further, fully automatic, quantitative characterization of the shape and size of the ventricle. The results are compared with manual tracings in order to demonstrate the advantage of the newly developed method. Some results from massive research on newborns with various heart defects are also presented. Keywords: acoustic quantification, algorithm, echocardiography, endocardium, image analysis. INTRODUCTION In the course of cyclic work, external and internal cardiac parameters change, similarly as the shape of the heart, its volume and left and right ventricular pressure parameters. Under pathological conditions, the ventricles adjust to an increased load, initially changing their shape and dimensions, and when excessive load is maintained over prolonged periods, by wall hypertrophy. Proper and objective characterisation of these changes requires a quantitative analysis of the ventricles. In order to evaluate the dimensions and shape of the ventricles, which undergo dynamic changes in the course of diastolic and systolic function, it is necessary to precisely trace the outlines of the endocardium. The main problem that hinders employing echocardiography in valid measurements of the ventricular size and shape during subsequent cycles of cardiac function lies in difficulties in precise delineation of endocardial margins. This is why much hope has been invested in the new echocardiographic technology of acoustic quantification (AQ), introduced in the nineties that allows for automatic endocardial margin delineation in the course of examination (real time). As the AQ method has some drawbacks discussed in detail further in this paper, numerous tests have led to the development of a new, universal algorithm of echocardiographic images processing that has become a valid tool in detection of endocardium in both ventricles. Its usefulness has been verified in the course of cardiac examinations performed in normal newborns and neonates with various congenital heart defects. The paper presents details of the developed method, while medical data that are beyond the scope of the present article can be found in the monograph by Szydlowski (1999). ACOUSTIC QUANTIFICATION AND ITS LIMITATIONS The AQ method allows for real-time detection of endocardium and computation of its basic geometrical parameters. The method has proven to be satisfactory in left ventricle (LV) evaluation, whereas it is of no use whatsoever in the case of the right ventricle (RV) in view of its irregular shape and numerous internal structures (trabeculae and papillary muscles), which trigger additional reflections of the acoustic wave, what in turn hinders appropriate detection of the right ventricle endocardium (Forni et al, 1996; Tardif et al, 1994; Wilson and Rahko, 1995). On the other 27 Wojnar L et al: Method for endocardium detection hand, the lack of satisfactory results of LV evaluation using AQ method is reported as well. Unfortunately, fully objective evaluation of the AQ method is not possible, as its principles are not precisely documented by the equipment manufacturers. However, in practice it can be easily noted that the detected endocardium corresponds almost perfectly to the black region of the echocardiographic control image. Consequently, the resulting outline is highly sensitive to operator-dependent adjustment of the apparatus. The nature of the AQ method (only real-time analysis) does not allow thorough testing and documentation of the bias introduced by inadequate tuning of the echocardiograph. Therefore, to demonstrate this problem, a series of echocardiographs with simulated brightness and contrast variation was analysed, as shown in Fig. 1. The left column in Fig. 1 consists of three images obtained from the same single frame. The differences between these images were obtained using histogram equalisation or gamma modulation and were similar to a variation in echocardiographic image induced by the operator. The middle column illustrates the possible results of AQ. The obtained loops are clearly defective, as they are very rough, whereas the real endocardium surface is smooth. Additionally, the resulting loops have different shapes and sizes. By comparison, the right column shows the result of endocardium detection obtained with the method described further in this paper. It can be clearly seen that the new method produces almost identical results for all the images and the detected smooth loops reflect well the endocardium shape. An exemplary result of real AQ detection, shown in Fig. 2, proves that the simulated tracings from Fig. 1 are close to reality. To summarise the above remarks and experience gained over a prolonged period, the following principal disadvantages of AQ can be specified (Szydlowski, 1999): • Limitation to studies of LV only, • Frequent, evident errors (AQ often shows wavy margin, whereas LV has smooth walls), • Large sensitivity to the apparatus adjustment, • No possibility of analysing historical materials (only real-time analysis possible), • Low usability in children due to problems with establishing standard position (children with rapid movements, high frequency respiration and heart rate at the course of examination, etc.). Fig. 1. Simulation of the results obtained by means of AQ method and the method proposed in this paper. Left column - simulated images of different quality, middle column - simulated results of AQ method (large scatter visible), right column - results of the method proposed. Fig. 2. An example of an erroneous detection of left ventricular (LV) endocardium by AQ. PREMISES OF THE NEW METHOD A visual assessment of the endocardial outline is too subjective and the results give no support to a 28 Image Anal Stereol 2001;20:27-34 reliable analysis. In a search for a better method that would allow for precise and faithful delineation of endocardial margins in both ventricles, studies were undertaken on the employment of image analysis methods. The main assumptions of the method searched for are as follows: • analysis of both ventricles (LV and RV) should be possible, • the method should allow for analysis of the historical material, • it should be possibly characterised by high repeatability and reproducibility, • the method should be relatively easy and inexpensive. As a consequence of the above assumptions typical video recordings used for archiving echocardiographic examinations are used as a source of data for further analysis. This assures possibility of analysis of historical material and allows for performing an analysis outside the echocardiograph, which can be simultaneously used for other patients. The video recordings are digitised using a typical VCR and frame grabber (in our case Matrox Marvel). Such a solution is inexpensive and assures sufficient accuracy. Obviously, this method is not perfect due to its indirect character, which causes the loss of image quality during digitisation. Unfortunately, the commercial echocardiographs offer no digital video output, so direct data transfer to the computer is not available. On the other hand, the grabbed frames have better quality than typical printouts available from the echocardiograph. The simplest solution seemed to trace the endocardium in a manual way. Such tracings could be subsequently measured using even a very simple image analysis program. It was demonstrated during preliminary tests that manual tracing gives very inaccurate results, with the scatter too high for any quantitative analysis. As an example, three sets of 19 outlines of the endocardium manually drawn by medical students are presented in Fig. 3. These students had completed basic courses on cardiology and were instructed in the field of echocardiography, but were not thoroughly trained in tracing the endocardium. A closer analysis of these manual tracings shows that they are generally correct. Even in the case of the middle image the tracing is correct but accompanied by two additional loops at the left side. More experience would prevent such errors. 29 Nevertheless, the large scatter (the smallest outlines have two times smaller surface area than the largest ones) and lack of reproducibility of these manually drawn loops is clearly visible. This explains the need for a new, powerful method. Fig. 3. Three medium quality images (left) and manual tracings drawn by 19 students (right). All the subsequent image processing and analysis, leading to development of an appropriate algorithm, have been performed on a PC computer equipped with Aphelion v.2.3 software (other image processing software can also be used). So, all the components of the equipment are commercially available. This allows for a relatively easy application of this method at virtually any echocardiographic laboratory. It should be clearly stated that the method described below is virtually different from AQ. This will be discussed in more details after the description of the entire algorithm. Wojnar L et al: Method for endocardium detection MARKERS FOR TRACING THE ENDOCARDIUM Fig. 4 presents a series of image profiles, which explain the sources of erroneous manual tracing and put some light on the possible solutions. We see in this figure three profiles illustrating the grey-level distribution along white line segments overlying the analysed image. Grey rectangles denote parts of the profiles that intersect the endocardium. Different grey levels correspond to the endocardium region in each profile, so it is impossible to detect it using any binarisation technique. Moreover, high gradient levels, which correspond to the almost vertical parts of profile lines, do not ensure correct detection, either. To summarize, successful detection requires very complex processing of the image (Wojnar, 1999). Fig. 4. The analysed image and grey level profiles demonstrating difficulties in automatic endocardium detection. Grey rectangles denote part of the profiles that intersect the endocardium. As it can be seen, high gradients in grey levels, which are easily detectable, do not necessarily correspond to the endocardium outlines. Initially, the development of a fully automatic method was assumed. Unfortunately, a wide research program required an analysis of rare heart defects from archive materials taken from historical echocardiographs. Their quality was too low to allow satisfactory detection in all the cases. In such circumstances a semiautomatic algorithm has been developed. Nevertheless, a fully automatic detection is possible in the case of images of very good quality. The concept of markers is a key feature of the whole semiautomatic algorithm. Main errors in automatic endocardium detection are caused by echoes from papillary muscles and trabeculae. The presence of papillary muscles can be relatively easily excluded by a human operator, as they are visible as small bright areas inside the ventricle (an example is denoted by a circle in Fig. 5a). If we return to Fig. 3, we will see a kind of band produced by the set of outlines. This band defines two regions: the inner and outer ones. The inner region is simply the area that is placed inside all the loops from the set and, simultaneously, is not intersected by any of these loops. Consequently, the outer region is just the outline of the whole set. We can say that markers should simply exclude the area we are convinced is outside the endocardium borders. There is no strict, mathematical or geometrical formula for generation of such markers, but the above description is in general sufficient even for non-specialists. So, the limits of the outer and inner marker can be visualised as white loops in Fig. 5b. Consequently, the markers in Fig. 5c should be judged as incorrect and markers in Fig. 5d should be considered acceptable. Fig. 5. Construction of the markers: a – initial images; region denoted by a circle should be excluded by the marker, b – inner and outer limits of correct markers, c – incorrect markers, d – acceptable markers. In fact, the choice of markers is the weakest point of the whole procedure. The rules illustrated in Fig. 5 are rather intuitive than very precise but we have tested them on people having no medical education with satisfactory results. If the chosen maker fits the simple rules described above, its shape has no great effect on the final detection, as illustrated in Fig. 6, which shows a series of manually drawn markers together with the resulting loops. It should be stressed that in order to check the quality of the method proposed all the markers were drawn by a person without any experience in cardiology. It is evident from these images that the series of significantly different markers (with the scatter similar to those of manual tracing, illustrated in Fig. 2) result in almost identical detection. A Image Anal Stereol 2001;20:27-34 statistical analysis of the results obtained from different markers has shown that the maximum relative error in any geometrical parameters measured on the detected loops does not exceed 10% (usually 3-5%). This is, depending on the case, 5-10 times less than in the case of manual tracing (Szydlowski, 1999). Naturally, the above mentioned results tell us nothing about the accuracy or correctness of the detection. They inform only that the method proposed is characterised by relatively good reproducibility and repeatability, which are usually very weak in semiautomatic methods. The problem of correctness will be discussed later. Fig. 6. Initial image of lower quality (left), three different markers (top) and corresponding detected outlines (bottom). AUTOMATIC PART OF THE ALGORITHM The procedures used in the discussed algorithm can be met in many commercially available image analysis packages. A detailed description of these procedures can be found in the literature on image processing (Coster and Chermant, 1989; Russ, 1995; Serra, 1982; Sonka et al., 1998; Wojnar, 1999). Now we will follow the automatic part of the algorithm. First, the initial image (Fig. 7a) is equalised in order to compensate for the scatter of brightness and contrast between the images. Equalisation allows further processing with predefined threshold values and other parameters of image processing procedures. In other words, equalization roughly simulates identical conditions of image formation and acquisition. The equalized image is shown in Fig. 7b. Next, in order to remove most of the noise which is always present in echocardiography, the image is median filtered in the 5x5 environment (Fig. 7c), dilated with the square structuring element of size 5 (Fig. 7d) and minimum filtered using the predefined 7x7 matrix (Fig. 7e). These filters, rather typical for image processing, produce a generalized image, which will be a starting point for endocardium detection. Without the above filtering the burden of details present in the initial image would lead to jaggy detection, similar to those shown in Fig. 2. The pre-processed image, shown in Fig. 7e, constitutes the basis for constrained watershed detection, i.e. watershed detection with user-defined markers (compare Fig. 5, which shows how the markers are built). The markers used in this case are depicted in Fig. 7f. Note once more that the creation of a marker (Fig. 7f) is the only operator-dependent step in the whole process of analysis. All the other transformations are done fully automatically, without any tuning from the operator. L\0 ^ J Fig. 7. Main steps of the algorithm for endocardium detection. Details in the text. The above mentioned watershed detection is based on the contrast of the image from Fig. 7e, which plays here the role of the distance image required by watershed detection algorithms. Profiles, shown in Fig. 4 demonstrate that the regions of high gradient may lie too far outside the endocardium to be detected. Therefore, as the pre-processed image (Fig. 7e) is simply a generalized version of the initial one, this preliminary watershed finding gives overestimated outline, which is far from the ideal result (Fig. 7g). Now we will perform the second watershed detection, 31 Wojnar L et al: Method for endocardium detection which should produce, by contrast, an underestimated loop. The second detection is based on the gradient image (Fig. 7h), computed on the basis of image after dilation (Fig. 7d). Consequently, as the dark, central part is much smaller in this image than in the initial one, the highest gradient values correspond with the underestimated loop of endocardium. In order to obtain more smooth detection the gradient image is equalised (Fig. 7i) which produces thicker lines. A similar watershed algorithm has been used, which lea ds to a n u nder estima ted out line, a s shown in F i g . 7 j . Both preliminary outlines (the over- and underestimated ones) are joined together using logical XOR operation (Fig. 7k) and subsequently thinned using skeletonisation with 8-connected L-skeleton followed by removal of branches. A combination of two preliminary loops allows for significant smoothing of the resulting loop that is closer to theoretically ideal detection. Any of the preliminary loops is usually significantly more jagged. The above-described operations lead to a one-pixel wide, smooth final result. This last shape is overlaid on the initial image (Fig. 7l), which clearly illustrates the quality of the whole algorithm. The use of generalised images and double detection allows for the obtention of smooth loops, which fit well the expected position of the traced endocardium. Irrespectively of the further validation of the method proposed, its main power lies in its reproducibility. Even if some systematic errors are built-in, we are able to judge correctly the tendencies in echocardiograms under study. VALIDATION OF THE RESULTS The result shown in Fig. 7l seems to a human observer to be almost perfect and even makes it difficult to understand why manual tracings may show such a large scatter as that shown in Fig. 3. Obviously, such a judgement suffers from the lack of objectivity. Nevertheless, our vision system is able to judge quite well the quality of detection even if we are unable to explain what criterion is used. A somewhat funny example is given in Fig. 8. More than 90% of people asked what this image represents, give an immediate answer that it shows the Eiffel tower. So, this is a kind of statistical proof that the image is drawn correctly. Unfortunately, in spite of analysing many photographs of the Eiffel tower (an objective reference image) we are unable to answer in terms of mathematics why these 5 (!) lines are sufficient to describe a very complicated structure of this construction. Fig. 8. The sketch of the Eiffel tower. See text for details. It has been suggested that a comparison with the results from cardiovascular magnetic resonance could help to judge in a more precise way the quality of the proposed method. Unfortunately such a solution is impossible for at least three reasons: • In order to get statistically valuable results we should have tens of examples and this is impossible as magnetic resonance is a very expensive method and nobody wants to pay for such experiments, • The method described was used for evaluation of hearts of newborns and magnetic resonance is a too invasive method for such young patients, • And last but not least – in the course of any examination, neonates are in almost constant motion, which rules out methods requiring quiet behaviour of the patient. Possibly we could test the algorithm on elderly patients, but their echocardiographic characteristics are different from those of newborns (mainly a thicker layer of tissues between the heart and sensor), so there is no evident correlation between these groups. It should be repeated that there is no theoretical basis for verification of the correctness of the presented algorithm. Possibly some operations, such as, for example, the first detection in which the generalized image is taken instead of the distance map, 32 Image Anal Stereol 2001;20:27-34 are not very elegant from the formal point of view. Nevertheless, this algorithm really works and is a result of many weeks of tests over various solutions. The authors are aware that further research will allow for creation of even more accurate algorithms and such a progress is typical for all the image processing solutions. PRACTICAL APPLICATIONS The algorithm described above has been already successfully used for analysis of 384 images of heart chambers of newborns in systole and diastole. The results give new insight into various congenital heart defects, as described by Szydlowski (1999) and Szydlowski et al. (1998). However, in this paper the authors want to emphasize only the methodological aspects of this work. Consequently, only some exemplary images of the detected loops overlaid over initial images are shown in Fig. 9 to demonstrate the quality of the method under consideration. Newborns with hypolastic left heart syndrome (HLHS) warn Newborns with total anomalous pulmonary veins return (TAPVR) Control group Fig. 9. Examples of detected endocardium outlines from the right ventricle overlaid over the initial images, taken from echocardiographic examinations of neonates with various congenital defects, as well as from the control group of new-borns. It is universal enough to allow for detection of both, LV and RV, in various forms of congenital heart defects, which, in turn, can slightly change the echocardiographic image. It should be stressed, however, that this method is not a tool for recognition or classification of heart defects. It allows only for evaluation of various geometrical parameters of the endocardium. Nevertheless, the method described above is relatively inexpensive and fast (about 20s per image, excluding time necessary for drawing the marker and digitisation of the data). The accuracy of outlines obtained is judged by cardiologists as satisfactory. DISCUSSION The method presented, in spite of extended practical verification on 384 real echocardiographic images suffers from the lack of objective judgement of its quality. Testing on simulated images seems to be not a good solution. The algorithm has been constructed assuming some relation between the echocardiographic image and detected endocardium. The simulated images should follow the same criteria and in such circumstances the result of simulation has to be positive. Note that any new construction - an aircraft, car or a yacht - after many simulations and model tests is finally evaluated just by the human and his opinion is decisive in spite of being not wholly objective. Therefore, positive judgement of experienced cardiologists seems to be in this case sufficient. In order to help judge the method proposed in a more objective way, some criteria are collected in Table 1 and the relation between these criteria and both methods compared here is discussed in terms of these criteria. The analysis of the contents of Table 1 shows that the new, proposed method is based on entirely different principles than AQ and offers more data for quantification of the heart chambers. On the other hand, however, it requires some additional operations. Among them, the most difficult seems to be the necessity of digitising the data. This would be very simple if only the manufacturers of echocardiographs decide to add digital output of the data. 33 Wojnar L et al: Method for endocardium detection Table 1. Comparison of AQ and the method described in this paper. Acoustic Quantification New method Data source ultrasonic wave digitised video recording Type of analysis only real-time only post-inspection analysis Equipment requirements echocardiograph with built-in AQ option virtually any echocardiograph, VCR, PC with frame grabber, image analysis software Use of image processing not documented; possibly some simple processing is built-in fully image processing-based method, uses procedures available in many advanced image analysis systems Role of operator Results highly sensitive to manual tuning of the echocardiograph semiautomatic method designed to minimize the operator errors or fully automatic mode Main limitations only analysis of LV available only-built in measurements available often poor quality of detection fully automatic analysis effective only in the case of very good quality images Main advantages fast results (available during echocardiographic inspection) analysis of LV and RV virtually any parameters can be analysed analysis of historical material good quality of detection CONCLUSIONS The application of image analysis methods allows for endocardium detection free from the main drawbacks of manual and AQ methods. Semiautomatic algorithms, if only correctly developed, can give consistent, repeatable results. Image analysis methods can play the role of an efficient, additional tool for quantitative interpretation of echocardiographic images (echocardiographs offer some quantification but it is based on analysis of the echo and an image displayed is rather a result of such analysis than its starting point). REFERENCES Coster M, Chermant JL (1989). Precis d’analyse d’images. Presses du CNRS, 1-560. Forni G, Pozzoli GM, Cannizaro G, Traversi E, Calsamiglia G, Rossi D, Cobelli F, Tavazzi L (1996). Assessment of right ventricular function in patients with congestive heart failure by echocardiographic automated boundary detection. Am J Cardiol 78:1317-21. Russ JC (1995). The image processing handbook. Second edition. Florida, Boca Raton: CRC Press 1-674. Serra J (1982). Image analysis and mathematical morphology. London: Acad Press, 1-610. Sonka M, Hlavac V, Boyle R (1998). Image Processing, analysis and machine vision. PWS Publishing, An International Thomson Publishing Comp, 1-770. Szydlowski L (1999). Ocena echokardiograficzna konfiguracji komór w wadach wrodzonych serca okresu wczesnonoworodkowego, dissertation for a D.Sc. degree. Kraków, Zakamycze: 1-178. Szydlowski L, Wojnar L, Popczynska-Markowa M (1998). Echocardiographic quantification of the right ventricular areas in newborns with selected congenital heart defects, 4th Central European Symposium on Echocardiography, 15-17 October 1998, Lodz, Poland, P140. Tardif JC, Cao QL, Pandian NG, Esakof DD (1994). Determination of cardiac output using acoustic quantification in critically ill patients. Amr J Cardiol 74:810-3. Wilson GM, Rahko PS (1995). The clinical utility of automatic boundary detection for the determination of left ventricular volume: a comparison with conventional off-line echocardiographic quantification. J Am Soc Echocardiography 8:822-9. Wojnar L (1999). Image analysis. Applications in materials engineering. Florida, Boca Raton: CRC Press, 1-245. 34