def set_ctf(v, ctf): '''Set the volume object's ctf''' from tvtk.util.ctf import set_lut v._ctf = ctf v._volume_property.set_color(v._ctf) v.update_ctf = True set_lut(v.module_manager.scalar_lut_manager.lut, v._volume_property)
def _set_cutoff(volume, cutoff): range_min, range_max = volume.current_range otf = PiecewiseFunction() otf.add_point(range_min, 0.0) otf.add_point(range_max, 0.2) volume._otf = otf volume.volume_property.set_scalar_opacity(otf) ctf = ColorTransferFunction() ctf.range = volume.current_range ctf.add_rgb_point(range_min, 1.0, 0.275, 0.0) ctf.add_rgb_point(range_max, 1.0, 0.275, 0.0) volume._ctf = ctf volume.volume_property.set_color(ctf) set_lut(volume.lut_manager.lut, volume.volume_property)
def _update_ctf_fired(self): set_lut(self.lut_manager.lut, self._volume_property) self.render()