Skip to content

Quick overview🧠

xai4mri logo

The package can be loaded with:

import xai4mri as xai

Loader for MRI datasets🧠

Functions to effectively load MRI data for model training and evaluation are in the dataloader submodule.

Build your own dataset class. For this, inherit from the BaseDataSet class:

from xai4mri.dataloader import BaseDataSet

See Loading data for more information.

Deep learning models for MRI prediction🧠

Deep learning models are implemented in Keras. This is required for the model analyzer to work, which is based on the iNNvestigate package.

Models provided by xai4mri can be trained from scratch or loaded with pretrained weights.

Among others, the package offers models based on Hofmann et al. (2022, NeuroImage), i.e., 3D-CNNs (MRInet) that are trained to predict age from various MRI modalities (T1w, FLAIR, SWI).

For instance, get the MRInet model with:

from xai4mri.model.mrinets import MRInet

See Model training for more information.

Transfer pretrained models to new MRI datasets and prediction tasks🧠

When using pretrained models, transfer learning can be applied. Find the relevant methods in

from xai4mri.model.transfer import *

Under construction

However, note that functions for transfer learning are not fully implemented yet.

See Model transfer for more information.

Model interpretation🧠

Code for model interpretation using explainable A.I. (XAI) methods can be found in the interpreter submodule.

To analyze the predictions of a model, import the following:

from xai4mri.model.interpreter import analyze_model

This is built on top of the XAI package iNNvestigate. The provided methods should work also with CNN architectures other than those offered by xai4mri, given that the models are implemented in Keras.

brain

See Model interpretation for more information.

Examples & tutorials🧠

For examples and tutorials, see the Examples page.

Citation🧠

When using xai4mri, please cite the following papers: [toolbox paper in prep] and Hofmann et al. (2022, NeuroImage).