I am proud to announce that we have just released a new tool: TGVDenoise, written by PTeam member Carlos Milovic. All users have now access to this tool as a regular update to PixInsight 1.8.0 RC7.
TGVDenoise is a noise reduction tool based on total generalized variation (see references [1...5] at the end of this post), a novel signal processing concept with important applications to image regularization and restoration. As I anticipated in a previous post, TGVDenoise is the first one of a series of TGV-based tools that we have been working on during the last year. Other members of this series are a multiscale, spatially adaptive TGV noise reduction tool (SATGV), and an image restoration (deconvolution) tool. Hopefully we'll be releasing these modules during the next weeks and months. I would like to reiterate my congratulations to Carlos Milovic for his excellent research and development work on these tools.
In the rest of this post I'll describe briefly the main TGVDenoise parameters. We'll be posting noise reduction examples on this board during the next days.Overview of the TGVDenoise tool
The TGVDenoise tool has two separate sections: noise reduction parameters at the top side, and local support parameters at the bottom side. While we write an official documentation, let's describe briefly these sections and their corresponding parameters.Noise Reduction Parameters
* Color working mode.
For color images, TGVDenoise provides two working modes: RGB/K and CIE L*a*b*. In RGB/K mode, the same set of parameters is applied to each nominal RGB channel, for color images, or to the nominal grayscale channel, for monochrome images. Note that for grayscale images the color working mode is irrelevant.
In CIE L*a*b* mode, the target image is first converted to the CIE L*a*b* color space. Lightness parameters (first tab) are then applied to the CIE L* component, and chrominance parameters (second tab) are applied to the CIE a* and b* components. Finally, the image is converted back to the RGB space. This mode allows you to apply a different (usually more aggressive) noise reduction procedure to the chrominance, which makes the tool more flexible and adaptable to a variety of typical denoising problems. You can disable one of the parameter sets, so you can apply noise reduction just to either the lightness or chroma components.
This parameter controls the strength of the diffusion
process that smoothens the image. Large values are more aggressive, while small values tend to give results that are more similar to the original image. You have to find a good balance between the strength and edge protection parameters (see below).
* Edge protection
This is by far the most critical parameter of the TGVDenoise tool. This parameter works as a threshold for the regularization process, preventing diffusion over edge features stronger than the threshold value. Hence, you use this parameter to prevent the noise reduction process from damaging significant image detail and features. Smaller values are more aggressive to protect edges against blurring caused by the diffusion process. Larger values are more permissive and lead to smoother images, but may cause some detail loss.
Controls the continuity degree of smooth regions. Smaller values tend to preserve small-scale structures such as sharp edges, but also may generate staircase artifacts. The default value of 2 usually works well with most images, and you normally won't need to change it.
TGVDenoise emulates a diffusion process, following a dynamic evolution scheme. Each iteration can be seen as a time sample, where the image reaches a new state. The process converges to an optimal solution when no significant diffusion can happen between neighbor pixels. This usually requires a large number of iterations. Convergence is evaluated by calculating the norm of the difference between two consecutive iteration steps. This is an estimate of global error, or mean square change
. Usually, once this difference drops below 1/255, little or no changes can be perceived in the displayed image.
Upon execution, TGVDenoise writes its final global error estimate to the console as a 'delta' value. You can watch these estimates to get an idea of how well the process is converging to an acceptable result. The default value of the iterations parameter (100 iterations) is a good starting point for most images.
* Automatic convergence
When automatic convergence is enabled, the process will be stopped if either the difference between two successive iterations (see the iterations parameter above) is smaller than the convergence parameter (see below), or if the maximum number of iterations is reached; whichever happens first. If this parameter is disabled, the specified number of iterations will always be performed, ignoring the convergence parameter.
Be aware that when automatic convergence is enabled, the TGVDenoise process is not previewable
. In other words, since convergence is specific to the data being processed, there is no guarantee that the result obtained on a preview be the same as the result obtained on its mother image with the same parameters. Depending on the image, the differences can be significant. For this reason the automatic convergence parameter is disabled by default.
When automatic convergence is enabled, the TGVDenoise process will be stopped when the difference between two successive iterations becomes smaller than this value. See the information given for the iterations and automatic convergence parameters.Local Support Parameters
A local support image changes the rate of the diffusion process, creating a spatially dependent function. This allows to better preserve high SNR areas, or to protect specific image edges. For deep-sky astronomical images, a local support is advisable to achieve optimal results, especially for linear images.
It is very important to point out that the local support image is not
a mask. The support image should represent the signal-to-noise ratio of the target image, where higher pixel values will provide stronger protection. This effectively controls the dynamic properties and evolution of the TGV regularization process, but does not work by mixing processed and unprocessed pixels, so it has nothing to do with a mask. Of course, the TGVDenoise process is fully maskable, so you can apply it through a mask if you find it necessary, in addition to using (or not) a local support image.
Enable this option to get a preview of the working local support image that will be used by TGVDenoise. This is a control mode that must be disabled to perform an actual noise reduction process.
* Support image
By default, the local support image is disabled. TGVDenoise performs outstandingly well for most images without the help of a local support. When enabled, the local support is the intensity component (in the HSI color system) of the target image by default, but you can select any grayscale image with the same geometry as the target view (or its mother image in the case of a preview). When SNR is proportional to illumination, as happens with deep-sky images, a local support can be of great help to drive the TGVDenoise process, as noted above.
* Noise Reduction
This is the number of small-scale wavelet layers that will be removed from the working local support image. For very noisy images, smoothing the local support may help to achieve more accurate results because this makes it less dependent on spurious small-scale variations.
This is the midtones balance parameter of a histogram transformation that will be applied to the working local support image. Use it to fine tune protection on moderately bright areas.
This is the shadows clipping point parameter of a histogram transformation that will be applied to the working local support image. Increase it to decrease protection on dark areas.
This is the highlights clipping point parameter of a histogram transformation that will be applied to the working local support image. Decrease it to increase protection on bright areas.Important Notes
* TGVDenoise is a memory intensive process. Internally it requires 13 working duplicates of one channel of the target image in 32-bit floating point format, so it may easily cause out-of-memory errors on the 32-bit version of PixInsight for Windows. If this happens to you, the only solution is a 64-bit version of PixInsight running on a 64-bit operating system.
* TGVDenoise is processor-intensive. We have done our best to achieve the best optimized parallel implementation we are capable of, but despite this, the algorithm requires significant processing time for moderately large images. Since the process is fully previewable (please note: if the automatic convergence parameter is disabled), you should use relatively small previews defined on special interest areas of the image to find an optimal set of parameters, which you can apply to the whole image after testing them thoroughly.
* The strength, edge protection and smoothness parameters have been implemented as exponential controls
on the TGVDenoise interface. We have already used exponential controls in the AdaptiveStretch tool. These controls allow you to work in scientific notation
, which gives you quick and easier control for parameters with very large ranges. Each parameter is divided into four fields that work in tandem: a large edit field where you can enter the parameter's value directly, a small edit field to enter the coefficient in the range from 1 to 9.99, a slider to change the coefficient value with the mouse, and a spin box where you can define the exponent. In future versions of the TGVDenoise tool, most of these parameters will probably be implemented differently, once we improve our knowledge of their practical ranges.References
 Florian Knoll, Kristian Bredies, Thomas Pock and Rudolf Stollberger. Second order total generalized variation (TGV) for MRI
. Magnetic Resonance in Medicine 65(2):480-491, 2011.
 Kristian Bredies, Karl Kunisch and Thomas Pock. Total generalized variation
. SIAM Journal on Imaging Sciences, 3(3):492-526, 2010.
 Kristian Bredies. Recovering piecewise smooth multichannel images by minimization of convex functionals with total generalized variation penalty
. Submitted for publication, 2012.
 Kristian Bredies, Yiqiu Dong and Michael Hintermüller. Spatially dependent regularization parameter selection in total generalized variation models for image restoration
. Submitted for publication, 2012.
 Chambolle, A., Pock, T. A first-order primal-dual algorithm for convex problems with applications to imaging
. J. Math. Imaging Vis. 40, 120–145, 2011.