Computer Assited Medical Intervention Tool Kit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
StructuralComponentDC Class Reference

The manager of the Structural component data. More...

#include <StructuralComponentDC.h>

+ Inheritance diagram for StructuralComponentDC:

Public Member Functions

GeometrycellsToGeometry ()
 create an Geometry (composed by vtk unstructured grid of n cells) from the managed SC which is a list of cells
StructuralComponent::ComposedBy composedBy ()
 return if the structural component is a list of cells or of atoms
virtual void createPointData ()
 create all the point data to display specific information (only works for SCs that have a surface representation).
virtual void destroyPointData ()
 destroy all the point data
StructuralComponent * getSC ()
 convenient methods
 StructuralComponentDC (camitk::Component *parent, PMManagerDC *pmManagerDC, StructuralComponent *sc, bool delayRepresentationInit=false)
 Default constructor, set the 3rd parameter to false to delay the construction of the Geometry (represention of the DC in 3D).
void updateAtoms ()
 the method to update both atomDCs vector and atomVtkPointsIndexMap
void updatePosition (AtomDC *, int atomOrderNr=-1)
 This atom position has been changed, the 3D representation has to be updated.
virtual ~StructuralComponentDC ()
 destructor
camitk::Component rewritten

This methods are overloaded from camitk::Component to give the StructuralComponentDC and its sub classe CellDC a different behaviour.

virtual QPixmap getIcon ()
 Get the pixmap that will be displayed for this node.
virtual void setPointSet (vtkSmartPointer< vtkPointSet >)
 if the vtkPointSet is modified externally (e.g. by an operator), change the PM structure
virtual void cellPicked (vtkIdType, bool)
 select a specific sub DC using the cell id (do nothing if the SC is not composed by cells)
virtual void pointPicked (vtkIdType, bool)
 select a specific sub DC using the point id (do nothing if the SC is not composed by atoms)
virtual void setSelected (const bool, const bool recursive=false)
 do not select sub DC if they are AtomDC (AtomDC can only be selected individually)
virtual void setEnhancedModes (const EnhancedModes)
 do not set enhanced modes if children are atomDC
virtual void setRenderingModes (const RenderingModes)
 set the rendering mode of the StructuralComponent as well as the DC
virtual void setActorColor (const RenderingModes, const double, const double, const double)
 Set the color of given representation modes.
virtual void setActorColor (const RenderingModes, double[4])
 Set the color of given representation modes.
virtual void setColor (const double, const double, const double)
 Set an (r,g,b) color to all representation modes, without changing the opacity.
virtual void setColor (const double, const double, const double, const double)
 Set an (r,g,b,a) color to all representation modes.
virtual void addChild (InterfaceNode *)
 add a sub DC: overloaded method to allow change in the physical model data representation
virtual void removeChild (InterfaceNode *)
 remove a sub DC: overloaded method to allow change in the physical model data representation
virtual QMenu * getPopupMenu (QWidget *parent)
 Overriden method so that we actually can build a popup menu with different actions.
virtual QObject * getPropertyObject ()
 reimplement this method to give the property object to the property editor
- Public Member Functions inherited from ComponentDC
 ComponentDC (camitk::Component *parent, PMManagerDC *pmManagerDC,::Component *c=NULL)
 constructors
::ComponentgetComponent ()
 return the component that this dc is managing
virtual PMManagerDCgetPMManagerDC ()
 get the PMManagerDC (given during instanciation), allows to get PML/Component maps
virtual void updateProperty (QString name, QVariant value)
 update a specific property
virtual ~ComponentDC ()
virtual void setOpacity (const double)
 

virtual const EnhancedModes getEnhancedModes () const
 get the current enhanced mode
virtual const RenderingModes getRenderingModes () const
 see Component.cpp
virtual void setName (const QString &)
 set the name to be displayed
virtual void deleteChildren ()
 remove a sub DC: overloaded method to avoir deletion of children that are used in more than one SCDC (that have more than one parent)
- Public Member Functions inherited from camitk::MeshComponent
vtkIdType getPickedCellId ()
 get the last pick point id,
