LION.utils.normaliser¶
Classes
|
How images are scaled to [0, 1], for models that need their inputs normalised and say how ( |
- class LION.utils.normaliser.Normalisation(normalisation_type='none', dataset=None, data_range=None)[source]¶
Bases:
objectHow images are scaled to [0, 1], for models that need their inputs normalised and say how (
LIONmodel.set_normalisation). Normalisation in CT isn’t trivial;normalisation_typeis one of:“none”: nothing;
“sample”: each image by its own range;
“dataset”: by the range of the dataset’s ground truths (read once from
dataset, or given asdata_rangewhen known, e.g. from a model file);“custom”: by
data_range, (min, max).
record()andfrom_recordsave and make it again.- record()[source]¶
What makes this normalisation again (
from_record): its type, and its range for “dataset” and “custom”.
- static from_record(record)[source]¶
The normalisation
record()describes (without its dataset); a dict or aLIONParameter.
- normalise(x)[source]¶
The images
x(B, C, H, W) scaled to [0, 1] by the normalisation’s range (“sample”: each image’s, kept forunnormalise).
- normalise_measurements(y, op=None)[source]¶
The measurements of the normalised images, by linearity: if images are mapped to (x - min) / s, measurements y = A x are mapped to (y - A(min)) / s, A(min) being the measurements of an image of value min everywhere (computed with
op; none needed when min is 0). For models that take measurements; the operator is unchanged. Not defined for “sample” (an image’s range isn’t known before reconstructing).