[vtkusers] vtkGPUVolumeRayCastMapper: Updateing ImageData after first Rendering?

zmantorn zmanvortex at gmail.com
Wed Feb 15 11:04:12 EST 2017


Since the interactor is tied to the renderwindow object and the renderwindow
object is tied to only the .NET panel object the GUI is not interrupted for
any interaction except with the panel object.

Here is my initialization code for a "document window". The vtkPanel object
is the .NET Windows Forms Panel object.

               * m_renwin->SetParentId(panelVtk->Handle.ToPointer());
		m_renwin->SetNumberOfLayers(5); // change to 5 layers

		m_iren = vtkRenderWindowInteractor::New();
		m_iren->SetDesiredUpdateRate(2.0);
		m_iren->SetRenderWindow(m_renwin);
		m_renwin->SetInteractor(m_iren);

		m_iren->Initialize();

		if (m_iren->GetInitialized() != 0)
			m_iren->UpdateSize(panelVtk->Width, panelVtk->Height);

		m_interactorstyle = vtkInteractorStyleUser::New();
		m_interactorstyle->SetMouseWheelMotionFactor(10.0);
		m_interactorstyle->SetAutoAdjustCameraClippingRange(0);
		m_iren->SetInteractorStyle(m_interactorstyle);

		m_picker = vtkWorldPointPicker::New();
		m_iren->SetPicker(m_picker);		

		m_backgroundrenderer = vtkRenderer::New();
		m_backgroundrenderer->SetLayer(0);
		m_backgroundrenderer->InteractiveOn();
		m_backgroundrenderer->SetActiveCamera(m_camera);
		m_backgroundrenderer->SetBackground(0.0, 0.0, 0.0);

		m_maprenderer = vtkRenderer::New();
		m_maprenderer->SetLayer(1);
		m_maprenderer->SetActiveCamera(m_camera);

		m_radarrenderer = vtkRenderer::New();
		m_radarrenderer->SetLayer(2);
		m_radarrenderer->SetActiveCamera(m_camera);
		m_radarrenderer->SetBackground(1.0, 1.0, 1.0);
		m_radarrenderer->AutomaticLightCreationOff();

		m_overlayrenderer = vtkRenderer::New();
		m_overlayrenderer->SetLayer(3);
		m_overlayrenderer->SetActiveCamera(m_camera);

		m_legendrenderer = vtkRenderer::New();
		m_legendrenderer->SetLayer(4);
		m_legendrenderer->SetActiveCamera(m_camera);

		m_renwin->AddRenderer(m_backgroundrenderer);

		m_renwin->AddRenderer(m_maprenderer);

		//radarrenderer->ResetCamera();
		m_renwin->AddRenderer(m_radarrenderer);

		m_renwin->AddRenderer(m_overlayrenderer);

		m_renwin->AddRenderer(m_legendrenderer);

		m_horizClipPlane = vtkPlane::New();

		//Selection actor
		m_selectionActor = vtkActor::New();
		m_selectionGlobeSource = vtkGlobeSource::New();

		// Conus Background
		m_lowResBackgroundActor = vtkActor::New();
		m_highResBackgroundActor = vtkActor::New();


		// County Lines
		m_countyLinesActor = vtkLODActor::New();
		m_countyLinesClipPlane = vtkPlane::New();
		m_countyLinesClipPlaneCollection = vtkPlaneCollection::New();
		m_countyLinesClipPlaneCollection->AddItem(m_horizClipPlane);
		m_countyLinesClipPlaneCollection->AddItem(m_countyLinesClipPlane);

		// County Texts
		m_countyTextActors = vtkPropCollection::New();


		//Light
		m_light = vtkLight::New();
		m_light->SetLightTypeToCameraLight();
		//m_light->SetDiffuseColor(1,0,0);
		//m_light->SetAmbientColor(0,1,0);
		//m_light->SetSpecularColor(0,0,1);
		m_light->SetIntensity(.85);

		

		//callbacks
		setOnLeftMouseDownDelegate();
		setOnLeftMouseReleaseDelegate();
		setOnMiddleMouseDownDelegate();
		setOnMiddleMouseReleaseDelegate();
		setOnRightMouseDownDelegate();
		setOnRightMouseReleaseDelegate();
		setOnKeyPressDelegate();
		setOnRenderDelegate();
		setOnMouseMoveDelegate();*

Here is the implementation of setOnMouseMoveDelegate:

*void SwisVtkRadarWindow::setOnMouseMoveDelegate()
	{
		vtkDotNetCommand* cmd = vtkDotNetCommand::New();
		cmd->SetCallback(gcnew vtkDotNetCallback(this,
&SwisVtkRadarWindows::SwisVtkRadarWindow::onVtkMouseMove));
		vtkRenderWindowInteractor* iren =
vtkRenderWindowInteractor::SafeDownCast(m_renwin->GetInteractor());
		m_interactorstyle->AddObserver(vtkCommand::MouseMoveEvent, cmd);
		cmd->Delete();		
	}*

Here is a clip of the onVtkMouseMove function in my "document" window:

*void SwisVtkRadarWindow::onVtkMouseMove(unsigned long eventId,
System::Object^ clientData)
	{
		switch (m_interact_state)
		{
		case 0:
			{				
				switch (m_interactorstyle->GetState())
				{
				case 1:  //VTKIS_ROTATE
					this->rotate();
					break;

				case 2:  //VTKIS_PAN
					this->pan();
					break;

				case 4:  //VTKIS_DOLLY
					this->dolly();
					break;                            
				}

			}
*

Do a search for the vtkDotNetCommand and vtkDotNetCallback code. I can't
remember where I got it.

Hope this helps.



--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkGPUVolumeRayCastMapper-Updateing-ImageData-after-first-Rendering-tp5742153p5742194.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list