Skip to content

Commit

Permalink
Remove redundant settings, fixes (mostly by Erin) (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
bethac07 authored Jan 7, 2025
1 parent 677fb7a commit 82991cb
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions active_plugins/filterobjects_stringmatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import scipy.sparse

import cellprofiler_core.object
from cellprofiler.utilities.rules import Rules

LOGGER = logging.getLogger(__name__)

Expand All @@ -25,16 +24,13 @@
METHOD_KEEP_EXACT = "Keep only strings matching"
METHOD_KEEP_CONTAINS = "Keep only strings containing"

ADDITIONAL_STRING_SETTING_INDEX = 5

class FilterObjects_StringMatch(ObjectProcessing):
module_name = "FilterObjects_StringMatch"

variable_revision_number = 2

def __init__(self):
self.rules = Rules()

super(FilterObjects_StringMatch, self).__init__()

def create_settings(self):
super(FilterObjects_StringMatch, self).create_settings()

Expand Down Expand Up @@ -88,8 +84,6 @@ def create_settings(self):
Click this button to add an additional string to apply to the objects with the same rules.""",
)

self.rules.create_settings()

def add_additional_string(self):
group = SettingsGroup()
group.append(
Expand All @@ -111,11 +105,18 @@ def add_additional_string(self):

def settings(self):
settings = super(FilterObjects_StringMatch, self).settings()
settings += [self.filter_out,self.filter_method, self.filter_column]
settings += [self.filter_out,self.filter_method, self.filter_column, self.additional_string_count]
for x in self.additional_strings:
settings += [self.filter_out]
settings += [x.additional_string]
return settings

def prepare_settings(self, setting_values):
additional_string_count = int(setting_values[ADDITIONAL_STRING_SETTING_INDEX])
while len(self.additional_strings) > additional_string_count:
del self.additional_images[additional_string_count:]
while len(self.additional_strings) < additional_string_count:
self.add_additional_string()

def visible_settings(self):
visible_settings = super(FilterObjects_StringMatch, self).visible_settings()
visible_settings += [
Expand Down

0 comments on commit 82991cb

Please sign in to comment.