Computer Assisted Medical Intervention Tool Kit  version 5.2
Geometry.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2024 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, TIMC, 38000 Grenoble, France
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 #ifndef GEOMETRY_H
27 #define GEOMETRY_H
28 
29 // -- Core stuff
30 #include "CamiTKAPI.h"
31 #include "InterfaceGeometry.h"
32 
33 #include <QMap>
34 
35 //-- VTK Classes
36 class vtkPointSet;
37 class vtkAlgorithmOutput;
38 class vtkDataSetMapper;
39 class vtkActor;
40 class vtkProp;
41 class vtkTexture;
42 class vtkGlyph3D;
43 class vtkTransform;
44 class vtkTubeFilter;
45 class vtkCastToConcrete;
46 class vtkTextMapper;
47 class vtkSphereSource;
48 class vtkTransformFilter;
49 
50 namespace camitk {
127 
128 public:
140  Geometry(QString label, vtkSmartPointer<vtkPointSet> pointSet, const InterfaceGeometry::RenderingModes mode = InterfaceGeometry::Surface);
141 
143  ~Geometry() override;
144 
146  const QString getLabel() const override {
147  return label;
148  }
149 
151  void setLabel(QString newName) override {
152  label = newName;
153  updateLabel();
154  }
155 
162  vtkSmartPointer<vtkPointSet> getPointSet() override {
163  return pointSet;
164  }
165 
167  void setPointSet(vtkSmartPointer<vtkPointSet> ds) override;
168 
170  void setMeshWorldTransform(vtkSmartPointer<vtkTransform>) override;
171 
173  vtkSmartPointer<vtkAlgorithmOutput> getDataPort() const override {
174  return dataOutput;
175  }
176 
178  void setDataConnection(vtkSmartPointer<vtkAlgorithmOutput>) override;
179 
181  void setPointData(vtkSmartPointer<vtkDataArray>) override;
182 
187  vtkSmartPointer<vtkActor> getActor(const RenderingModes) override;
188 
190  void setTexture(vtkSmartPointer<vtkTexture> texture) override;
191 
193  void pointPicked(vtkIdType, bool) override {};
194 
196  void cellPicked(vtkIdType, bool) override {};
197 
199 
209 
211  vtkSmartPointer<vtkProp> getProp(const QString&) override;
212 
214  unsigned int getNumberOfProp() const override;
215 
217  vtkSmartPointer<vtkProp> getProp(unsigned int) override;
218 
222  bool addProp(const QString&, vtkSmartPointer<vtkProp>) override final;
223 
227  bool removeProp(const QString&) override;
229 
232 
234  void getBounds(double* bounds) override final;
235 
237  double getBoundingRadius() override final;
238 
240  void setPointPosition(const unsigned int orderNumber, const double x, const double y, const double z) override;
241 
243 
244 
247 
249  void setRenderingModes(const RenderingModes rMode) override {
250  renderingModes = rMode;
251  }
252 
254  const RenderingModes getRenderingModes() const override {
255  return renderingModes;
256  }
257 
259  void setEnhancedModes(const EnhancedModes) override;
260 
262  const EnhancedModes getEnhancedModes() const override {
263  return enhancedModes;
264  }
265 
267  void setActorColor(const RenderingModes, double*) override;
268 
270  void setActorColor(const RenderingModes, const double, const double, const double) override;
271 
273  void getActorColor(const RenderingModes, double*) const override final;
274 
276  void setColor(const double, const double, const double) override;
277 
279  void setColor(const double, const double, const double, const double) override;
280 
282  void setActorOpacity(const RenderingModes, const double) override final;
283 
285  double getActorOpacity(const RenderingModes) const override;
286 
288  void setOpacity(const double) override;
289 
291  void setMapperScalarRange(double min, double max) override;
292 
294  void setGlyphType(const GlyphTypes type, const double size = 0.0) override final;
295 
297  void setLinesAsTubes(bool isTubes = true, bool radiusFromLength = true, double radiusFactor = 1.0 / 40.0, int numberOfSides = 5) override;
298 
299  void setColorMode(int vtkColorMode = VTK_COLOR_MODE_DEFAULT) override;
300 
302 
303 
304 private:
305 
310  vtkSmartPointer<vtkPointSet> pointSet;
311 
313  vtkSmartPointer<vtkAlgorithmOutput> dataOutput;
314 
316  vtkSmartPointer<vtkAlgorithmOutput> customPipelineOutput;
317 
319  vtkSmartPointer<vtkCastToConcrete> concreteData;
320 
322  vtkSmartPointer<vtkDataSetMapper> mapper;
323 
325  vtkSmartPointer<vtkTextMapper> labelActorMapper;
326 
328  vtkSmartPointer<vtkActor> surfaceActor;
329 
331  vtkSmartPointer<vtkActor> wireframeActor;
332 
334  vtkSmartPointer<vtkActor> pointsActor;
335 
337  vtkSmartPointer<vtkTexture> texture;
338 
340  vtkSmartPointer<vtkTubeFilter> tube;
341 
343  vtkSmartPointer<vtkTransformFilter> worldTransformFilter;
344 
346  vtkSmartPointer<vtkSphereSource> sphereGeom;
348 
352  InterfaceGeometry::RenderingModes renderingModes;
353 
355  InterfaceGeometry::EnhancedModes enhancedModes;
356 
358  double alphaShaded;
359 
361  QString label;
362 
364  double glyphSize;
365 
367  void buildLabel();
368 
370  void updateLabel();
371 
373  void buildGlyph(const GlyphTypes type);
374 
380  void createPointCloudVisualization();
382 
387  double surfaceColor[4];
388  double wireframeColor[4];
389  double pointsColor[4];
391 
394  double oldAlphaSurface;
395  double oldAlphaWireframe;
396  double oldAlphaPoints;
398 
402 
404  QMap<QString, vtkSmartPointer<vtkProp> > extraProp;
406 
407 };
408 
409 
410 
411 }
412 
413 #endif
#define CAMITK_API
Definition: CamiTKAPI.h:49
A 3D representation of a vtkPointSet to be displayed in a InteractiveViewer, this class implements th...
Definition: Geometry.h:126
void setLabel(QString newName) override
set the label of this Geometry instance
Definition: Geometry.h:151
void cellPicked(vtkIdType, bool) override
a vtkCell of the structured was picked (to be reimplemented in a Component inherited class if needed)
Definition: Geometry.h:196
vtkSmartPointer< vtkAlgorithmOutput > getDataPort() const override
get the custom algorithm pipeline input.
Definition: Geometry.h:173
const QString getLabel() const override
get the label of this Geometry instance
Definition: Geometry.h:146
const RenderingModes getRenderingModes() const override
Return if the actor associated to a rendering mode is currently visible or not.
Definition: Geometry.h:254
void pointPicked(vtkIdType, bool) override
a vtkPoint of the structured was picked (to be reimplemented in a Component inherited class if needed...
Definition: Geometry.h:193
vtkSmartPointer< vtkPointSet > getPointSet() override
Definition: Geometry.h:162
const EnhancedModes getEnhancedModes() const override
get the current enhanced mode
Definition: Geometry.h:262
This class describes what are the methods to implement for a Geometry (rendering parameters,...
Definition: InterfaceGeometry.h:61
@ Surface
the surface is visible
Definition: InterfaceGeometry.h:67
Definition: Action.cpp:36
void removeProp(vtkSmartPointer< vtkProp > p, bool refresh=false)
remove the given vtkProp (e.g.
addProp(axes)