41 lines
841 B
Python
41 lines
841 B
Python
from typing import Optional, NamedTuple
|
|
import torch
|
|
import numpy as np
|
|
|
|
|
|
class Prediction(NamedTuple):
|
|
overall_probability: float
|
|
is_pathology: bool
|
|
report: str
|
|
conclusion: str
|
|
image: np.ndarray | str
|
|
properties: dict
|
|
|
|
|
|
class PredictorInput(NamedTuple):
|
|
study_uid: str
|
|
image: torch.Tensor
|
|
laterality: Optional[str]
|
|
px_width: Optional[float]
|
|
px_height: Optional[float]
|
|
|
|
|
|
class MetaTags(NamedTuple):
|
|
study_iuid: str
|
|
series_iuid: str
|
|
patient_id: Optional[str]
|
|
accession_number: Optional[str]
|
|
issuer_of_patient_id: Optional[str]
|
|
filler_number: Optional[str]
|
|
|
|
|
|
class TagError(Exception):
|
|
def __init__(self, msg):
|
|
self.msg = msg
|
|
super().__init__()
|
|
|
|
|
|
class ImagesError(Exception):
|
|
def __init__(self, msg):
|
|
self.msg = msg
|
|
super().__init__() |