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 CLITKEXTRACTLYMPHSTATIONSFILTER_H
20 #define CLITKEXTRACTLYMPHSTATIONSFILTER_H
23 #include "clitkFilterBase.h"
24 #include "clitkFilterWithAnatomicalFeatureDatabaseManagement.h"
28 //--------------------------------------------------------------------
30 Try to extract the some Mediastinal Vessels in a thorax CT.
31 Need a set of Anatomical Features (AFDB)
33 //--------------------------------------------------------------------
35 template <class TImageType>
36 class ITK_EXPORT ExtractMediastinalVesselsFilter:
37 public virtual clitk::FilterBase,
38 public clitk::FilterWithAnatomicalFeatureDatabaseManagement,
39 public itk::ImageToImageFilter<TImageType, itk::Image<uchar, 3> >
43 /** Standard class typedefs. */
44 typedef itk::ImageToImageFilter<TImageType, itk::Image<uchar, 3> > Superclass;
45 typedef ExtractMediastinalVesselsFilter 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(ExtractMediastinalVesselsFilter, ImageToImageFilter);
55 /** Some convenient typedefs. */
56 typedef TImageType ImageType;
57 typedef typename ImageType::ConstPointer ImageConstPointer;
58 typedef typename ImageType::Pointer ImagePointer;
59 typedef typename ImageType::RegionType ImageRegionType;
60 typedef typename ImageType::PixelType ImagePixelType;
61 typedef typename ImageType::SizeType ImageSizeType;
62 typedef typename ImageType::IndexType ImageIndexType;
63 typedef typename ImageType::PointType ImagePointType;
65 typedef uchar MaskImagePixelType;
66 typedef itk::Image<MaskImagePixelType, 3> MaskImageType;
67 typedef typename MaskImageType::Pointer MaskImagePointer;
68 typedef typename MaskImageType::RegionType MaskImageRegionType;
69 typedef typename MaskImageType::SizeType MaskImageSizeType;
70 typedef typename MaskImageType::IndexType MaskImageIndexType;
71 typedef typename MaskImageType::PointType MaskImagePointType;
73 typedef itk::Image<MaskImagePixelType, 2> MaskSliceType;
74 typedef typename MaskSliceType::Pointer MaskSlicePointer;
75 typedef typename MaskSliceType::PointType MaskSlicePointType;
77 typedef long LabelType;
78 /** ImageDimension constants */
79 itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
82 itkGetConstMacro(BackgroundValue, MaskImagePixelType);
83 itkSetMacro(BackgroundValue, MaskImagePixelType);
85 itkGetConstMacro(ForegroundValue, MaskImagePixelType);
86 itkSetMacro(ForegroundValue, MaskImagePixelType);
88 itkGetConstMacro(TemporaryForegroundValue, MaskImagePixelType);
89 itkSetMacro(TemporaryForegroundValue, MaskImagePixelType);
91 itkGetConstMacro(ThresholdHigh, ImagePixelType);
92 itkSetMacro(ThresholdHigh, ImagePixelType);
94 itkGetConstMacro(ThresholdLow, ImagePixelType);
95 itkSetMacro(ThresholdLow, ImagePixelType);
97 itkGetConstMacro(ErosionRadius, int);
98 itkSetMacro(ErosionRadius, int);
100 itkGetConstMacro(DilatationRadius, int);
101 itkSetMacro(DilatationRadius, int);
103 itkGetConstMacro(MaxDistancePostToCarina, double);
104 itkSetMacro(MaxDistancePostToCarina, double);
105 itkGetConstMacro(MaxDistanceAntToCarina, double);
106 itkSetMacro(MaxDistanceAntToCarina, double);
107 itkGetConstMacro(MaxDistanceLeftToCarina, double);
108 itkSetMacro(MaxDistanceLeftToCarina, double);
109 itkGetConstMacro(MaxDistanceRightToCarina, double);
110 itkSetMacro(MaxDistanceRightToCarina, double);
112 itkSetMacro(DebugFlag, bool);
113 itkGetConstMacro(DebugFlag, bool);
114 itkBooleanMacro(DebugFlag);
116 itkSetMacro(SoughtVesselSeedName, std::string);
117 itkGetConstMacro(SoughtVesselSeedName, std::string);
119 itkSetMacro(SoughtVesselName, std::string);
120 itkGetConstMacro(SoughtVesselName, std::string);
122 itkSetMacro(OutputFilename, std::string);
123 itkGetConstMacro(OutputFilename, std::string);
125 itkSetMacro(MaxNumberOfFoundBifurcation, int);
126 itkGetConstMacro(MaxNumberOfFoundBifurcation, int);
129 ExtractMediastinalVesselsFilter();
130 virtual ~ExtractMediastinalVesselsFilter() {}
132 virtual void GenerateOutputInformation();
133 virtual void GenerateInputRequestedRegion();
134 virtual void GenerateData();
137 ImagePointer m_Input;
138 MaskImagePointer m_Working_Support;
139 MaskImagePointer m_Mediastinum;
140 MaskImagePointer m_Mask;
141 MaskImagePixelType m_BackgroundValue;
142 MaskImagePixelType m_ForegroundValue;
143 MaskImagePixelType m_TemporaryForegroundValue;
144 ImagePixelType m_ThresholdHigh;
145 ImagePixelType m_ThresholdLow;
147 int m_DilatationRadius;
148 double m_MaxDistancePostToCarina;
149 double m_MaxDistanceAntToCarina;
150 double m_MaxDistanceLeftToCarina;
151 double m_MaxDistanceRightToCarina;
152 int m_MaxNumberOfFoundBifurcation;
154 std::vector<MaskSlicePointer> m_slice_recon;
155 std::vector<MaskSlicePointer> m_slice_recon2;
157 // Resulting structures
158 MaskImageType::Pointer m_SoughtVessel;
159 std::string m_SoughtVesselSeedName;
160 std::string m_SoughtVesselName;
161 std::string m_OutputFilename;
163 void CropInputImage();
164 void TrackBifurcationFromPoint(MaskImagePointer & recon,
165 std::vector<MaskSlicePointer> & slices_recon,
166 MaskImagePointType BCA_p,
168 std::vector<MaskImagePointType> & bif);
171 ExtractMediastinalVesselsFilter(const Self&); //purposely not implemented
172 void operator=(const Self&); //purposely not implemented
175 //--------------------------------------------------------------------
177 } // end namespace clitk
178 //--------------------------------------------------------------------
180 #ifndef ITK_MANUAL_INSTANTIATION
181 #include "clitkExtractMediastinalVesselsFilter.txx"