14 #include <ctkPluginContext.h>
37 #include <vtkPolyData.h>
45 mGenerateFileWithRouteInformation(createRouteInformationFile),
52 return "Route to target";
57 return "routetotarget_filter";
63 "<h3>Route to target.</h3>"
64 "<p>Calculates the route to a selected target in navigated bronchocopy. "
65 "The route starts at the top of trachea and ends at the most adjacent airway centerline"
66 "from the target.</p>"
87 return "_AirwaysModel";
92 return "_AirwaysAndVessel_RTT";
105 centerline->setValueName(
"Airways centerline");
106 centerline->setHelp(
"Select airways centerline");
111 targetPoint->setValueName(
"Target point");
112 targetPoint->setHelp(
"Select target point metric");
117 bloodVesselCenterline->setValueName(
"Blood vessel centerline");
118 bloodVesselCenterline->setHelp(
"Select blood vessel centerline");
123 bloodVesselSegmentationVolume->setValueName(
"Blood vessel segmentation volume");
124 bloodVesselSegmentationVolume->setHelp(
"Select blood vessel segmentation volume");
125 mInputTypes.push_back(bloodVesselSegmentationVolume);
134 tempRTTMeshStringAdapter->setValueName(
"Route to target (mesh)");
135 tempRTTMeshStringAdapter->setHelp(
"Generated route to target mesh (vtk-format).");
140 tempRTTEXTMeshStringAdapter->setValueName(
"Route to target extended (mesh)");
141 tempRTTEXTMeshStringAdapter->setHelp(
"Generated route to target extended mesh (vtk-format).");
146 tempRTTVesselMeshStringAdapter->setValueName(
"Route to target along blood vessels (mesh)");
147 tempRTTVesselMeshStringAdapter->setHelp(
"Generated route to target along blood vessels mesh (vtk-format).");
152 tempRTTVesselAndAirwayRTTMeshStringAdapter->setValueName(
"Connected route - airways and vessels (mesh)");
153 tempRTTVesselAndAirwayRTTMeshStringAdapter->setHelp(
"Connected route to target - airways and blood vessels mesh (vtk-format).");
154 mOutputTypes.push_back(tempRTTVesselAndAirwayRTTMeshStringAdapter);
158 tempAirwaysModelMeshStringAdapter->setValueName(
"Airways along blood vessels surface model (mesh)");
159 tempAirwaysModelMeshStringAdapter->setHelp(
"Generated airways surface model mesh (vtk-format).");
160 mOutputTypes.push_back(tempAirwaysModelMeshStringAdapter);
168 MeshPtr mesh = boost::dynamic_pointer_cast<StringPropertySelectMesh>(
mInputTypes[0])->getMesh();
172 PointMetricPtr targetPoint = boost::dynamic_pointer_cast<StringPropertySelectPointMetric>(
mInputTypes[1])->getPointMetric();
176 mRouteToTarget->setSmoothing(mSmoothing);
178 mRouteToTarget->processCenterline(mesh);
181 mOutput = mRouteToTarget->findRouteToTarget(targetPoint);
183 if(mOutput->GetNumberOfPoints() < 1)
186 mExtendedRoute = mRouteToTarget->findExtendedRoute(targetPoint);
188 if (mGenerateFileWithRouteInformation)
189 mRouteToTarget->addRouteInformationToFile(
mServices);
191 if (getBloodVesselOption(
mOptions)->getValue())
195 MeshPtr bloodVesselCenterline = boost::dynamic_pointer_cast<StringPropertySelectMesh>(
mInputTypes[2])->getMesh();
196 if (bloodVesselCenterline)
198 if (bloodVesselVolume)
199 mRouteToTarget->setBloodVesselVolume(bloodVesselVolume);
201 mBloodVesselRoute = mRouteToTarget->findRouteToTargetAlongBloodVesselCenterlines( bloodVesselCenterline, targetPoint);
202 mAirwaysFromBloodVessel = mRouteToTarget->generateAirwaysFromBloodVesselCenterlines();
205 mAirwayAndBloodVesselRoute = mRouteToTarget->getConnectedAirwayAndBloodVesselRoute();
213 MeshPtr inputMesh = boost::dynamic_pointer_cast<StringPropertySelectMesh>(
mInputTypes[0])->getMesh();
217 PointMetricPtr targetPoint = boost::dynamic_pointer_cast<StringPropertySelectPointMetric>(
mInputTypes[1])->getPointMetric();
226 outputCenterline->getProperties().mLineWidth->setValue(5);
233 outputCenterlineExt->setColor(QColor(0, 0, 255, 255));
234 outputCenterlineExt->getProperties().mLineWidth->setValue(5);
241 outputCenterline->get_rMd_History()->setParentSpace(inputMesh->getUid());
242 outputCenterlineExt->get_rMd_History()->setParentSpace(inputMesh->getUid());
244 mServices->view()->autoShowData(outputCenterline);
249 mOutputTypes[1]->setValue(outputCenterlineExt->getUid());
251 MeshPtr bloodVesselCenterlineMesh = boost::dynamic_pointer_cast<StringPropertySelectMesh>(
mInputTypes[2])->getMesh();
252 if(mBloodVesselRoute && bloodVesselCenterlineMesh && getBloodVesselOption(
mOptions)->getValue())
268 MeshPtr inputMesh = boost::dynamic_pointer_cast<StringPropertySelectMesh>(
mInputTypes[0])->getMesh();
269 PointMetricPtr targetPoint = boost::dynamic_pointer_cast<StringPropertySelectPointMetric>(
mInputTypes[1])->getPointMetric();
274 MeshPtr bloodVesselCenterlineMesh = boost::dynamic_pointer_cast<StringPropertySelectMesh>(
mInputTypes[2])->getMesh();
280 outputCenterlineBV->setColor(QColor(0, 255, 0, 255));
283 outputCenterlineBV->get_rMd_History()->setParentSpace(inputMesh->getUid());
286 mOutputTypes[2]->setValue(outputCenterlineBV->getUid());
288 if(mAirwaysFromBloodVessel)
295 outputMesh->setColor(QColor(192, 253, 246, 255));
299 outputMesh->get_rMd_History()->setParentSpace(inputMesh->getUid());
309 outputMergedCenterline->
setVtkPolyData(mAirwayAndBloodVesselRoute);
310 outputMergedCenterline->setColor(QColor(0, 255, 0, 255));
311 outputMergedCenterline->getProperties().mLineWidth->setValue(5);
314 outputMergedCenterline->get_rMd_History()->setParentSpace(inputMesh->getUid());
317 mOutputTypes[3]->setValue(outputMergedCenterline->getUid());
325 mSmoothing = smoothing;
330 return mRouteToTarget->getRoutePositions();
335 return mRouteToTarget->getCameraRotation();
338 BoolPropertyPtr RouteToTargetFilter::getBloodVesselOption(QDomElement root)
343 "Selecting this option to use blood vessels to find RTT beyond airways",