]> Creatis software - FrontAlgorithms.git/blob - appli/CTBronchi/Process.h
...
[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(
79       _TInput& a, _TSkeleton& s,
80       const TString& fname,
81       const TString& pname
82       );
83
84   protected:
85     TStrArgs m_StrArgs;
86     TDblArgs m_DblArgs;
87
88     TSeed  m_Seed;
89     TLabel m_UndefinedLabel;
90     TLabel m_InsideLabel;
91     TLabel m_OutsideLabel;
92
93     TPixelImage  m_Input;
94     TScalarImage m_Vesselness;
95     TLabelImage  m_Mori;
96     TLabelImage  m_Labels;
97     TLabelImage  m_FastRW;
98     TLabelImage  m_SliceRW;
99     TLabelImage  m_AndRW;
100
101     TSkeleton m_FastRWSkeleton;
102     TSkeleton m_SliceRWSkeleton;
103     TSkeleton m_AndRWSkeleton;
104   };
105
106 } // ecapseman
107
108 #endif // __CTBronchi__Process__h__
109
110 // eof - $RCSfile$