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