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"
26 //--------------------------------------------------------------------
28 Try to extract the mediastinum part of a thorax CT.
35 //--------------------------------------------------------------------
37 template <class TImageType>
38 class ITK_EXPORT ExtractMediastinumFilter:
39 public clitk::FilterBase,
40 public itk::ImageToImageFilter<TImageType, TImageType>
44 /** Standard class typedefs. */
45 typedef itk::ImageToImageFilter<TImageType, TImageType> Superclass;
46 typedef ExtractMediastinumFilter Self;
47 typedef itk::SmartPointer<Self> Pointer;
48 typedef itk::SmartPointer<const Self> ConstPointer;
50 /** Method for creation through the object factory. */
53 /** Run-time type information (and related methods). */
54 itkTypeMacro(ExtractMediastinumFilter, InPlaceImageFilter);
57 /** Some convenient typedefs. */
58 typedef TImageType ImageType;
59 typedef typename ImageType::ConstPointer ImageConstPointer;
60 typedef typename ImageType::Pointer ImagePointer;
61 typedef typename ImageType::RegionType ImageRegionType;
62 typedef typename ImageType::PixelType ImagePixelType;
63 typedef typename ImageType::SizeType ImageSizeType;
64 typedef typename ImageType::IndexType ImageIndexType;
65 typedef typename ImageType::PointType ImagePointType;
68 void SetInputPatientLabelImage(const TImageType * image, ImagePixelType bg=0);
69 void SetInputLungLabelImage(const TImageType * image, ImagePixelType bg=0,
70 ImagePixelType fgLeftLung=1, ImagePixelType fgRightLung=2);
71 void SetInputBonesLabelImage(const TImageType * image, ImagePixelType bg=0);
72 void SetInputTracheaLabelImage(const TImageType * image, ImagePixelType bg=0);
74 /** ImageDimension constants */
75 itkStaticConstMacro(ImageDimension, unsigned int, TImageType::ImageDimension);
77 // Set all options at a time
78 template<class ArgsInfoType>
79 void SetArgsInfo(ArgsInfoType arg);
81 // Background / Foreground
82 itkSetMacro(BackgroundValuePatient, ImagePixelType);
83 itkGetConstMacro(BackgroundValuePatient, ImagePixelType);
84 GGO_DefineOption(patientBG, SetBackgroundValuePatient, ImagePixelType);
86 itkSetMacro(BackgroundValueLung, ImagePixelType);
87 itkGetConstMacro(BackgroundValueLung, ImagePixelType);
88 GGO_DefineOption(lungBG, SetBackgroundValueLung, ImagePixelType);
90 itkSetMacro(BackgroundValueBones, ImagePixelType);
91 itkGetConstMacro(BackgroundValueBones, ImagePixelType);
92 GGO_DefineOption(bonesBG, SetBackgroundValueBones, ImagePixelType);
94 itkGetConstMacro(BackgroundValue, ImagePixelType);
95 itkGetConstMacro(ForegroundValue, ImagePixelType);
97 itkSetMacro(ForegroundValueLeftLung, ImagePixelType);
98 itkGetConstMacro(ForegroundValueLeftLung, ImagePixelType);
99 GGO_DefineOption(lungLeft, SetForegroundValueLeftLung, ImagePixelType);
101 itkSetMacro(ForegroundValueRightLung, ImagePixelType);
102 itkGetConstMacro(ForegroundValueRightLung, ImagePixelType);
103 GGO_DefineOption(lungRight, SetForegroundValueRightLung, ImagePixelType);
105 itkSetMacro(BackgroundValueTrachea, ImagePixelType);
106 itkGetConstMacro(BackgroundValueTrachea, ImagePixelType);
107 GGO_DefineOption(lungBG, SetBackgroundValueTrachea, ImagePixelType);
109 itkSetMacro(IntermediateSpacing, double);
110 itkGetConstMacro(IntermediateSpacing, double);
111 GGO_DefineOption(spacing, SetIntermediateSpacing, double);
113 itkSetMacro(FuzzyThreshold1, double);
114 itkGetConstMacro(FuzzyThreshold1, double);
115 GGO_DefineOption(fuzzy1, SetFuzzyThreshold1, double);
117 itkSetMacro(FuzzyThreshold2, double);
118 itkGetConstMacro(FuzzyThreshold2, double);
119 GGO_DefineOption(fuzzy2, SetFuzzyThreshold2, double);
121 itkSetMacro(FuzzyThreshold3, double);
122 itkGetConstMacro(FuzzyThreshold3, double);
123 GGO_DefineOption(fuzzy3, SetFuzzyThreshold3, double);
126 ExtractMediastinumFilter();
127 virtual ~ExtractMediastinumFilter() {}
129 virtual void GenerateOutputInformation();
130 virtual void GenerateInputRequestedRegion();
131 virtual void GenerateData();
133 itkSetMacro(BackgroundValue, ImagePixelType);
134 itkSetMacro(ForegroundValue, ImagePixelType);
136 ImagePixelType m_BackgroundValuePatient;
137 ImagePixelType m_BackgroundValueLung;
138 ImagePixelType m_BackgroundValueBones;
139 ImagePixelType m_BackgroundValueTrachea;
140 ImagePixelType m_ForegroundValueLeftLung;
141 ImagePixelType m_ForegroundValueRightLung;
143 ImagePixelType m_BackgroundValue;
144 ImagePixelType m_ForegroundValue;
146 double m_IntermediateSpacing;
147 double m_FuzzyThreshold1;
148 double m_FuzzyThreshold2;
149 double m_FuzzyThreshold3;
152 ExtractMediastinumFilter(const Self&); //purposely not implemented
153 void operator=(const Self&); //purposely not implemented
156 //--------------------------------------------------------------------
158 } // end namespace clitk
159 //--------------------------------------------------------------------
161 #ifndef ITK_MANUAL_INSTANTIATION
162 #include "clitkExtractMediastinumFilter.txx"