Esempio n. 1
0
mitk::Gizmo::HandleType mitk::GizmoInteractor::PickFrom3D(const InteractionPositionEvent* positionEvent)
{
  BaseRenderer* renderer = positionEvent->GetSender();
  auto& picker = m_Picker[renderer];
  if ( picker == nullptr )
  {
    picker = vtkSmartPointer<vtkCellPicker>::New();
    picker->SetTolerance(0.005);
    auto mapper = GetDataNode()->GetMapper(BaseRenderer::Standard3D);
    auto vtk_mapper = dynamic_cast<VtkMapper*>(mapper);
    if ( vtk_mapper )
    { // doing this each time is bizarre
      picker->AddPickList(vtk_mapper->GetVtkProp(renderer));
      picker->PickFromListOn();
    }
  }

  auto displayPosition = positionEvent->GetPointerPositionOnScreen();
  picker->Pick( displayPosition[0], displayPosition[1], 0,
                positionEvent->GetSender()->GetVtkRenderer() );

  vtkIdType pickedPointID = picker->GetPointId();
  if (pickedPointID == -1)
  {
      return Gizmo::NoHandle;
  }

  // _something_ picked
  return m_Gizmo->GetHandleFromPointID(pickedPointID);
}
Esempio n. 2
0
void mitk::VtkMapper::UpdateVtkTransform(mitk::BaseRenderer *renderer)
{
  vtkLinearTransform *vtktransform = GetDataNode()->GetVtkTransform(this->GetTimestep());

  auto *prop = dynamic_cast<vtkProp3D *>(GetVtkProp(renderer));
  if (prop)
    prop->SetUserTransform(vtktransform);
}
Esempio n. 3
0
void mitk::ContourModelMapper3D::MitkRenderVolumetricGeometry(BaseRenderer* renderer)
{
  if(IsVisible(renderer)==false)
    return;
  if ( GetVtkProp(renderer)->GetVisibility() )
  {
    this->GetVtkProp(renderer)->RenderVolumetricGeometry(renderer->GetVtkRenderer());
  }
}
Esempio n. 4
0
void VtkMapper3D::MitkRenderVolumetricGeometry(BaseRenderer* renderer)
{
  if(IsVisible(renderer)==false) 
    return;

  /* if(dynamic_cast<vtkLODProp3D*>(m_Prop3D) != NULL)
  {
  if(  dynamic_cast<BoolProperty*>(GetDataNode()->
  GetProperty("volumerendering",renderer).GetPointer())==NULL ||  
  dynamic_cast<BoolProperty*>(GetDataNode()->
  GetProperty("volumerendering",renderer).GetPointer())->GetValue() == false)    
  return;
  }*/

  if ( GetVtkProp(renderer)->GetVisibility() )
    GetVtkProp(renderer)->RenderVolumetricGeometry(renderer->GetVtkRenderer());

}
Esempio n. 5
0
void mitk::VtkOverlay::RemoveFromBaseRenderer(mitk::BaseRenderer *renderer)
{
  if(!renderer || !renderer->GetVtkRenderer())
     return;
  vtkSmartPointer<vtkProp> vtkProp = GetVtkProp(renderer);
  if(renderer->GetVtkRenderer()->HasViewProp(vtkProp))
  {
    renderer->GetVtkRenderer()->RemoveViewProp(vtkProp);
  }
}
Esempio n. 6
0
void mitk::VtkOverlay::RemoveFromRenderer(mitk::BaseRenderer *renderer, vtkRenderer *vtkrenderer)
{
  if(!renderer || !vtkrenderer)
     return;
  vtkSmartPointer<vtkProp> vtkProp = GetVtkProp(renderer);
  if(vtkrenderer->HasViewProp(vtkProp))
  {
    vtkrenderer->RemoveViewProp(vtkProp);
    mitk::RenderingManager::GetInstance()->RequestUpdate(vtkrenderer->GetRenderWindow());
  }
}
void mitk::FiberBundleXMapper2D::MitkRenderVolumetricGeometry(BaseRenderer* renderer)
{
    //  MITK_INFO << "FiberBundleMapper2D MitkRenderVolumentricGeometry(renderer)";
    if(IsVisible(renderer)==false)
        return;

    //TODO is it possible to have a visible BaseRenderer AND an invisible VtkRenderer???
    if ( GetVtkProp(renderer)->GetVisibility() )
        this->GetVtkProp(renderer)->RenderVolumetricGeometry(renderer->GetVtkRenderer());

}
Esempio n. 8
0
void mitk::VtkOverlay::AddToBaseRenderer(mitk::BaseRenderer *renderer)
{
  if(!renderer || !renderer->GetVtkRenderer())
    return;
  Update(renderer);
  vtkSmartPointer<vtkProp> vtkProp = GetVtkProp(renderer);
  if(renderer && renderer->GetVtkRenderer() && !renderer->GetVtkRenderer()->HasViewProp(vtkProp))
  {
    renderer->GetVtkRenderer()->AddViewProp(vtkProp);
  }
}
Esempio n. 9
0
void mitk::VtkMapper::MitkRenderTranslucentGeometry(BaseRenderer *renderer)
{
  bool visible = true;
  GetDataNode()->GetVisibility(visible, renderer, "visible");
  if (!visible)
    return;

  if (this->GetVtkProp(renderer)->GetVisibility())
  {
    GetVtkProp(renderer)->RenderTranslucentPolygonalGeometry(renderer->GetVtkRenderer());
  }
}
Esempio n. 10
0
void mitk::VtkMapper::MitkRenderOverlay(BaseRenderer *renderer)
{
  bool visible = true;
  GetDataNode()->GetVisibility(visible, renderer, "visible");
  if (!visible)
    return;

  if (this->GetVtkProp(renderer)->GetVisibility())
  {
    GetVtkProp(renderer)->RenderOverlay(renderer->GetVtkRenderer());
  }
}
Esempio n. 11
0
void mitk::VtkOverlay::Update(mitk::BaseRenderer *renderer)
{
  vtkSmartPointer<vtkProp> prop = GetVtkProp(renderer);
  if(!IsVisible(renderer))
  {
    prop->SetVisibility(false);
    return;
  }
  else
  {

    prop->SetVisibility(true);
    UpdateVtkOverlay(renderer);
  }
}
Esempio n. 12
0
mitk::Gizmo::HandleType mitk::GizmoInteractor::PickFrom2D(const InteractionPositionEvent* positionEvent)
{
  BaseRenderer* renderer = positionEvent->GetSender();

  auto mapper = GetDataNode()->GetMapper(BaseRenderer::Standard2D);
  auto gizmo_mapper = dynamic_cast<GizmoMapper2D*>(mapper);  auto& picker = m_Picker[renderer];

  if ( picker == nullptr )
  {
    picker = vtkSmartPointer<vtkCellPicker>::New();
    picker->SetTolerance(0.005);

    if ( gizmo_mapper )
    { // doing this each time is bizarre
      picker->AddPickList(gizmo_mapper->GetVtkProp(renderer));
      picker->PickFromListOn();
    }
  }

  auto displayPosition = positionEvent->GetPointerPositionOnScreen();
  picker->Pick( displayPosition[0], displayPosition[1], 0,
                positionEvent->GetSender()->GetVtkRenderer() );

  vtkIdType pickedPointID = picker->GetPointId();
  if (pickedPointID == -1)
  {
      return Gizmo::NoHandle;
  }

  vtkPolyData* polydata = gizmo_mapper->GetVtkPolyData(renderer);

  if (polydata && polydata->GetPointData() && polydata->GetPointData()->GetScalars())
  {
    double dataValue = polydata->GetPointData()->GetScalars()->GetTuple1(pickedPointID);
    return m_Gizmo->GetHandleFromPointDataValue(dataValue);
  }

  return Gizmo::NoHandle;
}
Esempio n. 13
0
void mitk::VtkOverlay::Paint( BaseRenderer* renderer )
{
  GetVtkProp( renderer )->RenderOpaqueGeometry(renderer->GetVtkRenderer() );
  GetVtkProp( renderer )->RenderOverlay( renderer->GetVtkRenderer() );
}