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.
34 //--------------------------------------------------------------------
36 template <class TImageType>
37 class ITK_EXPORT ExtractMediastinumFilter:
38 public clitk::FilterBase,
39 public itk::ImageToImageFilter<TImageType, TImageType>
43 /** Standard class typedefs. */
44 typedef itk::ImageToImageFilter<TImageType, TImageType> Superclass;
45 typedef ExtractMediastinumFilter Self;
46 typedef itk::SmartPointer<Self> Pointer;
47 typedef itk::SmartPointer<const Self> ConstPointer;
49 /** Method for creation through the object factory. */
52 /** Run-time type information (and related methods). */
53 itkTypeMacro(ExtractMediastinumFilter, InPlaceImageFilter);
56 /** Some convenient typedefs. */
57 typedef TImageType ImageType;
58 typedef typename ImageType::ConstPointer ImageConstPointer;
59 typedef typename ImageType::Pointer ImagePointer;
60 typedef typename ImageType::RegionType ImageRegionType;
61 typedef typename ImageType::PixelType ImagePixelType;
62 typedef typename ImageType::SizeType ImageSizeType;
63 typedef typename ImageType::IndexType ImageIndexType;
66 void SetInputPatientLabelImage(const TImageType * image, ImagePixelType bg=0);
67 void SetInputLungLabelImage(const TImageType * image, ImagePixelType bg=0,
68 ImagePixelType fgLeftLung=1, ImagePixelType fgRightLung=2);
69 void SetInputBonesLabelImage(const TImageType * image, ImagePixelType bg=0);
71 /** ImageDimension constants */
72 itkStaticConstMacro(ImageDimension, unsigned int, TImageType::ImageDimension);
74 // Set all options at a time
75 template<class ArgsInfoType>
76 void SetArgsInfo(ArgsInfoType arg);
78 // Background / Foreground
79 itkSetMacro(BackgroundValuePatient, ImagePixelType);
80 itkGetConstMacro(BackgroundValuePatient, ImagePixelType);
81 GGO_DefineOption(patientBG, SetBackgroundValuePatient, ImagePixelType);
83 itkSetMacro(BackgroundValueLung, ImagePixelType);
84 itkGetConstMacro(BackgroundValueLung, ImagePixelType);
85 GGO_DefineOption(lungBG, SetBackgroundValueLung, ImagePixelType);
87 itkSetMacro(BackgroundValueBones, ImagePixelType);
88 itkGetConstMacro(BackgroundValueBones, ImagePixelType);
89 GGO_DefineOption(bonesBG, SetBackgroundValueBones, ImagePixelType);
91 itkGetConstMacro(BackgroundValue, ImagePixelType);
92 itkGetConstMacro(ForegroundValue, ImagePixelType);
94 itkSetMacro(ForegroundValueLeftLung, ImagePixelType);
95 itkGetConstMacro(ForegroundValueLeftLung, ImagePixelType);
96 GGO_DefineOption(lungLeft, SetForegroundValueLeftLung, ImagePixelType);
98 itkSetMacro(ForegroundValueRightLung, ImagePixelType);
99 itkGetConstMacro(ForegroundValueRightLung, ImagePixelType);
100 GGO_DefineOption(lungRight, SetForegroundValueRightLung, ImagePixelType);
102 itkSetMacro(IntermediateSpacing, double);
103 itkGetConstMacro(IntermediateSpacing, double);
104 GGO_DefineOption(spacing, SetIntermediateSpacing, double);
106 itkSetMacro(FuzzyThreshold1, double);
107 itkGetConstMacro(FuzzyThreshold1, double);
108 GGO_DefineOption(fuzzy1, SetFuzzyThreshold1, double);
110 itkSetMacro(FuzzyThreshold2, double);
111 itkGetConstMacro(FuzzyThreshold2, double);
112 GGO_DefineOption(fuzzy2, SetFuzzyThreshold2, double);
115 ExtractMediastinumFilter();
116 virtual ~ExtractMediastinumFilter() {}
118 virtual void GenerateOutputInformation();
119 virtual void GenerateInputRequestedRegion();
120 virtual void GenerateData();
122 itkSetMacro(BackgroundValue, ImagePixelType);
123 itkSetMacro(ForegroundValue, ImagePixelType);
125 ImagePixelType m_BackgroundValuePatient;
126 ImagePixelType m_BackgroundValueLung;
127 ImagePixelType m_BackgroundValueBones;
128 ImagePixelType m_ForegroundValueLeftLung;
129 ImagePixelType m_ForegroundValueRightLung;
131 ImagePixelType m_BackgroundValue;
132 ImagePixelType m_ForegroundValue;
134 double m_IntermediateSpacing;
135 double m_FuzzyThreshold1;
136 double m_FuzzyThreshold2;
139 ExtractMediastinumFilter(const Self&); //purposely not implemented
140 void operator=(const Self&); //purposely not implemented
143 //--------------------------------------------------------------------
145 } // end namespace clitk
146 //--------------------------------------------------------------------
148 #ifndef ITK_MANUAL_INSTANTIATION
149 #include "clitkExtractMediastinumFilter.txx"