A BaSiC Tool for Background and Shading Correction of Optical Microscopy Images

BaSiC is a retrospective image correction method for optical microscopy, available as a Fiji/ImageJ Plugin. It is based on low rank and sparse decomposition, which corrects both shading in space and background bleaching in time. In comparison to existing shading correction tools, BaSiC achieves high accuracy with significantly fewer input images, works for diverse imaging conditions and is robust against artifacts. Moreover, through correction of temporal drift in time-lapse microscopy data, it improves continuous single-cell quantification. Relying on a build-in automatic parameter setting strategy, BaSiC is very easy-to-use, with no tedious manual parameter tuning required. 


Tingying Peng, Kurt Thorn, Timm Schroeder, Lichao Wang, Fabian J Theis, Carsten Marr & Nassir Navab. "A BaSiC Tool for Background and Shading Correction of Optical Microscopy Image" Nature Communication 8:14836 (2017). doi: 10.1038/ncomms14836.


BaSiC is licensed under 

Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International Public License

It is free for academic use and please contact us for any commercial use.

Install via the Fiji Updater

Note: If you do not have Fiji installed on your computer, you can download it from Fiji website.

  1. Start Fiji and run the updater ("Help->Update Fiji")
  2. Select the "Manage Update Sites" button at the bottom-left of the updater window
  3. Scroll the list of available update sites to find "BaSiC" (Note: If you cannot find "BaSiC" in the list, select "Add Update Sites", Change the name field from default "New" to "BaSiC", set the URL field to
  4. Check the box at the left of "BaSiC"
  5. Select "Close" 
  6. Select "Apply Changes" 
  7. Restart Fiji. BaSiC should appear in the Plugins menu.

From now on, running the Fiji updater will also check for BaSiC updates, and install them if they are available.

Install manually

Please download BaSiC Plugin

  1. Copy “BaSiC_.jar” to the “$FIJIROOT/plugins” folder of your Fiji/ImageJ installation.
  2. Copy all dependent jar files in the "Dependent" folder to your Fiji/ImageJ "$FIJIROOT/jars" directory.


If you get the error message 

"java.lang.NoSuchMethodError: edu.emory.mathcs.utils.ConcurrencyUtils.submit"

make sure that in your Fiji/ImageJ "$FIJIROOT/jars" directory, there is only one version of each jar from the "Dependent" folder. Particularly, delete jtransforms-2.4.jar and replace it with our jtransform.jar.


Download demo data examples from Dropbox

WSI data

Using the graphical user interface:

  1. Open Fiji/ImageJ.
  2. Import the image stack in "Demoexample/WSI_Brain/Uncorrected_tiles" via Import -> Image sequence.
  3. Open BaSiC via Plugins->BaSiC.
  4. Here we estimate shading profile (flat-field and dark-field) only (no temporal drift need to be corrected). Set parameters as shown in ‘BaSiC_protocol.jpg’. Click OK. 
  5. Save the corrected image tiles via File->Save as->Image Sequence, please tick the checkbox "Use slice labels as file names". This guarantees that our image tiles in our "Corrected" folder have the same order as the "Uncorrected" folder.

We can visualise the effect of shading correction by comparing the stitched image from uncorrected tiles vs corrected tiles. To stitch a WSI, we can use the Grid/Collection stitching plugin.

  1. Open Fiji/Image.
  2. Open Grid/Collection stitching plugin via Plugins->Stitching->Grid/Collection stitching.
  3. Select "Type" as "Grid: snake by rows" and "Order" as "Left & Down", click "OK".
  4. Setting parameter in the Grid stitching dialog box according to the screenshot "stitching_protocol.jpg". Browse the directory to your folder where image tiles are stored, and then click "OK".
  5. The fused WSI will be automatically displayed on our desktop and we can adjust image contrast via Fiji->Image->Adjust->Brightness/Contrast to better view the stitched image.

After BaSiC correction and stitching, "Corrected_fused.jpg" looks much more smooth than "Uncorrected_fused.jpg". This example is a challenging case, as it has various artifacts such as dye particles on the specimen (see annotation in "Uncorrected_fused.jpg") and an additive stray light and excitation light residual (repeated pattern in the WSI background). 

Time-lapse data

Using the graphical user interface:

  1. Open Fiji/ImageJ.
  2. Import the image stack in "Demoexample/Timelapse_brightfield/Uncorrected" via Import -> Image sequence. In the Sequence Options, set Increment = 10 so that we import a image subset of 10 images.  
  3. Open BaSiC via Plugins->BaSiC.
  4. First we estimate shading profile (in this case flat-field) only. Set parameters as shown in ‘BaSiC_protocol_stepI.jpg’. Click OK. Processing 10 images should take less than 1 min. Save the estimated flat-field as Flat-field.tif via File->Save as->Flat-field.tif for future use. Close the Uncorrected image stack
  5. In a second step, we use the previously estimated flat-field and calculate the temporal drift. Import the entire image stack (100 images) in "Demoexample/Timelapse_brightfield/Uncorrected" via Import->Image sequence. Open Flat-field.tif. In this step, skip the shading estimation, use the precomputed flat-field as an input and only correct temporal drift. The respective parameter setting is shown in "BaSiC_protocal_stepII.jpg".
  6. The corrected image stack will be displayed.

Note that both the poor illumination at the right edge of the images, and the temporal flickering and flashing in the original movie (e.g. frame 4 is darker than both its neighbouring frames 3 and 5) has been corrected by BaSiC (as shown in the Uncorr_vs_corr.jpg). The dynamics of the mean image intensity can be visualised using Fiji->Image->Stacks->Plot Z-axis Profile).

One can also combine Step I and II into a single step by setting parameter as "BaSiC_protocal_singlestep.jpg’. In this way, both the shading and the temporal drift are estimated from the whole image sequence (100 images), which should be a bit slower than doing these two steps separately.


Using the IJ macro operation:

  1. Open Fiji/ImageJ
  2. Open a new script from File->New->Script. Setting script language into IJ1 Macro
  3. Copy the command in the "BaSiC_protocol_stepIandII.ijm" to your script.
  4. Runing the script.

Note that you have to change the path to the image stack to your own one. Similar to graphic interface, one can also combine Step I and II into a single run using "BaSiC_protocol_singlestep.ijm"


The detailed instruction to run other examples are given in "Demoexamples_readme.txt".


  • BaSiC improves contrast in the image corners (Source: HMGU)
  • BaSiC enables a seamless stitching (Source: HMGU)
  • BaSiC enables a seamless stitching (Source: HMGU)
  • BaSiC enables a seamless stitching (Source: HMGU)