]> Creatis software - FrontAlgorithms.git/blob - appli/CTArteries/CTArteries.h
487591727991386fc80719f847da06803db7f93f
[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 <fpa/DataStructures/Image/Path.h>
17
18 #include "FourierSeries.h"
19
20 class vtkPolyData;
21 class vtkSplineWidget;
22 class QDialog;
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 fpa::DataStructures::Image::Path< Dim >    TAxis;
59   typedef ivq::ITK::Simple3DCurve< TScalar >         TCurve;
60   typedef 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( );
76   void _prepareQuantification( );
77   void _showProcessResults( );
78
79 protected slots:
80   void _sOpen( );
81   void _sConfig( );
82   void _sProcess( );
83
84 private:
85   template< class _TImagePtr, class _TVTKImagePtr, class _TCurvePtr >
86   void _CPR(
87     _TImagePtr& output, _TVTKImagePtr& vtk_output,
88     const _TImagePtr& input, const _TCurvePtr& curve
89     );
90
91 private:
92   Ui::CTArteries* m_UI;
93
94   // Dialog
95   QDialog*        m_DlgParameters;
96   Ui::Parameters* m_UIParameters;
97
98   // Input data
99   TImage::Pointer    m_Image;
100   TVTKImage::Pointer m_VTKImage;
101
102   // Output information
103   TScalarImage::Pointer    m_Segmentation;
104   TVTKScalarImage::Pointer m_VTKSegmentation;
105   TAxis::Pointer           m_Axis;
106   TCurve::Pointer          m_Curve;
107   vtkSmartPointer< ivq::VTK::PolyDataActor > m_Surface;
108
109   // CPRs
110   TImage::Pointer m_CPRImage;
111   TScalarImage::Pointer m_CPRSegmentation;
112   TVTKImage::Pointer m_VTKCPRImage;
113   TVTKScalarImage::Pointer m_VTKCPRSegmentation;
114
115   // Quantification data
116   std::vector< vtkSmartPointer< vtkPolyData > > m_Contours;
117   std::vector< vtkSmartPointer< ivq::VTK::PolyDataActor > > m_ContoursActors;
118   ivq::VTK::PolyDataActor* m_ContourActor;
119   std::vector< TFourier > m_Fourier;
120
121   // Widgets
122   vtkSmartPointer< ivq::VTK::SeedWidgetOverImageActor > m_Seeds;
123   vtkSmartPointer< vtkSplineWidget > m_Spline;
124
125   friend class ContourCallback;
126 };
127
128 #endif // __CTArteries__h__
129
130 // eof - $RCSfile$