Computer Assited Medical Intervention Tool Kit  version 4.0
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
camitk::Frame Class Reference

Represents a hierarchy of frames. More...

#include <Frame.h>

Inherits camitk::InterfaceFrame.

Public Member Functions

virtual vtkSmartPointer< vtkAxesActor > getFrameAxisActor ()
 Gives the 3D representation of the frame (based on xyd arrows) More...
 
virtual bool getFrameVisibility (Viewer *viewer) const
 Get the Component Frame visibility for a given viewer. More...
 
virtual void removeFrameChild (InterfaceFrame *frame)
 If the parent frame keeps track of its children, when a child is deleted it should warn its parent. More...
 
virtual void setFrameVisibility (Viewer *viewer, bool visible)
 Set the Component Frame visible for a given viewer. More...
 
is the name of the frame

Default constructor with transformation

is the vtk transformtation to express the current frame coordinates into its parent frame.

If no transform is givent the default transform is set to the identity matrix. is the base frame in the begin of the hierarchical system. If no parent is given, the default parent is set to NULL and considered as the World frame.

 Frame (vtkSmartPointer< vtkTransform > transform=NULL, Frame *parentFrame=NULL)
 
virtual ~Frame ()
 Default Destructor. More...
 
virtual const QString & getFrameName () const
 Hierarchy accessors / Modifyers. More...
 
virtual void setFrameName (QString name)
 Set the Frame Unique identifyer. More...
 
virtual InterfaceFramegetParentFrame () const
 Get the parent frame. More...
 
virtual void setParentFrame (InterfaceFrame *parent, bool keepTransform=true)
 Set the parent frame to the parameter frame. More...
 
virtual const QVector< InterfaceFrame * > & getChildrenFrame () const
 Get the Children Frames from the current Frame in the Frame Hierarchy The Frame hierarchy may not be the same as the Component Hierarchy. More...
 
virtual const vtkSmartPointer< vtkTransform > getTransformFromWorld () const
 Transforms accessors / Modifyers. More...
 
virtual const vtkSmartPointer< vtkTransform > getTransform () const
 Get a the transformation with respect to the parent frame. More...
 
virtual const vtkSmartPointer< vtkTransform > getTransformFromFrame (InterfaceFrame *frame) const
 Get a COPY of the transformation with respect to another frame. More...
 
virtual void setTransform (vtkSmartPointer< vtkTransform > transform)
 Set the current input frame position (according to its parent Frame) More...
 
virtual void resetTransform ()
 Set the current frame transform to identity. More...
 
virtual void translate (double x, double y, double z)
 Apply a translation relative to the current position. More...
 
virtual void rotate (double aroundX, double aroundY, double aroundZ)
 Apply rotations relative to the current position in the alphabetical order (X, Y, Z). More...
 
virtual void rotateVTK (double aroundX, double aroundY, double aroundZ)
 Apply a rotation relative to the current position, using the VTK rotation order (Z, X, Y) More...
 
virtual void setTransformTranslation (double x, double y, double z)
 Set the translation part of the 3D space transformation of the current frame. More...
 
virtual void setTransformTranslationVTK (double x, double y, double z)
 Set the translation part of the 3D space transformation of the current frame. More...
 
virtual void setTransformRotation (double aroundX, double aroundY, double aroundZ)
 Set the rotation part of the 3D space transformation of the current frame. More...
 
virtual void setTransformRotationVTK (double aroundX, double aroundY, double aroundZ)
 Set the rotation part of the 3D space transformation of the current frame. More...
 
void initAttributes ()
 
- Public Member Functions inherited from camitk::InterfaceFrame
virtual ~InterfaceFrame ()
 empty virtual destructor, to avoid memory leak More...
 

Protected Member Functions

QVector< InterfaceFrame * > computeDescendants (InterfaceFrame *)
 Compute all the descendants of the input frame. More...
 

Protected Attributes

QVector< InterfaceFrame * > childrenFrame
 List of children Frames to keep track of Frame hierarchy. More...
 
QString frameName
 Frame unique identifier. More...
 
InterfaceFrameparentFrame
 The Parent Frame. More...
 
