]> Creatis software - clitk.git/blob - itk/clitkLabelImageOverlapMeasureFilter.h
With ITK 5.0, itk::ProcessObject::VerifyInputInformation are now declared const
[clitk.git] / itk / clitkLabelImageOverlapMeasureFilter.h
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to:
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://www.centreleonberard.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17   ===========================================================================**/
18
19 #ifndef CLITKLABELIMAGEOVERLAPMEASUREFILTER_H
20 #define CLITKLABELIMAGEOVERLAPMEASUREFILTER_H
21
22 // clitk
23 #include "clitkFilterBase.h"
24 #include "clitkCropLikeImageFilter.h"
25 #include "clitkSegmentationUtils.h"
26
27 // itk
28 #include <itkImageToImageFilter.h>
29 #include <itkLabelStatisticsImageFilter.h>
30 #include <itkLabelOverlapMeasuresImageFilter.h>
31
32 #include <iomanip>
33
34 namespace clitk {
35
36   //--------------------------------------------------------------------
37   /*
38     Analyze the relative position of a Target (mask image) according
39     to some Object, in a given Support. Indicate the main important
40     position of this Target according the Object.
41   */
42   //--------------------------------------------------------------------
43
44   template <class ImageType>
45   class LabelImageOverlapMeasureFilter:
46     public virtual FilterBase,
47     public itk::ImageToImageFilter<ImageType, ImageType>
48   {
49
50   public:
51     /** Standard class typedefs. */
52     typedef itk::ImageToImageFilter<ImageType, ImageType>      Superclass;
53     typedef LabelImageOverlapMeasureFilter<ImageType>          Self;
54     typedef itk::SmartPointer<Self>                            Pointer;
55     typedef itk::SmartPointer<const Self>                      ConstPointer;
56
57     /** Method for creation through the object factory. */
58     itkNewMacro(Self);
59
60     /** Run-time type information (and related methods). */
61     itkTypeMacro(LabelImageOverlapMeasureFilter, ImageToImageFilter);
62
63     /** Some convenient typedefs. */
64     typedef typename ImageType::ConstPointer ImageConstPointer;
65     typedef typename ImageType::Pointer      ImagePointer;
66     typedef typename ImageType::RegionType   RegionType;
67     typedef typename ImageType::PixelType    PixelType;
68     typedef typename ImageType::SpacingType  SpacingType;
69     typedef typename ImageType::SizeType     SizeType;
70     typedef typename ImageType::IndexType    IndexType;
71     typedef typename ImageType::PointType    PointType;
72
73     /** ImageDimension constants */
74     itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
75     FILTERBASE_INIT;
76
77     // Options
78     itkGetConstMacro(BackgroundValue, PixelType);
79     //itkSetMacro(BackgroundValue, PixelType);
80
81     itkGetConstMacro(Label1, PixelType);
82     itkSetMacro(Label1, PixelType);
83
84     itkGetConstMacro(Label2, PixelType);
85     itkSetMacro(Label2, PixelType);
86
87     itkSetMacro(VerboseFlag, bool);
88     itkGetConstMacro(VerboseFlag, bool);
89     itkBooleanMacro(VerboseFlag);
90
91     itkSetMacro(LongFlag, bool);
92     itkGetConstMacro(LongFlag, bool);
93     itkBooleanMacro(LongFlag);
94
95     // I dont want to verify inputs information
96 #if ITK_VERSION_MAJOR <= 4
97     virtual void VerifyInputInformation() ITK_OVERRIDE { }
98 #else
99     virtual void VerifyInputInformation() const ITK_OVERRIDE { }
100 #endif
101
102    protected:
103     LabelImageOverlapMeasureFilter();
104     virtual ~LabelImageOverlapMeasureFilter() {}
105
106     PixelType m_BackgroundValue;
107     PixelType m_Label1;
108     PixelType m_Label2;
109     ImagePointer m_Input1;
110     ImagePointer m_Input2;
111     bool m_VerboseFlag;
112     bool m_LongFlag;
113
114     virtual void GenerateOutputInformation();
115     virtual void GenerateInputRequestedRegion();
116     virtual void GenerateData();
117
118   private:
119     LabelImageOverlapMeasureFilter(const Self&); //purposely not implemented
120     void operator=(const Self&); //purposely not implemented
121
122   }; // end class
123   //--------------------------------------------------------------------
124
125 } // end namespace clitk
126 //--------------------------------------------------------------------
127
128 #include "clitkLabelImageOverlapMeasureFilter.txx"
129
130 #endif