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 CLITKEXTRACTAIRWAYTREEINFOSFILTER_H
20 #define CLITKEXTRACTAIRWAYTREEINFOSFILTER_H
23 #include "clitkFilterBase.h"
24 #include "clitkDecomposeAndReconstructImageFilter.h"
25 #include "clitkExplosionControlledThresholdConnectedImageFilter.h"
26 #include "clitkSegmentationUtils.h"
27 #include "clitkFilterWithAnatomicalFeatureDatabaseManagement.h"
31 #include "itkStatisticsImageFilter.h"
35 //--------------------------------------------------------------------
37 From a trachea binary image, compute the skeleton and track the
38 path to find the carena.
40 //--------------------------------------------------------------------
47 typedef itk::Index<3> IndexType;
48 typedef itk::Point<double, 3> PointType;
49 typedef double PixelType;
50 Bifurcation(IndexType _index, PixelType _l, PixelType _l1, PixelType _l2) {
61 typedef itk::Index<3> NodeType;
62 typedef tree<NodeType> TreeType;
63 typedef TreeType::iterator TreeIterator;
64 TreeIterator treeIter;
66 //--------------------------------------------------------------------
69 //--------------------------------------------------------------------
70 template <class TImageType>
71 class ITK_EXPORT ExtractAirwaysTreeInfoFilter:
72 public virtual clitk::FilterBase,
73 public clitk::FilterWithAnatomicalFeatureDatabaseManagement,
74 public itk::ImageToImageFilter<TImageType, TImageType>
78 /** Standard class typedefs. */
79 typedef itk::ImageToImageFilter<TImageType, TImageType> Superclass;
80 typedef ExtractAirwaysTreeInfoFilter Self;
81 typedef itk::SmartPointer<Self> Pointer;
82 typedef itk::SmartPointer<const Self> ConstPointer;
84 /** Method for creation through the object factory. */
87 /** Run-time type information (and related methods). */
88 itkTypeMacro(ExtractAirwaysTreeInfoFilter, ImageToImageFilter);
91 /** Some convenient typedefs */
92 typedef TImageType ImageType;
93 typedef typename ImageType::ConstPointer ImageConstPointer;
94 typedef typename ImageType::Pointer ImagePointer;
95 typedef typename ImageType::RegionType ImageRegionType;
96 typedef typename ImageType::PixelType ImagePixelType;
97 typedef typename ImageType::SizeType ImageSizeType;
98 typedef typename ImageType::IndexType ImageIndexType;
99 typedef typename ImageType::PointType ImagePointType;
101 typedef Bifurcation BifurcationType;
102 typedef ImageIndexType NodeType;
103 typedef tree<NodeType> TreeType;
104 typedef typename TreeType::iterator TreeIterator;
106 itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
107 typedef int InternalPixelType;
108 typedef itk::Image<InternalPixelType, ImageType::ImageDimension> InternalImageType;
109 typedef typename InternalImageType::Pointer InternalImagePointer;
110 typedef typename InternalImageType::IndexType InternalIndexType;
111 typedef LabelizeParameters<InternalPixelType> LabelParamType;
113 /** Connect inputs */
114 void SetInput(const ImageType * image);
116 // Set all options at a time
117 template<class ArgsInfoType>
118 void SetArgsInfo(ArgsInfoType arg);
120 // Background / Foreground
121 itkGetConstMacro(BackgroundValue, ImagePixelType);
122 itkGetConstMacro(ForegroundValue, ImagePixelType);
125 itkGetConstMacro(FirstTracheaPoint, ImagePointType);
126 itkGetConstMacro(CarinaPoint, ImagePointType);
129 ExtractAirwaysTreeInfoFilter();
130 virtual ~ExtractAirwaysTreeInfoFilter() {}
133 ImageConstPointer input;
134 ImagePointer skeleton;
135 ImagePointer working_input;
138 itkSetMacro(BackgroundValue, ImagePixelType);
139 itkSetMacro(ForegroundValue, ImagePixelType);
140 ImagePixelType m_BackgroundValue;
141 ImagePixelType m_ForegroundValue;
144 ImagePointType m_FirstTracheaPoint;
145 ImagePointType m_CarinaPoint;
147 virtual void GenerateOutputInformation();
148 virtual void GenerateData();
150 TreeType m_SkeletonTree;
151 void TrackFromThisIndex(std::vector<BifurcationType> & listOfBifurcations,
152 ImagePointer skeleton,
153 ImageIndexType index,
154 ImagePixelType label,
155 TreeIterator currentNode);
157 ExtractAirwaysTreeInfoFilter(const Self&); //purposely not implemented
158 void operator=(const Self&); //purposely not implemented
161 //--------------------------------------------------------------------
163 } // end namespace clitk
164 //--------------------------------------------------------------------
166 #ifndef ITK_MANUAL_INSTANTIATION
167 #include "clitkExtractAirwaysTreeInfoFilter.txx"