Computer Assisted Medical Intervention Tool Kit  version 5.2
camitk::Geometry Class Reference

A 3D representation of a vtkPointSet to be displayed in a InteractiveViewer, this class implements the InterfaceGeometry. More...

#include <Geometry.h>

+ Inheritance diagram for camitk::Geometry:
+ Collaboration diagram for camitk::Geometry:

Public Member Functions

 Geometry (QString label, vtkSmartPointer< vtkPointSet > pointSet, const InterfaceGeometry::RenderingModes mode=InterfaceGeometry::Surface)
 instantiate a Geometry using existing stuff. More...
 
const QString getLabel () const override
 get the label of this Geometry instance More...
 
void setLabel (QString newName) override
 set the label of this Geometry instance More...
 
 ~Geometry () override
 destructor More...
 
InterfaceGeometry Vtk related inherited methods

All the implemented InterfaceGeometry methods (Geometry is the adaptee of Component)

vtkSmartPointer< vtkPointSet > getPointSet () override
 
void setPointSet (vtkSmartPointer< vtkPointSet > ds) override
 set the input data of the Geometry, More...
 
void setMeshWorldTransform (vtkSmartPointer< vtkTransform >) override
 Set the world transform (if the Geometry depends on another Frame) More...
 
vtkSmartPointer< vtkAlgorithmOutput > getDataPort () const override
 get the custom algorithm pipeline input. More...
 
void setDataConnection (vtkSmartPointer< vtkAlgorithmOutput >) override
 call this method with the custom algorithm pipeline output More...
 
void setPointData (vtkSmartPointer< vtkDataArray >) override
 set the point data (may contains a lookup table) More...
 
vtkSmartPointer< vtkActor > getActor (const RenderingModes) override
 Return the actor representing this representation mode (returns nullptr if hightlight mode is Hidden). More...
 
void setTexture (vtkSmartPointer< vtkTexture > texture) override
 Set a texture to this object. More...
 
void pointPicked (vtkIdType, bool) override
 a vtkPoint of the structured was picked (to be reimplemented in a Component inherited class if needed) More...
 
void cellPicked (vtkIdType, bool) override
 a vtkCell of the structured was picked (to be reimplemented in a Component inherited class if needed) More...
 
InterfaceGeometry Helpers inherited methods
void getBounds (double *bounds) override final
 compute the object's bounding box [xmin,xmax, ymin,ymax, zmin,zmax] More...
 
double getBoundingRadius () override final
 compute the object's bounding sphere radius More...
 
void setPointPosition (const unsigned int orderNumber, const double x, const double y, const double z) override
 set a given point position More...
 
InterfaceGeometry rendering mode settings inherited methods
void setRenderingModes (const RenderingModes rMode) override
 Set the actor associated to a rendering mode visible or not. More...
 
const RenderingModes getRenderingModes () const override
 Return if the actor associated to a rendering mode is currently visible or not. More...
 
void setEnhancedModes (const EnhancedModes) override
 set the enhanced mode More...
 
const EnhancedModes getEnhancedModes () const override
 get the current enhanced mode More...
 
void setActorColor (const RenderingModes, double *) override
 Set the color of given representation modes. More...
 
void setActorColor (const RenderingModes, const double, const double, const double) override
 Set the color of given representation modes. More...
 
void getActorColor (const RenderingModes, double *) const override final
 Get the color of given representation modes in the second parameter, i.e. double[4] (r,g,b,a) More...
 
void setColor (const double, const double, const double) override
 Set an (r,g,b) color to all representation modes, without changing the opacity. More...
 
void setColor (const double, const double, const double, const double) override
 Set an (r,g,b,a) color to all representation modes. More...
 
void setActorOpacity (const RenderingModes, const double) override final
 Set the opacity of this representation modes. WARNING color field (surfaceColor, ...) are not modified! More...
 
double getActorOpacity (const RenderingModes) const override
 Return the opacity of a given renderng mode. More...
 
void setOpacity (const double) override
 Set the opacity of this object. WARNING color field (surfaceColor, ...) are not modified! More...
 
void setMapperScalarRange (double min, double max) override
 Set the mapper scalar range. More...
 
void setGlyphType (const GlyphTypes type, const double size=0.0) override final
 set the glyph information More...
 
