Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt Quick3D custom geometry from 3D array



  • Hello there,
    I have some segmented medical image in DICOM format that I would like to display with Quick3D. I read those images with ITK and there is a image to mesh filter which I should be able to use. My question is how do I create a 3D object from this mesh? I found the custom geometry example, but don't really understand it as I have a limited knowledge about 3D graphics. Any help would be very welcome.

    I already have a QML file that can display a 3D image from a mesh file.

    import QtQuick 2.0
    import QtQuick.Controls 2.12
    import QtQuick.Layouts 1.2
    import QtQuick3D 1.15
    import QtQuick3D.Helpers 1.0
    
    Item {
        id: displayImage
        width: 1200
        height: 800
    
        Rectangle {
            width: parent.width
            height: parent.height
    
            Rectangle {
                height: parent.height-60
                width: parent.width
                anchors.top: parent.top
    
                // content
                View3D {
                    id: view
                    anchors.fill: parent
    
                    PerspectiveCamera {
                        id: camera
                        position: Qt.vector3d(0, 0, 0)
                        pivot: Qt.vector3d(0, 0, -300)
                    }
    
                    DirectionalLight {
                        id: light
                        eulerRotation.x: camera.eulerRotation.x
                        eulerRotation.y: camera.eulerRotation.y
                        eulerRotation.z: camera.eulerRotation.z
                    }
    
                    Model {
                        id: bone
                        position: Qt.vector3d(-512/2*0.57, -512/2*0.57, -129/2*1.6) // center of image
                        source: "file:///C:/.../bone.mesh"
    
                        materials:
                            DefaultMaterial {
                            diffuseColor: "grey"
                        }
                    }
    
                WasdController {
                    controlledObject: camera
                }
            }
    
            Footer {
                anchors.bottom: parent.bottom
    
                previous: loadImg
            }
        }
    }
    
    

Log in to reply