Full text
BACHELOR’S THESIS Bachelor’s degree in Biomedical Engineering DICOM VIEWER: INTERACTIVE VIEWER OF DICOM MEDICAL IMAGES Report and Annexes Author: Júlia Romagosa Pérez Director: Christian Mata Miquel Co-Director: Raúl Benítez Iglesias Call: June 2021
DICOM Viewer: Interactive viewer of DICOM medical images i Resum El càncer de pròstata és el segon tipus de càncer més comú i la cinquena causa principal de mort per càncer en homes durant l'últim any. Tot i així, en les últimes dècades la taxa de mortalitat ha disminuït notablement degut a, entre altres factors, un diagnòstic precoç i a un a millora en les eines per portarlo a terme. Tradicionalment en l'estudi d'aquest càncer, els radiòlegs analitzen diferents modalitats d'imatge de forma individual, entre elles 3D T2Weighted Imaging, Diffusion-Weighted Imaging i PerfusionWeighted Imaging. D'aquesta manera, trobem casos en què l'observació del tumor es veu compromesa per diferents aspectes i pot no ser detectat correctament. Per això, el nostre objectiu és desenvolupar una aplicació accessible per a qualsevol centre mèdic o hospital, sense necessitat d'instal·lació d'un software complex, que serveixi d'ajuda per al diagnòstic de càncer de pròstata i d'una solució a aquestes limitacions. A partir de la base de dades proporcionada per l'Hospital de Dijon d'imatges DICOM (Digital Imaging and Communications in Medicine) de pròstata, en aquest estudi es proposa una aplicació web implementada mitjançant Python i disponible a través de Docker, que accedeix directament a la informació de les imatges i mostra simultàniament les tres modalitats d'imatges esmentades. Així mateix, proporciona una eina per fer anotacions en les diferents zones de la pròstata, incloent el tumor si és el cas, i que permet exportar i tornar a importar-les un cop acabat l'estudi.
Report ii Resumen El cáncer de próstata se trata del segundo cáncer más frecuente y la quinta causa principal de muerte por cáncer en hombres en el último año. Sin embargo, durante las últimas décadas la tasa de muerte ha disminuido notablemente debido a, entre otros factores, un diagnóstico precoz y a una mejora en las herramientas para realizarlo. Tradicionalmente en el estudio de este cáncer, los radiólogos analizan diferentes modalidades de imagen de forma individual, entre ellas 3D T2Weighted Imaging, Diffusion-Weighted Imaging y Perfusion-Weighted Imaging. De esta forma, encontramos casos en los que la observación del tumor se ve comprometida por diferentes aspectos y puede no ser detectado correctamente. Por ello, nuestro objetivo es desarrollar una aplicación accesible para cualquier centro médico o hospital, sin necesidad de instalación de un software complejo, que sirva de ayuda para el diagnóstico de cáncer de próstata y de una solución a estas limitaciones. A partir de la base de datos proporcionada por el Hospital de Dijon de imágenes DICOM (Digital Imaging and Communications in Medicine) de próstata, en este estudio se propone una aplicación web implementada mediante Python y disponible a través de Docker, que accede directamente a la información de las imágenes y muestra simultáneamente las tres modalidades de imágenes mencionadas. Asimismo, proporciona una herramienta para hacer anotaciones en las diferentes zonas de la próstata, incluyendo el tumor si es el caso, y que permite exportar y volver a importarlas una vez acabado el estudio.
DICOM Viewer: Interactive viewer of DICOM medical images iii Abstract Prostate cancer is the second most common cancer and the fifth leading cause of cancer death among men in the past year. Nevertheless, during the last decades the death rate has notably decreased mostly as a result of an early diagnosis and an improvement on the tools used to perform it. Traditionally in the study of this cancer, radiologists analyse different imaging modalities individually, including 3D T2-Weighted Imaging, Diffusion-Weighted Imaging and Perfusion-Weighted Imaging. In this way, we can find cases in which the observation of the tumour can be compromised by different aspects and may not be detected correctly. For this reason, our goal is to develop a simple, web-based, application accessible from primary care centres or hospitals to help diagnosing prostate cancer and overcome these limitations. From the database supplied by the Dijon Hospital of prostate DICOM (Digital Imaging and Communications in Medicine) images, this study proposes a web application implemented using Python, which directly accesses the information in the DICOM images and displays simultaneously the three images modalities that have been mentioned. Likewise, it provides a tool to make annotations in the different areas of the prostate, including the tumour, and that allows them to be exported and imported once the study has finished.
Report iv Acknowledgments This project concludes with the work of these last four years. Firstly, I would like to thank my supervisor, Christian Mata, for always being willing to help and for all the support he has brought me since the beginning. Thank you for always being so encouraging, it has been a pleasure working with you, as well as with my co-supervisor Raúl Benitez. Last but not least, it would not have been possible to finish this grade and work without the help of my parents, sister and friends. I am beyond grateful with them for being by my side during this time and making it a lot easier.
DICOM Viewer: Interactive viewer of DICOM medical images v Glossary ADC Apparent Diffusion Coefficient CZ Central Zone DCE Perfusion-Weighted imaging DICOM Digital Imaging and Communications in Medicine DWI Diffusion-Weighted Imaging MRI Magnetic Resonance Imaging PCa Prostate Cancer PZ Peripheral Zone SOP Service Object Pair T2WI 3D T2-Weighted Imaging UID Unique Identifiers
Report vi Index RESUM ______________________________________________________________ I RESUMEN ____________________________________________________________ II ABSTRACT ___________________________________________________________ III ACKNOWLEDGMENTS _________________________________________________ IV GLOSSARY ____________________________________________________________ V 1. INTRODUCTION ___________________________________________________ 5 1.1. Project origin ................................................................................................................. 5 1.2. Motivation ..................................................................................................................... 5 1.3. Project framework ........................................................................................................ 6 1.3.1. General objective ......................................................................................................... 6 1.3.2. Specific objectives ........................................................................................................ 6 2. THEORETICAL FRAMEWORK_________________________________________ 7 2.1. Prostate anatomy ......................................................................................................... 7 2.2. Magnetic Resonance Imaging techniques ................................................................. 8 2.2.1. 3D T2Weighted Imaging (T2WI) ............................................................................... 9 2.2.2. Diffusion-Weighted Imaging (DWI) .......................................................................... 10 2.2.3. Perfusion-Weighted Imaging (DCE) .......................................................................... 11 2.2.4. DICOM format ............................................................................................................ 12 2.2.5. Current problematic ................................................................................................... 15 3. STATE OF THE ART ________________________________________________ 16 3.1. Literature classification .............................................................................................. 16 4. PROJECT FRAMEWORK ____________________________________________ 19 4.1. Project implementation ............................................................................................. 19 4.1.1. Programming language .............................................................................................. 20 4.1.2. Architecture ................................................................................................................ 21 4.1.3. Graphic interface ........................................................................................................ 22 4.1.4. Image processing tools .............................................................................................. 23 4.1.5. Annotation system ..................................................................................................... 27 4.1.6. Repositories and deployment ................................................................................... 27 4.1.7. Materials ..................................................................................................................... 32
DICOM Viewer: Interactive viewer of DICOM medical images vii 5. DICOM VIEWER APPLICATION ______________________________________ 33 5.1. Database ...................................................................................................................... 33 5.2. Image visor and filter management .......................................................................... 34 5.3. Annotation system ...................................................................................................... 35 5.4. Case of study ............................................................................................................... 37 6. DISCUSSION AND FURTHER WORK __________________________________ 40 7. PROJECT SCHEDULE ______________________________________________ 42 8. ENVIRONMENTAL IMPACT _________________________________________ 43 CONCLUSIONS _______________________________________________________ 44 BUDGET ____________________________________________________________ 46 BIBLIOGRAPHY _______________________________________________________ 47 ANNEX A ____________________________________________________________ 53 A1. Dockerfile ..................................................................................................................... 53 A2. Instructions to run docker .......................................................................................... 54 ANNEX B ____________________________________________________________ 55 ANNEX C ____________________________________________________________ 56
DICOM Viewer: Interactive viewer of DICOM medical images 7 2. Theoretical framework 2.1. Prostate anatomy Although being the second most common cancer in men worldwide, Prostate Cancer (PCa) specific survival is excellent for most patients. In fact, the death rate of prostate cancer has been in significant decline since the mid-1990s. Early diagnosis and a proper follow-up, as well as advanced treatments and further investigation in this field, have led to this drop on the mortality rate. The prostate is a walnut-sized gland located between the bladder and the penis, which surrounds the proximal urethra as it exits from the bladder. The upper part of the prostate is called the base and the lower, narrowed part the apex. Moreover, most part of the prostate is covered by a thin layer of connective tissue called the capsule. An example of the anatomy of a prostate gland is depicted in Figure 2.1. It is divided in four zones: Peripheral Zone (PZ), Central Zone (CZ), Transition Zone (TZ) and Anterior Fibromuscular Stroma (AFS). Figure 2.1. Zonal anatomy of the prostate gland [56] The Peripheral Zone occupies around 70% of the prostate gland, extending from the base of the apex to the posterior surface and surrounding the distal urethra. It is normally represented with a high signal intensity in T2-weighted images, as it contains numerous ductal and acinar elements with sparsely interwoven smooth muscle [4]. In this zone, carcinoma, chronic prostatitis, and post inflammatory atrophy are relatively more common than in the other zones, and around a 75% of prostate cancers originate in this zone [1].
Report 8 The Central Zone is a cone-shaped structure which forms part of the base of the prostate, located between the peripheral and transition zones, and it is traversed by the ejaculatory ducts. It accounts for approximately 25% of the glandular tissue. Tumours originating in the Central Zone, although being less common, tend to be more aggressive. The Transition Zone forms only 5% of the glandular tissue and consists of two equal portions lateral to the urethra in the mid-gland. This portion of the prostate can enlarge over the years due to the development of benign prostatic hyperplasia (BPH), and less probably adenocarcinoma. On MRI, it is represented as nodular areas with different signal intensity, depending on the relative amount of glandular and stromal hyperplasia [17]. Glandular hyperplasia results in higher signal intensity on T2weighted images, due to ductal and acinar elements and secretions. On the other hand, stromal hyperplasia contains more muscular and fibrous elements, resulting in lower signal intensity. The Anterior Fibromuscular Stroma (AFMS) covers the apex of the prostate. It is composed of fibrous and smooth muscular elements. Hence, this portion results in low intensity signals in T2W1. The distal part of the AFMS is important in voluntary sphincter functions, whereas the proximal portion plays a central role in involuntary sphincter functions. In terms of image annotation in prostate diagnosis, the most common zones are CZ, PZ, TZ and Tumour (Tum), in case it is presented. For this reason, our interest is mainly focused on these four regions in this study. 2.2. Magnetic Resonance Imaging techniques Magnetic resonance imaging (MRI) is a non-invasive imaging technology that produces three dimensional detailed anatomical images, used to investigate the anatomy and physiology of the body in both health and disease. MRI uses a strong magnetic field and radio frequency pulses to produce detailed pictures of organs, soft tissues, bone and other internal body structures. When talking about MRI it is important to be familiar with “weighted” images, especially with T1Weighted Imaging (T1WI) and T2-Weighted Imaging, which can be in 3D (3D T2-Weighted Imaging (T2WI)). These are related to relaxation parameters. As well as that, there are MRI features which focus on the pulse sequence. This pulse sequences are programmed sets of changing magnetic gradients that allow the user to image a tissue in various ways to obtain important diagnostic information about the tissue. Among this pulse-based features, the most important ones are the Echo Time (TE) and the Repetition Time (TR). TE refers to the time occurred between the application of a radiofrequency excitation pulse and the peak of the signal induced in the coil. In contrast, TR refers to the time from the application of an excitation pulse to the application of the next pulse. Whereas TE controls the
DICOM Viewer: Interactive viewer of DICOM medical images 9 amount of T2 relaxation, TR determines how much longitudinal magnetization recovers between each pulse. Both are measured in milliseconds. Compared to other imaging modalities, such as X-Ray, CT-scan and ultrasound, this technique is considered to perform the best results in terms of high resolution and spontaneous contrast of soft tissues, besides allowing multiplanar and multiparametric scanning. For these reasons, MRI has been established as the best imaging modality for the detection, localization and staging of PCa [1]. For most men suspected of having prostate cancer, tissue is obtained through transrectal ultrasound guided (TRUS) biopsy during which 12 biopsy cores are randomly taken. Still, advances in MRI have shown improved detection and characterization of prostate cancer by using a multiparametric approach, which combines anatomical and functional data [4]. This multiparametric MRI evaluation includes three general components: high-resolution T2WI and at least two functional MRI techniques, diffusion weighted imaging (DWI) and either MR spectroscopic imaging (MRSI) or Perfusion weighted imaging (DCE). For the purposes of this project we will discuss T2WI and both DWI and DCE. 2.2.1. 3D T2Weighted Imaging (T2WI) 3D T2-Weighted Imaging provides the best depiction of the prostate’s anatomy, so they are sometimes referred to as anatomy images. However, it is not recommended its use alone, as using it in combination with other techniques increases the image quality in both sensitivity and specificity. T2WI images are normally obtained in two or three orientations. Prostate cancer typically presents as a round or ill-defined low signal-intensity focus in the peripheral zone on T2WI, and many of them can be detected within the high signal-intensity background of the normal peripheral zone glandular tissue [4]. Unfortunately, many conditions such as prostate intraepithelial neoplasia, prostatitis, haemorrhage, atrophy, scars and post-treatment changes can mimic prostate carcinomas. Furthermore, the signal intensity of the peripheral zone can be compromised by hormonal ablation, reducing the visibility of prostate cancer. Transitional Zone tumours are even more difficult to detect due to the fact that the tissue low intensity overlaps with PCa, and they are often shown as a homogeneous signal mass with indistinct margins. An example of a 3D T2-weighted image of a prostate study with a healthy and a tumour area is depicted in Figure 2.2.
Report 10 Figure 2.2. Example of a 3D T2-weighted image of a prostate study [1]. For a proper detection of a PCa, we must take into account different zones: the capsule, the seminal vesicles and tje posterior bladder wall for extra-prostatic tumour invasion. Different criteria have to be considered when evaluating each zone. Criteria for extracapsular extension are abutment; irregularity and thickening of the neurovascular bundle; bulge, loss of capsule and capsular enhancement; measurable extracapsular disease; and obliteration of the recto-prostatic angle. As well as that, an abnormally low signal intensity within the lumen or a focal thickening of the seminal vesicle wall is suggestive of seminal vesicle invasion. Besides, expansion, low T2 signal intensity and filling in of the prostate seminal vesicle angle can be a sign of seminal vesicle infiltration [5]. 2.2.2. Diffusion-Weighted Imaging (DWI) Diffusion-weighted imaging (DWI) allows qualitative and quantitative assessment of prostate cancer’s aggressiveness and provides information about the tissue in terms of cell organization, density and microstructure. DWI relies on Apparent Diffusion Coefficient (ADC) maps, which are a measure of the magnitude of diffusion of water molecules within tissue and are commonly clinically calculated using MRI with DWI. The motion of water molecules is more restricted in tissues with a high cellular density and intact cell membranes, so very low ADC values are clearly indicative of cancer. Another important concept in DWI imaging is the b-value (s/mm), which identifies the measurement’s sensitivity to diffusion and determines the strength and duration of the diffusion gradients. PCa shows a high signal intensity with high b-values and low signal intensity/value on ADC maps. An example of a DWI of a prostate study with healthy and tumour area is depicted in Figure 2.3.
DICOM Viewer: Interactive viewer of DICOM medical images 11 Figure 2.3.Example of a Diffusion-weighted image of a prostate study [1]. High b-value (800-1000) DW images and ADC maps are used for a qualitative assessment. Still, normal prostatic tissue in some zones like TZ may present high signal intensity in DWI and low ADC, mimicking a tumour. This can be overcome by using very high b-values in combination with T2WI. On the other side, ADC values are used for quantitative assessments, providing information about the tumour’s aggressiveness, and improves specificity in prostate cancer detection compared with T2WI alone. It should, therefore, be part of routine assessments of patients with prostate cancer [1]. 2.2.3. Perfusion-Weighted Imaging (DCE) Perfusion imaging is based on Dynamic Contrast Enhancement (DCE) of the signal during the pass of a contrast agent. The theoretical basis of this vascular technique is tumour angiogenesis, as there is a relationship between abnormal perfusion and neoangiogenesis in tumours. In order to evaluate the tumour’s viability, it is commonly used a gadolinium-based contrast agent. However, a comparison of pre and post-gadolinium images is not enough to discern prostate cancer, since a normal prostate is highly vascularized. T1WI DCE-MRI imaging data can be assessed in three ways: qualitatively, semi-quantitatively or quantitatively. DCE-MRI images are acquired in a series of axial T1WI gradient echo sequences covering the entire prostate during a bolus injection of the contrast medium. According to several studies, DCE-MRI gives better results for prostate cancer localization than T2WI [1]. An example of a Perfusion-weighted image of a prostate study with healthy and tumour area is depicted in Figure 2.4. Although the available information is limited, it is suggested that DCE may
Report 12 improve staging. Moreover, DCE-MRI is essential for the detection of post-prostatectomy and radiotherapy recurrences. Figure 2.4.Example of a Perfusion-weighted image of a prostate study [1]. 2.2.4. DICOM format The Digital Imaging and Communications in Medicine Standard (DICOM) specifies a non-proprietary data interchange protocol, digital image format, and file structure for biomedical images and image related information [12]. DICOM is the globally accepted standard for communication and management of a wide range of medical images. It is used as a way to define the format of these images so that they can be exchanged with the data and quality necessary for clinical use. With Internet becoming the platform for new information applications, DICOM has enabled the development of advanced medical imaging apps that have “changed the face of clinical medicine” [14]. Structure of a DICOM file DICOM groups information into data sets, consisting of several data elements. Information Objects Definition (IOD) are a key part in the DICOM structure organization, defining the set of data elements that are being transmitted. These data elements store the values of the coded attributes for the realworld object represented in the data set. They are organized in groups called modules, as shown in Figure 2.5. Each data element is identified by its tag, numbered with a unique identifier and ordered within the DICOM file from minor to major [15]. IODs can be associated with services to form what is called a Service Object Pair (SOP). For instance, a MR image IOD is associated with the Storage service to form the MR Image Storage SOP Class.
DICOM Viewer: Interactive viewer of DICOM medical images 13 Figure 2.5. DICOM structure [15] DICOM header format A DICOM file contains a file header portion, a file meta information portion, and a single SOP instance [1]. The header is made up of a preamble of 128-byte, followed by the characters DICOM (these are used to identify whether it is a DICOM format or not). The file meta portion follows a tagged format, and contains information about the file, the series, the study and the patient it belongs to, as it can be seen in Figure 2.6.
Report 14 Figure 2.6. Example of a DICOM header [1] Each DICOM file is designed to be standalone, so all the information needed to identify the file should be embedded in each header. The acronym UID refers to a Unique Identifier. This information is organized into 4 levels: PatientID, StudyInstanceUID, SeriesInstanceUID, and InstanceUID: • Patient: Contains information related to the patient, such as patient’s name or date of birth among others. The key attribute in this level is “PatientID” which is normally associated with his or her medical history number. • Study: Contains information about the study, for instance the study date, the acquisition number or the study description. The key attribute is “StudyInstanceUID”, which should be unique for each study. • Series: Consists in a sequence of images for each study, and contains information about a series, such as modality or series number. The key attribute is “SeriesInstanceUID”.
DICOM Viewer: Interactive viewer of DICOM medical images 15 • Instance image: Contains data about the instance image. The key attribute is “InstanceUID” which is unique for each image. 2.2.5. Current problematic In order to make a proper diagnosis of a prostate study, several aspects need to be taken into consideration. Firstly, it is really important to take into account the interactivity between the three described MRI techniques. When a prostate study is carried out, every image modality should be examined thoroughly. By visualizing the three MRI techniques simultaneously, the same region of interest can be seen in each of them, so the tumour visualization is not compromised by each modality’s limitations or by any other prostate condition that can mislead to an incorrect diagnosis. On the other hand, the digital input promotes the development of medical image processing, which has grown into a vast field of study. Applications for image processing and visualization are generally limited to the health center or hospital. Web-based applications have become a solution to ease the use of these applications, providing a tool accessible from anywhere, regardless of the software or the device, with no need for a difficult installation process. Moreover, DICOM is considered the standard to exchange medical images and its related information. Therefore, the used application should allow a direct visualization of DICOM files and the information contained in them. For this reason, in the next chapter it is carried out a bibliographic research to check if there is any available application that satisfies the problematic exposed above. Next, it is presented a summary table with all the related work found over the last decade.
Report 16 3. State of the art 3.1. Literature classification The aim of this chapter is to evaluate the current available web-based medical applications, study its framework and compare them. The literature research was carried out using PubMed and Google Scholar, and it focused on web-based medical applications related to medical imaging. In Table 3.1 it is presented an overview of the web-based medical applications developed in the last decade. Most of the currently available applications include tools for image visualization and image processing. However, others such as the developed by Kaspar et al. [29] focused more on improving accessibility in real-time, enabling a remote and interactive stereoscopic visualization among multiple viewing locations. Another similar approach was studied in 2019 by Lajara et al. [42], they proposed a solution to deal with the lack of a standardized whole slide image (WIS) format. The developed web-app, Visilab Viewer, allows telepathology and proper collaborative work during diagnosis, being able to interact and work with any WSI based on the DICOM standard. A web-based system fort retinal image analysis was proposed in 2010 by Ortega et al. [33], providing a framework for ophthalmologists and other experts in the field to collaboratively work using retinal image-based applications. Retinal microcirculation is assessed using a semi-automatic methodology for the computation of the Arteriolar-to-venular Ratio (AVR). Furthermore, in 2016 another useful web tool for ophthalmologists was developed by Remeseiro et al. [43] to assess dry eye disease, evaluating tear film images. It allows manual annotations and also a tool that integrates several algorithms for automatic tear film pattern analysis. In 2011, Baltasar et al. [34] designed a web-tool to support diagnostic clinical trials involving different experts and hospitals or research centers. The image analysis of this project is based on skeletal X-ray imaging; besides it allows to store data and images to the database. Moreover, in 2014 Kammerer et al. [38] presented a similar work, MyCases, a portable database server for quick and easy storage of such cases including whole image series, patient data, and annotations. In 2010, Mahmoudi et al. [31] developed a web-based, interactive, extendable, 2D and 3D medical image processing and visualization application that requires no client installation. It also includes a wide range of medical image preprocessing, registration, and segmentation methods, implemented using open source libraries. The software supports image formats such as tiff, gif, jpeg and DICOM. Another approach containing segmentation tools was proposed by Young et al. [45], which consisted in a webbased automatic spine segmentation method using deep learning that can be very practical and accurate for spine segmentation as a diagnostic method. Moreover, Yang et al. [32] also studied a web-
DICOM Viewer: Interactive viewer of DICOM medical images 23 Figure 4.1. DICOM Viewer graphic interface 4.1.4. Image processing tools As we have seen one of the main parts of the app are the three simultaneous panels displaying each one an MRI technique. In order to visualize and improve its visualization, it is included a tool to apply basic image processing filters to the images. All the image processing filters are applied from the Python library Skimage [22]. Different modules have been used: the module Filters (Gaussian, Median and Sobel), Morphology (Erosion and Dilation) and lastly Exposure (Gamma contrast).
Report 24 Median filter Median filter is one smoothing filter and it removes speckle noise and impulsive noise from the image, especially impulse and salt & pepper noise. As the median filter is applied onto an image, each pixel is replaced with the median value of its neighbors [28]. One of the main advantages of the median filter is that it also preserves the edges present in the image. Furthermore, it does not introduce new pixel values since it only re-use existing pixel values from the window. An example of a Median filter applied to a prostate image compared to a Gaussian filter can be seen in Figure 4.2. Gaussian filter A Gaussian Filter is a low pass filter used for reducing noise (high frequency components) and blurring regions of an image [28]. In this sense it is similar to the mean filter, but it uses a different kernel that has the shape of the function ‘Gaussian distribution’ (Equation 4.1) to define the weights inside the kernel, which are used to compute the weighted average of the neighboring points (pixels) in an image. 𝐺 𝜎 =1 2𝜋𝜎2𝑒−(𝑥2+𝑦2) 2𝜎2 Equation 4.1. Gaussian distribution The differences between both Median and Gaussian smothering filters is shown in Figure 4.2. Figure 4.2. Comparison between Median and Gaussian filter. From left to right it can be seen: the image without filter, Gaussian and Median filter.
DICOM Viewer: Interactive viewer of DICOM medical images 25 Sobel Figure 4.3. On the left, a prostate diffusion image without filter and on the right the same image with a Sobel filter. The Sobel filter is used for edge detection, which are rapid changes in the image intensity function. The effects can be observed in Figure 4.3. A Sobel edge detection operator consists of a pair of convolution kernels as shown in Equation 4.2, where the second kernel is a rotation of the first one. These kernels are designed to respond maximally to vertical and horizontal edges [46]. Equation 4.2. Sobel operators Erosion Erosion is a morphological filter where the value of the output pixel is the minimum value of all pixels in the neighborhood. By using erosion, islands and small objects can be removed so that only substantive parts remain. It acts like a local minimum filter [47]. In Figure 4.4 there is an example of an erosion filter applied to a prostate image in contrast to the dilation filter. Dilation Opposite to erosion, dilation filter adds a layer of pixels to both the inner and outer boundaries of regions so that the value of the output pixel is the maximum value of all pixels in the neighborhood. Therefore, it acts like a local maximum filter. Dilation can be used to make objects more visible and fill in small holes in objects [47]. The notable difference between an Erosion and Dilation filter is shown in Figure 4.4.
Report 26 Figure 4.4. Comparison between an erosion filter on the middle, a dilation filter on the right, and a normal prostate anatomy image, on the left Gamma contrast Gamma correction is used to correct the differences between the way a camera captures content, the way a display displays content and the way our visual system processes light. It is the name of a non-linear operation used to code and decode luminance, maximizing the use of the bits or bandwidth relative to how humans perceive light and color. Figure 4.5. A Gamma contrast filter, on the right, applied to a Perfusion image, on the left. Gamma correction is defined in the simplest cases by the expression on Equation 4.3 [48], where A represents a constant, typically from 0 to 1, and the input and output values are non-negative real values. A gamma value γ < 1 will turn the image darker while gamma values > 1 will make the image appear lighter. On Figure 4.5 it can be seen the effects of applying this filter with a gamma value of 1.5.
DICOM Viewer: Interactive viewer of DICOM medical images 27 Equation 4.3. Gamma correction 4.1.5. Annotation system The annotation system provides a tool for experts to manually annotate regions and classify them between the different prostate zones, including the Central zone, Peripheral Zone, Transition zone and the Tumour itself. The python library Plotly has some predefined tool to draw different kinds of labels in images, such as rectangular or open freeform. For the means of our application the predefined tool we use is a closed freeform, which lets us draw a limited region, defining a zone. The application stores the coordinates of the annotations, which can be exported in a CSV (Comma Separated Values) format [50]. A CSV file is a plain text file that contains a list of data. It has a fairly simple structure, a list of data separated by commas. For instance, a file with two different kinds of annotations, one for the CZ and another for a tumour would look like is depicted in Figure 4.6. Hence, for a larger list the structure would look exactly the same: the name of the zone followed by a coma and the coordinates of the closed freeform label. The idea is that you can export complex data from the application to a CSV file, and then import the same data into the application again. 4.1.6. Repositories and deployment 4.1.6.1. GitHub GitHub is a code hosting platform for version control and collaboration. We have created a repository where there can be found all the files of the project, which is explained in Annex B. The main code can be found on the app.py file and the file README explains how to run the app locally. Basically, you first need to install all the dependencies to run the project, executing the command pip Type, Coordinates Central Zone,"M74.67899761336515,108.73329355608591L76.46897370167,109.44928400954653L75.75298329355608,111.23 926014319808L74.67899761336515,110.88126491646777L74.67899761336515,108.37529832935559Z" Tumor,"M72.17303102625297,114.10322195704056L73.96300715990454,115.89319809069211L72.53102625298328,1 15.5352028639618L72.53102625298328,114.81921241050118Z" Figure 4.6. Example of a CSV file structure.
Report 28 install -r requirements.txt. Next, execute the command python app.py (or python3 app.py, depending on the python version you have installed in your system) and the app will begin to execute. Figure 4.7. List of folders and files that can be found in the DICOM Viewer repository [51] 4.1.6.2. Docker Dash apps can be deployed to servers. In our case we will use Docker, which is an open platform for developing, shipping, and running applications [26]. Docker packages and runs an application in an isolated environment called a container, which contains everything needed to run the application. The isolation and security allow you to run containers simultaneously on a given host. Figure 4.8. Docker architecture [26] In Figure 4.8 it is shown a schema of Docker works. Docker uses a client-server architecture: the client sends commands to the Docker daemon, which carries them out. Hence, the daemon builds, runs and distributes Docker containers.
DICOM Viewer: Interactive viewer of DICOM medical images 29 These containers form part of the series of objects which are created when using Docker. The instructions and the template needed to create containers are held on Images, and these Images are stored in a Docker registry, such as Docker Hub. The steps followed to containerize our python application are the following: • We create a Dockerfile which contains the instructions to build the Python image • We build the image • Run the image as a container • Deploy the application to a hub Build the Python image In order to build the image, we first need to create a Dockerfile. A Dockerfile is a text document that contains all the commands which need to be called on the command line to assemble an image. An example of a Docker file can be found in Annex A1. Firstly, in the root of our working directory we create a file named Dockerfile, which must contain the instructions described in Figure 4.9. Figure 4.9. Commands of the Dockerfile • FROM python:3 this command tells Docker which base image should use. • WORKDIR /usr/src/app instructs Docker to use this path as the default location for all subsequent commands so we can use relative paths • COPY requirements.txt ./ is used to copy our requirements.txt file into the image, which contains all the dependencies needed to run our application. • RUN pip3 install – no-cache-dir -r requirements.txt installs the modules into the image, so all the needed dependencies are installed.
Report 30 • COPY . . command takes all the files located in the current directory and copies them into the image • The EXPOSE instruction informs Docker that the container listens on the specified network port. • CMD [ "python", "/app.py"] tells Docker which command we want to run when our image is executed inside a container. Once we have built the Dockerfile we can build the application Image. To do so we use the docker build command, shown in Figure 4.10, which builds Docker images from a Dockerfile and a “context”. This context refers to a set of files located in the specified path. The command takes an optional -- tag flag, to specify the name of the image. Figure 4.10. Instructions to build a Docker image Run the image as a container Containers are runnable instances of images. First step to run a container inside an image is to use the docker run command (Figure 4.11). Besides, we need to specify a port for our container, by using the - - publish command or -p for short. For instance, to map the host’s port 8050 to the container’s port 8050 we must type -p 8050:8050. This command should be followed by -- detach or -d if we want our container to run in detached mode or in the background. Moreover, to specify the name of the container it is necessary to include the -- name flag on the docker run command. Figure 4.11. Command to run the Docker container To list the built images we use docker images, and to see the running container we use the command docker ps. Moreover, to stop the container from running we can type docker stop followed by the container name.
DICOM Viewer: Interactive viewer of DICOM medical images 31 Push a Docker container image to a Docker Hub Docker Hub repositories are used to share container images, which can be pushed to Docker Hub through the docker push command. Firstly, it is needed to name the local image using the Docker Hub username and the repository name created. This can be done by re-tagging an existing local image docker tag <existing-image> <hubuser>/<repo-name>, as it can be seen in Figure 4.12. After that, it is used docker push <hubuser>/<repo-name> to finally push the image to the Hub. Figure 4.12. Push Docker image to Docker Hub The application repository [52] in Docker Hub, shown in Figure 4.13, can be downloaded by using the command docker pull juliaromagosa/dicom-viewer:dicom-viewer, which downloads it locally in the host. In order to do so, you first need you first need to install Docker Desktop [58], which provides the speed and security needed to use this applications on your desktop. Figure 4.13. GitHub repository interface [52]
Report 32 4.1.7. Materials In this chapter it is presented the currently working DICOM prostate database supplied by the Hospital of Dijon. This is composed of anatomical, diffusion, and perfusion images of 47 different cases of study. There are a total of 64 images of T2WI, 14 of DWI and around 640 for DCE imaging per case. Furthermore, the average age for all the patients is around 52 years. Their personal information, such as their complete name, is anonymized. T2W1 fast spin-echo images were acquired with a sub-millimetric pixel resolution on an oblique axial plane. The specific acquisition parameters were a TR, TE and ETL of 3600 ms, 143 ms and 109 correspondingly, and a slice thickness of 1.25 mm. To acquire DWI images it was used a pulsed gradient spin-echo technique with two b-values, 100 and 800 sec/mm2. ADC mapping was generated from the raw data on a pixel-by-pixel basis, and the TR and TE were of 4200 and 101 ms respectively. DCE-MRI was performed using a fat-suppressed 3D T1 VIBE sequence, which is specified by a TR and a TE of 3.25 and 1.12 ms, as well as a flip angle of 10 degrees and a temporal resolution of 6 sec/slab over approximately 5 minutes. As well as that, it was administered a bolus injection of Gd-DTPA, at a dose of 0.2 ml Gd-DTPA/kg of body weight.
DICOM Viewer: Interactive viewer of DICOM medical images 39 As a result, in Figure 5.9 it is shown the simultaneous view that offers DICOM Viewer of the tumour in each MRI modality, with the prostate gland also classified in its regions of interest. From this case we can conclude that what can be confused as part of a healthy prostate tissue in an anatomical image, can be finally diagnosed as a tumour by comparing it in Perfusion and Diffusion images. Here relies the importance of analysing a suspicious region thoroughly in different MR image modalities, so we can provide an accurate diagnosis. Figure 5.9. Simultaneous view of a tumour in different MRI images
Report 40 6. Discussion and further work DICOM Viewer is a web-based application for the analysis of prostate images using three different MR image techniques: T2WI, DWI and DCE. One of the most important issues we wanted to address is the necessity to simultaneously visualize different MRI images of the same patient in order to diagnose some pathology or lesion. That is because of the high importance it has to consider the interconnectivity between these different techniques of image acquisition. Hence, the proposed interface is divided into three panels so that experts can study the same region of interest at the same time, simultaneously, through the different techniques. As well as that, the presented application provides a tool where experts can annotate important findings in a really simple way, in order to make the diagnosis of a patient study. Once the study has been analysed, the findings are reported in a standardized format; csv. Besides, this information can be later imported to the app again. In this way, it provides a useful tool for experts to manage examinations with different types of images and data. Furthermore, DICOM Viewer directly reads and shows DICOM files, including important patient information that could be useful to experts. Since DICOM is considered the globally accepted standard to manage with medical images, it can easily be adapted to other modalities and protocols, although being specialized in prostate images. Another main advantage is that our tool is designed to work in a web-based environment. It is developed using a very intuitive programming language, Python, and it is implemented using Dash to create an interactive and dynamic application. Docker is used to deploy the app, so multiple users can access DICOM Viewer remotely and no installation is needed on any computer. Moreover, it can be executed from any operating system, including Windows, Linux and MAC. The only requirement is to install Docker desktop on your computer, which is free and fast. On the other hand, the project we present is still the first release. There are some ways in which the application can be improved. For instance, there are some parameters regarding the image filters that could have had some input to modify them, such as the gamma value in the Gamma contrast filter. Moreover, we could apply automatic segmentation filters that can help to improve the efficiency of the diagnosis, as currently it is all manually done. Furthermore, the application could have a simple way to go directly to a specific image number. In addition, we found some limitations when exporting the database due to a limitation of time. We could have studied a function to export the entire database with its annotations, not creating separated files for each one. Docker has also got some shortcomings. In case we want to add more patients to the actual database, we would have to build the Docker image again, as it cannot be
DICOM Viewer: Interactive viewer of DICOM medical images 41 modified. If the application is being used locally via the GitHub repository, there would not be a problem as files can easily be added to the database folder. Finally, it has to be remarked that this application has been validated by the medical image experts in the Hospital of Dijon. This validation is based on the paper presented by Mata et al. [59], where it is analysed the ground-truth obtention of a prostate cancer analysis using MRI by two different experts. Medical findings in different regions of the prostate gland are evaluated using collaborative work, demonstrating that evaluation with a previous knowledge of the other experts opinion reduces the variability and increases the quality of the diagnosis.
Report 42 7. Project schedule In the next section it is described the Gantt diagram followed to develop this project, which can be seen in Table 7.1. It comprises 16 weeks. The first meetings started during mid-February and lasted until the second week of June, when we concluded this report. The development of this project focused on three stages. First of all, it was carried out an initial information research to learn the basics of this work and to get in touch with the Dash structure. Then, the main part of the development focused on the programming part, where we dedicated most of the time and which needed the most attention. That included the deployment of the application. Finally, we gathered all this information and results on this report, and we made the final conclusions and thought about future work. Table 7.1. Gantt diagram of the project organization
DICOM Viewer: Interactive viewer of DICOM medical images 43 8. Environmental impact In this chapter we aim to evaluate the environmental impact of this project, that could result from the development stage and also from the use of it. Due to the expectational situation derived from the COVID pandemic, all the meetings with the project director and co-director were made via google meet. For this reason, there has been no emission of gases from any kind of transport. Basically, this project consists in an application programmed exclusively in Python language using an interpreter, PyCharm [55], and deployed via Docker. Thus, the only tool needed to perform this study was a computer, specifically a MacBook Pro 13-inch of 2017 and four Thunderbolt-3 ports. This device was not acquired in the means of this project; therefore, we only consider the electric power used to charge it part of the environmental impact, not accounting the manufacturing process of it. In order to calculate the impact generated by the computer's consumption of electricity, we must take into consideration the emission of CO2. As stated in the Gantt diagram in Chapter 7, the whole project was carried out during a total of 16 weeks. Considering an average of 40 hours per week we assume a number of 650 worked hours. Moreover, the computer specifications state a power consumption of 61 W [53]. In total, the electricity consumption derived from the computer’s use for the project adds up to 44.84 kWh (Equation 8.1). 𝐸𝑙𝑒𝑐𝑡𝑟𝑖𝑐𝑖𝑡𝑦 𝑐𝑜𝑛𝑠𝑢𝑚𝑝𝑡𝑖𝑜𝑛 = 650 ℎ ∗ 61 𝑊 = 39650 Wh = 39,65 kWh Equation 8.1. Total electricity consumption derived from the computer use With the aim of calculating the gas emission produced by this consumption, we assume that one kWh emits 0.15 kg of CO2 in Spain, according to the National Commission for Markets and Competition (CNMC) on date April 16th of 2021 [54]. Consequently, a total of 5,94 CO2 kg have been emitted during this project development (Equation 8.2). 𝐶𝑂2 𝑒𝑚𝑖𝑠𝑠𝑖𝑜𝑛 = 39,65 kWh ∗ 0,15 kg kWh = 5,94 𝐶𝑂2 𝑘𝑔 Equation 8.2. C02 emission derived from the electricity consumption On the other hand, the used DICOM prostate database was not directly acquired for this study, so we consider it out of the project scope. As a result, no environmental impact derives from the images acquisition process. Likewise, as the application is web-based, the only impact its use will have is, as well as in the other assumptions, the consumption of electric power.
Report 44 Conclusions Prostate cancer is the second most common cancer in men worldwide. Thus, along with the significant tendency of applying new technologies to the software of medical imaging centers, has led to the development of this project. Our main goal was to develop a medical tool for the healthcare community to manage prostate cancer, demonstrating the capabilities and advantages of implementing a web-based application. During the second chapter we presented a theoretical basis to understand the prostate anatomy, mostly focusing on defining the prostate gland zones where tumours can be originated. Besides, it is explained the acquisition of prostate images using MRI techniques, which follows a DICOM protocol, also explained in this section. In the third chapter several web-based medical applications, designed for medical image purposes, are reviewed and evaluated. Many of them provided some tools to annotate different image zones. We wanted our tool to differ from others so that it allowed a simultaneous analysis of the same region of interest using different MRI techniques (DWI, DCE and T2W1), which increases the diagnosis accuracy. There are different prostate conditions that can mimic cancer, or others that can compromise the visualization of tumours. By carrying out a simultaneous analysis of the same region in each modality, the probabilities of conducting a correct diagnosis increase significantly, as it has been demonstrated in an example shown in the case of study. Besides, the continuous technological evolution creates a need for these apps to be constantly improved. In this context, during the fourth chapter we present the framework of our application, discussing different implementation options and defining the decided system architecture. As we aimed to ease all the process related to prostate cancer diagnosis, we decided to use a web-based system architecture to facilitate the installation procedure and to ensure that every healthcare center could make use of it. The language used to implement this platform was Python, making profit of the Dash library and its components to develop an interactive web-based application. Moreover, we needed to implement a tool that could read and access DICOM information directly, as it is the standard to manage medical images and its information. Regarding the design of the images visor, we had in mind the importance of the previously mentioned interactivity between the different image modalities found in the database, as well as providing some image processing tools to improve this visualization. Concerning the annotation system, it is designed to help experts to manage annotating image findings in an easy and intuitive way. Besides, these annotations can be exported, in a csv format, and imported later in case the radiologists need it.
DICOM Viewer: Interactive viewer of DICOM medical images 45 In chapter five, it is shown how the developed application, DICOM Viewer, looks like and how to use it. Each section of it is described in detail explaining all the provided functionalities; including the table containing the DICOM information, the image visor displaying three different MRI techniques and also presenting the image processing tools, and finally the system to perform annotations and the method to export and import these findings. The application code can be found at the GitHub repository [51], where it can be downloaded and executed using a python interpreter. Moreover, it is also possible to use it through Docker. To access the Docker Hub, you just need to download the Docker app, which is free and fast to download, and open the repository of DICOM Viewer [52]. Hence, there is no need to install any complicated system framework. To sum up, the developed first version of DICOM Viewer accomplishes all the original specific and general objectives. We designed a tool destined to be used by the medical community with the support of medical staff and hospitals for the diagnosis of prostate cancer. However, there are some features that we have thought about during its development that could improve its use, but this first version is efficient and ready to use. This project has personally given me the opportunity to gain a huge amount of knowledge in many aspects. I have learned the hard work behind programming a web app, helping me realize the perseverance programming needs. In order to solve the problems that may come across you must search a lot of information and look at things closely in a different way, rethinking your original ideas and improving them. Moreover, I have improved the previous experience I had working with Python, which is something I am sure it is going to be useful in the future, as this language is widely used for many other finalities related to the medical world. I also value that the developed application is ready to be used by medical experts, and that this work I have carried out can be useful and contribute to many other previous and future work related to medical diagnosis. Related to this, in Annex C it can be found a Draft of the paper that we have presented to the IEEE-EMBS International Conference on Biomedical and Health Informatics BHI), which will take place on the 27th of July.
Report 46 Budget In this Chapter it is presented the detailed budget of this project, broken down by different categories and taking into account the number of hours spent in each different task and the cost per hour of an engineer. Due to the project scope, it was only needed a computer with the necessary software. The computer was not acquired owing to this work, so we do not consider it a part of the developed budget. Moreover, all the software we used did not have any cost, as PyCharm is an open source program. Table 0.1 Break down of the project’s budget
DICOM Viewer: Interactive viewer of DICOM medical images 47 Bibliography [1] Mata, C. (2015). Web-based application for medical imaging management. [PhD Thesis, Universitat de GironaUniversité de Bourgogne]. https://www.tdx.cat/handle/10803/323093#page=9 [2] Sung, H., Ferlay, J., Siegel, R. L., Laversanne, M., Soerjomataram, I., Jemal, A., & Bray, F. (2021). Global Cancer Statistics 2020: GLOBOCAN Estimates of Incidence and Mortality Worldwide for 36 Cancers in 185 Countries. CA: A Cancer Journal for Clinicians, 71(3), 209–249. https://doi.org/10.3322/caac.21660 [3] Key Statistics for Prostate Cancer. (2021). American Cancer Society. https://www.cancer.org/cancer/prostate-cancer/about/key-statistics.html [4] Bhavsar, A., & Verma, S. (2014). Anatomic Imaging of the Prostate. BioMed Research International, 2014, 1–9. https://doi.org/10.1155/2014/728539 [5] Barentsz, J. O., Richenberg, J., Clements, R., Choyke, P., Verma, S., Villeirs, G., Rouviere, O., Logager, V., & Fütterer, J. J. (2012). ESUR prostate MR guidelines 2012. European Radiology, 22(4), 746–757. https://doi.org/10.1007/s00330-011-2377-y [6] Qiao, L., Li, Y., Chen, X., Yang, S., Gao, P., Liu, H., Feng, Z., Nian, Y., & Qiu, M. (2015). Medical highresolution image sharing and electronic whiteboard system: A pure-web-based system for accessing and discussing lossless original images in telemedicine. Computer Methods and Programs in Biomedicine, 121(2), 77–91. https://doi.org/10.1016/j.cmpb.2015.05.010 [7] Wickens, B., Lewis, J., Morris, D. P., Husein, M., Ladak, H. M., & Agrawal, S. K. (2015). Face and content validity of a novel, web-based otoscopy simulator for medical education. Journal of Otolaryngology - Head & Neck Surgery, 44(1), 7. https://doi.org/10.1186/s40463-015-0060-z [8] Shen, H., Ma, D., Zhao, Y., Sun, H., Sun, S., Ye, R., Huang, L., Lang, B., & Sun, Y. (2014). MIAPS: A web-based system for remotely accessing and presenting medical images. Computer Methods and Programs in Biomedicine, 113(1), 266–283. https://doi.org/10.1016/j.cmpb.2013.09.008 [9] Maglogiannis, I., Andrikos, C., Rassias, G., & Tsanakas, P. (2017). A DICOM Based Collaborative Platform for Real-Time Medical Teleconsultation on Medical Images. Advances in Experimental Medicine and Biology, 79–91. https://doi.org/10.1007/978-3-319-57348-9_7
Report 48 [10] Yuan, R., Shi, S., Chen, J., & Cheng, G. (2018). Radiomics in RayPlus: a Web-Based Tool for Texture Analysis in Medical Images. Journal of Digital Imaging, 32(2), 269–275. https://doi.org/10.1007/s10278-018-0128-1 [11] Min, Q., Wang, X., Huang, B., & Xu, L. (2020). Web-Based Technology for Remote Viewing of Radiological Images: App Validation. Journal of Medical Internet Research, 22(9), e16224. https://doi.org/10.2196/16224 [12] Bidgood, W. D., Horii, S. C., Prior, F. W., & Van Syckle, D. E. (1997). Understanding and Using DICOM, the Data Interchange Standard for Biomedical Imaging. Journal of the American Medical Informatics Association, 4(3), 199–212. https://doi.org/10.1136/jamia.1997.0040199 [13] Gibaud, B. (2008). The DICOM Standard: A Brief Overview. Molecular Imaging: Computer Reconstruction and Practice, 229–238. https://doi.org/10.1007/978-1-4020-8752-3_13 [14] DICOM standard. (n. d.). DICOM. https://www.dicomstandard.org/ [15] DICOM. (n. d.). Leadtools. https://www.leadtools.com/help/leadtools/v19/dh/to/di-topicsdicom.html [16] Villeirs, G. M., & De Meerleer, G. O. (2007). Magnetic resonance imaging (MRI) anatomy of the prostate and application of MRI in radiotherapy planning. European Journal of Radiology, 63(3), 361–368. https://doi.org/10.1016/j.ejrad.2007.06.030 [17] Hammerich, K. H., Ayala, G. E., & Wheeler, T. M. (2008). Anatomy of the prostate gland and surgical pathology of prostate cancer. Prostate Cancer, 1–14. https://doi.org/10.1017/cbo9780511551994.003 [18] Pydicom. (n. d.). https://pydicom.github.io/ [19] Dash. (n. d.). PyPI. https://pypi.org/project/dash/ [20] Introducing Dash - Plotly. (2019). Medium. https://medium.com/plotly/introducing-dash5ecf7191b503 [21] Van Rossum, G., & L. Drake, F. (2002). Python Reference Manual Release 2.2.1. http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.406.6230
DICOM Viewer: Interactive viewer of DICOM medical images 55 Annex B In the GitHub repository [51] there are all the files needed to run the application. By clicking on the green button shown in Table A. 1, the folder containing all the files will begin to download in a zip format. In order to run the app you need to have installed a python interpreter and follow the instructions on the README file. Table A. 1. Screenshot of the DICOM Viewer repository on GitHub The database is inside the assets folder, classified by the patient’s identifier and divided in folders for each MRI technique.
Annexos 56 Annex C