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

Move heatmap functionality to brainglobe-utils #74

Merged
merged 1 commit into from
Jan 8, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
16 changes: 0 additions & 16 deletions brainglobe_workflows/brainmapper/figures/figures.py

This file was deleted.

62 changes: 0 additions & 62 deletions brainglobe_workflows/brainmapper/figures/heatmap.py

This file was deleted.

26 changes: 23 additions & 3 deletions brainglobe_workflows/brainmapper/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
from datetime import datetime

import bg_space as bgs
import pandas as pd
import tifffile
from brainglobe_utils.cells.cells import MissingCellsError
from brainglobe_utils.general.system import ensure_directory_exists
from brainglobe_utils.image.heatmap import heatmap_from_points
from brainglobe_utils.IO.cells import get_cells, save_cells
from cellfinder.core.main import suppress_tf_logging, tf_suppress_log_messages

Expand Down Expand Up @@ -106,7 +108,6 @@
from cellfinder.core.tools.IO import read_with_dask

from brainglobe_workflows.brainmapper.analyse import analyse
from brainglobe_workflows.brainmapper.figures import figures
from brainglobe_workflows.brainmapper.tools.prep import (
prep_candidate_detection,
prep_channel_specific_general,
Expand Down Expand Up @@ -222,8 +223,27 @@
if len(points) == 0:
logging.info("No cells detected, skipping")
else:
logging.info("Generating figures")
figures.run(args, atlas, downsampled_space.shape)
logging.info("Generating heatmap")

if args.mask_figures:

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

View check run for this annotation

Codecov / codecov/patch

brainglobe_workflows/brainmapper/main.py#L227-L228

Added lines #L227 - L228 were not covered by tests
mask_image = tifffile.imread(
args.brainreg_paths.registered_atlas
)
else:

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

View check run for this annotation

Codecov / codecov/patch

brainglobe_workflows/brainmapper/main.py#L232

Added line #L232 was not covered by tests
mask_image = None

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

View check run for this annotation

Codecov / codecov/patch

brainglobe_workflows/brainmapper/main.py#L234

Added line #L234 was not covered by tests
downsampled_points = pd.read_hdf(
args.paths.downsampled_points
).values

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

View check run for this annotation

Codecov / codecov/patch

brainglobe_workflows/brainmapper/main.py#L238

Added line #L238 was not covered by tests
heatmap_from_points(
downsampled_points,
atlas.resolution[0], # assumes isotropic atlas
downsampled_space.shape,
output_filename=args.paths.heatmap,
smoothing=args.heatmap_smooth,
mask_image=mask_image,
)
else:
logging.info("Skipping figure generation")

Expand Down
Loading