Skip to content

Commit

Permalink
adds wip plot_zstack method
Browse files Browse the repository at this point in the history
  • Loading branch information
rueberger committed Sep 3, 2022
1 parent 0d51cb5 commit 3999bfc
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions pijm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pijm.plot import plot_zstack
33 changes: 33 additions & 0 deletions pijm/plot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
""" Plotting methods
"""


import matplotlib.pyplot as plt
import numpy as np

from pijm.events import StackScroller


# TODO: return type?
# TODO: type hint for array shape?
def plot_zstack(image_array: np.ndarray):
"""Interactively plot stack, capturing scrolling events to scroll through slices
Args:
image_array - (n_x, n_y, n_z)
"""
assert image_array.ndim == 3

axes_image = plt.imshow(
image_array[:, :, image_array.shape[2] // 2],
vmin=image_array.min(),
vmax=image_array.max(),
)

handlers = []

handlers.append(StackScroller(image_array, axes_image))

# NOTE: handlers will be garbage collected if not returned
# TODO: find more elegant solution
return axes_image, handlers

0 comments on commit 3999bfc

Please sign in to comment.