Skip to content

Commit

Permalink
Merge pull request #631 from ANTsX/fix-plot-overlay
Browse files Browse the repository at this point in the history
FIX: overlay plot background is masked
  • Loading branch information
Nicholas Cullen, PhD authored May 15, 2024
2 parents 3dcfdeb + f1a3515 commit 9266f2f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 143 deletions.
1 change: 0 additions & 1 deletion ants/viz/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from .create_tiled_mosaic import create_tiled_mosaic

from .plot import plot
from .movie import movie
Expand Down
138 changes: 0 additions & 138 deletions ants/viz/create_tiled_mosaic.py

This file was deleted.

10 changes: 6 additions & 4 deletions ants/viz/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,10 @@ def reorient_slice(x, axis):

if overlay is not None:
ov_arr = overlay.numpy()
mask = ov_arr == 0
mask = np.ma.masked_where(mask == 0, mask)
ov_arr = np.ma.masked_array(ov_arr, mask)
ov_arr = rotate90_matrix(ov_arr)
if ov_arr.dtype not in ["uint8", "uint32"]:
ov_arr = np.ma.masked_where(ov_arr == 0, ov_arr)

fig = plt.figure()
if title is not None:
Expand Down Expand Up @@ -375,8 +376,9 @@ def reorient_slice(x, axis):
if reorient:
overlay = overlay.reorient_image2("LAI")
ov_arr = overlay.numpy()
if ov_arr.dtype not in ["uint8", "uint32"]:
ov_arr = np.ma.masked_where(ov_arr == 0, ov_arr)
mask = ov_arr == 0
mask = np.ma.masked_where(mask == 0, mask)
ov_arr = np.ma.masked_array(ov_arr, mask)
ov_arr = np.rollaxis(ov_arr, axis)

if slices is None:
Expand Down

0 comments on commit 9266f2f

Please sign in to comment.