File size: 1,284 Bytes
c2d8817 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | """
自定义异常类
"""
class NeuroScanException(Exception):
"""NeuroScan 基础异常"""
def __init__(self, message: str, code: str = "UNKNOWN_ERROR"):
self.message = message
self.code = code
super().__init__(self.message)
class DicomLoadError(NeuroScanException):
"""DICOM 加载错误"""
def __init__(self, message: str):
super().__init__(message, code="DICOM_LOAD_ERROR")
class RegistrationError(NeuroScanException):
"""图像配准错误"""
def __init__(self, message: str):
super().__init__(message, code="REGISTRATION_ERROR")
class SegmentationError(NeuroScanException):
"""分割错误"""
def __init__(self, message: str):
super().__init__(message, code="SEGMENTATION_ERROR")
class AnalysisError(NeuroScanException):
"""分析错误"""
def __init__(self, message: str):
super().__init__(message, code="ANALYSIS_ERROR")
class ModelNotFoundError(NeuroScanException):
"""模型未找到错误"""
def __init__(self, message: str):
super().__init__(message, code="MODEL_NOT_FOUND")
class InvalidInputError(NeuroScanException):
"""无效输入错误"""
def __init__(self, message: str):
super().__init__(message, code="INVALID_INPUT")
|