void setLinesAsTubes (bool isTubes=true, bool radiusFromLength=true, double radiusFactor=1.0/40.0, int numberOfSides=5) override
 display lines as tubes (depeding of the boolean) (only work if the Geometry was defined using a vtkPolyData). More...
 
void setColorMode (int vtkColorMode=VTK_COLOR_MODE_DEFAULT) override
 
- Public Member Functions inherited from camitk::InterfaceGeometry
virtual ~InterfaceGeometry ()=default
 empty virtual destructor, to avoid memory leak More...
 

manage extra prop associated with a Geometry

TODO see extra prop management method section

vtkSmartPointer< vtkProp > getProp (const QString &) override
 Return the vtkProp (actors, volumes and annotations) corresponding to the given name. More...
 
unsigned int getNumberOfProp () const override
 return the number of additional prop More...
 
vtkSmartPointer< vtkProp > getProp (unsigned int) override
 return an additional prop by its index More...
 
bool addProp (const QString &, vtkSmartPointer< vtkProp >) override final
 insert an additional prop, defining it by its name (default visibility = false) More...
 
bool removeProp (const QString &) override
 remove a given additional prop. More...
 

Additional Inherited Members

- Public Types inherited from camitk::InterfaceGeometry
enum  EnhancedMode { Normal = 0x0 , Hidden = 0x1 , Shaded = 0x2 , Highlighted = 0x4 }
 (and QFlags EnhancedModes) handle the way the rendering actors will be enhanced or not (from completely hidden to highlighted) More...
 
enum  GlyphType { NoGlyph = 0x0 , Sphere = 0x1 }
 (and QFlags GlyphTypes) is the type of glyph attached to the geometry representation More...
 
enum  RenderingMode { None = 0x0 , Surface = 0x1 , Wireframe = 0x2 , Points = 0x4 }
 (and QFlags RenderingModes) handle actor rendering options (render this InterfaceGeometry as a surface, a wireframe and set of points). More...
 

Detailed Description

A 3D representation of a vtkPointSet to be displayed in a InteractiveViewer, this class implements the InterfaceGeometry.

A Geometry is build out of a vtkPointSet. A single vtkDataSetMapper is created, with several associated vtkActors. Each actor has specific rendering properties: representation mode, color, ...

Available actors are: surface, wireframe and points.

An actor is visible or not according to the options of the RenderingModes associated to the Geometry as well as the highlight mode (from hidden to highlighted).

Note
when the Geometry is instantiated the Geometry TAKES CONTROL of the given vtkPointSet (hence, if you then delete the instance, the vtkDataSet will be deleted as well).

This class is used as a delegate by Component (who delegates all the InterfaceGeometry service implementation to Geometry), according to the Object Adapter Design Pattern (Component is the adaptor, Geometry is the adaptee concerning the InterfaceGeometry service).

If you need to add your own vtk filter/algorithm pipeline to pre-process the data, you need to write something like this:

vtkSomeAlgorithm *startFilter = vtkSomeAlgorithm::New();
startFilter->SetInputConnection(theAbstractGeometry->getDataPort());
...
...
theAbstractGeometry->setDataConnection(endFilter->GetOutputPort());

The complete Vtk Pipeline looks like this:

*                                                                                  +-----> getDataPort()
*  +----------------+     +------------------+      +---------------------------+ /
*  |  vtkPointSet   |     |vtkCastToConcrete |      |vtkTransformPolyDataFilter |/
*  |                |----\|                  |----\ |                           |----\ your custom  ----\ ...
*  |   pointSet     |----/|  concreteData    |----/ |    data in world frame    |----/  pipeline    ----/
*  +----------------+     +------------------+      +--------------------------+|
*     ^           |                                                      |
*     |           |                                                      |
* setPointSet()   |                                                      |
*                 |                                                      |
*                 v                                                      v
*          getPointSet()                                       getPointSetWorldCoords()
*
*
* setDataConnection(..)
*      |
*      |  +---OPTIONAL---+       +------------------+
*      +->| vtkTubeFilter|       | vtkDataSetMapper |
*... ----\|              |-----\ |                  |
*    ----/|     tube     |-----/ |     mapper       |
*         +--------------+       +------------------+
*                ^                     |
*                |                     V
*         setLinesAsTube()        +------------------+
*                                 |     3 actors:    |
*                                 |   surfaceActor   |
*                                 | wireframeActor   |
*                                 |    pointsActor   |
*                                 |                  |
*                                 +------------------+
*
* 

