コード例 #1
0
mitk::NavigationDataObjectVisualizationFilter::Pointer mitk::TrackingDeviceSourceConfigurator::CreateNavigationDataObjectVisualizationFilter(mitk::TrackingDeviceSource::Pointer trackingDeviceSource, mitk::NavigationToolStorage::Pointer navigationTools)
  {
  mitk::NavigationDataObjectVisualizationFilter::Pointer returnValue = mitk::NavigationDataObjectVisualizationFilter::New();
  for (int i=0; i<trackingDeviceSource->GetNumberOfOutputs(); i++)
    {
    mitk::NavigationTool::Pointer currentTool = navigationTools->GetToolByName(trackingDeviceSource->GetOutput(i)->GetName());
    if (currentTool.IsNull())
      {
      this->m_ErrorMessage = "Error: did not find correspondig tool in tracking device after initialization.";
      return NULL;
      }
    returnValue->SetInput(i,trackingDeviceSource->GetOutput(i));
    returnValue->SetRepresentationObject(i,currentTool->GetDataNode()->GetData());
    }
  return returnValue;
  }
mitk::NavigationDataObjectVisualizationFilter::Pointer mitk::TrackingDeviceSourceConfigurator::CreateNavigationDataObjectVisualizationFilter(mitk::TrackingDeviceSource::Pointer trackingDeviceSource, mitk::NavigationToolStorage::Pointer navigationTools)
  {
  mitk::NavigationDataObjectVisualizationFilter::Pointer returnValue = mitk::NavigationDataObjectVisualizationFilter::New();
  for (unsigned int i=0; i<trackingDeviceSource->GetNumberOfIndexedOutputs(); i++)
    {
    // Note: If all tools have the same name only the first tool will always be returned and
    //       the others won't be updated during rendering.This could potentially lead to inconstencies
    mitk::NavigationTool::Pointer currentTool = navigationTools->GetToolByName(trackingDeviceSource->GetOutput(i)->GetName());
    if (currentTool.IsNull())
      {
      this->m_ErrorMessage = "Error: did not find corresponding tool in tracking device after initialization.";
      return NULL;
      }
    returnValue->SetInput(i,trackingDeviceSource->GetOutput(i));
    returnValue->SetRepresentationObject(i,currentTool->GetDataNode()->GetData());
    }
  return returnValue;
  }
コード例 #3
0
  firstTool->SetDataNode(firstNode);
  claronStorage->AddTool(firstTool);

  //create invalid tool 2
  mitk::NavigationTool::Pointer secondTool = mitk::NavigationTool::New();
  secondTool->SetTrackingDeviceType(mitk::MicronTrackerTypeInformation::GetTrackingDeviceName());
  mitk::DataNode::Pointer secondNode = mitk::DataNode::New();
  secondNode->SetName("Tool2");
  secondTool->SetDataNode(secondNode);
  claronStorage->AddTool(secondTool);

  mitk::TrackingDevice::Pointer testDevice = dynamic_cast<mitk::TrackingDevice*>(mitk::ClaronTrackingDevice::New().GetPointer());

  testInstance = mitk::TrackingDeviceSourceConfigurator::New(claronStorage,testDevice);

  mitk::TrackingDeviceSource::Pointer testSource = testInstance->CreateTrackingDeviceSource();

  MITK_TEST_CONDITION_REQUIRED(testSource.IsNull(),"..testing return value");
  MITK_TEST_CONDITION_REQUIRED(testInstance->GetErrorMessage().size()>1,"..testing if there is an error message");

  MITK_TEST_OUTPUT(<<"Testing simple claron tracking device with another 2 invalid tools");

  secondTool->SetTrackingDeviceType(mitk::NDIAuroraTypeInformation::GetTrackingDeviceName());
  claronStorage = mitk::NavigationToolStorage::New();
  claronStorage->AddTool(secondTool);

  testInstance = mitk::TrackingDeviceSourceConfigurator::New(claronStorage,testDevice);

  MITK_TEST_CONDITION_REQUIRED(!testInstance->IsCreateTrackingDeviceSourcePossible(),"..testing if factory class detects the invalid data");

  testSource = testInstance->CreateTrackingDeviceSource();