scieee AI-readable full text Open interactive document viewer

Building an imaging-based research platform for experiments with brain connectivity data

Moreira, Rogério Gomes Lopes

Abstract

Within the past decade, not only societies in general but also medicine and healthcare, in particular, have changed tremendously. In large part because of the rapid dissemination of computers and digital communications which lead to the appearance of new medical disciplines, such as Medical Informatics. Nowadays, one of the most prominent field in Medical Informatics is Medical Imaging, as it is implied, it is a collection of methodologies and techniques used in order to visually and spatially represent parts of the brain for diagnostic and research purposes. In the research ecosystem, Neuroimaging is an increasing popular field, with applications in neurology and psychiatry. However, due to the difficulties to handle Neuroimaging data, since data has its own specificities, researchers have encountered problems to correctly handling this data. This can be a crucial issue specially with large volumes of Neuroimaging data and all the research materials associated. This work aims to architect and build a research platform to correctly archive Medical Imaging data and all the associated research materials, where researchers can exchange imaging data and collaborate in Neuroimaging research projects. The platform offers a correct way to collect and store all imaging data, archiving all of patient exams with the correspondent information, making available the correspondent information to researchers in a confidential, secure and efficient way. The two main outcomes of this work are an architecture of a platform that manages all imaging data and associated research materials, plus an open-source Python package to easily interact with that platform.

Full text

