# ExponentialFitCorrection

Exponential fit based attenuation correction

## SYNOPSIS

`#include "dip_microscopy.h"`

dip_Error dip_ExponentialFitCorrection ( in, out, method, percentile, fromWhere, hysteresis, varWeighted )

## DATA TYPES

binary, integer, **float**

## FUNCTION

This routine implements a simple absorption, reflection and bleaching
correction based upon the assumption that the sum of these effects result
in a exponential extinction of the signal as a function of depth. Only
pixels that are non-zero are taken into account.
Depending upon the chosen method, the mean or a percentile of all the non-zero
pixels are calculated as a function of the slice number (depth).
Then an exponential function is fitted
through these slice-representing values. The starting point of the fit is
determined by fromWhere. The first maximum is found with
point[z+1] > hysteresis * point[z].
If the mean variant is chosen one can chose to apply a variance weighting
to the fit.

## ARGUMENTS

**Data type** | **Name** | **Description** |

`dip_Image` | `in` | Input image |

`dip_Image` | `out` | Output image |

`dipf_ExpFitData` | `method` | Data statistic to fit on |

`dip_float` | `percentile` | Percentile |

`dipf_ExpFitStart` | `fromWhere` | From where to start the fit |

`dip_float` | `hysteresis` | First maximum hysteresis |

`dip_Boolean` | `varWeighted` | Fit with variance weights |

The `dipf_ExpFitData` enumaration consists of the following flags:

**Name** | **Description** |

`DIP_ATTENUATION_EXP_FIT_DATA_MEAN` | Fit on the mean values |

`DIP_ATTENUATION_EXP_FIT_DATA_PERCENTILE` | Fit on the specified percentile of the data |

The `dipf_ExpFitStart` enumaration consists of the following flags:

**Name** | **Description** |

`DIP_ATTENUATION_EXP_FIT_START_FIRST_PIXEL` | Start fit on first pixel |

`DIP_ATTENUATION_EXP_FIT_START_GLOBAL_MAXIMUM` | Start fit on global maximum |

`DIP_ATTENUATION_EXP_FIT_START_FIRST_MAXIMUM` | Start fit on first maximum |

## LITERATURE

K.C. Strasters, H.T.M. van der Voort, J.M. Geusebroek, and A.W.M. Smeulders,
*"Fast attenuation correction in fluorescence confocal imaging:
a recursive approach"*, BioImaging, vol. 2, no. 2, 1994, 78-92.

## AUTHOR

Karel Strasters, adapted to DIPlib by Geert van Kempen.

## SEE ALSO

`AttenuationCorrection`, `SimulatedAttenuation`