Repository: napari/napari

Issue:
Layer right-click menu in 3D viewing mode: 'linear' is not a valid interpolation
## 🐛 Bug

Hi all,

I'm just testing napari 0.4.11rc1. I really ❤️ the new right-click menu on layers. However, there is a little bug: An exception is raised when doing a projection while one is looking at a dataset in 3D mode. 

## To Reproduce

Steps to reproduce the behavior:

1. Start napari
2. Open skimage blobs 3D example image
3. Switch to 3D mode
4. Right click the layer, click on Projection > std

That's the error message then:
```
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
~\miniconda3\envs\bio4\lib\site-packages\napari\layers\_layer_actions.py in _project(ll=[<Image layer 'binary_blobs' at 0x23839ed02e0>], axis=0, mode='std')
     75         'rendering': layer.rendering,
     76     }
---> 77     new = Layer.create(data, meta, layer._type_string)
        new = undefined
        global Layer.create = <bound method Layer.create of <class 'napari.layers.base.base.Layer'>>
        data = (<class 'numpy.ndarray'> (1, 128, 128) float64,)
        meta = {'name': 'binary_blobs std-proj', 'metadata': {}, 'scale': [1.0, 1.0, 1.0], 'translate': [0.0, 0.0, 0.0], 'rotate': [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], 'shear': [0.0, 0.0, 0.0], 'opacity': 1.0, 'blending': 'translucent', 'visible': True, 'colormap': 'gray', 'interpolation': 'linear', 'rendering': 'mip'}
        layer._type_string = 'image'
     78     ll.append(new)
     79

~\miniconda3\envs\bio4\lib\site-packages\napari\layers\base\base.py in create(cls=<class 'napari.layers.base.base.Layer'>, data=(<class 'numpy.ndarray'> (1, 128, 128) float64,), meta={'blending': 'translucent', 'colormap': 'gray', 'interpolation': 'linear', 'metadata': {}, 'name': 'binary_blobs std-proj', 'opacity': 1.0, 'rendering': 'mip', 'rotate': [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], 'scale': [1.0, 1.0, 1.0], 'shear': [0.0, 0.0, 0.0], ...}, layer_type='image')
   1544         except Exception as exc:
   1545             if 'unexpected keyword argument' not in str(exc):
-> 1546                 raise exc
        exc = undefined
   1547
   1548             bad_key = str(exc).split('keyword argument ')[-1]

~\miniconda3\envs\bio4\lib\site-packages\napari\layers\base\base.py in create(cls=<class 'napari.layers.base.base.Layer'>, data=(<class 'numpy.ndarray'> (1, 128, 128) float64,), meta={'blending': 'translucent', 'colormap': 'gray', 'interpolation': 'linear', 'metadata': {}, 'name': 'binary_blobs std-proj', 'opacity': 1.0, 'rendering': 'mip', 'rotate': [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], 'scale': [1.0, 1.0, 1.0], 'shear': [0.0, 0.0, 0.0], ...}, layer_type='image')
   1541
   1542         try:
-> 1543             return Cls(data, **(meta or {}))
        Cls = <class 'napari.layers.image.image.Image'>
        data = (<class 'numpy.ndarray'> (1, 128, 128) float64,)
        meta = {'name': 'binary_blobs std-proj', 'metadata': {}, 'scale': [1.0, 1.0, 1.0], 'translate': [0.0, 0.0, 0.0], 'rotate': [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], 'shear': [0.0, 0.0, 0.0], 'opacity': 1.0, 'blending': 'translucent', 'visible': True, 'colormap': 'gray', 'interpolation': 'linear', 'rendering': 'mip'}
   1544         except Exception as exc:
   1545             if 'unexpected keyword argument' not in str(exc):

~\miniconda3\envs\bio4\lib\site-packages\napari\layers\image\image.py in __init__(self=<Image layer 'binary_blobs std-proj'>, data=<class 'numpy.ndarray'> (1, 128, 128) float64, rgb=False, colormap='gray', contrast_limits=None, gamma=1, interpolation='linear', rendering='mip', iso_threshold=0.5, attenuation=0.05, name='binary_blobs std-proj', metadata={}, scale=[1.0, 1.0, 1.0], translate=[0.0, 0.0, 0.0], rotate=[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], shear=[0.0, 0.0, 0.0], affine=None, opacity=1.0, blending='translucent', visible=True, multiscale=False, experimental_slicing_plane=None, experimental_clipping_planes=None)
    307             ),
    308         }
--> 309         self.interpolation = interpolation
        self.interpolation = 'nearest'
        interpolation = 'linear'
    310         self.rendering = rendering
    311         if experimental_slicing_plane is not None:

~\miniconda3\envs\bio4\lib\site-packages\napari\layers\image\image.py in interpolation(self=<Image layer 'binary_blobs std-proj'>, interpolation='linear')
    481             )
    482         else:
--> 483             self._interpolation[self._ndisplay] = Interpolation(interpolation)
        self._interpolation = {2: <Interpolation.NEAREST: 'nearest'>, 3: <Interpolation3D.LINEAR: 'linear'>}
        self._ndisplay = 2
        global Interpolation = <enum 'Interpolation'>
        interpolation = 'linear'
    484         self.events.interpolation(value=self._interpolation[self._ndisplay])
    485

~\miniconda3\envs\bio4\lib\site-packages\napari\utils\misc.py in __call__(cls=<enum 'Interpolation'>, value='linear', names=None, module=None, qualname=None, type=None, start=1)
    249         if names is None:
    250             if isinstance(value, str):
--> 251                 return super().__call__(value.lower())
        global super.__call__ = undefined
        value.lower = <built-in method lower of str object at 0x000002381BA56130>
    252             elif isinstance(value, cls):
    253                 return value

~\miniconda3\envs\bio4\lib\enum.py in __call__(cls=<enum 'Interpolation'>, value='linear', names=None, module=None, qualname=None, type=None, start=1)
    337         """
    338         if names is None:  # simple value lookup
--> 339             return cls.__new__(cls, value)
        cls.__new__ = <function Enum.__new__ at 0x0000023875A93790>
        cls = <enum 'Interpolation'>
        value = 'linear'
    340         # otherwise, functional API: we're creating a new Enum type
    341         return cls._create_(

~\miniconda3\envs\bio4\lib\enum.py in __new__(cls=<enum 'Interpolation'>, value='linear')
    661                 ve_exc = ValueError("%r is not a valid %s" % (value, cls.__name__))
    662                 if result is None and exc is None:
--> 663                     raise ve_exc
        ve_exc = None
    664                 elif exc is None:
    665                     exc = TypeError(

ValueError: 'linear' is not a valid Interpolation
```

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior

