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);
176 mRouteToTarget->setSmoothing(mSmoothing);
178 if(mReprocessCenterline || !mBranchListPtr)
180 mRouteToTarget->processCenterline(mesh);
181 mBranchListPtr = mRouteToTarget->getBranchList();
185 mRouteToTarget->setBranchList(mBranchListPtr);
189 mOutput = mRouteToTarget->findRouteToTarget(targetPoint);
191 if(mOutput->GetNumberOfPoints() < 1)
194 mExtendedRoute = mRouteToTarget->findExtendedRoute(targetPoint);
196 if (mGenerateFileWithRouteInformation)
197 mRouteToTarget->addRouteInformationToFile(
mServices);
199 if (getBloodVesselOption(
mOptions)->getValue())
203 MeshPtr bloodVesselCenterline = boost::dynamic_pointer_cast<StringPropertySelectMesh>(
mInputTypes[2])->getMesh();
204 if (bloodVesselCenterline)
206 if (bloodVesselVolume)
207 mRouteToTarget->setBloodVesselVolume(bloodVesselVolume);
209 mBloodVesselRoute = mRouteToTarget->findRouteToTargetAlongBloodVesselCenterlines( bloodVesselCenterline, targetPoint);
210 mAirwaysFromBloodVessel = mRouteToTarget->generateAirwaysFromBloodVesselCenterlines();
213 mAirwayAndBloodVesselRoute = mRouteToTarget->getConnectedAirwayAndBloodVesselRoute();
234 outputCenterline->getProperties().mLineWidth->setValue(5);
241 outputCenterlineExt->setColor(QColor(0, 0, 255, 255));
242 outputCenterlineExt->getProperties().mLineWidth->setValue(5);
249 outputCenterline->get_rMd_History()->setParentSpace(inputMesh->getUid());
250 outputCenterlineExt->get_rMd_History()->setParentSpace(inputMesh->getUid());
258 mOutputTypes[1]->setValue(outputCenterlineExt->getUid());
260 MeshPtr bloodVesselCenterlineMesh = boost::dynamic_pointer_cast<StringPropertySelectMesh>(
mInputTypes[2])->getMesh();
261 if(mBloodVesselRoute && bloodVesselCenterlineMesh && getBloodVesselOption(
mOptions)->getValue())
283 MeshPtr bloodVesselCenterlineMesh = boost::dynamic_pointer_cast<StringPropertySelectMesh>(
mInputTypes[2])->getMesh();
289 outputCenterlineBV->setColor(QColor(0, 255, 0, 255));
292 outputCenterlineBV->get_rMd_History()->setParentSpace(inputMesh->getUid());
295 mOutputTypes[2]->setValue(outputCenterlineBV->getUid());
297 if(mAirwaysFromBloodVessel)
304 outputMesh->setColor(QColor(192, 253, 246, 255));
308 outputMesh->get_rMd_History()->setParentSpace(inputMesh->getUid());
318 outputMergedCenterline->
setVtkPolyData(mAirwayAndBloodVesselRoute);
319 outputMergedCenterline->setColor(QColor(0, 255, 0, 255));
320 outputMergedCenterline->getProperties().mLineWidth->setValue(5);
323 outputMergedCenterline->get_rMd_History()->setParentSpace(inputMesh->getUid());
326 mOutputTypes[3]->setValue(outputMergedCenterline->getUid());
334 mSmoothing = smoothing;
339 return mRouteToTarget->getRoutePositions(extendedRoute);
344 return mRouteToTarget->getRouteBranches();
349 return mRouteToTarget->getCameraRotation();
354 return mRouteToTarget->getBranchingIndex();
359 return mBranchListPtr;
364 mBranchListPtr = branchList;
369 mReprocessCenterline = reprocess;
372 BoolPropertyPtr RouteToTargetFilter::getBloodVesselOption(QDomElement root)
377 "Selecting this option to use blood vessels to find RTT beyond airways",
static QString getNameSuffixBloodVessel()
virtual QString getName() const
static BoolPropertyPtr initialize(const QString &uid, QString name, QString help, bool value, QDomNode root=QDomNode())
virtual void createOutputTypes()
std::vector< SelectDataStringPropertyBasePtr > mInputTypes
virtual void createOptions()
std::vector< Eigen::Vector3d > getRoutePositions(bool extendedRoute=true)
boost::shared_ptr< class BranchList > BranchListPtr
boost::shared_ptr< class VisServices > VisServicesPtr
boost::shared_ptr< class Image > ImagePtr
static QString getNameSuffixExtension()
void setSmoothing(bool smoothing=true)
static QString getNameSuffix()
std::vector< int > getBranchingIndex()
std::vector< PropertyPtr > mOptionsAdapters
boost::shared_ptr< class SelectDataStringPropertyBase > SelectDataStringPropertyBasePtr
PatientModelServicePtr patientService()
void setVtkPolyData(const vtkPolyDataPtr &polyData)
virtual bool postProcess()
virtual void createInputTypes()
std::vector< BranchPtr > getRouteBranches()
virtual QString getType() const
ImagePtr getCopiedInputImage(int index=0)
virtual QString getHelp() const
virtual bool postProcessBloodVessels()
static QString getNameSuffixAirwayAndVesselRTT()
std::vector< SelectDataStringPropertyBasePtr > mOutputTypes
static StringPropertySelectPointMetricPtr New(PatientModelServicePtr patientModelService)
BranchListPtr getBranchList()
std::vector< double > getCameraRotation()
static QString getNameSuffixAirwayModel()
static StringPropertySelectMeshPtr New(PatientModelServicePtr patientModelService)
boost::shared_ptr< class StringPropertySelectPointMetric > StringPropertySelectPointMetricPtr
static StringPropertySelectImagePtr New(PatientModelServicePtr patientModelService)
void setBranchList(BranchListPtr branchList)
boost::shared_ptr< class BoolProperty > BoolPropertyPtr
boost::shared_ptr< class Mesh > MeshPtr
RouteToTargetFilter(VisServicesPtr services, bool createRouteInformationFile=false)
boost::shared_ptr< class StringPropertySelectMesh > StringPropertySelectMeshPtr
void setReprocessCenterline(bool reprocess)
Namespace for all CustusX production code.
boost::shared_ptr< class PointMetric > PointMetricPtr