]> Creatis software - FrontAlgorithms.git/blob - appli/CTBronchi/Process.h
d9b939b2c0da79b8902da8256f6619ab29a27019
[FrontAlgorithms.git] / appli / CTBronchi / Process.h
1 // =========================================================================
2 // @author Leonardo Florez Valencia (florez-l@javeriana.edu.co)
3 // =========================================================================
4 #ifndef __CTBronchi__Process__h__
5 #define __CTBronchi__Process__h__
6
7 #include <map>
8 #include <tuple>
9 #include <fpa_ctbronchi_export.h>
10 #include "Image.h"
11 #include "Skeleton.h"
12
13 namespace CTBronchi
14 {
15   class FPA_CTBRONCHI_EXPORT Process
16   {
17   public:
18     // Some types and values
19     static const unsigned int Dim = 3;
20     typedef short         TPixel;
21     typedef unsigned char TLabel;
22     typedef float         TScalar;
23     typedef std::string   TString;
24
25     // Arguments
26     typedef std::tuple< TString, TString, bool > TStrArg;
27     typedef std::tuple< TScalar, TString, bool > TDblArg;
28     typedef std::map< TString, TStrArg >         TStrArgs;
29     typedef std::map< TString, TDblArg >         TDblArgs;
30
31     // Images
32     typedef CTBronchi::Image< TPixel, Dim >  TPixelImage;
33     typedef CTBronchi::Image< TLabel, Dim >  TLabelImage;
34     typedef CTBronchi::Image< TScalar, Dim > TScalarImage;
35
36     // Skeleton
37     typedef CTBronchi::Skeleton< Dim > TSkeleton;
38
39     // Seed
40     typedef TPixelImage::TImage::PointType TPoint;
41     typedef TPixelImage::TImage::IndexType TIndex;
42     typedef std::pair< TIndex, TPoint >    TSeed;
43
44   public:
45     Process( );
46     virtual ~Process( );
47
48     void ParseArguments( int argc, char* argv[] );
49     void Update( );
50
51   protected:
52     template< class _TImage >
53     void _Input( _TImage& input );
54
55     template< class _TInput, class _TVesselness >
56     void _Vesselness( _TInput& input, _TVesselness& vesselness );
57
58     template< class _TInput, class _TMori, class _TSeed >
59     void _Mori( _TInput& input, _TMori& mori, _TSeed& seed );
60
61     template< class _TInput, class _TMori, class _TVesselness, class _TLabels >
62     void _MoriLabelling(
63       _TInput& input, _TMori& mori, _TVesselness& vesselness, _TLabels& labels
64       );
65
66     template< class _TInput, class _TLabels, class _TFastRW >
67     void _FastRW( _TInput& input, _TLabels& labels, _TFastRW& fastrw );
68
69     template< class _TInput, class _TLabels, class _TVesselness, class _TSliceRW >
70     void _SliceRW(
71       _TInput& input, _TLabels& labels, _TVesselness& vesselness, _TSliceRW& slicerw
72       );
73
74     template< class _TInput >
75     void _AndImages( _TInput& a, _TInput& b, _TInput& c );
76
77     template< class _TInput, class _TSkeleton >
78     void _Skeleton( _TInput& a, _TSkeleton& s, const TString& fname );
79
80   protected:
81     TStrArgs m_StrArgs;
82     TDblArgs m_DblArgs;
83
84     TSeed  m_Seed;
85     TLabel m_UndefinedLabel;
86     TLabel m_InsideLabel;
87     TLabel m_OutsideLabel;
88
89     TPixelImage  m_Input;
90     TScalarImage m_Vesselness;
91     TLabelImage  m_Mori;
92     TLabelImage  m_Labels;
93     TLabelImage  m_FastRW;
94     TLabelImage  m_SliceRW;
95     TLabelImage  m_AndRW;
96
97     TSkeleton m_FastRWSkeleton;
98     TSkeleton m_SliceRWSkeleton;
99     TSkeleton m_AndRWSkeleton;
100   };
101
102 } // ecapseman
103
104 #endif // __CTBronchi__Process__h__
105
106 // eof - $RCSfile$