Skip to content

rationai.qc.typing

BinaryMask = NDArray[np.bool_] module-attribute

Binary mask only containing values 0 and 1.

FloatingPointImage = NDArray[np.float64] module-attribute

Floating point image represented by a numpy array.

GrayScaleImage = NDArray[np.uint8] module-attribute

Single channel grayscale image represented by a numpy array.

RGBImage = NDArray[np.uint8] module-attribute

Three channel RGB image represented by a numpy array.

Stain = 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
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
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: FloatingPointImage
    """Coverage mask of the blur score. Coverage ranges from 0.0 to 1.0.
    0.0 - no blur, 1.0 - full blur
    """

    number_of_examined_pixels: int
    """Number of pixels that were examined by the function and could
    be theoretically marked as artifacts.
    """

    number_of_flagged_pixels: int
    """Number of pixels that were labeled as artifacts by the function."""

blur_score_coverage 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 instance-attribute

Binary mask composed of 16x16 px blocks marking blurred area

number_of_examined_pixels instance-attribute

Number of pixels that were examined by the function and could be theoretically marked as artifacts.

number_of_flagged_pixels instance-attribute

Number of pixels that were labeled as artifacts by the function.

CorrectStaining

Bases: TypedDict

Dictionary containing answer if the slide is stained correctly.

Source code in rationai/qc/typing.py
33
34
35
36
37
38
39
40
41
42
43
44
45
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 instance-attribute

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

stain1_diff_median instance-attribute

Median of differences for the first stain.

stain2_diff_median 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
48
49
50
51
52
53
54
55
class DominantStains(TypedDict):
    """Dictionary containing two detected dominant stains."""

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

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

stain1 instance-attribute

First dominant stain vector.

stain2 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
class FoldArtifacts(TypedDict):
    """Dictionary containing the fold detection mask and intermediate results."""

    folding_per_pixel: 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.
    """

    number_of_examined_pixels: int
    """Number of pixels that were examined by the function and could
    be theoretically marked as artifacts.
    """

    number_of_flagged_pixels: int
    """Number of pixels that were labeled as artifacts by the function."""

folding_per_pixel instance-attribute

Mask of the fold detection

number_of_examined_pixels instance-attribute

Number of pixels that were examined by the function and could be theoretically marked as artifacts.

number_of_flagged_pixels instance-attribute

Number of pixels that were labeled as artifacts by the function.

thresholded_eosin instance-attribute

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

thresholded_saturation instance-attribute

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

thresholded_value instance-attribute

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

ResidualArtifacts

Bases: TypedDict

Dictionary containing an artifact mask and a number of examined and flagged pixels.

Source code in rationai/qc/typing.py
58
59
60
61
62
63
64
65
66
67
68
69
70
class ResidualArtifacts(TypedDict):
    """Dictionary containing an artifact mask and a number of examined and flagged pixels."""

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

    number_of_examined_pixels: int
    """Number of pixels that were examined by the function and could
    be theoretically marked as artifacts.
    """

    number_of_flagged_pixels: int
    """Number of pixels that were labeled as artifacts by the function."""

artifacts_per_pixel instance-attribute

Binary mask of the detected residual artifacts.

number_of_examined_pixels instance-attribute

Number of pixels that were examined by the function and could be theoretically marked as artifacts.

number_of_flagged_pixels instance-attribute

Number of pixels that were labeled as artifacts by the function.

StainingDifference

Bases: TypedDict

Dictionary with color differences and a correct staining verdict.

Source code in rationai/qc/typing.py
73
74
75
76
77
78
79
80
81
82
83
84
85
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 instance-attribute

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

stain_diff1 instance-attribute

First stain difference.

stain_diff2 instance-attribute

Second stain difference.