void ToolTipCalibrateWidget::calibrateSlot()
{
  ToolPtr refTool = mTools->getTool();
  //Todo, we only allow the reference point with id 1 to be used to calibrate
  //this could be done more dynamic.
  if(!refTool || !refTool->hasReferencePointWithId(1))
    return;

  ToolPtr tool = mServices->tracking()->getActiveTool();
  CoordinateSystem to = mServices->spaceProvider()->getT(tool);
  Vector3D P_t = mServices->spaceProvider()->getActiveToolTipPoint(to);

  ToolTipCalibrationCalculator calc(mServices->spaceProvider(), tool, refTool, P_t);
  Transform3D calibration = calc.get_calibration_sMt();

  QMessageBox msgBox;
  msgBox.setText("Do you want to overwrite "+tool->getName()+"s calibration file?");
  msgBox.setInformativeText("This cannot be undone.");
  msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
  msgBox.setDefaultButton(QMessageBox::Ok);
  int ret = msgBox.exec();

  if(ret == QMessageBox::Ok)
  {
    tool->setCalibration_sMt(calibration);
    mCalibrationLabel->setText("Calibration:\n"+qstring_cast(calibration));
  }
}
QString StringPropertySelectTool::convertInternal2Display(QString internal)
{
  ToolPtr tool = mTrackingService->getTool(internal);
  if (!tool)
  {
	return "<no tool>";
  }
  return qstring_cast(tool->getName());
}
Exemple #3
0
PlaybackTool::PlaybackTool(ToolPtr base, PlaybackTimePtr time) :
	ToolImpl(base->getUid(), "playback "+base->getName()), mBase(base),
    mTime(time),
    mVisible(false)
{
	connect(mTime.get(), SIGNAL(changed()), this, SLOT(timeChangedSlot()));

	connect(mBase.get(), SIGNAL(toolProbeSector()), this, SIGNAL(toolProbeSector()));
	connect(mBase.get(), SIGNAL(tooltipOffset(double)), this, SIGNAL(tooltipOffset(double)));
}
void PatientLandMarksWidget::updateToolSampleButton()
{
	ToolPtr tool = mServices->tracking()->getActiveTool();

	bool enabled = tool && tool->getVisible() && (!tool->hasType(Tool::TOOL_MANUAL) || settings()->value("giveManualToolPhysicalProperties").toBool()); // enable only for non-manual tools.
	mToolSampleButton->setEnabled(enabled);

	if (mServices->tracking()->getActiveTool())
		mToolSampleButton->setText("Sample " + qstring_cast(tool->getName()));
	else
		mToolSampleButton->setText("No tool");
}
Exemple #5
0
void PatientModelImplService::videoSourceAdded(VideoSourcePtr source)
{
	ToolPtr tool = this->getProbeTool(source->getUid());
	if(!tool)
		return;

	QString uid = source->getUid() + tool->getUid();
	QString name = source->getName() + " - " + tool->getName();
	TrackedStreamPtr trackedStream = this->dataService()->getTrackedStream(uid);
	if (!trackedStream)
		trackedStream = this->createSpecificData<TrackedStream>(uid, name);
	trackedStream->setProbeTool(tool);
	trackedStream->setVideoSource(source);
	trackedStream->setSpaceProvider(mDataService->getSpaceProvider());

	//Only load trackedStream, don't save it
	this->dataService()->loadData(trackedStream);
	emit videoAddedToTrackedStream();
	this->reEmitActiveTrackedStream(trackedStream);
}
Exemple #6
0
void ViewWrapper3D::appendToContextMenu(QMenu& contextMenu)
{	
	QAction* slicePlanesAction = NULL;
	QAction* fillSlicePlanesAction = NULL;
	if (mSlicePlanes3DRep)
	{
		slicePlanesAction = new QAction("Show Slice Planes", &contextMenu);
		slicePlanesAction->setCheckable(true);
		slicePlanesAction->setChecked(mSlicePlanes3DRep->getProxy()->getVisible());
		connect(slicePlanesAction, SIGNAL(triggered(bool)), this, SLOT(showSlicePlanesActionSlot(bool)));

		fillSlicePlanesAction = new QAction("Fill Slice Planes", &contextMenu);
		fillSlicePlanesAction->setCheckable(true);
		fillSlicePlanesAction->setEnabled(mSlicePlanes3DRep->getProxy()->getVisible());
		fillSlicePlanesAction->setChecked(mSlicePlanes3DRep->getProxy()->getDrawPlanes());
		connect(fillSlicePlanesAction, SIGNAL(triggered(bool)), this, SLOT(fillSlicePlanesActionSlot(bool)));
	}

	QAction* resetCameraAction = new QAction("Reset Camera (r)", &contextMenu);
	connect(resetCameraAction, SIGNAL(triggered()), this, SLOT(resetCameraActionSlot()));

	QAction* centerImageAction = new QAction("Center to image", &contextMenu);
	connect(centerImageAction, SIGNAL(triggered()), this, SLOT(centerImageActionSlot()));

	QAction* centerToolAction = new QAction("Center to tool", &contextMenu);
	connect(centerToolAction, SIGNAL(triggered()), this, SLOT(centerToolActionSlot()));

	QAction* showAxesAction = new QAction("Show Coordinate Axes", &contextMenu);
	showAxesAction->setCheckable(true);
	showAxesAction->setChecked(mShowAxes);
	connect(showAxesAction, SIGNAL(triggered(bool)), this, SLOT(showAxesActionSlot(bool)));

	QAction* showManualTool = new QAction("Show Manual Tool", &contextMenu);
	showManualTool->setCheckable(true);
	showManualTool->setChecked(settings()->value("showManualTool").toBool());
	connect(showManualTool, SIGNAL(triggered(bool)), this, SLOT(showManualToolSlot(bool)));

	QAction* showOrientation = new QAction("Show Orientation", &contextMenu);
	showOrientation->setCheckable(true);
	showOrientation->setChecked(mAnnotationMarker->getVisible());
	connect(showOrientation, SIGNAL(triggered(bool)), this, SLOT(showOrientationSlot(bool)));

	QAction* showToolPath = new QAction("Show Tool Path", &contextMenu);
	showToolPath->setCheckable(true);
	showToolPath->setChecked(settings()->value("showToolPath").toBool());
	connect(showToolPath, SIGNAL(triggered(bool)), this, SLOT(showToolPathSlot(bool)));

	QMenu* show3DSlicesMenu = new QMenu("Show 3D slices");
	mShow3DSlicesInteractor->addDataActions(show3DSlicesMenu);

	QMenu* showSlicesMenu = new QMenu("Slice Type", &contextMenu);
	this->createSlicesActions(showSlicesMenu);

	QAction* showRefTool = new QAction("Show Reference Tool", &contextMenu);
	showRefTool->setDisabled(true);
	showRefTool->setCheckable(true);
	ToolPtr refTool = mServices->tracking()->getReferenceTool();
	if (refTool)
	{
		showRefTool->setText("Show " + refTool->getName());
		showRefTool->setEnabled(true);
		showRefTool->setChecked(RepContainer(mView->getReps()).findFirst<ToolRep3D>(refTool) ? true : false);
		connect(showRefTool, SIGNAL(toggled(bool)), this, SLOT(showRefToolSlot(bool)));
	}

	contextMenu.addSeparator();
	contextMenu.addMenu(show3DSlicesMenu);
	contextMenu.addMenu(showSlicesMenu);
	contextMenu.addSeparator();
	contextMenu.addAction(resetCameraAction);
	contextMenu.addAction(centerImageAction);
	contextMenu.addAction(centerToolAction);
	contextMenu.addAction(showAxesAction);
	contextMenu.addAction(showOrientation);
	contextMenu.addSeparator();
	contextMenu.addAction(showManualTool);
	contextMenu.addAction(showRefTool);
	if (showToolPath)
		contextMenu.addAction(showToolPath);
	contextMenu.addSeparator();
	if (slicePlanesAction)
		contextMenu.addAction(slicePlanesAction);
	if (fillSlicePlanesAction)
		contextMenu.addAction(fillSlicePlanesAction);
}