[vtkusers] Jet colormap in vtk?

Luke Dodd luke.dodd at gmail.com
Thu Jan 14 11:10:15 EST 2010


If you've got Matlab just output RGB lookup table with a few hundred
rows using its jet function. That's how I'm using the colour map in my
code.

Here is the java code that seems to work for me (note I've not looked
over this at all, I can hardly remember creating it.)

public class Jet {
	public static double [][] jet = {
		{0,0,5.200000e-01},
		{0,0,5.400000e-01},
		{0,0,5.600000e-01},
		{0,0,5.800000e-01},
		{0,0,6.000000e-01},
		{0,0,6.200000e-01},
		{0,0,6.400000e-01},
		{0,0,6.600000e-01},
		{0,0,6.800000e-01},
		{0,0,7.000000e-01},
		{0,0,7.200000e-01},
		{0,0,7.400000e-01},
		{0,0,7.600000e-01},
		{0,0,7.800000e-01},
		{0,0,8.000000e-01},
		{0,0,8.200000e-01},
		{0,0,8.400000e-01},
		{0,0,8.600000e-01},
		{0,0,8.800000e-01},
		{0,0,9.000000e-01},
		{0,0,9.200000e-01},
		{0,0,9.400000e-01},
		{0,0,9.600000e-01},
		{0,0,9.800000e-01},
		{0,0,1},
		{0,2.000000e-02,1},
		{0,4.000000e-02,1},
		{0,6.000000e-02,1},
		{0,8.000000e-02,1},
		{0,1.000000e-01,1},
		{0,1.200000e-01,1},
		{0,1.400000e-01,1},
		{0,1.600000e-01,1},
		{0,1.800000e-01,1},
		{0,2.000000e-01,1},
		{0,2.200000e-01,1},
		{0,2.400000e-01,1},
		{0,2.600000e-01,1},
		{0,2.800000e-01,1},
		{0,3.000000e-01,1},
		{0,3.200000e-01,1},
		{0,3.400000e-01,1},
		{0,3.600000e-01,1},
		{0,3.800000e-01,1},
		{0,4.000000e-01,1},
		{0,4.200000e-01,1},
		{0,4.400000e-01,1},
		{0,4.600000e-01,1},
		{0,4.800000e-01,1},
		{0,5.000000e-01,1},
		{0,5.200000e-01,1},
		{0,5.400000e-01,1},
		{0,5.600000e-01,1},
		{0,5.800000e-01,1},
		{0,6.000000e-01,1},
		{0,6.200000e-01,1},
		{0,6.400000e-01,1},
		{0,6.600000e-01,1},
		{0,6.800000e-01,1},
		{0,7.000000e-01,1},
		{0,7.200000e-01,1},
		{0,7.400000e-01,1},
		{0,7.600000e-01,1},
		{0,7.800000e-01,1},
		{0,8.000000e-01,1},
		{0,8.200000e-01,1},
		{0,8.400000e-01,1},
		{0,8.600000e-01,1},
		{0,8.800000e-01,1},
		{0,9.000000e-01,1},
		{0,9.200000e-01,1},
		{0,9.400000e-01,1},
		{0,9.600000e-01,1},
		{0,9.800000e-01,1},
		{0,1,1},
		{2.000000e-02,1,9.800000e-01},
		{4.000000e-02,1,9.600000e-01},
		{6.000000e-02,1,9.400000e-01},
		{8.000000e-02,1,9.200000e-01},
		{1.000000e-01,1,9.000000e-01},
		{1.200000e-01,1,8.800000e-01},
		{1.400000e-01,1,8.600000e-01},
		{1.600000e-01,1,8.400000e-01},
		{1.800000e-01,1,8.200000e-01},
		{2.000000e-01,1,8.000000e-01},
		{2.200000e-01,1,7.800000e-01},
		{2.400000e-01,1,7.600000e-01},
		{2.600000e-01,1,7.400000e-01},
		{2.800000e-01,1,7.200000e-01},
		{3.000000e-01,1,7.000000e-01},
		{3.200000e-01,1,6.800000e-01},
		{3.400000e-01,1,6.600000e-01},
		{3.600000e-01,1,6.400000e-01},
		{3.800000e-01,1,6.200000e-01},
		{4.000000e-01,1,6.000000e-01},
		{4.200000e-01,1,5.800000e-01},
		{4.400000e-01,1,5.600000e-01},
		{4.600000e-01,1,5.400000e-01},
		{4.800000e-01,1,5.200000e-01},
		{5.000000e-01,1,5.000000e-01},
		{5.200000e-01,1,4.800000e-01},
		{5.400000e-01,1,4.600000e-01},
		{5.600000e-01,1,4.400000e-01},
		{5.800000e-01,1,4.200000e-01},
		{6.000000e-01,1,4.000000e-01},
		{6.200000e-01,1,3.800000e-01},
		{6.400000e-01,1,3.600000e-01},
		{6.600000e-01,1,3.400000e-01},
		{6.800000e-01,1,3.200000e-01},
		{7.000000e-01,1,3.000000e-01},
		{7.200000e-01,1,2.800000e-01},
		{7.400000e-01,1,2.600000e-01},
		{7.600000e-01,1,2.400000e-01},
		{7.800000e-01,1,2.200000e-01},
		{8.000000e-01,1,2.000000e-01},
		{8.200000e-01,1,1.800000e-01},
		{8.400000e-01,1,1.600000e-01},
		{8.600000e-01,1,1.400000e-01},
		{8.800000e-01,1,1.200000e-01},
		{9.000000e-01,1,1.000000e-01},
		{9.200000e-01,1,8.000000e-02},
		{9.400000e-01,1,6.000000e-02},
		{9.600000e-01,1,4.000000e-02},
		{9.800000e-01,1,2.000000e-02},
		{1,1,0},
		{1,9.800000e-01,0},
		{1,9.600000e-01,0},
		{1,9.400000e-01,0},
		{1,9.200000e-01,0},
		{1,9.000000e-01,0},
		{1,8.800000e-01,0},
		{1,8.600000e-01,0},
		{1,8.400000e-01,0},
		{1,8.200000e-01,0},
		{1,8.000000e-01,0},
		{1,7.800000e-01,0},
		{1,7.600000e-01,0},
		{1,7.400000e-01,0},
		{1,7.200000e-01,0},
		{1,7.000000e-01,0},
		{1,6.800000e-01,0},
		{1,6.600000e-01,0},
		{1,6.400000e-01,0},
		{1,6.200000e-01,0},
		{1,6.000000e-01,0},
		{1,5.800000e-01,0},
		{1,5.600000e-01,0},
		{1,5.400000e-01,0},
		{1,5.200000e-01,0},
		{1,5.000000e-01,0},
		{1,4.800000e-01,0},
		{1,4.600000e-01,0},
		{1,4.400000e-01,0},
		{1,4.200000e-01,0},
		{1,4.000000e-01,0},
		{1,3.800000e-01,0},
		{1,3.600000e-01,0},
		{1,3.400000e-01,0},
		{1,3.200000e-01,0},
		{1,3.000000e-01,0},
		{1,2.800000e-01,0},
		{1,2.600000e-01,0},
		{1,2.400000e-01,0},
		{1,2.200000e-01,0},
		{1,2.000000e-01,0},
		{1,1.800000e-01,0},
		{1,1.600000e-01,0},
		{1,1.400000e-01,0},
		{1,1.200000e-01,0},
		{1,1.000000e-01,0},
		{1,8.000000e-02,0},
		{1,6.000000e-02,0},
		{1,4.000000e-02,0},
		{1,2.000000e-02,0},
		{1,0,0},
		{9.800000e-01,0,0},
		{9.600000e-01,0,0},
		{9.400000e-01,0,0},
		{9.200000e-01,0,0},
		{9.000000e-01,0,0},
		{8.800000e-01,0,0},
		{8.600000e-01,0,0},
		{8.400000e-01,0,0},
		{8.200000e-01,0,0},
		{8.000000e-01,0,0},
		{7.800000e-01,0,0},
		{7.600000e-01,0,0},
		{7.400000e-01,0,0},
		{7.200000e-01,0,0},
		{7.000000e-01,0,0},
		{6.800000e-01,0,0},
		{6.600000e-01,0,0},
		{6.400000e-01,0,0},
		{6.200000e-01,0,0},
		{6.000000e-01,0,0},
		{5.800000e-01,0,0},
		{5.600000e-01,0,0},
		{5.400000e-01,0,0},
		{5.200000e-01,0,0},
		{5.000000e-01,0,0}
	};
	
	static public vtkLookupTable getLookuptable(){
		vtkLookupTable t = new vtkLookupTable();
		t.SetNumberOfColors(jet.length);
		for(int i = 0; i < jet.length; i++)
			t.SetTableValue(i,jet[i][0], jet[i][1], jet[i][2], 1.0d);
		
		return t;
	}
	
	static public vtkColorTransferFunction
getColorTransferFunction(double min, double max){
		vtkColorTransferFunction t = new vtkColorTransferFunction();
		t.SetRange(min, max);
		double d = (max-min)/(jet.length-1);
		for(int i = 0; i < jet.length; i++)
			t.AddRGBPoint(min + i*d, jet[i][0], jet[i][1], jet[i][2]);
		return t;
	}
}

2010/1/13  <lynx.abraxas at freenet.de>:
> Hello!
>
>
> Currently  I'm  wondering how I can get "jet" colormap in vtk. It's not HSV at
> constant S and V but some how related. Is there a function that can  create  a
> jet LUT as shown here:
> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/colormap.html
>
> Thanks for any help or hints
> Lynx
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list