Computer Assisted Medical Intervention Tool Kit  version 6.0
Loading...
Searching...
No Matches
ArbitrarySingleImageComponent.h
Go to the documentation of this file.
1/*****************************************************************************
2 * $CAMITK_LICENCE_BEGIN$
3 *
4 * CamiTK - Computer Assisted Medical Intervention ToolKit
5 * (c) 2001-2025 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, 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 ARBITRARYSINGLEIMAGEVOLUMECOMPONENT_H
27#define ARBITRARYSINGLEIMAGEVOLUMECOMPONENT_H
28
29// -- Core stuff
31#include "ImageComponent.h" // for friend fromVariant method
32
33// -- QT stuff classes
34#include <QVector3D>
35
36namespace camitk {
37
90 Q_OBJECT
91
92public:
94 ArbitrarySingleImageComponent(Component* parentComponent, const QString& name, vtkSmartPointer<vtkWindowLevelLookupTable> lut);
95
97 virtual ~ArbitrarySingleImageComponent() override;
98
102
104 virtual void propertyValueChanged(QString name) override;
105
110
113 virtual void resetTransform();
114
117 virtual void setSlice(int) override;
118
120 virtual void setSlice(double, double, double) override;
121
124 virtual int getSlice() const override;
125
128 virtual int getNumberOfSlices() const override;
130
134
138 void getArbitraryCenter(double center[4]) const;
139
143 void getArbitraryPlaneNormal(double normalVector[4]) const;
145
147 vtkSmartPointer<vtkActor> get3DCursor() override;
148
151 return arbitraryTransformation.get();
152 }
153
156 return arbitraryFrame.get();
157 }
158
161 void setArbitraryFrame(const std::shared_ptr<FrameOfReference>& fr) {
162 arbitraryFrame = fr;
163 }
164
167 void setFrame(const std::shared_ptr<FrameOfReference>& fr) override;
168
172 virtual QMultiMap<const FrameOfReference*, Component*> getAllFrames(bool includeChildrenFrames) override;
173
177 virtual QMultiMap<const Transformation*, Component*> getAllTransformations(bool includeChildrenTransformations) override;
178
179
180private:
183 friend void ImageComponent::fromVariant(const QVariant&);
184
189 void initArbitraryTransformation(const std::shared_ptr<FrameOfReference>& arbitraryFrame, const std::shared_ptr<FrameOfReference>& dataFrame, const std::shared_ptr<Transformation>& tr = nullptr);
190
192 void resetArbitraryTransformationMatrix();
193
198 virtual void updateTranslation();
199
203 virtual void updateRotation();
204
210 double computeTranslationRatio() const;
211
222 void computeIntersectionsWithImageBorders(QVector3D& Cz_min, QVector3D& Cz_max) const;
223
238 void computeIntersectionsWithImageBorders(const QVector3D& origin, const QVector3D& upVector, QVector3D& intersectionMin, QVector3D& intersectionMax) const;
239
241 bool checkCenter(vtkSmartPointer<vtkMatrix4x4>) const;
242
244 bool pointInsideVolume(QVector3D) const;
245
247 int* dimensions;
248
250 double* spacing;
251
253 std::shared_ptr<FrameOfReference> arbitraryFrame;
254
256 std::shared_ptr<Transformation> arbitraryTransformation;
257
279 template<typename T> static vtkSmartPointer<vtkMatrix4x4> Multiply4x4(T, T);
280 template<typename T, typename... Args> static vtkSmartPointer<vtkMatrix4x4> Multiply4x4(T a, T b, Args... args);
281
290 static bool linePlaneIntersectionPoint(QVector3D, QVector3D, QVector3D, QVector3D, QVector3D&);
291
294 static float roundTo4Decimals(float);
295
298 static QVector3D roundTo4Decimals(QVector3D);
299
303 static void cleanMatrix(vtkSmartPointer<vtkMatrix4x4> matrixToClean, double epsilon = 1e-5);
305};
306
307}
308
309#endif // ARBITRARYSINGLEIMAGEVOLUMECOMPONENT_H
#define CAMITK_API
Definition CamiTKAPI.h:66
virtual void setSlice(int) override
set slice as a percentage on the z axis translation
Definition ArbitrarySingleImageComponent.cpp:459
ArbitrarySingleImageComponent(Component *parentComponent, const QString &name, vtkSmartPointer< vtkWindowLevelLookupTable > lut)
Constructor.
Definition ArbitrarySingleImageComponent.cpp:92
virtual int getNumberOfSlices() const override
always return 100 (as getSlice() gives a percentage value, the max number of slices is 100.
Definition ArbitrarySingleImageComponent.cpp:515
vtkSmartPointer< vtkActor > get3DCursor() override
Returns a 3D cross cursor vtkActor to show the picked voxel (override to give it in the right frame).
Definition ArbitrarySingleImageComponent.cpp:435
virtual void propertyValueChanged(QString name) override
propertyValueChanged: when "Translation" and "Rotation" properties are modify, this will update the s...
Definition ArbitrarySingleImageComponent.cpp:193
virtual void updatePropertyFromTransformation()
update the property values from the current arbitrary transformation (this can be called for instance...
Definition ArbitrarySingleImageComponent.cpp:208
const Transformation * getArbitraryTransformation() const
Returns the arbitrary transformation (from arbitraryFrame to main frame of this component,...
Definition ArbitrarySingleImageComponent.h:150
void setArbitraryFrame(const std::shared_ptr< FrameOfReference > &fr)
Set the ArbitraryFrame.
Definition ArbitrarySingleImageComponent.h:161
virtual int getSlice() const override
return the slice as the percentage of translation (between 0 and 100)
Definition ArbitrarySingleImageComponent.cpp:510
virtual void resetTransform()
reset the transformation to the image component parent so that the frame of the arbitrary slice is in...
Definition ArbitrarySingleImageComponent.cpp:219
void getArbitraryCenter(double center[4]) const
Compute the current position of the cutting plane center in the image coordinate system (i....
Definition ArbitrarySingleImageComponent.cpp:409
void getArbitraryPlaneNormal(double normalVector[4]) const
Compute the current z-direction (normal vector) in the image coordinate system (i....
Definition ArbitrarySingleImageComponent.cpp:418
const FrameOfReference * getArbitraryFrame() const
Get the arbitrary frame that is located in the chosen arbitrary position.
Definition ArbitrarySingleImageComponent.h:155
A Component represents something that could be included in the explorer view, the interactive 3D view...
Definition sdk/libraries/core/component/Component.h:304
FrameOfReference is only a label for an abstract coordinate system.
Definition FrameOfReference.h:69
virtual void fromVariant(const QVariant &) override
Load data from a QVariant to initialize the current object.
Definition ImageComponent.cpp:1028
This Component manages sub-component of the image component seen as a single orientation only (axial ...
Definition SingleImageComponent.h:62
vtkSmartPointer< vtkWindowLevelLookupTable > lut
Look up table used for this image.
Definition SingleImageComponent.h:95
Transformation represents a geometrical transformation between two FrameOfReferences.
Definition Transformation.h:81
Definition Action.cpp:40