[Paraview] Plugin to modify the current transfer function

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Tue Dec 3 21:50:12 EST 2013


Joe,

In ParaView, one rarely directly changes the underlying VTK objects,
instead uses the Proxy API. You should stick with updating the
"RGBPoints" property on the lookup table proxy
(repr->getLookupTable()->getProxy()).

e.g.

vtkSMProxy* lutProxy = repr->getLookupTable()->getProxy();
helper(lutProxy, "RGBPoints");
double rgbPoints = {10, 0, 0, 0,
                             100, 0, 0, 0};
vtkSMPropertyHelper(lutProxy, "RGBPoints").Set(rgbPoints, 8);
lutProxy->UpdateVTKObjects();


Utkarsh

On Tue, Dec 3, 2013 at 3:33 PM, Joe Ping-Lin Hsiao <phsiao at cs.unc.edu> wrote:
> I figured it  out. What I need is
>
> GUI_SOURCES
>    ${UI_BUILT_SOURCES}
>
> in ADD_PARAVIEW_PLUGIN().
>
> However instead modifying the transfer function, what I actually what to do
> is editing the Scalar to Color map. I have
>
> pqDataRepresentation* repr =
> pqActiveObjects::instance().activeRepresentation();
>
> vtkColorTransferFunction *ctf =
> vtkColorTransferFunction::SafeDownCast(repr->getLookupTable()->getProxy()->GetClientSideObject());
> ctf->AddRGBPoint(10, 0, 0, 0);
> ctf->AddRGBPoint(100, 0, 0, 0);
>
> in my plugin's constructor, but when I open the transfer function editor
> after applying the plugin, there's no new point in the color map. There are
> just the two default color points. Am I missing something?
>
>
> On Wed, Nov 27, 2013 at 2:56 PM, Joe Ping-Lin Hsiao <phsiao at cs.unc.edu>
> wrote:
>>
>> Which libraries should I link to use pqActiveObjects? I tried
>> ${PARAVIEW_BUILD_SHARED_LIBS} but it doesn't work.
>>
>> Joe
>>
>>
>> On Sat, Nov 23, 2013 at 5:48 PM, Utkarsh Ayachit
>> <utkarsh.ayachit at kitware.com> wrote:
>>>
>>> Yes, you can indeed write a client-side plugin that updates the active
>>> opacity transfer function. Your plugin can monitor pqActiveObjects
>>> singleton to get access to the active representation and from that you
>>> can access it's ScalarOpacityFunction. Look at pqColorMapEditor and
>>> pqColorOpacityEditorWidget in ParaView 4.1.0 source to see how that
>>> could be done.
>>>
>>> Utkarsh
>>>
>>> On Fri, Nov 15, 2013 at 10:36 AM, Joe Ping-Lin Hsiao <phsiao at cs.unc.edu>
>>> wrote:
>>> > I want to modify the transfer function from my plugin, e.g. add and
>>> > delete
>>> > points.
>>> > In VTK, it would be calling vtkPiecewiseFunction->AddPoint(). Can I do
>>> > that
>>> > in Paraview?
>>> >
>>> > Thanks,
>>> > Joe
>>> >
>>> > _______________________________________________
>>> > 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 ParaView Wiki at:
>>> > http://paraview.org/Wiki/ParaView
>>> >
>>> > Follow this link to subscribe/unsubscribe:
>>> > http://www.paraview.org/mailman/listinfo/paraview
>>> >
>>
>>
>


More information about the ParaView mailing list