Computer Assited Medical Intervention Tool Kit  version 3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
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 
49 namespace camitk
50 {
127 
128  public:
140  Geometry(QString label, vtkSmartPointer<vtkPointSet> pointSet, const InterfaceGeometry::RenderingModes mode = InterfaceGeometry::Surface);
141 
143  virtual ~Geometry();
144 
146  virtual const QString getLabel() const {
147  return label;
148  }
149 
151  virtual void setLabel(QString newName) {
152  label = newName;
153  updateLabel();
154  }
155 
160  virtual vtkSmartPointer<vtkPointSet> getPointSet() {
163  return pointSet;
164  }
165 
167  virtual void setPointSet(vtkSmartPointer<vtkPointSet> ds);
168 
170  virtual vtkSmartPointer<vtkAlgorithmOutput> getDataPort() const {
171  return dataOutput;
172  }
173 
175  virtual void setDataConnection(vtkSmartPointer<vtkAlgorithmOutput>);
176 
178  virtual void setPointData(vtkSmartPointer<vtkDataArray>);
179 
184  virtual vtkSmartPointer<vtkActor> getActor(const RenderingModes);
185 
187  virtual vtkSmartPointer<vtkProp> getProp(const QString &);
188 
190  virtual unsigned int getNumberOfProp() const;
191 
193  virtual vtkSmartPointer<vtkProp> getProp(unsigned int);
194 
198  virtual bool addProp(const QString &, vtkSmartPointer<vtkProp>);
199 
203  virtual bool removeProp(const QString &);
204 
206  virtual void setTexture(vtkSmartPointer<vtkTexture> texture);
207 
209  virtual void pointPicked(vtkIdType, bool) {};
210 
212  virtual void cellPicked(vtkIdType, bool) {};
213 
215 
218 
220  virtual void getBounds(double *bounds);
221 
223  virtual double getBoundingRadius();
224 
226  virtual void setPointPosition(const unsigned int orderNumber, const double x, const double y, const double z);
227 
229 
230 
233 
235  virtual void setRenderingModes(const RenderingModes rMode) { renderingModes = rMode; }
236 
238  virtual const RenderingModes getRenderingModes() const { return renderingModes; }
239 
241  virtual void setEnhancedModes(const EnhancedModes );
242 
244  virtual const EnhancedModes getEnhancedModes() const { return enhancedModes; }
245 
247  virtual void setActorColor(const RenderingModes, double*);
248 
250  virtual void setActorColor(const RenderingModes, const double, const double, const double);
251 
253  virtual void getActorColor(const RenderingModes, double*);
254 
256  virtual void setColor(const double, const double, const double);
257 
259  virtual void setColor(const double, const double, const double, const double);
260 
262  virtual void setActorOpacity(const RenderingModes, const double);
263 
265  virtual double getActorOpacity(const RenderingModes) const;
266 
268  virtual void setOpacity(const double);
269 
271  virtual void setMapperScalarRange(double min, double max);
272 
274  virtual void setGlyphType(const GlyphTypes type, const double size = 0.0);
275 
277  virtual void setLinesAsTubes(bool tubes = false);
278 
280 
281 
282  private:
283 
286  vtkSmartPointer<vtkPointSet> pointSet;
289 
291  vtkSmartPointer<vtkAlgorithmOutput> dataOutput;
292 
294  vtkSmartPointer<vtkAlgorithmOutput> customPipelineOutput;
295 
297  vtkSmartPointer<vtkCastToConcrete> concreteData;
298 
300  vtkSmartPointer<vtkDataSetMapper> mapper;
301 
303  QMap<QString, vtkSmartPointer<vtkProp> > extraProp;
304 
306  vtkSmartPointer<vtkTextMapper> labelActorMapper;
307 
309  vtkSmartPointer<vtkActor> surfaceActor;
310 
312  vtkSmartPointer<vtkActor> wireframeActor;
313 
315  vtkSmartPointer<vtkActor> pointsActor;
316 
318  vtkSmartPointer<vtkTexture> texture;
319 
321  vtkSmartPointer<vtkTubeFilter> tube;
323 
327  InterfaceGeometry::RenderingModes renderingModes;
328 
330  InterfaceGeometry::EnhancedModes enhancedModes;
331 
333  double alphaShaded;
334 
336  QString label;
337 
339  double glyphSize;
340 
342  void buildLabel();
343 
345  void updateLabel();
346 
348  void buildGlyph(const GlyphTypes type);
349 
351  vtkSmartPointer<vtkSphereSource> sphereGeom;
353 
357  double surfaceColor[4];
359  double wireframeColor[4];
360  double pointsColor[4];
362 
368  double oldPointsColor[4];
370 protected:
371  vtkSmartPointer< vtkPointSet > New();
372 };
373 
374 
375 
376 }
377 
378 #endif
InterfaceGeometry::RenderingModes renderingModes
Definition: Geometry.h:327
vtkSmartPointer< vtkSphereSource > sphereGeom
the sphere glyph
Definition: Geometry.h:351
vtkSmartPointer< vtkActor > pointsActor
the point actor that manages the representation as a set of points
Definition: Geometry.h:315
vtkSmartPointer< vtkTubeFilter > tube
the tube filter (creates tubes insead of lines)
Definition: Geometry.h:321
double oldAlphaSurface
Definition: Geometry.h:365
virtual void pointPicked(vtkIdType, bool)
a vtkPoint of the structured was picked (to be reimplemented in a Component inherited class if needed...
Definition: Geometry.h:209
virtual vtkSmartPointer< vtkAlgorithmOutput > getDataPort() const
get the custom algorithm pipeline input.
Definition: Geometry.h:170
QMap< QString, vtkSmartPointer< vtkProp > > extraProp
The additional map for prop (include at least "label" and "glyph".
Definition: Geometry.h:303
Definition: Action.h:40
virtual void cellPicked(vtkIdType, bool)
a vtkCell of the structured was picked (to be reimplemented in a Component inherited class if needed)...
Definition: Geometry.h:212
double glyphSize
current size of glyph (0.0 means no glyph)
Definition: Geometry.h:339
vtkSmartPointer< vtkAlgorithmOutput > dataOutput
to be able to set external custom pipeline
Definition: Geometry.h:291
#define CAMITK_API
Definition: CamiTKAPI.h:49
virtual const RenderingModes getRenderingModes() const
Return if the actor associated to a rendering mode is currently visible or not.
Definition: Geometry.h:238
double oldAlphaWireframe
Definition: Geometry.h:366
vtkSmartPointer< vtkDataSetMapper > mapper
the VTK mapper
Definition: Geometry.h:300
InterfaceGeometry::EnhancedModes enhancedModes
Enhanced mode options (the way actors are rendered: normal, hidden, highlighted, shaded) ...
Definition: Geometry.h:330
vtkSmartPointer< vtkAlgorithmOutput > customPipelineOutput
the external custom pipeline output (equals to dataOuput if no custom pipeline plugged) ...
Definition: Geometry.h:294
vtkSmartPointer< vtkCastToConcrete > concreteData
the filter to convert the DataSet to get a correct vtkPipeline output port
Definition: Geometry.h:297
virtual const EnhancedModes getEnhancedModes() const
get the current enhanced mode
Definition: Geometry.h:244
double alphaShaded
Opacity value when this object must be shaded.
Definition: Geometry.h:333
virtual void setLabel(QString newName)
set the label of this Geometry instance
Definition: Geometry.h:151
vtkSmartPointer< vtkTexture > texture
texture of this object.
Definition: Geometry.h:318
vtkSmartPointer< vtkActor > surfaceActor
the surface actor that manages the surfacic representation
Definition: Geometry.h:309
A 3D representation of a vtkPointSet to be displayed in a InteractiveViewer, this class implements th...
Definition: Geometry.h:126
virtual const QString getLabel() const
get the label of this Geometry instance
Definition: Geometry.h:146
vtkSmartPointer< vtkTextMapper > labelActorMapper
the mapper to create the text
Definition: Geometry.h:306
This class describes what are the methods to implement for a Geometry (rendering parameters, input/output, filters, picking parameters...)
Definition: InterfaceGeometry.h:61
virtual void setRenderingModes(const RenderingModes rMode)
Set the actor associated to a rendering mode visible or not.
Definition: Geometry.h:235
double oldAlphaPoints
Definition: Geometry.h:367
vtkSmartPointer< vtkActor > wireframeActor
the wireframe actor that manages the representation as wireframe
Definition: Geometry.h:312
the surface is visible
Definition: InterfaceGeometry.h:67
QString label
the label
Definition: Geometry.h:336