From 4716739192da724691c1145365c670a8e139c232 Mon Sep 17 00:00:00 2001 From: Rafael Palomar Date: Wed, 8 Nov 2023 18:40:25 +0100 Subject: [PATCH] WIP: Add gaussian blur for resectograms and refactor --- ...vtkSlicerBezierSurfaceRepresentation3D.cxx | 274 ++++++++++-------- .../vtkSlicerBezierSurfaceRepresentation3D.h | 38 ++- 2 files changed, 186 insertions(+), 126 deletions(-) diff --git a/LiverMarkups/VTKWidgets/vtkSlicerBezierSurfaceRepresentation3D.cxx b/LiverMarkups/VTKWidgets/vtkSlicerBezierSurfaceRepresentation3D.cxx index 0edac6c..ae9ff2b 100644 --- a/LiverMarkups/VTKWidgets/vtkSlicerBezierSurfaceRepresentation3D.cxx +++ b/LiverMarkups/VTKWidgets/vtkSlicerBezierSurfaceRepresentation3D.cxx @@ -63,100 +63,71 @@ #include // VTK includes + #include -#include #include +#include +#include +#include #include +#include +#include #include #include +#include #include -#include +#include #include +#include #include #include #include #include #include #include +#include #include +#include +#include #include #include #include #include #include -#include -#include -#include "vtkRendererCollection.h" -#include #include -#include -#include +#include //------------------------------------------------------------------------------ vtkStandardNewMacro(vtkSlicerBezierSurfaceRepresentation3D); -static const int RENDERER_LAYER = 1; //------------------------------------------------------------------------------ vtkSlicerBezierSurfaceRepresentation3D::vtkSlicerBezierSurfaceRepresentation3D() + :DistanceMapVolumeNode(nullptr) { - this->BezierSurfaceSource = vtkSmartPointer::New(); - this->BezierSurfaceSource->SetResolution(20,20); - - // Set the initial position of the bezier surface - auto planeSource = vtkSmartPointer::New(); - planeSource->SetResolution(3,3); - planeSource->Update(); - this->BezierSurfaceNormals = vtkSmartPointer::New(); - this->BezierSurfaceNormals->SetInputConnection(this->BezierSurfaceSource->GetOutputPort()); + // ------------------------------------------------------------------------------------------ + // 1. Construct 3D visualization pipeline - this->BezierPlane = vtkSmartPointer::New(); - this->BezierPlane->SetResolution(20,20); - auto PlaneControlPoints = vtkSmartPointer::New(); - - for(int i=0;i<4;i++){ - PlaneControlPoints->InsertNextPoint(-60,(i*40),0); - PlaneControlPoints->InsertNextPoint(-20,(i*40),0); - PlaneControlPoints->InsertNextPoint(20,(i*40),0); - PlaneControlPoints->InsertNextPoint(60,(i*40),0); - - } - - this->BezierPlane->SetControlPoints(PlaneControlPoints); - this->BezierPlane->Update(); - - this->ResectogramCamera = vtkSmartPointer::New(); - ResectogramPlaneCenter(true); - - auto BezierPlanePoints = BezierPlane->GetOutput()->GetPoints()->GetData(); - BezierPlanePoints->SetName("BSPlanePoints"); - this->BezierSurfaceNormals->GetOutput()->GetPointData()->AddArray(BezierPlanePoints); + this->BezierSurfaceSource = vtkSmartPointer::New(); + this->BezierSurfaceSource->SetResolution(20, 20); + // Set the initial position of the bezier surface (3D) + auto BezierControlPointsPlaneSource = vtkSmartPointer::New(); + BezierControlPointsPlaneSource->SetResolution(3,3); + BezierControlPointsPlaneSource->Update(); this->BezierSurfaceControlPoints = vtkSmartPointer::New(); this->BezierSurfaceControlPoints->SetNumberOfPoints(16); - this->BezierSurfaceControlPoints->DeepCopy(planeSource->GetOutput()->GetPoints());; + this->BezierSurfaceControlPoints->DeepCopy(BezierControlPointsPlaneSource->GetOutput()->GetPoints()); + + this->BezierSurfaceNormals = vtkSmartPointer::New(); + this->BezierSurfaceNormals->SetInputConnection(this->BezierSurfaceSource->GetOutputPort()); this->BezierSurfaceResectionMapper = vtkSmartPointer::New(); this->BezierSurfaceResectionMapper->SetInputConnection(this->BezierSurfaceNormals->GetOutputPort()); this->BezierSurfaceActor = vtkSmartPointer::New(); this->BezierSurfaceActor->SetMapper(this->BezierSurfaceResectionMapper); - // if (!this->BezierSurfaceActor->GetTexture()) - // { - // auto image = vtkSmartPointer::New(); - // image->SetDimensions(1,1,1); - // image->AllocateScalars(VTK_FLOAT, 2); - // auto fakeTexture = vtkSmartPointer::New(); - // fakeTexture->SetInputData(image); - // this->BezierSurfaceActor->SetTexture(fakeTexture); - // } - - this->BezierSurfaceResectionMapper2D = vtkSmartPointer::New(); - this->BezierSurfaceResectionMapper2D->SetInputConnection(BezierPlane->GetOutputPort()); - this->BezierSurfaceActor2D = vtkSmartPointer::New(); - this->BezierSurfaceActor2D->SetMapper(this->BezierSurfaceResectionMapper2D); - this->ControlPolygonPolyData = vtkSmartPointer::New(); this->ControlPolygonTubeFilter = vtkSmartPointer::New(); this->ControlPolygonTubeFilter->SetInputData(this->ControlPolygonPolyData.GetPointer()); @@ -169,12 +140,96 @@ vtkSlicerBezierSurfaceRepresentation3D::vtkSlicerBezierSurfaceRepresentation3D() this->ControlPolygonActor = vtkSmartPointer::New(); this->ControlPolygonActor->SetMapper(this->ControlPolygonMapper); - this->DistanceMapVolumeNode = nullptr; + // auto PlaneControlPoints = vtkSmartPointer::New(); + + // for(int i=0;i<4;i++){ + // PlaneControlPoints->InsertNextPoint(-60,(i*40),0); + // PlaneControlPoints->InsertNextPoint(-20,(i*40),0); + // PlaneControlPoints->InsertNextPoint(20,(i*40),0); + // PlaneControlPoints->InsertNextPoint(60,(i*40),0); + + // }Resectogram Visualization pipeline + + // ------------------------------------------------------------------------------------------ + // 2. Construct Resectogram Visualization pipeline + + this->ResectogramPlaneSource = vtkSmartPointer::New(); + this->ResectogramPlaneSource->SetResolution(19, 19); + this->ResectogramPlaneSource->Update(); + + this->ResectogramCamera = vtkSmartPointer::New(); + this->ResectogramCamera->ParallelProjectionOn(); + + //ResectogramPlaneCenter(true); + + // auto BezierPlanePoints = BezierPlane->GetOutput()->GetPoints()->GetData(); + // if (BezierPlanePoints) + // { + // BezierPlanePoints->SetName("BSPlanePoints"); + + // } + // this->BezierSurfaceNormals->GetOutput()->GetPointData()->AddArray(BezierPlanePoints); + + + // vtkSmartPointer normalizedDeviceCoords = vtkSmartPointer::New(); + // normalizedDeviceCoords->SetCoordinateSystem(VTK_COORDINATE_NORMALIZED_DEVICE); + // double* worldCoords = normalizedDeviceCoords->GetComputedWorldValue(actor->GetRenderer()); + + this->ResectogramMapper= vtkSmartPointer::New(); + this->ResectogramMapper->SetInputConnection(ResectogramPlaneSource->GetOutputPort()); + this->ResectogramActor = vtkSmartPointer::New(); + this->ResectogramActor->SetMapper(this->ResectogramMapper); + + // double yViewport[4] = {0, 0.6, 0.3, 1.0}; + double viewport[4] = {0.0, 0.0, 0.3, 0.3}; + + this->ResectogramRenderer = vtkSmartPointer::New(); + this->ResectogramRenderer->SetLayer(RENDERER_LAYER); + this->ResectogramRenderer->InteractiveOff(); + this->ResectogramRenderer->SetActiveCamera(this->ResectogramCamera); + this->ResectogramRenderer->AddActor(this->ResectogramActor); + this->ResectogramRenderer->SetViewport(viewport); + // this->ResectogramRenderer->SetViewport(yViewport); + + this->ResectogramRenderPasses = vtkSmartPointer::New(); + this->ResectogramBlurPass = vtkSmartPointer::New(); + this->ResectogramBlurPass->SetDelegatePass(ResectogramRenderPasses); } //------------------------------------------------------------------------------ vtkSlicerBezierSurfaceRepresentation3D::~vtkSlicerBezierSurfaceRepresentation3D() = default; +//---------------------------------------------------------------------- +void vtkSlicerBezierSurfaceRepresentation3D::SetRenderer(vtkRenderer *renderer) +{ + this->Superclass::SetRenderer(renderer); + + if (renderer == nullptr) + { + return; + } + + auto renderWindow = renderer->GetRenderWindow(); + if (renderWindow == nullptr) + { + return; + } + + if (renderWindow->GetNumberOfLayers() < RENDERER_LAYER + 1) + { + renderWindow->SetNumberOfLayers(RENDERER_LAYER + 1); + } + + this->ResectogramRenderer->SetPass(this->ResectogramBlurPass); + double background[3]={0.0}; + double background2[3]={0.0}; + renderer->GetBackground(background); + renderer->GetBackground2(background2); + this->ResectogramRenderer->SetBackground(background); + this->ResectogramRenderer->SetBackground2(background2); + +} + //---------------------------------------------------------------------- void vtkSlicerBezierSurfaceRepresentation3D::UpdateFromMRML(vtkMRMLNode* caller, unsigned long event, void *callData /*=nullptr*/) { @@ -240,42 +295,33 @@ void vtkSlicerBezierSurfaceRepresentation3D::UpdateFromMRML(vtkMRMLNode* caller, this->BezierSurfaceResectionMapper->SetRasToIjkMatrixT(rasToIjkT); this->BezierSurfaceResectionMapper->SetIjkToTextureMatrixT(ijkToTextureT); - this->BezierSurfaceResectionMapper2D->SetRasToIjkMatrixT(rasToIjkT); - this->BezierSurfaceResectionMapper2D->SetIjkToTextureMatrixT(ijkToTextureT); + this->ResectogramMapper->SetRasToIjkMatrixT(rasToIjkT); + this->ResectogramMapper->SetIjkToTextureMatrixT(ijkToTextureT); } this->DistanceMapVolumeNode = distanceMap; } - //------------------- add new renderer here ----------------------// + auto renderWindow = vtkRenderWindow::SafeDownCast(this->GetRenderer()->GetRenderWindow()); if(BezierSurfaceDisplayNode->GetShowResection2D()) { - auto renderWindow1 = vtkRenderWindow::SafeDownCast(this->GetRenderer()->GetRenderWindow()); - auto renderers = renderWindow1->GetRenderers(); - if(renderers->GetNumberOfItems()!=5) - { - double yViewport[4] = {0, 0.6, 0.3, 1.0}; - - if (renderWindow1->GetNumberOfLayers() < RENDERER_LAYER+1) + if (!renderWindow->HasRenderer(this->ResectogramRenderer)) { - renderWindow1->SetNumberOfLayers( RENDERER_LAYER+1 ); + renderWindow->AddRenderer(ResectogramRenderer); } - auto CoRenderer2D = vtkSmartPointer::New(); - CoRenderer2D->SetLayer(RENDERER_LAYER); - CoRenderer2D->InteractiveOff(); - CoRenderer2D->SetActiveCamera(this->ResectogramCamera); - CoRenderer2D->AddActor(this->BezierSurfaceActor2D); - CoRenderer2D->SetViewport(yViewport); - renderWindow1->AddRenderer(CoRenderer2D); - renderWindow1->Render(); - } } + else{ + if (renderWindow->HasRenderer(this->ResectogramRenderer)) + { + renderWindow->RemoveRenderer(ResectogramRenderer); + } + } - if(BezierSurfaceDisplayNode->GetMirrorDisplay()){ - ResectogramPlaneCenter(true); - } else { - ResectogramPlaneCenter(false); - }; + // if(BezierSurfaceDisplayNode->GetMirrorDisplay()){ + // ResectogramPlaneCenter(true); + // } else { + // ResectogramPlaneCenter(false); + // }; this->NeedToRenderOn(); } @@ -294,7 +340,7 @@ void vtkSlicerBezierSurfaceRepresentation3D::ReleaseGraphicsResources( { this->Superclass::ReleaseGraphicsResources(win); this->BezierSurfaceActor->ReleaseGraphicsResources(win); - this->BezierSurfaceActor2D->ReleaseGraphicsResources(win); + this->ResectogramActor->ReleaseGraphicsResources(win); this->ControlPolygonActor->ReleaseGraphicsResources(win); } @@ -364,7 +410,7 @@ vtkTypeBool vtkSlicerBezierSurfaceRepresentation3D::HasTranslucentPolygonalGeome if (this->BezierSurfaceActor->GetVisibility() && this->BezierSurfaceActor->HasTranslucentPolygonalGeometry()) { return true; } - if (this->BezierSurfaceActor2D->GetVisibility() && this->BezierSurfaceActor2D->HasTranslucentPolygonalGeometry()) + if (this->ResectogramActor->GetVisibility() && this->ResectogramActor->HasTranslucentPolygonalGeometry()) { return true; } @@ -423,8 +469,8 @@ void vtkSlicerBezierSurfaceRepresentation3D::PrintSelf(ostream& os, vtkIndent in { os << indent << "BezierSurface Visibility: (none)\n"; } - if (this->BezierSurfaceActor2D) { - os << indent << "BezierSurface2D Visibility: " << this->BezierSurfaceActor2D->GetVisibility() << "\n"; + if (this->ResectogramActor) { + os << indent << "BezierSurface2D Visibility: " << this->ResectogramActor->GetVisibility() << "\n"; } else { @@ -474,17 +520,17 @@ void vtkSlicerBezierSurfaceRepresentation3D::UpdateBezierSurfaceGeometry(vtkMRML this->BezierSurfaceSource->SetControlPoints(this->BezierSurfaceControlPoints); this->BezierSurfaceSource->Update(); - this->BezierSurfaceSourcePoints = this->BezierSurfaceSource->GetOutput()->GetPoints()->GetData(); - this->BezierSurfaceSourcePoints->SetName("BSPoints"); + this->BezierSurfaceSourcePointsArray = this->BezierSurfaceSource->GetOutput()->GetPoints()->GetData(); + this->BezierSurfaceSourcePointsArray->SetName("BSPoints"); auto BezierSurfaceDisplayNode = vtkMRMLMarkupsBezierSurfaceDisplayNode::SafeDownCast(node->GetDisplayNode()); Ratio(BezierSurfaceDisplayNode->GetEnableFlexibleBoundary()); - - if(this->BezierPlane->GetOutput()->GetPointData()->GetArray("BSPoints")){ - this->BezierPlane->GetOutput()->GetPointData()->RemoveArray("BSPoints"); - this->BezierPlane->GetOutput()->GetPointData()->AddArray(this->BezierSurfaceSourcePoints); + //TODO: This replacement could happen via SetArray function instead of Remove/Add + if(this->ResectogramPlaneSource->GetOutput()->GetPointData()->GetArray("BSPoints")){ + this->ResectogramPlaneSource->GetOutput()->GetPointData()->RemoveArray("BSPoints"); + this->ResectogramPlaneSource->GetOutput()->GetPointData()->AddArray(this->BezierSurfaceSourcePointsArray); }else{ - this->BezierPlane->GetOutput()->GetPointData()->AddArray(this->BezierSurfaceSourcePoints); + this->ResectogramPlaneSource->GetOutput()->GetPointData()->AddArray(this->BezierSurfaceSourcePointsArray); } } } @@ -595,10 +641,10 @@ void vtkSlicerBezierSurfaceRepresentation3D::UpdateBezierSurfaceDisplay(vtkMRMLM this->BezierSurfaceResectionMapper->SetResectionMargin(node->GetResectionMargin()); this->BezierSurfaceResectionMapper->SetUncertaintyMargin(node->GetUncertaintyMargin()); - this->BezierSurfaceResectionMapper2D->SetResectionMargin(node->GetResectionMargin()); - this->BezierSurfaceResectionMapper2D->SetUncertaintyMargin(node->GetUncertaintyMargin()); - this->BezierSurfaceResectionMapper2D->SetHepaticContourThickness(node->GetHepaticContourThickness()); - this->BezierSurfaceResectionMapper2D->SetPortalContourThickness(node->GetPortalContourThickness()); + this->ResectogramMapper->SetResectionMargin(node->GetResectionMargin()); + this->ResectogramMapper->SetUncertaintyMargin(node->GetUncertaintyMargin()); + this->ResectogramMapper->SetHepaticContourThickness(node->GetHepaticContourThickness()); + this->ResectogramMapper->SetPortalContourThickness(node->GetPortalContourThickness()); if (displayNode) { @@ -617,20 +663,20 @@ void vtkSlicerBezierSurfaceRepresentation3D::UpdateBezierSurfaceDisplay(vtkMRMLM this->BezierSurfaceResectionMapper->SetGridThicknessFactor(0.0); } - this->BezierSurfaceResectionMapper2D->SetResectionColor(displayNode->GetResectionColor()); - this->BezierSurfaceResectionMapper2D->SetResectionGridColor(displayNode->GetResectionGridColor()); - this->BezierSurfaceResectionMapper2D->SetResectionMarginColor(displayNode->GetResectionMarginColor()); - this->BezierSurfaceResectionMapper2D->SetUncertaintyMarginColor(displayNode->GetUncertaintyMarginColor()); - this->BezierSurfaceResectionMapper2D->SetInterpolatedMargins(displayNode->GetInterpolatedMargins()); - this->BezierSurfaceResectionMapper2D->SetHepaticContourColor(displayNode->GetHepaticContourColor()); - this->BezierSurfaceResectionMapper2D->SetPortalContourColor(displayNode->GetPortalContourColor()); - this->BezierSurfaceResectionMapper2D->SetTextureNumComps(displayNode->GetTextureNumComps()); + this->ResectogramMapper->SetResectionColor(displayNode->GetResectionColor()); + this->ResectogramMapper->SetResectionGridColor(displayNode->GetResectionGridColor()); + this->ResectogramMapper->SetResectionMarginColor(displayNode->GetResectionMarginColor()); + this->ResectogramMapper->SetUncertaintyMarginColor(displayNode->GetUncertaintyMarginColor()); + this->ResectogramMapper->SetInterpolatedMargins(displayNode->GetInterpolatedMargins()); + this->ResectogramMapper->SetHepaticContourColor(displayNode->GetHepaticContourColor()); + this->ResectogramMapper->SetPortalContourColor(displayNode->GetPortalContourColor()); + this->ResectogramMapper->SetTextureNumComps(displayNode->GetTextureNumComps()); if (displayNode->GetGrid2DVisibility()){ - this->BezierSurfaceResectionMapper2D->SetGridDivisions(displayNode->GetGridDivisions()); - this->BezierSurfaceResectionMapper2D->SetGridThicknessFactor(displayNode->GetGridThickness()); + this->ResectogramMapper->SetGridDivisions(displayNode->GetGridDivisions()); + this->ResectogramMapper->SetGridThicknessFactor(displayNode->GetGridThickness()); } else { - this->BezierSurfaceResectionMapper2D->SetGridDivisions(0.0); - this->BezierSurfaceResectionMapper2D->SetGridThicknessFactor(0.0); + this->ResectogramMapper->SetGridDivisions(0.0); + this->ResectogramMapper->SetGridThicknessFactor(0.0); } } } @@ -658,12 +704,12 @@ void vtkSlicerBezierSurfaceRepresentation3D::Ratio(bool flexibleBoundery){ if (flexibleBoundery) { double disU = 0, disV = 0; - std::vector p0u = {this->BezierSurfaceSourcePoints->GetTuple3(0)[0],this->BezierSurfaceSourcePoints->GetTuple3(0)[1],this->BezierSurfaceSourcePoints->GetTuple3(0)[2]}; - std::vector p0v = {this->BezierSurfaceSourcePoints->GetTuple3(0)[0],this->BezierSurfaceSourcePoints->GetTuple3(0)[1],this->BezierSurfaceSourcePoints->GetTuple3(0)[2]}; + std::vector p0u = {this->BezierSurfaceSourcePointsArray->GetTuple3(0)[0],this->BezierSurfaceSourcePointsArray->GetTuple3(0)[1],this->BezierSurfaceSourcePointsArray->GetTuple3(0)[2]}; + std::vector p0v = {this->BezierSurfaceSourcePointsArray->GetTuple3(0)[0],this->BezierSurfaceSourcePointsArray->GetTuple3(0)[1],this->BezierSurfaceSourcePointsArray->GetTuple3(0)[2]}; for(int i = 1; i<20; i++){ - std::vector p1 = {this->BezierSurfaceSourcePoints->GetTuple3(i)[0],this->BezierSurfaceSourcePoints->GetTuple3(i)[1],this->BezierSurfaceSourcePoints->GetTuple3(i)[2]}; - std::vector p2 = {this->BezierSurfaceSourcePoints->GetTuple3(20*i)[0],this->BezierSurfaceSourcePoints->GetTuple3(20*i)[1],this->BezierSurfaceSourcePoints->GetTuple3(20*i)[2]}; + std::vector p1 = {this->BezierSurfaceSourcePointsArray->GetTuple3(i)[0],this->BezierSurfaceSourcePointsArray->GetTuple3(i)[1],this->BezierSurfaceSourcePointsArray->GetTuple3(i)[2]}; + std::vector p2 = {this->BezierSurfaceSourcePointsArray->GetTuple3(20*i)[0],this->BezierSurfaceSourcePointsArray->GetTuple3(20*i)[1],this->BezierSurfaceSourcePointsArray->GetTuple3(20*i)[2]}; auto d01 = sqrt(pow(p0u[0]-p1[0],2.0)+pow(p0u[1]-p1[1],2.0)+pow(p0u[2]-p1[2],2.0)); disU = disU + d01; @@ -686,7 +732,7 @@ void vtkSlicerBezierSurfaceRepresentation3D::Ratio(bool flexibleBoundery){ matR[0] = 1; matR[1] = 1; } - this->BezierSurfaceResectionMapper2D->SetMatRatio(matR); + this->ResectogramMapper->SetMatRatio(matR); } void vtkSlicerBezierSurfaceRepresentation3D::ResectogramPlaneCenter(bool mirror){ @@ -697,7 +743,7 @@ void vtkSlicerBezierSurfaceRepresentation3D::ResectogramPlaneCenter(bool mirror) z = -1; } double bounds[6]; - this->BezierPlane->GetOutput()->GetBounds(bounds); + this->ResectogramPlaneSource->GetOutput()->GetBounds(bounds); double center[3] = {(bounds[0]+bounds[1])/2, (bounds[2]+bounds[3])/2, z*100.0}; this->ResectogramCamera->SetPosition(center[0], center[1], center[2] * 3); this->ResectogramCamera->SetFocalPoint(center[0], center[1], center[2]); diff --git a/LiverMarkups/VTKWidgets/vtkSlicerBezierSurfaceRepresentation3D.h b/LiverMarkups/VTKWidgets/vtkSlicerBezierSurfaceRepresentation3D.h index e3cd66d..046696e 100644 --- a/LiverMarkups/VTKWidgets/vtkSlicerBezierSurfaceRepresentation3D.h +++ b/LiverMarkups/VTKWidgets/vtkSlicerBezierSurfaceRepresentation3D.h @@ -43,29 +43,32 @@ #include "vtkSlicerLiverMarkupsModuleVTKWidgetsExport.h" // Markups VTKWidgets includes -#include "vtkSlicerMarkupsWidgetRepresentation3D.h" #include "vtkMultiTextureObjectHelper.h" +#include "vtkSlicerMarkupsWidgetRepresentation3D.h" // MRML includes #include // VTK includes -#include -#include -#include "vtkOpenGLPolyDataMapper2D.h" #include #include +#include +#include +#include //------------------------------------------------------------------------------ class vtkBezierSurfaceSource; +class vtkGaussianBlurPass; class vtkOpenGLActor; +class vtkOpenGLBezierResectionPolyDataMapper; +class vtkOpenGLResection2DPolyDataMapper; +class vtkPlaneSource; +class vtkPoints; class vtkPolyData; class vtkPolyDataNormals; -class vtkPoints; +class vtkRenderStepsPass; class vtkTextureObject; class vtkTubeFilter; -class vtkOpenGLBezierResectionPolyDataMapper; -class vtkOpenGLResection2DPolyDataMapper; //------------------------------------------------------------------------------ class vtkMRMLMarkupsBezierSurfaceNode; @@ -75,6 +78,9 @@ class vtkMRMLScalarVolumeNode; class VTK_SLICER_LIVERMARKUPS_MODULE_VTKWIDGETS_EXPORT vtkSlicerBezierSurfaceRepresentation3D : public vtkSlicerMarkupsWidgetRepresentation3D { + +static const int RENDERER_LAYER = 1; + public: static vtkSlicerBezierSurfaceRepresentation3D* New(); vtkTypeMacro(vtkSlicerBezierSurfaceRepresentation3D, vtkSlicerMarkupsWidgetRepresentation3D); @@ -93,6 +99,9 @@ class VTK_SLICER_LIVERMARKUPS_MODULE_VTKWIDGETS_EXPORT vtkSlicerBezierSurfaceRep /// Return the bounds of the representation double *GetBounds() override; +protected: + void SetRenderer(vtkRenderer *ren) override; + protected: /// TransferDistanceMap void CreateAndTransferDistanceMapTexture(vtkMRMLScalarVolumeNode* node, int numComps); @@ -107,10 +116,10 @@ class VTK_SLICER_LIVERMARKUPS_MODULE_VTKWIDGETS_EXPORT vtkSlicerBezierSurfaceRep vtkSmartPointer BezierSurfaceResectionMapper; vtkSmartPointer BezierSurfaceActor; vtkSmartPointer BezierSurfaceNormals; - vtkSmartPointer BezierSurfaceActor2D; - vtkSmartPointer BezierSurfaceResectionMapper2D; - vtkSmartPointer BezierPlane; - vtkSmartPointer BezierSurfaceSourcePoints; + vtkSmartPointer ResectogramActor; + vtkSmartPointer ResectogramMapper; + vtkSmartPointer ResectogramPlaneSource; + vtkSmartPointer BezierSurfaceSourcePointsArray; vtkSmartPointer ResectogramCamera; @@ -126,7 +135,12 @@ class VTK_SLICER_LIVERMARKUPS_MODULE_VTKWIDGETS_EXPORT vtkSlicerBezierSurfaceRep vtkNew VBOShiftScale; vtkNew VBOInverseTransform; vtkWeakPointer ShaderProperty; - vtkSmartPointer CoRenderer2D; + + // create the basic VTK render steps + vtkSmartPointer ResectogramRenderPasses; + vtkSmartPointer ResectogramRenderer; + vtkSmartPointer ResectogramBlurPass; + // Vascular Segments related elements vtkSmartPointer VascularSegmentsTexture;