Part 4: removing rings artefacts¶
Rings artefacts can have many causes. They are detrimental for steps following reconstruction (e.g. segmentation).
In Nabu, two types of rings correction methods are available:
- Projections-based: "double flat-field"
- Sinogram-based: "sinogram deringer"
Volume-based rings corrections is not available yet.
Preparing the dataset¶
We will use another dataset (but still bamboo!) where plain reconstruction yields rings artefacts.
/data/projects/tomo-sample-data/training/part4_rings/bamboo_rings.nx
Create a new directory and a new nabu configuration file:
mkdir my_dir
cd my_dir
nabu-config --dataset /data/projects/tomo-sample-data/training/part4_rings/bamboo_rings.nx
Perform a first reconstruction: nabu nabu.conf --slice middle
and visualize it.
1 - Projections-based rings removal ("double flat-field")¶
This method consists in two steps:
- Compute a "mean projection" image
dff
- Divide each projection with this mean projection
In python:
dff = projections.mean(axis=0) # sum the 3D stack over the angles
projections /= dff # divide each projection with this image
Hopefully, when computing the "mean projection" dff
, the sample-dependent features cancel out, and only the systematic noise remains. Thus, dividing the projections with dff
will remove the systematic noise.
Needless to say, quantitativeness is lost when using this method!
In the configuration file, the parameter to use is double_flatfield_enabled
in section [preproc]
:
# ...
[preproc]
double_flatfield_enabled = 1
# ...
(this option corresponds to DOUBLEFFCORRECTION
in PyHST2)
Exercise¶
- Modify the nabu configuration file to enable double flatfield
- Run the reconstruction of one slice and visualize it.
- Compare both reconstructions.
Advanced parameters¶
Sometimes, averaging projections along the angles is not enough to cancel out the sample-dependent features.
Some low-frequency signal still remains, which may give rings artefacts even after DFF.
One possible solution is to apply a high-pass filter on the DFF image, using an unsharp mask with tunable strength dff_sigma
.
# ...
[preproc]
# Whether to enable the 'double flat-field' filetering for correcting rings artefacts.
double_flatfield_enabled = 1
# Enable high-pass filtering on double flatfield with this value of 'sigma'
dff_sigma = 0.8
# ...
Pre-computing the DFF¶
The DFF image can be pre-computed once and for all for the current dataset, with the command nabu-double-flatfield <dataset>
.
A HDF5 file is generated, it contains the DFF image. It can be provided to the processes_file
parameter of the nabu configuration file:
# ...
[preproc]
processes_file = /path/to/my/dff.h5
# ...
Exercise¶
- Generate the DFF file:
nabu-double-flatfield /data/projects/tomo-sample-data/training/part4_rings/bamboo_rings.nx /path/to/my/dff.h5
- This takes a while! To monitor progress, you can use the
--loglevel debug
option.
- This takes a while! To monitor progress, you can use the
- Edit the nabu configuration file to use "
dff.h5
" as aprocesses_file
. - Run the reconstruction, visualize the reconstructed slice(s)
2 - Sinogram-based rings removal¶
As of version 2024.1.0, there are three deringers acting on sinogram in nabu:
- Fourier-Wavelets
- Vo
- Mean-subtraction
2.1 - Fourier-Wavelets rings removal¶
This method is an implementation of the paper [munch09]
, hereby called "Munch filter".
It consists in doing a wavelets decomposition of the sinogram, examine the "vertical coefficients" to detect vertical lines, and filter them out.
[munch09] B. Munch, P. Trtik, F. Marone, M. Stampanoni, Stripe and ring artifact removal with
combined wavelet-Fourier filtering, Optics Express 17(10):8567-8591, 2009.
In Nabu, this rings removal method is enabled using sino_rings_correction = munch
in [preproc]
:
[preproc]
sino_rings_correction = munch
Exercise¶
- Edit the nabu configuration file to use this method
- Reconstruct and visualize the result
Advanced parameters¶
The method from paper [munch09]
has some parameters which can be tuned: "sigma" (gaussian filter strength), "levels" (number of wavelets decomposition levels), and "wname" (name of the wavelet filter).
As a rule of thumb:
- Higher values of
sigma
means more filtering - Higher values of
levels
might yield artefacts, especially in the center (since the filtering occurs accross more wavelets scales, it is more prone to inversion issues) - Changing the wavelet filter
wname
has less impact
These advanced options are passed through the sino_rings_options
parameter in [preproc]
section. The syntax is the following:
[preproc]
sino_rings_correction = munch
sino_rings_options = sigma=1.0 ; levels=10; wname='db15'; padding=True # mind the semicolon separator
These parameters correspond to FW_SIGMA
, FW_LEVELS
and FW_WNAME
in PyHST2.
Padding can be used in local tomography, where the wavelets filtering can yield edge effects.
2.2 - Vo rings removal¶
Nabu ships the rings artefacts removal techniques from Nghia Vo described in
Nghia T. Vo, Robert C. Atwood, and Michael Drakopoulos, "Superior techniques for eliminating ring artifacts in X-ray micro-tomography," Opt. Express 26, 28396-28412 (2018)
and more precisely its tomocupy implementation.
To enable it in nabu:
[preproc]
sino_rings_correction = vo
The default options are the following:
sino_rings_options = snr=3.0; la_size=51; sm_size=21; dim=1
please refer to algotom remove_all_stripe()
for their meaning.
2.3 - Mean subtraction rings removal¶
A very simple deringer, yet often efficient, is to subtract a curve from each line of the sinogram.
In the simplest case, this curve can be the mean of all projections.
In short: sinogram = sinogram - sinogram.mean(axis=0)
.
Usually it's good to high-pass filter this curve to avoid low-frequency effects in the new singoram.
To enable it in nabu:
sino_rings_correction = mean-subtraction
The default options are the following:
sino_rings_options = filter_cutoff=(0, 30)
Exercise¶
Try the different rings removal methods
2 - Rings artefacts removal using tomwer¶
The same options are available from the nabu slice
interface from tomwer
this is available from the pre processing
stage