]> Creatis software - clitk.git/blob - segmentation/clitkExtractMediastinalVesselsFilter.h
Extract vessels v0.1
[clitk.git] / segmentation / clitkExtractMediastinalVesselsFilter.h
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to: 
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
8
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.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17   ======================================================================-====*/
18
19 #ifndef CLITKEXTRACTLYMPHSTATIONSFILTER_H
20 #define CLITKEXTRACTLYMPHSTATIONSFILTER_H
21
22 // clitk
23 #include "clitkFilterBase.h"
24 #include "clitkFilterWithAnatomicalFeatureDatabaseManagement.h"
25
26 namespace clitk {
27   
28   //--------------------------------------------------------------------
29   /*
30     Try to extract the some Mediastinal Vessels in a thorax CT.
31     Need a set of Anatomical Features (AFDB)
32   */
33   //--------------------------------------------------------------------
34   
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> >
40   {
41
42   public:
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;
48     
49     /** Method for creation through the object factory. */
50     itkNewMacro(Self);
51     
52     /** Run-time type information (and related methods). */
53     itkTypeMacro(ExtractMediastinalVesselsFilter, ImageToImageFilter);
54
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; 
64         
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; 
72
73     typedef itk::Image<MaskImagePixelType, 2>    MaskSliceType;
74     typedef typename MaskSliceType::Pointer      MaskSlicePointer;
75     typedef typename MaskSliceType::PointType    MaskSlicePointType;
76
77     typedef long LabelType;
78     /** ImageDimension constants */
79     itkStaticConstMacro(ImageDimension, unsigned int, ImageType::ImageDimension);
80     FILTERBASE_INIT;
81    
82     itkGetConstMacro(BackgroundValue, MaskImagePixelType);
83     itkSetMacro(BackgroundValue, MaskImagePixelType);
84
85     itkGetConstMacro(ForegroundValue, MaskImagePixelType);
86     itkSetMacro(ForegroundValue, MaskImagePixelType);
87
88     itkGetConstMacro(TemporaryForegroundValue, MaskImagePixelType);
89     itkSetMacro(TemporaryForegroundValue, MaskImagePixelType);
90
91     itkGetConstMacro(OutputFolder, std::string);
92     itkSetMacro(OutputFolder, std::string);
93
94     itkGetConstMacro(Threshold, ImagePixelType);
95     itkSetMacro(Threshold, ImagePixelType);
96
97   protected:
98     ExtractMediastinalVesselsFilter();
99     virtual ~ExtractMediastinalVesselsFilter() {}
100     
101     virtual void GenerateOutputInformation();
102     virtual void GenerateInputRequestedRegion();
103     virtual void GenerateData();
104     
105     std::string        m_OutputFolder;
106     ImagePointer       m_Input;
107     MaskImagePointer   m_Working_Support;
108     MaskImagePointer   m_Mediastinum;
109     MaskImagePointer   m_Mask;
110     MaskImagePixelType m_BackgroundValue;
111     MaskImagePixelType m_ForegroundValue;
112     MaskImagePixelType m_TemporaryForegroundValue;
113     ImagePixelType     m_Threshold;
114
115     std::vector<MaskSlicePointer> m_slice_recon;
116     
117     void CropSupInf();
118     //void SearchBrachioCephalicArtery(int & BCA_first_slice, LabelType & BCA_first_label);
119     void TrackBifurcationFromPoint(MaskImagePointer & recon, 
120                                    std::vector<MaskSlicePointer> & slices_recon, 
121                                    MaskImagePointType BCA_p, 
122                                    LabelType newLabel, 
123                                    std::vector<MaskImagePointType> & bif);
124
125   private:
126     ExtractMediastinalVesselsFilter(const Self&); //purposely not implemented
127     void operator=(const Self&); //purposely not implemented
128     
129   }; // end class
130   //--------------------------------------------------------------------
131
132 } // end namespace clitk
133 //--------------------------------------------------------------------
134
135 #ifndef ITK_MANUAL_INSTANTIATION
136 #include "clitkExtractMediastinalVesselsFilter.txx"
137 #endif
138
139 #endif