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