]> Creatis software - clitk.git/blob - itk/clitkLabelImageOverlapMeasureFilter.h
First version of clitkLabelImageOverlapMeasure
[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 CLITKRELATIVEPOSITIONANALYZERFILTER_H
21
22 // clitk
23 #include "clitkFilterBase.h"
24 #include "clitkCropLikeImageFilter.h"
25 #include "clitkSegmentationUtils.h"
26 // #include "itkLabelOverlapMeasuresImageFilter.h"
27
28 // itk
29 #include <itkImageToImageFilter.h>
30 #include <itkLabelStatisticsImageFilter.h>
31
32 namespace clitk {
33   
34   //--------------------------------------------------------------------
35   /*
36     Analyze the relative position of a Target (mask image) according
37     to some Object, in a given Support. Indicate the main important
38     position of this Target according the Object. 
39   */
40   //--------------------------------------------------------------------
41   
42   template <class ImageType>
43   class LabelImageOverlapMeasureFilter:
44     public virtual FilterBase,
45     public itk::ImageToImageFilter<ImageType, ImageType>
46   {
47
48   public:
49     /** Standard class typedefs. */
50     typedef itk::ImageToImageFilter<ImageType, ImageType>      Superclass;
51     typedef LabelImageOverlapMeasureFilter<ImageType>          Self;
52     typedef itk::SmartPointer<Self>                            Pointer;
53     typedef itk::SmartPointer<const Self>                      ConstPointer;
54        
55     /** Method for creation through the object factory. */
56     itkNewMacro(Self);
57     
58     /** Run-time type information (and related methods). */
59     itkTypeMacro(LabelImageOverlapMeasureFilter, ImageToImageFilter);
60
61     /** Some convenient typedefs. */
62     typedef typename ImageType::ConstPointer ImageConstPointer;
63     typedef typename ImageType::Pointer      ImagePointer;
64     typedef typename ImageType::RegionType   RegionType; 
65     typedef typename ImageType::PixelType    PixelType;
66     typedef typename ImageType::SpacingType  SpacingType;
67     typedef typename ImageType::SizeType     SizeType;
68     typedef typename ImageType::IndexType    IndexType;
69     typedef typename ImageType::PointType    PointType;
70     
71     /** ImageDimension constants */
72     itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
73     FILTERBASE_INIT;
74  
75     // Options
76     itkGetConstMacro(BackgroundValue, PixelType);
77     itkSetMacro(BackgroundValue, PixelType);
78
79     itkGetConstMacro(Label1, PixelType);
80     itkSetMacro(Label1, PixelType);
81
82     itkGetConstMacro(Label2, PixelType);
83     itkSetMacro(Label2, PixelType);
84
85     // I dont want to verify inputs information
86     virtual void VerifyInputInformation() { }
87     
88    protected:
89     LabelImageOverlapMeasureFilter();
90     virtual ~LabelImageOverlapMeasureFilter() {}
91     
92     PixelType m_BackgroundValue;
93     PixelType m_Label1;
94     PixelType m_Label2;
95     ImagePointer m_Input1;
96     ImagePointer m_Input2;
97
98     virtual void GenerateOutputInformation();
99     virtual void GenerateInputRequestedRegion();
100     virtual void GenerateData();
101
102   private:
103     LabelImageOverlapMeasureFilter(const Self&); //purposely not implemented
104     void operator=(const Self&); //purposely not implemented
105     
106   }; // end class
107   //--------------------------------------------------------------------
108
109 } // end namespace clitk
110 //--------------------------------------------------------------------
111
112 #include "clitkLabelImageOverlapMeasureFilter.txx"
113
114 #endif