[vtkusers] Notification after interaction with vtkComposite(TransferFunction|ControlPoints)Item
Elvis Stansvik
elvis.stansvik at orexplore.com
Fri Dec 16 15:38:49 EST 2016
2016-08-30 8:14 GMT+02:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:
> 2016-06-27 15:55 GMT+02:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:
>>
>> 2016-06-22 12:23 GMT+02:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:
>>>
>>> 2016-06-22 11:07 GMT+02:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:
>>>>
>>>> 2016-06-22 10:36 GMT+02:00 Elvis Stansvik
>>>> <elvis.stansvik at orexplore.com>:
>>>>>
>>>>> 2016-06-21 16:02 GMT+02:00 Elvis Stansvik
>>>>> <elvis.stansvik at orexplore.com>:
>>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> I'm using a vtkCompositeTransferFunctionItem +
>>>>>> vtkCompositeControlPointsItem in a vtkChartXY to modify the transfer
>>>>>> functions used for some volume rendering.
>>>>>>
>>>>>> Is there some event from one of these items I can observe that will
>>>>>> fire once interaction has occurred? I know I can observe the ModifiedEvent
>>>>>> of the vtkCompositeTransferFunctionItem, but when dragging points around, it
>>>>>> will fire on each mouse move. I need to be notified only once the
>>>>>> interaction has stopped.
>>>>>
>>>>>
>>>>> Looking at the code, I noticed that vtkControlPointsItem seem to emit
>>>>> vtkCommand::StartInteractionEvent and vtkCommand::EndInteractionEvent
>>>>> (though I'm not sure...), and since vtkCompositeControlPointsItem indirectly
>>>>> inherits vtkControlPointsItem, I tried to observe
>>>>> vtkCommand::EndInteractionEvent with
>>>>>
>>>>> self._pointsItem.AddObserver(vtkCommand.EndInteractionEvent,
>>>>> lambda *_: print('interaction
>>>>> ended'))
>>>>>
>>>>> where self._pointsItem is my vtkCompositeControlPointsItem.
>>>>>
>>>>> But it seems the event is not emitted when I interact with the points.
>>>>>
>>>>> Any ideas here? Surely there must be some way of being notified when
>>>>> interaction with the color transfer functions has ended? My use case is that
>>>>> I don't want to issue a re-render of my volume each time the mouse moves
>>>>> when dragging a point around. Only when dragging finally stops do I want to
>>>>> re-render.
>>>>>
>>>>> Any advice is much appriciated.
>>>>
>>>>
>>>> After some more experimentation, trying to observe various events on the
>>>> items, the chart, the context view and the context scene, I've realized I
>>>> can observe
>>>>
>>>> vtkCommand.LeftButtonReleaseEvent
>>>> vtkCommand.RightButtonReleaseEvent
>>>> vtkCommand.MiddleButtonReleaseEvent
>>>>
>>>> on the context scene. This will work as a workaround, but seems overly
>>>> liberal and complicated. Is there no single event on the composite control
>>>> points item or the composite transfer function item I could observe?
>>>
>>>
>>> Although I realized now that this approach won't work, since for some
>>> reason, by the time I get the vtkCommand.MiddleButtonReleaseEvent, the point
>>> has not yet been deleted. So still looking for a proper solution.
>>
>>
>> Noone knows how this can be done? I noticed that ParaView also has this
>> behavior (that the rendering is updated on each mouse move when dragging a
>> point in the transfer function). For me, this will be too heavy :/ Only once
>> mouse movement stops do I want to re-render. But I can't seem to find a way
>> to do this when using these VTK-bundled transfer function editing widgets.
>
>
> Sorry to bump my own thread, but I'm still searching for a solution here. I
> find it incredible that this wouldn't be possible. Anyone know how I can be
> notified once editing of a transfer function stops when using these editor
> widgets?
>
> Thanks in advance,
> Elvis
Has really noone faced this problem before? I must be a unicorn! :)
At the moment, I'm doing
void ColorEditor::mouseReleaseEvent(QMouseEvent *event)
{
// Hack: We don't want to emit functionModified each time a
control point moves
// during dragging, as it leads to too many Render() calls
and a sluggish
// experience, but there seems to be no way in VTK to be
notified when the
// interaction with a point in a vtkControlPointsItem ends
(user releases
// a point). See my thread at [1]. As a workaround, we emit
functionModified
// each time the mouse is released over the editor widget,
since more often
// than not, this marks the end of a point move.
//
// [1]
http://public.kitware.com/pipermail/vtkusers/2016-June/095609.html
emit functionModified();
VTKWidget::mouseReleaseEvent(event);
}
in the QVTKWidget subclass I have for the chart, as a sort of
compromise, but it's too liberal obviously.
Thanks,
Elvis
>
>>
>> Elvis
>>
>>>
>>>
>>> Elvis
>>>
>>>>
>>>>
>>>>
>>>> Elvis
>>>>
>>>>>
>>>>> Elvis
>>>>>
>>>>>>
>>>>>> Thanks in advance,
>>>>>> Elvis
>>>>>
>>>>>
>>>>
>>>
>>
>
More information about the vtkusers
mailing list