vtkIdType getPickedPointId ()
 get the last pick point id,
 MeshComponent (const QString &file) throw (AbortException)
 Creates a top-level MeshComponent from a file.
 MeshComponent (vtkSmartPointer< vtkPointSet > aPointSet, const QString &name)
 Creates a top-level MeshComponent from a vtkPointSet (and instanciate its 3D representation).
 MeshComponent (Component *parentComponent, vtkSmartPointer< vtkPointSet > aPointSet, const QString &name)
 Creates a MeshComponent as a sub component of another Component using a vtkPointSet (and instanciate its 3D representation).
virtual ~MeshComponent ()
 Destructor.
- Public Member Functions inherited from camitk::Component
 Component (const QString &file, const QString &name, Representation rep=NO_REPRESENTATION)
 Component constructor for top-level component (please use the other constructor for sub-level components).
 Component (Component *parentComponent, const QString &name, Representation rep=NO_REPRESENTATION) throw (AbortException)
 Component constructor for a Component that is a child of another Component You should not use this constructor for a top-level component.
virtual ~Component ()
 default destructor
Representation getRepresentation () const
 return the type of representation concretely implemented by this Component in the InteractiveViewer.
bool isTopLevel () const
 return true if this component is a top-level component
virtual ComponentgetParentComponent ()
 get the parent component
virtual ComponentgetTopLevelComponent ()
 get the top-level component
virtual void setModified (bool modified=true)
 set the modified flag
virtual bool getModified () const
 set the modified flag
virtual void setVisibility (Viewer *, bool)
 set the visibility for a viewer
virtual bool getVisibility (Viewer *) const
 get the visibility of a viewer
virtual void refresh () const
 refresh all the viewer that are currently displaying this Component
virtual void refreshInterfaceNode ()
 Asks all viewers that are currently displaying this Component to rebuild the representation of the InterfaceNode for this Component.
virtual bool isSelected () const
 Check if this data component is selected.
const QString getFileName () const
 get the file name where the data have to be stored/were stored
void setFileName (const QString &)
 set the file name where the data have to be stored
bool event (QEvent *e)
 Overriden from QObject, this one is only intercepting signal for dynamic property changed (see constructor).
QMenu * getActionAndPopupMenu ()
 Get a QMenu that contains all the action that can be applied to this component + the popup menu (if exists).
QStringList getHierarchy ()
bool isInstanceOf (QString className)
 Assert that a Component instance really inherits from a given className.
virtual QWidget * getPropertyWidget (QWidget *parent=0)
 get the property widget to display.
virtual void attachChild (InterfaceNode *)
 add a child Component (but leave its parent unchanged)
virtual void setParent (InterfaceNode *)
 set the parent Component. This method automatically remove this Component from its previous (if already had one parent Component)
virtual QString getName () const
 get the name to be displayed
virtual const ComponentListgetChildren ()
 get the list of the InterfaceNode children (sub items in the hierarchy)
virtual bool doubleClicked ()
 this method is called each time the InterfaceNode is double clicked by the user.
virtual InterfaceNodegetParent ()
 get the parent Component
virtual bool inItalic () const
 A component name is not displayed in italic by default.
const QString getLabel () const
void setLabel (QString newName)
 set the string used to display the label, do the same as setName
virtual vtkSmartPointer
< vtkPointSet > 
getPointSet ()
virtual void setPointData (vtkSmartPointer< vtkDataArray > param)
 set the point data (may contains a lookup table).
virtual vtkSmartPointer
< vtkAlgorithmOutput > 
getDataPort () const
 get the custom algorithm pipeline input.
virtual void setDataConnection (vtkSmartPointer< vtkAlgorithmOutput > param)
 Set/reset the connection for the InterfaceGeometry internal algorithm.
virtual vtkSmartPointer< vtkActor > getActor (const RenderingModes param)
 Return the actor for the representation mode, NULL if the actor doesn't exist.
virtual vtkSmartPointer< vtkProp > getProp (const QString &param)
 Return the vtkProp (actors, volumes and annotations) corresponding to the given name.
virtual unsigned int getNumberOfProp () const
 return the number of additional prop
virtual vtkSmartPointer< vtkProp > getProp (unsigned int index)
 return an additional prop by its index
virtual bool addProp (const QString &name, vtkSmartPointer< vtkProp > prop)
 insert an additional prop, defining it by its name (default visibility = false)
