uLib-0.2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
vtkVoxRaytracerRepresentation.h
Go to the documentation of this file.
1 /*//////////////////////////////////////////////////////////////////////////////
2 // CMT Cosmic Muon Tomography project //////////////////////////////////////////
4 
5  Copyright (c) 2014, Universita' degli Studi di Padova, INFN sez. di Padova
6  All rights reserved
7 
8  Authors: Andrea Rigoni Garola < andrea.rigoni@pd.infn.it >
9 
10  ------------------------------------------------------------------
11  This library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU Lesser General Public
13  License as published by the Free Software Foundation; either
14  version 3.0 of the License, or (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  Lesser General Public License for more details.
20 
21  You should have received a copy of the GNU Lesser General Public
22  License along with this library.
23 
25 
26 
27 
28 #ifndef U_VTKVOXRAYTRACERREPRESENTATION_H
29 #define U_VTKVOXRAYTRACERREPRESENTATION_H
30 
31 #include <vtkLine.h>
32 #include <vtkCellArray.h>
33 
34 #include <vtkLineSource.h>
35 #include <vtkSphereSource.h>
36 #include <vtkBoundingBox.h>
37 #include <vtkCubeSource.h>
38 #include <vtkSmartPointer.h>
39 #include <vtkPolyDataMapper.h>
40 #include <vtkAppendPolyData.h>
41 #include <vtkActor.h>
42 #include <vtkAssembly.h>
43 #include <vtkProp3DCollection.h>
44 #include <vtkProperty.h>
45 #include <vtkPolyData.h>
46 #include <vtkTransform.h>
47 #include <vtkTransformPolyDataFilter.h>
48 
49 #include "Math/Dense.h"
50 
51 #include "uLibVtkInterface.h"
52 
53 #include "Detectors/MuonScatter.h"
54 
55 #include "Math/StructuredGrid.h"
56 #include "Math/VoxRaytracer.h"
57 
58 
59 class vtkActor;
60 
61 namespace uLib {
62 namespace Vtk {
63 
64 class vtkVoxRaytracerRepresentation : public Puppet {
65  typedef VoxRaytracer Content;
66 public:
67  vtkVoxRaytracerRepresentation(Content &content);
68  ~vtkVoxRaytracerRepresentation();
69 
70  uLib::VoxRaytracer *GetRaytracerAlgorithm();
71 
72  vtkProp *GetProp();
73 
74  vtkPolyData *GetPolyData() const;
75 
76  enum RepresentationElements {
77  RayElements,
78  VoxelsElements
79  };
80  void SetRepresentationElements(enum RepresentationElements el);
81 
82  void SetMuon(MuonScatter &muon);
83 
84  void SetMuon(MuonScatter &muon, HPoint3f poca);
85 
86  void SetMuon(class vtkMuonEvent &muon);
87 
88  void SetMuon(class vtkMuonScatter &muon);
89 
90  VoxRaytracer::RayData GetRay();
91 
92  void SetRay(HPoint3f in, HPoint3f out);
93 
94  void SetRay(HPoint3f in, HPoint3f mid, HPoint3f out);
95 
96  void SetRay(VoxRaytracer::RayData *ray);
97 
98  void SetVoxelsColor(Vector4f rgba);
99  void SetRayColor(Vector4f rgba);
100 
101 
102 
103 private:
104  void InstallPipe();
105 
106  void SetColor(vtkActor *actor, Vector4f rgba);
107 
108  VoxRaytracer *m_Content;
109 
110  Scalarf default_radius;
111  vtkAssembly *m_Assembly;
112  vtkAppendPolyData *m_RayLine;
113  vtkActor *m_RayLineActor;
114  vtkActor *m_RayRepresentationActor;
115  vtkSmartPointer<vtkTransform> m_Transform;
116  VoxRaytracer::RayData m_Ray;
117  vtkSmartPointer<vtkSphereSource> m_Sphere1;
118  vtkSmartPointer<vtkSphereSource> m_Sphere2;
119  vtkSmartPointer<vtkLineSource> m_Line1;
120  vtkSmartPointer<vtkLineSource> m_Line2;
121  vtkSmartPointer<vtkLineSource> m_Line3;
122  vtkSmartPointer<vtkAppendPolyData> m_RayRepresentation;
123 
124  vtkAppendPolyData *m_SelectedElement;
125 };
126 
127 
128 } // vtk
129 } // uLib
130 
131 
132 #endif // VTKVOXRAYTRACERREPRESENTATION_H