Method summary
- __init__(self, num_entries)
- get_color(self, f)
- get_color_hsva(self, f)
- get_pos_color(self, f)
- get_pos_rgba_color_lerped(self, f)
- insert_control_point(self, new_point)
- load(self, file_name)
- load_from_vtk_volume_prop(self, volume_prop)
- save(self, file_name)
- scaling_parameters_changed(self)
- set_scaling_function(self, new_function_string)
- set_scaling_function_parameter(self, new_parameter)
- sort_control_points(self)
- store_to_vtk_lookup_table(self, vtk_table, num_entries = 256)
- store_to_vtk_volume_prop(self, volume_prop, scalar_range)
- update(self)
Methods
- __init__(self, num_entries)
- get_color(self, f)
return (r,g,b,a) tuple in self.table for fraction f in [0,1].
- get_color_hsva(self, f)
return (h,s,v,a) tuple in self.table_hsva for fraction f in [0,1].
- get_pos_color(self, f)
return a Color object representing the color which is lies at position f in [0..1] in the current gradient
- get_pos_rgba_color_lerped(self, f)
return a (r,g,b,a) color representing the color which is lies at position f in [0..1] in the current gradient. if f is outside the [0..1] interval, the result will be clamped to this interval.
- insert_control_point(self, new_point)
Insert a new control point into the table. Does sort the control points, but does NOT update the table.
- load(self, file_name)
Load control point set from file FileName and recalculate gradient table.
- load_from_vtk_volume_prop(self, volume_prop)
Given a vtkVolumeProperty, this initializes the control points of the gradient table. This works best when a ctf.ColorTransferFunction and PiecewiseFunction are used.
Note that it is not as easy to setup the control points from a LUT because the LUT may end up having more than the size of the table editor here. It also usually does not make sense to do this with a LUT.
- save(self, file_name)
Save control point set into a new file FileName. It is not checked whether the file already exists. Further writes out a VTK .lut file and a .jpg file showing the gradients.
- scaling_parameters_changed(self)
Recompile the scaling function.
- set_scaling_function(self, new_function_string)
Set scaling function. new_function_string is a string describing the function, e.g. 'x**(4*a)'
- set_scaling_function_parameter(self, new_parameter)
Set the 'a' parameter of the scaling function
- sort_control_points(self)
Sort control points by position. Call this if the position of any control point was changed externally. The control point array always has to be sorted.
- store_to_vtk_lookup_table(self, vtk_table, num_entries = 256)
Store current color table in vtk_table, an instance of tvtk.LookupTable.
- store_to_vtk_volume_prop(self, volume_prop, scalar_range)
Given a tvtk.VolumeProperty and a scalar range to map values into, this sets the CTF based on the current control points.
- update(self)
Recalculate the gradient table from the control points. The colors are interpolated linearly between each two control points in hsva space.