# Total Variation¶

This section deals with an iterative reconstruction algorithm (hence, different from the filtered back projection), that solves the minimization problem

```
x = argmin 1/2||H x - y||^2 + beta_tv TV(x)
```

where:

x is the image to be reconstructed

H is the projection matrix

y is the sinogram

TV(x) is the total variation semi-norm of x, that is, the l1 norm of its gradient

beta_tv is a parameter controlling the relative importance of the two terms in the minimization

This algorithm tends to reconstruct piecewise-constant images. It is therefore suitable for images with a limited number of phases, such as many images in materials science. It is not suited, however, for images with a very irregular texture, or for images with smooth large-scale gradients.

The following documentation has been extracted automatically from the comments found in the source code. Discard Parameters. object variable.

class`Parameters_module.`

`Parameters`

¶The input variables are read from the input file. The input file is written with python syntax. The Input file is interpreted as python after a preprocessing The preprocessing was introduced at the time of HST-> PYHST transition to maintaing compatibility with:

NO/YES meaning 0/1

items containing FILE in their name can be initialized without using the “” which are otherwise necessary for strings

The input file has to set (some of) the following variables. To setup easily an input file you are suggested to start from one of the examples given in the doc.

`BETA_TV`

= 1.0¶

When DENOISING_TYPE=1, the beta entering in the below formula :

\[\frac{1}{2} \left\| Sino - P \cdot Slice \right\|_2^2 + \beta \, TV(Slice)\]whose value is minimized by the iterative procedure

When DENOISING_TYPE=4, the beta of the paper http://arxiv.org/abs/1305.1256

`DENOISING_TYPE`

= 1¶

- The kind of denoising used at each step of iterative correction :

DENOISING_TYPE=1 -> TV denoising (translated to gpu from Emmanuelle Gouillart https://github.com/emmanuelle/tomo-tv/)

related parameters : ITERATIVE_CORRECTIONS, DO_PRECONDITION=1, BETA_TV, N_ITERS_DENOISING, DUAL_GAP_STOP,

DENOISING_TYPE=4 -> Dictionary patching with Overlapping Patches using FISTA + L1 norm. Following http://arxiv.org/abs/1305.1256

related parameters : ITERATIVE_CORRECTIONS, BETA_TV, WEIGHT_OVERLAP, PATCHES_FILE, STEPFORPATCHES

DENOISING_TYPE=5 and ITERATIVE_CORRECTIONS>0 -> NN-FBP: Reconstruct using a trained NN-FBP network

related parameters : NNFBP_FILTERS_FILE, NNFBP_NLINEAR

DENOISING_TYPE=6 and ITERATIVE_CORRECTIONS>0 -> NN-FBP: Create a training set to train a NN-FBP network

related parameters : NNFBP_TRAINING_PIXELS_PER_SLICE, NNFBP_TRAINING_RECONSTRUCTION_FILE, NNFBP_NLINEAR,NNFBP_FILTERS_FILE , NNFBP_TRAINING_USEMASK, NNFBP_TRAINING_MASK_FILE , NNFBP_NHIDDEN_NODES

DENOISING_TYPE=8 -> Wavelet regularization

related parameters : W_WNAME, W_LEVELS, W_FISTA_PARAM, W_CYCLE_SPIN, W_SWT

`DO_PRECONDITION`

= 1¶the preconditioning of the backprojector is turned off by default. Set it to zero if you want to perform filtered-backprojections in the iteration loops. Mind that BETA_TV will be much different than in the usual case ( much smaller)

`DUAL_GAP_STOP`

= 5e-07¶the stop criteria for DENOISING_TYPE=1

`FISTA`

= 1¶the update of the slice, in the iterative procedure, is done with FISTA

`ITERATIVE_CORRECTIONS`

= 0¶The number of iterative correction loops. If zero no iterative correction (default).

`N_ITERS_DENOISING`

= 500¶The number of iterations when DENOISING_TYPE=1, for the denoising procedure. For DENOISING_TYPE=1 it is the maximum number of iterations, the stop criteria being dual gap.

`OPTIM_ALGORITHM`

= 1¶

- the algorithm that solves the convex optimization problem :

1 : FISTA (with or without smooth penalty depending on PENALTY_TYPE)

2 : Modified conjugate gradient algo. PENALTY_TYPE MUST be set to 1.

3 : Chambolle-Pock algorithm ( Only with total variation )

5 : Conjugate SubGradient Algorithm (only with dictionary learning)