The other vtk (minor) ingredients not mentionned are specific vtkProp (actors, volumes and annotations) By default two props are defined: label and glyph. They can be accessed by getProp("label") and getProp("glyph"). You can also add your own additional custom props by using addProp(QString, vtkProp) and setPropVisible(QString, bool).

Constructor & Destructor Documentation

◆ Geometry()

camitk::Geometry::Geometry ( QString  label,
vtkSmartPointer< vtkPointSet >  pointSet,
const InterfaceGeometry::RenderingModes  mode = InterfaceGeometry::Surface 
)

instantiate a Geometry using existing stuff.

Note
when the Geometry is instantiated like this, the object takes CONTROL of the vtkDataSet (hence, if you then delete this instance, the vtkDataSet will be deleted as well). dataSet thus becomes owned by the Geometry and will be deleted when necessary, so do not pass the address of an object on the stack.
Parameters
labelname to display on the label
pointSetthe vtkDataSet to take as the vtk object to display
modethe default rendering mode

References camitk::InterfaceGeometry::Normal, setGlyphType(), camitk::InterfaceGeometry::Sphere, and camitk::transform.

+ Here is the call graph for this function:

◆ ~Geometry()

camitk::Geometry::~Geometry ( )
override

destructor

Member Function Documentation

◆ addProp()

bool camitk::Geometry::addProp ( const QString &  name,
vtkSmartPointer< vtkProp >  prop 
)
finaloverridevirtual

insert an additional prop, defining it by its name (default visibility = false)

Returns
true if the additional prop was added (i.e. another additional prop of the same name does not exist)

Implements camitk::InterfaceGeometry.

◆ cellPicked()

void camitk::Geometry::cellPicked ( vtkIdType  ,
bool   
)
inlineoverridevirtual

a vtkCell of the structured was picked (to be reimplemented in a Component inherited class if needed)

Implements camitk::InterfaceGeometry.

◆ getActor()

vtkSmartPointer< vtkActor > camitk::Geometry::getActor ( const  RenderingModes)
overridevirtual

Return the actor representing this representation mode (returns nullptr if hightlight mode is Hidden).

If RenderingModes have a more than one possible representation, it returns in priority order: the surface, wireframe or points representation.

Implements camitk::InterfaceGeometry.

References camitk::InterfaceGeometry::Hidden, camitk::InterfaceGeometry::Points, setActorColor(), camitk::InterfaceGeometry::Surface, and camitk::InterfaceGeometry::Wireframe.

Referenced by ReorientImage::modelChanged().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActorColor()

void camitk::Geometry::getActorColor ( const RenderingModes  mode,
double *  color 
) const
finaloverridevirtual

Get the color of given representation modes in the second parameter, i.e. double[4] (r,g,b,a)

Implements camitk::InterfaceGeometry.

References camitk::InterfaceGeometry::Points, camitk::InterfaceGeometry::Surface, and camitk::InterfaceGeometry::Wireframe.

◆ getActorOpacity()

double camitk::Geometry::getActorOpacity ( const RenderingModes  mode) const
overridevirtual

Return the opacity of a given renderng mode.

Implements camitk::InterfaceGeometry.

References camitk::InterfaceGeometry::Points, camitk::InterfaceGeometry::Surface, and camitk::InterfaceGeometry::Wireframe.

Referenced by setActorColor().

+ Here is the caller graph for this function:

◆ getBoundingRadius()

double camitk::Geometry::getBoundingRadius ( )
finaloverridevirtual

compute the object's bounding sphere radius

Implements camitk::InterfaceGeometry.

References getBounds().

Referenced by setGlyphType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBounds()

void camitk::Geometry::getBounds ( double *  bounds)
finaloverridevirtual

compute the object's bounding box [xmin,xmax, ymin,ymax, zmin,zmax]

Implements camitk::InterfaceGeometry.

Referenced by getBoundingRadius().

+ Here is the caller graph for this function:

◆ getDataPort()

vtkSmartPointer<vtkAlgorithmOutput> camitk::Geometry::getDataPort ( ) const
inlineoverridevirtual

get the custom algorithm pipeline input.

Implements camitk::InterfaceGeometry.

◆ getEnhancedModes()

