AnisotropicDiffusion.h 3.24 KB
Newer Older
1
2
3
4
/*****************************************************************************
 * $CAMITK_LICENCE_BEGIN$
 *
 * CamiTK - Computer Assisted Medical Intervention ToolKit
saubatn's avatar
saubatn committed
5
 * (c) 2001-2016 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) 
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 *
 * Visit http://camitk.imag.fr for more information
 *
 * This file is part of CamiTK.
 *
 * CamiTK is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * CamiTK is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with CamiTK.  If not, see <http://www.gnu.org/licenses/>.
 *
 * $CAMITK_LICENCE_END$
 ****************************************************************************/
25
26
27
28
29
30
#ifndef ANISOTROPICDIFFUSION_H
#define ANISOTROPICDIFFUSION_H

#include <QObject>
#include <Action.h>
#include <ImageComponent.h>
31
#include <ActionWidget.h>
32

saubatn's avatar
saubatn committed
33
34
#include "ITKFilterAPI.h"

35
/**
36
 *
37
 * @ingroup group_cepimaging_actions_itkfilters
38
 *
39
40
 * @brief
 * Perform a anisotropic diffusion on the @ref camitk::ImageComponent "ImageComponent"
41
 *
42
 **/
saubatn's avatar
saubatn committed
43
class ITKFILTER_API AnisotropicDiffusion : public camitk::Action {
44
    Q_OBJECT
45

46
47
    /// Enumerations
    Q_ENUMS( AnisoDiffType )
48

49
50
public:
    /// Define the possible implementations of Gaussian filtering
saubatn's avatar
saubatn committed
51
    enum AnisoDiffType {GRADIENT, CURVATURE};
52

53
    /// Default Constructor
54
    AnisotropicDiffusion(camitk::ActionExtension * );
55
56
57
58

    /// Default Destructor
    virtual ~AnisotropicDiffusion();

59
public slots:
60
    /** this method is automatically called when the action is triggered.
61
62
      * Use getTargets() QList to get the list of component to use.
      * \note getTargets() is automatically filtered so that it only contains compatible components,
63
64
      * i.e., instances of ImageComponent (or a subclass).
      */
65
    virtual ApplyStatus apply();
66

saubatn's avatar
saubatn committed
67
68
69
70
71
72
    /**
     * @brief Get the diffusion type to be used by the algorithm.
     * @return The diffusion type as an enum.
     * @note The diffusion type uses camitk::Property with its ENUM.
     */
    AnisoDiffType getDiffusionType();
73
74


75
private:
76
    /// helper method to simplify the target component processing
promayon's avatar
promayon committed
77
    virtual void process(camitk::ImageComponent *);
78

79
    vtkSmartPointer<vtkImageData> implementProcess(vtkSmartPointer<vtkImageData> img);
80

81
82
    template <class InputPixelType, class OutputPixelType, const int dim>
    vtkSmartPointer<vtkImageData> itkProcess(vtkSmartPointer<vtkImageData> img);
83

84
85
    template <class InputPixelType, class OutputPixelType, const int dim>
    vtkSmartPointer<vtkImageData> itkProcessGradientAnisotropicDiffusion(vtkSmartPointer<vtkImageData> img);
86

87
88
    template <class InputPixelType, class OutputPixelType, const int dim>
    vtkSmartPointer<vtkImageData> itkProcessCurvatureAnisotropicDiffusion(vtkSmartPointer<vtkImageData> img);
89
90

protected:
91
92
93
94
    bool keepOrgVoxelType;
    int numberOfIterations;
    double conductance;
};
saubatn's avatar
saubatn committed
95

96
Q_DECLARE_METATYPE(AnisotropicDiffusion::AnisoDiffType)
97
#endif // ANISOTROPICDIFFUSION_H