Skip to content

Commit a7cb59d

Browse files
author
Souheil Inati
committed
Added colormap option to the image show function.
1 parent af67204 commit a7cb59d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ismrmrdtools/show.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
import matplotlib.pyplot as plt
77
from matplotlib.widgets import RectangleSelector
88

9-
def imshow(image_matrix, tile_shape=None, scale=None, titles=[], colorbar=False):
9+
def imshow(image_matrix, tile_shape=None, scale=None, titles=[], colorbar=False, cmap='jet'):
1010
""" Tiles images and displays them in a window.
1111
1212
:param image_matrix: a 2D or 3D set of image data
1313
:param tile_shape: optional shape ``(rows, cols)`` for tiling images
1414
:param scale: optional ``(min,max)`` values for scaling all images
1515
:param titles: optional list of titles for each subplot
16+
:param cmap: optional colormap for all images
1617
"""
1718
assert image_matrix.ndim in [2, 3], "image_matrix must have 2 or 3 dimensions"
1819

@@ -50,6 +51,7 @@ def on_pick(event):
5051
rectprops = dict(facecolor='red', edgecolor='black', alpha=0.5, fill=True)
5152
cols, rows = tile_shape
5253
fig = plt.figure()
54+
plt.set_cmap(cmap)
5355
for z in range(image_matrix.shape[0]):
5456
ax = fig.add_subplot(cols, rows, z+1)
5557
ax.set_title(titles[z])

0 commit comments

Comments
 (0)