Computer Assited Medical Intervention Tool Kit  version 5.0
MeshProjection.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2021 Univ. Grenoble Alpes, CNRS, Grenoble INP, TIMC, 38000 Grenoble, France
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 
27 #ifndef MESHPROJECTION_H
28 #define MESHPROJECTION_H
29 
30 #include <Action.h>
31 
32 #include <MeshComponent.h>
33 #include <ImageComponent.h>
34 #include <Slice.h>
35 #include <InteractiveViewer.h>
36 
37 //--vtk
38 // disable warning generated by clang about the surrounded headers
39 #include <CamiTKDisableWarnings>
40 #include <vtkPolyDataMapper.h>
41 #include <CamiTKReEnableWarnings>
42 
43 #include <vtkPlane.h>
44 
54  Q_OBJECT
55 
56 public:
57 
60 
62  virtual ~MeshProjection();
63 
65  virtual bool event(QEvent* e);
66 
68  virtual QWidget* getWidget();
69 
70 public slots:
77 
79  void updateCuttingPlane();
80 
82  void hide();
83 
84 private:
87 
90 
93 
94  // used to map item id with component for the "Component List" property
95  QList<camitk::ImageComponent*> imageComponentList;
96 
98  void updateVisibility();
99 
101  QMap<camitk::Slice::SliceOrientation, vtkSmartPointer<vtkPolyDataMapper>> cutterMapperMap;
102 
104  QMap<camitk::Slice::SliceOrientation, vtkSmartPointer<vtkActor>> contourActorMap;
105 
107  QMap<camitk::Slice::SliceOrientation, vtkSmartPointer<vtkActor>> contourActorIn2DViewerMap;
108 
110  QMap<camitk::Slice::SliceOrientation, vtkSmartPointer<vtkPlane>> cuttingPlaneMap;
111 
115 
118 
121 
123  vtkSmartPointer<vtkActor> getNewActor(camitk::Slice::SliceOrientation);
124 
126  vtkSmartPointer<vtkPlane> getNewPlane(camitk::Slice::SliceOrientation);
127 
130 
132  void updateContourLineWidth();
133 };
134 
135 #endif // MESHPROJECTION_H
136 
camitk::ImageComponent::getCoronalSlices
SingleImageComponent * getCoronalSlices()
Returns the coronal slice.
Definition: ImageComponent.cpp:477
MeshProjection::~MeshProjection
virtual ~MeshProjection()
Default Destructor.
Definition: MeshProjection.cpp:103
camitk::ArbitrarySingleImageComponent::getImageCenterAndTranslationVectorInParent
void getImageCenterAndTranslationVectorInParent(double C_P[4], double Z_P[4])
Compute the current position of the image center and the z direction vector in the parent coordinate ...
Definition: ArbitrarySingleImageComponent.cpp:342
camitk::Action::setFamily
void setFamily(QString family)
the name of the family in which this action is associated
Definition: Action.cpp:136
MeshProjection::hide
void hide()
remove the contour from the viewers if the mesh is closed / destroyed
Definition: MeshProjection.cpp:499
MeshProjection::updateComponents
void updateComponents(camitk::MeshComponent *)
update the managed mesh and check the change in the image component using the corresponding property
Definition: MeshProjection.cpp:184
CAMITK_WARNING
#define CAMITK_WARNING(MSG)
Log for warning verbosity (the most common one) Will appear by default.
Definition: Log.h:266
MeshProjection::contourActorIn2DViewerMap
QMap< camitk::Slice::SliceOrientation, vtkSmartPointer< vtkActor > > contourActorIn2DViewerMap
the mesh contours in the 2D views (with the proper transform that makes it appear in the slice viewer...
Definition: MeshProjection.h:130
SingleImageComponent.h
camitk::Action::SUCCESS
@ SUCCESS
everything went according to plan
Definition: Action.h:248
MeshProjection::getWidget
virtual QWidget * getWidget()
method called when the action when the action is triggered (i.e. started)
Definition: MeshProjection.cpp:108
camitk::Property::setEnumTypeName
void setEnumTypeName(QString)
if the property's type is an enum, set the name of the registered Qt Enum.
Definition: Property.cpp:108
camitk::Action::ApplyStatus
ApplyStatus
Definition: Action.h:247
camitk::Action::setName
void setName(QString name)
Definition: Action.cpp:120
camitk::Component::getSlice
int getSlice() const override
see Component.cpp
Definition: sdk/libraries/core/component/Component.cpp:749
MeshProjection
Show the mesh contour in the slice viewers.
Definition: MeshProjection.h:53
camitk::Action::setAutoUpdateProperties
void setAutoUpdateProperties(bool)
are the properties to be udpated every time the user makes a change in the widget (default is false)?
Definition: Action.cpp:426
camitk::Action::setComponent
void setComponent(QString component)
the name of the component class that can be used by this action
Definition: Action.cpp:131
MeshProjection::cuttingPlaneMap
QMap< camitk::Slice::SliceOrientation, vtkSmartPointer< vtkPlane > > cuttingPlaneMap
the cutting planes: the contour is the intersection between these planes and the mesh
Definition: MeshProjection.h:133
camitk::ImageComponent
The manager of the Image Volume data. An image volume data has no concrete 3D representation,...
Definition: ImageComponent.h:77
camitk::Action::getTargets
const ComponentList getTargets() const
the currently selected and valid (regarding the component property) components, for which this action...
Definition: Action.cpp:166
MeshProjection::getViewer
camitk::InteractiveViewer * getViewer(camitk::Slice::SliceOrientation)
get the slice viewer corresponding to the orientation
Definition: MeshProjection.cpp:595
camitk::InteractiveViewer::getRendererWidget
RendererWidget * getRendererWidget()
return interactiveViewer RendererWidget
Definition: InteractiveViewer.h:237
Action.h
camitk::InteractiveViewer
InteractiveViewer is used to view 3D objects and slices (anything that provides either a InterfaceBit...
Definition: InteractiveViewer.h:112
camitk::ImageComponent::getAxialSlices
SingleImageComponent * getAxialSlices()
Returns the axial slice.
Definition: ImageComponent.cpp:472
camitk::Property
This class describes a property that can be used in components and actions or any class that needs to...
Definition: Property.h:303
MeshProjection::targetImage
camitk::ImageComponent * targetImage
current image component to project onto
Definition: MeshProjection.h:112
camitk::Action::addTag
void addTag(QString tag)
add a tag to the tags list of this action
Definition: Action.cpp:141
Log.h
MeshComponent.h
MeshProjection.h
camitk::SingleImageComponent
This Component manages sub-component of the image component seen as a single orientation only (axial ...
Definition: SingleImageComponent.h:61
camitk::InterfaceGeometry::getPointSet
virtual vtkSmartPointer< vtkPointSet > getPointSet()=0
camitk::Action
Action class is an abstract class that enables you to build a action (generally on a component)....
Definition: Action.h:231
ArbitrarySingleImageComponent.h
MeshProjection::getOrientationIndex
int getOrientationIndex(camitk::Slice::SliceOrientation)
get the dimension index corresponding to the current orientation 0 is the index for sagittal dimensio...
Definition: MeshProjection.cpp:546
Property.h
camitk::Property::setAttribute
void setAttribute(const QString &attribute, const QVariant &value)
Set a given property for this attribute.
Definition: Property.cpp:183
MeshProjection::getNewPlane
vtkSmartPointer< vtkPlane > getNewPlane(camitk::Slice::SliceOrientation)
create a plane for a given orientation
Definition: MeshProjection.cpp:505
MeshProjection::updateCuttingPlane
void updateCuttingPlane()
this slots is called when the user changes the selected slice to update the contour
Definition: MeshProjection.cpp:488
MeshProjection::getNewActor
vtkSmartPointer< vtkActor > getNewActor(camitk::Slice::SliceOrientation)
create an actor for the contour. The color of the new actor depends on the current orientation
Definition: MeshProjection.cpp:571
MeshProjection::event
virtual bool event(QEvent *e)
manage property modification immediatly
Definition: MeshProjection.cpp:152
camitk::Action::setDescription
void setDescription(QString description)
the description of the action
Definition: Action.cpp:126
camitk::Component::getName
QString getName() const override
get the name to be displayed
Definition: sdk/libraries/core/component/Component.h:907
camitk::ArbitrarySingleImageComponent::getImageCenterInParent
void getImageCenterInParent(double[4])
get the current position of the image center in the parent coordinate system i.e the image frame (giv...
Definition: ArbitrarySingleImageComponent.cpp:332
MeshProjection::getVoxelSize
double getVoxelSize(camitk::Slice::SliceOrientation)
get the voxel slice in the correct orientation
Definition: MeshProjection.cpp:564
MeshProjection::cutterMapperMap
QMap< camitk::Slice::SliceOrientation, vtkSmartPointer< vtkPolyDataMapper > > cutterMapperMap
the contour mappers (input for both 3D and 2D actors)
Definition: MeshProjection.h:124
camitk::ImageComponent::getSagittalSlices
SingleImageComponent * getSagittalSlices()
Returns the sagittal slice.
Definition: ImageComponent.cpp:482
camitk::Component::getTransformFromWorld
const vtkSmartPointer< vtkTransform > getTransformFromWorld() const override
Transforms accessors / Modifyers.
Definition: sdk/libraries/core/component/Component.cpp:814
camitk::ComponentList
QList< Component * > ComponentList
A list of Component.
Definition: CamiTKAPI.h:127
MeshProjection::MeshProjection
MeshProjection(camitk::ActionExtension *)
Default Constructor.
Definition: MeshProjection.cpp:60
MeshProjection::meshToProject
camitk::MeshComponent * meshToProject
current mesh component
Definition: MeshProjection.h:109
camitk::Action::addParameter
virtual bool addParameter(Property *)
Add a new parameter to the action, using the CamiTK property class.
Definition: Action.cpp:440
camitk::ActionExtension
This class describes what is a generic Action extension. To add a ActionExtension to CamiTK core,...
Definition: ActionExtension.h:80
MeshProjection::updateContourLineWidth
void updateContourLineWidth()
update the contour line width using the corresponding property value
Definition: MeshProjection.cpp:210
MeshProjection::imageComponentList
QList< camitk::ImageComponent * > imageComponentList
Definition: MeshProjection.h:118
MeshProjection::contourActorMap
QMap< camitk::Slice::SliceOrientation, vtkSmartPointer< vtkActor > > contourActorMap
the mesh contours in the 3D view (where the mesh actually is), one for each orientation
Definition: MeshProjection.h:127
MeshProjection::updateVisibility
void updateVisibility()
show/hide the contour in a viewer
Definition: MeshProjection.cpp:224
camitk::ImageComponent::getImageData
vtkSmartPointer< vtkImageData > getImageData() const override
get the image volume managed by this Component
Definition: ImageComponent.h:123
InteractiveViewer.h
camitk::Action::getProperty
virtual Q_INVOKABLE camitk::Property * getProperty(QString name)
Get a Property given its name.
Definition: Action.cpp:435
MeshProjection::apply
virtual camitk::Action::ApplyStatus apply()
this method is automatically called when the action is triggered.
Definition: MeshProjection.cpp:146
camitk::MeshComponent
Basic component to manage any kind of mesh.
Definition: MeshComponent.h:53
camitk::refresh
void refresh()
refresh the display
camitk::Slice::SliceOrientation
SliceOrientation
Common slices orientation: axial, sagittal, coronal axial_neuro.
Definition: Slice.h:197
camitk::ImageComponent::getArbitrarySlices
ArbitrarySingleImageComponent * getArbitrarySlices()
Returns the arbitrary slice.
Definition: ImageComponent.cpp:487
Slice.h
ImageComponent.h
camitk::Component
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition: sdk/libraries/core/component/Component.h:302
Application.h
camitk
Definition: Action.cpp:35