Color Conversion
Class representing a color conversion between stain space and RGB space.
Source code in rationai/staining/color_conversion.py
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 101 102 | |
direction
property
Returns the conversion direction.
inverse
property
Returns the inverse of the current color conversion.
matrix
property
Returns the conversion matrix in a form of a numpy array.
__init__(conversion_matrix, conversion_direction)
Initializes a ColorConversion instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conversion_matrix
|
StainTupleMatrix
|
Matrix defining the color conversion. |
required |
conversion_direction
|
ConversionDirection
|
Direction of the conversion. |
required |
Source code in rationai/staining/color_conversion.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |
__repr__()
Source code in rationai/staining/color_conversion.py
47 48 | |
from_stain_vectors(stain1, stain2, stain3=None, conversion_direction=ConversionDirection.RGB2STAIN)
staticmethod
Creates a ColorConversion instance from the given stain vectors.
The provided stain vectors are assumed to be in stain space.
This allows to specify the stain vectors in the same format as they are detected
by the estimate_stain_vectors function, making it more convenient to create custom
color conversions from reference images.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stain1
|
StainTuple
|
First stain vector. |
required |
stain2
|
StainTuple
|
Second stain vector. |
required |
stain3
|
StainTuple | None
|
Optional third stain vector. If not provided, it will be computed as the residual vector orthogonal to the first two. |
None
|
conversion_direction
|
ConversionDirection
|
Desired conversion direction of the resulting |
RGB2STAIN
|
Returns:
| Type | Description |
|---|---|
ColorConversion
|
|
Source code in rationai/staining/color_conversion.py
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 101 102 | |