35 #include <QVBoxLayout> 39 #include <vtkPolyData.h> 59 BaseWidget(parent,
"bronchoscopy_navigation_widget",
"Bronchoscopy Navigation"),
60 mVerticalLayout(new QVBoxLayout(this))
62 mIsCenerlineProcessed =
false;
64 mOptions =
profile()->getXmlSettings().descend(
"bronchoscopynavigationwidget");
66 mPatientModelService = services->patient();
67 mViewService = services->view();
68 mTrackingService = services->tracking();
71 this->setObjectName(
"BronchoscopyNavigationWidget");
72 this->setWindowTitle(
"BronchoscopyNavigation");
73 this->setWhatsThis(this->defaultWhatsThis());
78 mSelectMeshWidget->setValueName(
"Centerline: ");
81 mProjectionCenterlinePtr->createMaxDistanceToCenterlineOption(mOptions.
getElement());
82 mProjectionCenterlinePtr->createMaxSearchDistanceOption(mOptions.
getElement());
83 mProjectionCenterlinePtr->createAlphaOption(mOptions.
getElement());
85 mProcessCenterlineButton =
new QPushButton(
"Process centerline");
86 connect(mProcessCenterlineButton, SIGNAL(clicked()),
this, SLOT(processCenterlineSlot()));
87 mProcessCenterlineButton->setToolTip(this->defaultWhatsThis());
89 mEnableButton =
new QPushButton(
"Enable",
this);
90 connect(mEnableButton, SIGNAL(clicked()),
this, SLOT(enableSlot()));
91 mEnableButton->setToolTip(this->defaultWhatsThis());
93 mDisableButton =
new QPushButton(
"Disable",
this);
94 connect(mDisableButton, SIGNAL(clicked()),
this, SLOT(disableSlot()));
95 mDisableButton->setToolTip(this->defaultWhatsThis());
97 mAdvancedOption =
new QCheckBox(
"Use advanced centerline projection",
this);
98 connect(mAdvancedOption, SIGNAL(clicked()),
this, SLOT(showAdvancedOptionsSlot()));
101 PropertyPtr maxDistanceToCenterline = mProjectionCenterlinePtr->getMaxDistanceToCenterlineOption();
102 PropertyPtr maxSearchDistance = mProjectionCenterlinePtr->getMaxSearchDistanceOption();
103 PropertyPtr alpha = mProjectionCenterlinePtr->getAlphaOption();
105 mMaxSearchDistanceWidget =
createDataWidget(mViewService, mPatientModelService,
this, maxSearchDistance);
106 mAlphaWidget =
createDataWidget(mViewService, mPatientModelService,
this, alpha);
109 mVerticalLayout->addWidget(
new DataSelectWidget(mViewService, mPatientModelService,
this, mSelectMeshWidget));
110 mVerticalLayout->addWidget(mProcessCenterlineButton);
111 mVerticalLayout->addWidget(
createDataWidget(mViewService, mPatientModelService,
this, maxDistanceToCenterline));
112 mVerticalLayout->addWidget(mAdvancedOption);
114 mVerticalLayout->addWidget(mMaxSearchDistanceWidget);
115 mVerticalLayout->addWidget(mAlphaWidget);
116 mVerticalLayout->addWidget(mEnableButton);
117 mVerticalLayout->addWidget(mDisableButton);
120 mVerticalLayout->addStretch();
122 mEnableButton->setEnabled(
false);
123 mDisableButton->setEnabled(
false);
124 this->showAdvancedOptionsSlot();
132 void BronchoscopyNavigationWidget::processCenterlineSlot()
134 if(!mSelectMeshWidget->getMesh())
139 vtkPolyDataPtr centerline = mSelectMeshWidget->getMesh()->getVtkPolyData();
140 Transform3D rMd = mSelectMeshWidget->getMesh()->get_rMd();
141 Transform3D rMpr = mPatientModelService->get_rMpr();
144 mProjectionCenterlinePtr->processCenterline(centerline, rMd, rMpr);
145 mIsCenerlineProcessed =
true;
146 mEnableButton->setEnabled(
true);
149 void BronchoscopyNavigationWidget::enableSlot()
151 if(!mIsCenerlineProcessed)
157 if(!mToolSelector->getTool())
164 mProjectionCenterlinePtr->setAdvancedCenterlineOption(mAdvancedOption->isChecked());
165 if (!mTrackingSystem)
175 mTrackingService->unInstallTrackingSystem(mTrackingSystem->getBase());
176 mTrackingService->installTrackingSystem(mTrackingSystem);
178 mEnableButton->setEnabled(
false);
179 mDisableButton->setEnabled(
true);
181 std::cout <<
"BronchoscopyNavigation started. Position locked to centerline." << std::endl;
184 void BronchoscopyNavigationWidget::disableSlot()
188 mTrackingService->unInstallTrackingSystem(mTrackingSystem);
189 mTrackingService->installTrackingSystem(mTrackingSystem->getBase());
190 mTrackingSystem.reset();
193 std::cout <<
"BronchoscopyNavigation stopped." << std::endl;
194 mEnableButton->setEnabled(
true);
195 mDisableButton->setEnabled(
false);
200 void BronchoscopyNavigationWidget::showAdvancedOptionsSlot()
202 if(mAdvancedOption->isChecked())
204 mMaxSearchDistanceWidget->show();
205 mAlphaWidget->show();
208 mMaxSearchDistanceWidget->hide();
209 mAlphaWidget->hide();
213 QString BronchoscopyNavigationWidget::defaultWhatsThis()
const 216 "<h3>BronchoscopyNavigation plugin.</h3>" 217 "<p>Locks tool position to CT centerline.</p>"
cxResource_EXPORT ProfilePtr profile()
void reportError(QString msg)
boost::shared_ptr< class VisServices > VisServicesPtr
Interface towards a bronchoscopy navigation tracking system.Wraps another tracking system...
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
QDomElement getElement()
return the current element
QWidget * createDataWidget(ViewServicePtr viewService, PatientModelServicePtr patientModelService, QWidget *parent, PropertyPtr data, QGridLayout *gridLayout, int row)
Create a widget capable of displaying the input data.
boost::shared_ptr< class Property > PropertyPtr
vtkSmartPointer< vtkPolyData > vtkPolyDataPtr
boost::shared_ptr< class TrackingSystemBronchoscopyService > TrackingSystemBronchoscopyServicePtr
static StringPropertySelectMeshPtr New(PatientModelServicePtr patientModelService)
boost::shared_ptr< class BronchoscopePositionProjection > BronchoscopePositionProjectionPtr
Namespace for all CustusX production code.