UMinho 2019 Rogério Gomes Lopes Moreira Building an imaging-based research platform for experiments with brain connectivity data November 2019 Rogério Gomes Lopes Moreira Building an imaging-based research platform for experiments with Brain connectivity data Ana Filipa de Oliveria Ramos Deep Learning Applied to Medical Imaging i Rogério Gomes Lopes Moreira Building an imaging-based research platform for experiments with brain connectivity data Master’s Dissertation Integrated Master’s in Informatics Engineering Dissertation oriented by Victor Manuel Rodrigues Alves Nicolás Francisco Lori November 2019 i Acknowledgements I would like to thank my supervisor, Victor Alves for his guidance, availability, sharing and encouragement. His advices and assistant were truly important to me. I would also like to thank Nicolás Lori, my cosupervisor, who taught me so much about neuroimaging. Finally, to my parents, my brother and Jorge for all the support and advice in my decisions. To my course colleagues, Samuel, Gustavo and Diogo who supported me greatly and were always willing to help me. To Luis, my teacher who truly changed the way I saw the world. I’m forever thankful for his insights and mind opening. And finally, to Madalena, for being with me all the time in good and bad and supporting me through my academic journey. Thank you for all your love. ii DECLARATION Name: Rogério Gomes Lopes Moreira Dissertation Title: Building an imaging-based research platform for experiments with brain connectivity data Mentors: Victor Manuel Rodrigues Alves, Nicolás Francisco Lori Conclusion Year: 2019 Master Designation: Mestrado Integrado em Engenharia Informática Master Branch: Informática Médica I declare that I grant to the University of Minho and its agents a non-exclusive license to file and make available through its repository, in the conditions indicated below, my dissertation, as a whole or partially, in digital support. I declare that I authorize the University of Minho to file more than one copy of the dissertation and, without altering its contents, to convert the dissertation to any format or support, for the purpose of preservation and access. Furthermore, I retain all copyrights related to the dissertation and the right to use it in future works. I authorize the partial reproduction of this dissertation for the purpose of investigation by means of a written declaration of the interested person or entity. This is an academic work that can be used by third parties if internationally accepted rules and good practice with regard to copyright and related rights are respected. Thus, the present work can be used under the terms of the license indicated below. In case the user needs permission to be able to make use of the work in conditions not foreseen in the indicated licensing, he should contact the author through the RepositoriUM of the University of Minho. Atribuição-NãoComercial-SemDerivações CC BY-NC-ND https://creativecommons.org/licenses/by-nc-nd/4.0/ Universidade do Minho, ____/____/______ Signature: ___________________________________ iii STATEMENT OF INTEGRITY I hereby declare having conducted this academic work with integrity. I confirm that I have not used plagiarism or any form of undue use of information or falsification of results along the process leading to its elaboration. I further declare that I have fully acknowledged the Code of Ethical Conduct of the University of Minho. Universidade do Minho, ____/____/______ Signature: ________________________________________ iv ABSTRACT Within the past decade, not only societies in general but also medicine and healthcare, in particular, have changed tremendously. In large part because of the rapid dissemination of computers and digital communications which lead to the appearance of new medical disciplines, such as Medical Informatics. Nowadays, one of the most prominent field in Medical Informatics is Medical Imaging, as it is implied, it is a collection of methodologies and techniques used in order to visually and spatially represent parts of the brain for diagnostic and research purposes. In the research ecosystem, Neuroimaging is an increasing popular field, with applications in neurology and psychiatry. However, due to the difficulties to handle Neuroimaging data, since data has its own specificities, researchers have encountered problems to correctly handling this data. This can be a crucial issue specially with large volumes of Neuroimaging data and all the research materials associated. This work aims to architect and build a research platform to correctly archive Medical Imaging data and all the associated research materials, where researchers can exchange imaging data and collaborate in Neuroimaging research projects. The platform offers a correct way to collect and store all imaging data, archiving all of patient exams with the correspondent information, making available the correspondent information to researchers in a confidential, secure and efficient way. The two main outcomes of this work are an architecture of a platform that manages all imaging data and associated research materials, plus an open-source Python package to easily interact with that platform. • Keywords: Data Sharing, Medical Imaging, Neuroinformatics, Neuroimaging, XNAT. xi ABBREVIATIONS AND ACRONYMS A AI Artificial Intelligence API Application Programming Interface B BIRN Biomedical Informatics Research Network C CNDA Central Neuroimaging Data Archive CSV Comma-separated values CT Computed Tomography D DICOM Digital Imaging and Communications in Medicine DBMS Database Management System DL Deep Learning F fMRI Functional magnetic resonance imaging G GUI Graphical User Interface H HDD Hard Disk Drive HTTP Hypertext Transfer Protocol HCP Human Connectome Project J JAAT Joint Anonymization and Archive Transmission L Loni IDA Loni Image Data Archive xii LXC Linux Containers M ML Machine Learning MRI Magnetic Resonance Imaging MR Magnetic Resonance MVCC Multiversion concurrency control N NIfTI Neuroimaging Informatics Technology Initiative NM Nuclear Medicine NIAC Neuroimaging Informatics and Analysis Center NGINX Engine-X NA-MIC National Alliance for Medical Image Computing O OS Operating System P PET Positron-Emission Tomography PITR Point-in-Time-Recovery R REST Representational State Transfer S SFTP Secure File Transfer Protocol SCP Service Class Provider SPECT Single-photon emission computed tomography SQL Structured Query Language SSD Solid-State Drive U UI User Interface UMINHO University of Minho xiii US United Stated V VM Virtual Machine X XDAT eXtensible Data Archive Toolkit XML eXtensible Markup Language XNAT eXtensible Neuroimaging Archive Toolkit XSD XML Schema Definition XTK X-Ray Toolkit Y YAML YAML Ain't Markup Language xiv GLOSSARY Dataset A collection of examples. Each example contains one or more features and a label (if using supervised training). DICOM DICOM (Digital Imaging and Communications in Medicine) is a standard for handling, storing, printing, and transmitting information in Medical Imaging. It includes a file format definition and a network communications protocol. Magnetic Resonance Imaging (MRI) Non-invasive technique used disease detection and treatment monitoring. MRI scanners are particularly well suited to image the soft tissues of the body e.g., brain, spinal cord and nerves, muscles and ligaments. Medical Imaging Informatics A discipline that results from the combination of medical images and biomedical informatics. Serves to enhance the improvement and knowledge of clinical care. On the one hand, Medical Imaging allows the study of a disease state in vivo . On the other hand, biomedical informatics is involved in the development of computer science techniques for creating and managing medical data. Nifty A simple, minimalistic format which has been widely adopted in Neuroimaging research, allowing scientists to mix and match image processing and analysis tools developed by different teams. XNAT An open source imaging informatics software platform designed to facilitate common management and handling of Neuroimaging and associated data. INTRODUCTION 1 INTRODUCTION INTRODUCTION 16 1.1 CONTEXT AND MOTIVATION Medical informatics is a recent medical discipline when comparing with other medical disciplines that have been around for centuries [1]. Within the past decade societies in general, and medicine and healthcare in particular, have tremendously changed, in large because of the rapid dissemination of computers and digital communications [2]. This allowed new medical disciplines to appear, such as Medical Informatics, which is the intersection of computer informatics and healthcare [3]. This new discipline deals with the resources, devices, and methods required to optimize the acquisition, storage, retrieval, and use of information in healthcare systems. One of the most prominent field in Medical Informatics is Medical Imaging, as it is implied, it is a collection of methodologies and techniques used in order to visually and spatially represent parts of the human body for diagnostic and research purposes. This field is so important nowadays that it is hard to imagine a medical diagnostic without the use of imaging tools since they allow doctors to have a clear picture of the problem. In research, Medical Imaging has gained considerable attention due to its widespread utility in a multitude of clinical applications and the considerable improvements in the techniques [4]. One of the most prominent fields in Medical Imaging is the representation/study of the brain, known as Neuroimaging. This field is a set of imaging techniques that either directly or indirectly image the structure or function of the nervous system, which includes the brain [5]. Neuroimaging comprises several different modalities such as Magnetic Resonance Imaging (MRI), Positron Emission Tomography (PET), Computed Tomography (CT) and functional MRI (fMRI) [6]. These techniques have major clinical applications in neurology, serving as a crucial part in diagnosis and, more recently, in psychiatry, with special focus on psychiatric disorders by helping to understand the interactions between the brain and the body. All of these make Neuroimaging an increasing popular field of research, especially in the last 20 years [7]. In conjunction with this, in the last few years has been a growing interest in including Machine Learning (ML) [8] and Deep Learning (DL) [9] in the analysis of Neuroimaging data. Machine Learning addresses the question of how to make computers improve automatically though experience. It is one of most rapidly growing technical fields, joining areas like computer science, statistics and data science [10]. Deep Learning is one of the most recognized ML techniques, which allows computational models composed of multiple layers to learn representations of data with multiple levels of abstraction. These methods have dramatically improved hard computer problems like speech recognition, visual object INTRODUCTION 17 recognition and object detection. Deep Learning discovers a structure in large data sets by using an algorithm to indicate how a machine should change its internal parameters, used to compute the representation in each layer from the representation in the previous layer [11]. A large number of studies show that ML and DL can be used to extract new exciting information from Neuroimaging data [12]. This field of research has revealed itself to be very complex from the beginning as it requires analysis of complex and multivariate data [13]. Data with both these characteristics is precisely what leads to the development of computer techniques such as ML and DL which allow to train classifiers that decode data and extract the relevant information. This would not be possible with the socalled “traditional computing”, since the volumes of information to decode are extremely large [13]. The recent progress in ML has been driven both by the development of new algorithms and by the availability of data. With this, researchers rely more and more upon large datasets that sometimes are not correctly labeled and archived, which can result in unreliable results. This is especially true in Neuroimaging since the data is difficult to handle and is most of the time sliced in multiple files. For all of these reasons, a research platform to correctly store Medical Imaging data plus all the associated research materials is a crucial part of a larger sought ecosystem where researchers can exchange data and collaborate in Neuroimaging research projects. One of these ecosystems was developed through the collaboration between the Algoritmi Research Center and the Life and Health Sciences Research Institute (ICVS), both at University of Minho (UMinho) [14], with the objective to map and search for patterns on the human brain (Fig 1.1). Figure 1.1 – UMinho Neuroimaging project This work has the purpose to architect a platform to archive Neuroimaging data and build a prototype with the planned architecture to be integrated in the current system workflow of the UMinho Neuroimaging project but implemented in such a way that it can easily be transferred to other workflow systems. The developed platform has the objective to facilitate the distribution of Neuroimaging data available in both INTRODUCTION 18 public datasets and acquired locally at the ICVS MRI scanner. With the workflow used before, researchers moved Neuroimaging data and the associated research materials via hard-drives or platforms like Redmine [15], which is not scalable as the dataset sizes increase. The platforms that handle Medical Imaging data and in particular neuroimages have unique characteristics, that make it different from traditional sharing systems. Also, medical research has rigid workflows that can’t be changed easily. Commonly, platforms that try to change these workflows don’t succeed. The system to be built must seamlessly integrate in the actual workflow, with only minor adaptations, but also be integrable in a global Neuroimaging data sharing network (Fig. 1.2). Figure 1.2 – Example of multiple Medical Imaging platforms connected to share research data Over the last years, ICVS and Algoritmi have been collaborating in studies about Neuroimaging and nowadays all the ongoing research involves a large number of disperse researchers, large datasets and different data sources. With this increase in popularity, a new problem was encountered. How to properly store, manage and make available this data and the research materials associated? The methods used until now duplicate the space used and don’t ensure properly data archiving, plus, as research increasingly specializes in a narrower range (Fig. 1.2) of applications it becomes harder and harder to obtain sufficient data if it is dispersed across researchers and projects. INTRODUCTION 19 Figure 1.3 - Comparing scientific quality versus amount of shared data (image from [16]) Taking for example another research ecosystem like the one at UMinho, the Cancer Imaging Archive [17] has more than 25.000 patients/subjects, 73.000 studies and 21 million images which represents more than 11 terabytes of data, all available to researchers. Any researcher can easily select data from the global dataset with the required characteristics and use the data without the need to make a new acquisition. 1.2 OBJECTIVES The main objective of this work is to architecture an imaging-based research platform for the implementation of experiments with Medical Imaging data and associated research materials, with a particular focus on Neuroimaging. Also, as this type of platform involves multiple iterations, a prototype of the work will be available in ICVS and Algoritmi to manage all the Neuroimaging data used there. Furthermore, as researchers need a simple way to programmatically interact with the platform, there is also the development of both APIs and libraries for the interaction with the developed platform. 1.3 DISSERTATION STRUCTURE The two focuses of this work are the XNAT@DI platform and the XNATUM package. The dissertation is structured as follows. Section 2 reviews published systems in the field and discusses the additional INTRODUCTION 20 requirements that have motivated the development of the XNAT@DI project. Section 3 is an overview of the system’s features, technologies and the overall architecture of the platform. Section 4 presents implementation details of the platform. Section 5 presents an overview and the implementation of the XNATUM package, including descriptions of features, performance and testing. Finally, Section 6 presents conclusions and future work. STATE OF THE ART 27 • Work as a federated platform where project owners retain autonomous control over their data and define project-specific procedures, but also allow to have global projects, which can be used by any researcher; • Have the possibility to connect optional gateways servers within each clinical institution; • Includes features like DICOM direct upload, REST API to upload and download data, quality control modules, web-based interface, powerful and sophisticated search, online image viewer and a pipeline engine for automating image processing tasks. PLATFORM DESIGN AND ARCHITECTURE 3 PLATFORM DESIGN AND ARCHITECTURE 29 The system to be conceived, must be a secure data platform that simplifies and automates the process of accessing and sharing research materials for Medical Imaging with general applicability which can be adapted to benefit research projects across a variety of fields at any research facility. The main goal of the research platform is to provide a flexible, clinical and researcher-friendly system for sharing Medical Imaging data and research materials across multiple departments and research centers. The system aims to satisfy the demands of patient confidentiality, data security and to bring the benefits from a web platform to imaging research; with the goal of encouraging more data sharing, both standardizing and simplifying the data transfer and anonymization processes, and the providing of centralized storage and backups which simplify the sharing of researcher-derived results. The platform will achieve all of these aims by building upon existing and well-established technologies, accessible and usable to different types of users, and with an ease-of-use appropriate for those that are more or less familiarized with this kind of data and technology. 3.1 PURPOSED SOLUTION A general system diagram of the platform is shown in Fig.3.1. The platform consists of a central server and optional gateway servers for clinical institutions and research departments. Therefore, the already existing technologies used must be cross-platform compatible, offering complexity with regard to the required hardware and operating system. The service must provide a data upload feature with automated anonymization of patient information and which integrates with software already in use at the research labs like Horos [40] or OsiriX [41]. 30 Figure 3.1 - Platform conceptual architecture 31 3.2 PLATFORM ARCHITECTURE 3.2.1 OVERVIEW In consequence of the necessity for research centers to manage data there are a lot of different data management systems to facilitate collaborative research and data sharing in Neuroimaging such as Lify [42], Capterra [43], Nora [44] and XNAT [45]. The anonymized research and associated research materials will be hosted on a dedicated instance, with this, users can access and download data within the secure website from a web interface access to any browser. The platform (Fig. 3.2) may also provide a set of protocols and services to be accessed programmatically, to allow integration with third-party software and tools, in a form of a Representational State Transfer Application Programming Interface (REST API). Figure 3.2 – Platform conceptual architecture network. 3.2.2 INTEGRATION WITH OTHER INSTANCES AND HOSPITAL SYSTEMS The platform must allow the connection of optional gateways to enable each institution and research department to provide image uploading mechanisms suited to their needs. Each interested institution can provide a gateway from their infrastructure to others. There are two main ways this is done with the 32 current standards: syncing projects between instances, or sharing raw imaging data. The first method establishes a persistent data sync of all or selected data between instances, which allows the researcher to upload the data just once and guarantee that the data is automatically uploaded to the other instances. The second method allows, for example, to move large amounts of DICOM data from hospital facilities and research centers. 3.2.3 DATA SECURITY AND ACCESS CONTROL All the data stored on the platform to be built is anonymized and not identifiable. All data exchange will happen over the Internet in an encrypted connection with the server certificate ensuring clients can only connect to the genuine server. The server firewalls restrict access only to trusted clients and limit the maximum attempts of failed connections, blocking consecutive failed connections. All data access requires a personal account. A user can request a user account to the primary Investigator or to a platform administrator. 3.2.4 WORKFLOW The datasets are either coming from a researcher or directly from a hospital with an MRI machine. There are two main ways data can be uploaded to the platform, via REST API or via the web interface. When uploading data, the most straightforward process is first to upload all project metadata and then the associated subjects and complementary information which can be both made via REST API or via CSV upload on the web interface. Then the anonymized sessions can be uploaded to their correspondent project and subject or to the pre-archive to be analyzed by a project researcher before inclusion in the corresponding project. Researchers retrieve the anonymized data using integrated software or simply by downloading needed data via the web interface. 33 3.3 TECHNOLOGIES AND CONCEPTS In this chapter are described some of the technologies that will be used to build the platform as well as well as a justification in why a particular technology was chosen in favor of others. The general preference was to use already well established open-source technologies existent in the market for many years and which have proven their worth in the research area. 3.3.1 VIRTUALIZATION SOFTWARE The chosen virtualization software was Docker, a program created to isolate processes from the system on which it is running. It was created to isolate an application and the resources required to run that application from the hardware on which it runs. Docker uses pre-built Linux Containers (LXC) which are an operating system level virtualization built-in directly on the Linux kernel, without the overhead of a fullfledged VM. XNAT application depends in a few different and distinct applications which can cause different types of errors. Docker solves this problem via containerization, ensuring compatibility across platforms and, therefore, eliminating "works on my machine" issues in research and software developing. Despite appearances, the most common Docker containers are not VMs. They have a key difference, while VMs don't share the same Linux kernel, in the Docker containers the contrary happens. Docker containers share the same Linux kernel with the hardware they are running, resulting on much less boot time and resource usage than VM’s. This has made Docker particularly attractive to industry and has thus seen a steep rise in adoption of the technology. Docker will be used to containerize the platform on the server as well as simplify and guarantee the consistency of the installation and setup of the system, since some of the used third-party software used is only available for Linux-based systems. Docker was chosen because it satisfies the practical requirements, and the accessibility of Docker Hub enables images to be quickly found and deployed. “Virtual machines like those created in Virtual Box [46] or VMware [47] provide lots of range in terms of operating systems that can be launched and allow native access to the machine through a GUI. However, though these are great features, they are not necessary for the platform.” [48] 34 Figure 3.3 - Docker engine layers (image from [49]) 3.3.1.1 DOCKER MANAGING ENVIRONMENTS The Docker API allows a lack of options for interfacing with Docker, the containers, and images from CLIs to desktop applications and web-based management tools. These tools go from Kitematic [50], the default GUI program that ships with Docker to Shipyard [51], a web-based app that provides an interface for containers. Although, the chosen tool was Portainer [52] a UI management software which allows to manage Docker environments and simply deploy any docker container to run on the Docker engine. All Docker resources, including containers, images, volumes and networks can be managed via Portainer [52]. This solution was chosen since it is web-based, which means that can be accessible in any browser without the need to install other third-party software, is free and open-source. 35 Figure 3.4 - The interface of Portainer, the Docker management tool 3.3.2 DATA REPOSITORY MANAGEMENT SYSTEM The chosen Data Repository Management System was the eXtensible Neuroimaging Archive Toolkit (XNAT) [45], one of the oldest and more stable open-source data repositories available. It is developed by the Neuroinformatics Research Group with the purpose of addressing and facilitating data management challenges in Neuroimaging studies. It consists of an image repository to store raw and post-processed images, a database to store metadata and non-imaging measures and user interface tools for accessing, searching and exploring the data. User interface tools include a secure web application, command line tools and desktop applications for organizing and uploading local data. It supports full DICOM workflow for all common imaging modalities and an extensible system for modeling and storing clinical, behavioral, and other non-imaging data. XNAT has automated tools to capture data from multiple sources and keeps them in a secure repository and distributes the data to authorized users. XNAT relies heavily on XML and XML Schema [53]. XNAT uses XML Schema Definition (XSD) to define data types and to generate custom components, graphical and local content for its Presentation, Application and Data tiers. Also, XML is used for security, input validation and queries. Therefore, XNAT provides an ad hoc workflow for 36 Neuroimaging data acquisition and sanitizing, that consists of automated data acquisition directly in the scanner and/or via upload followed by a strict quality control procedure, where we can include data anonymization. However, XNAT also has some problems like inefficient metadata storage. The XNAT datamodel can be resumed in three main data types: Experiments, Subjects and Projects. Imaging data from the scanners enter the workflow using mechanisms like the Digital Imaging and Communications in Medicine (DICOM), Secure File Transfer Protocol (SFTP), or portable hard media. Non-imaging data such as clinical assessments, subject demographics and genetic measures are passed via web-based forms, csv uploads or XML (eXtensible Markup Language) [54]. XNAT is used by institutions and data sharing projects around the world including the Biomedical Informatics Research Network (BIRN), the National Alliance for Medical Imaging Computing (NA-MIC) and the Informatics for Integrating Biology & the Bedside (I2B2) [55]. Figure 3.5 - XNAT architecture [56] A data model is an abstract model that organizes certain elements and standardizes how they can relate to each other. It explicitly determines the structure of data and for that reason it is sometimes referred to as a data structure. XNAT server is a platform built for imaging research purposes, his functions can BUILDING THE RESEARCH PLATFORM – XNAT@DI 43 Performance The main points related with performance take into account that the two most common actions are data upload and data download. These two actions can have a huge impact on the server since it is necessary a persistent connection. XNAT@DI prioritizes low impact on network over speed and latency. As the server is on eduroam (Education Roaming) network data upload is bandwidth limited. Fault Tolerance To prevent data loss, files physically stored on the server are regularly backed up to secondary disks. If the server connection is not available or data upload fails, uploading is re-attempted multiple times with an exponentially increasing delay [59]. Taking into account all of these discussed topics and what was discussed previously, the server configuration where the platform is hosted has: • OS: Ubuntu 14.04 LTS (64 bit) as the operative system • CPU: Intel Xeon E5-1650 • RAM: 64Gb • Secondary Memory: 2 Disks of 2TB and 1 disk of 512Gb • GPU: NVIDIA P6000 o Cuda Parallel-Processing Colors 3840 o GPU 24 GB GDDR5X o FP32 Performance 12 TFLOPS 4.2 SHARING DATA BETWEEN INSTANCES Sharing data between instances is critical in this kind of platform. It’s very common to have multiple departments to work on multiple projects that can sometimes share data between them. In XNAT there are two main ways to connect two instances: using the XNAT Project Sync plugin or the Joint Anonymization and Archive Transmission (JAAT). The XNAT Project Sync plugin is more suitable to share data between research institutions. This method establishes a persistent data sync of all or selected data between XNAT instances, which allows the data- BUILDING THE RESEARCH PLATFORM – XNAT@DI 44 owning researcher to upload the data just once and guarantees that the data is automatically uploaded to the other instances. The JAAT method was developed to allow the migration of large amounts of DICOM data. This method is highly suitable for large amounts of data. For example, to transfer sessions between the hospital where the MRI machine is and the XNAT server. Figure 4.2 - XNAT JAAT method explained 4.3 CONTAINERIZATION AND PLATFORM DEPLOY As mentioned on the previous chapters all services running on the server are on top of Docker containers. A Docker container is a process/service that runs directly on the server, slightly different than a regular process because the Docker daemon along with the Linux kernel ensures it runs in total isolation, which allows to have multiple services running at the same time on a single computer, without interfering witch BUILDING THE RESEARCH PLATFORM – XNAT@DI 45 each other [59]. There were already multiple containers deployed on the server, all managed with Portainer [52]. XNAT would be only “one more service running”, although to run it with the needed features (specially redundancy and scalability) some changes had to be made. As discussed on the previous chapters it is necessary to run multiple services at the same time, including Tomcat, Postgres, NGINX and, obliviously, the main XNAT container. To do this, we need a way to manage and deploy at the same time all these containers. This can be made with Docker Compose [60], which allows to manage theservice versions, the connections between containers, and even which ports to expose in each container. Compose is a tool built-in directly on the Docker engine to define and run multiple-container environments in a single network. To use the tool, an YAML [61] file with the containers and services specification was created. The YAML file below bootstraps the deployment of three containers: BUILDING THE RESEARCH PLATFORM – XNAT@DI 46 1. version: '1' 2. services: 3. xnat-web: 4. build: 5. context: ./xnat 6. args: 7. XNAT_VER: '1.7.4.1' 8. SMTP_ENABLED: 'false' 9. SMTP_HOSTNAME: fake.fake 10. SMTP_PORT: 11. AMTP_AUTH: 12. SMTP_USERNAME: 13. SMTP_PASSWORD: 14. XNAT_DATASOURCE_DRIVER: 'org.postgresql.Driver' 15. XNAT_DATASOURCE_URL: 'jdbc:postgresql://xnat-db/xnat' 16. XNAT_DATASOURCE_USERNAME: 'xnat' 17. XNAT_DATASOURCE_PASSWORD: 'xnat' 18. XNAT_HIBERNATE_DIALECT: 'org.hibernate.dialect.PostgreSQL9Dialect' 19. TOMCAT_XNAT_FOLDER: XNAT@DI 20. XNAT_ROOT: /data/xnat 21. XNAT_HOME: /data/xnat/home 22. ports: 23. - "8081:8080" 24. - "8000:8000" 25. - "8104:8104" 26. expose: 27. - "8080" 28. - "8104" 29. volumes: 30. - ./xnat-data/home/logs:/data/xnat/home/logs 31. - ./xnat-data/home/plugins:/data/xnat/home/plugins 32. - ./xnat-data/archive:/data/xnat/archive 33. - ./xnat-data/cache:/data/xnat/cache 34. - ./xnat-data/prearchive:/data/xnat/prearchive 35. - ./xnat-data/ftp:/data/xnat/ftp 36. - ./xnat-data/build:/data/xnat/build 37. - ./xnat-data/pipeline:/data/xnat/pipeline 38. - /var/run/docker.sock:/var/run/docker.sock 39. depends_on: 40. - xnat-db 41. environment: 42. - CATALINA_OPTS=-Xms128m -Xmx1024m -Dxnat.home=/data/xnat/home - agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 43. - XNAT_HOME=/data/xnat/home 44. 45. xnat-db: 46. build: ./postgres 47. expose: 48. - "5432" 49. volumes: 50. - ./postgres-data:/var/lib/postgresql/data 51. 52. xnat-nginx: 53. build: ./nginx 54. ports: 55. - "80:80" 56. expose: 57. - "80" 58. links: 59. - xnat-web Program 4.1 - Docker Compose configuration file BUILDING THE RESEARCH PLATFORM – XNAT@DI 47 Tomcat + XNAT This container uses Tomcat and XNAT web application. Tomcat is an open source implementation of the Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket technologies [62] and is used as proxy to the XNAT container. The deployment of these applications also includes setting system resources and setting the service user and permissions so that the Tomcat process can read and write from the XNAT archive and working folders. As mentioned before, the server has a main disk, which is a Solid-State Disk, and additional Hard Disk Drives (HDD). Taking in consideration that: 1. SSDs are much faster on read and write operations but HDDs are cheaper; 2. The application files are accessed much more than the Medical Imaging files. All the operative systems (OS) and Docker containers run on top of the SSD, but files are stored in the HDDs disks. This ensures that the platform is fast, and the storage is cheap to maintain. To do this some symbolic links from inside the container to the HDD were created: This ensures that the XNAT container writes all data on the secondary disks, but all the necessary folders remain in the container. The HDD disks containing the folders are backed up to other HDD disks attached to the server. Also, as discussed on the previous chapters, it was necessary to create a DICOM SCP 1. - ./xnat-data/home/logs:/data/xnat/home/logs 2. - ./xnat-data/home/plugins:/data/xnat/home/plugins 3. - ./xnat-data/archive:/data/xnat/archive 4. - ./xnat-data/cache:/data/xnat/cache 5. - ./xnat-data/prearchive:/data/xnat/prearchive 6. - ./xnat-data/ftp:/data/xnat/ftp 7. - ./xnat-data/build:/data/xnat/build 8. - ./xnat-data/pipeline:/data/xnat/pipeline 9. - /var/run/docker.sock:/var/run/docker.sock Program 4.2 - The symbolic links created 1. ports: 2. - "8081:8080" 3. - "8000:8000" 4. - "8104:8104" 5. expose: 6. - "8080" 7. - "8104" Program 4.4 - The exposed ports Program 4.3 - The exposed ports on the XNAT container BUILDING THE RESEARCH PLATFORM – XNAT@DI 48 receiver [63]. For this, it was necessary to expose a new port in which the receiver will get all the Medical Imaging data. PostgreSQL PostgreSQL [57] is an open-source object-relational database system that extends the SQL language combining features to safely store and scale data. PostgreSQL has earned a strong reputation for its architecture, reliability, data integrity, robust feature set, extensibility and the consistently innovative solutions. Some of the highlights are custom data types, data integrity, scalability, concurrency, performance, security and extensibility. XNAT uses the PostgreSQL database to store all of its persistent data that's not stored in files on the local storage device like subject information or user accounts. NGINX NGINX is a web server that uses a non-threaded, event-driven architecture. It also does other important things, like load balancing, HTTP caching or reverse proxying. A NGINX proxy configuration requires a server block which configures connections, and a location block, which points to the specific Tomcat instance wanted for the web to connect to. The following configuration sets up a listener on port 80 (http). This is then associated with the Tomcat running on port 8080. Finally, when starting to run the multi-container environment with docker-compose up , several directories are created to save the persistent data: • postgres-data - contains the XNAT database; • xnat-data/archive - contains the XNAT archive; • xnat-data/build - contains the XNAT build space; • xnat-data/home/logs - contains the XNAT logs; • xnat-data/home/plugins - Initially contains nothing. Serves to customize XNAT with plugins. 1. ports: 2. - "80:80" 3. expose: 4. - "80" Program 4.5 - The exposed ports on the Nginx container BUILDING THE RESEARCH PLATFORM – XNAT@DI 49 4.4 XNAT CONFIGURATIONS After building and installing the XNAT multi-container environment some customizations had to be made directly on the administration XNAT web interface. These changes include: • Add the DICOM Store Service Provider – Register a new DICOM Store Service Provider to XNAT configurations on the previous exposed port (8104). • Change the Session Idle Check Interval to check every 10 minutes - This controls how often the system checks to see if there are incoming DICOM sessions in the pre-archive. This value is specified in milliseconds. • Enable Site-wide Anonymization script – An auto anonymization script was added based on what is in use at Washington University School of Medicine and Howard Hughes Medical Institute. BUILDING THE RESEARCH PLATFORM – XNAT@DI 50 4.5 XNAT PLUGINS AND PIPELINES XNAT platform has the ability to use third-parties services to add custom functionalities or modules. This is done either through pipelines which can be automatically set to run when, for example, new data is uploaded or through plugins which add extra functionalities (generally user-invoked). Building the plugins and pipelines requires running a gradlew [64] script inside the Docker container in which all the compiled classes and static content is built into a single output file located in the build/libs folder. After building the plugin or pipeline, deploying it can be done in three steps: 1. Stop Tomcat container; 2. Copy JAR file and build to plugins folder in XNAT files system; 3. Start Tomcat container again. Some of the installed plugins and pipelines are: • Clinical Data Types [65] - A collection of additional typical clinical data types; • IQ Assessment [66] – A new IQ datatype; • Radiological Assessment [66] – A new Radiological datatype, which includes edit and report pages; • mricron [67] - DICOM and PARREC flavored pipelines for auto imaging data conversion to NIFTI format; • Quality Assessment Protocol [68] - QA analysis on functional/structural MRI data; • mricrogl [69] - New generation of DICOM-to-NIFTI format conversion pipeline (using dcm2niix); • DTI-preprocessing [70] - Compute preprocessing corrections on MRI DTI scans; • MRI bias field correction [71] - Correcting intensity non-uniformity (i.e. bias fields); • MRI anatomical defacer [72] - Automated facial traits removal (defacing) of anatomical scan data; • Image Viewer [73]– Neuroimage viewing module built with XTK [74] and Google Closure [75] (Fig. 4.3). BUILDING THE RESEARCH PLATFORM – XNAT@DI 51 Figure 4.3 - Image Viewer built-in the XNAT@DI platform 4.6 ORGANIZING AND UPLOADING EXISTING DATA One of the pre-defined requirements was that existent data must be uploaded to the platform. As research and data collecting had already been occurring for many years at ICVS and Algoritmi, there was the need to find a way to correctly make this data available through XNAT@DI. The way researchers typically share data before the here-described platform was available involved having an CSV file with subject information like age, gender and then organize the scans in folders with the correspondent subject ID. Thus, from this we concluded that to upload this data to XNAT@DI, the workflow would have to have two steps: 1. Upload subject data to the platform from the CSV file; 2. Upload and labeling all the sessions scans and images. However, some of this CSV files are custom to each project since they have custom variables oftentimes related with the research field of the project and not included on the XNAT generic types. Hence, for each project, a custom variable set with specific data types was created. To include new variables, an XML file has to be modified with the specific project configuration. BUILDING THE RESEARCH PLATFORM – XNAT@DI 52 After this, the CSV could be uploaded though the platform built-in uploader. After creating the subjects, all the session scans need to be uploaded to the specific subject. This was done through a Python script that maps all the CSV content and uploads the corresponding images with the correct label that identifies the scan. 1. <FieldMapping data-type="xnat:subjectData" createdate="Tue Jan 05 03:35:32 PDT 2019" title="BrainConnect" ID="1294343251432"> 2. <field>xnat:subjectData/ID</field> 3. <field>xnat:subjectData/fatherAge</field> 4. <field>xnat:subjectData/motherAge</field> 5. </FieldMapping> Program 4.6 - New fields added to the XML project subjects configuration file 1. with open('data.csv', 'r') as _filehandler: 2. csv_file_reader = csv.DictReader(_filehandler) 3. for row in csv_file_reader: 4. subject = row['Codigo_SW'] 5. print subject 6. experiment = subject + "_CORRELATION" 7. scan = "1" 8. filepath = "/AllData/" + \ 9. subject + \ 10. "_fnc_vol_stime_mcf_bet_mni_coreg_denoised_wScrubbing.nii.gz" 11. file = project.subject(subject).experiment(experiment).scan( 12. scan).resource("CORRELATION").file(os.path.basename(filepath)) 13. print file 14. if not(file.exists()) and os.path.isfile(filepath): 15. file.put(filepath, format=" ", content=" ", tags=" ") 16. project.subject(subject).experiment( 17. experiment).scan(scan).attrs.set("type", "CORRELATION") Program 4.7 - Python script to upload all sessions to XNAT@DI XNATUM – A PYTHON API FOR XNAT 59 Figure 5.5 - XNAT REST model For example, with the REST API it is possible to look for all female subjects that are 23 years of age within a project or have a specific answer to an assessment. Using a merge of the XNATPy package, which implies a lot of knowledge in Python and APIs to use, with the Python request module, XNATUM is able to retrieve all the assessments from a subject in a single statement whereas the REST API from XNAT would require multiple HTTP calls. XNATUM uses Python classes to create an initial server configuration, which persists to be used in multiple server operations. The connection holds the login information, the server information and a session. It will also send a ping every 14 minutes to keep the connection alive, even if no operation is being executed. XNATUM also allows self-closing sessions that can also be used using the Python context operator, to remove the possibility of unforeseen errors. As soon as the session doesn’t exist anymore, for example because an error/exception was thrown away, the session is automatically disconnected. 1. import xnatum 2. 3. session = xnat.connect('http://mivbox.di.uminho.pt/XNAT@DI/', user='xnatum', pass word='secret') Program 5.1 - Example of creating a connection to a XNAT instance XNATUM – A PYTHON API FOR XNAT 60 When a session is established and maintained within the scope, it is fairly easy to explore the data on the XNAT server. The data structure of XNAT is mimicked as Python objects. The connection gives access to a listing of all projects, subjects, and experiments on the server. All levels on the XNAT server: projects, subjects, experiments, scans, resources, files can be browsed. Although, there are situations on which there is the need for looping over data. To do this, XNATListing objects can be used as Python dictionaries. If there is the need to download data, this can be done using a helper function to either download it to a target directory or to the current directory. This will create a data structure similar to that of XNAT on the local disk. To add new data into the XNAT server, it is possible using the XNAT REST import service with an HTTP POST request. It allows the upload of a zip file containing new experiments and XNAT will automatically store it in the correct place. Although, it is dangerous to add data straight into the archive due to the lack 1. import xnatum 2. 3. with xnat.connect('http://my.xnat.server') as session: 4. print(session.projects) Program 5.2 - Creating a connection to a XNAT instance using the Python context operator 1. project = self.session.projects[lproject] 2. 3. for subject in project.subjects.values(): 4. for experiment in subject.experiments.values(): 5. allexperiments.append(experiment) 6. return allexperiments 1. try: 2. self.__prearc_session = self.session.services.import_( 3. zipfname, 4. overwrite="append", 5. project=project, 6. subject=subject, 7. experiment=subject + "_" + session, 8. destination=destination, 9. trigger_pipelines=False, 10. ) 11. except: 12. print("Unexpected error during XNAT import:") 13. print(sys.exc_info()) Program 5.4 - XNATUM session upload function Program 5.3 - Getting all experiments of a XNAT project XNATUM – A PYTHON API FOR XNAT 61 of reviewing. So, the suggested workflow for the XNAT@DI platform is to use the destination argument as ‘prearchive’ in the function to send sessions to the server. This will make the sessions being uploaded to the project, but also makes the pre-archive be reviewed by the primary researcher before being available to research purposes. 5.3 USE-CASE EXAMPLES XNATUM is a powerful yet easy to use Python package. As the initial goal was to create a new package in which researchers could rely one, even those not familiar with Python programming. For this reason, some working examples were created to serve as the entry point to use the package. Download project sessions This example uses the download_project_sessions function to download all images within a project to the directory where the Python script is being executed. Download project sessions to directory This example uses the download_project_sessions_to_directory function to download all images within a project to the dirpath argument folder. If the folder does not exist XNATUM creates the folder. Download subject sessions This example uses the download_subject_sessions function to download all images within a project from a specific subject to the directory where the Python script is being executed. 1. xnat = Xnat(args.server, args.username, args.password) 2. xnat_sessions = xnat.download_project_sessions(args.project) Program 5.5 - Download project sessions through XNATUM 1. xnat = Xnat(args.server, args.username, args.password) 2. xnat_sessions = xnat.download_project_sessions_to_directory(args.project, dirpath ) Program 5.6 - Download project sessions to directory through XNATUM XNATUM – A PYTHON API FOR XNAT 62 Download subject sessions to directory This example uses the download_subject_sessions_to_directory function to download all images within a project from a specific subject to the dirpath argument folder. If the folder does not exist XNATUM creates the folder. Download specific subject session to directory This example uses the download_single_subject_session_to_directory function to download all images within a project to the dirpath argument folder. If the folder does not exist XNATUM creates the folder. Get list of subjects This example uses the get_list_subjects function to list of subject that exist on a project. Get project sessions 1. xnat = Xnat(args.server, args.username, args.password) 2. xnat_sessions = xnat.download_subject_sessions(args.project, args.subject) Program 5.7 - Download subject sessions through XNATUM 1. xnat = Xnat(args.server, args.username, args.password) 2. xnat_sessions = xnat.download_subject_sessions_to_directory(args.project, args.su bject, dirpath) Program 5.8 - Download subject sessions to directory through XNATUM 1. xnat = Xnat(args.server, args.username, args.password) 2. xnat_sessions = xnat.download_single_subject_session_to_directory(args.project, a rgs.subject, args.session', dirpath) Program 5.9 - Download specific subject session to directory through XNATUM 1. xnat = Xnat(args.server, args.username, args.password) 2. print(xnat.get_list_subjects(args.project)) Program 5.10 - List all project subjects through XNATUM XNATUM – A PYTHON API FOR XNAT 63 This example uses the get_project_sessions function to list all sessions labels within a project, identifying the correspondent subject. Get subject info This example uses the get_subject_info function to get all subject metadata within a project. All the examples described here, and more are available in the XNATUM GitHub repository 3 . Upload session This example uses the import_resource function to upload a session to a project from a subject. It starts to create the session item structure, sorts it by the format and then upload de resources files to the XNAT server. 3 XNATUM examples folder on the GitHub repository - https://github.com/rgllm/xnatum/tree/master/examples 1. xnat = Xnat(args.server, args.username, args.password) 2. xnat_sessions = xnat.get_project_sessions(args.project) Program 5.11 - Get project sessions labels through XNATUM 1. xnat = Xnat(args.server, args.username, args.password) 2. print(xnat.get_subject_info(args.project, args.subject)) Program 5.12 - Get all information from a subject within a project through XNATUM 1. # Creating connection and load experiment object 2. xnat = Xnat(args.server, args.username, args.password) 3. item = xnat.session.projects[args.project].subjects[args.subject].experiments[0] 4. 5. # Sending file 6. files = sorted( glob.glob( '{}/sessions/{}_*.*'.format( args.input, args.subject ) ) ) 7. xnat.import_resource(item, 'FILE', files) 8. print('File imported.') Program 5.13 - Upload a sessiont a subject through XNATUM XNATUM – A PYTHON API FOR XNAT 64 5.4 USING A VIRTUAL RAM DRIVE Talking specifically about the workflow at Algoritmi and ICVS, XNAT@DI platform has a unique workflow and setup. Researchers work and develop scripts in Jupyter notebooks hosted on the same server in which XNAT is running, the only difference is that they are running on different containers. This allows true collaboration between all researchers and the XNAT@DI. The goal here is to allow to not replicate Medical Imaging data across different Jupyter notebooks and containers but to host medical images in XNAT and use those images directly in all Jupyter notebooks. The first attempt to do this relied on the fact that XNAT REST API exposes an API which includes the entire DICOM file, the Medical Imaging raw format, with various DICOM data elements. A DICOM data element, or attribute, is composed of the following parts [63] : • a tag that identifies the attribute, usually in the format (XXXX, XXXX) with hexadecimal numbers, and may be divided further into DICOM Group Number and DICOM Element Number; • a DICOM Value Representation (VR) that describes the data type and format of the attribute value. For example, the tag (0018,8151) corresponds to the X-Ray Tube Current in µA and the tag (0010,0010) corresponds to the Patient’s Name. There is also a tag for the specific scan image. The Nifty file format, a file format used after the medical image is processed (can be compared to JPEG) and works in the same way as DICOM; with different tags and attributes as all images are anonymized and combined by default. Taking this into account, the plan was to read and use all the images from the DICOM and Nifty files by selecting the correspondent tag field from the XNAT REST API. As explained before, the API creates a JSON endpoint for each session inside a "project and subject" file and these endpoints contain all DICOM tags and attributes. However, XNAT truncates the attributes from the DICOM dump available on the API to under 64 characters. So, it’s only possible to read the first 64 characters of the “Pixel Data” attribute and not the complete images. Thus, the next approach was to use RAM Drive which is a block of random-access memory that software can use as if the memory were a disk drive. Python has an API to generate temporary files and directories that uses this OS built-in functionality. The module creates temporary files and directories and provides automatic cleanup which can be used as context managers. However, as this is a specific approach for our platform and XNATUM is a global package that can be used in any XNAT installation, this is not XNATUM – A PYTHON API FOR XNAT 65 included in the core functionality. Therefore, this is added as a working example on the XNATUM repository making use of the functionality previously described to download images by indicating the destination folder. The example uses the “tempfile.mkdtemp” [85] Python functionality that creates temporary directory in the most secure manner possible with no race conditions in the directory creation. The directory is readable, writable, searchable only by the creating user ID and is available as long as the user wants it to be during the program execution. This Python functionality, when executed, returns the temporary directory path and therefore the unique thing to do on XNATUM is to indicate this path to the correspondent function so as to download the sessions by project, subject or session label. When the program is executed, all the sessions are downloaded directly from XNATUM to the temporary directory and can be used after that in the research script. 5.5 DISCUSSION Historically, Neuroimaging researchers have used ad hoc procedures for maintaining their analysis and data. Over the last few years, there have been several attempts to build systems that manage Neuroimaging data. Moreover, the ability to programmatically access Neuroimaging data is becoming increasingly important to perform batch analysis and administration tasks, as these databases increase in size. Apart from this, one of the most widely used Neuroimaging management systems is XNAT, which includes many useful and powerful features including, as discussed before, a REST API. XNATUM provides a bridge between the XNAT instance used by the researcher to archive their data and the analysis tool. Combined with Python, it can be used as an alternative both to the XNAT web frontend and to a vast set of Python tools available in the neuroscience domain. The package focuses on ease of use, combining RESTful services and XNATPy with clear semantics and helper features. Since one of the main focus of the neuroscience research at UMinho is using Machine Learning (ML) and Deep Learning (DL) in the neuroscience/medicine imaging research field, XNATUM combines a series of features to help researchers focuses in the research, abstracting from the data to use. For example, there is a feature on XNATUM to simply obtain and download all sessions within a XNAT project and automatically label each session as train data or test data. The version 1.0 of XNATUM for Python is available publicly since March 28 of 2019 and it is currently mainly used by researchers that use the XNAT@DI platform. As any software in their early steps, there are a couple of things that can be improved and added to the package. These improvements and new XNATUM – A PYTHON API FOR XNAT 66 features are discussed in the next chapter. The primary goal in creating this package was for researchers to have a simple way to manage data in the XNAT@DI platform, and that was accomplished since there are already researchers testing it and/or using it in their experiments. The images bellow list some of the stats from the Pypi repository. XNATUM – A PYTHON API FOR XNAT 67 Figure 5.6 - Daily downloads since the package is available at Pypi Figure 5.7 - Daily downloads proportion between different versions of Python Figure 5.8 - Daily downloads between different versions of Python XNATUM – A PYTHON API FOR XNAT 68 Figure 5.9 - Daily downloads proportion between different versions of Python Figure 5.10 - Daily downloads between different system Figure 5.11 - Daily downloads proportion between different system REFERENCES lxxv [26] W. J. Bug, G. A. Ascoli, J. S. Grethe, A. Gupta, C. Fennema-Notestine, A. R. Laird, S. D. Larson, D. Rubin, G. M. Shepherd, J. A. Turner, and M. E. Martone, “The NIFSTD and BIRNLex vocabularies: Building comprehensive ontologies for neuroscience,” Neuroinformatics , vol. 6, no. 3, pp. 175–194, Sep. 2008. [27] W. Raghupathi Viju Raghupathi, An Overview of Health Analytics , vol. 04. 2013. [28] W. Raghupathi and V. Raghupathi, “Big data analytics in healthcare: promise and potential,” Heal. Inf. Sci. Syst. , vol. 2, no. 1, pp. 1–10, 2014. [29] S. T. C. Wong, D. Tjandra, H. Wang, and W. Shen, “Workflow-enabled distributed componentbased information architecture for digital medical imaging enterprises,” IEEE Trans. Inf. Technol. Biomed. , vol. 7, no. 3, pp. 171–183, 2003. [30] E. Society, “The new EU General Data Protection Regulation: what the radiologist should know,” Insights Imaging , vol. 8, no. 3, pp. 295–299, 2017. [31] R. A. Poldrack, “NIH Public Access The future of fMRI in Cognitive Neuroscience,” vol. 62, no. 2, pp. 1216–1220, 2014. [32] A. Moser, K. Range, and D. M. York, “NIH Public Access,” Bone , vol. 23, no. 1, pp. 1–7, 2008. [33] National Institutes of Health (NIH), “NIH Launches the Human Connectome Project to Unravel the Brain’s Connections,” 2009. [Online]. Available: https://www.nih.gov/news-events/newsreleases/nih-launches-human-connectome-project-unravel-brains-connections. [Accessed: 01- Jan-2019]. [34] L. Geddes, “Human brain mapped in unprecedented detail,” Nature , Jul. 2016. [35] D. S. Marcus, K. A. Archie, T. R. Olsen, and M. Ramaratnam, “The open-source neuroimaging research enterprise,” J. Digit. Imaging , vol. 20, no. SUPPL. 1, pp. 130–138, 2007. [36] J. Gurneya, T. Olsenb, J. Flavina, M. Ramaratnamc, K. Archied, J. Ransforde, R. Herricka, L. Wallacea, J. Clinea, W. Hortona, and D. S. Marcusa, “The Washington University Central Neuroimaging Data Archive,” HHS Public Access , vol. 91, no. 2, pp. 165–171, 2015. [37] K. Alpert, A. Kogan, T. Parrish, D. Marcus, and L. Wang, “The Northwestern University Neuroimaging Data Archive (NUNDA),” Neuroimage , vol. 124, pp. 1131–1136, 2016. [38] T. Doel, D. I. Shakir, R. Pratt, M. Aertsen, J. Moggridge, E. Bellon, A. L. David, J. Deprest, T. Vercauteren, and S. Ourselin, “GIFT-Cloud: A data sharing and collaboration platform for medical imaging research.,” Comput. Methods Programs Biomed. , vol. 139, pp. 181–190, Feb. 2017. [39] D. T. Fetzer and O. C. West, “The HIPAA Privacy Rule and Protected Health Information. Implications in Research Involving DICOM Image Databases,” Acad. Radiol. , vol. 15, no. 3, pp. REFERENCES lxxvi 390–395, Mar. 2008. [40] Horos, “Horos Project 2015,” 2015. [Online]. Available: https://horosproject.org/. [Accessed: 29-May-2019]. [41] “OsiriX DICOM Viewer | The world famous medical imaging viewer,” OsiriX , 2019. [Online]. Available: https://www.osirix-viewer.com/. [Accessed: 31-May-2019]. [42] “Medical imaging software: Platform for modern radiology.” [43] “Best Medical Imaging Software | 2019 Reviews of the Most Popular Tools & Systems.” [Online]. Available: https://www.capterra.com/medical-imaging-software/. [Accessed: 13-Jul- 2019]. [44] “Nora Medical Imaging Platform.” 2017. [45] “XNAT.” [Online]. Available: https://www.xnat.org/. [Accessed: 24-May-2019]. [46] Oracle, “Oracle VM VirtualBox,” pp. 1–362, 2012. [47] VMware, “VMware,” 2019. [Online]. Available: https://www.vmware.com/. [Accessed: 27-Jul- 2019]. [48] G. Kiar, K. J. Gorgolewski, D. Kleissas, W. G. Roncal, B. Litt, B. Wandell, R. A. Poldrack, M. Wiener, R. J. Vogelstein, R. Burns, and J. T. Vogelstein, “Science in the cloud (SIC): A use case in MRI connectomics,” Gigascience , vol. 6, no. 5, pp. 1–10, May 2017. [49] Docker Inc., “What is a Container?: A standardized unit of software,” Docker.Com , 2019. [Online]. Available: https://www.docker.com/resources/what-container. [Accessed: 30-Jun-2019]. [50] “Kitematic | Docker Documentation.” [Online]. Available: https://docs.docker.com/kitematic/. [Accessed: 02-Jul-2019]. [51] “shipyard project.” [Online]. Available: http://shipyard-project.com/. [Accessed: 02-Jul-2019]. [52] Portainer, “Portainer Management, Docker User Interface, Container Software - Auckland, Singapore, San Francisco | Emerging Technology Partners,” 2019. [Online]. Available: https://www.portainer.io/. [Accessed: 31-May-2019]. [53] M. Böhnlein and A. U. Vom Ende, “XML - Extensible Markup Language,” Wirtschaftsinformatik , vol. 41, no. 3, pp. 274–276, 1999. [54] F. Falahati, E. Westman, and A. Simmons, “Multivariate data analysis and machine learning in Alzheimer’s disease with a focus on structural magnetic resonance imaging,” J. Alzheimer’s Dis. , vol. 41, no. 3, pp. 685–708, 2014. [55] Y. Huo, J. Blaber, S. M. Damon, B. D. Boyd, S. Bao, P. Parvathaneni, C. B. Noguera, S. Chaganti, V. Nath, J. M. Greer, I. Lyu, W. R. French, A. T. Newton, B. P. Rogers, and B. A. Landman, REFERENCES lxxvii “Towards Portable Large-Scale Image Processing with High-Performance Computing,” J. Digit. Imaging , vol. 31, no. 3, pp. 304–314, 2018. [56] D. Marcus, “XNAT Clinical Analytics Platform ( XCAP ): An Informatics Platform for Machine Learning Applications in Clinical Research.” [57] “PostgreSQL: The world’s most advanced open source database,” 2013. [Online]. Available: https://www.postgresql.org/. [Accessed: 01-Jun-2019]. [58] B. Shaik, “Simple PostgreSQL Blog: PostgreSQL Architecture,” 2013. [Online]. Available: http://bajis-postgres.blogspot.com/2013/10/postgresql-architecture.html. [Accessed: 30-Jun- 2019]. [59] T. Bui, “Analysis of Docker Security,” 2015. [60] Docker Inc., “Overview of Docker Compose,” docs.docker.com , pp. 1–6, 2015. [61] C. Evans, “The Official {YAML} Web Site,” {YAML:} {YAML} Ain’t Markup Language , 2011. [Online]. Available: http://yaml.org/. [Accessed: 06-Jun-2019]. [62] The Apache Software Foundation, “Apache Tomcat,” 2011. [Online]. Available: http://tomcat.apache.org/. [Accessed: 06-Jun-2019]. [63] Mildenberger Peter, M. Eichelberg, and E. Martin, “Introduction to the DICOM standard,” p. 8, 2001. [64] “The Gradle Wrapper,” 2018. [Online]. Available: https://docs.gradle.org/current/userguide/gradle_wrapper.html. [Accessed: 06-Jun-2019]. [65] “Clinical Data Types - XNAT MarketplaceXNAT Marketplace.” [Online]. Available: https://marketplace.xnat.org/plugin/clinical-data-types/. [Accessed: 06-Jun-2019]. [66] “IQ Assessment - XNAT MarketplaceXNAT Marketplace.” [Online]. Available: https://marketplace.xnat.org/plugin/radiological-assessment/. [Accessed: 06-Jun-2019]. [67] “mricron XNAT Pipeline.” [Online]. Available: https://github.com/jhuguetn/xnatpipelines/tree/master/mricron. [68] “QAP.” [Online]. Available: https://github.com/jhuguetn/xnatpipelines/blob/master/QAP/README.md. [69] “mricrogl.” [Online]. Available: https://github.com/jhuguetn/xnatpipelines/tree/master/mricrogl. [70] “DTI-preprocessing.” [Online]. Available: https://github.com/jhuguetn/xnatpipelines/tree/master/dti_preprocessing. [71] “MRI bias field correction.” [Online]. Available: https://github.com/jhuguetn/xnat- REFERENCES lxxviii pipelines/tree/master/bias_correction. [72] “MRI anatomical defacer.” [Online]. Available: https://github.com/jhuguetn/xnatpipelines/tree/master/mri_anat_deface. [73] “xnatdev / xnat-image-viewer-plugin.” [Online]. Available: https://bitbucket.org/xnatdev/xnatimage-viewer-plugin/src/master/. [Accessed: 07-Jun-2019]. [74] “XTK.” [Online]. Available: https://github.com/xtk/X#readme. [75] Google, “Closure Tools - Google Developers,” 2013. [Online]. Available: https://developers.google.com/closure/. [Accessed: 07-Jun-2019]. [76] NRG Lab, “Who Uses XNAT?” [Online]. Available: https://www.xnat.org/about/xnatimplementations.php. [Accessed: 11-Jun-2019]. [77] S. D. Larson and M. E. Martone, “Ontologies for neuroscience: What are they and what are they good for?,” Front. Neurosci. , vol. 3, no. MAY, pp. 60–67, 2009. [78] E. Muller, J. A. Bednar, M. Diesmann, M. Gewaltig, M. Hines, and A. P. Davison, Python in Neuroscience . 2015. [79] SciPy developers, “SciPy.org — SciPy.org,” 2019. [Online]. Available: https://www.scipy.org/. [Accessed: 12-Jun-2019]. [80] A. J. Nathan and A. Scobell, “How China sees America,” Foreign Affairs , vol. 91, no. 5. p. All, 2012. [81] “PEP 249 -- Python Database API Specification v2.0 | Python.org.” [Online]. Available: https://www.python.org/dev/peps/pep-0249/. [Accessed: 12-Jun-2019]. [82] R. T. Fielding, “Architectural Styles and the Design of Network-based Software Architectures,” University of California, 2000. [83] “Pypi XNAT search.” [Online]. Available: https://pypi.org/search/?q=xnat. [84] MathWorks, “MATLAB - MathWorks - MATLAB & Simulink,” Matlab , 2019. [Online]. Available: https://www.mathworks.com/products/matlab.html. [Accessed: 13-Jun-2019]. [85] Python.org, “tempfile: Generate temporary files and directories,” 2019. [Online]. Available: https://docs.python.org/2/library/tempfile.html. [Accessed: 02-Jul-2019]. APPENDICES APPENDICES APPENDICES lxxx A - XNAT USER GUIDE A.1 INTRODUCTION XNAT@DI is an instance of the popular Neuroimaging archive system XNAT (xnat.org) and archives all imaging data acquired at the ICVS and Hospital of Braga and used in the Department of Informatics. This guide covers the most commonly performed operations with the XNAT@DI web portal. For more detailed information on how to use the portal please visit the XNAT wiki, or if you can't find the answer for your question, please email a XNAT administrator. Figure A.1 - UMinho XNAT platform A.2 SITE ACCESS Registration All UMinho staff and students can register to use XNAT@DI. For this, they need to email Prof. Victor Alves at [email protected] asking for an account in the platform. Staff and students may use their institutional email. After this it is necessary to be granted access to a project. Non-UMinho users should also email Prof. Victor Alves with their preferred username and contact details, including the contact APPENDICES lxxxi details of an investigator for the project(s) they wish to be granted access to in the comments sections. XNAT@DI administrations will enable the account after confirming with the relevant project investigator(s). Login To access to the portal, access the address the platform address or copy/paste this address into a web browser address bar. Next insert your login details in the login box. If any problem occurs, try to delete your cookies. If the problem persists, please contact Prof. Victor Alves. Login information is displayed in the top right-hand corner of all pages on the site above the general search bar. To logout simply click the “logout” link. Login sessions will expire after 15 mins of inactivity, with the remaining time displayed next to the username of the logged-in user. If you wish to renew your session click the “renew” link also in the top right-hand side of the screen, and the 15 min counter will start again. Project Membership Access to imaging data is controlled via project membership. Members are added to a project by administrators and/or project investigator. To ask the administrators to add a new member to a project, the investigator must email [email protected] with the name and email address of the person to be added and the project name that the access is to be given to. If you are a project owner, you can use the "Access" tab of the project page. Access is granted by on the Access tab of the project page, new members are added by selecting the available users from the list. Members can be removed from a project by a project owner or MBI administrators by clicking the “Remove” button next to their names. A.3 NAVIGATION XNAT@DI ID Conventions All projects acquired and make available at XNAT@DI must contain a name. Generally, this name is the projects name. APPENDICES lxxxii Home Screen The home screen provides several convenient methods to navigate the imaging data that is accessible to the user. A list of recently accessed projects by the user will appear in the bottom left corner of the screen and a list of recently uploaded scanning sessions on the right. Clicking on these entries will navigate the user to the corresponding project/session. To narrow down the list of projects, subjects or sessions, search criteria can be entered into the search box in the middle of the page. To return to the home screen from any page, select the XNAT logo in the top left corner. Command Ribbon The command ribbon is accessible from all pages within the site. Clicking on the “Browse” opens a hierarchical menu that provides links to all projects, subjects and imaging sessions that are accessible to the user. A.4 DATA ACCESS It is the researcher's responsibility to verify the quality of the imaging data uploaded to XNAT. Generally, the data uploaded to the XNAT instance goes to the "Pre-archive". The research must review and archive the data himself, giving a project to it. Snapshots and DICOM Headers After an imaging session is uploaded to XNAT, image snapshots are generated for recognized image types and can be displayed along with other basic meta-data by toggling the +/- button next to the scan name on the session page. Detailed metadata can be accessed from the DICOM headers via the link “View DICOM Headers”. Image Viewer XNATUM provides a convenient built-in viewer for visual inspection of imaging data, which can be accessed by the “view images” link on the “Actions” menu on the session page. APPENDICES lxxxiii A.5 MANAGE SESSIONS DATA WITH HOROS To manage sessions through Horos or other DICOM medical image viewer you just to have to add XNAT as a new image location on the correspondent DICOM port. Figure A..2 - HOROS XNAT location configuration APPENDICES lxxxiv B – XNAT DATA MODEL A data model is an abstract model that organizes certain elements and standardizes how they can relate to each other. It explicitly determines the structure of the data and for that reason it is sometimes referred to as a data structure. XNAT server is a platform built for imaging research purposes. Its functions can archive, import, process and securely distribute the data. The core data-model used in XNAT previews the use of the XNAT server in various projects. There are three core data-types in XNAT data model: Projects, Subjects and Experiments. These three data-types relate with each other. Projects A project is used to define a collection of a certain data stored in the server. The project is used to define a secure structure of data. Users can have certain permissions for data within a certain project. They can be Owners, Members or Collaborators. This permission defines who can read, save or delete data. For example, in a specific research study we can give permission for the principal researcher to save, read and delete data but for an internal researcher only to read the data. Subjects A subject is anyone who participates in a study. Imaging studies has traditionally focused on human studies, however, the subject could be non-human. It exists in a context of a project and it's "owned" by the project where it was created on. Also, subjects can be shared with other projects to capture longitudinal data from various studies. Experiments An experiment is an event by which imaging data or non-imaging data is acquired. It cannot exist outside the context of a project and can be shared into other projects.