Computer Assited Medical Intervention Tool Kit  version 5.0
MeshClipping.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 #ifndef MESH_CLIPPING_H
27 #define MESH_CLIPPING_H
28 
29 //-- Specific action stuffs
30 #include "PlaneWidget.h"
31 
32 //-- Core stuffs
33 #include <Action.h>
34 #include <MeshComponent.h>
35 
36 // VTK stuffs
37 #include <vtkSmartPointer.h>
38 #include <vtkPlane.h>
39 
60 class MeshClipping : public camitk::Action {
61  Q_OBJECT
62 
63 public:
66 
68  virtual ~MeshClipping();
69 
71  virtual QWidget* getWidget();
72 
73 public slots:
76 
78  virtual void meshDeleted();
79 
80 private:
84  void customizeActionLayout();
85 
87  ApplyStatus clipMesh(camitk::MeshComponent* mesh, vtkSmartPointer<vtkPlane> plane);
88 
91 
94 
96  bool smoothing;
97 
99  bool allComponents;
100 
102  bool planeVisibility;
103 
105  bool save;
106 
108  double limBounds[6];
109 
110 private slots:
111 
115  void updateBox();
116 
118  void restoreMeshes();
119 
121  void changeAllComponents();
122 
124  void changeSmoothing();
125 
127  void changeVisibility();
128 
130  void saveClippedMeshes();
131 
132 private:
135  void updateBox(bool refreshViewer);
136 
137 };
138 
139 #endif // MESH_CLIPPING_H
MeshClipping::customizeActionLayout
void customizeActionLayout()
Customizes the action viewer.
Definition: MeshClipping.cpp:190
camitk::Action::setFamily
void setFamily(QString family)
the name of the family in which this action is associated
Definition: Action.cpp:136
MeshClipping::MeshClipping
MeshClipping(camitk::ActionExtension *)
The constructor.
Definition: MeshClipping.cpp:55
CAMITK_WARNING
#define CAMITK_WARNING(MSG)
Log for warning verbosity (the most common one) Will appear by default.
Definition: Log.h:266
MeshClipping::~MeshClipping
virtual ~MeshClipping()
The destructor.
Definition: MeshClipping.cpp:77
InteractiveGeometryViewer.h
camitk::Action::SUCCESS
@ SUCCESS
everything went according to plan
Definition: Action.h:248
camitk::Component::isSelected
virtual bool isSelected() const
Check if this data component is selected.
Definition: sdk/libraries/core/component/Component.h:892
camitk::Action::ABORTED
@ ABORTED
the action was aborted before completion
Definition: Action.h:251
camitk::ActionWidget
Build a default widget for a given action using its Qt properties. It should be good enough in most o...
Definition: ActionWidget.h:96
camitk::Action::ApplyStatus
ApplyStatus
Definition: Action.h:247
camitk::Action::setName
void setName(QString name)
Definition: Action.cpp:120
MeshClipping::meshDeleted
virtual void meshDeleted()
specific slot called when the mesh currently clipped is deleted
Definition: MeshClipping.cpp:185
InteractiveGeometryViewer
Interactive 3D viewer.
Definition: InteractiveGeometryViewer.h:56
PlaneWidget
This class implements a VTK implicit plane in the CamiTK application.
Definition: PlaneWidget.h:48
PlaneWidget.h
camitk::ActionWidget::setButtonVisibility
void setButtonVisibility(bool)
if false then the apply/revert buttons are shown
Definition: ActionWidget.cpp:156
MeshClipping::save
bool save
Controls the saving of the clipped component.
Definition: MeshClipping.h:128
MeshClipping::planeVisibility
bool planeVisibility
Controls the clipping widget visibility.
Definition: MeshClipping.h:125
camitk::Action::setComponent
void setComponent(QString component)
the name of the component class that can be used by this action
Definition: Action.cpp:131
camitk::Action::actionWidget
QWidget * actionWidget
the action widget
Definition: Action.h:480
camitk::InteractiveViewer::getRendererWidget
RendererWidget * getRendererWidget()
return interactiveViewer RendererWidget
Definition: InteractiveViewer.h:237
Action.h
MeshClipping::changeSmoothing
void changeSmoothing()
Method called when the smooth button is clicked.
Definition: MeshClipping.cpp:409
ActionWidget.h
camitk::Component::getDataPort
vtkSmartPointer< vtkPointSet > getDataPort
Definition: sdk/libraries/core/component/Component.h:585
camitk::Action::addTag
void addTag(QString tag)
add a tag to the tags list of this action
Definition: Action.cpp:141
MeshClipping::getWidget
virtual QWidget * getWidget()
Method called when the action when the action is triggered (i.e. started).
Definition: MeshClipping.cpp:82
Log.h
MeshComponent.h
camitk::InterfaceGeometry::getPointSet
virtual vtkSmartPointer< vtkPointSet > getPointSet()=0
RendererWidget.h
camitk::Action
Action class is an abstract class that enables you to build a action (generally on a component)....
Definition: Action.h:231
MeshClipping::list
camitk::ComponentList list
List of MeshComponent that are currently targeted by the clipping.
Definition: MeshClipping.h:113
MeshClipping
This action allows the user to clip several kinds of MeshComponents : vtkStructuredGridClip,...
Definition: MeshClipping.h:60
MeshClipping::changeAllComponents
void changeAllComponents()
Method called when the clip all components button is clicked.
Definition: MeshClipping.cpp:427
camitk::Component::isInstanceOf
bool isInstanceOf(QString className) const override
Assert that a Component instance really inherits from a given className.
Definition: sdk/libraries/core/component/Component.cpp:496
PlaneWidget::planeWidget
vtkSmartPointer< vtkImplicitPlaneWidget > planeWidget
The widget to see the real information.
Definition: PlaneWidget.h:85
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
MeshClipping::widget
PlaneWidget * widget
Class which contains the widget (implements vtkCommand).
Definition: MeshClipping.h:116
camitk::ComponentList
QList< Component * > ComponentList
A list of Component.
Definition: CamiTKAPI.h:127
MeshClipping::allComponents
bool allComponents
Controls which components are clipped : all opened components or only selected components.
Definition: MeshClipping.h:122
MeshClipping::limBounds
double limBounds[6]
Contains the clipping widget bounding box [xmin, xmax, ymin, ymax, zmin, zmax].
Definition: MeshClipping.h:131
camitk::Component::getBounds
void getBounds(double *bounds) override
compute the object's bounding box [xmin,xmax, ymin,ymax, zmin,zmax], see Component....
Definition: sdk/libraries/core/component/Component.cpp:671
MeshClipping::updateBox
void updateBox()
Method called when the update button is clicked re-calculates the widget box size when new components...
Definition: MeshClipping.cpp:232
camitk::ActionExtension
This class describes what is a generic Action extension. To add a ActionExtension to CamiTK core,...
Definition: ActionExtension.h:80
MeshClipping::apply
virtual camitk::Action::ApplyStatus apply()
Method called when the action is applied.
Definition: MeshClipping.cpp:139
MeshClipping::changeVisibility
void changeVisibility()
Method called when the visibility button is clicked.
Definition: MeshClipping.cpp:392
camitk::MeshComponent
Basic component to manage any kind of mesh.
Definition: MeshComponent.h:53
camitk::refresh
void refresh()
refresh the display
MeshClipping::saveClippedMeshes
void saveClippedMeshes()
Method called when the saving button is clicked.
Definition: MeshClipping.cpp:449
MeshClipping::restoreMeshes
void restoreMeshes()
Method called when the restore button is clicked.
Definition: MeshClipping.cpp:380
camitk::InteractiveViewer::getBounds
void getBounds(double *bound)
Compute the bounding box of all displayed Component.
Definition: InteractiveViewer.cpp:1547
MeshClipping.h
ImageComponent.h
MeshClipping::clipMesh
ApplyStatus clipMesh(camitk::MeshComponent *mesh, vtkSmartPointer< vtkPlane > plane)
Clips the mesh throughout the plane specified and return the ApplyStatus.
Definition: MeshClipping.cpp:291
camitk::InterfaceGeometry::setDataConnection
virtual void setDataConnection(vtkSmartPointer< vtkAlgorithmOutput >)=0
Set/reset the connection for the InterfaceGeometry internal algorithm.
MeshClipping::smoothing
bool smoothing
Controls smooth or chiselled (raw) clipping.
Definition: MeshClipping.h:119
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