[vtkusers] update scalars of vtkPoints

Sebastien Jourdain sebastien.jourdain at kitware.com
Thu Jul 1 09:45:28 EDT 2010


Hi Hagen,

Did you compiled VTK in Debug mode, or Release ?
Are you sure that the time you are giving do not include the time to
update the dataset ?
In which language is your code ? (C++, Java, Python, TCL...)

Seb

2010/7/1 Hagen Mölle <h.moelle at googlemail.com>:
> Hi again,
>
> using scalars->Modified() works. But now I returned to start. The
> visualization update of the vtkUnstructuredGrid with for example 7000 points
> takes about 40 seconds. So there is no difference in time consumption
> between creating a new dataset or updating the old dataset.
>
> I do not really understand why it takes vtk over 40 seconds to update the
> scalars in visualization of only 7000 points (vtkUnstructuredGrid). Is there
> any else I can do to bring down the update time?
>
> Hagen
>>
>> Hi Hagen,
>>
>> did you also try scalars->Modified() instead?
>>
>> With Modified() you tell the pipeline that the data object has to be
>> updated (also everything coming after this object in pipeline). You might
>> forgot to run Update() on your mapper the vtkUnstructedGrid is attached to
>> (or any other object that has Update() and is connected after the grid in
>> pipeline row). You might also forgot to call the Render() method to update
>> the renderer?
>>
>> Hope this helps!
>>
>> Sebastian Barth
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Hagen Mölle [mailto:h.moelle at googlemail.com]
>> Gesendet: Donnerstag, 1. Juli 2010 14:16
>> An: Barth, Sebastian
>> Cc: John Drescher; vtkusers at vtk.org; sebastien.jourdain at kitware.com
>> Betreff: Re: AW: [vtkusers] update scalars of vtkPoints
>>
>> Hi Sebastian,
>>
>> Thanks for your help. I got it working with vtkPolyData in my 2D
>> visualization.
>>
>> In my 3D visualization of measured points I still have the problem that
>> the scalars do not change. There I use vtkUnstructuredGrid instead of
>> vtkPolyData. Right now the update routine of the scalars looks like this
>> (pseudo code):
>>
>> scalars = vtkDataSet->GetPointData()->GetScalars()
>> for(number of scalars)
>> {
>>      update each scalar
>> }
>> vtkDataSet->Modified()
>>
>> The code is compiling for vtkUnstructuredGrid and vtkPolyData. But it
>> seems I have to do something additional to update the scalars of the
>> vtkUnstructuredGrid.
>>
>> Any idea?
>>
>> Hagen
>>
>>
>>
>>>
>>> Hello Hagen,
>>>
>>> did you forget to call Modified() of the vtkPolyData after altering the
>>> points? Otherwise the vtkPolyData does not know that their points, scalars
>>> or cells were changed.
>>>
>>> Sebastian Barth
>>>
>>> -----Ursprüngliche Nachricht-----
>>> Von: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] Im
>>> Auftrag von Hagen Mölle
>>> Gesendet: Donnerstag, 1. Juli 2010 08:26
>>> An: John Drescher; vtkusers at vtk.org; sebastien.jourdain at kitware.com
>>> Betreff: Re: [vtkusers] update scalars of vtkPoints
>>>
>>> On 06/30/2010 06:14 PM, John Drescher wrote:
>>>
>>>
>>>>
>>>> 2010/6/30 Sebastien Jourdain<sebastien.jourdain at kitware.com>:
>>>>
>>>>
>>>>
>>>>>
>>>>> Hi Hagen,
>>>>>
>>>>> As you said, you can start by simply change the data on the fly and
>>>>> call Render() once the change has been done. By change I mean point
>>>>> location, scalar data and even point number.
>>>>> But be aware that only one thread should be used in VTK otherwise they
>>>>> have to be synchronized.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> I think vtkPolyData->GetPointData->GetScalars()
>>>>
>>>> is where to start
>>>>
>>>> John
>>>>
>>>>
>>>>
>>>
>>> Hi Sebastien and John,
>>>
>>> Thanks for pointing out how to change the scalars of the points on the
>>> fly. So I need to alter the vtkDataArray which I get by
>>> vtkPolyData->GetPointData->GetScalars(). Hopefully this will work.
>>>
>>> Yesterday I tried to set new scalars by using the following method:
>>> vtkPolyData->GetPointData->SetScalars(vtkDoubleArray). So I did not
>>> generate a new dataset. But the visualization did not change during
>>> update. It seemed the old scalars where used during update.
>>>
>>> Hagen
>>> _______________________________________________
>>> 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
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.vtk.org/mailman/listinfo/vtkusers
>>>
>>>
>>
>>
>
>



More information about the vtkusers mailing list