virtual bool removeProp (const QString &name)
 remove a given additional prop.
virtual void getBounds (double bounds[6])
 compute the object's bounding box [xmin,xmax, ymin,ymax, zmin,zmax], see Component.cpp
virtual double getBoundingRadius ()
 compute the object's bounding sphere radius,
virtual void setPointPosition (const unsigned int param1, const double param2, const double param3, const double param4)
 set a given point position
virtual void getActorColor (const RenderingModes, double[4])
 see Component.cpp
virtual void setActorOpacity (const RenderingModes param1, const double param2)
 Set the opacity of this representation modes. WARNING color field (surfaceColor, ...) are not modified!
virtual double getActorOpacity (const RenderingModes param) const
 Return the opacity of a given renderng mode.
virtual void setTexture (vtkSmartPointer< vtkTexture > param)
 Set a texture to this object.
virtual void setGlyphType (const GlyphTypes type, const double size=0.0)
 Set the glyph type (a glyph is a geometric representation attached to every point in the input dataset).
virtual void setLinesAsTubes (bool param)
 set the lines as tubes (works only for vtkDataSet representation that contains lines)
virtual vtkSmartPointer
< vtkImageData > 
getImageData () const
 Return the displayed images as a vtkImageData.
virtual void setOriginalVolume (vtkSmartPointer< vtkImageData > param)
 set the original volume image data (the source vtkImageData before any reslice) and refresh the vtk pipeline
virtual vtkSmartPointer
< vtkImageActor > 
get2DImageActor () const
 Return the vtkImageActor (vtkProp) representing a slice to be displayed in 2D.
virtual vtkSmartPointer
< vtkImageActor > 
get3DImageActor () const
 Return the vtkImageActor (vtkProp) representing a slice to be displayed in 2D.
virtual vtkSmartPointer< vtkActor > getPickPlaneActor () const
 Return the vtkActor used to pick pixels in the slices.
virtual vtkSmartPointer< vtkActor > getPixelActor ()
 Return the vtkActor used to pick pixels in the slices.
virtual void pixelPicked (double param1, double param2, double param3)
 This method is called when the associated plane has been picked in the InteractiveViewer, the given coordinates is position where the plane was picked.
virtual void updatePickPlane ()
virtual void setSlice (int param)
 Set the current slice index.
virtual void setSlice (double param1, double param2, double param3)
 Set the slice corresponding to the given world coordinates.
virtual void setRotationX (double param)
 Set the current angle to the arbitrary slice.
virtual void setRotationY (double param)
virtual void setRotationZ (double param)
virtual int getNumberOfColors () const
 Return the number of colors in the images.
virtual void setPixelRealPosition (double param1, double param2, double param3)
 move the pixel selection green indicator (pixelActor) to the given real position
virtual double getRotationX () const
 see Component.cpp
virtual double getRotationY () const
 see Component.cpp
virtual double getRotationZ () const
 see Component.cpp
virtual int getNumberOfSlices () const
 see Component.cpp
virtual int getSlice () const
 see Component.cpp
- Public Member Functions inherited from camitk::InterfaceProperty
virtual ~InterfaceProperty ()
 empty virtual destructor, to avoid memory leak
- Public Member Functions inherited from camitk::InterfaceNode
virtual ~InterfaceNode ()
 empty virtual destructor, to avoid memory leak
- Public Member Functions inherited from camitk::InterfaceGeometry
virtual ~InterfaceGeometry ()
 empty virtual destructor, to avoid memory leak
- Public Member Functions inherited from camitk::InterfaceBitMap
virtual ~InterfaceBitMap ()
 virtual destructor

Static Public Member Functions

static vtkSmartPointer
< vtkUnstructuredGrid > 
structuralComponentToVtk (StructuralComponent *, std::AtomVtkPointsIndexMap *)
 Build an unstructured grid from a Structural Component, and build the correct AtomVtkPointsIndexMap.
static vtkSmartPointer
< vtkUnstructuredGrid > 
structuralComponentToVtk (StructuralComponent *)
 Build an unstructured grid from a Structural Component.

Protected Attributes

unsigned int nrOfAtoms
 nr of atoms
vtkSmartPointer< vtkDoubleArray > pointData
 the point data array
