code
stringlengths
17
6.64M
def mean_merge_fn(planes: list): return np.stack(planes).mean(axis=0)
class AssembleInteractionFn(): ' Function interface enabling interaction with the `index_expression` and the `data` before it gets added to the\n assembled `prediction` in :class:`.SubjectAssembler`.\n\n\n .. automethod:: __call__\n ' def __call__(self, key, data, index_expr, **kwargs): '\n\...
class ApplyTransformInteractionFn(AssembleInteractionFn): def __init__(self, transform: tfm.Transform) -> None: self.transform = transform def __call__(self, key, data, index_expr, **kwargs): temp = tfm.raise_error_if_entry_not_extracted tfm.raise_error_entry_not_extracted = False ...
class PlaneSubjectAssembler(Assembler): def __init__(self, datasource: extr.PymiaDatasource, merge_fn=mean_merge_fn, zero_fn=numpy_zeros): "Assembles predictions of one or multiple subjects where predictions are made in all three planes.\n\n This class assembles the prediction from all planes (axi...
class Subject2dAssembler(Assembler): def __init__(self, datasource: extr.PymiaDatasource) -> None: 'Assembles predictions of two-dimensional images.\n\n Two-dimensional images do not specifically require assembling. For pipeline compatibility reasons this class provides\n , nevertheless, a ...
class RandomCrop(tfm.Transform): def __init__(self, shape: typing.Union[(int, tuple)], axis: typing.Union[(int, tuple)]=None, p: float=1.0, entries=(defs.KEY_IMAGES, defs.KEY_LABELS)): "Randomly crops the sample to the specified shape.\n\n The sample shape must be bigger than the crop shape.\n\n ...
class RandomElasticDeformation(tfm.Transform): def __init__(self, num_control_points: int=4, deformation_sigma: float=5.0, interpolators: tuple=(sitk.sitkBSpline, sitk.sitkNearestNeighbor), spatial_rank: int=2, fill_value: float=0.0, p: float=0.5, entries=(defs.KEY_IMAGES, defs.KEY_LABELS)): "Randomly tr...
class RandomMirror(tfm.Transform): def __init__(self, axis: int=(- 2), p: float=1.0, entries=(defs.KEY_IMAGES, defs.KEY_LABELS)): "Randomly mirrors the sample along a given axis.\n\n Args:\n p (float): The probability of the mirroring to be applied.\n axis (int): The axis to ...
class RandomRotation90(tfm.Transform): def __init__(self, axes: typing.Tuple[int]=((- 3), (- 2)), p: float=1.0, entries=(defs.KEY_IMAGES, defs.KEY_LABELS)): "Randomly rotates the sample 90, 180, or 270 degrees in the plane specified by axes.\n\n Raises:\n UserWarning: If the plane to ro...
class RandomShift(tfm.Transform): def __init__(self, shift: typing.Union[(int, tuple)], axis: typing.Union[(int, tuple)]=None, p: float=1.0, entries=(defs.KEY_IMAGES, defs.KEY_LABELS)): "Randomly shifts the sample along axes by a value from the interval [-p * size(axis), +p * size(axis)],\n where ...
class PytorchDatasetAdapter(torch_data.Dataset): def __init__(self, datasource: extr.PymiaDatasource) -> None: 'A wrapper class for :class:`.PymiaDatasource` to fit the\n `torch.utils.data.Dataset <https://pytorch.org/docs/stable/data.html#torch.utils.data.Dataset>`_ interface.\n\n Args:\n ...
class SubsetSequentialSampler(smplr.Sampler): def __init__(self, indices): 'Samples elements sequential from a given list of indices, without replacement.\n\n The class adopts the `torch.utils.data.Sampler\n <https://pytorch.org/docs/1.3.0/data.html#torch.utils.data.Sampler>`_ interface.\n\...
def get_tf_generator(data_source: extr.PymiaDatasource): 'Returns a generator that wraps :class:`.PymiaDatasource` for the TensorFlow data handling.\n\n The returned generator can be used with `tf.data.Dataset.from_generator\n <https://www.tensorflow.org/api_docs/python/tf/data/Dataset#from_generator>`_ in ...
class ImageProperties(): def __init__(self, image: sitk.Image): 'Represents ITK image properties.\n\n Holds common ITK image meta-data such as the size, origin, spacing, and direction.\n\n See Also:\n SimpleITK provides `itk::simple::Image::CopyInformation`_ to copy image informa...
class NumpySimpleITKImageBridge(): 'A numpy to SimpleITK bridge, which provides static methods to convert between numpy array and SimpleITK image.' @staticmethod def convert(array: np.ndarray, properties: ImageProperties) -> sitk.Image: 'Converts a numpy array to a SimpleITK image.\n\n Arg...
class SimpleITKNumpyImageBridge(): 'A SimpleITK to numpy bridge.\n\n Converts SimpleITK images to numpy arrays. Use the ``NumpySimpleITKImageBridge`` to convert back.\n ' @staticmethod def convert(image: sitk.Image) -> typing.Tuple[(np.ndarray, ImageProperties)]: 'Converts an image to a num...
class Callback(): 'Base class for the interaction with the dataset creation.\n\n Implementations of the :class:`.Callback` class can be provided to :meth:`.Traverser.traverse` in order to\n write/process specific information of the original data.\n ' def on_start(self, params: dict): 'Called...
class ComposeCallback(Callback): def __init__(self, callbacks: typing.List[Callback]) -> None: 'Composes many :class:`.Callback` instances and behaves like an single :class:`.Callback` instance.\n\n This class allows passing multiple :class:`.Callback` to :meth:`.Traverser.traverse`.\n\n Ar...
class MonitoringCallback(Callback): 'Callback that monitors the dataset creation process by logging the progress to the console.' def on_start(self, params: dict): print('start dataset creation') def on_subject(self, params: dict): index = params[defs.KEY_SUBJECT_INDEX] subject_f...
class WriteDataCallback(Callback): def __init__(self, writer: wr.Writer) -> None: 'Callback that writes the raw data to the dataset.\n\n Args:\n writer (.creation.writer.Writer): The writer used to write the data.\n ' self.writer = writer def on_subject(self, params:...
class WriteEssentialCallback(Callback): def __init__(self, writer: wr.Writer) -> None: 'Callback that writes the essential information to the dataset.\n\n Args:\n writer (.creation.writer.Writer): The writer used to write the data.\n ' self.writer = writer self.re...
class WriteImageInformationCallback(Callback): def __init__(self, writer: wr.Writer, category=defs.KEY_IMAGES) -> None: 'Callback that writes the image information (shape, origin, direction, spacing) to the dataset.\n\n Args:\n writer (.creation.writer.Writer): The writer used to write ...
class WriteNamesCallback(Callback): def __init__(self, writer: wr.Writer) -> None: 'Callback that writes the names of the category entries to the dataset.\n\n Args:\n writer (.creation.writer.Writer): The writer used to write the data.\n ' self.writer = writer def on...
class WriteFilesCallback(Callback): def __init__(self, writer: wr.Writer) -> None: 'Callback that writes the file names to the dataset.\n\n Args:\n writer (.creation.writer.Writer): The writer used to write the data.\n ' self.writer = writer self.file_root = None ...
def get_default_callbacks(writer: wr.Writer, meta_only=False) -> ComposeCallback: 'Provides a selection of commonly used callbacks to write the most important information to the dataset.\n\n Args:\n writer (.creation.writer.Writer): The writer used to write the data.\n meta_only (bool): Whether o...
class Load(abc.ABC): 'Interface for loading the data during the dataset creation in :meth:`.Traverser.traverse`\n \n .. automethod:: __call__\n ' @abc.abstractmethod def __call__(self, file_name: str, id_: str, category: str, subject_id: str) -> typing.Tuple[(np.ndarray, typing.Union[(conv.Image...
class LoadDefault(Load): 'The default loader.\n\n It loads every data item (id/entry, category) for each subject as :code:`sitk.Image`\n and the corresponding :class:`.ImageProperties`.\n ' def __call__(self, file_name: str, id_: str, category: str, subject_id: str) -> typing.Tuple[(np.ndarray, ty...
def default_concat(data: typing.List[np.ndarray]) -> np.ndarray: 'Default concatenation function used to combine all entries from a category (e.g. T1, T2 data from "images" category)\n in :meth:`.Traverser.traverse`\n\n Args:\n data (list): List of numpy.ndarray entries to be concatenated.\n\n Ret...
class Traverser(): def __init__(self, categories: typing.Union[(str, typing.Tuple[(str, ...)])]=None): 'Class managing the dataset creation process.\n\n Args:\n categories (str or tuple of str): The categories to traverse. If None, then all categories of a\n :class:`.Subj...
class Writer(abc.ABC): 'Represents the abstract dataset writer defining an interface for the writing process.' def __enter__(self): self.open() return self def __exit__(self, exc_type, exc_val, exc_tb): self.close() def __del__(self): self.close() @abc.abstractm...
class Hdf5Writer(Writer): str_type = h5py.special_dtype(vlen=str) def __init__(self, file_path: str) -> None: 'Writer class for HDF5 file type.\n\n Args:\n file_path(str): The path to the dataset file to write.\n ' self.h5 = None self.file_path = file_path ...
def get_writer(file_path: str) -> Writer: 'Get the dataset writer corresponding to the file extension.\n\n Args:\n file_path(str): The path of the dataset file to be written.\n\n Returns:\n .creation.writer.Writer: Writer corresponding to dataset file extension.\n ' ...
def subject_index_to_str(subject_index, nb_subjects): max_digits = len(str(nb_subjects)) index_str = '{{:0{}}}'.format(max_digits).format(subject_index) return index_str
def convert_to_string(data): 'Converts extracted string data from bytes to string, as strings are handled as bytes since h5py >= 3.0.\n\n The function has been introduced as part of an `issue <https://github.com/rundherum/pymia/issues/40>`_.\n\n Args:\n data: The data to be converted; either :obj:`by...
class PymiaDatasource(): def __init__(self, dataset_path: str, indexing_strategy: idx.IndexingStrategy=None, extractor: extr.Extractor=None, transform: tfm.Transform=None, subject_subset: list=None, init_reader_once: bool=True) -> None: 'Provides convenient and adaptable reading of the data from a create...
class Reader(abc.ABC): def __init__(self, file_path: str) -> None: 'Abstract dataset reader.\n\n Args:\n file_path(str): The path to the dataset file.\n ' super().__init__() self.file_path = file_path def __enter__(self): self.open() return se...
class Hdf5Reader(Reader): 'Represents the dataset reader for HDF5 files.' def __init__(self, file_path: str, category=defs.KEY_IMAGES) -> None: 'Initializes a new instance.\n\n Args:\n file_path(str): The path to the dataset file.\n category(str): The category of an entry...
def get_reader(file_path: str, direct_open: bool=False) -> Reader: 'Get the dataset reader corresponding to the file extension.\n\n Args:\n file_path(str): The path to the dataset file.\n direct_open(bool): Whether the file should directly be opened.\n\n Returns:\n Reader: Reader corres...
class SelectionStrategy(abc.ABC): 'Interface for selecting indices according some rule.\n\n .. automethod:: __call__\n .. automethod:: __repr__\n ' @abc.abstractmethod def __call__(self, sample: dict) -> bool: '\n\n Args:\n sample (dict): An extracted from :class:`.Pymi...
class NonConstantSelection(SelectionStrategy): def __init__(self, loop_axis=None) -> None: super().__init__() self.loop_axis = loop_axis def __call__(self, sample) -> bool: image_data = sample[defs.KEY_IMAGES] if (self.loop_axis is None): return (not self._all_equ...
class NonBlackSelection(SelectionStrategy): def __init__(self, black_value: float=0.0) -> None: self.black_value = black_value def __call__(self, sample) -> bool: return (sample[defs.KEY_IMAGES] > self.black_value).any() def __repr__(self) -> str: return '{}({})'.format(self.__c...
class PercentileSelection(SelectionStrategy): def __init__(self, percentile: float) -> None: self.percentile = percentile def __call__(self, sample) -> bool: image_data = sample[defs.KEY_IMAGES] percentile_value = np.percentile(image_data, self.percentile) return (image_data ...
class WithForegroundSelection(SelectionStrategy): def __call__(self, sample) -> bool: return sample[defs.KEY_LABELS].any()
class SubjectSelection(SelectionStrategy): 'Select subjects by their name or index.' def __init__(self, subjects) -> None: if isinstance(subjects, int): subjects = (subjects,) if isinstance(subjects, str): subjects = (subjects,) self.subjects = subjects de...
class ComposeSelection(SelectionStrategy): def __init__(self, strategies) -> None: self.strategies = strategies def __call__(self, sample) -> bool: return all((strategy(sample) for strategy in self.strategies)) def __repr__(self) -> str: return '|'.join((repr(s) for s in self.st...
def select_indices(data_source: ds.PymiaDatasource, selection_strategy: SelectionStrategy): selected_indices = [] for (i, sample) in enumerate(data_source): if selection_strategy(sample): selected_indices.append(i) return selected_indices
class IndexExpression(): def __init__(self, indexing: t.Union[(int, tuple, t.List[int], t.List[tuple], t.List[list])]=None, axis: t.Union[(int, tuple)]=None) -> None: 'Defines the indexing of a chunk of raw data in the dataset.\n\n Args:\n indexing (int, tuple, list): The indexing. If :...
class FileCategory(): def __init__(self, entries=None) -> None: if (entries is None): entries = {} self.entries = entries
class SubjectFile(): def __init__(self, subject: str, **file_groups) -> None: 'Holds the file information of a subject.\n\n Args:\n subject (str): The subject identifier.\n **file_groups (dict): The groups of file types containing the file path entries.\n ' sel...
class Transform(abc.ABC): @abc.abstractmethod def __call__(self, sample: dict) -> dict: pass
class ComposeTransform(Transform): def __init__(self, transforms: typing.Iterable[Transform]) -> None: self.transforms = transforms def __call__(self, sample: dict) -> dict: for t in self.transforms: sample = t(sample) return sample
class LoopEntryTransform(Transform, abc.ABC): def __init__(self, loop_axis=None, entries=()) -> None: super().__init__() self.loop_axis = loop_axis self.entries = entries @staticmethod def loop_entries(sample: dict, fn, entries, loop_axis=None): for entry in entries: ...
class IntensityRescale(LoopEntryTransform): def __init__(self, lower, upper, loop_axis=None, entries=(defs.KEY_IMAGES,)) -> None: super().__init__(loop_axis=loop_axis, entries=entries) self.lower = lower self.upper = upper def transform_entry(self, np_entry, entry, loop_i=None) -> np...
class IntensityNormalization(LoopEntryTransform): def __init__(self, loop_axis=None, entries=(defs.KEY_IMAGES,)) -> None: super().__init__(loop_axis=loop_axis, entries=entries) self.normalize_fn = self._normalize def transform_entry(self, np_entry, entry, loop_i=None) -> np.ndarray: ...
class LambdaTransform(LoopEntryTransform): def __init__(self, lambda_fn, loop_axis=None, entries=(defs.KEY_IMAGES,)) -> None: super().__init__(loop_axis=loop_axis, entries=entries) self.lambda_fn = lambda_fn def transform_entry(self, np_entry, entry, loop_i=None) -> np.ndarray: retur...
class ClipPercentile(LoopEntryTransform): def __init__(self, upper_percentile: float, lower_percentile: float=None, loop_axis=None, entries=(defs.KEY_IMAGES,)) -> None: super().__init__(loop_axis=loop_axis, entries=entries) self.upper_percentile = upper_percentile if (lower_percentile is ...
class Relabel(LoopEntryTransform): def __init__(self, label_changes: typing.Dict[(int, int)], entries=(defs.KEY_LABELS,)) -> None: super().__init__(loop_axis=None, entries=entries) self.label_changes = label_changes def transform_entry(self, np_entry, entry, loop_i=None) -> np.ndarray: ...
class Reshape(LoopEntryTransform): def __init__(self, shapes: dict) -> None: 'Initializes a new instance of the Reshape class.\n\n Args:\n shapes (dict): A dict with keys being the entries and the values the new shapes of the entries.\n E.g. shapes = {defs.KEY_IMAGES: (-1...
class Permute(LoopEntryTransform): def __init__(self, permutation: tuple, entries=(defs.KEY_IMAGES, defs.KEY_LABELS)) -> None: super().__init__(loop_axis=None, entries=entries) self.permutation = permutation def transform_entry(self, np_entry, entry, loop_i=None) -> np.ndarray: retur...
class Squeeze(LoopEntryTransform): def __init__(self, entries=(defs.KEY_IMAGES, defs.KEY_LABELS), squeeze_axis=None) -> None: super().__init__(loop_axis=None, entries=entries) self.squeeze_axis = squeeze_axis def transform_entry(self, np_entry, entry, loop_i=None) -> np.ndarray: retu...
class UnSqueeze(LoopEntryTransform): def __init__(self, axis=(- 1), entries=(defs.KEY_IMAGES, defs.KEY_LABELS)) -> None: super().__init__(loop_axis=None, entries=entries) self.axis = axis def transform_entry(self, np_entry, entry, loop_i=None) -> np.ndarray: return np.expand_dims(np_...
class SizeCorrection(Transform): 'Size correction transformation.\n\n Corrects the size, i.e. shape, of an array to a given reference shape.\n ' def __init__(self, shape: typing.Tuple[(typing.Union[(None, int)], ...)], pad_value: int=0, entries=(defs.KEY_IMAGES, defs.KEY_LABELS)) -> None: 'Init...
class Mask(Transform): def __init__(self, mask_key: str, mask_value: int=0, masking_value: float=0.0, loop_axis=None, entries=(defs.KEY_IMAGES, defs.KEY_LABELS)) -> None: super().__init__() self.mask_key = mask_key self.mask_value = mask_value self.masking_value = masking_value ...
class RandomCrop(LoopEntryTransform): def __init__(self, size: tuple, loop_axis=None, entries=(defs.KEY_IMAGES, defs.KEY_LABELS)) -> None: super().__init__(loop_axis, entries) self.size = size self.slices = None def transform_entry(self, np_entry, entry, loop_i=None) -> np.ndarray: ...
def check_and_return(obj, type_): if (not isinstance(obj, type_)): raise ValueError("entry must be '{}'".format(type_.__name__)) return obj
class Result(): def __init__(self, id_: str, label: str, metric: str, value): "Represents a result.\n\n Args:\n id_ (str): The identification of the result (e.g., the subject's name).\n label (str): The label of the result (e.g., the foreground).\n metric (str): Th...
class Evaluator(abc.ABC): def __init__(self, metrics: typing.List[pymia_metric.Metric]): 'Evaluator base class.\n\n Args:\n metrics (list of pymia_metric.Metric): A list of metrics.\n ' self.metrics = metrics self.results = [] @abc.abstractmethod def eval...
class SegmentationEvaluator(Evaluator): def __init__(self, metrics: typing.List[pymia_metric.Metric], labels: dict): 'Represents a segmentation evaluator, evaluating metrics on predictions against references.\n\n Args:\n metrics (list of pymia_metric.Metric): A list of metrics.\n ...
class AreaMetric(SpacingMetric, abc.ABC): def __init__(self, metric: str='AREA'): 'Represents an area metric base class.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def _calculate_area(self, image: np.ndarray, slice...
class VolumeMetric(SpacingMetric, abc.ABC): def __init__(self, metric: str='VOL'): 'Represents a volume metric base class.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def _calculate_volume(self, image: np.ndarray) -...
class Accuracy(ConfusionMatrixMetric): def __init__(self, metric: str='ACURCY'): 'Represents an accuracy metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): 'Calculates the accuracy.' ...
class AdjustedRandIndex(ConfusionMatrixMetric): def __init__(self, metric: str='ADJRIND'): 'Represents an adjusted rand index metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): 'Calcula...
class AreaUnderCurve(ConfusionMatrixMetric): def __init__(self, metric: str='AUC'): 'Represents an area under the curve metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): 'Calculates th...
class AverageDistance(SpacingMetric): def __init__(self, metric: str='AVGDIST'): 'Represents an average (Hausdorff) distance metric.\n\n Calculates the distance between the set of non-zero pixels of two images using the following equation:\n\n .. math:: AVD(A,B) = max(d(A,B), d(B,A)),\n\n ...
class CohenKappaCoefficient(ConfusionMatrixMetric): def __init__(self, metric: str='KAPPA'): "Represents a Cohen's kappa coefficient metric.\n\n Args:\n metric (str): The identification string of the metric.\n " super().__init__(metric) def calculate(self): "...
class DiceCoefficient(ConfusionMatrixMetric): def __init__(self, metric: str='DICE'): 'Represents a Dice coefficient metric with empty target handling, defined as:\n\n .. math:: \\begin{cases} 1 & \\left\\vert{y}\\right\\vert = \\left\\vert{\\hat y}\\right\\vert = 0 \\\\ Dice(y,\\hat y) & \\left\\...
class FalseNegative(ConfusionMatrixMetric): def __init__(self, metric: str='FN'): 'Represents a false negative metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): 'Calculates the false n...
class FalsePositive(ConfusionMatrixMetric): def __init__(self, metric: str='FP'): 'Represents a false positive metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): 'Calculates the false p...
class Fallout(ConfusionMatrixMetric): def __init__(self, metric: str='FALLOUT'): 'Represents a fallout (false positive rate) metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): 'Calculat...
class FalseNegativeRate(ConfusionMatrixMetric): def __init__(self, metric: str='FNR'): 'Represents a false negative rate metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): 'Calculates t...
class FMeasure(ConfusionMatrixMetric): def __init__(self, beta: float=1.0, metric: str='FMEASR'): 'Represents a F-measure metric.\n\n Args:\n beta (float): The beta to trade-off precision and recall.\n Use 0.5 or 2 to calculate the F0.5 and F2 measure, respectively.\n ...
class GlobalConsistencyError(ConfusionMatrixMetric): def __init__(self, metric: str='GCOERR'): 'Represents a global consistency error metric.\n\n Implementation based on Martin 2001. todo(fabianbalsiger): add entire reference\n\n Args:\n metric (str): The identification string of...
class HausdorffDistance(DistanceMetric): def __init__(self, percentile: float=100.0, metric: str='HDRFDST'): 'Represents a Hausdorff distance metric.\n\n Calculates the distance between the set of non-zero pixels of two images using the following equation:\n\n .. math:: H(A,B) = max(h(A,B),...
class InterclassCorrelation(NumpyArrayMetric): def __init__(self, metric: str='ICCORR'): 'Represents an interclass correlation metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): 'Calcul...
class JaccardCoefficient(ConfusionMatrixMetric): def __init__(self, metric: str='JACRD'): 'Represents a Jaccard coefficient metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): 'Calculate...
class MahalanobisDistance(NumpyArrayMetric): def __init__(self, metric: str='MAHLNBS'): 'Represents a Mahalanobis distance metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): 'Calculates...
class MutualInformation(ConfusionMatrixMetric): def __init__(self, metric: str='MUTINF'): 'Represents a mutual information metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): 'Calculates...
class Precision(ConfusionMatrixMetric): def __init__(self, metric: str='PRCISON'): 'Represents a precision metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): 'Calculates the precision.'...
class PredictionArea(AreaMetric): def __init__(self, slice_number: int=(- 1), metric: str='PREDAREA'): 'Represents a prediction area metric.\n\n Args:\n slice_number (int): The slice number to calculate the area.\n Defaults to -1, which will calculate the area on the inte...
class PredictionVolume(VolumeMetric): def __init__(self, metric: str='PREDVOL'): 'Represents a prediction volume metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): 'Calculates the predi...
class ProbabilisticDistance(NumpyArrayMetric): def __init__(self, metric: str='PROBDST'): 'Represents a probabilistic distance metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): 'Calcul...
class RandIndex(ConfusionMatrixMetric): def __init__(self, metric: str='RNDIND'): 'Represents a rand index metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): 'Calculates the rand index....
class ReferenceArea(AreaMetric): def __init__(self, slice_number: int=(- 1), metric: str='REFAREA'): 'Represents a reference area metric.\n\n Args:\n slice_number (int): The slice number to calculate the area.\n Defaults to -1, which will calculate the area on the interme...
class ReferenceVolume(VolumeMetric): def __init__(self, metric: str='REFVOL'): 'Represents a reference volume metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): 'Calculates the referenc...
class Sensitivity(ConfusionMatrixMetric): def __init__(self, metric: str='SNSVTY'): 'Represents a sensitivity (true positive rate or recall) metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): ...
class Specificity(ConfusionMatrixMetric): def __init__(self, metric: str='SPCFTY'): 'Represents a specificity metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): 'Calculates the specific...
class SurfaceDiceOverlap(DistanceMetric): def __init__(self, tolerance: float=1, metric: str='SURFDICE'): 'Represents a surface Dice coefficient overlap metric.\n\n Args:\n tolerance (float): The tolerance of the surface distance in mm.\n metric (str): The identification stri...
class SurfaceOverlap(DistanceMetric): def __init__(self, tolerance: float=1.0, prediction_to_reference: bool=True, metric: str='SURFOVLP'): 'Represents a surface overlap metric.\n\n Computes the overlap of the reference surface with the predicted surface and vice versa allowing a\n specifie...
class TrueNegative(ConfusionMatrixMetric): def __init__(self, metric: str='TN'): 'Represents a true negative metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): 'Calculates the true nega...
class TruePositive(ConfusionMatrixMetric): def __init__(self, metric: str='TP'): 'Represents a true positive metric.\n\n Args:\n metric (str): The identification string of the metric.\n ' super().__init__(metric) def calculate(self): 'Calculates the true posi...