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://www.centreleonberard.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 "clitkStructuresExtractionFilter.h"
26 //--------------------------------------------------------------------
28 Try to extract the mediastinum part of a thorax CT.
36 //--------------------------------------------------------------------
38 template <class TImageType>
39 class ITK_EXPORT ExtractMediastinumFilter:
40 public clitk::StructuresExtractionFilter<TImageType>
44 /** Some convenient typedefs. */
45 typedef TImageType ImageType;
46 typedef typename ImageType::ConstPointer ImageConstPointer;
47 typedef typename ImageType::Pointer ImagePointer;
48 typedef typename ImageType::RegionType ImageRegionType;
49 typedef typename ImageType::PixelType ImagePixelType;
50 typedef typename ImageType::SizeType ImageSizeType;
51 typedef typename ImageType::IndexType ImageIndexType;
52 typedef typename ImageType::PointType ImagePointType;
54 /** Some convenient typedefs. */
55 typedef uchar MaskImagePixelType;
56 typedef itk::Image<MaskImagePixelType, 3> MaskImageType;
57 typedef typename MaskImageType::ConstPointer MaskImageConstPointer;
58 typedef typename MaskImageType::Pointer MaskImagePointer;
59 typedef typename MaskImageType::RegionType MaskImageRegionType;
60 typedef typename MaskImageType::SizeType MaskImageSizeType;
61 typedef typename MaskImageType::IndexType MaskImageIndexType;
62 typedef typename MaskImageType::PointType MaskImagePointType;
64 typedef itk::Image<MaskImagePixelType, 2> MaskSliceType;
65 typedef typename MaskSliceType::Pointer MaskSlicePointer;
66 typedef typename MaskSliceType::PointType MaskSlicePointType;
68 /** Standard class typedefs. */
69 // typedef itk::ImageToImageFilter<TImageType, MaskImageType> Superclass;
70 typedef clitk::StructuresExtractionFilter<TImageType> Superclass;
71 typedef ExtractMediastinumFilter Self;
72 typedef itk::SmartPointer<Self> Pointer;
73 typedef itk::SmartPointer<const Self> ConstPointer;
75 /** Method for creation through the object factory. */
78 /** Run-time type information (and related methods). */
79 itkTypeMacro(ExtractMediastinumFilter, InPlaceImageFilter);
83 void SetInput(const ImageType * image);
84 void SetInputPatientLabelImage(const MaskImageType * image, MaskImagePixelType bg=0);
85 void SetInputLungLabelImage(const MaskImageType * image, MaskImagePixelType bg=0,
86 MaskImagePixelType fgLeftLung=1, MaskImagePixelType fgRightLung=2);
87 void SetInputBonesLabelImage(const MaskImageType * image, MaskImagePixelType bg=0);
88 void SetInputTracheaLabelImage(const MaskImageType * image, MaskImagePixelType bg=0);
90 // Output filename (for AFBD)
91 itkSetMacro(OutputMediastinumFilename, std::string);
92 itkGetConstMacro(OutputMediastinumFilename, std::string);
94 /** ImageDimension constants */
95 itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
97 // Background / Foreground
98 itkSetMacro(BackgroundValuePatient, MaskImagePixelType);
99 itkGetConstMacro(BackgroundValuePatient, MaskImagePixelType);
101 itkSetMacro(BackgroundValueLung, MaskImagePixelType);
102 itkGetConstMacro(BackgroundValueLung, MaskImagePixelType);
104 itkSetMacro(BackgroundValueBones, MaskImagePixelType);
105 itkGetConstMacro(BackgroundValueBones, 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 itkBooleanMacro(UseBones);
120 itkSetMacro(UseBones, bool);
121 itkGetConstMacro(UseBones, bool);
123 itkSetMacro(DistanceMaxToAnteriorPartOfTheVertebralBody, double);
124 itkGetConstMacro(DistanceMaxToAnteriorPartOfTheVertebralBody, double);
126 void SetFuzzyThreshold(std::string tag, double value);
127 double GetFuzzyThreshold(std::string tag);
130 ExtractMediastinumFilter();
131 virtual ~ExtractMediastinumFilter() {}
133 virtual void GenerateOutputInformation();
134 virtual void GenerateInputRequestedRegion();
135 virtual void GenerateData();
137 MaskImagePixelType m_BackgroundValuePatient;
138 MaskImagePixelType m_BackgroundValueLung;
139 MaskImagePixelType m_BackgroundValueBones;
140 MaskImagePixelType m_BackgroundValueTrachea;
141 MaskImagePixelType m_ForegroundValueLeftLung;
142 MaskImagePixelType m_ForegroundValueRightLung;
144 MaskImagePointer output;
145 MaskImagePointer patient;
146 MaskImagePointer lung;
147 MaskImagePointer bones;
148 MaskImagePointer trachea;
150 std::map<std::string, double> m_FuzzyThreshold;
151 double m_IntermediateSpacing;
153 double m_DistanceMaxToAnteriorPartOfTheVertebralBody;
155 void RemovePostPartOfVertebralBody();
157 std::string m_OutputMediastinumFilename;
160 ExtractMediastinumFilter(const Self&); //purposely not implemented
161 void operator=(const Self&); //purposely not implemented
164 //--------------------------------------------------------------------
166 } // end namespace clitk
167 //--------------------------------------------------------------------
169 #ifndef ITK_MANUAL_INSTANTIATION
170 #include "clitkExtractMediastinumFilter.txx"