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