]> Creatis software - clitk.git/blob - segmentation/clitkExtractLymphStationsFilter.h
some segmentation tools (most from jef)
[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 #include "clitkFilterBase.h"
23
24 namespace clitk {
25   
26   //--------------------------------------------------------------------
27   /*
28     Try to extract the LymphStations part of a thorax CT.
29     Inputs : 
30     - Patient label image
31     - Lungs label image
32     - Bones label image
33   */
34   //--------------------------------------------------------------------
35   
36   template <class TImageType>
37   class ITK_EXPORT ExtractLymphStationsFilter: 
38     public clitk::FilterBase, 
39     public itk::ImageToImageFilter<TImageType, TImageType> 
40   {
41
42   public:
43     /** Standard class typedefs. */
44     typedef itk::ImageToImageFilter<TImageType, TImageType> 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, InPlaceImageFilter);
54     FILTERBASE_INIT;
55
56     /** Some convenient typedefs. */
57     typedef TImageType                       ImageType;
58     typedef typename ImageType::ConstPointer ImageConstPointer;
59     typedef typename ImageType::Pointer      ImagePointer;
60     typedef typename ImageType::RegionType   ImageRegionType; 
61     typedef typename ImageType::PixelType    ImagePixelType; 
62     typedef typename ImageType::SizeType     ImageSizeType; 
63     typedef typename ImageType::IndexType    ImageIndexType; 
64         
65     /** Connect inputs */
66     void SetInputMediastinumLabelImage(const TImageType * image, ImagePixelType bg=0);
67     void SetInputTracheaLabelImage(const TImageType * image, ImagePixelType bg=0);
68   
69     /** ImageDimension constants */
70     itkStaticConstMacro(ImageDimension, unsigned int, TImageType::ImageDimension);
71
72     // Set all options at a time
73     template<class ArgsInfoType>
74       void SetArgsInfo(ArgsInfoType arg);
75    
76     // Background / Foreground
77     itkSetMacro(BackgroundValueMediastinum, ImagePixelType);
78     itkGetConstMacro(BackgroundValueMediastinum, ImagePixelType);
79     //GGO_DefineOption(MediastinumBG, SetBackgroundValueMediastinum, ImagePixelType);
80     
81     itkSetMacro(BackgroundValueTrachea, ImagePixelType);
82     itkGetConstMacro(BackgroundValueTrachea, ImagePixelType);
83     //GGO_DefineOption(TracheaBG, SetBackgroundValueTrachea, ImagePixelType);
84
85     itkGetConstMacro(BackgroundValue, ImagePixelType);
86     itkGetConstMacro(ForegroundValue, ImagePixelType);
87
88     itkSetMacro(CarenaZPositionInMM, double);
89     itkGetConstMacro(CarenaZPositionInMM, double);
90     GGO_DefineOption(carenaZposition, SetCarenaZPositionInMM, double);
91
92     itkSetMacro(MiddleLobeBronchusZPositionInMM, double);
93     itkGetConstMacro(MiddleLobeBronchusZPositionInMM, double);
94     GGO_DefineOption(middleLobeBronchusZposition, SetMiddleLobeBronchusZPositionInMM, double);
95
96     itkSetMacro(IntermediateSpacing, double);
97     itkGetConstMacro(IntermediateSpacing, double);
98     GGO_DefineOption(spacing, SetIntermediateSpacing, double);
99
100     itkSetMacro(FuzzyThreshold1, double);
101     itkGetConstMacro(FuzzyThreshold1, double);
102     GGO_DefineOption(fuzzy1, SetFuzzyThreshold1, double);
103
104
105
106   protected:
107     ExtractLymphStationsFilter();
108     virtual ~ExtractLymphStationsFilter() {}
109     
110     virtual void GenerateOutputInformation();
111     virtual void GenerateInputRequestedRegion();
112     virtual void GenerateData();
113        
114     itkSetMacro(BackgroundValue, ImagePixelType);
115     itkSetMacro(ForegroundValue, ImagePixelType);
116     
117     ImageConstPointer m_mediastinum;
118     ImageConstPointer m_trachea;
119     ImagePointer m_working_image;
120     ImagePointer m_working_trachea;  
121     ImagePointer m_output;  
122     
123     ImagePixelType m_BackgroundValueMediastinum;
124     ImagePixelType m_BackgroundValueTrachea;
125     ImagePixelType m_BackgroundValue;
126     ImagePixelType m_ForegroundValue;
127     
128     double m_CarenaZPositionInMM;
129     double m_MiddleLobeBronchusZPositionInMM; 
130     double m_IntermediateSpacing;
131     double m_FuzzyThreshold1;
132     
133   private:
134     ExtractLymphStationsFilter(const Self&); //purposely not implemented
135     void operator=(const Self&); //purposely not implemented
136     
137   }; // end class
138   //--------------------------------------------------------------------
139
140 } // end namespace clitk
141 //--------------------------------------------------------------------
142
143 #ifndef ITK_MANUAL_INSTANTIATION
144 #include "clitkExtractLymphStationsFilter.txx"
145 #endif
146
147 #endif