blur_score_piqe
Creates per-pixel and per-image coverage mask of the blur score based on the PIQE algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
img
|
RGBImage
|
RGB Image of the tissue, minimum size 10x10 pixels. |
required |
pixel_size
|
float
|
Size of a pixel in micrometers. The score is most accurate at pixel sizes around 0.44 micrometers. |
0.44
|
foreground_mask
|
BinaryMask | None
|
Binary mask of the tissue, where 1 represents tissue and 0 represents background.
If not provided, foreground mask is computed by |
None
|
Returns:
| Type | Description |
|---|---|
BlurScore
|
Dictionary with the per-pixel and coverage mask blur_score_per_pixel - binary mask composed of 16x16 px blocks marking blurred areas. blur_score_coverage - coverage mask of the per_pixel detections. Coverage ranges from 0.0 to 1.0. |
Note
The returned dictionary contains the following values:
| Key | Description |
|---|---|
blur_score_per_pixel |
Binary mask of the blur score. |
blur_score_coverage |
Coverage mask of the blur score. |
number_of_examined_pixels |
Number of pixels that were evaluated by the function. |
number_of_flagged_pixels |
Number of pixels labeled as artifacts. |
Examples:
from skimage.data import immunohistochemistry
from rationai.qc.blur import blur_score_piqe
img = immunohistochemistry()
pixel_size = 0.44 # pixel size of img in micrometers
result = blur_score_piqe(img, pixel_size)
# Mask of the blur coverage range from 0.0 to 1.0
coverage_mask = result["blur_score_coverage"]
# Binary mask of the blur detections
blur_score_per_pixel = result["blur_score_per_pixel"]
Source code in rationai/qc/blur/blur_score_piqe.py
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |