30: m_corner00(Eigen::Vector3d::Zero())
31, m_corner10(Eigen::Vector3d::UnitX())
32, m_corner01(Eigen::Vector3d::UnitY())
33, m_corner11(Eigen::Vector3d::UnitX() + Eigen::Vector3d::UnitY())
42 const Eigen::Matrix4d& voxelToWorld)
47 m_voxelToWorld = voxelToWorld;
50 const int w = m_image.width();
51 const int h = m_image.height();
57 Eigen::Vector4d c00 = Eigen::Vector4d::Zero();
58 Eigen::Vector4d c10 = Eigen::Vector4d::Zero();
59 Eigen::Vector4d c01 = Eigen::Vector4d::Zero();
60 Eigen::Vector4d c11 = Eigen::Vector4d::Zero();
62 switch (m_orientation) {
87 Eigen::Vector4d w00 = m_voxelToWorld * c00;
88 Eigen::Vector4d w10 = m_voxelToWorld * c10;
89 Eigen::Vector4d w01 = m_voxelToWorld * c01;
90 Eigen::Vector4d w11 = m_voxelToWorld * c11;
92 m_corner00 = w00.head<3>();
93 m_corner10 = w10.head<3>();
94 m_corner01 = w01.head<3>();
95 m_corner11 = w11.head<3>();
103 const Eigen::Matrix4d& imageToWorld)
109 const int w = m_image.width();
110 const int h = m_image.height();
112 const Eigen::Vector4d c00(0.0, 0.0, 0.0, 1.0);
113 const Eigen::Vector4d c10(
static_cast<double>(w), 0.0, 0.0, 1.0);
114 const Eigen::Vector4d c01(0.0,
static_cast<double>(h), 0.0, 1.0);
115 const Eigen::Vector4d c11(
static_cast<double>(w),
static_cast<double>(h), 0.0, 1.0);
117 m_corner00 = (imageToWorld * c00).head<3>();
118 m_corner10 = (imageToWorld * c10).head<3>();
119 m_corner01 = (imageToWorld * c01).head<3>();
120 m_corner11 = (imageToWorld * c11).head<3>();
127 return m_orientation;
152 Eigen::Vector3d u = m_corner10 - m_corner00;
153 Eigen::Vector3d v = m_corner01 - m_corner00;
154 Eigen::Vector3d n = u.cross(v).normalized();
158 mat(0, 0) =
static_cast<float>(u.x());
159 mat(1, 0) =
static_cast<float>(u.y());
160 mat(2, 0) =
static_cast<float>(u.z());
162 mat(0, 1) =
static_cast<float>(v.x());
163 mat(1, 1) =
static_cast<float>(v.y());
164 mat(2, 1) =
static_cast<float>(v.z());
166 mat(0, 2) =
static_cast<float>(n.x());
167 mat(1, 2) =
static_cast<float>(n.y());
168 mat(2, 2) =
static_cast<float>(n.z());
170 mat(0, 3) =
static_cast<float>(m_corner00.x());
171 mat(1, 3) =
static_cast<float>(m_corner00.y());
172 mat(2, 3) =
static_cast<float>(m_corner00.z());
181 m_windowCenter = center;
182 m_windowWidth = width;
189 return m_windowCenter;
196 return m_windowWidth;
219 float* p = vertices.data();
222 *p++ =
static_cast<float>(m_corner00.x());
223 *p++ =
static_cast<float>(m_corner00.y());
224 *p++ =
static_cast<float>(m_corner00.z());
229 *p++ =
static_cast<float>(m_corner10.x());
230 *p++ =
static_cast<float>(m_corner10.y());
231 *p++ =
static_cast<float>(m_corner10.z());
236 *p++ =
static_cast<float>(m_corner01.x());
237 *p++ =
static_cast<float>(m_corner01.y());
238 *p++ =
static_cast<float>(m_corner01.z());
243 *p++ =
static_cast<float>(m_corner11.x());
244 *p++ =
static_cast<float>(m_corner11.y());
245 *p++ =
static_cast<float>(m_corner11.z());
255 indices = {0, 1, 2, 2, 1, 3};
Single MRI volume slice rendered as a textured quad with adjustable axis, position,...
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 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)