]> Creatis software - clitk.git/blob - segmentation/clitkExtractLymphStationsFilter.h
add clitkExceptionMacro
[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     Inputs : 
32     - Patient label image
33     - Lungs label image
34     - Bones label image
35   */
36   //--------------------------------------------------------------------
37   
38   template <class TImageType>
39   class ITK_EXPORT ExtractLymphStationsFilter: 
40     public virtual clitk::FilterBase, 
41     public clitk::FilterWithAnatomicalFeatureDatabaseManagement,
42     public itk::ImageToImageFilter<TImageType, TImageType>
43   {
44
45   public:
46     /** Standard class typedefs. */
47     typedef itk::ImageToImageFilter<TImageType, TImageType> Superclass;
48     typedef ExtractLymphStationsFilter          Self;
49     typedef itk::SmartPointer<Self>             Pointer;
50     typedef itk::SmartPointer<const Self>       ConstPointer;
51     
52     /** Method for creation through the object factory. */
53     itkNewMacro(Self);
54     
55     /** Run-time type information (and related methods). */
56     itkTypeMacro(ExtractLymphStationsFilter, InPlaceImageFilter);
57     FILTERBASE_INIT;
58
59     /** Some convenient typedefs. */
60     typedef TImageType                       ImageType;
61     typedef typename ImageType::ConstPointer ImageConstPointer;
62     typedef typename ImageType::Pointer      ImagePointer;
63     typedef typename ImageType::RegionType   ImageRegionType; 
64     typedef typename ImageType::PixelType    ImagePixelType; 
65     typedef typename ImageType::SizeType     ImageSizeType; 
66     typedef typename ImageType::IndexType    ImageIndexType; 
67     typedef typename ImageType::PointType    ImagePointType; 
68         
69     /** Connect inputs */
70     void SetInputMediastinumLabelImage(const TImageType * image, ImagePixelType bg=0);
71     void SetInputTracheaLabelImage(const TImageType * image, ImagePixelType bg=0);
72   
73     /** ImageDimension constants */
74     itkStaticConstMacro(ImageDimension, unsigned int, TImageType::ImageDimension);
75
76     // Set all options at a time
77     template<class ArgsInfoType>
78       void SetArgsInfo(ArgsInfoType arg);
79    
80     // Background / Foreground
81     itkSetMacro(BackgroundValueMediastinum, ImagePixelType);
82     itkGetConstMacro(BackgroundValueMediastinum, ImagePixelType);
83     //GGO_DefineOption(MediastinumBG, SetBackgroundValueMediastinum, ImagePixelType);
84     
85     itkSetMacro(BackgroundValueTrachea, ImagePixelType);
86     itkGetConstMacro(BackgroundValueTrachea, ImagePixelType);
87     //GGO_DefineOption(TracheaBG, SetBackgroundValueTrachea, ImagePixelType);
88
89     itkGetConstMacro(BackgroundValue, ImagePixelType);
90     itkGetConstMacro(ForegroundValue, ImagePixelType);
91
92     //itkSetMacro(CarinaZPositionInMM, double);
93     void SetCarinaZPositionInMM(double d) { m_CarinaZPositionInMM = d; Modified(); m_CarinaZPositionInMMIsSet = true; }
94     itkGetConstMacro(CarinaZPositionInMM, double);
95     GGO_DefineOption(carenaZposition, SetCarinaZPositionInMM, double);
96
97     itkSetMacro(MiddleLobeBronchusZPositionInMM, double);
98     itkGetConstMacro(MiddleLobeBronchusZPositionInMM, double);
99     GGO_DefineOption(middleLobeBronchusZposition, SetMiddleLobeBronchusZPositionInMM, double);
100
101     itkSetMacro(IntermediateSpacing, double);
102     itkGetConstMacro(IntermediateSpacing, double);
103     GGO_DefineOption(spacing, SetIntermediateSpacing, double);
104
105     itkSetMacro(FuzzyThreshold1, double);
106     itkGetConstMacro(FuzzyThreshold1, double);
107     GGO_DefineOption(fuzzy1, SetFuzzyThreshold1, double);
108     
109   protected:
110     ExtractLymphStationsFilter();
111     virtual ~ExtractLymphStationsFilter() {}
112     
113     virtual void GenerateOutputInformation();
114     virtual void GenerateInputRequestedRegion();
115     virtual void GenerateData();
116        
117     itkSetMacro(BackgroundValue, ImagePixelType);
118     itkSetMacro(ForegroundValue, ImagePixelType);
119     
120     ImageConstPointer m_mediastinum;
121     ImageConstPointer m_trachea;
122     ImagePointer m_working_image;
123     ImagePointer m_working_trachea;  
124     ImagePointer m_output;  
125     
126     ImagePixelType m_BackgroundValueMediastinum;
127     ImagePixelType m_BackgroundValueTrachea;
128     ImagePixelType m_BackgroundValue;
129     ImagePixelType m_ForegroundValue;
130     
131     double m_CarinaZPositionInMM;
132     bool   m_CarinaZPositionInMMIsSet;
133     double m_MiddleLobeBronchusZPositionInMM; 
134     double m_IntermediateSpacing;
135     double m_FuzzyThreshold1;
136     
137   private:
138     ExtractLymphStationsFilter(const Self&); //purposely not implemented
139     void operator=(const Self&); //purposely not implemented
140     
141   }; // end class
142   //--------------------------------------------------------------------
143
144 } // end namespace clitk
145 //--------------------------------------------------------------------
146
147 #ifndef ITK_MANUAL_INSTANTIATION
148 #include "clitkExtractLymphStationsFilter.txx"
149 #endif
150
151 #endif