中间读取部分就不陈词滥调了。直接调色
![[太开心]](/static/emoticons/u592au5f00u5fc3.png)
。
vtkSmartPointer<vtkLookupTable> lookupTable =
vtkSmartPointer<vtkLookupTable>::New();
lookupTable->SetNumberOfTableValues(2);
lookupTable->SetRange(0.0,1.0);
lookupTable->SetTableValue( 0, 0.0, 0.0, 0.0, 0.0 ); //label 0 is transparent
lookupTable->SetTableValue( 1, 0.0, 1.0, 0.0, 0.5 ); //label 1 is opaque and green
lookupTable->Build();
vtkSmartPointer<vtkImageMapToColors> mapTransparency =
vtkSmartPointer<vtkImageMapToColors>::New();
mapTransparency->SetLookupTable(lookupTable);
mapTransparency->PassAlphaToOutputOn();
mapTransparency->SetInput(maskImage);