# DICTIONARY LEARNING¶

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)

`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)

`PATCHES_FILE`

= 'patches.h5'¶In the case DENOISING_TYPE=4, the file where square patches are found. It is a hdf5 file containing a 5D dataset named /data. The dimesions of this dataset are :

number of patches

number of vectorial components ( 1 for normal thomography, 2 for phase gradient reconstruction)

z dimension of a patch ( 1 if you are doing slice by slice regularisation)

y dimension

x dimension

The z dimension must be odd ( 1, 3 or more ). if it is n with n>1, n slices will be reconstructed and regularised at the same time and the middle one will be taken. The patches can be generated using :

git clone https://gitlab.esrf.Fr/mirone/ksvd

`STEPFORPATCHES`

= 2¶Determines the degree of overlapping between patches. If bigger then patch size then patches are only contiguous. At the other limit, when the step is one the overlapping is maximum.

`VECTORIALITY`

= 1¶Let this always to 1 unless you are doing differential phase tomography. In this case the sinogram data must be the horizontal displacement of the beam, which is a measure of the phase gradient parallel to the detector horizontal axis. PyHST2 reconstructs in this case two images, one obtained by multiplying the data by cosinus(angle) , the other by sinus(angle). Make sure in this case that ZEROCLIPVALUE is set to a large negative value or your (multiplied) data will be clipped. If you use this option with Dictionary learning, provide a vectorial dictionary (key DERIVATIVES: 1 in the yaml input file for ksvd program which generates the patches )

`WEIGHT_OVERLAP`

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