]> Creatis software - clitk.git/blob - segmentation/clitkExtractLymphStationsFilter.h
d1301579699fcc99f09498018c46033678807554
[clitk.git] / segmentation / clitkExtractLymphStationsFilter.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://oncora1.lyon.fnclcc.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 CLITKEXTRACTLYMPHSTATIONSFILTER_H
20 #define CLITKEXTRACTLYMPHSTATIONSFILTER_H
21
22 // clitk
23 #include "clitkFilterBase.h"
24 #include "clitkFilterWithAnatomicalFeatureDatabaseManagement.h"
25
26 namespace clitk {
27   
28   //--------------------------------------------------------------------
29   /*
30     Try to extract the LymphStations part of a thorax CT.
31     Need a set of Anatomical Features (AFDB)
32   */
33   //--------------------------------------------------------------------
34   
35   template <class TImageType>
36   class ITK_EXPORT ExtractLymphStationsFilter: 
37     public virtual clitk::FilterBase, 
38     public clitk::FilterWithAnatomicalFeatureDatabaseManagement,
39     public itk::ImageToImageFilter<TImageType, itk::Image<uchar, 3> >
40   {
41
42   public:
43     /** Standard class typedefs. */
44     typedef itk::ImageToImageFilter<TImageType, itk::Image<uchar, 3> > Superclass;
45     typedef ExtractLymphStationsFilter          Self;
46     typedef itk::SmartPointer<Self>             Pointer;
47     typedef itk::SmartPointer<const Self>       ConstPointer;
48     
49     /** Method for creation through the object factory. */
50     itkNewMacro(Self);
51     
52     /** Run-time type information (and related methods). */
53     itkTypeMacro(ExtractLymphStationsFilter, ImageToImageFilter);
54
55     /** Some convenient typedefs. */
56     typedef TImageType                       ImageType;
57     typedef typename ImageType::ConstPointer ImageConstPointer;
58     typedef typename ImageType::Pointer      ImagePointer;
59     typedef typename ImageType::RegionType   ImageRegionType; 
60     typedef typename ImageType::PixelType    ImagePixelType; 
61     typedef typename ImageType::SizeType     ImageSizeType; 
62     typedef typename ImageType::IndexType    ImageIndexType; 
63     typedef typename ImageType::PointType    ImagePointType; 
64         
65     typedef uchar MaskImagePixelType;
66     typedef itk::Image<MaskImagePixelType, 3>    MaskImageType;  
67     typedef typename MaskImageType::Pointer      MaskImagePointer;
68     typedef typename MaskImageType::RegionType   MaskImageRegionType; 
69     typedef typename MaskImageType::SizeType     MaskImageSizeType; 
70     typedef typename MaskImageType::IndexType    MaskImageIndexType; 
71     typedef typename MaskImageType::PointType    MaskImagePointType; 
72
73     /** ImageDimension constants */
74     itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
75     FILTERBASE_INIT;
76    
77     /** Main options (from ggo) */
78     template <class ArgsInfoType>
79     void SetArgsInfo(ArgsInfoType & argsinfo);
80
81     itkGetConstMacro(BackgroundValue, MaskImagePixelType);
82     itkGetConstMacro(ForegroundValue, MaskImagePixelType);
83     itkSetMacro(BackgroundValue, MaskImagePixelType);
84     itkSetMacro(ForegroundValue, MaskImagePixelType);
85     
86     // Station 7
87     itkSetMacro(FuzzyThreshold, double);
88     itkGetConstMacro(FuzzyThreshold, double);
89     itkSetMacro(Station7Filename, std::string);
90     itkGetConstMacro(Station7Filename, std::string);
91
92   protected:
93     ExtractLymphStationsFilter();
94     virtual ~ExtractLymphStationsFilter() {}
95     
96     virtual void GenerateOutputInformation();
97     virtual void GenerateInputRequestedRegion();
98     virtual void GenerateData();
99     
100     ImageConstPointer  m_Input;
101     MaskImagePointer   m_Support;
102     MaskImagePointer   m_Working_Support;
103     MaskImagePointer   m_Output;
104     MaskImagePixelType m_BackgroundValue;
105     MaskImagePixelType m_ForegroundValue;    
106
107     // Common 
108     MaskImagePointer m_Trachea;
109
110     // Station 7
111     void ExtractStation_7();
112     void ExtractStation_7_SI_Limits();
113     void ExtractStation_7_RL_Limits();
114     void ExtractStation_7_Posterior_Limits();       
115     std::string      m_Station7Filename;
116     MaskImagePointer m_working_trachea;
117     double           m_FuzzyThreshold;
118     MaskImagePointer m_LeftBronchus;
119     MaskImagePointer m_RightBronchus;
120     MaskImagePointer m_Station7;
121
122     // Station 4RL
123     void ExtractStation_4RL();
124     void ExtractStation_4RL_SI_Limits();
125     void ExtractStation_4RL_LR_Limits();
126     MaskImagePointer m_Station4RL;
127
128   private:
129     ExtractLymphStationsFilter(const Self&); //purposely not implemented
130     void operator=(const Self&); //purposely not implemented
131     
132   }; // end class
133   //--------------------------------------------------------------------
134
135 } // end namespace clitk
136 //--------------------------------------------------------------------
137
138 #ifndef ITK_MANUAL_INSTANTIATION
139 #include "clitkExtractLymphStationsFilter.txx"
140 #include "clitkExtractLymphStation_7.txx"
141 #include "clitkExtractLymphStation_4RL.txx"
142 #endif
143
144 #endif