]> Creatis software - FrontAlgorithms.git/blob - appli/CTArteries/CTArteries.h
0fd1b45c32ebfbe1da6e13a4c14062b8e2da4ccc
[FrontAlgorithms.git] / appli / CTArteries / CTArteries.h
1 // =========================================================================
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // =========================================================================
4 #ifndef __CTArteries__h__
5 #define __CTArteries__h__
6
7 #include <itkImage.h>
8 #include <itkImageToVTKImageFilter.h>
9
10 #include <vtkSmartPointer.h>
11
12 #include <QMainWindow>
13
14 #include <ivq/ITK/Simple3DCurve.h>
15
16 #include <ivq/ITK/ImagePath.h>
17
18 #include "FourierSeries.h"
19
20 class vtkPolyData;
21 class vtkSplineWidget;
22 class QDialog;
23 class QCPItemLine;
24 class QCPItemText;
25 namespace Ui
26 {
27   class CTArteries;
28   class Parameters;
29 }
30 namespace ivq
31 {
32   namespace VTK
33   {
34     class PolyDataActor;
35     class SeedWidgetOverImageActor;
36   }
37 }
38
39 /**
40  */
41 class CTArteries
42   : public QMainWindow
43 {
44   Q_OBJECT;
45 public:
46   typedef CTArteries  Self;
47   typedef QMainWindow Superclass;
48
49   enum Constants
50   {
51     Dim = 3
52   };
53   typedef short                      TPixel;
54   typedef double                     TScalar;
55   typedef itk::Image< TPixel, Dim >  TImage;
56   typedef itk::Image< TScalar, Dim > TScalarImage;
57
58   typedef itk::ImageToVTKImageFilter< TImage >       TVTKImage;
59   typedef itk::ImageToVTKImageFilter< TScalarImage > TVTKScalarImage;
60   typedef ivq::ITK::ImagePath< Dim >                 TAxis;
61   typedef ivq::ITK::Simple3DCurve< TScalar >         TCurve;
62   typedef FourierSeries< TScalar, 2 >                TFourier;
63
64 public:
65   explicit CTArteries(
66     int argc, char* argv[],
67     QWidget* parent = NULL
68     );
69   virtual ~CTArteries( );
70
71 protected:
72   template< class _TStrings >
73   void _openImage( const _TStrings& fnames );
74   void _openDicom( const std::string& dirname );
75   void _showInputImage( );
76
77   void _process( const std::vector< TImage::PointType >& seeds );
78   void _prepareQuantification( );
79   void _showProcessResults( );
80   void _showStenosis( );
81
82   void _ExecuteLog( const std::string& fname );
83
84 protected slots:
85   void _sOpen( );
86   void _sConfig( );
87   void _sProcess( );
88   void _sMarkReference( );
89   void _sMarkStenosis( );
90   void _sSaveResults( );
91   void _sUpdateContour( );
92
93 private:
94   template< class _TImagePtr, class _TVTKImagePtr, class _TCurvePtr >
95   void _CPR(
96     _TImagePtr& output, _TVTKImagePtr& vtk_output,
97     const _TImagePtr& input, const _TCurvePtr& curve
98     );
99
100 private:
101   Ui::CTArteries* m_UI;
102
103   // Dialog
104   QDialog*        m_DlgParameters;
105   Ui::Parameters* m_UIParameters;
106
107   // Input data
108   TImage::Pointer    m_Image;
109   TVTKImage::Pointer m_VTKImage;
110
111   // Output information
112   TScalarImage::Pointer    m_Segmentation;
113   TVTKScalarImage::Pointer m_VTKSegmentation;
114   TAxis::Pointer           m_Axis;
115   TCurve::Pointer          m_Curve;
116   vtkSmartPointer< ivq::VTK::PolyDataActor > m_Surface;
117
118   // CPRs
119   TImage::Pointer m_CPRImage;
120   TScalarImage::Pointer m_CPRSegmentation;
121   TVTKImage::Pointer m_VTKCPRImage;
122   TVTKScalarImage::Pointer m_VTKCPRSegmentation;
123
124   // Quantification data
125   std::vector< vtkSmartPointer< vtkPolyData > > m_Contours;
126   std::vector< vtkSmartPointer< ivq::VTK::PolyDataActor > > m_ContoursActors;
127   ivq::VTK::PolyDataActor* m_ContourActor;
128   std::vector< TFourier > m_Fourier;
129
130   // Widgets
131   vtkSmartPointer< ivq::VTK::SeedWidgetOverImageActor > m_Seeds;
132   vtkSmartPointer< vtkSplineWidget > m_Spline;
133
134   // References
135   int m_StenosisSlice;
136   int m_ReferenceSlice;
137   QCPItemLine* m_StenosisLine;
138   QCPItemLine* m_ReferenceLine;
139   QCPItemText* m_StenosisText;
140
141   friend class ContourCallback;
142 };
143
144 #endif // __CTArteries__h__
145
146 // eof - $RCSfile$