Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
imagejan committed May 2, 2024
1 parent d20b810 commit b7904cd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

# criteria for file selection in case of multiple channels/slices per position
file_selection:
mode: standard
channel: C01

# choose method how to segment, filter, and sample the objects
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ authors = [
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = [
"cellpose",
"confuse",
"faim-ipa",
"rich",
"scikit-image",
"tqdm",
Expand All @@ -55,7 +56,7 @@ cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=faim_w
no-cov = "cov --no-cov {args}"

[[tool.hatch.envs.test.matrix]]
python = ["38", "39", "310", "311"]
python = ["39", "310", "311", "312"]

[tool.coverage.run]
branch = true
Expand Down
14 changes: 12 additions & 2 deletions src/faim_wako_searchfirst/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,16 @@ def run(folder: Union[str, Path], configfile: Union[str, Path]):
config_copy.write_text(config.dump())

# Select files
file_selection_config = config["file_selection"].get()
if "mode" in file_selection_config:
mode = file_selection_config.pop("mode")
if mode == "stitched" and "field" not in file_selection_config:
file_selection_config["field"] = "F0001"
else:
mode = "standard"
tif_files = _select_files(
folder=folder_path,
**(config["file_selection"].get()),
**file_selection_config,
)

logger.info(f"Found {len(tif_files)} matching files.")
Expand Down Expand Up @@ -123,10 +130,13 @@ def _process_tif(tif_file, config, logger):

def _select_files(
folder: Path,
time: str = "T[0-9][0-9][0-9][0-9]",
field: str = "F[0-9][0-9][0-9]",
plane: str = "Z[0-9][0-9]",
channel: str = "C01",
) -> List[Path]:
"""Filter all TIFs in folder starting with folder name - and containing channel ID."""
return sorted(folder.rglob(folder.name + "*" + channel + ".tif"))
return sorted(folder.glob(folder.name + "_*_" + time + field + "L[0-9][0-9]A[0-9][0-9]" + plane + channel + ".tif"))


def _save_segmentation_image(folder_path, filename, img, labels):
Expand Down

0 comments on commit b7904cd

Please sign in to comment.