rsatoolbox.io.optional module

Just-in-time importing of optional dependencies

These can be installed with rsatoolbox using the square brackets syntax; ` pip install rsatoolbox[imaging] `

exception rsatoolbox.io.optional.OptionalImportMissingException(name: str)[source]

Bases: Exception

rsatoolbox.io.optional.import_nibabel(mock=None)[source]

Try to access the nibabel module or raise an exception.

Nibabel is an open source python library for reading and writing MRI files. Used by the BIDS functionality.

Parameters:
  • mock (Mock, optional) – When testing, a Mock object

  • None. (can be injected here. Defaults to)

Raises:
Returns:

nibabel main module

Return type:

nibabel

rsatoolbox.io.optional.import_nitools(mock=None)[source]

Try to access the neuroimagingtools module or raise an exception.

Neuroimagingtools is an open source python library for efficient access to Nifti, Gifti and Cifti files. Used by the SpmGlm class.

Parameters:
  • mock (Mock, optional) – When testing, a Mock object

  • None. (can be injected here. Defaults to)

Raises:
Returns:

neuroimagingtools main module

Return type:

nitools