@@ -312,9 +312,15 @@ def __init__(self, **kwargs): # noqa: C901
312
312
opacities_array = self ._validate_geometry_opacities (proposal )
313
313
kwargs ['geometry_opacities' ] = opacities_array
314
314
self .observe (self ._on_geometries_changed , ['geometries' ])
315
- if 'label_map' in kwargs :
315
+ have_label_map = 'label_map' in kwargs and kwargs ['label_map' ] is not None
316
+ if have_label_map :
316
317
# Interpolation is not currently supported with label maps
317
318
kwargs ['interpolation' ] = False
319
+ if not 'cmap' in kwargs or kwargs ['cmap' ] is None :
320
+ if have_label_map :
321
+ kwargs ['cmap' ] = cm .grayscale
322
+ else :
323
+ kwargs ['cmap' ] = cm .viridis
318
324
319
325
super (Viewer , self ).__init__ (** kwargs )
320
326
@@ -643,7 +649,7 @@ def roi_slice(self):
643
649
644
650
def view (image = None , # noqa: C901
645
651
label_map = None , # noqa: C901
646
- cmap = cm . viridis ,
652
+ cmap = None ,
647
653
select_roi = False ,
648
654
interpolation = True ,
649
655
gradient_opacity = 0.22 , slicing_planes = False , shadow = True , blend = 'composite' ,
@@ -722,7 +728,7 @@ def view(image=None, # noqa: C901
722
728
Value that maps to the minimum of image colormap. Defaults to maximum of
723
729
the image pixel buffer.
724
730
725
- cmap: string, optional, default: 'Viridis (matplotlib)'
731
+ cmap: string, optional, default: viridis, grayscale with a label map
726
732
Colormap. Some valid values available at itkwidgets.cm.*
727
733
728
734
select_roi: bool, optional, default: False
0 commit comments