- Protected Attributes inherited from ComponentDC
::ComponentmyComponent
 the managed Component
PMManagerDCmyPMManagerDC
 the PMManagerDC

Private Member Functions

GeometryatomsToGeometry ()
 create an Geometry (a vtk unstructured grid of 1 poly vertex) from the managed SC which is a list of atoms
virtual void initRepresentation ()
 the concrete building of the geometry

Private Attributes

std::vector< AtomDC * > atomDCs
 list of atom DCs.
std::vector< unsigned int > cellIdToBeRemoved
 cell ids in the vtk structures to be removed
StructuralComponentDCPopupmyPopupMenu
 the popup menu
StructuralComponentDCPropertiesmyProp
 the SC DC properties
unsigned int nrOfParts
 cumulative nr of cell and points.

Static Private Attributes

static QPixmap * myPixmap = NULL
 the StructuralComponentDC pixmap

Additional Inherited Members

- Public Types inherited from camitk::Component
enum  Representation { GEOMETRY, SLICE, NO_REPRESENTATION }
 The different representation that can be implemented to represent this Component in the InteractiveViewer. More...
- Public Attributes inherited from camitk::InterfaceBitMap
QMap< QString, vtkSmartPointer
< vtkProp > > 
extraProp
 The additional map for prop (include at least "label" and "glyph".
- Protected Member Functions inherited from camitk::MeshComponent
virtual void initRepresentation (vtkSmartPointer< vtkPointSet >)
 build the instance of Geometry from the given vtkPointSet

Detailed Description

The manager of the Structural component data.

Maintains a map to tell at what position is a give atom in the vtkPoints list. This class gives also a conveniant method to save a StructuralComponent in a vtk unstructured grid.

Constructor & Destructor Documentation

StructuralComponentDC::StructuralComponentDC ( camitk::Component parent,
PMManagerDC pmManagerDC,
StructuralComponent *  sc,
bool  delayRepresentationInit = false 
)

Default constructor, set the 3rd parameter to false to delay the construction of the Geometry (represention of the DC in 3D).

delayRepresentationInit should always be set to true when the constructor is called by a sub-class (see CellDC constructor). If delayRepresentationInit is false (default) and if the default mode is visible, then the SCDC constructor will build an Geometry considering a SC not a sub-class (i.e. Cell).

References PMManagerDC::addStructuralComponentDCPair(), camitk::Component::attachChild(), PMManagerDC::getDC(), getSC(), initRepresentation(), ComponentDC::myPMManagerDC, myPopupMenu, myProp, nrOfAtoms, nrOfParts, pointData, PMManagerDC::progressOneStep(), ComponentDC::setName(), and camitk::Component::setVisibility().

StructuralComponentDC::~StructuralComponentDC ( )
virtual

destructor

References destroyPointData(), myPopupMenu, and myProp.

Member Function Documentation

void StructuralComponentDC::addChild ( InterfaceNode childNode)
virtual

add a sub DC: overloaded method to allow change in the physical model data representation

Reimplemented from camitk::Component.

References getSC().

Geometry * StructuralComponentDC::atomsToGeometry ( )
private

create an Geometry (a vtk unstructured grid of 1 poly vertex) from the managed SC which is a list of atoms

References camitk::Component::childrenComponent, camitk::Component::getName(), AtomDC::getPosition(), getSC(), ComponentDC::myPMManagerDC, nrOfAtoms, and PMManagerDC::toDCRenderingMode().

Referenced by initRepresentation().

void StructuralComponentDC::cellPicked ( vtkIdType  cellId,
bool  pickingIsSelecting 
)
virtual

select a specific sub DC using the cell id (do nothing if the SC is not composed by cells)

Reimplemented from camitk::MeshComponent.

References camitk::Component::childrenComponent, composedBy(), and getSC().

Geometry * StructuralComponentDC::cellsToGeometry ( )
StructuralComponent::ComposedBy StructuralComponentDC::composedBy ( )

return if the structural component is a list of cells or of atoms

References getSC().

Referenced by cellPicked(), createPointData(), initRepresentation(), pointPicked(), setEnhancedModes(), setPointSet(), setSelected(), updateAtoms(), and updatePosition().

void StructuralComponentDC::createPointData ( )
virtual

create all the point data to display specific information (only works for SCs that have a surface representation).

This will automatically fills up the AtomDC point data pointers.

Reimplemented from ComponentDC.

Reimplemented in CellDC.

References atomDCs, composedBy(), getSC(), pointData, and camitk::Component::setPointData().

void StructuralComponentDC::destroyPointData ( )
virtual

destroy all the point data

Reimplemented from ComponentDC.

Reimplemented in CellDC.

References atomDCs, pointData, and camitk::Component::setPointData().

Referenced by ~StructuralComponentDC().

QPixmap StructuralComponentDC::getIcon ( )
virtual

Get the pixmap that will be displayed for this node.

If you want your component to have a nice pixmap displayed in the explorer, for example, you just need to
1. declare a new static member and redefines the getIcon() method (in MyComponent.h):
@code 

public: virtual QPixmap getIcon(); private: static QPixmap * myPixmap; // declare a ptr here (it is static for optimization)

  1. add these lines in your code (in MyComponent.cpp):
    // use this two lines or better use a Qt resource bundle (recommanded!)
    #include "myComponent_pixmap.xpm" // include the pixmap resource file or use a Qt resource bundle
    QPixmap * MyComponent::myPixmap = NULL; // static initialization
    // check if the class instance was already used somewhere
    if (!myPixmap) {
    // create the pixmap from the data like this (or using the Qt resource bundle, see Qt documentation)
    myPixmap = new QPixmap(myComponent_pixmap); // myComponent_pixmap is the name of the char[] found in the .xpm file
    }
    // return the object (not the pointer
    return (*myPixmap);
    }
    And that all folks! A nice icon will be now used to display your component!