const EnhancedModes camitk::Geometry::getEnhancedModes ( ) const
inlineoverridevirtual

get the current enhanced mode

Implements camitk::InterfaceGeometry.

◆ getLabel()

const QString camitk::Geometry::getLabel ( ) const
inlineoverridevirtual

get the label of this Geometry instance

Implements camitk::InterfaceGeometry.

Referenced by VtkMeshUtil::saveGeometryToFile().

+ Here is the caller graph for this function:

◆ getNumberOfProp()

unsigned int camitk::Geometry::getNumberOfProp ( ) const
overridevirtual

return the number of additional prop

Implements camitk::InterfaceGeometry.

◆ getPointSet()

vtkSmartPointer<vtkPointSet> camitk::Geometry::getPointSet ( )
inlineoverridevirtual

Return the dataset associated to this object.

Implements camitk::InterfaceGeometry.

Referenced by VtkMeshUtil::saveGeometryToFile().

+ Here is the caller graph for this function:

◆ getProp() [1/2]

vtkSmartPointer< vtkProp > camitk::Geometry::getProp ( const QString &  name)
overridevirtual

Return the vtkProp (actors, volumes and annotations) corresponding to the given name.

Implements camitk::InterfaceGeometry.

References camitk::InterfaceGeometry::Sphere.

Referenced by setGlyphType().

+ Here is the caller graph for this function:

◆ getProp() [2/2]

vtkSmartPointer< vtkProp > camitk::Geometry::getProp ( unsigned int  index)
overridevirtual

return an additional prop by its index

Implements camitk::InterfaceGeometry.

◆ getRenderingModes()

const RenderingModes camitk::Geometry::getRenderingModes ( ) const
inlineoverridevirtual

Return if the actor associated to a rendering mode is currently visible or not.

Implements camitk::InterfaceGeometry.

◆ pointPicked()

void camitk::Geometry::pointPicked ( vtkIdType  ,
bool   
)
inlineoverridevirtual

a vtkPoint of the structured was picked (to be reimplemented in a Component inherited class if needed)

Implements camitk::InterfaceGeometry.

◆ removeProp()

bool camitk::Geometry::removeProp ( const QString &  name)
overridevirtual

remove a given additional prop.

Returns
true if effictively done

Implements camitk::InterfaceGeometry.

◆ setActorColor() [1/2]

void camitk::Geometry::setActorColor ( const RenderingModes  mode,
const double  r,
const double  g,
const double  b 
)
overridevirtual

Set the color of given representation modes.

Implements camitk::InterfaceGeometry.

References getActorOpacity(), and setActorColor().

+ Here is the call graph for this function:

◆ setActorColor() [2/2]

void camitk::Geometry::setActorColor ( const RenderingModes  mode,
double *  color 
)
overridevirtual

Set the color of given representation modes.

Implements camitk::InterfaceGeometry.

References camitk::InterfaceGeometry::Points, camitk::InterfaceGeometry::Surface, and camitk::InterfaceGeometry::Wireframe.

Referenced by getActor(), setActorColor(), and setColor().

+ Here is the caller graph for this function:

◆ setActorOpacity()

void camitk::Geometry::setActorOpacity ( const RenderingModes  mode,
const double  alpha 
)
finaloverridevirtual

Set the opacity of this representation modes. WARNING color field (surfaceColor, ...) are not modified!

Implements camitk::InterfaceGeometry.

References camitk::InterfaceGeometry::Points, camitk::InterfaceGeometry::Surface, and camitk::InterfaceGeometry::Wireframe.

Referenced by setEnhancedModes(), and setOpacity().

+ Here is the caller graph for this function:

◆ setColor() [1/2]

void camitk::Geometry::setColor ( const double  r,
const double  g,
const double  b 
)
overridevirtual

Set an (r,g,b) color to all representation modes, without changing the opacity.

Implements camitk::InterfaceGeometry.

References camitk::InterfaceGeometry::Points, setActorColor(), camitk::InterfaceGeometry::Surface, and camitk::InterfaceGeometry::Wireframe.

+ Here is the call graph for this function:

◆ setColor() [2/2]

void camitk::Geometry::setColor ( const double  r,
const double  g,
const double  b,
const double  a 
)
overridevirtual

Set an (r,g,b,a) color to all representation modes.

Implements camitk::InterfaceGeometry.