vtkSmartPointer< vtkTransformPolyDataFilter > representationTransformFilter
 Transform Filter to store the transformation for the Frame's 3D representation. More...
 
vtkSmartPointer< vtkTransform > transformParentToMe
 Transformation to represent my points (expressed in my frame) in my parent's frame. More...
 
vtkSmartPointer< vtkTransform > transformWorldToMe
 Transformation to represent my points (expressed in my frame) in the world's frame. More...
 

Private Member Functions

virtual void addFrameChild (InterfaceFrame *frame)
 When the current Frame is set to parent, it must update its children list. More...
 

Private Attributes

vtkSmartPointer< vtkAxesActor > axes
 Geometric representation of the frame (vtkAxes) More...
 
QMap< Viewer *, bool > frameViewers
 List of Viewers in which the frame is visible. More...
 

Static Private Attributes

static int nbTotalFrames = 0
 To be able to give a default unique identifier to each created frame. More...
 

Detailed Description

Represents a hierarchy of frames.

Each frame is represented by its parent frame (by default the World frame) and a linear transformation from its parent frame ; i.e. the transformation to represents my points (expressed in my frame) in my parent's frame.

Frames are in a tree hierarchy, in a top down way.

The frame hierarchy only changes the REPRESENTATION of Components, not Components themselves To obtain the real point position of child components, one should apply getWorldTransformation to them.

When a frame moves, it should move from its parent, not from the world frame (except if its parent frame is the world frame).

Constructor & Destructor Documentation

◆ Frame()

Frame::Frame ( vtkSmartPointer< vtkTransform >  transform = NULL,
Frame parentFrame = NULL 
)

◆ ~Frame()

Frame::~Frame ( )
virtual

Member Function Documentation

◆ addFrameChild()

void Frame::addFrameChild ( InterfaceFrame frame)
privatevirtual

When the current Frame is set to parent, it must update its children list.

Implements camitk::InterfaceFrame.

References childrenFrame.

Referenced by Frame().

◆ computeDescendants()

QVector< InterfaceFrame * > Frame::computeDescendants ( InterfaceFrame frame)
protected

Compute all the descendants of the input frame.

References camitk::InterfaceFrame::getChildrenFrame().

Referenced by setParentFrame().

◆ getChildrenFrame()

const QVector< InterfaceFrame * > & Frame::getChildrenFrame ( ) const
virtual

Get the Children Frames from the current Frame in the Frame Hierarchy The Frame hierarchy may not be the same as the Component Hierarchy.

Implements camitk::InterfaceFrame.

References childrenFrame.

◆ getFrameAxisActor()

vtkSmartPointer< vtkAxesActor > Frame::getFrameAxisActor ( )
virtual

Gives the 3D representation of the frame (based on xyd arrows)

Implements camitk::InterfaceFrame.

References axes, and transformWorldToMe.

◆ getFrameName()

const QString & Frame::getFrameName ( ) const
virtual

Hierarchy accessors / Modifyers.

Get the Frame Unique identifyer (can be set by user)

Implements camitk::InterfaceFrame.

References frameName.

Referenced by setParentFrame().

◆ getFrameVisibility()

bool Frame::getFrameVisibility ( Viewer viewer) const
virtual

Get the Component Frame visibility for a given viewer.

Implements camitk::InterfaceFrame.

References frameViewers.

◆ getParentFrame()

InterfaceFrame * Frame::getParentFrame ( ) const
virtual

Get the parent frame.

Implements camitk::InterfaceFrame.

References parentFrame.

◆ getTransform()

const vtkSmartPointer< vtkTransform > Frame::getTransform ( ) const
virtual

Get a the transformation with respect to the parent frame.

Implements camitk::InterfaceFrame.

References transformParentToMe.

◆ getTransformFromFrame()

const vtkSmartPointer< vtkTransform > Frame::getTransformFromFrame ( InterfaceFrame frame) const
virtual

Get a COPY of the transformation with respect to another frame.

Implements camitk::InterfaceFrame.

References camitk::InterfaceFrame::getTransformFromWorld(), and transformWorldToMe.

Referenced by setParentFrame().

◆ getTransformFromWorld()

const vtkSmartPointer< vtkTransform > Frame::getTransformFromWorld ( ) const
virtual

