imagej / imagej.github.io

The ImageJ wiki
https://imagej.net
Other
25 stars 110 forks source link

Default of ROI background correction #196

Closed maurosilber closed 2 years ago

maurosilber commented 2 years ago

In the docs, it says:

Image Intensity Processing

ROI background correction

The rolling-ball algorithm takes a lot of time. To speed up the process with an image that has a more even background, select a region of interest from the background and subtract the mean value of this area for each slice from each slice. Use the selection tools to select an area of background and run the menu command Process | Subtract Background. This macro will subtract the mean of the ROI from the image plus an additional value equal to the standard deviation of the ROI multiplied by the scaling factor you enter. The default for this is 3.

https://github.com/imagej/imagej.github.io/blob/7bfdac0328bb0f2b9c211562006ec764829bf011/_pages/imaging/image-intensity-processing.md#roi-background-correction

Why the mean plus 3 standard deviations? I would understand this decision for segmentation purposes, but not for image intensity processing, where the mean (or median) would be more appropriate. Is it still the default value? I tried looking into the code, but could not found it.

ctrueden commented 2 years ago

@maurosilber wrote:

I tried looking into the code, but could not found it.

If you are using Fiji, you can find the source code by typing "Subtract Background" into the search bar, then clicking the "Source" button in the right-hand pane. Here is the code:

https://github.com/imagej/ImageJA/blob/v1.53k/src/main/java/ij/plugin/filter/BackgroundSubtracter.java

Personally, I do not like the "Subtract Background" command; the algorithm seems to have weird artifacts to me. But I never dug into the code to find out why. I just use a workflow like this instead:

  1. Duplicate image
  2. Gaussian blur the duplicate with large radius
  3. Subtract the blurred image from the original

Please feel warmly welcome to improve the Image Intensity Processing page, and really any page, on the wiki—that's why it is a wiki. The original authors of those Scientific Imaging Tutorials pages are mostly long gone, so it's up to the community to improve them as ImageJ evolves.