dicube.exceptions
exceptions
Exceptions module for DiCube.
This module defines the exception hierarchy used throughout the DiCube library. All exceptions inherit from the base DicomCubeError class to allow for easy catching of all DiCube-related exceptions.
Classes
| Name | Description |
|---|---|
| CodecError | Raised when an error occurs in the encoding/decoding process. |
| DataConsistencyError | Raised when data arrays have consistency issues. |
| DicomCubeError | Base exception class for all DicomCube-related errors. |
| InvalidCubeFileError | Raised when a file is not a valid DicomCube file. |
| MetaDataError | Raised when metadata is missing or inconsistent. |
CodecError
exceptions.CodecError(message, context=None, suggestion=None, details=None)Raised when an error occurs in the encoding/decoding process.
This exception is raised when there are problems with image compression or decompression, such as JPEG 2000 processing failures.
DataConsistencyError
exceptions.DataConsistencyError(
message,
context=None,
suggestion=None,
details=None,
)Raised when data arrays have consistency issues.
This exception is raised when image data arrays have mismatched shapes, incompatible types, or other consistency-related issues.
DicomCubeError
exceptions.DicomCubeError(message, context=None, suggestion=None, details=None)Base exception class for all DicomCube-related errors.
All other exceptions in the DiCube library inherit from this class, allowing applications to catch all DiCube-related exceptions with:
try:
# DiCube operations
except DicomCubeError:
# Handle any DiCube errorThis enhanced base class supports contextual error information and helpful suggestions for resolving common issues.
InvalidCubeFileError
exceptions.InvalidCubeFileError(
message,
context=None,
suggestion=None,
details=None,
)Raised when a file is not a valid DicomCube file.
This exception is raised when attempting to load a file that is not in the expected DicomCube format. This could be due to incorrect magic number, version mismatch, or a corrupted file structure.
MetaDataError
exceptions.MetaDataError(message, context=None, suggestion=None, details=None)Raised when metadata is missing or inconsistent.
This exception is raised when critical metadata (DicomMeta, Space, etc.) is missing, corrupted, or inconsistent in a DicomCube file or operation.