Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support single z-stack tif file for input #88

Merged
merged 3 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions brainglobe_workflows/brainmapper/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
from cellfinder.core.classify import classify
from cellfinder.core.detect import detect
from cellfinder.core.tools import prep
from cellfinder.core.tools.IO import read_with_dask
from cellfinder.core.tools.IO import read_z_stack

from brainglobe_workflows.brainmapper import analyse
from brainglobe_workflows.brainmapper.prep import (
Expand All @@ -120,7 +120,7 @@
if what_to_run.detect:
logging.info("Detecting cell candidates")
args = prep_candidate_detection(args)
signal_array = read_with_dask(
signal_array = read_z_stack(
args.signal_planes_paths[args.signal_channel]
)

Expand Down Expand Up @@ -165,11 +165,11 @@
if points is None:
points = get_cells(args.paths.detected_points)
if signal_array is None:
signal_array = read_with_dask(
signal_array = read_z_stack(

Check warning on line 168 in brainglobe_workflows/brainmapper/main.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_workflows/brainmapper/main.py#L168

Added line #L168 was not covered by tests
args.signal_planes_paths[args.signal_channel]
)
logging.info("Running cell classification")
background_array = read_with_dask(args.background_planes_path[0])
background_array = read_z_stack(args.background_planes_path[0])

points = classify.main(
points,
Expand Down
12 changes: 6 additions & 6 deletions brainglobe_workflows/cellfinder/cellfinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import pooch
from brainglobe_utils.IO.cells import save_cells
from cellfinder.core.main import main as cellfinder_run
from cellfinder.core.tools.IO import read_with_dask
from cellfinder.core.tools.IO import read_z_stack
from cellfinder.core.train.train_yml import depth_type

from brainglobe_workflows.utils import (
Expand Down Expand Up @@ -352,8 +352,8 @@ def run_workflow_from_cellfinder_run(cfg: CellfinderConfig):

The steps are:
1. Read the input signal and background data as two separate
Dask arrays.
2. Run the main cellfinder pipeline on the input Dask arrays,
Dask arrays (or in-memory numpy arrays if single file tiff stack).
2. Run the main cellfinder pipeline on the input arrays,
with the parameters defined in the input configuration (cfg).
3. Save the detected cells as an xml file to the location specified in
the input configuration (cfg).
Expand All @@ -364,9 +364,9 @@ def run_workflow_from_cellfinder_run(cfg: CellfinderConfig):
a class with the required setup methods and parameters for
the cellfinder workflow
"""
# Read input data as Dask arrays
signal_array = read_with_dask(str(cfg._signal_dir_path))
background_array = read_with_dask(str(cfg._background_dir_path))
# Read input data as Dask or numpy arrays
signal_array = read_z_stack(str(cfg._signal_dir_path))
background_array = read_z_stack(str(cfg._background_dir_path))

# Run main analysis using `cellfinder_run`
detected_cells = cellfinder_run(
Expand Down