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 
Show the mesh contour in the slice viewers.
Definition: MeshProjection.h:53
void updateCuttingPlane()
this slots is called when the user changes the selected slice to update the contour
Definition: MeshProjection.cpp:488
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:104
virtual bool event(QEvent *e)
manage property modification immediatly
Definition: MeshProjection.cpp:152
QMap< camitk::Slice::SliceOrientation, vtkSmartPointer< vtkPlane > > cuttingPlaneMap
the cutting planes: the contour is the intersection between these planes and the mesh
Definition: MeshProjection.h:110
camitk::ImageComponent * targetImage
current image component to project onto
Definition: MeshProjection.h:89
camitk::MeshComponent * meshToProject
current mesh component
Definition: MeshProjection.h:86
void hide()
remove the contour from the viewers if the mesh is closed / destroyed
Definition: MeshProjection.cpp:499
void updateVisibility()
show/hide the contour in a viewer
Definition: MeshProjection.cpp:224
virtual ~MeshProjection()
Default Destructor.
Definition: MeshProjection.cpp:103
virtual camitk::Action::ApplyStatus apply()
this method is automatically called when the action is triggered.
Definition: MeshProjection.cpp:146
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:107
double getVoxelSize(camitk::Slice::SliceOrientation)
get the voxel slice in the correct orientation
Definition: MeshProjection.cpp:564
void updateContourLineWidth()
update the contour line width using the corresponding property value
Definition: MeshProjection.cpp:210
QList< camitk::ImageComponent * > imageComponentList
Definition: MeshProjection.h:95
void updateComponents(camitk::MeshComponent *)
update the managed mesh and check the change in the image component using the corresponding property
Definition: MeshProjection.cpp:184
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
camitk::InteractiveViewer * getViewer(camitk::Slice::SliceOrientation)
get the slice viewer corresponding to the orientation
Definition: MeshProjection.cpp:595
MeshProjection(camitk::ActionExtension *)
Default Constructor.
Definition: MeshProjection.cpp:60
vtkSmartPointer< vtkPlane > getNewPlane(camitk::Slice::SliceOrientation)
create a plane for a given orientation
Definition: MeshProjection.cpp:505
virtual QWidget * getWidget()
method called when the action when the action is triggered (i.e. started)
Definition: MeshProjection.cpp:108
QMap< camitk::Slice::SliceOrientation, vtkSmartPointer< vtkPolyDataMapper > > cutterMapperMap
the contour mappers (input for both 3D and 2D actors)
Definition: MeshProjection.h:101
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
This class describes what is a generic Action extension.
Definition: ActionExtension.h:57
Action class is an abstract class that enables you to build a action (generally on a component).
Definition: Action.h:208
ApplyStatus
describes what happened during the application of an algorithm (i.e. results of the apply method)
Definition: Action.h:224
The manager of the Image Volume data.
Definition: ImageComponent.h:77
InteractiveViewer is used to view 3D objects and slices (anything that provides either a InterfaceBit...
Definition: InteractiveViewer.h:112
Basic component to manage any kind of mesh.
Definition: MeshComponent.h:53
SliceOrientation
Common slices orientation: axial, sagittal, coronal axial_neuro.
Definition: Slice.h:151