Skip to content

Commit

Permalink
Move heatmap functionality to brainglobe-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
adamltyson committed Jan 5, 2024
1 parent 4643180 commit b0a36bf
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 81 deletions.
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 @@ def run_all(args, what_to_run, atlas):
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 @@ def run_all(args, what_to_run, atlas):
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

0 comments on commit b0a36bf

Please sign in to comment.