52 : m_corner00(Eigen::Vector3d::Zero())
53 , m_corner10(Eigen::Vector3d::UnitX())
54 , m_corner01(Eigen::Vector3d::UnitY())
55 , m_corner11(Eigen::Vector3d::UnitX() + Eigen::Vector3d::UnitY())
64 const Eigen::Matrix4d& voxelToWorld)
69 m_voxelToWorld = voxelToWorld;
72 const int w = m_image.width();
73 const int h = m_image.height();
77 Eigen::Vector4d c00, c10, c01, c11;
79 switch (m_orientation) {
104 Eigen::Vector4d w00 = m_voxelToWorld * c00;
105 Eigen::Vector4d w10 = m_voxelToWorld * c10;
106 Eigen::Vector4d w01 = m_voxelToWorld * c01;
107 Eigen::Vector4d w11 = m_voxelToWorld * c11;
109 m_corner00 = w00.head<3>();
110 m_corner10 = w10.head<3>();
111 m_corner01 = w01.head<3>();
112 m_corner11 = w11.head<3>();
119 return m_orientation;
144 Eigen::Vector3d u = m_corner10 - m_corner00;
145 Eigen::Vector3d v = m_corner01 - m_corner00;
146 Eigen::Vector3d n = u.cross(v).normalized();
150 mat(0, 0) =
static_cast<float>(u.x());
151 mat(1, 0) =
static_cast<float>(u.y());
152 mat(2, 0) =
static_cast<float>(u.z());
154 mat(0, 1) =
static_cast<float>(v.x());
155 mat(1, 1) =
static_cast<float>(v.y());
156 mat(2, 1) =
static_cast<float>(v.z());
158 mat(0, 2) =
static_cast<float>(n.x());
159 mat(1, 2) =
static_cast<float>(n.y());
160 mat(2, 2) =
static_cast<float>(n.z());
162 mat(0, 3) =
static_cast<float>(m_corner00.x());
163 mat(1, 3) =
static_cast<float>(m_corner00.y());
164 mat(2, 3) =
static_cast<float>(m_corner00.z());
173 m_windowCenter = center;
174 m_windowWidth = width;
181 return m_windowCenter;
188 return m_windowWidth;
211 float* p = vertices.data();
214 *p++ =
static_cast<float>(m_corner00.x());
215 *p++ =
static_cast<float>(m_corner00.y());
216 *p++ =
static_cast<float>(m_corner00.z());
217 *p++ = 0.0f; *p++ = 0.0f;
220 *p++ =
static_cast<float>(m_corner10.x());
221 *p++ =
static_cast<float>(m_corner10.y());
222 *p++ =
static_cast<float>(m_corner10.z());
223 *p++ = 1.0f; *p++ = 0.0f;
226 *p++ =
static_cast<float>(m_corner01.x());
227 *p++ =
static_cast<float>(m_corner01.y());
228 *p++ =
static_cast<float>(m_corner01.z());
229 *p++ = 0.0f; *p++ = 1.0f;
232 *p++ =
static_cast<float>(m_corner11.x());
233 *p++ =
static_cast<float>(m_corner11.y());
234 *p++ =
static_cast<float>(m_corner11.z());
235 *p++ = 1.0f; *p++ = 1.0f;
243 indices = { 0, 1, 2, 2, 1, 3 };
SliceObject class declaration — MRI volume slice renderable.
3-D brain visualisation using the Qt RHI rendering backend.
SliceOrientation
Orientation for an orthogonal MRI slice.
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 generateQuadVertices(QVector< float > &vertices) const
SliceOrientation orientation() const
void setOpacity(float opacity)