Skip to content

Commit

Permalink
Move heatmap functionality to brainglobe-utils (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamltyson authored Jan 8, 2024
1 parent b2ba47e commit 80d583c
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 @@ -221,8 +222,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:
mask_image = tifffile.imread(
args.brainreg_paths.registered_atlas
)
else:
mask_image = None

downsampled_points = pd.read_hdf(
args.paths.downsampled_points
).values

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 80d583c

Please sign in to comment.