Note
Recommanded pixmap size is 20x20 (not nice, but efficient)...

Reimplemented from camitk::Component.

Reimplemented in CellDC.

References myPixmap.

QMenu * StructuralComponentDC::getPopupMenu ( QWidget *  parent)
virtual

Overriden method so that we actually can build a popup menu with different actions.

Reimplemented from camitk::Component.

References myPopupMenu.

QObject * StructuralComponentDC::getPropertyObject ( )
virtual

reimplement this method to give the property object to the property editor

Reimplemented from ComponentDC.

Reimplemented in CellDC.

References myProp.

StructuralComponent * StructuralComponentDC::getSC ( )
inline
void StructuralComponentDC::initRepresentation ( )
privatevirtual

the concrete building of the geometry

References atomsToGeometry(), cellsToGeometry(), composedBy(), getSC(), camitk::Component::myGeometry, and updateAtoms().

Referenced by StructuralComponentDC().

void StructuralComponentDC::pointPicked ( vtkIdType  pointId,
bool  pickingIsSelecting 
)
virtual

select a specific sub DC using the point id (do nothing if the SC is not composed by atoms)

Reimplemented from camitk::MeshComponent.

References atomDCs, CAMITK_ERROR, camitk::Component::childrenComponent, composedBy(), camitk::Component::getName(), and getSC().

void StructuralComponentDC::removeChild ( InterfaceNode childNode)
virtual

remove a sub DC: overloaded method to allow change in the physical model data representation

Reimplemented from camitk::Component.

References cellIdToBeRemoved, camitk::Component::childrenComponent, and getSC().

void StructuralComponentDC::setActorColor ( const RenderingModes  ,
const double  ,
const double  ,
const double   
)
virtual

Set the color of given representation modes.

Reimplemented from camitk::Component.

References camitk::Component::getActorColor(), and getSC().

Referenced by setActorColor().

void StructuralComponentDC::setActorColor ( const RenderingModes  ,
double  [4] 
)
virtual

Set the color of given representation modes.

Reimplemented from camitk::Component.

References getSC(), and setActorColor().

void StructuralComponentDC::setColor ( const double  ,
const double  ,
const double   
)
virtual

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

Reimplemented from camitk::Component.

References getSC().

Referenced by setColor().

void StructuralComponentDC::setColor ( const double  ,
const double  ,
const double  ,
const double   
)
virtual

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

Reimplemented from camitk::Component.

References getSC(), and setColor().

void StructuralComponentDC::setEnhancedModes ( const EnhancedModes  em)
virtual