When doing the projection before switching to 3D view mode, it all works.

## Environment

 - Please copy and paste the information at napari info option in help menubar here:

napari: 0.4.11rc1
Platform: Windows-10-10.0.19042-SP0
Python: 3.8.10 | packaged by conda-forge | (default, May 11 2021, 06:25:23) [MSC v.1916 64 bit (AMD64)]
Qt: 5.15.2
PyQt5: 5.15.4
NumPy: 1.21.2
SciPy: 1.7.1
Dask: 2021.08.1
VisPy: 0.8.0

OpenGL:
- GL version: 4.6.14756 Compatibility Profile Context 20.40.44.02 27.20.14044.2001
- MAX_TEXTURE_SIZE: 16384

Screens:
- screen 1: resolution 1920x1200, scale 1.0

Plugins:
- Measurements (Plot profile): 0.1.4
- clEsperanto: 0.10.0
- console: 0.0.3
- napari-features: 0.1.3
- scikit-image: 0.4.11rc1
- svg: 0.1.5
 - Any other relevant information:

## Additional context

<!-- Add any other context about the problem here. -->



Discussion:
thanks!  easy one.  will fix soon

Resolving patch:
diff --git a/napari/layers/_layer_actions.py b/napari/layers/_layer_actions.py
--- a/napari/layers/_layer_actions.py
+++ b/napari/layers/_layer_actions.py
@@ -71,7 +71,6 @@ def _project(ll: LayerList, axis: int = 0, mode='max'):
         **layer._get_base_state(),
         'name': f'{layer} {mode}-proj',
         'colormap': layer.colormap.name,
-        'interpolation': layer.interpolation,
         'rendering': layer.rendering,
     }
     new = Layer.create(data, meta, layer._type_string)


Test patch: