Skip to content
Snippets Groups Projects
Commit bc7c05d1 authored by Felipe Delestro Matos's avatar Felipe Delestro Matos
Browse files

Hotfix for slice_viz

parent a616caca
No related branches found
No related tags found
No related merge requests found
...@@ -231,11 +231,11 @@ def slice_viz(input, position = 'mid', cmap="viridis", axis=False, img_height=2, ...@@ -231,11 +231,11 @@ def slice_viz(input, position = 'mid', cmap="viridis", axis=False, img_height=2,
# Position is a string # Position is a string
if isinstance(position,str): if isinstance(position,str):
if position.lower() in ['mid','middle']: if position.lower() in ['mid','middle']:
height = [int(vol.shape[-1]/2)] height = [int(vol.shape[0]/2)]
elif position.lower() in ['top','upper', 'start']: elif position.lower() in ['top','upper', 'start']:
height = [0] height = [0]
elif position.lower() in ['bot','bottom', 'end']: elif position.lower() in ['bot','bottom', 'end']:
height = [vol.shape[-1]-1] height = [vol.shape[0]-1]
else: else:
raise ValueError('Position not recognized. Choose an integer, list, array or "start","mid","end".') raise ValueError('Position not recognized. Choose an integer, list, array or "start","mid","end".')
...@@ -253,7 +253,7 @@ def slice_viz(input, position = 'mid', cmap="viridis", axis=False, img_height=2, ...@@ -253,7 +253,7 @@ def slice_viz(input, position = 'mid', cmap="viridis", axis=False, img_height=2,
axs = fig.subplots(nrows = 1, ncols = num_images) axs = fig.subplots(nrows = 1, ncols = num_images)
for col, ax in enumerate(np.atleast_1d(axs)): for col, ax in enumerate(np.atleast_1d(axs)):
ax.imshow(vol[:,:,height[col]],cmap = cmap) ax.imshow(vol[height[col],:,:],cmap = cmap)
ax.set_title(f'Slice {height[col]}', fontsize=8) ax.set_title(f'Slice {height[col]}', fontsize=8)
if not axis: if not axis:
ax.axis('off') ax.axis('off')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment