[vtkusers] change imagedata during runtime

David Doria daviddoria at gmail.com
Thu Oct 27 09:44:43 EDT 2011


>
> On Thu, Oct 27, 2011 at 2:17 PM, Hikaruchan <
> Sandra.Schroetter.fl at ait.ac.at> wrote:
>
>> Hi!
>>
>> I am new to VTK, and maybe it is an too simple question, but I do not get
>> it
>> work. Hope you can help me.
>>
>> I have an application with four renderviews (three 2D, one 3D), where I
>> show
>> my different MRI Slices (sagittal, coronal and axial, and in 3D all of
>> them). Now I wanted to make a new Imagedata (which is no problem) and draw
>> to it (which is no problem). After a user input I change some of the
>> scalars
>> of the imagedata (using GetScalarPointer()), but my changes are not
>> displayed. I called
>>
>> electricDensityIma->Update(); //thats the vtkImageData
>>
>> after I have made my changes to imagedata.
>>
>> I don't know if it is important, but I make my image, then put a
>> vtkImageGaussianSmooth on it, then a vtkImageMedian3D then a
>> vtkImageReslice
>> and so on.
>>
>> But I don't get it work, that the display is updated. Hope someone can
>> help
>> me and explain me how a imagedata can be changed during runtime and
>> correcty
>> updated and displayed.
>>
>> Thank you in advance and please excuse my bad english. :-)
>
>
I believe you have to call electricDensityIma->Modified();. Since you are
changing the data directly (via the pointer), Modified() does not get called
automatically like when you change most things (with a SetXYZ() function).
The pipeline therefore does not know that anything has changed, so even by
calling Update() it has nothing to (and thus does not display the new data).
Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111027/1ea0a660/attachment.htm>


More information about the vtkusers mailing list