You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please refer to our FAQ and look at our known issues before opening a bug report.
Describe the bug
When trying to run segmentation, an error propped up where a mask file that didn't exist was being loaded for csv writing. After troubleshooting, the problem occurs in alpineer's io_utils.list_files code. In this example, while only file names with 'R6C1' were desired, files with R6C10' were also being extracted due to the way io_utils.list_files` matches substrings in file names.
Expected behavior io_utils.list_files currently finds files using the code below based on a matching substring (substr) matches = [file for file in files if any([substr in file for substr in substrs])] -> will return files with both 'R6C1' and 'R6C10'
To Reproduce
Ping me for access to my mask files.
The text was updated successfully, but these errors were encountered:
Proposed solution below:
Change the current list comprehension in io_utils.list_files from the below: matches = [file for file in files if any([substr in file for substr in substrs])]
To this regular expression which uses a word boundary instead of string matching alone to find the desired files.
# Create a regular expression pattern from substrs with word boundaries
pattern = '|'.join(re.escape(substr) + r'\b' for substr in substrs)
# Use re.search to check if any of the substrings exactly match in the file names
matches = [file for file in files if re.search(pattern, file)]
Please refer to our FAQ and look at our known issues before opening a bug report.
Describe the bug
When trying to run segmentation, an error propped up where a mask file that didn't exist was being loaded for csv writing. After troubleshooting, the problem occurs in alpineer's
io_utils.list_files
code. In this example, while only file names with 'R6C1' were desired, files withR6C10' were also being extracted due to the way
io_utils.list_files` matches substrings in file names.Expected behavior
io_utils.list_files
currently finds files using the code below based on a matching substring (substr)matches = [file for file in files if any([substr in file for substr in substrs])]
-> will return files with both 'R6C1' and 'R6C10'To Reproduce
Ping me for access to my mask files.
The text was updated successfully, but these errors were encountered: