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, itk::Image<uchar, 3> >
46 /** Some convenient typedefs. */
47 typedef TImageType ImageType;
48 typedef typename ImageType::ConstPointer ImageConstPointer;
49 typedef typename ImageType::Pointer ImagePointer;
50 typedef typename ImageType::RegionType ImageRegionType;
51 typedef typename ImageType::PixelType ImagePixelType;
52 typedef typename ImageType::SizeType ImageSizeType;
53 typedef typename ImageType::IndexType ImageIndexType;
54 typedef typename ImageType::PointType ImagePointType;
56 /** Some convenient typedefs. */
57 typedef uchar MaskImagePixelType;
58 typedef itk::Image<MaskImagePixelType, 3> MaskImageType;
59 typedef typename MaskImageType::ConstPointer MaskImageConstPointer;
60 typedef typename MaskImageType::Pointer MaskImagePointer;
61 typedef typename MaskImageType::RegionType MaskImageRegionType;
62 typedef typename MaskImageType::SizeType MaskImageSizeType;
63 typedef typename MaskImageType::IndexType MaskImageIndexType;
64 typedef typename MaskImageType::PointType MaskImagePointType;
66 /** Standard class typedefs. */
67 typedef itk::ImageToImageFilter<TImageType, MaskImageType> Superclass;
68 typedef ExtractMediastinumFilter Self;
69 typedef itk::SmartPointer<Self> Pointer;
70 typedef itk::SmartPointer<const Self> ConstPointer;
72 /** Method for creation through the object factory. */
75 /** Run-time type information (and related methods). */
76 itkTypeMacro(ExtractMediastinumFilter, InPlaceImageFilter);
80 void SetInput(const ImageType * image);
81 void SetInputPatientLabelImage(const MaskImageType * image, MaskImagePixelType bg=0);
82 void SetInputLungLabelImage(const MaskImageType * image, MaskImagePixelType bg=0,
83 MaskImagePixelType fgLeftLung=1, MaskImagePixelType fgRightLung=2);
84 void SetInputBonesLabelImage(const MaskImageType * image, MaskImagePixelType bg=0);
85 void SetInputTracheaLabelImage(const MaskImageType * image, MaskImagePixelType bg=0);
87 // Output filename (for AFBD)
88 itkSetMacro(OutputMediastinumFilename, std::string);
89 itkGetConstMacro(OutputMediastinumFilename, std::string);
91 /** ImageDimension constants */
92 itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
94 // Set all options at a time
95 template<class ArgsInfoType>
96 void SetArgsInfo(ArgsInfoType arg);
98 // Background / Foreground
99 itkSetMacro(BackgroundValuePatient, MaskImagePixelType);
100 itkGetConstMacro(BackgroundValuePatient, MaskImagePixelType);
101 // GGO_DefineOption(patientBG, SetBackgroundValuePatient, MaskImagePixelType);
103 itkSetMacro(BackgroundValueLung, MaskImagePixelType);
104 itkGetConstMacro(BackgroundValueLung, MaskImagePixelType);
105 // GGO_DefineOption(lungBG, SetBackgroundValueLung, MaskImagePixelType);
107 itkSetMacro(BackgroundValueBones, MaskImagePixelType);
108 itkGetConstMacro(BackgroundValueBones, MaskImagePixelType);
109 // GGO_DefineOption(bonesBG, SetBackgroundValueBones, MaskImagePixelType);
111 itkGetConstMacro(BackgroundValue, MaskImagePixelType);
112 itkGetConstMacro(ForegroundValue, MaskImagePixelType);
114 itkSetMacro(ForegroundValueLeftLung, MaskImagePixelType);
115 itkGetConstMacro(ForegroundValueLeftLung, MaskImagePixelType);
116 // GGO_DefineOption(lungLeft, SetForegroundValueLeftLung, MaskImagePixelType);
118 itkSetMacro(ForegroundValueRightLung, MaskImagePixelType);
119 itkGetConstMacro(ForegroundValueRightLung, MaskImagePixelType);
120 // GGO_DefineOption(lungRight, SetForegroundValueRightLung, MaskImagePixelType);
122 itkSetMacro(BackgroundValueTrachea, MaskImagePixelType);
123 itkGetConstMacro(BackgroundValueTrachea, MaskImagePixelType);
124 // GGO_DefineOption(lungBG, SetBackgroundValueTrachea, MaskImagePixelType);
126 itkSetMacro(IntermediateSpacing, double);
127 itkGetConstMacro(IntermediateSpacing, double);
128 GGO_DefineOption(spacing, SetIntermediateSpacing, double);
130 itkSetMacro(FuzzyThreshold1, double);
131 itkGetConstMacro(FuzzyThreshold1, double);
132 GGO_DefineOption(fuzzy1, SetFuzzyThreshold1, double);
134 itkSetMacro(FuzzyThreshold2, double);
135 itkGetConstMacro(FuzzyThreshold2, double);
136 GGO_DefineOption(fuzzy2, SetFuzzyThreshold2, double);
138 itkSetMacro(FuzzyThreshold3, double);
139 itkGetConstMacro(FuzzyThreshold3, double);
140 GGO_DefineOption(fuzzy3, SetFuzzyThreshold3, double);
142 itkSetMacro(DistanceMaxToAnteriorPartOfTheSpine, double);
143 itkGetConstMacro(DistanceMaxToAnteriorPartOfTheSpine, double);
144 GGO_DefineOption(antSpine, SetDistanceMaxToAnteriorPartOfTheSpine, double);
146 itkBooleanMacro(UseBones);
147 itkSetMacro(UseBones, bool);
148 itkGetConstMacro(UseBones, bool);
149 GGO_DefineOption_Flag(useBones, SetUseBones);
151 itkSetMacro(UpperThreshold, double);
152 itkGetConstMacro(UpperThreshold, double);
153 GGO_DefineOption(upper, SetUpperThreshold, double);
155 itkSetMacro(LowerThreshold, double);
156 itkGetConstMacro(LowerThreshold, double);
157 GGO_DefineOption(lower, SetLowerThreshold, double);
160 ExtractMediastinumFilter();
161 virtual ~ExtractMediastinumFilter() {}
163 virtual void GenerateOutputInformation();
164 virtual void GenerateInputRequestedRegion();
165 virtual void GenerateData();
167 itkSetMacro(BackgroundValue, MaskImagePixelType);
168 itkSetMacro(ForegroundValue, MaskImagePixelType);
170 MaskImagePixelType m_BackgroundValuePatient;
171 MaskImagePixelType m_BackgroundValueLung;
172 MaskImagePixelType m_BackgroundValueBones;
173 MaskImagePixelType m_BackgroundValueTrachea;
174 MaskImagePixelType m_ForegroundValueLeftLung;
175 MaskImagePixelType m_ForegroundValueRightLung;
177 MaskImagePixelType m_BackgroundValue;
178 MaskImagePixelType m_ForegroundValue;
180 typename MaskImageType::Pointer output;
182 double m_IntermediateSpacing;
183 double m_FuzzyThreshold1;
184 double m_FuzzyThreshold2;
185 double m_FuzzyThreshold3;
186 double m_DistanceMaxToAnteriorPartOfTheSpine;
188 double m_UpperThreshold;
189 double m_LowerThreshold;
191 std::string m_OutputMediastinumFilename;
194 ExtractMediastinumFilter(const Self&); //purposely not implemented
195 void operator=(const Self&); //purposely not implemented
198 //--------------------------------------------------------------------
200 } // end namespace clitk
201 //--------------------------------------------------------------------
203 #ifndef ITK_MANUAL_INSTANTIATION
204 #include "clitkExtractMediastinumFilter.txx"