# shrinkage

In this routine the actual step in thresholded, nonlinear Landweber scheme by the extended soft-shrinkage operator.

## Contents

- Syntax
- Description
- Input Arguments
- Output Arguments
- More About
- See Also
- Code

## Syntax

    qROI = shrinkage(seti,qROIPrev,stepsize,ADFFq)

## Description

`qROI = shrinkage(seti,qROIPrev,stepsize,ADFFq)` uses the extended soft-shrinkage operator, that is available as `seti.shrkRe` and `seti.shrkIm` to update the contrast `qROIPrev` to `qROI` using a given step size `stepsize` and adjoint of the Fréchet derivative applied to the defect. It is also possible to scale the grid down for this step and scale it up afterwards.

## Input Arguments

- `seti` : Structure array (mutable data structure of IPscatt). The most important fields for soft-shrinkage are explained below.
- `qROIPrev` : Contrast of previous step.
- `stepsize` : step size of the thresholded, nonlinear Landweber scheme, see minShrink.html.
- `ADFFq` : Adjoint of the Fréchet derivative applied to the defect, see mimo.html, adjOfDer.html.

We only consider fields of `seti` that are relevant for the routine `shrinkage`.

Fields of `seti` for Extended Soft-Shrinkage

- `seti.shrkRe` : Soft-shrinkage of real part, see shrinkFuncs.html.
- `seti.shrkIm` : Soft-shrinkage of imaginary part, see shrinkFuncs.html.
- `seti.alpha` : Regularization parameter for sparsity penalty, see setInvType.html.

Fields of `seti` for Grid Scaling

- `seti.gscale` : Grid scaling on (1) or off (0), see setGridScale.html.
- `seti.GU` : Function to scale up the grid, see setGridScale.html.
- `seti.GD` : Function to scale down the grid, see setGridScale.html.

Fields of `seti` for Wavelets, see setWavelet.html

- `seti.useWavelet` : Use wavelets (1) or not (0) (default: 0), see also checkConsisRec.html.
- `seti.wW`
- `seti.wWi`
- `seti.wiW`
- `seti.wiWi`
- `seti.omegaW1p`

## Output Arguments

`qROI` : New reconstruction of the contrast.

## More About

The soft-shrinkage operator and the extended soft-shrinkage operator are explained in shrinkFuncs.html

## See Also

- shrinkFuncs.html
- minShrink.html
- setGridScale.html
- gridDown.html
- gridUp.html

## Code

    function qROI = shrinkage(seti,qROIPrev,stepsize,ADFFq)

    GU = seti.GU;
    GD = seti.GD;

    if seti.useWavelet == 1
        WqROIPrev = seti.wW(qROIPrev);
        qNew = WqROIPrev - stepsize*ADFFq; % is WqNew in case of wavelet
    else
        qNew = qROIPrev - stepsize*ADFFq;
    end
    % qROI = qNew;

    if seti.useWavelet == 1 && seti.gscale == 1
        GDqNew = seti.wWi(GD(seti.wiW(qNew)));
        % Grid scaling is only in pixel basis useful.
        % Transform it with wWi back into wavelet basis.
    else
        GDqNew = GD(qNew);
    end

    if isfield(seti,'wavIsom') && strcmp(seti.wavIsom,'W1p') && isfield(seti,'omegaW1p')
        % qROI on small grid
        % qROI is WqROI in case of wavelet
        qROI = seti.shrkRe(real(GDqNew), seti.alpha*seti.omegaW1p*stepsize) ...
               + 1i*seti.shrkIm(imag(GDqNew), seti.alpha*seti.omegaW1p*stepsize);
    else
        qROI = seti.shrkRe(real(GDqNew), seti.alpha*stepsize) ...
               + 1i*seti.shrkIm(imag(GDqNew), seti.alpha*stepsize);
    end
    clear GDqNew;

    %qROI = seti.shrkRe(real(qNew), seti.alpha*stepsize) ...
    %          + 1i*seti.shrkIm(imag(qNew), seti.alpha*stepsize);

    %WqROI = GU( seti.shrkRe(real(qNew), seti.alpha*stepsize) ...
    %                + 1i*seti.shrkIm(imag(qNew), seti.alpha*stepsize) );
    %WqROI = seti.shrkRe(real(qNew), seti.alpha*stepsize) ...
    %        + 1i*seti.shrkIm(imag(qNew), seti.alpha*stepsize);

    if seti.useWavelet == 1 && seti.gscale == 1
        qROI = GU(seti.wiWi(qROI)); % weights on small ROI
    elseif seti.useWavelet == 1 && seti.gscale == 0
        qROI = seti.wiW(GU(qROI)); % weights on full ROI
    else % seti.useWavelet == 0
        qROI = GU(qROI);
    end
    clear qNew;

    end