Skip to content

Commit

Permalink
Update background.py
Browse files Browse the repository at this point in the history
  • Loading branch information
arsalanmstn committed Sep 26, 2024
1 parent 1c2db1c commit 8be4aef
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pyopia/background.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def shift_bgstack_fast(bgstack, imbg, imnew):
return bgstack, imbg


def correct_im_accurate(imbg, imraw, divide_bg=True):
def correct_im_accurate(imbg, imraw, divide_bg=False):
'''
Corrects raw image by subtracting or dividing the background and scaling the output
Expand All @@ -112,17 +112,16 @@ def correct_im_accurate(imbg, imraw, divide_bg=True):
raw image
divide_bg : (bool, optional)
If True, the correction will be performed by dividing the raw image by the background
Default to True
Default to False
Returns
-------
im_corrected : float64
corrected image, same type as input
'''

imbg = np.clip(imbg, a_min=1/255, a_max=None) # Clipping the zero_value pixels

if divide_bg:
imbg = np.clip(imbg, a_min=1/255, a_max=None) # Clipping the zero_value pixels
im_corrected = imraw / imbg
else:
im_corrected = imraw - imbg
Expand Down Expand Up @@ -233,7 +232,7 @@ class CorrectBackgroundAccurate():
divide_bg : (bool)
If True, it performs background correction by dividing the raw image by the background.
Default to True.
Default to False.
Returns
-------
Expand Down Expand Up @@ -271,7 +270,7 @@ class CorrectBackgroundAccurate():
Then you could use :class:`pyopia.pipeline.CorrectBackgroundNone` if you need to instead.
'''

def __init__(self, bgshift_function='pass', average_window=1, image_source='imraw', divide_bg=True):
def __init__(self, bgshift_function='pass', average_window=1, image_source='imraw', divide_bg=False):
self.bgshift_function = bgshift_function
self.average_window = average_window
self.image_source = image_source
Expand Down

0 comments on commit 8be4aef

Please sign in to comment.