[vtkusers] re:How can I modify an vtkImageData manually?

Yixun Liu yxliu at fudan.edu.cn
Tue Aug 22 22:59:44 EDT 2006


Hi,

The reason maybe that you use a wrong data type.

Call reader->Update() then use reader->GetOutput()->GetScalarType() to get the correct data type. Then, assuming short*,
short *f = reader->GetOutput()->GetScalarPointer();
Then, in the loop use f[j] +=100 instead of f[j] += 10 you can see a notable change.

for(int k=0;k<360;k++){

  renWin->Render();

  ren1->GetActiveCamera()->Azimuth( 1 );
     for(int j=0;j<dims[0]*dims[1]*dims[2];j++){
     f[j]+=100;
      }



}

Cheers,

Yixun Liu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060823/964df723/attachment.htm>


More information about the vtkusers mailing list