Part 3: flat-field normalization¶
Flat-field normalization of the radios is usually the fist step of the processing chain.
1. What is Flat-field normalization¶
Flat-field is a normalization step which "corrects" for the incoming beam intensity.
Remember that in absorption tomography (in the ideal monochromatic beam setting), the beam intensity decays through the sample between positions $[x_0, x]$ as a Lambert-Beer law:
$$ I(x) = I_0 \exp \left( -\displaystyle\int_{x_0}^x \mu(l) \operatorname{d}\! l \right) $$
and we aim at "reconstructing" the linear absorption coefficient $\mu(x)$ from line integrals:
$$ -\ln\left(\dfrac{I(x)}{I_0} \right) = \displaystyle\int_{x_0}^x \mu(l) \operatorname{d}\!l $$
(the same kind of equation holds for phase-contrast tomography).
$$ -\ln\left(\dfrac{I(x)}{I_0} \right) = \displaystyle\int_{x_0}^x \mu(l) \operatorname{d}\!l $$
$I_0 = I(x=0)$ is the incoming beam intensity, which has to be recorded alongside the "projections" $I(x)$.
As detectors are not ideal, they record a background noise ("dark current") even without beam. This dark image has to be subtracted from the incoming intensity.
$$ \dfrac{I}{I_0} = \dfrac{P - D}{F - D} $$ where $P$ is the projection image recorded on detector, $D$ is the dark image, and $F$ is the flat image ($F = I_0 + D$)
2. How Flat-field normalization is done¶
The normalized intensity at index $k$, $I_n (k)$ is given by
$$ I_n (k) = \displaystyle\dfrac { I (k) - D } { F (k) - D } $$
where $I (k)$ is the raw projection number $k$, $F (k)$ is the flat corresponding to radio $k$, and $D$ is the detector dark-current.
For practical reasons, it's not possible to record one flat image (and one dark image) for every projection.
Usually there is not as many flats as radios, so $F (k)$ is obtained by linear interpolation:
F(k1) I(k) F(k2)
------|--------|-------|------ ...
$$ F(k) = \dfrac{k_2 - k}{k_2 - k_1} F_{k_1} + \dfrac{k - k_1}{k_2 - k_1} F_{k_2} $$
Usually, in a tomo acquisition, the acquisition scheme is the following:
- Darks
- Flats
- Projections
- (optionally) Flats
3. "Reduced" flats and darks¶
When doing a scan, series of flats/darks are acquired.
Example sequence:
- Acquire 50 darks
- Acquire 100 flats
- Acquire 10 000 projections
- Acquire 100 flats
Each series of flats/darks is reduced to obtain one image (per sequence).
In the previous example:
- 50 darks ------> mean ---> one dark image
- 100 flats -----> median ---> one flat image
- 10 000 projs
- 100 flats -----> median ---> one flat image
In the previous acquisition/processing system (octave-fasttomo), the resulting files were called dark0000.edf
, refHST<num>.edf
In nabu/tomwer, the reduced flats/darks are called <dataset_prefix>_darks.h5
and <dataset_prefix>_flats.h5
These final (reduced) frames are used for flat-field normalization.
Example (1/5)
Principle:
Example (2/5)
Bliss file layout
Example (3/5)
Bliss file layout with data
Example (4/5)
NXTomo file layout
Example (5/5)
image_key_control
field in NXTomo file
In the NXTomo convention:
- 2 = dark
- 1 = flat
- 0 = projection
How nabu does the flats/darks reduction¶
Before computing the mean/median of darks/flats, nabu/tomwer will first attempt to load them (to avoid re-computations).
Nabu will
- Try to load from
darks_flats_dir
(in[preproc]
of the configuration file), if specified - Try to load the
<dataset>_darks.h5
and<dataset>_flats.h5
files if they are alongside the dataset - Try to load them from the output reconstruction directory
4. Possible flat-field modes with nabu¶
In the configuration file (section [preproc]
), the paramter flatfield
can have these possible values:
flatfield = 1
or True (default): do flat-field normalization with the frames from the datasetflatfield = 0
or False: no flat-field normalizationflatfield = force-load
: perform flatfield regardless of the dataset by attempting to load darks/flatsflatfield = force-compute
: perform flatfield, ignore all .h5 files containing already computed darks/flats
5. Synchrotron current normalization¶
Sometimes a beam refill happens during an acquisition.
Depending on how flats are acquired, flat-fielding might not correct for the incoming beam intensity jump.
This is especially detrimental for half-tomography, as projections at $\theta$ and $\theta + 180°$ will not have the same incoming intensity.
When information on synchrotron current (SRCurrent) is available, it's possible to normalize each with this current, according to
$$ P' = \dfrac{P - D}{s/s_{Max}} + D $$
where $s$ is the synchrotron current for the current frame, $s_{Max}$ is the max current, and $D$ is the dark frame.
In nabu, the current normalization is done during flat-field:
$$ \dfrac{P' - D}{F' - D} = \dfrac{(P - D)/s_P}{(F - D)/s_F} $$
To enable it:
[preproc]
# ...
normalize_srcurrent = 1
# ...
Since version 2024.1.0, SRCurrent normalization is enabled by default.