Transforms accessors / Modifyers.

Get a the transformation with respect to the world frame

Implements camitk::InterfaceFrame.

References transformWorldToMe.

Referenced by Frame().

◆ initAttributes()

void Frame::initAttributes ( )

Constructors helpers Private method to initialize private attributes (called only in constrctors but in all constructors)

References axes, childrenFrame, frameName, nbTotalFrames, parentFrame, representationTransformFilter, transformParentToMe, and transformWorldToMe.

Referenced by Frame().

◆ removeFrameChild()

void Frame::removeFrameChild ( InterfaceFrame frame)
virtual

If the parent frame keeps track of its children, when a child is deleted it should warn its parent.

Implements camitk::InterfaceFrame.

References childrenFrame.

Referenced by setParentFrame().

◆ resetTransform()

void Frame::resetTransform ( )
virtual

Set the current frame transform to identity.

In other words, the current frame and its parent share the same 3D location.

Implements camitk::InterfaceFrame.

References representationTransformFilter, transformParentToMe, and transformWorldToMe.

◆ rotate()

void Frame::rotate ( double  aroundX,
double  aroundY,
double  aroundZ 
)
virtual

Apply rotations relative to the current position in the alphabetical order (X, Y, Z).

Note
Prefer using the rotateVTK method if possible, this one involves errors when retrieving rotation angles from a rotation matrix, as we use a VTK method for this.

Implements camitk::InterfaceFrame.

References representationTransformFilter, transformParentToMe, and transformWorldToMe.

◆ rotateVTK()

void Frame::rotateVTK ( double  aroundX,
double  aroundY,
double  aroundZ 
)
virtual

Apply a rotation relative to the current position, using the VTK rotation order (Z, X, Y)

Note
Prefer using this method if you can.

Implements camitk::InterfaceFrame.

References representationTransformFilter, transformParentToMe, and transformWorldToMe.

◆ setFrameName()

void Frame::setFrameName ( QString  name)
virtual

Set the Frame Unique identifyer.

Implements camitk::InterfaceFrame.

References frameName.

◆ setFrameVisibility()

void Frame::setFrameVisibility ( Viewer viewer,
bool  visible 
)
virtual

Set the Component Frame visible for a given viewer.

Implements camitk::InterfaceFrame.

References frameViewers.

◆ setParentFrame()

void Frame::setParentFrame ( InterfaceFrame parent,
bool  keepTransform = true 
)
virtual

Set the parent frame to the parameter frame.

During the parent transition you have the choice to keep or not the frame transform. If you keep the frame's initial transform after the parent transition, the frame's position will change as its transform's target frame changes. If you decide not to keep the initial frame's transfor, this one is updated during the parent transition in order to keep the original frame position (in the world frame).

Caution: if the parent frame in parameter is either the current frame or one of its descendant, the parent frame is set to the world frame.

Implements camitk::InterfaceFrame.

References camitk::InterfaceFrame::addFrameChild(), computeDescendants(), getFrameName(), camitk::InterfaceFrame::getFrameName(), getTransformFromFrame(), camitk::InterfaceFrame::getTransformFromWorld(), parentFrame, removeFrameChild(), camitk::InterfaceFrame::removeFrameChild(), camitk::InterfaceFrame::setParentFrame(), setTransform(), transformParentToMe, and transformWorldToMe.

Referenced by Frame().

◆ setTransform()

void Frame::setTransform ( vtkSmartPointer< vtkTransform >  transform)
virtual

Set the current input frame position (according to its parent Frame)

Parameters
transformThe 3D transform of the current frame to its parent.

Implements camitk::InterfaceFrame.

References representationTransformFilter, transformParentToMe, and transformWorldToMe.

Referenced by Frame(), and setParentFrame().

◆ setTransformRotation()

void Frame::setTransformRotation ( double  aroundX,
double  aroundY,
double  aroundZ 
)
virtual

Set the rotation part of the 3D space transformation of the current frame.

Note
Reminder: A 3D space transform is a 4x4 matrix, composed of a rotation and a translation.

Implements camitk::InterfaceFrame.

References representationTransformFilter, transformParentToMe, and transformWorldToMe.

◆ setTransformRotationVTK()