References a, camitk::InterfaceGeometry::Points, setActorColor(), camitk::InterfaceGeometry::Surface, and camitk::InterfaceGeometry::Wireframe.

+ Here is the call graph for this function:

◆ setColorMode()

void camitk::Geometry::setColorMode ( int  vtkColorMode = VTK_COLOR_MODE_DEFAULT)
overridevirtual

◆ setDataConnection()

void camitk::Geometry::setDataConnection ( vtkSmartPointer< vtkAlgorithmOutput >  outputPort)
overridevirtual

call this method with the custom algorithm pipeline output

Implements camitk::InterfaceGeometry.

◆ setEnhancedModes()

void camitk::Geometry::setEnhancedModes ( const EnhancedModes  emode)
overridevirtual

set the enhanced mode

Implements camitk::InterfaceGeometry.

References camitk::InterfaceGeometry::Highlighted, camitk::InterfaceGeometry::Points, setActorOpacity(), setOpacity(), camitk::InterfaceGeometry::Shaded, camitk::InterfaceGeometry::Surface, and camitk::InterfaceGeometry::Wireframe.

+ Here is the call graph for this function:

◆ setGlyphType()

void camitk::Geometry::setGlyphType ( const GlyphTypes  type,
const double  size = 0.0 
)
finaloverridevirtual

set the glyph information

Implements camitk::InterfaceGeometry.

References getBoundingRadius(), getProp(), and camitk::InterfaceGeometry::NoGlyph.

Referenced by Geometry(), and setPointSet().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLabel()

void camitk::Geometry::setLabel ( QString  newName)
inlineoverridevirtual

set the label of this Geometry instance

Implements camitk::InterfaceGeometry.

◆ setLinesAsTubes()

void camitk::Geometry::setLinesAsTubes ( bool  isTubes = true,
bool  radiusFromLength = true,
double  radiusFactor = 1.0 / 40.0,
int  numberOfSides = 5 
)
overridevirtual

display lines as tubes (depeding of the boolean) (only work if the Geometry was defined using a vtkPolyData).

Implements camitk::InterfaceGeometry.

◆ setMapperScalarRange()

void camitk::Geometry::setMapperScalarRange ( double  min,
double  max 
)
overridevirtual

Set the mapper scalar range.

Implements camitk::InterfaceGeometry.

◆ setMeshWorldTransform()

void camitk::Geometry::setMeshWorldTransform ( vtkSmartPointer< vtkTransform >  transform)
overridevirtual

Set the world transform (if the Geometry depends on another Frame)

Implements camitk::InterfaceGeometry.

References camitk::transform.

◆ setOpacity()

void camitk::Geometry::setOpacity ( const double  alpha)
overridevirtual

Set the opacity of this object. WARNING color field (surfaceColor, ...) are not modified!

Implements camitk::InterfaceGeometry.

References camitk::InterfaceGeometry::Points, setActorOpacity(), camitk::InterfaceGeometry::Surface, and camitk::InterfaceGeometry::Wireframe.

Referenced by setEnhancedModes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPointData()

void camitk::Geometry::setPointData ( vtkSmartPointer< vtkDataArray >  da)
overridevirtual

set the point data (may contains a lookup table)

Implements camitk::InterfaceGeometry.

◆ setPointPosition()

void camitk::Geometry::setPointPosition ( const unsigned int  orderNumber,
const double  x,
const double  y,
const double  z 
)
overridevirtual

set a given point position

Implements camitk::InterfaceGeometry.

◆ setPointSet()

void camitk::Geometry::setPointSet ( vtkSmartPointer< vtkPointSet >  ds)
overridevirtual

set the input data of the Geometry,

Note
if there is already a vtkPointSet, this method calls DeepCopy(ds)

Implements camitk::InterfaceGeometry.

References setGlyphType(), and camitk::InterfaceGeometry::Sphere.

+ Here is the call graph for this function:

◆ setRenderingModes()

void camitk::Geometry::setRenderingModes ( const RenderingModes  rMode)
inlineoverridevirtual

Set the actor associated to a rendering mode visible or not.

Implements camitk::InterfaceGeometry.

◆ setTexture()

void camitk::Geometry::setTexture ( vtkSmartPointer< vtkTexture >  texture)
overridevirtual

Set a texture to this object.

Implements camitk::InterfaceGeometry.


The documentation for this class was generated from the following files: