- class aydin.it.transforms.attenuation.AttenuationTransform(axes: Union[None, int, Sequence[int]] = None, mode: str = 'linear', priority: float = 0.321, **kwargs)
Axis-aligned attenuation correction
Corrects intensity attenuation of an image along a given list of axis. This is usefull to correct for signal attenuation over time or along space. Currently only linear attenuation is supported. More modes on the way.
- class aydin.it.transforms.deskew.DeskewTransform(delta: float = 0, z_axis: int = 0, skew_axis: int = 1, pad: bool = True, priority: float = 0.4, **kwargs)
(Integral) Stack Deskewer
Denoising is more effective if voxels carrying correlated signal are close to each other. When a stack is skewed – as resulting in some imaging modalities – correlated voxels that should be close in space are far from each other. Thus, deskewing the image before denoising is highly recommended. Importantly, the deskewing must be ‘integral’, meaning that it must not interpolate voxel values, which is a unadvised lossy operation. Integral stack deskewing consists in applying an integral shear transformation to a stack. Two axes need to be specified: the ‘z’-axis and the ‘skew’-axis along which shifting happens. The delta parameter controls the amount of shift per plane - must be an integer. We automatically snap the delta value to the closest integer. Padding is supported.
Note: this only works for images with at least 3 dimensions. Does nothing on images with less than 3 dimensions.(advanced)
- class aydin.it.transforms.fixedpattern.FixedPatternTransform(axes: Union[None, int, Sequence[int], List[Sequence[int]]] = None, percentile: float = 1, sigma: float = 0.5, priority: float = 0.09, **kwargs)
Fixed Axis-Aligned Pattern Suppression
Suppresses fixed, axis aligned, offset patterns along any combination of axis. Given a list of lists of axis that defines axis-aligned volumes, intensity fluctuations of these volumes are stabilised. You can suppress intensity fluctuation over time, suppress fixed offsets per pixel over time, suppress intensity fluctuations per row, per column, and more…
For example, assume an image with dimensions tyx (t+2D), and you want to suppress fluctuations of intensity along the t axis, then you provide: axes=[] (or simply 0 or ) which means that the average intensity for all planes along t (axis=0) will be stabilised. If instead you want to suppress some fixed background offset over xy planes, then you do: axes=[[1,2]]. If you want to do both, then you use: axes=[, [1, 2]]. Please note that these corrections are applied in the order specified by the list of axis combinations. It is not recommended to reapply the pattern after denoising, unless the pattern itself is of value and is not considered noise.
- class aydin.it.transforms.highpass.HighpassTransform(sigma: float = 1, median_filtering: bool = True, priority: float = 0.1, **kwargs)
Highpass Image Simplification
For images with little noise, applying a high-pass filter can help denoise the image by removing some of the image complexity. The low-frequency parts of the image do not need to be denoised because sometimes the challenge is disentangling the (high-frequency) noise from the high-frequencies in the image. The scale parameter must be chosen with care. The lesser the noise, the smaller the value. Values around 1 work well but must be tuned depending on the image. If the scale parameter is too low, some noise might be left untouched. The best is to keep the parameter as low as possible while still achieving good denoising performance. It is also possible to apply median filtering when computing the low-pass image which helps reducing the impact of outlier voxel values, for example salt&pepper noise. Note: when median filtering is on, larger values of sigma (e.g. >= 1) are recommended, unless when the level of noise is very low in which case a sigma of 0 (no Gaussian blur) may be advantageous. To recover the original denoised image the filtering is undone during post-processing. Note: this is ideal for treating <a href=’https://en.wikipedia.org/wiki/Colors_of_noise’>’blue’ noise</a> that is characterised by a high-frequency support.
- class aydin.it.transforms.histogram.HistogramEqualisationTransform(mode: str = 'equalize', scale: float = 0.125, priority: float = 0.12, **kwargs)
For some images with extremely unbalanced histograms, applying histogram equalisation will improve results. Two modes are supported: ‘equalize’, and ‘clahe’.
- class aydin.it.transforms.motion.MotionStabilisationTransform(axes: Union[None, int, Sequence[int]] = 0, sigma: float = 3, pad: bool = False, crop: bool = False, pad_mode: str = 'min_constant', max_pixel_shift: Optional[int] = None, reference_index: Optional[int] = None, priority: float = 0.45, **kwargs)
Denoising is more effective if signal-correlated voxels are close to each other. When a 2D+t or 3D+t timelapse has shifts between time points, pixels that should be close to each other from one time point to the next are now further away from each other. Worse, this relative placement often varies over time. This complicates denoising and typically leads to more blurry denoised images. Thus, stabilizing a timelapse before denoising is recommended to improve denoising performance. Currently, we assume that all frames can be registered to a common reference frame, and thus that all images have a common background that can be used for registration. For completeness, multiple axis can be specified and the correction is applied along each in sequence.(advanced)
- class aydin.it.transforms.padding.PaddingTransform(pad_width: int = 3, mode: str = 'reflect', min_length_to_pad: int = 8, priority: float = 0.9, **kwargs)
Padding (and then Cropping)
Adds a border to the image before denoising and then removes that border from the denoised image. This reduces border artifacts when denoising certain images. In the case of self-supervised blind-spot based denoisers (e.g. N2S) padding must be carefully chosen because the added pixels should not ‘give away’ the value of their neighbors. Thus, not all padding modes are recommended. ‘symmetric’ is the recommended default.
Other supported modes: ‘constant’: Pads with a constant value of 0, ‘linear_ramp’: Pads with the linear ramp between end_value and the array edge value, ‘maximum’: Pads with the maximum value of all or part of the vector along each axis, ‘mean’: Pads with the mean value of all or part of the vector along each axis, ‘median’: Pads with the median value of all or part of the vector along each axis, ‘minimum’: Pads with the minimum value of all or part of the vector along each axis.
- class aydin.it.transforms.periodic.PeriodicNoiseSuppressionTransform(mask_radius: float = 0.01, threshold: float = 0.1, max_num_peaks: int = 32, post_processing_is_inverse: bool = False, priority: float = 0.3, **kwargs)
Periodic Noise Suppression
Some images have a form of periodic noise that can be seen as strong peaks in their power spectral density. Suppressing these peaks before and after denoising is often a good idea. This is tricky to use, use with care. Works with non-axis aligned periodic patterns.(advanced)
- class aydin.it.transforms.range.RangeTransform(mode: str = 'minmax', percentile: Optional[float] = None, force_float_datatype: bool = False, clip: bool = True, priority: float = 0.2, **kwargs)
Images come in all sorts of formats, and pixels can be represented as 8, 16, 32 bit integers as well as 16, 32, 64 bit floats. More crucially, the actual range of values can vary potentially causing difficulties for denoising algorithms. For these reasons and more, it is almost always recommended to normalise images to a range within [0, 1] and represented as 32 bit floats (sufficient for most cases and ideal for aydin). Finally, there are two different normalisation modes. The first ‘minmax’ simply finds the min and max values in the image and uses that to rescale to [0, 1]. However, there are sometimes outlier values that are isolated and completely out of context which would skew the normalisation. Therefore, we also have a ‘percentile’ mode that uses percentiles to determine the range – typically 1% for min value and 99% for max value. Optionally, the image can be left as float after denormalisation, and values can be clipped to the range during both normalisation and denormalisation.
- class aydin.it.transforms.salt_pepper.SaltPepperTransform(fix_repeated: bool = True, max_repeated: int = 4, fix_lipschitz: bool = True, lipschitz: float = 0.1, percentile: float = 0.01, num_iterations: int = 64, priority: float = 0.08, **kwargs)
Salt And Pepper Correction
Detectors such as cameras have ‘broken’ pixels that blink, are very dim, or very bright. Other phenomena cause voxels to have very different values from their neighbors, this is often called ‘impulse’ or ‘salt-and-pepper’ noise. While self-supervised denoising can solve many of these issues, there is no reason to not to alleviate the task, especially when there are simple and fast approaches that can tackle this kind of noise. This preprocessing replaces voxels with the median of its neighbors if the voxel value is too different from its neighbors. This difference is proportional to the local second-derivative of the image. Increase the threshold parameter to tolerate more variation, decrease it to be more aggressive in removing salt & pepper noise. The algorithm is iterative, starting with the most offending pixels, until no pixels are corrected. You can set the max proportion of pixels that are allowed to be corrected if you can give a good estimate for that.
- class aydin.it.transforms.variance_stabilisation.VarianceStabilisationTransform(mode: str = 'anscomb', leave_as_float: bool = True, priority: float = 0.11, **kwargs)
Variance Stabilization Transform (VST) and other range compression functions.
Applies either the Yeo-Johnson, Box-Cox, Anscomb or some other VST transform to the image. Variance stabilization turns an image with Poisson or in general non-Gaussian noise into an image with approximately Gaussian noise, which often facilitates denoising. Also, in general for images with very skewed histograms with for example dark regions of large extent and only a few very bright regions, it is often beneficial to apply a sqrt or log transformation before denoising.