LightsheetCorrection#

Module to remove lightsheet artifacts in images.

correct_lightsheet(source, percentile=0.25, max_bin=4096, mask=None, lightsheet={'selem': (150, 1, 1)}, background={'dtype': <class 'float'>, 'interpolate': 1, 'selem': (200, 200, 1), 'spacing': (25, 25, 1), 'step': (2, 2, 1)}, lightsheet_vs_background=2, return_lightsheet=False, return_background=False, verbose=False)[source]#

Removes lightsheet artifacts.

Arguments

sourcearray

The source to correct.

percentilefloat in [0,1]

The percentile to base the lightsheet correction on.

max_binint

The maximal bin to use. Max_bin needs to be >= the maximal value in the source.

maskarray or None

Optional mask.

lightsheetdict

Parameter to pass to the percentile routine for the lightsheet artifact estimate. See ImageProcessing.Filter.Rank.percentile().

backgrounddict

Parameter to pass to the percentile routine for the background estimation.

lightsheet_vs_backgroundfloat

The background is multiplied by this weight before comparing to the lightsheet artifact estimate.

return_lightsheetbool

If True, return the lightsheet artifact estimate.

return_backgroundbool

If True, return the background estimate.

verbosebool

If True, print progress information.

Returns

correctedarray

Lightsheet artifact corrected image.

lightsheetarray

The lightsheet artifact estimate.

backgroundarray

The background estimate.

Note

The routine implements a fast but effective way to remove lightsheet artifacts. Effectively the percentile in an eloganted structural element along the lightsheet direction centered around each pixel is calculated and then compared to the percentile in a symmetrical box like structural element at the same pixel. The former is an estimate of the lightsheet artifact the latter of the background. The background is multiplied by the factor lightsheet_vs_background and then the minimum of both results is subtracted from the source. Adding an overall background estimate helps to not accidentally remove vessel like structures along the light-sheet direction.

correct_lightsheet_divide(source, percentile=0.25, max_bin=4096, mask=None, lightsheet={'selem': (150, 1, 1)}, background={'dtype': <class 'float'>, 'interpolate': 1, 'selem': (200, 200, 1), 'spacing': (25, 25, 1), 'step': (2, 2, 1)}, lightsheet_minimum=1, lightsheet_maximum=None, return_lightsheet=False, return_background=False, verbose=False)[source]#

Removes lightsheet artifacts.

Arguments

sourcearray

The source to correct.

percentilefloat in [0,1]

The percentile to base the lightsheet correction on.

max_binint

The maximal bin to use. Max_bin needs to be >= the maximal value in the source.

maskarray or None

Optional mask.

lightsheetdict

Parameter to pass to the percentile routine for the lightsheet artifact estimate. See ImageProcessing.Filter.Rank.percentile().

backgrounddict

Parameter to pass to the percentile routine for the background estimation.

lightsheet_vs_backgroundfloat

The background is multiplied by this weight before comparing to the lightsheet artifact estimate.

return_lightsheetbool

If True, return the lightsheet artifact estimate.

return_backgroundbool

If True, return the background estimate.

verbosebool

If True, print progress information.

Returns

correctedarray

Lightsheet artifact corrected image.

lightsheetarray

The lightsheet artifact estimate.

backgroundarray

The background estimate.

Note

The routine implements a fast but effective way to remove lightsheet artifacts. Effectively the percentile in an eloganted structural element along the lightsheet direction centered around each pixel is calculated and then compared to the percentile in a symmetrical box like structural element at the same pixel. The former is an estimate of the lightsheet artifact the latter of the background. The background is multiplied by the factor lightsheet_vs_background and then the minimum of both results is subtracted from the source. Adding an overall background estimate helps to not accidentally remove vessel like structures along the light-sheet direction.

correct_lightsheet_subdiv(source, percentile=0.25, max_bin=4096, mask=None, lightsheet={'selem': (150, 1, 1)}, background={'dtype': <class 'float'>, 'interpolate': 1, 'selem': (200, 200, 1), 'spacing': (25, 25, 1), 'step': (2, 2, 1)}, lightsheet_minimum=1, lightsheet_maximum=None, return_lightsheet=False, return_background=False, verbose=False)[source]#

Removes lightsheet artifacts.

Arguments

sourcearray

The source to correct.

percentilefloat in [0,1]

The percentile to base the lightsheet correction on.

max_binint

The maximal bin to use. Max_bin needs to be >= the maximal value in the source.

maskarray or None

Optional mask.

lightsheetdict

Parameter to pass to the percentile routine for the lightsheet artifact estimate. See ImageProcessing.Filter.Rank.percentile().

backgrounddict

Parameter to pass to the percentile routine for the background estimation.

lightsheet_vs_backgroundfloat

The background is multiplied by this weight before comparing to the lightsheet artifact estimate.

return_lightsheetbool

If True, return the lightsheet artifact estimate.

return_backgroundbool

If True, return the background estimate.

verbosebool

If True, print progress information.

Returns

correctedarray

Lightsheet artifact corrected image.

lightsheetarray

The lightsheet artifact estimate.

backgroundarray

The background estimate.

Note

The routine implements a fast but effective way to remove lightsheet artifacts. Effectively the percentile in an eloganted structural element along the lightsheet direction centered around each pixel is calculated and then compared to the percentile in a symmetrical box like structural element at the same pixel. The former is an estimate of the lightsheet artifact the latter of the background. The background is multiplied by the factor lightsheet_vs_background and then the minimum of both results is subtracted from the source. Adding an overall background estimate helps to not accidentally remove vessel like structures along the light-sheet direction.