CustusX  18.04
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 
57  static vtkPolyDataPtr execute(vtkImageDataPtr input,
58  double threshold,
59  bool reduceResolution=false,
60  bool smoothing=true,
61  bool preserveTopology=true,
62  double decimation=0.2);
66  static MeshPtr postProcess(PatientModelServicePtr patient, vtkPolyDataPtr contour, ImagePtr base, QColor color);
67 
68 protected:
69  virtual void createOptions();
70  virtual void createInputTypes();
71  virtual void createOutputTypes();
72 
73 private slots:
76  void imageChangedSlot(QString uid);
77  void thresholdSlot();
78 
79 private:
80  void stopPreview();
81 
82  BoolPropertyPtr mReduceResolutionOption;
83  DoublePropertyPtr mSurfaceThresholdOption;
84  vtkPolyDataPtr mRawResult;
85  ImagePtr mPreviewImage;
86 };
87 typedef boost::shared_ptr<class ContourFilter> ContourFilterPtr;
88 
89 
90 } // namespace cx
91 
92 #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.