I made registration from CT to DSA, The right-top image is generated after DRR projection.
i want to paint drr image on VR window, Also DSA video is on background layer. The user can move or rotate drr projected image manually.
// load projected image and convert vector to scalar volume node,
// refer to vectortoscalar module
movedImage = "C:/PilotImage/Release/Slicer-build/bin/Release/bone.png";
QString cmd = QString(
"import vtk,slicer\n"
"inputVolumeNode=slicer.util.loadVolume('%1')\n"
"outputVolumeNode=slicer.mrmlScene.AddNewNodeByClass('vtkMRMLScalarVolumeNode')\n"
"ijkToRAS = vtk.vtkMatrix4x4()\n"
"inputVolumeNode.GetIJKToRASMatrix(ijkToRAS)\n"
"outputVolumeNode.SetIJKToRASMatrix(ijkToRAS)\n"
"extract=vtk.vtkImageExtractComponents()\n"
"extract.SetInputConnection(inputVolumeNode.GetImageDataConnection())\n"
"extract.SetComponents(0, 1, 2)\n"
"luminance=vtk.vtkImageLuminance()\n"
"luminance.SetInputConnection(extract.GetOutputPort())\n"
"luminance.Update()\n"
"outputVolumeNode.SetImageDataConnection(luminance.GetOutputPort())\n"
"outputVolumeNode.CreateDefaultDisplayNodes()\n"
"outputVolumeNode.SetName('BoneProjected')\n"
"displayNode=outputVolumeNode.GetVolumeDisplayNode()\n"
"displayNode.SetAndObserveColorNodeID('vtkMRMLColorTableNodeYellow')\n"
"slicer.mrmlScene.AddDefaultNode(displayNode)\n").arg(movedImage);
qSlicerPythonManager* pythonManager = qSlicerApplication::application()->pythonManager();
pythonManager->executeString(cmd);
//render projected image
vtkMRMLScalarVolumeNode* projecedNode = vtkMRMLScalarVolumeNode::SafeDownCast(
d->scene->GetFirstNodeByName("BoneProjected"));
vtkImageData* imageData = projecedNode->GetImageData();
vtkImageActor* image_actor = vtkImageActor::New();
image_actor->SetInputData(imageData);
auto threeDWidget = qSlicerApplication::application()->layoutManager()->threeDWidget(0);
auto view = threeDWidget->threeDView();
vtkRenderer* foregroundRenderer = vtkRenderer::New();
foregroundRenderer->InteractiveOff();
foregroundRenderer->AddActor(image_actor);
foregroundRenderer->SetLayer(1);
vtkRenderWindow* renderWindow = view->renderWindow();
renderWindow->AddRenderer(foregroundRenderer);
return;
Result is as below.
How can i display the drr image correctly with suitable color and direction.