问题
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)
回答1:
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);
来源:https://stackoverflow.com/questions/33011167/how-to-set-window-width-window-centers-with-vtkimageactor-or-vtkactor