Volume Rendering style.

This commit is contained in:
Krad
2022-08-29 09:23:38 +08:00
parent a53d3d395b
commit 20c53a173d

View File

@@ -63,11 +63,16 @@ VolumeRenderingViewer::VolumeRenderingViewer()
mapper->SetMinimumImageSampleDistance(1.0);
}
vtkNew<vtkColorTransferFunction> colorFun;
colorFun->SetScaleToLinear();
colorFun->AddRGBPoint(110.0,0.0,0.0,0.0);
colorFun->AddRGBPoint(121.0,0.5,0.25,0.125);
colorFun->AddRGBPoint(453.0,1.0,1,1);
colorFun->SetScaleToLinear();
colorFun->AddRGBPoint(80.0,0.0,0.0,0.0);
colorFun->AddRGBPoint(100.5,0.343,0.245,0.175);
colorFun->AddRGBPoint(300.0,0.9,0.6,0.3);
colorFun->AddRGBPoint(400.0,0.9,0.8,0.7);
colorFun->AddRGBPoint(500.0,1.,1.,1.);
// colorFun->ClampingOff();
// colorFun->AddRGBSegment(100.5,0.343,0.245,0.175,200.0,1.0,1.0,0.8);
// colorFun->AddRGBSegment(200.5,1.0,1.0,0.8,800.0,1.0,1.0,1);
vtkNew<vtkPiecewiseFunction> opacityFun;
opacityFun->AddPoint(120.5, 0.0);
// opacityFun->AddPoint(121.0, 1.0);
@@ -144,7 +149,7 @@ void VolumeRenderingViewer::InstallPipeline() {
this->Renderer->AddVolume(this->VolumeActor);
this->Renderer->AddViewProp(annotation);
Renderer->AddObserver(vtkCommand::EndEvent,this,&VolumeRenderingViewer::printFrameRate);
this->Renderer->SetBackground(0.3, 0.3, 0.3);
this->Renderer->SetBackground(0.0, 0.0, 0.0);
}
//TODO: annotation for orientation
}
@@ -239,7 +244,10 @@ void VolumeRenderingViewer::Render() {
if (RenderWindow && Interactor){
if (firstRender){
firstRender = false;
RenderWindow->SetDesiredUpdateRate(Interactor->GetDesiredUpdateRate());
Interactor->InvokeEvent(vtkCommand::StartInteractionEvent, nullptr);
SetViewDirection(0);
Render();
}
Interactor->Render();
}