void Frame::setTransformRotationVTK ( double  aroundX,
double  aroundY,
double  aroundZ 
)
virtual

Set the rotation part of the 3D space transformation of the current frame.

This translation uses the VTK rotation order (Z, X, Y) system.

Note
Reminder: A 3D space transform is a 4x4 matrix, composed of a rotation and a translation.

Implements camitk::InterfaceFrame.

References representationTransformFilter, transformParentToMe, and transformWorldToMe.

◆ setTransformTranslation()

void Frame::setTransformTranslation ( double  x,
double  y,
double  z 
)
virtual

Set the translation part of the 3D space transformation of the current frame.

Note
Reminder: A 3D space transform is a 4x4 matrix, composed of a rotation and a translation.

Implements camitk::InterfaceFrame.

References representationTransformFilter, transformParentToMe, and transformWorldToMe.

◆ setTransformTranslationVTK()

void Frame::setTransformTranslationVTK ( double  x,
double  y,
double  z 
)
virtual

Set the translation part of the 3D space transformation of the current frame.

This translation uses the VTK rotation order (Z, X, Y) system.

Note
Reminder: A 3D space transform is a 4x4 matrix, composed of a rotation and a translation.

Implements camitk::InterfaceFrame.

References representationTransformFilter, transformParentToMe, and transformWorldToMe.

◆ translate()

void Frame::translate ( double  x,
double  y,
double  z 
)
virtual

Apply a translation relative to the current position.

Implements camitk::InterfaceFrame.

References representationTransformFilter, transformParentToMe, and transformWorldToMe.

Member Data Documentation

◆ axes

vtkSmartPointer<vtkAxesActor> camitk::Frame::axes
private

Geometric representation of the frame (vtkAxes)

Referenced by getFrameAxisActor(), and initAttributes().

◆ childrenFrame

QVector<InterfaceFrame *> camitk::Frame::childrenFrame
protected

List of children Frames to keep track of Frame hierarchy.

Referenced by addFrameChild(), getChildrenFrame(), initAttributes(), removeFrameChild(), and ~Frame().

◆ frameName

QString camitk::Frame::frameName
protected

Frame unique identifier.

Referenced by getFrameName(), initAttributes(), and setFrameName().

◆ frameViewers

QMap<Viewer *, bool> camitk::Frame::frameViewers
private

List of Viewers in which the frame is visible.

Referenced by getFrameVisibility(), setFrameVisibility(), and ~Frame().

◆ nbTotalFrames

int Frame::nbTotalFrames = 0
staticprivate

To be able to give a default unique identifier to each created frame.

Referenced by initAttributes().

◆ parentFrame

InterfaceFrame* camitk::Frame::parentFrame
protected

The Parent Frame.

If it is NULL, then the parent is the World Frame.

Referenced by Frame(), getParentFrame(), initAttributes(), setParentFrame(), and ~Frame().

◆ representationTransformFilter

vtkSmartPointer<vtkTransformPolyDataFilter> camitk::Frame::representationTransformFilter
protected

◆ transformParentToMe

vtkSmartPointer<vtkTransform> camitk::Frame::transformParentToMe
protected

Transformation to represent my points (expressed in my frame) in my parent's frame.

Transformation to apply to this (and children) data to place them in my parent's frame.

Referenced by Frame(), getTransform(), initAttributes(), resetTransform(), rotate(), rotateVTK(), setParentFrame(), setTransform(), setTransformRotation(), setTransformRotationVTK(), setTransformTranslation(), setTransformTranslationVTK(), and translate().

◆ transformWorldToMe

vtkSmartPointer<vtkTransform> camitk::Frame::transformWorldToMe
protected

Transformation to represent my points (expressed in my frame) in the world's frame.

i.e. Transformation to apply to this (and children) data to place them in the world's frame.

This transformation is always re-calculated and stored only for convenience purpose. It can not be set by a user.

Referenced by Frame(), getFrameAxisActor(), getTransformFromFrame(), getTransformFromWorld(), initAttributes(), resetTransform(), rotate(), rotateVTK(), setParentFrame(), setTransform(), setTransformRotation(), setTransformRotationVTK(), setTransformTranslation(), setTransformTranslationVTK(), and translate().


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