1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
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
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.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
19 #ifndef CLITKEXTRACTMEDIASTINUMFILTER_H
20 #define CLITKEXTRACTMEDIASTINUMFILTER_H
22 #include "clitkFilterBase.h"
23 #include "clitkFilterWithAnatomicalFeatureDatabaseManagement.h"
27 //--------------------------------------------------------------------
29 Try to extract the mediastinum part of a thorax CT.
36 //--------------------------------------------------------------------
38 template <class TImageType>
39 class ITK_EXPORT ExtractMediastinumFilter:
40 public virtual clitk::FilterBase,
41 public clitk::FilterWithAnatomicalFeatureDatabaseManagement,
42 public itk::ImageToImageFilter<TImageType, TImageType>
46 /** Standard class typedefs. */
47 typedef itk::ImageToImageFilter<TImageType, TImageType> Superclass;
48 typedef ExtractMediastinumFilter Self;
49 typedef itk::SmartPointer<Self> Pointer;
50 typedef itk::SmartPointer<const Self> ConstPointer;
52 /** Method for creation through the object factory. */
55 /** Run-time type information (and related methods). */
56 itkTypeMacro(ExtractMediastinumFilter, InPlaceImageFilter);
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;
70 void SetInputPatientLabelImage(const TImageType * image, ImagePixelType bg=0);
71 void SetInputLungLabelImage(const TImageType * image, ImagePixelType bg=0,
72 ImagePixelType fgLeftLung=1, ImagePixelType fgRightLung=2);
73 void SetInputBonesLabelImage(const TImageType * image, ImagePixelType bg=0);
74 void SetInputTracheaLabelImage(const TImageType * image, ImagePixelType bg=0);
76 /** ImageDimension constants */
77 itkStaticConstMacro(ImageDimension, unsigned int, TImageType::ImageDimension);
79 // Set all options at a time
80 template<class ArgsInfoType>
81 void SetArgsInfo(ArgsInfoType arg);
83 // Background / Foreground
84 itkSetMacro(BackgroundValuePatient, ImagePixelType);
85 itkGetConstMacro(BackgroundValuePatient, ImagePixelType);
86 GGO_DefineOption(patientBG, SetBackgroundValuePatient, ImagePixelType);
88 itkSetMacro(BackgroundValueLung, ImagePixelType);
89 itkGetConstMacro(BackgroundValueLung, ImagePixelType);
90 GGO_DefineOption(lungBG, SetBackgroundValueLung, ImagePixelType);
92 itkSetMacro(BackgroundValueBones, ImagePixelType);
93 itkGetConstMacro(BackgroundValueBones, ImagePixelType);
94 GGO_DefineOption(bonesBG, SetBackgroundValueBones, ImagePixelType);
96 itkGetConstMacro(BackgroundValue, ImagePixelType);
97 itkGetConstMacro(ForegroundValue, ImagePixelType);
99 itkSetMacro(ForegroundValueLeftLung, ImagePixelType);
100 itkGetConstMacro(ForegroundValueLeftLung, ImagePixelType);
101 GGO_DefineOption(lungLeft, SetForegroundValueLeftLung, ImagePixelType);
103 itkSetMacro(ForegroundValueRightLung, ImagePixelType);
104 itkGetConstMacro(ForegroundValueRightLung, ImagePixelType);
105 GGO_DefineOption(lungRight, SetForegroundValueRightLung, ImagePixelType);
107 itkSetMacro(BackgroundValueTrachea, ImagePixelType);
108 itkGetConstMacro(BackgroundValueTrachea, ImagePixelType);
109 GGO_DefineOption(lungBG, SetBackgroundValueTrachea, ImagePixelType);
111 itkSetMacro(IntermediateSpacing, double);
112 itkGetConstMacro(IntermediateSpacing, double);
113 GGO_DefineOption(spacing, SetIntermediateSpacing, double);
115 itkSetMacro(FuzzyThreshold1, double);
116 itkGetConstMacro(FuzzyThreshold1, double);
117 GGO_DefineOption(fuzzy1, SetFuzzyThreshold1, double);
119 itkSetMacro(FuzzyThreshold2, double);
120 itkGetConstMacro(FuzzyThreshold2, double);
121 GGO_DefineOption(fuzzy2, SetFuzzyThreshold2, double);
123 itkSetMacro(FuzzyThreshold3, double);
124 itkGetConstMacro(FuzzyThreshold3, double);
125 GGO_DefineOption(fuzzy3, SetFuzzyThreshold3, double);
128 ExtractMediastinumFilter();
129 virtual ~ExtractMediastinumFilter() {}
131 virtual void GenerateOutputInformation();
132 virtual void GenerateInputRequestedRegion();
133 virtual void GenerateData();
135 itkSetMacro(BackgroundValue, ImagePixelType);
136 itkSetMacro(ForegroundValue, ImagePixelType);
138 ImagePixelType m_BackgroundValuePatient;
139 ImagePixelType m_BackgroundValueLung;
140 ImagePixelType m_BackgroundValueBones;
141 ImagePixelType m_BackgroundValueTrachea;
142 ImagePixelType m_ForegroundValueLeftLung;
143 ImagePixelType m_ForegroundValueRightLung;
145 ImagePixelType m_BackgroundValue;
146 ImagePixelType m_ForegroundValue;
148 double m_IntermediateSpacing;
149 double m_FuzzyThreshold1;
150 double m_FuzzyThreshold2;
151 double m_FuzzyThreshold3;
154 ExtractMediastinumFilter(const Self&); //purposely not implemented
155 void operator=(const Self&); //purposely not implemented
158 //--------------------------------------------------------------------
160 } // end namespace clitk
161 //--------------------------------------------------------------------
163 #ifndef ITK_MANUAL_INSTANTIATION
164 #include "clitkExtractMediastinumFilter.txx"