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")
528 mToolBar->setOrientation(Qt::Vertical);
531 mButtonBox =
new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel);
534 this->
addTab(
new GeneralTab(viewService, patientModelService), tr(
"General"));
541 this->
addTab(
new DebugTab(patientModelService, trackingService), tr(
"Debug"));
543 QPushButton* applyButton =
mButtonBox->button(QDialogButtonBox::Apply);
545 connect(
mButtonBox, SIGNAL(rejected()),
this, SLOT(reject()));
546 connect(
mButtonBox, SIGNAL(accepted()),
this, SLOT(accept()));
547 connect(applyButton, SIGNAL(clicked()),
this, SLOT(applySlot()));
549 QVBoxLayout *mainLayout =
new QVBoxLayout;
550 QHBoxLayout *tabLayout =
new QHBoxLayout;
551 QFrame* frame =
new QFrame;
552 frame->setLineWidth(3);
553 frame->setFrameShape(QFrame::Panel);
554 frame->setFrameShadow(QFrame::Sunken);
555 frame->setLayout(
new QVBoxLayout);
558 tabLayout->addWidget(frame);
560 mainLayout->addLayout(tabLayout);
562 setLayout(mainLayout);
566 mButtonBox->button(QDialogButtonBox::Ok)->setFocus();
572 void PreferencesDialog::selectTabSlot()
574 QAction* action =
dynamic_cast<QAction*
>(sender());
577 int val = action->data().toInt();
581 void PreferencesDialog::applySlot()
589 connect(
mButtonBox, SIGNAL(accepted()), widget, SLOT(saveParametersSlot()));
590 connect(
this, SIGNAL(
applied()), widget, SLOT(saveParametersSlot()));
594 action->setCheckable(
true);
596 action->setChecked(
true);
597 connect(action, SIGNAL(triggered()),
this, SLOT(selectTabSlot()));
598 QToolButton* button =
new QToolButton(
this);
600 button->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
602 button->setDefaultAction(action);
613 mIGSTKDebugLoggingCheckBox(NULL),
614 mManualToolPhysicalPropertiesCheckBox(NULL),
615 mRenderSpeedLoggingCheckBox(NULL),
617 mPatientModelService(patientModelService),
618 mTrackingService(trackingService)
620 this->setObjectName(
"preferences_debug_widget");
633 QPushButton* runDebugToolButton =
new QPushButton(
"Run Debug Tool",
this);
634 runDebugToolButton->setToolTip(
"Start a dummy tool that runs in a deterministic pattern inside the bounding box of the first found volume.");
635 connect(runDebugToolButton, SIGNAL(clicked()),
this, SLOT(
runDebugToolSlot()));
646 mMainLayout->addWidget(runDebugToolButton, i++, 0);
664 dummyTool->setToolPositionMovement(dummyTool->createToolPositionMovementTranslationOnly(bb_r));
QString qstring_cast(const T &val)
DoublePropertyPtr mLabelSize
cxResource_EXPORT ProfilePtr profile()
QCheckBox * mRenderSpeedLoggingCheckBox
DoubleBoundingBox3D transform(const Transform3D &m, const DoubleBoundingBox3D &bb)
static BoolPropertyPtr initialize(const QString &uid, QString name, QString help, bool value, QDomNode root=QDomNode())
void saveParametersSlot()
QCheckBox * mManualToolPhysicalPropertiesCheckBox
void saveParametersSlot()
QActionGroup * mActionGroup
QGridLayout * mMainLayout
void applicationStateChanged()
AutomationTab(QWidget *parent=0)
boost::shared_ptr< class StateService > StateServicePtr
QCheckBox * mAutoShowNewDataCheckBox
TrackingServicePtr mTrackingService
boost::shared_ptr< class VisServices > VisServicesPtr
std::string toString(T const &value)
converts any type to a string
boost::shared_ptr< class TrackingService > TrackingServicePtr
DebugTab(PatientModelServicePtr patientModelService, TrackingServicePtr trackingService, QWidget *parent=0)
QRadioButton * m24bitRadioButton
BoolPropertyPtr mToolCrosshair
VisualizationTab(PatientModelServicePtr patientModelService, QWidget *parent=0)
void addTab(PreferenceTab *widget, QString name)
Utility class for describing a bounded numeric range.
boost::shared_ptr< class Image > ImagePtr
Automatic execution of actions when applicable.
QCheckBox * mAutoSaveCheckBox
static VisServicesPtr create(ctkPluginContext *context)
QCheckBox * mAutoStartTrackingCheckBox
Tab for general settings in the system.
virtual ~PreferencesDialog()
DoublePropertyPtr mAnnotationModelSize
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
static QStringList getRootConfigPaths()
DoublePropertyPtr mFollowTooltipBoundary
QCheckBox * mAutoDeleteDICOMDBCheckBox
Various parameters related to ultrasound acquisition and reconstruction.
DoublePropertyPtr mSphereRadius
QCheckBox * mAutoLoadPatientCheckBox
void initStereoTypeComboBox()
BoolPropertyPtr mShowDataText
void setValue(const QString &key, const QVariant &value)
boost::shared_ptr< class DummyTool > DummyToolPtr
QLineEdit * mAcquisitionNameLineEdit
QVBoxLayout * mMainLayout
QRadioButton * m8bitRadioButton
DoublePropertyPtr mAutoLoadPatientWithinHours
void saveParametersSlot()
StringPropertyPtr mClinicalView
PatientModelServicePtr mPatientModelService
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
QCheckBox * mAutoStartStreamingCheckBox
QActionGroup * mStereoTypeActionGroup
VideoTab(QWidget *parent=0)
QDialogButtonBox * mButtonBox
Settings * settings()
Shortcut for accessing the settings instance.
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk.
static StringPropertyPtr initialize(const QString &uid, QString name, QString help, QString value, QStringList range, QDomNode root=QDomNode())
LogicManager * logicManager()
QCheckBox * mCompressCheckBox
DoublePropertyPtr mEyeAngleAdapter
QComboBox * mStereoTypeComboBox
PatientModelServicePtr mPatientModelService
static DoublePropertyPtr initialize(const QString &uid, QString name, QString help, double value, DoubleRange range, int decimals, QDomNode root=QDomNode())
QCheckBox * mIGSTKDebugLoggingCheckBox
BoolPropertyPtr mShowLabels
StringPropertyPtr mAnnotationModel
QCheckBox * mAutoSelectActiveToolCheckBox
QGridLayout * mMainLayout
QCheckBox * mAutoReconstructCheckBox
BoolPropertyPtr mFollowTooltip
void saveParametersSlot()
QStackedWidget * mTabWidget
QVBoxLayout * mMainLayout
BoolPropertyPtr mShowMetricNamesInCorner
DoublePropertyPtr mAnyplaneViewOffset
PreferencesDialog(ViewServicePtr viewService, PatientModelServicePtr patientModelService, StateServicePtr stateService, TrackingServicePtr trackingService, QWidget *parent=0)
Namespace for all CustusX production code.