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

Added plots module with orthographic and grid plots #45

Merged
merged 6 commits into from
Oct 28, 2024
Merged

Conversation

niksirbi
Copy link
Member

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?
It would be nice to have some in-built plotting funcitons to help us get a quick overview of an image stack. Such overviews can be useful for quality control - i.e to select images to be included in the template and to inspect the consequences of various preprocessing steps. They can also be used for quickly inspecting the resulting templates.

What does this PR do?

Adds a new plots.py module with two public functions:

  • plot_orthographic() - generates a figure with 4 subplots: 3 for each section (frontal, horizontal, sagittal), and 1 with a top view surface rendering (an attenuated max intensity projection).
  • plot_grid() - plots multiple slices of a specific section (e.g. frontal) as a grid.

Here's how these plots look:

sub-CAP01_res-50um_channel-red_orthographic
sub-CAP01_res-50um_channel-red_grid

Both functions are "anatomically literate", as in the produced plots are labelled with anatomical axes, courtesy of the AnatomicalSpace class from brainglobe-space. The user needs to supply the image orientation to the plotting functions (default is "ASR") to the best of their knowledge. If they've misjudged the image orientation, the results will be obvious on the plots.

Apart from the two public functions, the new module also contains a bunch of small private utilities used by the 2 main functions.

How has this PR been tested?

Manually tested on the SWC rat data. No unit tests added yet.

Is this a breaking change?

No.

Does this PR require an update to the documentation?

In principle yes, but I haven't documented the new functions anywhere, yet. That said, extensive docstrings have been added.

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality (unit & integration)
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

@niksirbi niksirbi marked this pull request as ready for review October 21, 2024 17:00
Copy link
Member

@alessandrofelder alessandrofelder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - the plots look great!

Minor nitpicks to make docs slightly more precise and check I've understood things correctly. Please merge when you've considered the nitpicks.

brainglobe_template_builder/plots.py Show resolved Hide resolved
brainglobe_template_builder/plots.py Outdated Show resolved Hide resolved
brainglobe_template_builder/plots.py Show resolved Hide resolved
brainglobe_template_builder/plots.py Outdated Show resolved Hide resolved
brainglobe_template_builder/plots.py Show resolved Hide resolved
brainglobe_template_builder/plots.py Outdated Show resolved Hide resolved
@niksirbi niksirbi merged commit f9ce842 into main Oct 28, 2024
23 checks passed
@niksirbi niksirbi deleted the diagnostic-plots branch October 28, 2024 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants