From ee5fc72395aab1b3012679dfd3cbdcc51d2d4913 Mon Sep 17 00:00:00 2001 From: Alessia Saccardo <s212246@dtu.dk> Date: Tue, 10 Dec 2024 09:19:20 +0100 Subject: [PATCH] Start to add histogram --- qim3d/viz/explore.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/qim3d/viz/explore.py b/qim3d/viz/explore.py index be7bc543..12f49fcb 100644 --- a/qim3d/viz/explore.py +++ b/qim3d/viz/explore.py @@ -846,7 +846,7 @@ def threshold( # Create the interactive widget def _slicer(position, threshold, method): - fig, axes = plt.subplots(1, 3, figsize=(9, 3)) + fig, axes = plt.subplots(1, 4, figsize=(9, 3)) slice_img = volume[position, :, :] # If vmin is higher than the highest value in the image ValueError is raised @@ -866,6 +866,8 @@ def threshold( axes[0].set_title('Original') axes[0].axis('off') + + if method == 'Manual': threshold_slider.disabled = False else: @@ -882,9 +884,9 @@ def threshold( mask = slice_img > threshold - axes[1].imshow(mask, cmap=cmap_threshold) - axes[1].set_title('Binary mask') - axes[1].axis('off') + axes[2].imshow(mask, cmap=cmap_threshold) + axes[2].set_title('Binary mask') + axes[2].axis('off') masked_volume = qim3d.processing.operations.overlay_rgb_images( background = slice_img, @@ -902,9 +904,9 @@ def threshold( if (isinstance(vmax, (float, int)) and vmax < np.min(masked_volume)) else vmax ) - axes[2].imshow(masked_volume, cmap=cmap_threshold, vmin=new_vmin, vmax=new_vmax) - axes[2].set_title('Overlay') - axes[2].axis('off') + axes[3].imshow(masked_volume, cmap=cmap_threshold, vmin=new_vmin, vmax=new_vmax) + axes[3].set_title('Overlay') + axes[3].axis('off') return fig -- GitLab