BodenmillerGroup / napari-imc

Imaging Mass Cytometry (IMC) file type support for napari
MIT License
9 stars 2 forks source link

Save All Layers - colormap IMC not found #22

Open StefanosVoglis opened 2 years ago

StefanosVoglis commented 2 years ago

When trying to save multiple layers which were adjusted using napari-imc, error "colormap name IMC not found" appears.

File ~\anaconda3\envs\napari-env\lib\site-packages\napari_svg\layer_to_xml.py:110, in image_to_xml(data=<class 'numpy.ndarray'> (1000, 1000) float32, meta={'attenuation': 0.05, 'blending': 'additive', 'colormap': 'IMC', 'contrast_limits': [0.0, 15.112740308718573], 'experimental_clipping_planes': [], 'experimental_slicing_plane': {'enabled': False, 'normal': (1.0, 0.0, 0.0), 'position': (0.0, 0.0, 0.0), 'thickness': 1.0}, 'gamma': 1.0, 'interpolation': 'gaussian', 'iso_threshold': 0.5, 'metadata': {'channel': 'Vimenti_655((3791))Pt196', 'imc_acquisition_layer': True, 'imc_file_acquisition': r'\[path]i\imc_raw\2022011...w\20220112_SV_MelanomaBM_ImmunePanel_Test.mcd A17'}, ...})
    105     image = image / color_range
    107 # get colormap
    108 # TODO: Currently we only support vispy colormaps, need to
    109 # add support for all napari colormaps, matters for Labels too.
--> 110 cmap = get_colormap(colormap_name)
        colormap_name = 'IMC'
    112 # apply colormap to data
    113 mapped_image = cmap[image.ravel()]

File ~\anaconda3\envs\napari-env\lib\site-packages\vispy\color\colormap.py:1148, in get_colormap(name='IMC', *args=(), **kwargs={})
   1146         raise KeyError('colormap name %s not found' % name)
   1147 else:
-> 1148     raise KeyError('colormap name %s not found' % name)
        name = 'IMC'
        'colormap name %s not found' % name = 'colormap name IMC not found'
   1149 return cmap

KeyError: 'colormap name IMC not found'
jwindhager commented 2 years ago

Thanks for reporting this - indeed, napari-imc uses custom colormaps, which currently aren't fully supported by napari. Unfortunately, there is no easy way to fix this. With the refactoring of napari-imc (see here), this will probably be addressed in Q3/Q4 2022.