16
16
import scipy .sparse
17
17
18
18
import cellprofiler_core .object
19
- from cellprofiler .utilities .rules import Rules
20
19
21
20
LOGGER = logging .getLogger (__name__ )
22
21
25
24
METHOD_KEEP_EXACT = "Keep only strings matching"
26
25
METHOD_KEEP_CONTAINS = "Keep only strings containing"
27
26
27
+ ADDITIONAL_STRING_SETTING_INDEX = 5
28
+
28
29
class FilterObjects_StringMatch (ObjectProcessing ):
29
30
module_name = "FilterObjects_StringMatch"
30
31
31
32
variable_revision_number = 2
32
33
33
- def __init__ (self ):
34
- self .rules = Rules ()
35
-
36
- super (FilterObjects_StringMatch , self ).__init__ ()
37
-
38
34
def create_settings (self ):
39
35
super (FilterObjects_StringMatch , self ).create_settings ()
40
36
@@ -88,8 +84,6 @@ def create_settings(self):
88
84
Click this button to add an additional string to apply to the objects with the same rules.""" ,
89
85
)
90
86
91
- self .rules .create_settings ()
92
-
93
87
def add_additional_string (self ):
94
88
group = SettingsGroup ()
95
89
group .append (
@@ -111,11 +105,18 @@ def add_additional_string(self):
111
105
112
106
def settings (self ):
113
107
settings = super (FilterObjects_StringMatch , self ).settings ()
114
- settings += [self .filter_out ,self .filter_method , self .filter_column ]
108
+ settings += [self .filter_out ,self .filter_method , self .filter_column , self . additional_string_count ]
115
109
for x in self .additional_strings :
116
- settings += [self . filter_out ]
110
+ settings += [x . additional_string ]
117
111
return settings
118
112
113
+ def prepare_settings (self , setting_values ):
114
+ additional_string_count = int (setting_values [ADDITIONAL_STRING_SETTING_INDEX ])
115
+ while len (self .additional_strings ) > additional_string_count :
116
+ del self .additional_images [additional_string_count :]
117
+ while len (self .additional_strings ) < additional_string_count :
118
+ self .add_additional_string ()
119
+
119
120
def visible_settings (self ):
120
121
visible_settings = super (FilterObjects_StringMatch , self ).visible_settings ()
121
122
visible_settings += [
0 commit comments