Skip to content

rationai.qc.typing

BinaryMask: TypeAlias = NDArray[np.bool_] module-attribute

Binary mask only containing values 0 and 1.

GrayScaleImage: TypeAlias = NDArray[np.uint8] module-attribute

Single channel grayscale image represented by a numpy array.

RGBImage: TypeAlias = NDArray[np.uint8] module-attribute

Three channel RGB image represented by a numpy array.

Stain: TypeAlias = NDArray[np.float64] module-attribute

Single stain vector (of 3 values) represented by a numpy array.

BlurScore

Bases: TypedDict

Dictionary containing the blur score masks.

Source code in rationai/qc/typing.py
80
81
82
83
84
85
86
87
88
89
class BlurScore(TypedDict):
    """Dictionary containing the blur score masks."""

    blur_score_per_pixel: BinaryMask
    """Binary mask composed of 16x16 px blocks marking blurred area"""

    blur_score_coverage: NDArray[np.float64]
    """Coverage mask of the blur score. Coverage ranges from 0.0 to 1.0.
    0.0 - no blur, 1.0 - full blur
    """

blur_score_coverage: NDArray[np.float64] instance-attribute

Coverage mask of the blur score. Coverage ranges from 0.0 to 1.0. 0.0 - no blur, 1.0 - full blur

blur_score_per_pixel: BinaryMask instance-attribute

Binary mask composed of 16x16 px blocks marking blurred area

CorrectStaining

Bases: TypedDict

Dictionary containing answer if the slide is stained correctly.

Source code in rationai/qc/typing.py
28
29
30
31
32
33
34
35
36
37
38
39
40
class CorrectStaining(TypedDict):
    """Dictionary containing answer if the slide is stained correctly."""

    correct_staining: bool
    """True if the differences are considered to be small enough
    for a slide to be considered as correctly stained.
    """

    stain1_diff_median: float
    """Median of differences for the first stain."""

    stain2_diff_median: float
    """Median of differences for the second stain."""

correct_staining: bool instance-attribute

True if the differences are considered to be small enough for a slide to be considered as correctly stained.

stain1_diff_median: float instance-attribute

Median of differences for the first stain.

stain2_diff_median: float instance-attribute

Median of differences for the second stain.

DominantStains

Bases: TypedDict

Dictionary containing two detected dominant stains.

Source code in rationai/qc/typing.py
43
44
45
46
47
48
49
50
class DominantStains(TypedDict):
    """Dictionary containing two detected dominant stains."""

    stain1: Stain
    """First dominant stain vector."""

    stain2: Stain
    """Second dominant stain vector."""

stain1: Stain instance-attribute

First dominant stain vector.

stain2: Stain instance-attribute

Second dominant stain vector.

FoldArtifacts

Bases: TypedDict

Dictionary containing the fold detection mask and intermediate results.

Source code in rationai/qc/typing.py
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
class FoldArtifacts(TypedDict):
    """Dictionary containing the fold detection mask and intermediate results."""

    folding: BinaryMask
    """Mask of the fold detection"""

    thresholded_saturation: BinaryMask
    """Thresholded saturation channel. Intermediate result of folding detection. Can be used for debugging."""

    thresholded_value: BinaryMask
    """Thresholded value channel.Intermediate result of folding detection. Can be used for debugging."""

    thresholded_eosin: BinaryMask
    """Thresholded eosin channel.Intermediate result of folding detection. Can be used for debugging."""

folding: BinaryMask instance-attribute

Mask of the fold detection

thresholded_eosin: BinaryMask instance-attribute

Thresholded eosin channel.Intermediate result of folding detection. Can be used for debugging.

thresholded_saturation: BinaryMask instance-attribute

Thresholded saturation channel. Intermediate result of folding detection. Can be used for debugging.

thresholded_value: BinaryMask instance-attribute

Thresholded value channel.Intermediate result of folding detection. Can be used for debugging.

ResidualArtifacts

Bases: TypedDict

Dictionary containing a coverage mask and a coverage number.

Source code in rationai/qc/typing.py
53
54
55
56
57
58
59
60
61
62
class ResidualArtifacts(TypedDict):
    """Dictionary containing a coverage mask and a coverage number."""

    coverage_mask: BinaryMask
    """Binary mask of the detected residual artifacts."""

    coverage: float
    """A number that states what portion of the image's foreground area
    is covered by the artifacts.
    """

coverage: float instance-attribute

A number that states what portion of the image's foreground area is covered by the artifacts.

coverage_mask: BinaryMask instance-attribute

Binary mask of the detected residual artifacts.

StainingDifference

Bases: TypedDict

Dictionary with color differences and a correct staining verdict.

Source code in rationai/qc/typing.py
65
66
67
68
69
70
71
72
73
74
75
76
77
class StainingDifference(TypedDict):
    """Dictionary with color differences and a correct staining verdict."""

    stain_diff1: float
    """First stain difference."""

    stain_diff2: float
    """Second stain difference."""

    correct_staining: bool
    """True if the stain values are close to the expected ones
    (i.e., their color difference is small enough).
    """

correct_staining: bool instance-attribute

True if the stain values are close to the expected ones (i.e., their color difference is small enough).

stain_diff1: float instance-attribute

First stain difference.

stain_diff2: float instance-attribute

Second stain difference.