ToolManualCalibrationWidget::ToolManualCalibrationWidget(VisServicesPtr services, QWidget* parent) :
	BaseWidget(parent, "ToolManualCalibrationWidget", "Tool Manual Calibrate"),
	mServices(services)
{
  //layout
  QVBoxLayout* mToptopLayout = new QVBoxLayout(this);
  //toptopLayout->setMargin(0);

  this->setToolTip("Edit tool calibration matrix sMt");
  mTool = StringPropertySelectTool::New(mServices->tracking());
  mToptopLayout->addWidget(sscCreateDataWidget(this, mTool));

  mToptopLayout->addWidget(new QLabel("<font color=red>Caution: sMt is changed directly by this control.</font>"));
  mGroup = new QGroupBox(this);
  mGroup->setTitle("Calibration matrix sMt");
  mToptopLayout->addWidget(mGroup);
  QVBoxLayout* groupLayout = new QVBoxLayout;
  mGroup->setLayout(groupLayout);
  groupLayout->setMargin(0);
  mMatrixWidget = new Transform3DWidget(mGroup);
  groupLayout->addWidget(mMatrixWidget);
  connect(mMatrixWidget, SIGNAL(changed()), this, SLOT(matrixWidgetChanged()));
  connect(mTool.get(), SIGNAL(changed()), this, SLOT(toolCalibrationChanged()));

  this->toolCalibrationChanged();
  mMatrixWidget->setEditable(true);

  mToptopLayout->addStretch();

  connect(mServices->tracking().get(), &TrackingService::stateChanged, this, &ToolManualCalibrationWidget::toolCalibrationChanged);
}
USAcqusitionWidget::USAcqusitionWidget(AcquisitionServicePtr acquisitionService, VisServicesPtr services, UsReconstructionServicePtr usReconstructionService, QWidget* parent) :
    RecordBaseWidget(acquisitionService, parent, settings()->value("Ultrasound/acquisitionName").toString()),
    mUsReconstructionService(usReconstructionService)
{
    this->setObjectName("org_custusx_acquisition_widgets_acquisition");
    this->setWindowTitle("US Acquisition");
    this->setToolTip("Record and reconstruct US data");

    mServices = services;
    connect(mUsReconstructionService.get(), &UsReconstructionService::reconstructAboutToStart, this, &USAcqusitionWidget::reconstructAboutToStartSlot);
    connect(mUsReconstructionService.get(), &UsReconstructionService::reconstructStarted, this, &USAcqusitionWidget::reconstructStartedSlot);
    connect(mUsReconstructionService.get(), &UsReconstructionService::reconstructFinished, this, &USAcqusitionWidget::reconstructFinishedSlot);

    connect(mAcquisitionService.get(), &AcquisitionService::stateChanged, this, &USAcqusitionWidget::acquisitionStateChangedSlot);
    connect(mAcquisitionService.get(), &AcquisitionService::started, this, &USAcqusitionWidget::recordStarted);
    connect(mAcquisitionService.get(), &AcquisitionService::acquisitionStopped, this, &USAcqusitionWidget::recordStopped, Qt::DirectConnection);
    connect(mAcquisitionService.get(), &AcquisitionService::cancelled, this, &USAcqusitionWidget::recordCancelled);

    connect(mAcquisitionService.get(), &AcquisitionService::acquisitionDataReady, this, &USAcqusitionWidget::acquisitionDataReadySlot);
    connect(mAcquisitionService.get(), &AcquisitionService::saveDataCompleted, mUsReconstructionService.get(), &UsReconstructionService::newDataOnDisk);

    mRecordSessionWidget->setDescriptionVisibility(false);

    QHBoxLayout* timerLayout = new QHBoxLayout;
    mLayout->addLayout(timerLayout);
    mDisplayTimerWidget = new DisplayTimerWidget(this);
    mDisplayTimerWidget ->setFontSize(10);
    timerLayout->addStretch();
    timerLayout->addWidget(mDisplayTimerWidget);
    timerLayout->addStretch();

    QGridLayout* editsLayout = new QGridLayout;
    editsLayout->setColumnStretch(0,0);
    editsLayout->setColumnStretch(1,1);
    RecordBaseWidget::mLayout->addLayout(editsLayout);

    new LabeledComboBoxWidget(this, StringPropertyActiveProbeConfiguration::New(mServices->getToolManager()), editsLayout, 0);
    sscCreateDataWidget(this, mUsReconstructionService->getParam("Preset"), editsLayout, 1);

    QAction* optionsAction = this->createAction(this,
                             QIcon(":/icons/open_icon_library/system-run-5.png"),
                             "Details", "Show Details",
                             SLOT(toggleDetailsSlot()),
                             NULL);

    QToolButton* optionsButton = new QToolButton();
    optionsButton->setDefaultAction(optionsAction);
    editsLayout->addWidget(optionsButton, 0, 2);

    mOptionsWidget = this->createOptionsWidget();
    mOptionsWidget->setVisible(settings()->value("acquisition/UsAcqShowDetails").toBool());

    mTimedAlgorithmProgressBar = new cx::TimedAlgorithmProgressBar;
    mLayout->addWidget(mOptionsWidget);

    mLayout->addStretch();
    mLayout->addWidget(mTimedAlgorithmProgressBar);
}
RecordTrackingWidget::RecordTrackingWidget(XmlOptionFile options,
										   AcquisitionServicePtr acquisitionService,
										   VisServicesPtr services,
										   QString category,
										   QWidget* parent) :
	QWidget(parent),
	mServices(services),
	mOptions(options),
	mAcquisitionService(acquisitionService)
{
	QVBoxLayout* mVerticalLayout = new QVBoxLayout(this);

	mToolSelector = StringPropertySelectTool::New(services->tracking());

	mSelectRecordSession.reset(new SelectRecordSession(mOptions, acquisitionService, services));
	connect(mSelectRecordSession->getSessionSelector().get(), &StringProperty::changed, this, &RecordTrackingWidget::onMergeChanged);

	mMergeWithExistingSession = BoolProperty::initialize("mergerecording", "Merge",
														 "Merge new recording with selected recorded session",
														 false, QDomNode());
	connect(mMergeWithExistingSession.get(), &BoolProperty::changed, this, &RecordTrackingWidget::onMergeChanged);

	AcquisitionService::TYPES context(AcquisitionService::tTRACKING);
	mRecordSessionWidget = new RecordSessionWidget(mAcquisitionService, this, context, category);

	mVerticalLayout->setMargin(0);

	mToolSelectorWidget = sscCreateDataWidget(this, mToolSelector);
	mVerticalLayout->addWidget(mToolSelectorWidget);
	mVerticalLayout->addWidget(mRecordSessionWidget);
	mVerticalLayout->addWidget(sscCreateDataWidget(this, mMergeWithExistingSession));
	mVerticalLayout->addWidget(new LabeledComboBoxWidget(this, mSelectRecordSession->getSessionSelector()));

	mObscuredListener.reset(new WidgetObscuredListener(this));
	connect(mObscuredListener.get(), SIGNAL(obscured(bool)), this, SLOT(obscuredSlot(bool)));
}
Example #4
0
DataSelectWidget::DataSelectWidget(ViewServicePtr viewService, PatientModelServicePtr patientModelService, QWidget *parent, SelectDataStringPropertyBasePtr data, QGridLayout* gridLayout, int row) :
    BaseWidget(parent, "DataSelectWidget", "DataSelectWidget"),
	mData(data),
	mViewService(viewService),
	mPatientModelService(patientModelService)
{

    QHBoxLayout* layout = new QHBoxLayout(this);
    layout->setMargin(0);
    layout->setSpacing(0);

	QWidget* widget = sscCreateDataWidget(this, mData, gridLayout, row);

    mToggleShowAction = this->createAction(this,
                    QIcon(":/icons/open_icon_library/eye.png.png"),
                    "Toggle show data in view", "",
                    SLOT(toggleShowData()),
                    NULL);
    mToggleShowAction->setCheckable(true);
    CXSmallToolButton* toggleShowButton = new CXSmallToolButton();
    toggleShowButton->setDefaultAction(mToggleShowAction);

	mRemoveButton = new EraseDataToolButton(this);
	connect(mRemoveButton, &EraseDataToolButton::eraseData, this, &DataSelectWidget::eraseData);

    if(gridLayout)
    {
    	gridLayout->setMargin(0);
    	gridLayout->setSpacing(0);
    	QHBoxLayout* lay = new QHBoxLayout;
    	lay->addWidget(toggleShowButton);
		lay->addWidget(mRemoveButton);
    	gridLayout->addLayout(lay, row, 2);
    }else
    {
		layout->addWidget(widget);
		layout->addWidget(toggleShowButton);
		layout->addWidget(mRemoveButton);
    }

	connect(mViewService.get(), SIGNAL(activeViewChanged()), this, SLOT(viewGroupChangedSlot()));
    connect(mData.get(), SIGNAL(changed()), this, SLOT(updateDataVisibility()));

	this->viewGroupChangedSlot();
}
VideoConnectionWidget::VideoConnectionWidget(VisServicesPtr services, QWidget* parent) :
	BaseWidget(parent, "igt_link_widget", "Video Connection"),
	mServices(services),
	mUpdateConnectionInService(true)
{
	this->setToolTip("Connect to a video source");
	mOptions = profile()->getXmlSettings().descend("video");

	QString defaultConnection = mServices->video()->getConnectionMethod();
	mConnectionSelector = StringProperty::initialize("Connection", "", "Method for connecting to Video Server", defaultConnection, QStringList(), mOptions.getElement("video"));
	connect(mConnectionSelector.get(), SIGNAL(changed()), this, SLOT(setConnectionMethodAndUpdateGuiForConnectionMethodSlot()));

	connect(mServices->video().get(), &VideoService::connected, this, &VideoConnectionWidget::serverStatusChangedSlot);

	mStackedWidget = new QStackedWidget(this);
	mStackedWidgetFrame = this->wrapStackedWidgetInAFrame();
	mConnectButton = this->initializeConnectButton();
	mImportStreamImageButton = this->initializeImportStreamImageButton();
	mActiveVideoSourceSelector = this->initializeActiveVideoSourceSelector();
	mConnectionSelectionWidget = new DetailedLabeledComboBoxWidget(this, mConnectionSelector);

	mToptopLayout = new QVBoxLayout(this);
	mToptopLayout->addWidget(mConnectionSelectionWidget);
	mToptopLayout->addWidget(mStackedWidgetFrame);
	mToptopLayout->addWidget(mConnectButton);
	mToptopLayout->addWidget(mImportStreamImageButton);
	mToptopLayout->addWidget(sscCreateDataWidget(this, mActiveVideoSourceSelector));
	mToptopLayout->addStretch();

	connect(mServices->video().get(), SIGNAL(StreamerServiceAdded(StreamerService*)), this, SLOT(onServiceAdded(StreamerService*)));
	connect(mServices->video().get(), SIGNAL(StreamerServiceRemoved(StreamerService*)), this, SLOT(onServiceRemoved(StreamerService*)));
	connect(mServices->video().get(), &VideoService::connectionMethodChanged, this, &VideoConnectionWidget::connectionMethodChangedSlot);

	this->addExistingStreamerServices(); //Need to add StreamerServices already existing at this point, since we will only get signals when new Services are added

	this->setConnectionMethodAndUpdateGuiForConnectionMethodSlot();
}
Example #6
0
void PerformanceTab::init()
{
  int renderingInterval = settings()->value("renderingInterval").toInt();

  QLabel* renderingIntervalLabel = new QLabel(tr("Rendering interval"));

  mRenderingIntervalSpinBox = new QSpinBox;
  mRenderingIntervalSpinBox->setSuffix("ms");
  mRenderingIntervalSpinBox->setMinimum(4);
  mRenderingIntervalSpinBox->setMaximum(1000);
  mRenderingIntervalSpinBox->setValue(renderingInterval);
  connect(mRenderingIntervalSpinBox, SIGNAL(valueChanged(int)), this, SLOT(renderingIntervalSlot(int)));

  mRenderingRateLabel = new QLabel("");
  this->renderingIntervalSlot(renderingInterval);

  double Mb = pow(10.0,6);
  bool ok = true;
  double maxRenderSize = settings()->value("View3D/maxRenderSize").toDouble(&ok);
  if (!ok)
    maxRenderSize = 10 * Mb;
  mMaxRenderSize = DoubleProperty::initialize("MaxRenderSize", "Max Render Size (Mb)", "Maximum size of volumes used in volume rendering. Applies to new volumes.", maxRenderSize, DoubleRange(1*Mb,300*Mb,1*Mb), 0, QDomNode());
  mMaxRenderSize->setInternal2Display(1.0/Mb);

  double stillUpdateRate = settings()->value("stillUpdateRate").value<double>();
	mStillUpdateRate = DoubleProperty::initialize("StillUpdateRate", "Still Update Rate",
																											"<p>Still Update Rate in vtkRenderWindow. "
																											"Increasing the value may improve rendering speed "
																											"at the cost of render quality.</p> "
																											"Generally raycast rendering requires this to be low (0.001), "
																											"while texture based rendering requires it to be high (5-10)."
																											"<p>Restart needed.</p>",
																											stillUpdateRate, DoubleRange(0.0001, 20, 0.0001), 4, QDomNode());

  mSmartRenderCheckBox = new QCheckBox("Smart Render");
  mSmartRenderCheckBox->setChecked(settings()->value("smartRender", true).toBool());
  mSmartRenderCheckBox->setToolTip("Render only when scene has changed, plus once per second.");

  m3DVisualizer = StringProperty::initialize("ImageRender3DVisualizer",
	  "3D Renderer",
	  "Select 3D visualization method for images",
	  settings()->value("View3D/ImageRender3DVisualizer").toString(),
	  this->getAvailableVisualizers(),
	  QDomNode());
  m3DVisualizer->setDisplayNames(this->getAvailableVisualizerDisplayNames());

	bool useGPU2DRender = settings()->value("View2D/useGPU2DRendering").toBool();
  mGPU2DRenderCheckBox = new QCheckBox("2D Overlay");
  mGPU2DRenderCheckBox->setChecked(useGPU2DRender);
  mGPU2DRenderCheckBox->setToolTip("<p>Use a GPU-based 2D renderer instead of "
								   "the software-based one, if available.</p>"
								   "<p>This enables multiple volume rendering in 2D.<p>");

	bool linearInterpolationIn2D = settings()->value("View2D/useLinearInterpolationIn2DRendering").toBool();
	mLinearInterpolationIn2DCheckBox = new QCheckBox("Linear interpolation in 2D (Requires restart)");
	mLinearInterpolationIn2DCheckBox->setChecked(linearInterpolationIn2D);
	mLinearInterpolationIn2DCheckBox->setToolTip("<p>Use linear interpolation in GPU 2D rendering "
									 "instead of nearest.</p>"
										"<p>Requires restart.<p>");

  bool optimizedViews = settings()->value("optimizedViews").toBool();
  mOptimizedViewsCheckBox = new QCheckBox("Optimized Views");
  mOptimizedViewsCheckBox->setChecked(optimizedViews);
  mOptimizedViewsCheckBox->setToolTip("<p>Merge all non-3D views into a single vtkRenderWindow</p>"
									  "<p>This speeds up render on some platforms, still experimental.<p>");

  bool useGPU3DDepthPeeling = settings()->value("View3D/depthPeeling").toBool();
  mGPU3DDepthPeelingCheckBox = new QCheckBox("Use GPU 3D depth peeling");
  mGPU3DDepthPeelingCheckBox->setChecked(useGPU3DDepthPeeling);
  mGPU3DDepthPeelingCheckBox->setToolTip("Use a GPU-based 3D depth peeling to correctly visualize translucent surfaces.");

  //Layout
  mMainLayout = new QGridLayout;
  mMainLayout->addWidget(renderingIntervalLabel, 0, 0);
  new SpinBoxGroupWidget(this, mMaxRenderSize, mMainLayout, 1);
  mMainLayout->addWidget(mRenderingIntervalSpinBox, 0, 1);
  mMainLayout->addWidget(mRenderingRateLabel, 0, 2);
	mMainLayout->addWidget(mSmartRenderCheckBox, 2, 0);
	mMainLayout->addWidget(mGPU2DRenderCheckBox, 5, 0);
	mMainLayout->addWidget(mLinearInterpolationIn2DCheckBox, 6, 0);
	mMainLayout->addWidget(mOptimizedViewsCheckBox, 7, 0);
	mMainLayout->addWidget(mGPU3DDepthPeelingCheckBox, 8, 0);
	new SpinBoxGroupWidget(this, mStillUpdateRate, mMainLayout, 9);
	mMainLayout->addWidget(sscCreateDataWidget(this, m3DVisualizer), 10, 0, 1, 2);

  mMainLayout->setColumnStretch(0, 2);
  mMainLayout->setColumnStretch(1, 2);
  mMainLayout->setColumnStretch(2, 1);

  mTopLayout->addLayout(mMainLayout);
}