do not set enhanced modes if children are atomDC

Reimplemented from camitk::Component.

References composedBy(), and getSC().

void StructuralComponentDC::setPointSet ( vtkSmartPointer< vtkPointSet >  newPointSet)
virtual

if the vtkPointSet is modified externally (e.g. by an operator), change the PM structure

Reimplemented from camitk::Component.

References atomDCs, camitk::Component::childrenComponent, composedBy(), getSC(), camitk::Component::getTopLevelComponent(), camitk::Component::myGeometry, camitk::Component::setModified(), and AtomDC::setPosition().

void StructuralComponentDC::setRenderingModes ( const RenderingModes  m)
virtual

set the rendering mode of the StructuralComponent as well as the DC

Reimplemented from camitk::Component.

References getSC(), ComponentDC::myPMManagerDC, and PMManagerDC::toPMRenderingMode().

Referenced by CellDC::setSelected().

void StructuralComponentDC::setSelected ( const bool  s,
const bool  recursive = false 
)
virtual

do not select sub DC if they are AtomDC (AtomDC can only be selected individually)

Reimplemented from camitk::Component.

Reimplemented in CellDC.

References composedBy(), and getSC().

vtkSmartPointer< vtkUnstructuredGrid > StructuralComponentDC::structuralComponentToVtk ( StructuralComponent *  sc,
std::AtomVtkPointsIndexMap *  atomVtkPointsIndexMap 
)
static

Build an unstructured grid from a Structural Component, and build the correct AtomVtkPointsIndexMap.

Referenced by AnyDecoration::AnyDecoration(), and structuralComponentToVtk().

vtkSmartPointer< vtkUnstructuredGrid > StructuralComponentDC::structuralComponentToVtk ( StructuralComponent *  sc)
static

Build an unstructured grid from a Structural Component.

References structuralComponentToVtk().

void StructuralComponentDC::updateAtoms ( )
void StructuralComponentDC::updatePosition ( AtomDC modifiedAtomDC,
int  atomOrderNr = -1 
)

This atom position has been changed, the 3D representation has to be updated.

For optimization reason: if you know the atom order nr in this SCDC, please give it! An atom in the cell position has been changed this method starts the update cascade process, consisting in updating all the 3D representation of the all the components containing this component, then of all the components containing all the components containing this component... etc... up to the PM void updatePosition(AtomDC *, CellDC *);

References composedBy(), AtomDC::getAtom(), AtomDC::getOrderNumberInSCDC(), getSC(), camitk::Component::isInstanceOf(), camitk::Component::myGeometry, and camitk::InterfaceGeometry::setPointPosition().

Member Data Documentation

std::vector<AtomDC *> StructuralComponentDC::atomDCs
private

list of atom DCs.

This list is used only when the structural component is made of cells. This list is here to speed up the application: When you need atom's DC you could always call the PMManager::getDC method, but that is at a high cost. So why not maintain the list of the Atom DCs of the structural component. This list is build/update in the updateAtoms method.

Referenced by cellsToGeometry(), createPointData(), destroyPointData(), pointPicked(), setPointSet(), and updateAtoms().

std::vector<unsigned int> StructuralComponentDC::cellIdToBeRemoved
private

cell ids in the vtk structures to be removed

Referenced by removeChild().

QPixmap * StructuralComponentDC::myPixmap = NULL
staticprivate

the StructuralComponentDC pixmap

Referenced by getIcon().

StructuralComponentDCPopup* StructuralComponentDC::myPopupMenu
private
StructuralComponentDCProperties* StructuralComponentDC::myProp
private

the SC DC properties

Referenced by getPropertyObject(), StructuralComponentDC(), and ~StructuralComponentDC().

unsigned int StructuralComponentDC::nrOfAtoms
protected
unsigned int StructuralComponentDC::nrOfParts
private

cumulative nr of cell and points.

Example: if sc=[c0,c1] , c0=[a0,a2,a3] and c1=[a1,a2,a4,a0] then nrOfParts = 1 + 3 + 1 + 4 = 9. Updated in updateAtoms()

Referenced by cellsToGeometry(), StructuralComponentDC(), and updateAtoms().

vtkSmartPointer<vtkDoubleArray> StructuralComponentDC::pointData
protected

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