{'fraction_non_alphanumeric': 0.027890216210879653, 'fraction_numerical': 0.006417217889228947, 'mean_word_length': 4.921952645425314, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Medical imaging data structure extended to multiple modalities and anatomical regions

Brain Imaging Data Structure (BIDS) allows the user to organise brain imaging data into a clear and easy standard directory structure. BIDS is widely supported by the scientific community and is considered a powerful standard for management. The original BIDS is limited to images or data related to the brain. Medical Imaging Data Structure (MIDS) was therefore conceived with the objective of extending this methodology to other anatomical regions and other types of imaging systems in these areas.


Introduction
Methods which yield reliable and reproducible results must be used when acquiring scientific knowledge. High test-retest reliability of the applied methods is the foundation of research, irrespective of the scientific discipline. It is in the prime interest of every scientict to obtain reproducible results. While such reproducibility was considered of utmost importance in the positron emitting tomography (PET) field [1], the quantitative assessment of reproducibility has largely been neglected in the fMRI community, or as Bennett and Miller described it: "Reliability is not a typical topic of conversation" between functional magnetic resonance imaging (fMRI) investigators [2]. This situation changed significantly in 2016 following the establishment of the Committee on Best Practices in Data Analysis and Sharing [3] by the leading neuroimaging society -the Organisation for Human Brain Mapping (OHBM).
The basis of the Valencia Medical Imaging Bank [4] is the clinical environment data curation proposal, by which imaging data can be collected correctly and efficiently. Finding a way to organise this information is crucial. A proper organization and curation of the images is essential to train deep learning methods [5] that can perform object detection and segmentation using reliable medical data. Metadata can also be included in multimodal classifiers to complement imaging data in order to improve the accuracy of the detection.
Images and medical information can be stored in different ways, although there is no standard that indicates how this information should be organised and shared. The Health Ministry's Centre of Excellence and Innovation for Image Technology recommends using a simple system so that any researcher can understand the data distribution [6].
The proposed structure is called MIDS (Medical Imaging Data Structure) and aims to be a new standard that contains all types of medical information and images in simple hierarchical folders. It was conceived as an extension of the standard Brain Imaging Data Structure [7,8], which stores brain images. MIDS takes this system further and is not confined to brain images only. The idea is to create the same structure for images of different body parts by magnetic resonance, computed tomography, ecography, etc, following a single process, regardless of the type and shape of the image.

Brain Imaging Data Structure
Many studies focus on obtaining a medical imaging dataset for their own purposes, so that the management and control of the associated images and metadata can be roughly an effort. During projects, more data are generated and it may be necessary to relocate it inside a dataset. Each study has its own manner of organising the data, which makes it more difficult to understand, while a curated and well structured dataset can improve the search user experience and the quality of automatic classifiers.
There are a couple of studies which propose a standard to store this type of data, including BIDS, which aims a standard form of storing magnetic resonance imaging data and metadata in a clear and simple hierarchical folder structure. It is supported by several programs and libraries dedicated to the study of medical images (e.g. c-pacs, freesurfer, XNAT, BIDS Validator, among others) and is widely used by research groups. Figure 1 gives an example of the BIDS structure; the left directory is a folder with DICOM (Digital Imaging and Communication On Medicine) images [9] and the right directory is its corresponding BIDS structure.

Medical Imaging Data Structure
As BIDS only supports brain MRIs, if a project needs, for example, a lumbar MRI, BIDS would not support the images. However, by expanding its structure, other imaging techniques can be integrated in it, which is how MIDS was created. BIDS is thus a potential standard to store MRIs and there is in practice little difference between BIDS and MIDS. Furthermore, in epidemiological studies based on Population Image, MIDS can incorporate any type of [10] medical image (e.g. Computed Radiography, Computed Tomography, Ultrasound, Mammography, etc). MIDS can thus be seen as an extension of BIDS with a similar structural format [11].

General template for other anatomical regions
MIDS adds a new level to the BIDS directory hierarchy which describes the types of medical images used for a particular session. As can be seen in Figure 2, the structure is compatible with BIDS.
The added level is to define the type of medical imaging and can be classified by the energy used for their acquisition, together with the functional or tomographic adjectives for their generation. The classification is shown in Table 1.

File tags in MIDS
This template includes a new level to describe other types of medical image than MRI. The researcher decides whether or not to use particular filename keys, depending on the type of medical image. For example, the contrast enhancement (ce-<label>) filename key can be used for CT but will not be necessary for Bone Densitometry (X-ray).
The image types supported by MIDS, their relationship DICOM and their corresponding label can be seen in Table 2. The keys can be described as follows: • acq-<label>: denotes the set of acquisition parameters used (defined in BIDS -optional).
• run-<index>: denotes repetition of identical acquisition with identical scanning parameters (defined in BIDSoptional).
• vp-<viewPosition_label>: which describes the section, view, planes, direction or projection in the acquisition (defined in MIDS -optional). Possible labels: -Planes: sag = Sagittal plane, cor = Coronal plane, ax = Axial plane. • [mod-]<modality_dicom / techniques_label / modality_label>: Type of equipment that acquired the original data used to create the images in this Series. DICOM tag (0008,0060) [10]. The key mod is used when the type is not the end of the file name. (defined in BIDS and extended in MIDS -required).
• Extension file: In BIDS, the extension of image files are NIfTi format with an optional compression of the data (.nii[.gz]). NIfTi is the optimal format for 3D neuroimaging data, yet MIDS has types of 2D image data and is not optimal for NIfTi format. This means that 2D images must be saved in Portable Network Graphics (PNG) format [14], which is the best choice because it is a graphical format based on a lossless compression algorithm for non-patent bitmaps (defined in BIDS and extension in MIDS -required)

MRI modality label
This label refers to anatomical data acquired for a participant. When working with brain imaging, the modalities correspond to the intrinsic values of the resonance machines or sequences currently supported by BIDS (Table 2).  Inplane T1  inplaneT1  T1-weighted anatomical image matched to functional acquisition  Inplane T2 inplaneT2 T2-weighted anatomical image matched to functional acquisition Angiography angio

sequences and MIDS modalities
MR data can be acquired with different extrinsic parameter values, such as echo time, flip angle, inversion time during the same scan. When we have a population clinical image set, we can find many types of sequences that depend on the manufacturers of the machine used, called extrinsic values of the machine. These sequences can be fundamental since they can produce changes in the resulting image to highlight some tissues in the resonances or improve the quality or speed with which the image is obtained. This is an important feature to be considered when training artificial intelligence methods.
In some cases, these sequences are widely used depending on the area to be observed and the problem to be addressed. We will consider these widely used sequences as modalities. Table 3 gives some examples. Table 3: Widely used sequences considered as MIDS modalities.

Short-TI Inversion Recovery stir
It is typically used to nullify the signal from fat. Fat suppression is generally uniform and relatively independent of magnetic field inhomogeneities.
HASTE/SS-FSE haste SSFSE or HASTE sequence is one of the ultrafast sequences that enables us to acquire the whole MRI data (k-space) in a single radiofrequency (RF) excitation or single shot. Used for patients for myelography and routine liver protocol.

Magnetisation transfer T1mt, T2mt
Magnetisation transfer imaging (MTI) applies RF energy exclusively to the bound pool using specially designed MT pulse(s). The relative difference in signal between two adjacent tissues (A and B) is known as the magnetisation transfer contrast (MTC).
Dynamic Contrast Enhanced DCE T1-weighted images following contrast agent injection.

Chemical Exchange Saturation Transfer CEST
Sensitive images to specific molecules following selective saturation of mobile protons in chemical exchange with water.
Perfusion pwi Comparatively, this establishes the amount of blood received by a certain area of the brain.
Since a dataset must have all the information organised and this information must be relevant for further research, the type of sequence must be indicated. We recommend using the acq tag to indicate twhich sequence has been used to acquire the image. It should also be indicated in the tabular file of the scan information stipulated in BIDS. See examples in Table 4.    Table 5 shows the different modalities of medical images classified by the energy used in the acquisition, together with the DICOM Modes that belong to the mentioned categories.

Tabular files of meta-information
BIDS has different levels of information organised in tabular files. These are highlighted in Figure 3 and explained below together with the improvements incorporated in MIDS.

Participant description table
This file describes the participants' properties, such as age, handedness or sex, among others. In single-session studies, this file has one compulsory column, participant_id, which consists of sub-<participant_label>, followed by a list of optional columns describing the participants with only one row for each participant. This optional file is implemented in BIDS. Table 6 shows some columns of the participants.tsv description table.

Session description table
This file is optional as it provides the information referring to all the patient's sessions, such as age at the session, procedures, or diagnoses made. The name of this file, if it is required, is "sub-<participant_label>_sessions.tsv". This file was not described in BIDS, indeed, it is a new contribution of MIDS. Some columns of the session's description table can be seen in Table 7.

Scan description table
This optional file is implemented in BIDS. All data relative to the scan should be entered in this    ... ...

Derived dataset
Derivatives of the raw data must be kept separate from the raw data, may be under a derivatives/ subfolder in the root of the MIDS-Raw dataset folder. To represent these derived data, the Extension Proposal BEP003 [18] is used.
Each pipeline has a dedicated directory under which it stores all of its outputs. There is no restriction on the directory name; however, it is recommended to use the format <pipeline>-<variant> in cases where it is anticipated that the same pipeline will output more than one variant (e.g., preprocessing-registration, segmentationautomatic, segmentation-manual, etc.). MIDS-Derivatives filenames must follow all MIDS-Raw file naming conventions. This inheritance principle (i.e., MIDS-Derivative inherits all BIDS-Raw rules) applies to all aspects of the spec Every derivatives directory must include a dataset_description.json file at the root level.

<dataset>/derivatives/<pipeline_name>/dataset_description.json
This template includes the generic keys that describe the derivative data. It is the researchers' decision to determine whether or not particular filename keys are used. The following is a breakdown of the generic template: • desc-<label>: The desc keyword is a general purpose field with freeform values. To distinguish between multiple different versions of processing for the same input data the desc keyword should be used (e.g., _desc-manual, _desc-UNET, etc.).
• label-<label>: the label key can be used to specify a class label when the file belongs to a particular category or represent a single tissue class (e.g., _label-muscle, _label-sacrum, etc.).

Software & data
All software for building and running the BIMCV also reading metadata of its datasets is open source and available at Github [19]. Besides, the custom scripts used to combine metadata into a MIDS files structure are available in this Github.
XNAT2MIDS is a software written in Python 3 and can be found at the public Github repository listed above. This software allows the users of an XNAT platform to connect to their assigned projects and download the projects of interest in MIDS format. Figure 4 shows the execution flow in which a XNAT session is generated. It can store all the requested projects and, once saved in a temporary directory, the program generates the general MIDS structure and its tabular metadata. It was decided to make the download based on requests with the Rest API of the web platform for the connection with XNAT. This application ensures that the projects downloaded are saved to the disk without transmission errors. Large projects, contrary to standard web methods, will be interrupted during the download. The download software is made up of classes that are responsible for transmitting information to the lower level until each image is downloaded. The structure of XNAT code can be seen in Figure 5.
In a future project, we are going to use Machine Learning techniques to improve the auto-tagging of the MIDS structure, for example, by tagging the MRI type or the acquired anatomical part using exclusively DICOM features such as the acquisition parameters or image features through computer vision methods.
We also intend to include other software, such as the MIDS validator, enabling it to accept MIDS structure as an extension. All the datasets described in this proposal are available in Github.
This directory structure was applied to the data in the medical image bank of the Valencian community in the BIMCV COVID19 + project [20]. This project is a large dataset of the Medical Imaging Databank in BIMCV with chest X-ray images CXR (CR, DX) and computed tomography (CT) imaging of SARS-CoV-2 (COVID 19). The dataset can be downloaded from http://bimcv.cipf.es/bimcv-projects/bimcv-COVID-19 in the MIDS structure.

Discussion
MIDS is proposed as an extension of BIDS to include datasets with medical images of different body parts obtained by different methods. It adds a new element, the Session description table, to the BIDS structure, in which relevant information on the session is stored. Due to the high diversity of use cases that fit in the MIDS standard, MIDS accepts the BIDS key-value indexes if they are needed in image types or body parts that differ from those accepted by BIDS. This will be expanded in the future by including use cases supervised by experts to define these indexes.
The organisation by type of physical principle for each image makes the structure better categorised and therefore more intuitive for the user. Another advantage of separating by energy is the possibility of categorising all the possible methods of obtaining an image, which gives it the flexibility to catalogue images from new devices.
The specialisation of the type of image enhanced from its sequence is essential when training artificial intelligence models. For example, a T2w image in Spin Echo sequence is not the same as in Gradient Echo sequence since it causes the intensity to change for the same tissues at the pixel intensity level, so it would be wrong to classify them as the same type of image.
In the current MIDS version, only the ICD codification is used to describe the diagnosis and procedures performed in/at the session. In future versions we hope to expand this to other codifications such as the Unified Medical Language System (UMLS), specifically SNOMED-CT, so that researchers could use the standard that best fits their needs or allow the definition of different codifications in the same file to enrich the information displayed.
This type of standard provides a common structure for many projects, which can be helpful in artificial intelligence projects where these images can be used to train models that absorb the necessary knowledge to solve any problems that may arise. When it comes to obtain results, it can also be applied to automatically know where to place them in this structure.
BIDS/MIDS is part of a collaboration with the DeepHealth EU project in the guidance and construction of a fully anonymised population medical imaging data lake structure (according to the guidelines "Opinion 05/2014 on Anonymisation Techniques" and CEN/ISO standards). This data lake structure will allow the community to massively store imaging data in a native format to which MIDS will contribute with an improvement in the data curation process. This will provide a clear and simple structure both for the users and the software using these data.
Acknowledgement This work is first and foremost an open and free contribution from the authors in the working group with support from the Regional Ministry of Innovation, Universities, Science and Digital Society grant awarded through decree 51/2020 by the Valencian Innovation Agency (Spain) and Regional Ministry of Health in Valencia Region. This research is also supported by the University of Alicante's UACOVID-19-18 project.
This project was funded by a grant from the Generalitat Valenciana (Covid_19-SCI). Part of the infrastructure used has been cofunded by the European Union through the Operational Program of the European Fund of Regional Development (FEDER) of the Valencian Community 2014-2020. The Medical Image Bank of the Valencian Community (BIMCV) was partially funded by the European Union's Horizon 2020 Framework Programme under grant agreement 688945 (Euro-BioImaging PrepPhase II).
This article describes work undertaken in the context of the DeepHealth project, "Deep-Learning and HPC to Boost Biomedical Applications for Health" (https://deephealth-project.eu/) which has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreement No 825111". The contents of this publication reflect only the author's view, can in no way be taken to reflect the views of the European Union and the Community is not liable for any use that may be made of the information contained therein. ETHICS APPROVAL Finally, we also thank the entire BIDS team for providing us with the necessary tools to give visibility to this proposal and Robert Oostenveld, Gustav Nilsonne, Stefan Appelhoff and Thomas Nichols for their contributions to improve the proposal.
Ethics approval The study was approved by the local institutional ethics committee DGSP-CSISP NÚM.

20190503/12. AVAILABILITY OF DATA.
Rights and permissions Which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.