Computer Assisted Medical Intervention Tool Kit version 6.0
 
Loading...
Searching...
No Matches
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-2025 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#include <vtkTransformFilter.h>
37#include <vtkTubeFilter.h>
38#include <vtkTextMapper.h>
39#include <vtkCastToConcrete.h>
40#include <vtkTexture.h>
41
42class vtkPointSet;
43class vtkAlgorithmOutput;
44class vtkDataSetMapper;
45class vtkActor;
46class vtkProp;
47class vtkGlyph3D;
48class vtkTransform;
49class vtkSphereSource;
50
51
52namespace camitk {
130
131public:
143 Geometry(QString label, vtkSmartPointer<vtkPointSet> pointSet, const InterfaceGeometry::RenderingModes mode = InterfaceGeometry::Surface);
144
146 ~Geometry() override;
147
154 vtkSmartPointer<vtkPointSet> getPointSet() override {
155 return pointSet;
156 }
157
159 void setPointSet(vtkSmartPointer<vtkPointSet> ds) override;
160
162 void setMeshWorldTransform(vtkSmartPointer<vtkTransform>) override;
163
165 vtkSmartPointer<vtkAlgorithmOutput> getDataPort() const override {
166 return dataOutput;
167 }
168
170 void setDataConnection(vtkSmartPointer<vtkAlgorithmOutput>) override;
171
173 void setPointData(vtkSmartPointer<vtkDataArray>) override;
174
179 vtkSmartPointer<vtkActor> getActor(const RenderingModes) override;
180
182 void setTexture(vtkSmartPointer<vtkTexture> texture) override;
183
185 void pointPicked(vtkIdType, bool) override {};
186
188 void cellPicked(vtkIdType, bool) override {};
189
191
201
203 vtkSmartPointer<vtkProp> getProp(const QString&) override;
204
206 unsigned int getNumberOfProp() const override;
207
209 vtkSmartPointer<vtkProp> getProp(unsigned int) override;
210
214 bool addProp(const QString&, vtkSmartPointer<vtkProp>) override final;
215
219 bool removeProp(const QString&) override;
221
224
226 void getBounds(double* bounds) override final;
227
229 double getBoundingRadius() override final;
230
232 void setPointPosition(const unsigned int orderNumber, const double x, const double y, const double z) override;
233
235
236
239
241 void setRenderingModes(const RenderingModes rMode) override {
242 renderingModes = rMode;
243 }
244
246 const RenderingModes getRenderingModes() const override {
247 return renderingModes;
248 }
249
251 void setEnhancedModes(const EnhancedModes) override;
252
254 const EnhancedModes getEnhancedModes() const override {
255 return enhancedModes;
256 }
257
259 void setActorColor(const RenderingModes, double*) override;
260
262 void setActorColor(const RenderingModes, const double, const double, const double) override;
263
265 void getActorColor(const RenderingModes, double*, bool ignoreEnhancedModes = false) const override final;
266
268 void setColor(const double, const double, const double) override;
269
271 void setColor(const double, const double, const double, const double) override;
272
274 void setActorOpacity(const RenderingModes, const double) override final;
275
277 double getActorOpacity(const RenderingModes) const override;
278
280 void setOpacity(const double) override;
281
283 void setMapperScalarRange(double min, double max) override;
284
286 void setGlyphType(const GlyphTypes type, const double size = 0.0) override final;
287
289 void setLinesAsTubes(bool isTubes = true, bool radiusFromLength = true, double radiusFactor = 1.0 / 40.0, int numberOfSides = 5) override;
290
291 void setColorMode(int vtkColorMode = VTK_COLOR_MODE_DEFAULT) override;
292
294
297
299 virtual void updateLabel(const QString& label) override;
301
302private:
303
308 vtkSmartPointer<vtkPointSet> pointSet;
309
311 vtkSmartPointer<vtkAlgorithmOutput> dataOutput;
312
314 vtkSmartPointer<vtkAlgorithmOutput> customPipelineOutput;
315
317 vtkSmartPointer<vtkCastToConcrete> concreteData;
318
320 vtkSmartPointer<vtkDataSetMapper> mapper;
321
323 vtkSmartPointer<vtkTextMapper> labelActorMapper;
324
326 vtkSmartPointer<vtkActor> surfaceActor;
327
329 vtkSmartPointer<vtkActor> wireframeActor;
330
332 vtkSmartPointer<vtkActor> pointsActor;
333
335 vtkSmartPointer<vtkTexture> texture;
336
338 vtkSmartPointer<vtkTubeFilter> tube;
339
341 vtkSmartPointer<vtkTransformFilter> worldTransformFilter;
342
344 vtkSmartPointer<vtkSphereSource> sphereGeom;
346
350 InterfaceGeometry::RenderingModes renderingModes;
351
353 InterfaceGeometry::EnhancedModes enhancedModes;
354
356 double alphaShaded;
357
359 QString label;
360
362 double glyphSize;
363
365 void buildLabelProp();
366
368 void updateLabelProp();
369
371 void buildGlyph(const GlyphTypes type);
372
378 void createPointCloudVisualization();
380
385 double surfaceColor[4];
386 double wireframeColor[4];
387 double pointsColor[4];
389
392 double oldAlphaSurface;
393 double oldAlphaWireframe;
394 double oldAlphaPoints;
396
400
402 QMap<QString, vtkSmartPointer<vtkProp> > extraProp;
404
405};
406
407
408
409}
410
411#endif
#define CAMITK_API
Definition CamiTKAPI.h:66
A 3D representation of a vtkPointSet to be displayed in a InteractiveViewer, this class implements th...
Definition Geometry.h:129
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:188
vtkSmartPointer< vtkPointSet > getPointSet() override
Definition Geometry.h:154
vtkSmartPointer< vtkAlgorithmOutput > getDataPort() const override
get the custom algorithm pipeline input.
Definition Geometry.h:165
const RenderingModes getRenderingModes() const override
Return if the actor associated to a rendering mode is currently visible or not.
Definition Geometry.h:246
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:185
const EnhancedModes getEnhancedModes() const override
get the current enhanced mode
Definition Geometry.h:254
This class describes what are the methods to implement for a Geometry (rendering parameters,...
Definition InterfaceGeometry.h:61
Definition Action.cpp:40