A 3D representation of a vtkPointSet to be displayed in a InteractiveViewer, this class implements the InterfaceGeometry. More...
#include <Geometry.h>
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 *) 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 tubes=false) override |
display lines as tubes (depeding of the boolean) (only work if the Geometry was defined using a vtkPolyData). More... | |
Public Member Functions inherited from camitk::InterfaceGeometry | |
virtual | ~InterfaceGeometry ()=default |
empty virtual destructor, to avoid memory leak More... | |
Private Attributes | |
VTK members (data, filters, actors, etc...) | |
vtkSmartPointer< vtkPointSet > | pointSet |
vtkSmartPointer< vtkAlgorithmOutput > | dataOutput |
to be able to set external custom pipeline More... | |
vtkSmartPointer< vtkAlgorithmOutput > | customPipelineOutput |
the external custom pipeline output (equals to dataOuput if no custom pipeline plugged) More... | |
vtkSmartPointer< vtkCastToConcrete > | concreteData |
the filter to convert the DataSet to get a correct vtkPipeline output port More... | |
vtkSmartPointer< vtkDataSetMapper > | mapper |
the VTK mapper More... | |
vtkSmartPointer< vtkTextMapper > | labelActorMapper |
the mapper to create the text More... | |
vtkSmartPointer< vtkActor > | surfaceActor |
the surface actor that manages the surfacic representation More... | |
vtkSmartPointer< vtkActor > | wireframeActor |
the wireframe actor that manages the representation as wireframe More... | |
vtkSmartPointer< vtkActor > | pointsActor |
the point actor that manages the representation as a set of points More... | |
vtkSmartPointer< vtkTexture > | texture |
texture of this object. More... | |
vtkSmartPointer< vtkTubeFilter > | tube |
the tube filter (creates tubes insead of lines) More... | |
vtkSmartPointer< vtkTransformFilter > | worldTransformFilter |
the transform filter to place the mesh correctly with respect to its Frame More... | |
vtkSmartPointer< vtkSphereSource > | sphereGeom |
the sphere glyph More... | |
actor colors | |
All Colors are decribed using r, g, b, alpha (Alpha is opacity 0 = transparent, 1 = opaque) | |
double | surfaceColor [4] |
double | wireframeColor [4] |
double | pointsColor [4] |
Backup states | |
double | oldAlphaSurface |
double | oldAlphaWireframe |
double | oldAlphaPoints |
manage extra prop associated with a Geometry | |
QMap< QString, vtkSmartPointer< vtkProp > > | extraProp |
The additional map for prop (include at least "label" and "glyph") More... | |
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... | |
Other members | |
Rendering mode options for this Geometry (which actors are visible/rendered) | |
InterfaceGeometry::RenderingModes | renderingModes |
InterfaceGeometry::EnhancedModes | enhancedModes |
Enhanced mode options (the way actors are rendered: normal, hidden, highlighted, shaded) More... | |
double | alphaShaded |
Opacity value when this object must be shaded. More... | |
QString | label |
the label More... | |
double | glyphSize |
current size of glyph (0.0 means no glyph) More... | |
void | buildLabel () |
build the label extra prop More... | |
void | updateLabel () |
update position and text of the label More... | |
void | buildGlyph (const GlyphTypes type) |
build the glyph extra prop (sphere glyph by default) More... | |
void | createPointCloudVisualization () |
force visualization of point cloud If the point set does only contains a point cloud, i.e., there is no cell to visualize the points, this method will add a default poly vertex cell that will enable default visualization. More... | |
Additional Inherited Members | |
Public Types inherited from camitk::InterfaceGeometry | |
enum | EnhancedMode { Normal = 0x0, Hidden = 0x1, Shaded = 0x2, Highlighted = 0x4 } |
enum | GlyphType { NoGlyph = 0x0, Sphere = 0x1 } |
enum | RenderingMode { None = 0x0, Surface = 0x1, Wireframe = 0x2, Points = 0x4 } |
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).
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:
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).
camitk::Geometry::Geometry | ( | QString | label, |
vtkSmartPointer< vtkPointSet > | pointSet, | ||
const InterfaceGeometry::RenderingModes | mode = InterfaceGeometry::Surface |
||
) |
instantiate a Geometry using existing stuff.
label | name to display on the label |
pointSet | the vtkDataSet to take as the vtk object to display |
mode | the default rendering mode |
References surfaceColor.
|
override |
destructor
References createPointCloudVisualization(), pointSet, setGlyphType(), and camitk::InterfaceGeometry::Sphere.
|
finaloverridevirtual |
insert an additional prop, defining it by its name (default visibility = false)
Implements camitk::InterfaceGeometry.
|
private |
build the glyph extra prop (sphere glyph by default)
References tube.
|
private |
build the label extra prop
References extraProp, glyphSize, label, labelActorMapper, and pointSet.
|
inlineoverridevirtual |
a vtkCell of the structured was picked (to be reimplemented in a Component inherited class if needed)
Implements camitk::InterfaceGeometry.
|
private |
force visualization of point cloud If the point set does only contains a point cloud, i.e., there is no cell to visualize the points, this method will add a default poly vertex cell that will enable default visualization.
Caveat: if the user save this component, this cell might be saved as well.
Referenced by ~Geometry().
|
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.
Referenced by ReorientImage::initInternalViewer(), and ReorientImage::modelChanged().
|
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, setActorColor(), camitk::InterfaceGeometry::Surface, and camitk::InterfaceGeometry::Wireframe.
|
overridevirtual |
Return the opacity of a given renderng mode.
Implements camitk::InterfaceGeometry.
|
finaloverridevirtual |
compute the object's bounding sphere radius
Implements camitk::InterfaceGeometry.
|
finaloverridevirtual |
compute the object's bounding box [xmin,xmax, ymin,ymax, zmin,zmax]
Implements camitk::InterfaceGeometry.
|
inlineoverridevirtual |
get the custom algorithm pipeline input.
Implements camitk::InterfaceGeometry.
|
inlineoverridevirtual |
get the current enhanced mode
Implements camitk::InterfaceGeometry.
|
inlineoverridevirtual |
get the label of this Geometry instance
Implements camitk::InterfaceGeometry.
Referenced by VtkMeshUtil::saveGeometryToFile().
|
overridevirtual |
return the number of additional prop
Implements camitk::InterfaceGeometry.
|
inlineoverridevirtual |
Return the dataset associated to this object.
Implements camitk::InterfaceGeometry.
Referenced by VtkMeshUtil::saveGeometryToFile().
|
overridevirtual |
Return the vtkProp (actors, volumes and annotations) corresponding to the given name.
Implements camitk::InterfaceGeometry.
References extraProp.
Referenced by setOpacity().
|
overridevirtual |
return an additional prop by its index
Implements camitk::InterfaceGeometry.
|
inlineoverridevirtual |
Return if the actor associated to a rendering mode is currently visible or not.
Implements camitk::InterfaceGeometry.
|
inlineoverridevirtual |
a vtkPoint of the structured was picked (to be reimplemented in a Component inherited class if needed)
Implements camitk::InterfaceGeometry.
|
overridevirtual |
remove a given additional prop.
Implements camitk::InterfaceGeometry.
|
overridevirtual |
Set the color of given representation modes.
Implements camitk::InterfaceGeometry.
|
overridevirtual |
Set the color of given representation modes.
Implements camitk::InterfaceGeometry.
References pointsColor.
Referenced by getActorColor(), and setDataConnection().
|
finaloverridevirtual |
Set the opacity of this representation modes. WARNING color field (surfaceColor, ...) are not modified!
Implements camitk::InterfaceGeometry.
Referenced by setGlyphType().
|
overridevirtual |
Set an (r,g,b) color to all representation modes, without changing the opacity.
Implements camitk::InterfaceGeometry.
Referenced by ReorientImage::buildGeometries().
|
overridevirtual |
Set an (r,g,b,a) color to all representation modes.
Implements camitk::InterfaceGeometry.
References surfaceActor.
|
overridevirtual |
call this method with the custom algorithm pipeline output
Implements camitk::InterfaceGeometry.
References mapper, setActorColor(), camitk::InterfaceGeometry::Surface, surfaceActor, surfaceColor, and texture.
|
overridevirtual |
set the enhanced mode
Implements camitk::InterfaceGeometry.
|
finaloverridevirtual |
set the glyph information
Implements camitk::InterfaceGeometry.
References enhancedModes, camitk::InterfaceGeometry::Highlighted, oldAlphaPoints, oldAlphaSurface, oldAlphaWireframe, camitk::InterfaceGeometry::Points, pointsColor, renderingModes, setActorOpacity(), setOpacity(), camitk::InterfaceGeometry::Surface, surfaceColor, camitk::InterfaceGeometry::Wireframe, and wireframeColor.
Referenced by ~Geometry().
|
inlineoverridevirtual |
set the label of this Geometry instance
Implements camitk::InterfaceGeometry.
|
overridevirtual |
display lines as tubes (depeding of the boolean) (only work if the Geometry was defined using a vtkPolyData).
Implements camitk::InterfaceGeometry.
References pointSet.
|
overridevirtual |
Set the mapper scalar range.
Implements camitk::InterfaceGeometry.
|
overridevirtual |
Set the world transform (if the Geometry depends on another Frame)
Implements camitk::InterfaceGeometry.
|
overridevirtual |
Set the opacity of this object. WARNING color field (surfaceColor, ...) are not modified!
Implements camitk::InterfaceGeometry.
References getProp(), and glyphSize.
Referenced by setGlyphType().
|
overridevirtual |
set the point data (may contains a lookup table)
Implements camitk::InterfaceGeometry.
|
overridevirtual |
set a given point position
Implements camitk::InterfaceGeometry.
|
overridevirtual |
set the input data of the Geometry,
Implements camitk::InterfaceGeometry.
References pointSet.
|
inlineoverridevirtual |
Set the actor associated to a rendering mode visible or not.
Implements camitk::InterfaceGeometry.
Referenced by ReorientImage::buildGeometries().
|
overridevirtual |
Set a texture to this object.
Implements camitk::InterfaceGeometry.
|
private |
update position and text of the label
|
private |
Opacity value when this object must be shaded.
|
private |
the filter to convert the DataSet to get a correct vtkPipeline output port
|
private |
the external custom pipeline output (equals to dataOuput if no custom pipeline plugged)
|
private |
to be able to set external custom pipeline
|
private |
Enhanced mode options (the way actors are rendered: normal, hidden, highlighted, shaded)
Referenced by setGlyphType().
|
private |
The additional map for prop (include at least "label" and "glyph")
Referenced by buildLabel(), and getProp().
|
private |
current size of glyph (0.0 means no glyph)
Referenced by buildLabel(), and setOpacity().
|
private |
the label
Referenced by buildLabel().
|
private |
the mapper to create the text
Referenced by buildLabel().
|
private |
the VTK mapper
Referenced by getBoundingRadius(), and setDataConnection().
|
private |
Referenced by setGlyphType().
|
private |
Referenced by setGlyphType().
|
private |
Referenced by setGlyphType().
|
private |
the point actor that manages the representation as a set of points
|
private |
Referenced by setActorColor(), and setGlyphType().
|
private |
The low-level VTK data
Referenced by buildLabel(), getBoundingRadius(), setLinesAsTubes(), setPointSet(), and ~Geometry().
|
private |
Referenced by setGlyphType().
|
private |
the sphere glyph
|
private |
the surface actor that manages the surfacic representation
Referenced by setColor(), and setDataConnection().
|
private |
Referenced by Geometry(), setDataConnection(), and setGlyphType().
|
private |
texture of this object.
Referenced by setDataConnection().
|
private |
the tube filter (creates tubes insead of lines)
Referenced by buildGlyph().
|
private |
the wireframe actor that manages the representation as wireframe
|
private |
Referenced by setGlyphType().
|
private |
the transform filter to place the mesh correctly with respect to its Frame