Simulating Brain Aneurysms with HPC · RISC Software GmbH –Johannes Kepler University Linz ©...

68
RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 1 Simulating Brain Aneurysms with HPC RISC Software GmbH Softwarepark 35, 4232 Hagenberg, Austria

Transcript of Simulating Brain Aneurysms with HPC · RISC Software GmbH –Johannes Kepler University Linz ©...

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 1

    Simulating Brain Aneurysms with HPC

    RISC Software GmbH

    Softwarepark 35, 4232 Hagenberg, Austria

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 2

    Outline

    Medical background

    Blood flow simulation (MEDVIS 3D)

    – FEM, CFD, CSD, FSI

    – Workflow

    – Results

    Real-time surgery simulation (Virtual Aneurysm)

    – Fast FEM

    – Collision detection

    – Treatment quality assessment

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 3

    RISC – Unit Medical Informatics

    Virtual Patient

    • Surface area measurement on 3D models

    • Medical documentation and expert systems

    Biomechanical Simulation

    • Simulation of ocular misalignments and their surgical correction

    • Blood flow simulation

    Medical Image Processing

    • Vessel reconstruction

    • Reconstruction of eye muscles and nerves

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 4

    Medical Motivation

    Aneurysms

    – Balloon-like dilation of vessel wall with risk to rupture → bleeding into surounding brain tissue (hemorrhage)

    – Often at bifurcations of the aorta and brain arteries

    – Incidence: 5-8% of population

    – Growth/rupture processes of aneurysms still mostly unknown

    – Influence parameters:

    • Size, location and shape

    • Individual blood flow patterns

    • Mechanical stresses along the vessel wall

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 5

    Medical Motivation

    Therapies:

    Minimally invasive:Stenting + Coiling Surgical Clipping

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 6

    Medical Motivation

    Diagnosis Support Tool (MEDVIS 3D) providing

    – 3D reconstruction of vessel morphology

    – Automatic mesh generation

    – Predefined material parameters and boundary conditions

    – Numerical simulation of flow and wall movement

    – Interactive visualization of results in 3D

    – Low hardware requirements (GPU or GRID connection)

    and license cost

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 7

    Incompressible Navier-Stokes equationfor pressure p and velocity v

    Blood ≈ Newtonian fluid (constant viscosity)

    r = 1.05 g/cm3, m = 3.85 cP

    Laminar flow (no turbulence)

    Numerical solution using Finite Element Method(FEM)

    𝜌𝜕𝒗

    𝜕𝑡+ 𝒗 ∙ 𝛻 𝒗 − 𝜇𝛻2𝒗 + 𝛻𝑝 = 0

    𝛻 ∙ 𝒗 = 0

    Blood flow: Computational Fluid Dynamics

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 8

    Finite Element Method (FEM)

    Spatial discretization of PDE

    Computational domain divided in

    mesh of (tetrahedral) elements

    Linear PDE → linear equation system

    System matrix: dimension up to 107

    → solve by iteration: Conjugate Gradient (CG), Algebraic Multigrid (AMG)

    Navier-Stokes Eq. is nonlinear and asymmetric→ need to split p and v

    Linear solver: Parallel Toolbox (KFU Graz)

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 9

    Velocity + pressure fields

    Streamlines + Pathlines

    Wall shear stress (WSS)

    Oscillatory Shear Index (OSI)

    Stress tensor

    Traction acting on wall

    OSI =1

    21 −

    0𝑇 𝜏𝑊𝑑𝑡

    0𝑇 𝜏𝑊 𝑑𝑡

    ∈ 0,0.5 , 0 ≤ 𝑡 ≤ 𝑇…cardiac cycle

    𝜏𝑊 = 𝜏𝑊 = 𝜇 𝛻𝒗 ∙ 𝒏

    𝒕 = 𝒏 ∙ 𝜎

    𝜎 = 𝜇 𝛻𝒗 + 𝛻𝒗 𝑇 − 𝑝𝕀

    Important Results

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 10

    Blood pressure and flow induce force on vessel wall

    → wall deformation

    → blood surface displacement

    → blood pressure + flow change

    Solve by iteration

    Convergence criterion: Mechanical equilibrium

    Fluid-Structure Interaction (FSI)

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 11

    Blood surface changes → Mesh needs adaptation

    Update of inner mesh nodes necessary

    Additional PDE with new surface coordinates as BC

    Mesh velocity in Navier-Stokes equation

    ALE Method (Arbitrary Lagrangian Eulerian)

    Fluid-Structure Interaction (FSI)

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 12

    Vessel wall: isotropic, linear elastic structure

    Lamé-Navier equation for displacement d

    l, m ... Elasticity parameters

    Stress tensor s, strain tensor e→ effective (von Mises) stress sVM

    Solution using FEM + CG solver

    Computational Structure Dynamics (CSD)

    𝜌𝜕2𝒅

    𝜕𝑡2− 𝛻𝜎 = 𝒇

    𝜎 = 𝜆 tr 𝜀 𝕀 + 2𝜇𝜀

    𝜀 = 1 2 𝛻𝒅 + 𝛻𝒅 𝑇

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 13

    Solve CFD Traction forces f

    CSD with f as BC Displacement d

    Mesh Updatewith d as BC

    Mesh converged?

    t < tmax ? Endnoyes

    no

    yes

    FSI Iteratio

    nSubcycling

    t = t + dtf

    Solve CFDt = t + dtf

    Dt = Dt + dtf

    Dt = dts ?

    Dt = 0

    yes

    no

    Start

    FSI Algorithm

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 14

    OpenMP:

    – Simple implementation

    – Calculation of element matrices/vectors, accumulation

    MPI:

    – Supported by AMG solver

    – External solver call

    – Additional mesh partitioning necessary (METIS)

    CUDA/OpenCL:

    – Supported by AMG solver (CUDA)

    – Calculation of element matrices/vectors, accumulation

    – Complex to implement (avoid CPU-GPU data transfers)

    Parallelization Approaches

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 15

    Test Systems: – Intel Core i7 3930K (6 cores)– NVIDIA Geforce GTX 580, NVIDIA Tesla M2090

    CFD Benchmark

    660

    324.3

    264.6

    45.84 40.23 30.64

    0

    100

    200

    300

    400

    500

    600

    700

    Single Core OpenMP OpenMP + MPI OpenCL (GTX) CUDA (Tesla) CUDA (GTX)

    Calculation time for 500 steps (s)

    Up to 21.5x speedup

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 16

    2D medical image data (X-Ray angiography, CT)

    Workflow in MEDVIS 3D

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 17

    3D reconstruction of vascular geometry (voxel data)

    Workflow in MEDVIS 3D

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 18

    Segmentation of aneurysm

    Workflow in MEDVIS 3D

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 19

    Removal of artifacts, noise

    Workflow in MEDVIS 3D

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 20

    Skeleton calculation (homotopic thinning)

    Workflow in MEDVIS 3D

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 21

    Definition of inlet + outlets

    Workflow in MEDVIS 3D

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 22

    Definition of inlet + outlets

    Workflow in MEDVIS 3D

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 23

    Vessel detection

    Workflow in MEDVIS 3D

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 24

    Vessel detection

    Workflow in MEDVIS 3D

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 25

    Vessel detection

    Workflow in MEDVIS 3D

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 26

    Aneurysm measurement(diameters, volume)

    Workflow in MEDVIS 3D

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 27

    Blood mesh generation

    1. Choose intensity threshold

    2. Advanced Skeleton Climbing → Isosurface mesh

    3. Taubin mesh smoothing

    4. Remeshing of isosurface with arbitrary resolution

    5. Mesh cutting at inlet/outlet planes

    6. Meshing of cut areas

    7. Volume Meshing (Netgen/Tetgen)

    Workflow in MEDVIS 3D

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 28

    Blood Mesh Generation

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 29

    Blood Mesh Generation

    Resolution: 0.2 mm68,000 nodes 378,000 elements

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 30

    Definition of aneurysm surface

    Blood Mesh Generation

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 31

    Definition of aneurysm surface

    Blood Mesh Generation

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 32

    Definition of aneurysm surface

    Blood Mesh Generation

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 33

    Simplest method: Extrusion of all surface nodes innormal direction → intersecting elements in case of high concave curvature and thick wall→ FEM does not converge

    Wall Mesh Generation

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 34

    Extrusion along stream lines of a calculated vector field → no intersection

    Identical to normal vectorsclose to blood surface

    Gradient Vector Flow (GVF) used in image processing

    𝜇𝛻2𝒗 − 𝒗 − 𝛻𝑓 𝛻𝑓 2 = 0

    edge map 𝑓 = 𝛻𝐼 2

    Vector Field Method

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 35

    Create voxel volume with minimum distance to blood surface as intensity

    Generate isosurface from volume with thickness as threshold → outer wall surface

    Fill intermediate space with volume mesh

    Thickness variation by weighting the distance

    Works with any geometry

    Distance Field Method

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 36

    Extrusion in normal direction

    Extrusion along GVF field

    Distance Field Meshing

    Wall Mesh Generation

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 37

    40,000 nodes

    120,000 elements

    Ends are fixed

    r = 1 g/cm3

    E ≈ 1 MPa

    n = 0.45

    dts = 10 ms= 500 dtf

    Wall Mesh Generation

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 38

    Wall Mesh Generation

    Varying thickness:Artery: 0.4 mmAneurysm: 0.2 mm

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 39

    vinlet

    Pulse 1s, time step dtf = 0.02 ms

    Choose systolic/diastolic pressure + inlet curve

    poutlet

    Boundary Conditions

    vinlet

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 40

    Computation time (1 pulse cycle): 1 hour (GPU)

    FSI Results: Velocity + Wall displacement

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 41

    Streamlines

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 43

    Pressure distribution at max inflow velocity

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 44

    Velocity field at max inflow velocity

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 45

    Velocity field at max inflow velocity

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 46

    Time-averaged Wall Shear Stress

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 47

    Oscillatory Shear Index

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 48

    Von Mises Stress

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 49

    Von Mises Stress

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 50

    Particle Paths

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 51

    Particle Paths

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 52

    Rupture Odds

    Estimation of aneurysm rupture odds [Xiang et al., Stroke 2011, 42:144-152]

    WSS: average over the simulation time and aneurysm surface w.r.t. parent vessellow WSS → higher rupture risk

    OSI: average over aneurysm surface high OSI → higher rupture risk

    𝑝 = 𝑒−0.73∗𝑊𝑆𝑆+2.86∗𝑂𝑆𝐼−0.12

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 53

    Virtual Aneurysm

    Most aneurysms coiled

    Only most difficult treated with Clipping→ Training of young surgeons problematic

    Synthetic aneurysm models expensive to produce

    Project “Virtual Aneurysm”:Haptic Training Simulator for clipping surgeries

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 54

    Environment

    2 haptic input devices(Phantom Omni)

    Mount clipping forceps + sensor for opening angle

    Stereoscopic display+

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 55

    New Challenges

    Communication with haptic device (OpenHaptics)

    Real-time FEM calculation of vessel deformation

    Collision detection for deformable objects

    3D models obtained from

    – MEDVIS 3D (Aneurysm wall)

    – Aesculap, Inc. (Forceps + clips)

    Assessment of surgery result (blood flow simulation)→ trainee can determine optimal clip type & position for patient-specific geometry

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 56

    Linear Elasticity

    FEM discretization yields linear equation system

    K … Stiffness matrix

    u … nodal displacements

    f … nodal forces

    Precalculation of inverse system matrix

    109 components ≅ 2 GB memory

    Real-time Simulation: Fast Finite Element

    𝐾𝒖 = 𝒇

    𝒖 = 𝐾−1𝒇

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 57

    Precalculation slow, but only done once per model

    Stationary solution: Sparse force vector f→ fast calculation of multiplication

    Matrix condensation: Reduction to visible (outer) degrees of freedom

    Boundary conditions prescribed as forces→ conversion of displacements necessary

    Parallelization using CUDA

    Real-time Simulation: Fast Finite Element

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 58

    Up to 10,000 nodes (30,000 elements) in real-time with our current hardware

    Real-time Simulation: Fast Finite Element

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 61

    Known problem, e.g. from

    – Computer games

    – 3D Animation, special effects in movies

    Basis: Bullet Physics Library

    – Fast

    – Open source

    – Simple utilization

    Problems:

    – Deformation of the colliding mesh

    – Response (nodal displacement, force feedback)

    Real-time Simulation: Collision Detection

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 62

    Continuously test for collisions between triangular meshes

    If collision is found:

    – List of positions + penetration vectors→ fixed displacements for nearest nodes

    – Obtain boundary forces

    – FEM calculation

    – Update collision object

    – Update visualization

    At least 20 timesper second!

    Real-time Simulation: Collision Detection

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 63

    Smooth haptic feedback with 1000 Hz

    New contact generates tangential collision plane

    – Direction of force normal to plane

    – Amount of force proportional to penetration depth

    – Multiple collision planes → addition of forces

    Real-time Simulation: Force Feedback

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 64

    Real-time Simulation: Results

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 65

    Real-time Simulation: Results

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 66

    Result Assessment

    Simulation of blood flow through inner volume

    Meshing of interior space of deformed vessel wall

    Problem: Self-intersections of interior walls have to be removed and newly meshed

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 67

    Result Assessment

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 68

    Result Assessment

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 69

    Result Assessment

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 70

    Outlook

    Inclusion of multiple clip types

    Forceps + sensor mounted on haptic device

    Modeling of surrounding tissue

    Simulation of preparation phase

    Definition of assessment criteria (scoring)

    Future projects:

    – Simulation of stenting

    – Aortic dissections

    – …

  • RISC Software GmbH – Johannes Kepler University Linz © 2014 11.04.2014 | 71

    www.risc-software.at

    Thank You! Castor, 4228mPollux, 4092mzwischenMonte-Rosa-Massiv und Matterhorn

    Wallis, Schweiz