<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-04-15 18:51 GMT+02:00 Cory Quammen <span dir="ltr"><<a href="mailto:cory.quammen@kitware.com" target="_blank">cory.quammen@kitware.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="">On Fri, Apr 15, 2016 at 11:46 AM, Elvis Stansvik<br>
<<a href="mailto:elvis.stansvik@orexplore.com">elvis.stansvik@orexplore.com</a>> wrote:<br>
> 2016-04-15 16:36 GMT+02:00 Elvis Stansvik <<a href="mailto:elvis.stansvik@orexplore.com">elvis.stansvik@orexplore.com</a>>:<br>
>><br>
>> 2016-04-15 16:09 GMT+02:00 Cory Quammen <<a href="mailto:cory.quammen@kitware.com">cory.quammen@kitware.com</a>>:<br>
>>><br>
>>> Hi Elvis,<br>
>>><br>
>>> Have a look at<br>
>>><br>
>>><br>
>>> <a href="http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Charts/Core/Testing/Cxx/TestScalarsToColors.cxx" rel="noreferrer" target="_blank">http://www.vtk.org/gitweb?p=VTK.git;a=blob;f=Charts/Core/Testing/Cxx/TestScalarsToColors.cxx</a><br>
>>><br>
>>> for an example of how to set up the transfer function editors used in<br>
>>> ParaView.<br>
>>><br>
>>> You can eliminate the check at the end for vtkOpenGL2ContextDevice2D -<br>
>>> make sure to initialize and start the interactor, though.<br>
>>><br>
>>> I don't see anything in this example that won't work in Python - if<br>
>>> there is, please report back any problems you encounter.<br>
>><br>
>><br>
>> Excellent, thanks a lot. I'll report back how it went.<br>
><br>
><br>
> Worked like a charm :) It's not quite the same as the editors in ParaView<br>
> though. In ParaView, the opacity and color transfer functions are edited<br>
> separately, like this:<br>
><br>
> <a href="https://blog.kitware.com/blog/files/48_1536770536.png" rel="noreferrer" target="_blank">https://blog.kitware.com/blog/files/48_1536770536.png</a><br>
><br>
> Do you know if it's possible to get that kind of editing through VTK<br>
> classes, with the color transfer function edited using a gradient editor<br>
> below and the X/Y editor only for the the opacity transfer function, or is<br>
> ParaView doing something custom here?<br>
<br>
</span>Yes. You can use a vtkPiecewiseFunctionItem and<br>
vtkPiecewiseControlePointsItem to edit the opacity function and a<br>
vtkColorTransferFunctionItem and a vtkColorTransferControlPointsItem<br>
to edit the color transfer function. These can be displayed in two<br>
separate widgets, much like ParaView does. In each widget, you can<br>
have a vtkContextView. This is probably the easiest implementation for<br>
what you are after.<br></blockquote><div><br></div><div>Ah, excellent. Thanks. It was the vtkPiecewiseFunctionItem I was missing. Was searching for something called "opacity" or somesuch, but makes sense it's just a general piecewise function editor class.<br><br></div><div>Elvis<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<span class=""><font color="#888888"><br>
Cory<br>
</font></span><div class=""><div class="h5"><br>
> (I the class vtkCompositeTransferFunctionItem has "composite" in its name<br>
> precisely because it provides editing of both color/opacity in the same<br>
> editor, while I would like the separated approach that ParaView has.)<br>
><br>
> Elvis<br>
><br>
>><br>
>> Elvis<br>
>><br>
>>><br>
>>><br>
>>> HTH,<br>
>>> Cory<br>
>>><br>
>>> On Fri, Apr 15, 2016 at 8:54 AM, Elvis Stansvik<br>
>>> <<a href="mailto:elvis.stansvik@orexplore.com">elvis.stansvik@orexplore.com</a>> wrote:<br>
>>> > Hi all,<br>
>>> ><br>
>>> > I'd like to use the transfer function editors that VTK seems to provide<br>
>>> > (used by e.g. Paraview) from Python. Is it possible?<br>
>>> ><br>
>>> > Looking at<br>
>>> ><br>
>>> > <a href="http://www.vtk.org/pipermail/vtkusers/2013-December/082410.html" rel="noreferrer" target="_blank">http://www.vtk.org/pipermail/vtkusers/2013-December/082410.html</a><br>
>>> ><br>
>>> > I read the slightly worrying:<br>
>>> ><br>
>>> > "[...] Save/restore state and python interface are not working as<br>
>>> > expected. [...]"<br>
>>> ><br>
>>> > Though that was an old message when the new editors were first<br>
>>> > introduced in<br>
>>> > 2013. Is it still the case that the Python interface for the editor<br>
>>> > classes<br>
>>> > is not working as expected?<br>
>>> ><br>
>>> > Does anyone know of a Python application/example that makes use of the<br>
>>> > editors? (I'm using VTK 6.2 and PyQt 5.5.1).<br>
>>> ><br>
>>> > Thanks,<br>
>>> > Elvis<br>
>>> ><br>
>>> > _______________________________________________<br>
>>> > Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
>>> ><br>
>>> > Visit other Kitware open-source projects at<br>
>>> > <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>>> ><br>
>>> > Please keep messages on-topic and check the VTK FAQ at:<br>
>>> > <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
>>> ><br>
>>> > Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
>>> ><br>
>>> > Follow this link to subscribe/unsubscribe:<br>
>>> > <a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
>>> ><br>
>>><br>
>>><br>
>>><br>
>>> --<br>
>>> Cory Quammen<br>
>>> R&D Engineer<br>
>>> Kitware, Inc.<br>
>><br>
>><br>
><br>
<br>
<br>
<br>
--<br>
Cory Quammen<br>
R&D Engineer<br>
Kitware, Inc.<br>
</div></div></blockquote></div><br></div></div>