重用颜色传递函数和透明度传递函数

匿名 (未验证) 提交于 2019-12-03 00:19:01
    // MIP     // Create an opacity ramp from the window and level values.     // Color is white. Blending is MIP.     case 0:       colorFun->AddRGBSegment(0.0, 1.0, 1.0, 1.0, 255.0, 1.0, 1.0, 1.0 );       opacityFun->AddSegment( opacityLevel - 0.5*opacityWindow, 0.0,                               opacityLevel + 0.5*opacityWindow, 1.0 );       mapper->SetBlendModeToMaximumIntensity();       break;      // CompositeRamp     // Create a ramp from the window and level values. Use compositing     // without shading. Color is a ramp from black to white.     case 1:       colorFun->AddRGBSegment(opacityLevel - 0.5*opacityWindow, 0.0, 0.0, 0.0,                               opacityLevel + 0.5*opacityWindow, 1.0, 1.0, 1.0 );       opacityFun->AddSegment( opacityLevel - 0.5*opacityWindow, 0.0,                               opacityLevel + 0.5*opacityWindow, 1.0 );       mapper->SetBlendModeToComposite();       property->ShadeOff();       break;      // CompositeShadeRamp     // Create a ramp from the window and level values. Use compositing     // with shading. Color is white.     case 2:       colorFun->AddRGBSegment(0.0, 1.0, 1.0, 1.0, 255.0, 1.0, 1.0, 1.0 );       opacityFun->AddSegment( opacityLevel - 0.5*opacityWindow, 0.0,                               opacityLevel + 0.5*opacityWindow, 1.0 );       mapper->SetBlendModeToComposite();       property->ShadeOn();       break;      // CT_Skin     // Use compositing and functions set to highlight skin in CT data     // Not for use on RGB data     case 3:       colorFun->AddRGBPoint( -3024, 0, 0, 0, 0.5, 0.0 );       colorFun->AddRGBPoint( -1000, .62, .36, .18, 0.5, 0.0 );       colorFun->AddRGBPoint( -500, .88, .60, .29, 0.33, 0.45 );       colorFun->AddRGBPoint( 3071, .83, .66, 1, 0.5, 0.0 );        opacityFun->AddPoint(-3024, 0, 0.5, 0.0 );       opacityFun->AddPoint(-1000, 0, 0.5, 0.0 );       opacityFun->AddPoint(-500, 1.0, 0.33, 0.45 );       opacityFun->AddPoint(3071, 1.0, 0.5, 0.0);        mapper->SetBlendModeToComposite();       property->ShadeOn();       property->SetAmbient(0.1);       property->SetDiffuse(0.9);       property->SetSpecular(0.2);       property->SetSpecularPower(10.0);       property->SetScalarOpacityUnitDistance(0.8919);       break;      // CT_Bone     // Use compositing and functions set to highlight bone in CT data     // Not for use on RGB data     case 4:       colorFun->AddRGBPoint( -3024, 0, 0, 0, 0.5, 0.0 );       colorFun->AddRGBPoint( -16, 0.73, 0.25, 0.30, 0.49, .61 );       colorFun->AddRGBPoint( 641, .90, .82, .56, .5, 0.0 );       colorFun->AddRGBPoint( 3071, 1, 1, 1, .5, 0.0 );        opacityFun->AddPoint(-3024, 0, 0.5, 0.0 );       opacityFun->AddPoint(-16, 0, .49, .61 );       opacityFun->AddPoint(641, .72, .5, 0.0 );       opacityFun->AddPoint(3071, .71, 0.5, 0.0);        mapper->SetBlendModeToComposite();       property->ShadeOn();       property->SetAmbient(0.1);       property->SetDiffuse(0.9);       property->SetSpecular(0.2);       property->SetSpecularPower(10.0);       property->SetScalarOpacityUnitDistance(0.8919);       break;      // CT_Muscle     // Use compositing and functions set to highlight muscle in CT data     // Not for use on RGB data     case 5:       colorFun->AddRGBPoint( -3024, 0, 0, 0, 0.5, 0.0 );       colorFun->AddRGBPoint( -155, .55, .25, .15, 0.5, .92 );       colorFun->AddRGBPoint( 217, .88, .60, .29, 0.33, 0.45 );       colorFun->AddRGBPoint( 420, 1, .94, .95, 0.5, 0.0 );       colorFun->AddRGBPoint( 3071, .83, .66, 1, 0.5, 0.0 );        opacityFun->AddPoint(-3024, 0, 0.5, 0.0 );       opacityFun->AddPoint(-155, 0, 0.5, 0.92 );       opacityFun->AddPoint(217, .68, 0.33, 0.45 );       opacityFun->AddPoint(420,.83, 0.5, 0.0);       opacityFun->AddPoint(3071, .80, 0.5, 0.0);        mapper->SetBlendModeToComposite();       property->ShadeOn();       property->SetAmbient(0.1);       property->SetDiffuse(0.9);       property->SetSpecular(0.2);       property->SetSpecularPower(10.0);       property->SetScalarOpacityUnitDistance(0.8919);       break;      // RGB_Composite     // Use compositing and functions set to highlight red/green/blue regions     // in RGB data. Not for use on single component data     case 6:       opacityFun->AddPoint(0, 0.0);       opacityFun->AddPoint(5.0, 0.0);       opacityFun->AddPoint(30.0, 0.05);       opacityFun->AddPoint(31.0, 0.0);       opacityFun->AddPoint(90.0, 0.0);       opacityFun->AddPoint(100.0, 0.3);       opacityFun->AddPoint(110.0, 0.0);       opacityFun->AddPoint(190.0, 0.0);       opacityFun->AddPoint(200.0, 0.4);       opacityFun->AddPoint(210.0, 0.0);       opacityFun->AddPoint(245.0, 0.0);       opacityFun->AddPoint(255.0, 0.5);        mapper->SetBlendModeToComposite();       property->ShadeOff();       property->SetScalarOpacityUnitDistance(1.0);       break;

demo:https://lorensen.github.io/VTKExamples/site/Cxx/VolumeRendering/FixedPointVolumeRayCastMapperCT/

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!