CustusX  2021.04.21-dev+develop.337f9
An IGT application
cxAirwaysFilterService.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #ifndef CXAIRWAYSFILTERSERVICE_H_
13 #define CXAIRWAYSFILTERSERVICE_H_
14 
15 #include "org_custusx_filter_airways_Export.h"
16 
17 #include "cxFilter.h"
18 #include "cxFilterImpl.h"
19 
20 #include <boost/unordered_map.hpp>
21 #include <boost/shared_ptr.hpp>
22 
23 #include "cxPatientModelService.h"
24 
25 #include "cxStringProperty.h"
26 #include "cxBoolProperty.h"
27 
28 #include "FAST/Importers/ImageFileImporter.hpp"
29 #include "FAST/Algorithms/LungSegmentation/LungSegmentation.hpp"
30 #include "FAST/Algorithms/AirwaySegmentation/AirwaySegmentation.hpp"
31 
32 class ctkPluginContext;
33 
34 typedef vtkSmartPointer<class vtkImageData> vtkImageDataPtr;
35 typedef vtkSmartPointer<class vtkPolyData> vtkPolyDataPtr;
36 
37 namespace cx {
38 
48 class org_custusx_filter_airways_EXPORT AirwaysFilter : public FilterImpl
49 {
50 Q_OBJECT
51 Q_INTERFACES(cx::Filter)
52 
53 public:
54  AirwaysFilter(VisServicesPtr services);
55  virtual ~AirwaysFilter();
56 
57  virtual QString getType() const;
58  virtual QString getName() const;
59  virtual QString getHelp() const;
60 
61  bool preProcess();
62  virtual bool execute();
63  virtual bool postProcess();
64 
65  void setAirwaySegmentation(bool airwaySegmentation);
66  void setVesselSegmentation(bool vesselSegmentation);
67 
68 protected:
69  void segmentAirways(fast::ImageFileImporter::pointer importerPtr);
70  bool extractAirways(fast::AirwaySegmentation::pointer airwaySegmentationPtr);
71  void segmentLungs(fast::ImageFileImporter::pointer importerPtr);
72  void segmentVessels(fast::ImageFileImporter::pointer importerPtr);
73  bool extractBloodVessels(fast::LungSegmentation::pointer lungSegmentationPtr);
74  bool extractLungs(fast::LungSegmentation::pointer lungSegmentationPtr);
75  bool postProcessAirways();
76  bool postProcessLungs();
77  bool postProcessVessels();
78  virtual void createOptions();
79  virtual void createInputTypes();
80  virtual void createOutputTypes();
81 
82 private:
83  static Vector3D getSeedPointFromTool(SpaceProviderPtr spaceProvider, DataPtr image);
84  static bool isSeedPointInsideImage(Vector3D, DataPtr);
85  BoolPropertyPtr getManualSeedPointOption(QDomElement root);
86  BoolPropertyPtr getAirwaySegmentationOption(QDomElement root);
87  BoolPropertyPtr getAirwayTubesGenerationOption(QDomElement root);
88  BoolPropertyPtr getLungSegmentationOption(QDomElement root);
89  BoolPropertyPtr getVesselSegmentationOption(QDomElement root);
90  BoolPropertyPtr getVesselCenterlineOption(QDomElement root);
91  BoolPropertyPtr getVesselVolumeOption(QDomElement root);
92  void createAirwaysFromCenterline();
93 
94  vtkImageDataPtr mAirwaySegmentationOutput;
95  vtkPolyDataPtr mAirwayCenterlineOutput;
96  vtkImageDataPtr mLungSegmentationOutput;
97  vtkImageDataPtr mBloodVesselSegmentationOutput;
98  vtkPolyDataPtr mBloodVesselCenterlineOutput;
99  Transform3D mTransformation;
100  ImagePtr mInputImage;
101  Vector3D seedPoint;
102  bool mDefaultStraightCLTubesOption;
103  BoolPropertyPtr mManualSeedPointOption;
104  BoolPropertyPtr mAirwaySegmentationOption;
105  BoolPropertyPtr mAirwayTubesGenerationOption;
106  BoolPropertyPtr mLungSegmentationOption;
107  BoolPropertyPtr mVesselSegmentationOption;
108  BoolPropertyPtr mVesselCenterlineOption;
109  BoolPropertyPtr mVesselVolumeOption;
110 };
111 typedef boost::shared_ptr<class AirwaysFilter> AirwaysFilterPtr;
112 typedef boost::shared_ptr<class GenericScriptFilter> GenericScriptFilterPtr;
113 
114 } /* namespace cx */
115 #endif /* CXTUBESEGMENTATIONFILTERSERVICE_H_ */
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
boost::shared_ptr< class Data > DataPtr
vtkSmartPointer< class vtkPolyData > vtkPolyDataPtr
boost::shared_ptr< class GenericScriptFilter > GenericScriptFilterPtr
boost::shared_ptr< class AirwaysFilter > AirwaysFilterPtr
vtkSmartPointer< vtkPolyData > vtkPolyDataPtr
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition: cxVector3D.h:42
boost::shared_ptr< class BoolProperty > BoolPropertyPtr
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
Namespace for all CustusX production code.