Noise Model
Noise models Pydantic configurations.
GaussianLikelihoodConfig
Bases: BaseModel
Gaussian likelihood configuration.
logvar_lowerbound = None
class-attribute
instance-attribute
The lowerbound value for log-variance.
predict_logvar = None
class-attribute
instance-attribute
If pixelwise, log-variance is computed for each pixel, else log-variance
is not computed.
GaussianMixtureNMConfig
Bases: BaseModel
Gaussian mixture noise model.
max_signal = Field(default=1.0, ge=0.0)
class-attribute
instance-attribute
Maximum signal intensity expected in the image.
min_sigma = Field(default=125.0, ge=0.0)
class-attribute
instance-attribute
Minimum value of standard deviation allowed in the GMM.
All values of standard deviation below this are clamped to this value.
min_signal = Field(default=0.0, ge=0.0)
class-attribute
instance-attribute
Minimum signal intensity expected in the image.
n_coeff = Field(default=2, ge=2)
class-attribute
instance-attribute
Number of coefficients to describe the functional relationship between gaussian parameters and the signal. 2 implies a linear relationship, 3 implies a quadratic relationship and so on.
n_gaussian = Field(default=1, ge=1)
class-attribute
instance-attribute
Number of gaussians used for the GMM.
observation = Field(default=None, exclude=True)
class-attribute
instance-attribute
Path to the file containing observation or respective numpy array.
path = None
class-attribute
instance-attribute
Path to the directory where the trained noise model (*.npz) is saved in the
train method.
signal = Field(default=None, exclude=True)
class-attribute
instance-attribute
Path to the file containing signal or respective numpy array.
tol = Field(default=1e-10)
class-attribute
instance-attribute
Tolerance used in the computation of the noise model likelihood.
weight = None
class-attribute
instance-attribute
A [3*n_gaussian, n_coeff] sized array containing the values of the weights
describing the GMM noise model, with each row corresponding to one
parameter of each gaussian, namely [mean, standard deviation and weight].
Specifically, rows are organized as follows:
- first n_gaussian rows correspond to the means
- next n_gaussian rows correspond to the weights
- last n_gaussian rows correspond to the standard deviations
If weight=None, the weight array is initialized using the min_signal
and max_signal parameters.
validate_path()
Validate that the path points to a valid .npz file if provided.
Returns:
| Type | Description |
|---|---|
Self
|
Returns itself. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the path is provided but does not point to a valid .npz file. |
MultiChannelNMConfig
Bases: BaseModel
Noise Model config aggregating noise models for single output channels.
noise_models
instance-attribute
List of noise models, one for each target channel.
NMLikelihoodConfig
Bases: BaseModel
Noise model likelihood configuration.
NOTE: we need to define the data mean and std here because the noise model is trained on not-normalized data. Hence, we need to unnormalize the model output to compute the noise model likelihood.
data_mean = None
class-attribute
instance-attribute
The mean of the data, used to unnormalize data for noise model evaluation. Shape is (target_ch,) (or (1, target_ch, [1], 1, 1)).
data_std = None
class-attribute
instance-attribute
The standard deviation of the data, used to unnormalize data for noise model evaluation. Shape is (target_ch,) (or (1, target_ch, [1], 1, 1)).