[vtkusers] Modify scalar values

Michnay Balázs michnay at freemail.hu
Thu Jan 20 09:25:11 EST 2005


He all,
I'd like to modify the scalar values of some pixels of a vtkImageData.
What I do is to get the scalarArray with GetPointData()->GetScalars() 
and then I set the number of tuples and components.
If I try to set a component value, I get an error message (assertion 
error).
What is the problem?
Thanks in advance,
Regards,
 MB

The code:
-------------

vtkDataArray *scalarArrayDestination = LabeledImage->GetPointData()-
>GetScalars();
scalarArrayDestination->SetNumberOfTuples(NumberOfPixels);
scalarArrayDestination->SetNumberOfComponents(scalarArraySource-
>GetNumberOfComponents());	

//The following line generates the error:
scalarArrayDestination->SetComponent(CurrentPixel,0, 1.0f);



More information about the vtkusers mailing list