File tree Expand file tree Collapse file tree 1 file changed +27
-12
lines changed
Expand file tree Collapse file tree 1 file changed +27
-12
lines changed Original file line number Diff line number Diff line change @@ -98,18 +98,13 @@ def apply_rollingball_bg_subtraction(
9898 """
9999 log .info ("Applying rolling ball with radius %d" % rolling_ball_radius )
100100
101- option_parts = ["rolling=" + str (rolling_ball_radius )]
102-
103- if light_background :
104- option_parts .append ("light" )
105- if sliding :
106- option_parts .append ("sliding" )
107- if disable :
108- option_parts .append ("disable" )
109- if do_3d :
110- option_parts .append ("stack" )
111-
112- options = " " .join (option_parts )
101+ options = rolling_ball_options (
102+ rolling_ball_radius ,
103+ light_background = light_background ,
104+ sliding = sliding ,
105+ disable = disable ,
106+ do_3d = do_3d ,
107+ )
113108
114109 log .debug ("Background subtraction options: %s" % options )
115110
@@ -119,6 +114,26 @@ def apply_rollingball_bg_subtraction(
119114 return imageplus
120115
121116
117+ def rolling_ball_options (
118+ rolling_ball_radius ,
119+ light_background = False ,
120+ sliding = False ,
121+ disable = False ,
122+ do_3d = False ,
123+ ):
124+ """Return the option string for rolling ball background subtraction."""
125+ parts = ["rolling=" + str (rolling_ball_radius )]
126+ if light_background :
127+ parts .append ("light" )
128+ if sliding :
129+ parts .append ("sliding" )
130+ if disable :
131+ parts .append ("disable" )
132+ if do_3d :
133+ parts .append ("stack" )
134+ return " " .join (parts )
135+
136+
122137def apply_threshold (imp , threshold_method , do_3d = True ):
123138 """Apply a threshold method to the input ImagePlus.
124139
You can’t perform that action at this time.
0 commit comments