Hi,<br><br>I needed to import a lookup table for volume plots that I saved from the GUI into Python, and I saw that this feature is not available, and still pending as reported here:<br><br><a href="http://paraview.org/Bug/view.php?id=9273">http://paraview.org/Bug/view.php?id=9273</a><br>
<br>I wrote a little function, attached below, that parses the xml file and returns the LUT, the piecewise function and the color space name. It works for me, so if you need to do this, feel free to use it. But suggestions how to improve it are more than welcome! Regards,<br>
<br>Milos<br><br>-----------------------------------------------------------------------------------------------------------<br><br><span style="font-family: courier new,monospace;">import xml.dom.minidom</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">def colormap(filein):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Â Â Â </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Â Â Â map=xml.dom.minidom.parse(filein)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Â Â Â rlist=map.getElementsByTagName('Point')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Â Â Â rlist2=map.getElementsByTagName('ColorMap')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Â Â Â colorspace=str(rlist2[0].attributes["space"].value)</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Â Â Â piecewise_fun = []</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Â Â Â lut = []</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Â Â Â for i in range(len(rlist)):</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Â Â Â Â Â Â Â x=float(rlist[i].attributes["x"].value)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Â Â Â Â Â Â Â o=float(rlist[i].attributes["o"].value)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Â Â Â Â Â Â Â r=float(rlist[i].attributes["r"].value)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Â Â Â Â Â Â Â g=float(rlist[i].attributes["g"].value)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Â Â Â Â Â Â Â b=float(rlist[i].attributes["b"].value)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Â Â Â Â Â Â </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Â Â Â Â Â Â Â piecewise_fun.append(x)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Â Â Â Â Â Â Â piecewise_fun.append(o)</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Â Â Â Â Â Â Â lut.append(x)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Â Â Â Â Â Â Â lut.append(r)Â Â Â Â Â Â </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">Â Â Â Â Â Â Â lut.append(g)Â Â Â Â </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Â Â Â Â Â Â Â lut.append(b)</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Â Â Â return colorspace, piecewise_fun, lut</span><br><br clear="all"><br>-- <br><font color="#888888"><div>
<span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div>
<div><span>Miloš Ilak</span></div><div>Linné Flow Centre</div><div>KTH
Mechanics, Stockholm </div><div>+46(0) 8 790-7152</div><div><a href="http://www2.mech.kth.se/%7Eilak/" target="_blank">www2.mech.kth.se/~<span>ilak</span></a><br><br></div></div></span></span>
</div></font><br>