# Predefined contrasts in folder "incontrasts"

Reference to the predefined contrasts in folder "incontrasts" and their usage in the computational framework.

## Contents

- Syntax
- Description
- Input Arguments
- Output Arguments
- Examples in 2D
- List of all predefined Contrasts
- Usage in computational framework
- References

## Syntax

Example of syntax for a ball in 2D and 3D. You can find a list of all predefined contrasts below.

    q = referenceBall2D(X1,X2,seti)     % 2D
    q = referenceBall3D(X1,X2,X3,seti)  % 3D

## Description

`q = referenceBall2D(X1,X2,seti)` evaluates the contrast in the full grid described by X1 and X2 and stores it as a vector 1 x n. Note that X1 and X2 are produced with meshgrid, but stored as vectors 1 x n.

`q = referenceBall3D(X1,X2,X3,seti)` evaluates the contrast in the full grid described by X1, X2 and X3 and stores it as a vector 1 x n. Note that X1, X2, and X3 are produced with meshgrid, but stored as vectors 1 x n.

## Input Arguments

- X1, X2, (X3) : coordinate arrays X1, X2, and X3 (last one in 3D case) (vectors of size 1 x seti.nROI^seti.dim)
- seti : struct for additional input, e.g. contrast value `seti.qBall` for ball, radius `seti.rBall` for ball.

## Output Arguments

- q : contrast evaluated on the region of interet (ROI) stored as vector 1 x n.

## Examples in 2D

Triangle in 2D

For this example make sure to be in the folder code/incontrasts/2D.

    % Prepare a grid
    h = 0.016;
    r = 0.2;
    x1 = (-r:h:r-h);
    [X1,X2] = meshgrid(x1,x1);
    X1 = transpose(X1(:));
    X2 = transpose(X2(:));

    % Evaluate predefined contrast corner2D on the grid an plot result
    seti.rCD = 2*r;
    q = triangle2D(X1,X2,seti);
    l = length(x1);
    qMatrix = reshape(q,[l l]);
    imagesc(real(qMatrix)); axis xy; colorbar;

Ball in 2D

For this example make sure to be in the folder code.

    % add all pathes of rebis (needed in case of checkfield)
    init;

    % Prepare a grid
    h = 0.016;
    r = 0.2;
    x1 = (-r:h:r-h);
    [X1,X2] = meshgrid(x1,x1);
    X1 = transpose(X1(:));
    X2 = transpose(X2(:));

    % set strcut seti
    seti.qBall = 0.8;
    seti.rBall = 0.1;

    % Evaluate predefined contrast referenceBall2D on the grid an plot result
    q = referenceBall2D(X1,X2,seti);
    l = length(x1);
    qMatrix = reshape(q,[l l]);
    imagesc(real(qMatrix)); axis xy; colorbar;

## List of all predefined Contrasts

- q is the contrast value of the described obstacle.
- Imaginary part of contrast is in all predefined contrasts is 0, if nothing other is mentioned.

Folders in incontrasts:

- 2D: several two dimensional predefined contrasts.
- 2DFresnel: two dimensional predefined contrasts fitting to some of the real-world data from Institute Fresnel.
- 3D: several three dimensional predefined contrasts.

Predefined contrasts in 2D

Folder: incontrasts/2D

String | Description
empty2D | Empty contrast with q = 0 everywhere (to test)
corner2D | Corner top and left line with q = 1
cornerBallSparse2D | Non-constant corner, ball (filled circle) and broken corner Corner with non-constant contrast q Ball with q = 1 Broken corner with q = 1 (corner consisting of squares and a thin line - very sparse)
cornerBallSparseMod2D | Non-constant corner, ball (filled circle) and broken corner Same as cornerBallSparse2D, but rotated 180 degrees.
cross2D | Cross with q = 1
rectangle2D | Rectangle with q = 0.5
referenceBall2D | Ball (filled circle) with contrast value q = seti.qBall (default: 0.8) and radius seti.rBall (default: 0.015)
referenceBallSmooth2D | Smooth ball (filled circle) with contrast value seti.qBall and radius seti.rBall
shepp2D | Modified Shepp-Logan phantom from MATLAB
triangle2D | Trianlge with q = 0.8
twoCorners2D | Two corners with q = 1
twoCornersOneBall2D | Two corners and one ball Two corners with q = 0.8 Ball with q = 1

Predefined contrasts in 2D corresponding to real-world data from Institute Fresnel

Folder: incontrasts/2DFresnel

The obstacles corresponds to the described ones in [1].

Note that dielectricum means that the imaginary part of the contrast vanishes.

String | Description
fresnel_op1_dielTM | One dielectric cylinder Contrast value q = 2 + 0 i. Ball with radius 15 mm Distance of center of the ball from origin is approximately 30 mm. (Note: Position was manually corrected.)
fresnel_op1_twodielTM | Two dielectric cylinders Contrast value q = 2 + 0 i. Balls with radius 15 mm Distance of center of the balls from origin is approximately 45 mm. (Note: Position was manually corrected.)
fresnel_op1_rectTM_cent | Rectangle (experimentally!) This obstacle is experimentally and may contain errors, because the contrast value is assumed because reconstruction. The obstacle is out of metal, i.e. the refractive index is highly dependent on wavelength. Metal is perfectly conducting, i.e. the imaginary part is infinity. In a first approach we assume the contrast value q = 0.5 + 1E6 i. (Note: This contrast is experimentally.)

Predefined contrasts in 3D

String | Description
empty3D | Empty contrast with q = 0 everywhere (to test)
corner3D | Corner (tripod) first horizontal arc with q = 1.0, second horizontal arc with q = 0.8, vertical horizontal arc with q = 0.6.
cross3D | Cross first horizontal bar: q = 0.8, second horizontal bar with q = 0.6, vertical bar with q = 1.0.
referenceBall3D | Ball with contrast value q = seti.qBall (default: 0.8) and radius seti.rBall (default: 0.015).
twoTripods3D | Two tripods all arcs with q = 1.0.
cubeLike3D | Edges of a cube with contrast value q = 1.

## Usage in computational framework

Usage of predefined contrasts in computational framework

Syntax

    seti.contrast = str;

Description

`seti.contrast = str` uses the contrast defined in function `str`.

- `seti.contrast` is defined in a file in folder `inseti`.

Example

Define in inseti/example.m: (see example.html)

    seti.contrast = 'cornerBallSparse2D';

## References

- [1] Kamal Belkebir and Marc Saillard. Special section on testing inversion algorithms against experimental data. Inverse Problems, 17(6):1565-1571, 2001. URL: https://doi.org/10.1088/0266-5611/17/6/301.