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 // Background / Foreground
95 itkSetMacro(BackgroundValuePatient, MaskImagePixelType);
96 itkGetConstMacro(BackgroundValuePatient, MaskImagePixelType);
98 itkSetMacro(BackgroundValueLung, MaskImagePixelType);
99 itkGetConstMacro(BackgroundValueLung, MaskImagePixelType);
101 itkSetMacro(BackgroundValueBones, MaskImagePixelType);
102 itkGetConstMacro(BackgroundValueBones, MaskImagePixelType);
104 itkGetConstMacro(BackgroundValue, MaskImagePixelType);
105 itkGetConstMacro(ForegroundValue, MaskImagePixelType);
107 itkSetMacro(ForegroundValueLeftLung, MaskImagePixelType);
108 itkGetConstMacro(ForegroundValueLeftLung, MaskImagePixelType);
110 itkSetMacro(ForegroundValueRightLung, MaskImagePixelType);
111 itkGetConstMacro(ForegroundValueRightLung, MaskImagePixelType);
113 itkSetMacro(BackgroundValueTrachea, MaskImagePixelType);
114 itkGetConstMacro(BackgroundValueTrachea, MaskImagePixelType);
116 itkSetMacro(IntermediateSpacing, double);
117 itkGetConstMacro(IntermediateSpacing, double);
119 itkSetMacro(FuzzyThreshold1, double);
120 itkGetConstMacro(FuzzyThreshold1, double);
122 itkSetMacro(FuzzyThreshold2, double);
123 itkGetConstMacro(FuzzyThreshold2, double);
125 itkSetMacro(FuzzyThreshold3, double);
126 itkGetConstMacro(FuzzyThreshold3, double);
128 itkBooleanMacro(UseBones);
129 itkSetMacro(UseBones, bool);
130 itkGetConstMacro(UseBones, bool);
132 itkSetMacro(UpperThreshold, double);
133 itkGetConstMacro(UpperThreshold, double);
135 itkSetMacro(LowerThreshold, double);
136 itkGetConstMacro(LowerThreshold, double);
139 ExtractMediastinumFilter();
140 virtual ~ExtractMediastinumFilter() {}
142 virtual void GenerateOutputInformation();
143 virtual void GenerateInputRequestedRegion();
144 virtual void GenerateData();
146 itkSetMacro(BackgroundValue, MaskImagePixelType);
147 itkSetMacro(ForegroundValue, MaskImagePixelType);
149 MaskImagePixelType m_BackgroundValuePatient;
150 MaskImagePixelType m_BackgroundValueLung;
151 MaskImagePixelType m_BackgroundValueBones;
152 MaskImagePixelType m_BackgroundValueTrachea;
153 MaskImagePixelType m_ForegroundValueLeftLung;
154 MaskImagePixelType m_ForegroundValueRightLung;
156 MaskImagePixelType m_BackgroundValue;
157 MaskImagePixelType m_ForegroundValue;
159 typename MaskImageType::Pointer output;
161 double m_IntermediateSpacing;
162 double m_FuzzyThreshold1;
163 double m_FuzzyThreshold2;
164 double m_FuzzyThreshold3;
166 double m_UpperThreshold;
167 double m_LowerThreshold;
169 std::string m_OutputMediastinumFilename;
172 ExtractMediastinumFilter(const Self&); //purposely not implemented
173 void operator=(const Self&); //purposely not implemented
176 //--------------------------------------------------------------------
178 } // end namespace clitk
179 //--------------------------------------------------------------------
181 #ifndef ITK_MANUAL_INSTANTIATION
182 #include "clitkExtractMediastinumFilter.txx"