CustusX  2023.01.05-dev+develop.0da12
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 setColoringAirways(bool coloringAirways);
67  void setVesselSegmentation(bool vesselSegmentation);
68 
69 protected:
70  void segmentAirways(fast::ImageFileImporter::pointer importerPtr);
71  bool extractAirways(fast::AirwaySegmentation::pointer airwaySegmentationPtr);
72  void segmentLungs(fast::ImageFileImporter::pointer importerPtr);
73  void segmentVessels(fast::ImageFileImporter::pointer importerPtr);
74  bool extractBloodVessels(fast::LungSegmentation::pointer lungSegmentationPtr);
75  bool extractLungs(fast::LungSegmentation::pointer lungSegmentationPtr);
76  bool postProcessAirways();
77  bool postProcessLungs();
78  bool postProcessVessels();
79  virtual void createOptions();
80  virtual void createInputTypes();
81  virtual void createOutputTypes();
82 
83 private:
84  static Vector3D getSeedPointFromTool(SpaceProviderPtr spaceProvider, DataPtr image);
85  static bool isSeedPointInsideImage(Vector3D, DataPtr);
86  BoolPropertyPtr getManualSeedPointOption(QDomElement root);
87  BoolPropertyPtr getAirwaySegmentationOption(QDomElement root);
88  BoolPropertyPtr getAirwayTubesGenerationOption(QDomElement root);
89  BoolPropertyPtr getColoredAirwaysOption(QDomElement root);
90  BoolPropertyPtr getLungSegmentationOption(QDomElement root);
91  BoolPropertyPtr getVesselSegmentationOption(QDomElement root);
92  BoolPropertyPtr getVesselCenterlineOption(QDomElement root);
93  BoolPropertyPtr getVesselVolumeOption(QDomElement root);
94  void createAirwaysFromCenterline();
95  void createColoredAirways();
96 
97  vtkImageDataPtr mAirwaySegmentationOutput;
98  vtkPolyDataPtr mAirwayCenterlineOutput;
99  vtkImageDataPtr mLungSegmentationOutput;
100  vtkImageDataPtr mBloodVesselSegmentationOutput;
101  vtkPolyDataPtr mBloodVesselCenterlineOutput;
102  Transform3D mTransformation;
103  ImagePtr mInputImage;
104  Vector3D seedPoint;
105  bool mDefaultStraightCLTubesOption;
106  BoolPropertyPtr mManualSeedPointOption;
107  BoolPropertyPtr mAirwaySegmentationOption;
108  BoolPropertyPtr mAirwayTubesGenerationOption;
109  BoolPropertyPtr mColoredAirwaysOption;
110  BoolPropertyPtr mLungSegmentationOption;
111  BoolPropertyPtr mVesselSegmentationOption;
112  BoolPropertyPtr mVesselCenterlineOption;
113  BoolPropertyPtr mVesselVolumeOption;
114 };
115 typedef boost::shared_ptr<class AirwaysFilter> AirwaysFilterPtr;
116 typedef boost::shared_ptr<class GenericScriptFilter> GenericScriptFilterPtr;
117 
118 } /* namespace cx */
119 #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.