torch_staintools.functional.stain_extraction package
Submodules
torch_staintools.functional.stain_extraction.extractor module
torch_staintools.functional.stain_extraction.utils module
- torch_staintools.functional.stain_extraction.utils.cov(x)
Covariance matrix for eigen decomposition. https://en.wikipedia.org/wiki/Covariance_matrix
- torch_staintools.functional.stain_extraction.utils.normalize_matrix_rows(a: Tensor) Tensor
Normalize the rows of an array. :param a: An array to normalize
- Returns:
Array with rows normalized.
- torch_staintools.functional.stain_extraction.utils.percentile(t: Tensor, q: float, dim: int) Tensor
Author: adapted from https://gist.github.com/spezold/42a451682422beb42bc43ad0c0967a30
Return the
q-th percentile of the flattenepip d input tensor’s data.Caution
Needs PyTorch >= 1.1.0, as
torch.kthvalue()is used.Values are not interpolated, which corresponds to
numpy.percentile(..., interpolation="nearest").
- Parameters:
t – Input tensor.
q – Percentile to compute, which must be between 0 and 100 inclusive.
dim – which dim to operate for function tensor.kthvalue.
- Returns:
Resulting value (scalar).