16 #include <vtkRenderWindow.h>
17 #include <vtkRenderer.h>
46 this->setObjectName(
"preferences_visualization_widget");
56 double sphereRadius =
settings()->
value(
"View3D/sphereRadius").toDouble();
59 double labelSize =
settings()->
value(
"View3D/labelSize").toDouble();
65 "Set 3D view background color");
70 "Set the color of the tool in 2D");
73 "View/toolTipPointColor",
74 "Set the color of the tool tip in 2D/3D");
77 "View/toolOffsetPointColor",
78 "Set the color of the tool offset point in 2D/3D");
81 "View/toolOffsetLineColor",
82 "Set the color of the tool offset line in 2D/3D");
85 "View2D/toolCrossHairColor",
86 "Set the color of the tool 2D crosshair");
88 bool showDataText =
settings()->
value(
"View/showDataText").value<
bool>();
90 "Show the name of each data set in the views.",
92 bool showLabels =
settings()->
value(
"View/showLabels").value<
bool>();
94 "Attach name labels to entities in the views.",
97 bool toolCrosshair =
settings()->
value(
"View2D/showToolCrosshair").value<
bool>();
99 "Show a crosshair centered on the tool in the orthogonal (ACS) views.",
103 bool showMetricNamesInCorner =
settings()->
value(
"View/showMetricNamesInCorner").value<
bool>();
105 "Show the metric data in the upper right corner of the view instead of in the scene.",
106 showMetricNamesInCorner);
109 double annotationModelSize =
settings()->
value(
"View3D/annotationModelSize").toDouble();
111 QStringList annotationModelRange;
114 annotationModelRange << QDir(path+
"/models/").entryList(QStringList()<<
"*.stl");
116 annotationModelRange.prepend(
"<default>");
117 QString annotationModel =
settings()->
value(
"View3D/annotationModel").toString();
121 QGroupBox* stereoGroupBox =
new QGroupBox(
"Stereoscopic visualization");
123 connect(
mStereoTypeComboBox, SIGNAL(currentIndexChanged(
int)),
this, SLOT(stereoTypeChangedSlot(
int)));
125 double eyeAngle =
settings()->
value(
"View3D/eyeAngle").toDouble();
127 "Separation between eyes in degrees",
129 connect(
mEyeAngleAdapter.get(), SIGNAL(valueWasSet()),
this, SLOT(eyeAngleSlot()));
131 double anyplaneViewOffset =
settings()->
value(
"Navigation/anyplaneViewOffset").toDouble();
134 "Position of virtual tool tip in anyplane view, % from top.",
135 anyplaneViewOffset,
DoubleRange(-0.5,0.5,0.05), 2, QDomNode());
138 bool followTooltip =
settings()->
value(
"Navigation/followTooltip").value<
bool>();
140 "ACS Views follow the virtual tool tip",
142 double followTooltipBoundary =
settings()->
value(
"Navigation/followTooltipBoundary").toDouble();
144 "Follow Tool Boundary",
145 "Boundary in ACS Views where follow tool tip is applied. % of view size",
146 followTooltipBoundary,
DoubleRange(0.0,0.5,0.05), 2, QDomNode());
150 QStringList clinicalViews;
151 for (
unsigned i=0; i<mdCOUNT; ++i)
152 clinicalViews << enum2string<CLINICAL_VIEW>(CLINICAL_VIEW(i));
154 "Type of clinical view",
156 clinicalViews, QDomNode());
159 QVBoxLayout* stereoLayout =
new QVBoxLayout();
162 stereoGroupBox->setLayout(stereoLayout);
164 QHBoxLayout* toolcolors =
new QHBoxLayout;
165 toolcolors->addWidget(tool2DColor);
166 toolcolors->addWidget(toolTipPointColor);
167 toolcolors->addWidget(toolOffsetPointColor);
168 toolcolors->addWidget(toolOffsetLineColor);
169 toolcolors->addWidget(toolCrossHairColor);
174 mMainLayout->addWidget(backgroundColorButton, counter++, 0);
189 mMainLayout->addWidget(stereoGroupBox, counter++, 0);
191 QHBoxLayout* toptopLayout =
new QHBoxLayout;
193 toptopLayout->addStretch();
210 stereoInterlacedAction->setData(QVariant(
stINTERLACED));
211 stereoDresdenAction->setData(QVariant(
stDRESDEN));
212 stereoRedBlueAction->setData(QVariant(stRED_BLUE));
214 connect(stereoFrameSequentialAction, SIGNAL(triggered()),
this, SLOT(stereoFrameSequentialSlot()));
215 connect(stereoInterlacedAction, SIGNAL(triggered()),
this, SLOT(stereoInterlacedSlot()));
216 connect(stereoDresdenAction, SIGNAL(triggered()),
this, SLOT(stereoDresdenSlot()));
217 connect(stereoRedBlueAction, SIGNAL(triggered()),
this, SLOT(stereoRedBlueSlot()));
223 mStereoTypeComboBox->insertItem(stRED_BLUE, stereoRedBlueAction->text(), stereoRedBlueAction->data());
226 int stereoType =
settings()->
value(
"View3D/stereoType").toInt();
229 void VisualizationTab::stereoTypeChangedSlot(
int index)
232 if (index<0 || index>=actions.size())
234 actions[index]->trigger();
236 void VisualizationTab::stereoFrameSequentialSlot()
240 void VisualizationTab::stereoInterlacedSlot()
244 void VisualizationTab::stereoDresdenSlot()
248 void VisualizationTab::stereoRedBlueSlot()
253 void VisualizationTab::eyeAngleSlot()
280 this->setObjectName(
"preferences_automation_widget");
294 bool autoStartTracking =
settings()->
value(
"Automation/autoStartTracking").toBool();
298 bool autoStartStreaming =
settings()->
value(
"Automation/autoStartStreaming").toBool();
302 bool autoReconstruct =
settings()->
value(
"Automation/autoReconstruct").toBool();
306 bool autoSelectActiveTool =
settings()->
value(
"Automation/autoSelectActiveTool").toBool();
309 "Automatically select an active tool when a tool becomes visible");
312 bool autoSave =
settings()->
value(
"Automation/autoSave").toBool();
315 "Save patient after major events,\n"
316 "such as workflow step change, registration, reconstruction.");
319 bool autoShow =
settings()->
value(
"Automation/autoShowNewData").toBool();
322 "Show new data in the first view.\n"
323 "Occors after load data and reconstruct.");
326 bool autoLoadPatient =
settings()->
value(
"Automation/autoLoadRecentPatient").toBool();
331 bool autoDeleteDICOMDB =
settings()->
value(
"Automation/autoDeleteDICOMDatabase").toBool();
336 double autoLoadPatientWithinHours =
settings()->
value(
"Automation/autoLoadRecentPatientWithinHours").toDouble();
375 this->setObjectName(
"preferences_video_widget");
386 QVBoxLayout* toplayout =
new QVBoxLayout;
387 QHBoxLayout* acqNameLayout =
new QHBoxLayout;
388 toplayout->addLayout(acqNameLayout);
390 acqNameLayout->addWidget(
new QLabel(
"Name prefix"));
395 bool bw =
settings()->
value(
"Ultrasound/8bitAcquisitionData").toBool();
399 m24bitRadioButton->setToolTip(
"Convert color video to 24 bit color. If the video already is 8 bit grayscale it will not be converted to 24 bit");
406 mCompressCheckBox->setToolTip(
"Store the US Acquisition data as compressed MHD");
408 toplayout->addSpacing(5);
432 mStateService(stateService)
434 this->setObjectName(
"preferences_tool_config_widget");
441 connect(
settings(), SIGNAL(valueChangedFor(QString)),
this, SLOT(globalConfigurationFileChangedSlot(QString)));
443 connect(mToolConfigureGroupBox, SIGNAL(toolSelected(QString)), mFilePreviewWidget, SLOT(previewFileSlot(QString)));
444 connect(mToolFilterGroupBox, SIGNAL(toolSelected(QString)), mFilePreviewWidget, SLOT(previewFileSlot(QString)));
446 connect(mToolConfigureGroupBox, SIGNAL(toolSelected(QString)), mImagePreviewWidget, SLOT(previewFileSlot(QString)));
447 connect(mToolFilterGroupBox, SIGNAL(toolSelected(QString)), mImagePreviewWidget, SLOT(previewFileSlot(QString)));
449 this->applicationChangedSlot();
457 QGroupBox* filepreviewGroupBox =
new QGroupBox(
this);
461 filepreviewGroupBox->setTitle(
"Toolfile preview");
462 QHBoxLayout* filepreviewLayout =
new QHBoxLayout();
463 filepreviewGroupBox->setLayout(filepreviewLayout);
465 filepreviewLayout->addWidget(mFilePreviewWidget);
467 QGroupBox* imagepreviewGroupBox =
new QGroupBox(
this);
468 imagepreviewGroupBox->setTitle(
"Tool image preview");
469 QVBoxLayout* imagepreviewLayout =
new QVBoxLayout();
470 imagepreviewGroupBox->setLayout(imagepreviewLayout);
471 imagepreviewLayout->setMargin(0);
472 imagepreviewLayout->addWidget(mImagePreviewWidget);
475 QGridLayout* layout =
new QGridLayout;
478 layout->addWidget(mToolConfigureGroupBox, 0, 0, 1, 2);
479 layout->addWidget(mToolFilterGroupBox, 0, 2, 1, 2);
480 layout->addWidget(filepreviewGroupBox, 1, 0, 1, 3);
481 layout->addWidget(imagepreviewGroupBox, 1, 3, 1, 1);
492 if(newConfigFile.isEmpty())
496 QFile configFile(newConfigFile);
497 QFileInfo info(configFile);
498 if(!configFile.exists())
505 void ToolConfigTab::applicationChangedSlot()
510 void ToolConfigTab::globalConfigurationFileChangedSlot(QString key)
512 if(key !=
"toolConfigFile")
524 int currentIndex, QWidget *parent) :
530 mToolBar->setOrientation(Qt::Vertical);
533 mButtonBox =
new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel);
536 this->
addTab(
new GeneralTab(viewService, patientModelService), tr(
"General"), currentIndex);
541 this->
addTab(
new ToolConfigTab(stateService, trackingService), tr(
"Tool Configuration"), currentIndex);
543 this->
addTab(
new DebugTab(patientModelService, trackingService), tr(
"Debug"));
545 QPushButton* applyButton =
mButtonBox->button(QDialogButtonBox::Apply);
547 connect(
mButtonBox, SIGNAL(rejected()),
this, SLOT(reject()));
548 connect(
mButtonBox, SIGNAL(accepted()),
this, SLOT(accept()));
549 connect(applyButton, SIGNAL(clicked()),
this, SLOT(applySlot()));
551 QVBoxLayout *mainLayout =
new QVBoxLayout;
552 QHBoxLayout *tabLayout =
new QHBoxLayout;
553 QFrame* frame =
new QFrame;
554 frame->setLineWidth(3);
555 frame->setFrameShape(QFrame::Panel);
556 frame->setFrameShadow(QFrame::Sunken);
557 frame->setLayout(
new QVBoxLayout);
560 tabLayout->addWidget(frame);
562 mainLayout->addLayout(tabLayout);
564 setLayout(mainLayout);
568 mButtonBox->button(QDialogButtonBox::Ok)->setFocus();
574 void PreferencesDialog::selectTabSlot()
576 QAction* action =
dynamic_cast<QAction*
>(sender());
579 int val = action->data().toInt();
583 void PreferencesDialog::applySlot()
591 connect(
mButtonBox, SIGNAL(accepted()), widget, SLOT(saveParametersSlot()));
592 connect(
this, SIGNAL(
applied()), widget, SLOT(saveParametersSlot()));
596 action->setCheckable(
true);
598 action->setChecked(
true);
599 connect(action, SIGNAL(triggered()),
this, SLOT(selectTabSlot()));
600 QToolButton* button =
new QToolButton(
this);
602 button->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
604 button->setDefaultAction(action);
615 mIGSTKDebugLoggingCheckBox(NULL),
616 mManualToolPhysicalPropertiesCheckBox(NULL),
617 mRenderSpeedLoggingCheckBox(NULL),
619 mPatientModelService(patientModelService),
620 mTrackingService(trackingService)
622 this->setObjectName(
"preferences_debug_widget");
635 QPushButton* runDebugToolButton =
new QPushButton(
"Run Debug Tool",
this);
636 runDebugToolButton->setToolTip(
"Start a dummy tool that runs in a deterministic pattern inside the bounding box of the first found volume.");
637 connect(runDebugToolButton, SIGNAL(clicked()),
this, SLOT(
runDebugToolSlot()));
648 mMainLayout->addWidget(runDebugToolButton, i++, 0);
666 dummyTool->setToolPositionMovement(dummyTool->createToolPositionMovementTranslationOnly(bb_r));