SNRImageMetric

class nrtk.impls.image_metric.snr_image_metric.SNRImageMetric

Implementation of the ComputeImageMetrics interface to calculate the Signal to Noise Ratio.

Methods

compute

Given one image, compute the Signal to Noise ratio.

from_config

Instantiate a new instance of this class given the configuration JSON-compliant dictionary encapsulating initialization arguments.

get_config

Returns the config for the interface.

get_default_config

Generate and return a default configuration dictionary for this class.

get_impls

Discover and return a set of classes that implement the calling class.

is_usable

Check whether this class is available for use.

compute(img_1: ndarray, img_2: ndarray | None = None, additional_params: dict[str, Any] | None = None) float

Given one image, compute the Signal to Noise ratio.

Parameters:
  • img_1 – Original input image in the shape (height, width, channels).

  • img_2 – (Optional) Second input image in the shape (height, width, channels). Not allowed for SNR

  • additional_params – (Optional) A dictionary containing implementation-specific input param-values pairs.

SNR has the following optional parameters: - axis: valid values are None, 0, 1, (0,1). Default is 0. The axis over which to calculate the standard deviation during SNR calculation. Keeping this at None will calculate over both axes and the channels. - ddof: degrees of freedom for the standard deviation calculation. Default is 0. Max value is num_elements, the number of elements used in calculation. Must be non-negative.

Returns:

Returns the signal to noise ratio for the input image.