v2.0.0
Loading...
Searching...
No Matches
sliceobject.h
Go to the documentation of this file.
1//=============================================================================================================
24
25#ifndef SLICEOBJECT_H
26#define SLICEOBJECT_H
27
28//=============================================================================================================
29// INCLUDES
30//=============================================================================================================
31
32#include "../disp3D_global.h"
33
34//=============================================================================================================
35// EIGEN INCLUDES
36//=============================================================================================================
37
38#include <Eigen/Core>
39#include <Eigen/Geometry>
40
41//=============================================================================================================
42// QT INCLUDES
43//=============================================================================================================
44
45#include <QImage>
46#include <QMatrix4x4>
47#include <QVector>
48
49//=============================================================================================================
50// DEFINE NAMESPACE DISP3DLIB
51//=============================================================================================================
52
53namespace DISP3DLIB
54{
55
56//=============================================================================================================
61{
62 Axial = 0,
63 Coronal = 1,
65};
66
67static_assert(static_cast<int>(SliceOrientation::Axial) == 0, "MRI axial slice slot must be 0");
68static_assert(static_cast<int>(SliceOrientation::Coronal) == 1, "MRI coronal slice slot must be 1");
69static_assert(static_cast<int>(SliceOrientation::Sagittal) == 2, "MRI sagittal slice slot must be 2");
70
71//=============================================================================================================
82{
83public:
85
86 //=========================================================================================================
95 void setSlice(const QImage& image,
97 int sliceIndex,
98 const Eigen::Matrix4d& voxelToWorld);
99
100 //=========================================================================================================
109 void setSliceToWorld(const QImage& image,
111 int sliceIndex,
112 const Eigen::Matrix4d& imageToWorld);
113
114 //=========================================================================================================
119
120 //=========================================================================================================
124 int sliceIndex() const;
125
126 //=========================================================================================================
130 const QImage& image() const;
131
132 //=========================================================================================================
136 QMatrix4x4 sliceToWorld() const;
137
138 //=========================================================================================================
145 void setWindowLevel(float center, float width);
146
147 //=========================================================================================================
151 float windowCenter() const;
152
153 //=========================================================================================================
157 float windowWidth() const;
158
159 //=========================================================================================================
163 void setOpacity(float opacity);
164
165 //=========================================================================================================
169 float opacity() const;
170
171 //=========================================================================================================
177 void generateQuadVertices(QVector<float>& vertices) const;
178
179 //=========================================================================================================
185 static void generateQuadIndices(QVector<unsigned int>& indices);
186
187private:
188 QImage m_image;
190 int m_sliceIndex = 0;
191 Eigen::Matrix4d m_voxelToWorld = Eigen::Matrix4d::Identity();
192 float m_windowCenter = 0.5f;
193 float m_windowWidth = 1.0f;
194 float m_opacity = 0.7f;
195
196 // Cached corners in world coordinates (computed in setSlice)
197 Eigen::Vector3d m_corner00; // (0,0) UV corner
198 Eigen::Vector3d m_corner10; // (1,0) UV corner
199 Eigen::Vector3d m_corner01; // (0,1) UV corner
200 Eigen::Vector3d m_corner11; // (1,1) UV corner
201};
202
203} // namespace DISP3DLIB
204
205#endif // SLICEOBJECT_H
Library export/import macros and namespace marker for the disp3D library.
#define DISP3DSHARED_EXPORT
3-D brain visualisation using the Qt RHI rendering backend.
SliceOrientation
Orientation for an orthogonal MRI slice.
Definition sliceobject.h:61
float windowCenter() const
const QImage & image() const
void setWindowLevel(float center, float width)
static void generateQuadIndices(QVector< unsigned int > &indices)
float windowWidth() const
QMatrix4x4 sliceToWorld() const
void setSlice(const QImage &image, SliceOrientation orientation, int sliceIndex, const Eigen::Matrix4d &voxelToWorld)
void setSliceToWorld(const QImage &image, SliceOrientation orientation, int sliceIndex, const Eigen::Matrix4d &imageToWorld)
void generateQuadVertices(QVector< float > &vertices) const
SliceOrientation orientation() const
void setOpacity(float opacity)