[Paraview-developers] Changing ColorMaps.xml format
Utkarsh Ayachit
utkarsh.ayachit at kitware.com
Tue Apr 14 15:42:33 EDT 2015
Folks,
I am looking at adding tracing support for loading color map presets.
When doing that,
I am also looking at extending the "presets" mechanism to support
saving/loading opacity transfer function (along with color) and other
things that may be important in preset.
As I am doing this, I realize that the ColorMaps XML format is very
limited, for example, there's no way to save the BelowRangeColor in a
preset. If we go on extending the XML to add support for other
attributes on the color/opacity map that a user may potentially want
to save in a color map, we would just end up with a different way to
specifying what the XML state for the PVLookupTable proxy saves
anyways. If I remember correctly, we invented the ColorMap XML format
since we thought the lookuptable proxy's XML state will be too complex
for a user to manually create.
So here's a proposal: why don't we change the color map file format to
be a JSON instead, that matches what we currently save in
UserSettings.json file anyways. e.g.
{
"Annotations" : [ "100", "100" ],
"BelowRangeColor" : [ 0.6666666666666666, 0, 0 ],
"ColorSpace" : "HSV",
"NanColor" : [ 1, 1, 0 ],
"RGBPoints" : [
37.35310363769531, 0.278431, 0.278431, 0.858824,
71.59813206481934, 0, 0, 0.360784,
105.6036847686768, 0, 1, 1,
140.0881889190674, 0, 0.501961, 0,
174.0937416229248, 1, 1, 0,
208.3387700500488, 1, 0.380392, 0,
242.5837984771728, 0.419608, 0, 0,
276.8288269042969, 0.878431, 0.301961, 0.301961
],
"UseBelowRangeColor" : 1
}
All fields are of course optional. Thus for the attributes supported
by the current color map xml, the JSON would only be something like:
{
"ColorSpace" : "HSV",
"NanColor" : [ 1, 1, 0 ],
"RGBPoints" : [
37.35310363769531, 0.278431, 0.278431, 0.858824,
71.59813206481934, 0, 0, 0.360784,
105.6036847686768, 0, 1, 1,
140.0881889190674, 0, 0.501961, 0,
174.0937416229248, 1, 1, 0,
208.3387700500488, 1, 0.380392, 0,
242.5837984771728, 0.419608, 0, 0,
276.8288269042969, 0.878431, 0.301961, 0.301961
]
}
This is not much more complex the current color map XML, for example:
<ColorMap name="Rainbow Desaturated" space="HSV">
<Point x="0.0" r="0.278431372549" g="0.278431372549"
b="0.858823529412" o="0.0"/>
<Point x="0.143" r="0.0" g="0.0" b="0.360784313725" o="0.143"/>
<Point x="0.285" r="0.0" g="1.0" b="1.0" o="0.285"/>
<Point x="0.429" r="0.0" g="0.501960784314" b="0.0" o="0.429"/>
<Point x="0.571" r="1.0" g="1.0" b="0.0" o="0.571"/>
<Point x="0.714" r="1.0" g="0.380392156863" b="0.0" o="0.714"/>
<Point x="0.857" r="0.419607843137" g="0.0" b="0.0" o="0.857"/>
<Point x="1.0" r="0.878431372549" g="0.301960784314"
b="0.301960784314" o="1.0"/>
<NaN r="1.0" g="1.0" b="0.0"/>
</ColorMap>
Of course, we'll support loading old style XMLs for backwards
compatibiltiy as well as a tool to convert old style XMLs to the new
style json.
Thoughts? Objections? Alternative suggestions?
Utkarsh
More information about the Paraview-developers
mailing list