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