Page 1 of 1

save an image of the colormap like a colorbar in matlab/matplotlib

Posted: Wed Aug 01, 2018 3:46 pm
by guillaume
Hello,

until now I used to take a caption of the screen with the anatomist colormap window open and then manually crop the screenshot before I can incorporate it in my figure, which is not convenient.

is there a way to save on the disk an image of the colormap automatically using pyAnatomist?

thks for your help!
gui

Re: save an image of the colormap like a colorbar in matlab/matplotlib

Posted: Wed Aug 15, 2018 9:18 pm
by riviere
Hi Guillaume,
Sorry I didn't see your post, the forum notification seems broken...
Palette images are all images in jpeg, png, or ima formats, but I guess what you want is the colormaps with scale factors applied, and associated image or texture values, right ?
Well, there is nothing builtin for that, it could be something we may add...
There is a colormap module, which allows to do it interactively: view the object in a window, select the object in the main window, and in the right-click menu, select "color -> show/hide palette". The palette will display in windows showing the selected object. A "save" button allows to save it. I guess this is what you need, but there is no dedicated API to do it in python. Anyway it's programmed in python (and using matplotlib actually) so there is definitely a way to call it from a script, but we have to dig in the code of the plugin. I'll tell you a bit later when I have a solution...
Denis