[vtkusers] memory leak by vtkImageViewer2 and vtkImageFlip

Jason 2130220212 at email.szu.edu.cn
Thu Apr 9 04:33:32 EDT 2015


I have already solve it by imageActor->SetOrientation(180,0,0); flip the
image by 180 degreen along Y.
if you want to flip the data instead of the render window , you can take a
look at this:

vtkSmartPointer<vtkImageData> result = vtkSmartPointer<vtkIMageData>::New();
result->DeepCopy(YourImage);  //DeepCopy your image to result
rImage->Update();

    double val;
    int i = 0;

    for(vtkIdType f = result->GetNumberOfPoints()-1; f > -1; f--)
    {
      val = YourImage->GetPointData()->GetScalars()->GetTuple1(f);
      result->GetPointData()->GetScalars->SetTuple1(i,val);
      i++;
    }
result->Update();

Ofcourse,you need to correct the position of f and i to fix your need.



--
View this message in context: http://vtk.1045678.n5.nabble.com/memory-leak-by-vtkImageViewer2-and-vtkImageFlip-tp5731414p5731415.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list