changing colormap from file

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

changing colormap from file

Yannik Behr
Hi all,

I'm currently trying to change the LUT colormap to one that I defined
myself and load it using the 'file' button from the 'Colors and legends'
   mayavi object editor. I could neither find documentation on this on
the mayavi2 homepage nor on the mailing list. Is there anyone out there
who has done this before? Or could give me a hint how to do this?

Cheers,
Yannik



--
Yannik Behr
PhD Student in Seismology
School of Geography, Environment, and Earth Sciences
Victoria University of Wellington
P.O. Box 600
Wellington 6015
New Zealand

[hidden email]

ph. +64 (4) 463 5233 8369
fax.+64 (4) 463 5186
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: changing colormap from file

fred-2
Le 26/04/2010 07:53, Yannik Behr a écrit :
> Hi all,
Hi,

> I'm currently trying to change the LUT colormap to one that I defined
> myself and load it using the 'file' button from the 'Colors and legends'
>     mayavi object editor. I could neither find documentation on this on
> the mayavi2 homepage nor on the mailing list. Is there anyone out there
> who has done this before? Or could give me a hint how to do this?
I can't get your issue.

What are you trying to do?

Load a LUT file or create one?


Cheers,

--
Fred
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: changing colormap from file

Inigo Aldazabal Mensa
In reply to this post by Yannik Behr
El Lunes, 26 de Abril de 2010, Yannik Behr escribió:
> Hi all,
>
> I'm currently trying to change the LUT colormap to one that I defined
> myself and load it using the 'file' button from the 'Colors and legends'
>    mayavi object editor. I could neither find documentation on this on
> the mayavi2 homepage nor on the mailing list. Is there anyone out there
> who has done this before? Or could give me a hint how to do this?

I did this though:

Colors and legends -> Lut mode: file, filename: mylutfile

Being mylutfile:
--------------
LOOKUP_TABLE UnnamedTable 302
2.10937500e-01 7.500000e-01 9.33593750e-01 1.0000000e+00
1.28906250e-01 7.734375e-01 9.84375000e-01 1.0000000e+00
1.28906250e-01 7.656250e-01 9.88281250e-01 1.0000000e+00
...[up to 302 data lines]
---------------

If I recall properly for the rgb lut data you could give either integers  
from 0 to 255 or floats form 0. to 1., but you should check it for
yourself.

BTW I got the lut data from some plots I was given that I scanned and
extracted the RGB data from with numpy and then passed it to Mayavi so
that I finally ended up with something I could compare against. It was
really neat.

Thanks to the developers for this great application!



_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: changing colormap from file

Gael Varoquaux
In reply to this post by Yannik Behr
Hey Yannick

I have just cooked up an example showing how to do this. I am attaching
it to this mail. Please give me some feedback on it, I want to add it to
the docs.

HTH,

Gaël

On Mon, Apr 26, 2010 at 05:53:25PM +1200, Yannik Behr wrote:
> I'm currently trying to change the LUT colormap to one that I defined
> myself and load it using the 'file' button from the 'Colors and legends'
>    mayavi object editor. I could neither find documentation on this on
> the mayavi2 homepage nor on the mailing list. Is there anyone out there
> who has done this before? Or could give me a hint how to do this?


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev

test.py (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: changing colormap from file

fred-2
Gaël,

There is something I can't get in your example.

As I never use LUT editor, I have never realised this.

Why the LUT editor does not show the cool colormap?

In fact, it popups a Color Gradient Editor dialog, not a LUT editor.

If I save the colormap to a LUT file, this is the blue-red colormap
which is saved, not the cool one.

Should it not save the cool colormap, knowing this is the one which is
displayed?

I don't understand the logic :-/

In others words, if I want to modify the cool colormap, using the UI,
how could I do this ?


TIA

Cheers,

  --
Fred

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev

snapshot.png (504K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: changing colormap from file

Gael Varoquaux
On Mon, Apr 26, 2010 at 11:33:37AM +0200, Fred wrote:
> Why the LUT editor does not show the cool colormap?

Because the LUT editor works on colormaps that are not defined with LUT,
but with color transfer functions (it should not be called LUT editor).

> In fact, it popups a Color Gradient Editor dialog, not a LUT editor.

Right.

> If I save the colormap to a LUT file, this is the blue-red colormap  
> which is saved, not the cool one.

Correct. The LUT editor does not talk to the rest of the code. It's a
quick hack.

> Should it not save the cool colormap, knowing this is the one which is  
> displayed?
>
> I don't understand the logic :-/

No logic, just a limited amount of man-hours.

> In others words, if I want to modify the cool colormap, using the UI,  
> how could I do this ?

Write code to turn the Cool colormap in a CTF (which you should do
starting from the original definition of the cool color, not from the LUT
we built for it). Than you can apply the 'Color Gradient Editor' to it.

It's probably a few days of work for me to make the different colormap
codes fit together properly. It won't happen soon.


HTH,

Gaël
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: changing colormap from file

Yannik Behr
In reply to this post by Gael Varoquaux
Hi Gaël,

sorry for the latish reply and thanks a lot for your help. That was
exactly what I was looking for.

Cheers,
Yannik

Gael Varoquaux wrote:

> Hey Yannick
>
> I have just cooked up an example showing how to do this. I am attaching
> it to this mail. Please give me some feedback on it, I want to add it to
> the docs.
>
> HTH,
>
> Gaël
>
> On Mon, Apr 26, 2010 at 05:53:25PM +1200, Yannik Behr wrote:
>> I'm currently trying to change the LUT colormap to one that I defined
>> myself and load it using the 'file' button from the 'Colors and legends'
>>    mayavi object editor. I could neither find documentation on this on
>> the mayavi2 homepage nor on the mailing list. Is there anyone out there
>> who has done this before? Or could give me a hint how to do this?
>

--
Yannik Behr
PhD Student in Seismology
School of Geography, Environment, and Earth Sciences
Victoria University of Wellington
P.O. Box 600
Wellington 6015
New Zealand

[hidden email]

ph. +64 (4) 463 5233 8369
fax.+64 (4) 463 5186
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev