A_posteriori_shading_correction_514_v3


Aim:
Correction of multiplicative shading, due for instance to uneven illumination.
No other image (background, illumination, etc) is required, as for other ImageJ plugins.

History:
April 2003: Development of the plug-in by Maxime Pinchon.
August 2004: Version 1 available on the Web
September 2004: Improvement of the output image (larger dynamics). Version 2. Thanks to Joel Sheffield.
June 2005: Extensions by Laetitia Pasquet (v3= version 3), after suggestions by Gabriel Landini:
The plug-in is extended to work with 16 or 32 bit-images and RGB color images. An automatic version is proposed, without guarantee (because the selected markers are not constrained to be in the background). The polynomial is no more constrained to be of order 2. The polynomial degrees along X and Y are chosen by the user, up to 5.

Method:
The user has to choose the automatic version (click in the appropiate position (see below) and choose the positions of the reference points) or the semi-automatic version. If nothing is clicked, the user is assumed to choose the semi-automatic version.



Automatic version:
The markers are regularly spread over the image (without any guarantee that they belong to the background). So, this method is to be used with care.



Semi-automatic version:
The user has to click on several (at least 6, better someting like 10 or 12) positions assumed to belong to the "background". The positions and gray levels at these points will serve to model the background, and thus the illumination.

For this purpose, a new toolbar is created at the beginning of the plug-in run:
menu_shading
Items of the toolbar (1 to 5 from left to right):
1: start clicking
2: move point
3: delete last clicked point
4: coordinates of clicked points
5: starts computation

In both modes:
The program computes a background model according to the degrees of the polynome chosen by the user.
For instance,  a second order polynomial along X and Y is modelled as: B(x,y)=a0 + a1.x + a2.y + a3.x^2 + a4.y^2 + a5.x.y



The raw image is divided by the estimated background.

Miscellaneous:
When the graphic mouse leaves the image window, this window may move behind others and become hidden by these ones. It is thus recommended to maintain the mouse within the image window or to reduce the size of others windows.


Illustration (semi-automatic mode):
bacter_shade
Original, shaded, image.
points_shading
Selected points
Estimated_shading
Illumination model
Corected_shading
Corrected image. Note that parts of the original image with a value equal to 0 (in the upper left and in the lower right corners) cannot be restored.