问题描述
我想在使用 vtkImageActor/vtkActor 时设置 Windows Width/Windows Center 值.但我找不到解决它的方法.(如果我用vtkActor2d也可以,但是我不想用)
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)
推荐答案
将 vtkWindowLevelLookupTable
附加到您的映射器.
Attach a vtkWindowLevelLookupTable
to your mapper.
基本示例:
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;
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);
myLookupTable->SetWindow(WindowWidth);myLookupTable->SetLevel(WindowLevel);myMapper->SetLookupTable(myLookupTable);
这篇关于如何使用 vtkImageActor(或 vtkActor)设置窗口宽度/窗口中心?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!