Computer Assited Medical Intervention Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MorphologicalOperators.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2013 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 #ifndef MORPHOLOGICALOPERATORS_H
26 #define MORPHOLOGICALOPERATORS_H
27 
28 #include <QObject>
29 #include <Action.h>
30 #include <ImageComponent.h>
31 #include <ActionWidget.h>
32 
33 #include <itkImage.h>
34 
35 using namespace camitk;
36 
38  Q_OBJECT
39 
41  Q_ENUMS( MorphoType )
42  Q_ENUMS( MorphoOperation )
43 
44  Q_PROPERTY( MorphoType typeOfOperation READ getTypeOfOperation WRITE setTypeOfOperation)
45  Q_PROPERTY( MorphoOperation operation READ getOperation WRITE setOperation)
46 
47 
48 public:
50  enum MorphoType {Grey_Level, Binary };
51 
53  enum MorphoOperation {Erosion, Dilation, Opening, Closing };
54 
57 
58  // Setters and Getters for parameters
59  MorphoType getTypeOfOperation() const ;
60  void setTypeOfOperation(const MorphoType typeOfOperation);
61 
62  MorphoOperation getOperation() const ;
63  void setOperation(const MorphoOperation operation);
64 
66  virtual ~MorphologicalOperators();
67 
68 public slots:
74  virtual ApplyStatus apply();
75 
76 
77 private:
79  virtual void process(ImageComponent * comp);
80 
81 private:
82  vtkSmartPointer<vtkImageData> implementProcess(vtkSmartPointer<vtkImageData> img);
83 
84  template <class InputPixelType, class OutputPixelType, const int dim>
85  vtkSmartPointer<vtkImageData> itkProcess(vtkSmartPointer<vtkImageData> img);
86 
87  template <class InputPixelType, class OutputPixelType, const int dim>
88  vtkSmartPointer<vtkImageData> binaryErosionFilter(vtkSmartPointer<vtkImageData> img);
89  template <class InputPixelType, class OutputPixelType, const int dim>
90  vtkSmartPointer<vtkImageData> binaryDilationFilter(vtkSmartPointer<vtkImageData> img);
91  template <class InputPixelType, class OutputPixelType, const int dim>
92  vtkSmartPointer<vtkImageData> binaryOpeningFilter(vtkSmartPointer<vtkImageData> img);
93  template <class InputPixelType, class OutputPixelType, const int dim>
94  vtkSmartPointer<vtkImageData> binaryClosureFilter(vtkSmartPointer<vtkImageData> img);
95 
96  template <class InputPixelType, class OutputPixelType, const int dim>
97  vtkSmartPointer<vtkImageData> greyLevelErosionFilter(vtkSmartPointer<vtkImageData> img);
98  template <class InputPixelType, class OutputPixelType, const int dim>
99  vtkSmartPointer<vtkImageData> greyLevelDilationFilter(vtkSmartPointer<vtkImageData> img);
100  template <class InputPixelType, class OutputPixelType, const int dim>
101  vtkSmartPointer<vtkImageData> greyLevelOpeningFilter(vtkSmartPointer<vtkImageData> img);
102  template <class InputPixelType, class OutputPixelType, const int dim>
103  vtkSmartPointer<vtkImageData> greyLevelClosureFilter(vtkSmartPointer<vtkImageData> img);
104 
105 
106 
107 protected:
109  MorphoType typeOfOperation;
110  MorphoOperation operation;
112 
113  QString suffix;
114 
115 };
116 #endif // MORPHOLOGICALOPERATORS_H