CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxContourFilter.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 CXCONTOURFILTER_H
13 #define CXCONTOURFILTER_H
14 
15 #include "cxFilterImpl.h"
16 class QColor;
17 
18 namespace cx
19 {
20 
28 class cxResourceFilter_EXPORT ContourFilter : public FilterImpl
29 {
30  Q_OBJECT
31 
32 public:
33  ContourFilter(VisServicesPtr services);
34  virtual ~ContourFilter() {}
35 
36  virtual QString getType() const;
37  virtual QString getName() const;
38  virtual QString getHelp() const;
39  static QString getNameSuffix();
40  virtual void setActive(bool on);
41 
42  bool preProcess();
43  virtual bool execute();
44  virtual bool postProcess();
45 
46  // extensions:
47  BoolPropertyPtr getReduceResolutionOption(QDomElement root);
48  BoolPropertyPtr getSmoothingOption(QDomElement root);
49  BoolPropertyPtr getPreserveTopologyOption(QDomElement root);
50  DoublePropertyPtr getSurfaceThresholdOption(QDomElement root);
51  DoublePropertyPtr getDecimationOption(QDomElement root);
52  ColorPropertyPtr getColorOption(QDomElement root);
53  DoublePropertyPtr getNumberOfIterationsOption(QDomElement root);
54  DoublePropertyPtr getPassBandOption(QDomElement root);
55 
59  static vtkPolyDataPtr execute(vtkImageDataPtr input,
60  double threshold,
61  bool reduceResolution=false,
62  bool smoothing=true,
63  bool preserveTopology=true,
64  double decimation=0.2,
65  double numberOfIterations = 15,
66  double passBand = 0.3);
70  static MeshPtr postProcess(PatientModelServicePtr patient, vtkPolyDataPtr contour, ImagePtr base, QColor color);
71 
72 protected:
73  virtual void createOptions();
74  virtual void createInputTypes();
75  virtual void createOutputTypes();
76 
77 private slots:
80  void imageChangedSlot(QString uid);
81  void thresholdSlot();
82 
83 private:
84  void stopPreview();
85 
86  BoolPropertyPtr mReduceResolutionOption;
87  DoublePropertyPtr mSurfaceThresholdOption;
88  vtkPolyDataPtr mRawResult;
89  ImagePtr mPreviewImage;
90 };
91 typedef boost::shared_ptr<class ContourFilter> ContourFilterPtr;
92 
93 
94 } // namespace cx
95 
96 #endif // CXCONTOURFILTER_H
virtual ~ContourFilter()
boost::shared_ptr< class ColorProperty > ColorPropertyPtr
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
boost::shared_ptr< class ContourFilter > ContourFilterPtr
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
vtkSmartPointer< vtkPolyData > vtkPolyDataPtr
boost::shared_ptr< class DoubleProperty > DoublePropertyPtr
boost::shared_ptr< class BoolProperty > BoolPropertyPtr
boost::shared_ptr< class Mesh > MeshPtr
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
Namespace for all CustusX production code.