@@ -332,7 +332,29 @@ def alpha(self, alpha):
332332 self ._alpha = alpha
333333 self .draw ()
334334
335- def set_overlay (self , data , affine = None , threshold = None , cmap = 'viridis' ):
335+ def set_overlay (self , data , affine = None , threshold = None , cmap = 'viridis' ,
336+ alpha = 0.7 ):
337+ """ Sets `data` as overlay for currently plotted image
338+
339+ Parameters
340+ ----------
341+ data : array-like
342+ The data that will be overlayed on the slicer. Should have 3+
343+ dimensions.
344+ affine : array-like or None, optional
345+ Affine transform for the provided data. This is used to determine
346+ how the data should be sliced for plotting into the sagittal,
347+ coronal, and axial view axes. If this does not match the currently
348+ plotted slicer the provided data will be resampled.
349+ threshold : float or None, optional
350+ Threshold for overlay data; values below this threshold will not
351+ be displayed. Default: None
352+ cmap : str, optional
353+ The Colormap instance or registered colormap name used to map
354+ scalar data to colors. Default: 'viridis'
355+ alpha : [0, 1] float, optional
356+ Set the alpha value used for blending. Default: 0.7
357+ """
336358 if affine is None :
337359 try : # did we get an image?
338360 affine = data .affine
@@ -385,8 +407,7 @@ def set_overlay(self, data, affine=None, threshold=None, cmap='viridis'):
385407
386408 # set transparency and new cmap
387409 self ._overlay .cmap = cmap
388- for im in self ._overlay ._ims :
389- im .set_alpha (0.7 )
410+ self ._overlay .alpha = alpha
390411
391412 # no double cross-hairs (they get confused when we have linked orthos)
392413 for cross in self ._overlay ._crosshairs :
0 commit comments