Hoang Anh Tuan
Hoang Anh Tuan

Reputation: 63

How to set Window Width/Window Centers with vtkImageActor (or vtkActor)?

I want to set Windows Width/ Windows Center value when use vtkImageActor/vtkActor. But I could not find the way to solve it. (If I use vtkActor2d, it's okay, but I don't want to use it)

Upvotes: 0

Views: 1416

Answers (1)

JohnnyQ
JohnnyQ

Reputation: 1611

Attach a vtkWindowLevelLookupTable to your mapper.

Basic Example:

vtkSmartPointer<vtkWindowLevelLookupTable> myLookupTable = 
vtkSmartPointer<vtkWindowLevelLookupTable>::New();

double WindowWidth = myImageReader->GetOutput()->GetScalarRange()[1] - myImageReader->GetOutput()->GetScalarRange()[0]; double WindowLevel = (myImageReader->GetOutput()->GetScalarRange()[1] + myImageReader->GetOutput()->GetScalarRange()[0]) / 2.0;

myLookupTable->SetWindow(WindowWidth); myLookupTable->SetLevel(WindowLevel); myMapper->SetLookupTable(myLookupTable);

Upvotes: 1

Related Questions