The Brain Imaging Statistics (BIS) toolset: C++ libraries and programs for handling brain MRI data

Poster No:

1916 

Submission Type:

Abstract Submission 

Authors:

Alle Meije Wink1

Institutions:

1Amsterdam University Medical Centre, Amsterdam, Noord-Holland

First Author:

Alle Meije Wink  
Amsterdam University Medical Centre
Amsterdam, Noord-Holland

Introduction:

Brain image analyses rely on programs to convert, process and analyse the scans stored in DICOM and NIfTI files. Most open-source software packages for these tasks are programmed in either Python or Matlab. Even though these languages often rely on C++ for efficient routines in computation, there is little software that exposes the handling of image data in C++.
We present the brain imaging statistics software (BIS) tools, which are built around the Computer Analysis of Brain Imag Statistics (CAnaBIS) library, and include ComBIS, a command-line image processing tool and will include BISkits, a graphical brain image processing tool. The source code of the software is [available at https://github.com/amwink/bis].

Methods:

The CAnaBIS library is built around two main features: (i) File I/O and (ii) a flexible data type for scientific analyses. File I/O is handled by wrapping basic routines of the standard DICOM library, DCMTK [1] and the standard NIfTI library, nifticlib [2] into functions that provide an interface to the main CAnaBIS data type. This is the bisimage class template, which supports (a) voxels of multiple data types, (b) variable dimensionality and (c) mathematical operation, e.g. addition and division. More and higher functions are being added, such as watershed and max-tree transformations for segmentation.

For file I/O, there is full NIfTI support and increasing DICOM support. We use the following class hierarchy: bisdicomimage :: bisbidsimage :: bidsniftiimage :: bisimage. The BIDS standard [3], which consists of a directory and file naming convention and a data format where NIfTI images are accompanied by a JSON 'sidecar', is supported by reading and writing the NIfTI/JSON pairs. DICOM images can be read and written as BIDS files (see fig. 1A), the JSON being filled with acquisition-specific information from the DICOM header.

The bisimage data type is the parent of the other image types. It is a class template whose pixel data are stored in a 1-dimensional array, with multi-dimensional addressing defined by a sizes array (describing the dimensions), a strides array (describing the offsets for stepping through each dimension) and an addressing operator accepting an initializer_list argument. This can be an array literal, e.g. {2,3,4}, an array variable, e.g. int [pos[3], or a std::vector of a numerical type (see Fig. 1B).

Many images require operations on 2-, 3- and 4-dimensional vectors, and CAnaBIS supports a number of these in the vecN template class (with explicit support for N of 2, 3 and 4). Operations include addition, subtraction, multiplication and division. Vectors operations include inner and cross products, matrix operations include the Hadamard product and eigenvector and -value computation for symmetric matrices (see fig1C).
Supporting Image: Screenshot_20231201_085158.png
   ·Figure 1: code exmples of the use of the CAnaBIS library
 

Results:

Code example A creates a DICOM image, given the name of a single file. This is usually a 2D slice that is part of a 3D or 4D data set, so the directory where the file is found is scanned for other DICOM files with the same UID. These are sorted by position and converted to a 2D, 3D or 4D image, with an accompanying NIfTI header and JSON record, which are both saved in the write() function.

Example B creates a (2x3x4x5)-pixel image with integer values, and imports its values from a 120-value interger array that is filled with the values 0-119. Element (0,1,2,3), which would be row 0 of column 1 in slice 2 of volume 3, is the value at array offset 0*1+1*2+4*(2*3)+5*(2*3*4), so coefficient 86, which also has value 86. The sum over dimension 3 (with size 5) is a new bisimage object of dimensions (2,3,4), see fig. 2A

Example C shows the 4x4 matrix, its inverse and its eigenvectors and -values (see fig 2B).
Supporting Image: Screenshot_20231201_161408.png
   ·Figure 2: Screen output format of vectors and matrices
 

Conclusions:

We introduce the CAnaBIS library, a C++ library with easy DICOM, BIDS and NIfTI file access and numerical data structures whose behaviour resembles that of MatLab and NumPy matrices. More functionality will be added to the ComBIS and BISkits programs and the code is available on GitHub.

Modeling and Analysis Methods:

Methods Development 1
Other Methods

Neuroinformatics and Data Sharing:

Workflows 2
Informatics Other

Keywords:

Computing
Data analysis
Data Organization
Informatics
Open-Source Code
Open-Source Software
Workflows

1|2Indicates the priority used for review

Provide references using author date format

[1] Eichelberg, M. (2004), "Ten years of medical imaging standardization and prototypical implementation: the DICOM standard and the OFFIS DICOM toolkit (DCMTK)", Proc SPIE vol. 5, DOI 10.1117/12.534853, https://github.com/DCMTK/dcmtk
[2] Cox, R.W. (2004), "A (sort of) new image data format standard: NiFTI-1", Proc. OHBM vol. 10, https://nifti.nimh.nih.gov/pub/dist/src/niftilib
[3] Gorgolewski K.J. (2016), "The brain imaging data structure, a format for organizing and describing outputs of neuroimaging experiments", Sci Data 3:160044, doi: 10.1038/sdata.2016.44, https://bids.neuroimaging.io