New in ParaView: Changes to color/opacity presets
In ParaView, color presets provide a way for user to access of palette of predefined color maps that can be used for pseudocoloring datasets using data variables. Management of presets in ParaView has been revamped for ParaView 4.4 There were several major focuses of this new work including making the UI easier to use, adding support for opacity transfer functions in presets, and ability to access the presets in Python scripts. In this article we take a fresh look at presets.
Accessing the presets
Presets can be accessed using the Color Map Editor panel. When the active source is being colored (or pseudocolored) using a data variable in the active view, the Color Map Editor panel can be used to fine tune the scalar to colors (or opacities) mapping. While you can always manually setup the color and opacity transfer functions, you can also load a preset. To popup the Choose Preset dialog, you use the icon. It’s shown under the Mapping Data group (Figure 1: left) or Annotations group (Figure 1: right), if using categorical color mapping.
Navigating the Choose Preset dialog
The Import/Export buttons allow you to import or export preset. To export presets, simple select one or muliple presets in the Presets table and then click the Export button. Presets are exported in a JSON format that is consistent with the format used for settings.
Remove can be used to remove an imported preset. The button is not enabled for any of the builtin presets.
The Choose Preset dialog is quite similar for categories color maps, the only difference is that the Options to load: list is different.
Saving a preset
You can save your current color (and opacity) maps as a preset using the button on the Color Map Editor. That will pop up the Save Preset Options dialog that allows you to pick whether to save the opacity map with the preset as well. Check the Save opacities checkbox to save opacities along with the color in the present. While saving a preset doesn’t provide the option to now save color map, users can always pick to load only opacities when applying a preset.
Python API
ParaView 4.4 how supports an API to load presets through Python. You can simply use the tracing capabilities to determine the calls to make to load a specific preset (assuming a unique name).
from paraview.simple import * # get color transfer function/color map for 'RTData' rTDataLUT = GetColorTransferFunction('RTData') # get opacity transfer function/opacity map for 'RTData' rTDataPWF = GetOpacityTransferFunction('RTData') #------------------------------------------------ # Loading a color map alone #------------------------------------------------ # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. rTDataLUT.ApplyPreset('Rainbow Desaturated', True) #---------------------------------------------------------- # Loading a color and opacity map and preserve preset ranges #---------------------------------------------------------- # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. rTDataLUT.ApplyPreset('My Preset', False) # Apply a preset using its name. Note this may not work as expected when presets have duplicate names. rTDataPWF.ApplyPreset('My Preset', False)
Hi, I am using Paraview 5.0.1. Regarding presets, I can select a preset and make it as default in the older versions. However with 5.0.1, I am not able to find the “make as default” option. How to make a particular preset as default in 5.0.1?
@Satish, it’s one of the buttons at the bottom-left corner on the Color Map Editor dialog.