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//=============================================================================================================
60enum class SliceOrientation {
61 Axial = 0,
62 Coronal = 1,
64};
65
66static_assert(static_cast<int>(SliceOrientation::Axial) == 0, "MRI axial slice slot must be 0");
67static_assert(static_cast<int>(SliceOrientation::Coronal) == 1, "MRI coronal slice slot must be 1");
68static_assert(static_cast<int>(SliceOrientation::Sagittal) == 2, "MRI sagittal slice slot must be 2");
69
70//=============================================================================================================
79{
80public:
82
83 //=========================================================================================================
92 void setSlice(const QImage& image,
94 int sliceIndex,
95 const Eigen::Matrix4d& voxelToWorld);
96
97 //=========================================================================================================
106 void setSliceToWorld(const QImage& image,
108 int sliceIndex,
109 const Eigen::Matrix4d& imageToWorld);
110
111 //=========================================================================================================
116
117 //=========================================================================================================
121 int sliceIndex() const;
122
123 //=========================================================================================================
127 const QImage& image() const;
128
129 //=========================================================================================================
133 QMatrix4x4 sliceToWorld() const;
134
135 //=========================================================================================================
142 void setWindowLevel(float center, float width);
143
144 //=========================================================================================================
148 float windowCenter() const;
149
150 //=========================================================================================================
154 float windowWidth() const;
155
156 //=========================================================================================================
160 void setOpacity(float opacity);
161
162 //=========================================================================================================
166 float opacity() const;
167
168 //=========================================================================================================
174 void generateQuadVertices(QVector<float>& vertices) const;
175
176 //=========================================================================================================
182 static void generateQuadIndices(QVector<unsigned int>& indices);
183
184private:
185 QImage m_image;
187 int m_sliceIndex = 0;
188 Eigen::Matrix4d m_voxelToWorld = Eigen::Matrix4d::Identity();
189 float m_windowCenter = 0.5f;
190 float m_windowWidth = 1.0f;
191 float m_opacity = 0.7f;
192
193 // Cached corners in world coordinates (computed in setSlice)
194 Eigen::Vector3d m_corner00; // (0,0) UV corner
195 Eigen::Vector3d m_corner10; // (1,0) UV corner
196 Eigen::Vector3d m_corner01; // (0,1) UV corner
197 Eigen::Vector3d m_corner11; // (1,1) UV corner
198};
199
200} // namespace DISP3DLIB
201
202#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:60
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)