Medical image segmentation

A prototype of the e-Medicus application based on the level set function and artificial intelligence

View presentation:


The purpose of the application project is to build a prototype of the intelligent computer system that processes and analyzes the images with the use of artificial intelligence. The functionality of the intelligent computer system will rely on an analysis of images from different sources.
The result of the final project will be a prototype e-Medicus for registration and analysis of data from x-ray images and classification of cancer cells. The innovative solution will be directed to medical units. The system will assist the activities of the health care units, carrying out research in the field of x-ray analysis and test results of computed tomography. Analysis of radiological images will rely on their treatment, identification and image segmentation. Thanks to such analysis, it will be possible to track changes in the patient’s condition at the time, and the process of analysis of the photos will be automated.
The application will be based on the latest scientific achievements in the field of image segmentation algorithms, computational intelligence, models and mathematical theory. The task of the system will be on the registration and analysis of medical images in the form of a numeric function. This will allow to identify changes and keeping the proper classification of the data. The multimedia presentation of the changing process will be made using the level set function, which allows to change the properties of the topological solution. The project will be developed and applied new procedures and algorithms in the field of theoretical computer science using a numerical neural networks, genetic algorithms, semantic web, ontology, theory of approximate harvest images, level set methods and hybrid algorithms. Algorithms develop methods and concepts in the field of image segmentation, capture, transmission, storage, extraction of information and show the appropriate form of their presentation.


E-Medicus system consists:

  • artificial intelligence algorithms,
  • segmentation algorithms
  • the framework,
  • agents,
  • topological algorithms
  • databases,
  • visualization systems,
  • the user interface


The development of information technology has made images valuable source of information. However, solving a specific computer problems, most of this information turns out to be useless. Therefore, the process of extracting data of interest from the image is required. This process consists of a pre-processing step, which aim is to improve the image by binarization and noise removal; data reduction focuses on extracting interesting features from the image and the last step – the analysis of these characteristics.
Recently, medical images have become the subject of intensive research, that for over a hundred of years were recorded on analog x-ray film. It enabled the recording and presentation of the image and its storage. Nowadays, the standard has become radiovisiography, which on the beginning was only used in stomatology. Although it was very controversial at the beginning, it also appeared in other branch of medicine. Received in this standard images are stored in digital form as a two-dimensional array, where each element is a value that indicates the gray level of the corresponding pixel. Digital recording is a huge advantage of this method, because it has enabled easier to store images and made their transfer more possible for further diagnosis. In addition, standard programs supplied with the equipment for radiographic offer basic operations on the image, such as a change in the presentation image (rotate to any angle, zoom in or out), change the contrast or brightness, and even making any measurements (eg. measurements of angle and area). On the other hand, high quality sensor significantly reduces the dose of radiation to which the patient is exposed to during the test. Without any changing, it is remained the fact that detection of anomalies in tissues is constantly the responsibility of the doctor. Therefore, in parallel with the development of technologies used to create medical images, the software to support their analysis is created.


The analysis of medical images allows to both locate and classify conditions accordingly. Hovewer, in practice it is very difficult method because the transformation of healthy cells to ill ones is an uninterrupted process. It is just unknown when this process starts and how long it lasts. That’s why, it is very important to have the opportunity to detect as soon as possibile ill cells.
The image analysis starts at the pixel level. The image is presented in the form of a two-dimensional array of pixels, which provides only information about the location and color of each pixel, and does not contain information identifying the pixels that make up individual objects. In order to analyze the image, it is needed to move from the pixels’ level to objects’ one. It is possible thanks to more or less complex algorithms for segmentation.


Extracting information from the image can be done by various methods. One of them is the segmentation. It can distinguish its several types, but any case, it is based on the division of the image to disjoint and uniform its fragments according to the given criterion. It’s difficult to say, which of them is the best method, because they are generally used to extract different kinds of information from image. However, their significance is enormous, because improper performance can be a major cause of erroneous results. The significant impact on the quality of their results has also the resolution of images. Too high resolution becomes a cause of separation of many irrelevant details, while too low one blurs the edges of objects, which may lead to incorrect their extraction. The simplest methods of segmentation worth to be mentioned are segmentation by thresholding and by detecting the edges of objects. The first one determines a certain threshold T, which is used to classify each pixel into one of two categories. In turn, the second of these methods is based on the border between areas of different brightness, where a large difference between the gray levels of adjacent pixels indicates the occurrence of edges between objects.

The segmentation using statistical methods

Worth more of attention are statistical methods, including k-means algorithm and k-nearest neighbors. Their simplicity and lack of necessity to determine a priori probabilities have found wide application in image segmentation. And so, the k means algorithm determines the membership of pixels to particular groups on the basis of mutual similarity of classified image points. The value of k is a predetermined value, which is often a serious drawback of this algorithm. Therefore, it is usually carried out repeatedly for different values ​​of k and the best result is selected. In turn, the algorithm k – nearest neighbors bases classification of pixels into different groups on the so-called the training set and k nearest points. In both cases, the value k indicates the number of groups.
Algorithms which were presented above were used to search for lesions of the soft tissues around the teeth. Pictures 1 and 2 show the results of their application. It is easy to see, that they are very similar, when the properly number of classes and ways of measuring the distance were selected.

Picture 1. Image segmentation by k- means algorithm on 5 clusters using Euclidean distance.

Picture 2. Image segmentation by k nearest neighbor on 5 clusters using Euclidean distance.

Segmentation by level set method

The segmentation of x-rays is also possible thanks to applying a variational level set method, which in comparison to its basic version eliminates costly time-initialization. This method is a numerical technique by which the figure of the searched object can be traced and optimized their shape. It has been presented in Figure 3 on dental image. It is easy to see, that the objects are separated and segregated with high accuracy. The separation of parts of the image with common characteristics allows to specify more precisely the boundaries between different tissues and detect anomalies within the same tissue.

Picture 3. Image segmentation by variational level set methods after 300 iterations

Figure 4 shows dermatoscopic image segmentation using level set method. Zero level set of object locates initially sought areas.

Picture 4. Dermatoscopic image segmetation using level set metod.

The image segmentation and  of the lungs shows figures 5-12.

Fig. 5. The image reconstruction by the variational level set method

Fig. 6. The image reconstruction by the fast and robust level set method

Fig. 7. FCMThresholding – sarcoidosis

Fig. 8. FCMThresholding – metastasis

Fig. 9. Results of a contour function. Sarcoidosis on the left image, metastasis on the right one. The contour function is a result of the level set function.

Fig. 10. Results of a contourf function. Sarcoidosis on the left image, metastasis on the right one. The contourf function divides an image into two areas – black and white, where white area is the area that we are interested in for further analysis.

Fig. 11. These images are obtained after transforming the original image with an im2bw function. Sarcoidosis on the left image, metastasis on the right one.

Fig. 12. Final results. By using immultiply and bwarea functions we get an estimated percentage of anomalies present on the area of interest. Results are visible on the top of every image, where image on the left shows sarcoidosis results, and image on the right shows metastasis.


Medical images created by using different types of specialized equipment allows doctors to observe the structures of the human body and the course of a number of physiological processes. Proper both analysis of these images and interpretation of information extracted from them contributes significantly to make a correct diagnosis. It should be noted that there is no universal imaging method for each of the medicine’s fields.