Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the user guide for the big picture.

nilearn.exceptions.DimensionError

class nilearn.exceptions.DimensionError(file_dimension, required_dimension)[source]

Custom error type for dimension checking.

This error is used in recursive calls in check_niimg to keep track of the dimensionality of the data. Its final goal it to generate a user friendly message.

Parameters:
file_dimensioninteger

Indicates the dimensionality of the bottom-level nifti file.

required_dimensioninteger

The dimension the nifti file should have.

__init__(file_dimension, required_dimension)[source]
args
increment_stack_counter()[source]

Increments the counter of recursive calls.

Called when the error is caught and re-raised to count the number of recursive calls, ie the number of dimensions added by imbrication in lists.

property message

Format error message.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.