Efficient EndoNeRF reconstruction and its application for data-driven surgical simulation

Purpose The healthcare industry has a growing need for realistic modeling and efficient simulation of surgical scenes. With effective models of deformable surgical scenes, clinicians are able to conduct surgical planning and surgery training on scenarios close to real-world cases. However, a significant challenge in achieving such a goal is the scarcity of high-quality soft tissue models with accurate shapes and textures. To address this gap, we present a data-driven framework that leverages emerging neural radiance field technology to enable high-quality surgical reconstruction and explore its application for surgical simulations. Method We first focus on developing a fast NeRF-based surgical scene 3D reconstruction approach that achieves state-of-the-art performance. This method can significantly outperform traditional 3D reconstruction methods, which have failed to capture large deformations and produce fine-grained shapes and textures. We then propose an automated creation pipeline of interactive surgical simulation environments through a closed mesh extraction algorithm. Results Our experiments have validated the superior performance and efficiency of our proposed approach in surgical scene 3D reconstruction. We further utilize our reconstructed soft tissues to conduct FEM and MPM simulations, showcasing the practical application of our method in data-driven surgical simulations. Conclusion We have proposed a novel NeRF-based reconstruction framework with an emphasis on simulation purposes. Our reconstruction framework facilitates the efficient creation of high-quality surgical soft tissue 3D models. With multiple soft tissue simulations demonstrated, we show that our work has the potential to benefit downstream clinical tasks, such as surgical education.


Introduction
The development of realistic robotic surgery scenes is important for VR-based surgical training.The conventional method for creating these surgery scenes involves manual creation of soft tissue models with in-vivo textures by skilled artists.However, this approach is highly time-consuming and restricts the level of detail and variety achievable in surgical simulation.To overcome these limitations, we propose an automated approach to reconstruct interactive surgical environments using captured real data.
Surgical reconstruction [1][2][3][4][5][6][7], as an emerging task, aims to recover the 3D shapes and appearance of soft tissues from in-vivo surgery videos.As pointed out by previous literature [6,7], surgical reconstruction is cursed with three typical challenges over natural scene reconstruction: 1) Soft tissues will undergo large and drastic deformations.Many surgical operations, e.g., cutting and tearing, can even damage the topologies of soft tissues.2) Surgical tools usually appear on the surgery videos and partially occlude underlying soft tissues from observation.3) Endoscopic surgery videos are captured in confined in-vivo spaces, resulting in limited multi-view geometric clues of the 3D shapes.Our recent work EndoNeRF [7] exploits the strong capacity of NeRF [8] for scene representations and incorporates tailored modules for handling tool occlusion and single-viewpoint input, achieving significant improvements in surgical reconstruction, particularly for scenes with large deformations.However, EndoNeRF encounters new practical challenges when constructing surgical simulation environments.First, the process of reconstructing a surgical scene from endoscopic videos using EndoNeRF is inefficient, requiring over 10 hours for per-scene optimization.Second, the optimized geometry of EndoNeRF is represented in a purely implicit field, i.e., the whole scene is encoded by network parameters.However, many physically-based methods in soft-body simulation [9][10][11][12] require explicit geometry model, e.g., meshes, particles, or tetrahedrons, rather than implicit fields.It is also worth noting that the realistic interaction of soft tissues is reliant on the underlying content beneath the tissue surface.While the geometry in the EndoNeRF only represents the surfaces of soft tissues.Hence, apart from surface reconstruction, another significant challenge lies in recovering topologically closed counterparts of soft tissues for simulation purposes.
To fill this gap, this work is the first attempt to create surgical simulation environments with soft tissue surfaces automatically reconstructed from endoscopic surgery videos.Technically, we propose a novel framework for dynamic surgical reconstruction, which can yield realistic and simulator-friendly counterparts of the soft tissues in the input robotic surgery videos.We summarize our main contributions as follows: • We adopt a novel voxel grids-based scene representation for faster dynamic surgical scene reconstruction.• We build a pipeline for converting radiance fields into a closed mesh, which enables physically-based simulation of the reconstructed surgical scenes.• We exhibit multiple robotic surgery simulations with our reconstructed soft tissues on multiple simulation engines, including Taichi MPM [13,14] and NVIDIA Isaac Sim [15].This work builds upon a preliminary version presented at MICCAI 2022 [7].In this paper, we have made significant revisions and extensions to the original conference version.The major improvements include: -We designed a new deformable scene representation with grid-based radiance fields and 4D tensor-decomposed motion fields for faster training convergence.-We proposed a novel pipeline for extracting closed meshes from radiance fields, in order to generate simulatable soft tissues.-We conduct multiple surgical scene simulations with our reconstructed soft tissues.Our code is available at https://github.com/med-air/EndoNeRF.

Method
We first aim to propose a dynamic scene representation to model soft tissue's 3D shapes and textures from a stereo video clip of a dynamic surgical scene.Then we devise a particular de-occlusion rendering and stereo depth-supervised loss for optimizing the scene representation.Finally, we fill the reconstructed mesh surfaces into closed meshes and perform soft-body simulations on the filled meshes.The detailed descriptions are as follows.

Efficient EndoNeRF Scene Representations
In order to enable high-fidelity reconstruction of the surgical simulation environments, we resort to neural radiance fields.The fundamental neural radiance fields [8] for 3D scene representations are modeled in a coordinate-based MLP.Optimizing such scene representation to convergence is slow.Alternatively, we adopt an implicit-explicit voxel grids-based scene representation, which is shown to achieve much faster optimization [16][17][18][19].Specifically, we model the shape and appearance of the scene in density volume grids V  ∈ R  × × and feature volume grids V  ∈ R  × × × , where , , and  are the resolutions for the x, y and z dimensions and  is the channel number of the appearance features.For the density volume grids V  , each grid vertex maintains its occupancy probability.For the feature volume grids V  , each grid vertex holds an appearance code.To map the appearance code into RGB color, we introduce a shallow MLP  Θ : R  → R 3 as a learnable implicit shading module.The geometry and appearance of any point  in the 3D space can be retrieved via tri-linear interpolation (denoted as interp(•)) of the 8 surrounding vertices' densities and features, i.e., the density () = interp(, V  ) and the color c() =  Θ (interp(, V  )).
Next, we consider surgical scene deformations.A dynamic surgical scene can be decomposed into a canonical radiance field and a time-dependent deformation field [20,21].Thereby the dynamic scene at time  can be viewed as the canonical field warped by the deformation field at .In our proposed method, the canonical radiance field is represented by the V  and V  .To support large and topology-varying deformations, we adopt decomposed 4D motion fields and a 3-layer MLP to model the deformation field, which maps a spatial-temporal coordinate (, ) into its corresponding displacement Δ.In specific, we define a motion feature field as a  × ×  × ×  tensor T [22], where  is the resolution of the time dimension and   is the temporal feature channel number.Direct dense 5D modeling of the motion feature field is costly in storage and over-high-dimensional for optimization on sparsely captured frames.Thus, we need to seek another compact representation.Since deformations can be locally continuous and low-rank, as observed in [19,23], we can decompose this tensor via outer product (Eq.1): where  1 ,  2 ,  3 and  4 are expected rank for each dimension,    is a 1-D vector of the -th dimension,    is a feature basis of the -th dimension, and V , ,  is a 3-D volume encompassing , , -th dimensions.For each continuously queried point (, ), we trilinearly interpolate component tensors    and V , ,  to obtain a motion feature vector.Then we feed the motion feature vector into a 3-layer MLP   to compute the output displacement vector.In this way, the corresponding coordinates in the canonical field can be obtained by  ′ =  + Δ(, ) with Δ(, ) =   (interp(, , T )).

Rendering and Optimization
Volume rendering.With this scene representation, we can reconstruct the deformable surgical scene by optimizing the loss between rendered color Ĉ and ground truth color C. Specifically, the rendered color of the ray r() = o + d at time  can be evaluated by volume rendering as shown in Eq. 2: where  is the number of sampled points along r(),   is the sampling step length,   and c  are the density and color of the j-th sample evaluated by (  + Δ(  , )) and c(  + Δ(  , )), respectively.The attenuation term   can be regarded as the probability that the ray is transmitted to the j-th sample.
De-occlusion of surgical tools.According to the literature [6,7], soft tissues in surgical videos can often be occluded by surgical tools in the foreground.To address this issue and accurately reconstruct the soft tissues, our approach focuses on training the rays corresponding to tool pixels.Following the methodology proposed in EndoN-eRF [7], we generate binary tool masks for the left view of each frame.Instead of the mask-guided ray sampling proposed in EndoNeRF [7], which bypasses rays per training iteration, we pre-compute all possible camera rays and check for intersections between these rays and the tool masks prior to training.This saves the computational costs during the scene optimization procedure, resulting in faster training.Any rays that pass through the tool masks are excluded from the training process.During training, the training batch R is randomly sampled from the pre-computed rays that have been screened in this manner.By doing so, we ensure that the optimization of the scene representation bypasses the tool pixels.Leveraging the auto-interpolation property of radiance fields, we can patch the occluded soft tissue areas using information from adjacent frames throughout the training procedures.
Distillation of stereo correspondence.To exploit stereo geometry in confined in-vivo input, we propose to leverage stereo geometry to enrich 3D clues over the optimization of the scene representation.Very recent work unimatch [24] learns dense correspondence on general vision datasets in a unified formulation for optical flow, stereo matching, and depth estimation tasks.Due to its superior performance over the previous method [25], we propose to distill stereo correspondence learned on general data into the surgical data along with the optimization of the surgical scene.To measure the learned stereo correspondence of the scene representation, we render depth from the radiance fields via D(r(), ) =  =1     , where   is the distance of the j-th sample along the ray r().The rendered depth is expected to converge to the estimated stereo depth once well-matched stereo correspondence is attained by optimizing the scene representation.Thus, we estimate stereo depth D(r(), ) by stereo-matching the feature correspondence of the robotic surgery videos from unimatch [24].Lastly, we add a depth-supervised loss to the objective function, resulting in the final loss function: +   Huber D(r(), ), D(r(), ) , where C(r(), ) and D(r(), ) is the corresponding ground truth pixel color and unimatch [24] stereo depth of camera ray r() at the time .Here we adopt Huber loss [26] which is more stable to outliers.Compared with the stereo depth maps predicted by STTR [25], supervising better depth maps via unimatch can further decrease the training time since the depth refinement module proposed in EndoNeRF [7], which requires depth rendering of all training images, is no longer needed. ′ ← (  ,   , );

Extraction of Closed Meshes for Soft-Body Simulations
After we obtain an optimized dynamic radiance field, we aim to perform physicallybased simulations on the reconstruction.Numerically solving physically-based simulation systems requires dividing the object material domain into a number of geometry primitives.Since our reconstructed scene representation only encodes the seen soft tissue surface in an implicit geometry, we need to first obtain its explicit form and convert it into a simulatable object.To do this, we propose the following procedure.We first render the reconstructed canonical radiance fields to color and depth maps.Then, we back-project RGB-D maps into point clouds.Namely, each 3D point (, , ) can be computed from a corresponding pixel (  ,   ) with depth value D as (, , ) = ( D(  −   )/  , D(  −   )/  , D), where (  ,   ) is the principal point and  is the focal length.Bilateral filtering is also applied to smooth the point clouds.After conversion to point clouds, we perform Poisson surface reconstruction to extract the mesh surface from the simplified point clouds.Subsequently, we need to construct supporting structures underneath the surface for deformable object simulations.Material Point Method (MPM) and Finite Element Method (FEM) both require a closed mesh surface as the input for discretization.For the MPM solvers, dense particles are sampled to fill the soft tissue surface [27].As for the FEM solver, robust tetrahedral meshing algorithms [28][29][30] are proposed to convert surface objects into Thus, we tailor an efficient mesh-open2closed algorithm that can universally enclose the reconstructed mesh surfaces.The pseudocode of the algorithm is given in Algorithm 1, where the input mesh vertices V and triangles F are structured in 2D arrays, and   ,   denote the x and y dimensions of vertex .The algorithm begins with constructing the boundary edges of the reconstructed surface and organizing them in a list.Those boundary edges can be classified by non-manifold test, i.e., manifold edges should be simultaneously included in 2 triangles.After finding non-manifold edges, we  It is noteworthy that our algorithm is designed for the input mesh with a single "hole", i.e., there is only one connected edge.This assumption usually holds since the incisions on soft tissues are relatively shallow in in-vivo surgical scenes.If there are two disjoint surfaces represented in the reconstructed field, a solution is to run the algorithm separately for each surface.

Evaluation of Efficient EndoNeRF
We conducted an evaluation of our proposed method on a set of typical clips of robotic surgery videos, captured from 10 cases of our in-house DaVinci robotic prostatectomy dataset.In addition to the cases used in EndoNeRF [7], the new cases contain suturing, bleeding, and cutting on soft tissues.Each clip lasted for 4 to 8 seconds and was sampled into 45 ∼ 180 frames.These clips were captured from stereo cameras, and they encompassed challenging scenes with non-rigid deformation and tool occlusion.To establish the effectiveness of our new method, we compared it with two strong baselines: the recent NeRF-based method EndoNeRF [7] and the traditional DynamicFusion-based approach E-DSSR [6].For qualitative evaluation, we exhibit the reconstruction objects produced by our method, including reconstructed point clouds, surface meshes, and closed meshes.Due to clinical regulations, it is infeasible to collect ground truth depth for numerical evaluation on 3D structures.To perform quantitative comparisons, we instead used photometric errors, such as PSNR, SSIM, LPIPS, and training time, as evaluation metrics.This evaluation methodology is consistent with that used in previous work on surgical scene reconstruction, such as [6,7], and is widely used in the field of neural rendering.Figure 2 showcases our reconstruction outcomes, including extracted point clouds, soft tissue mesh surfaces, and closed meshes.Our FastEndoNeRF algorithm excels at reconstructing watertight surfaces of soft tissues from videos, faithfully capturing the intricate in-vivo textures.Despite the presence of large deformations, our method tracks the dynamics of the soft tissues using our proposed 4D decomposed motion field.For tool occlusion in the input videos, our method manages to patch tool-occluded areas by leveraging information from adjacent frames, ensuring a comprehensive and watertight representation of the dynamic soft tissue.In order to ensure that the reconstructed surface is suitable for simulation purposes in contemporary simulation engines, we have employed a mesh extraction scheme capable of constructing high-resolution meshes with intricate textures and shapes from the reconstructed point clouds.Furthermore, our proposed mesh-open2closed algorithm facilitates the creation of a closed structure by appending a base to the mesh surface.This closed structure is essential for enabling accurate simulations in the chosen environment.In Figure 3, we run our method and the original EndoNeRF [7] on the same NVIDIA RTX 3090 GPU for 3 minutes and compare their training efficiency.Due to the limited training time, the reconstruction results obtained with EndoNeRF remain noisy and blurry.Conversely, our method demonstrates impressive performance even at an early training stage (i.e., 10s to 60s), with the ability to approximate the scene's appearance and shape accurately.This validates the superior training convergence speed of our proposed scene representation.It is noteworthy that our model employs ∼160M parameters, consuming 4GB GPU memory for training each case.Without factorizing the 4D deformation field, the 4D deformation field would necessitate an allocation of over 12GB of memory during the training procedure, which shows the effectiveness of our compact dynamic scene representations.
Table 1 displays a quantitative comparison of the metrics PSNR, SSIM, LPIPS, and training time.Both methods exhibit impressive photometric results when compared to the traditional method of E-DSSR [6].Despite a slight decrease in performance, FastEndoNeRF achieves a remarkable training time improvement of approximately 20 times faster than EndoNeRF.By training FastEndoNeRF for 27 minutes, we can achieve comparable quality to EndoNeRF trained for over 10 hours.This highlights the efficiency and effectiveness of the FastEndoNeRF approach.

NVIDIA Isaac Sim FEM Solver
Taichi MPM Solver + Particle Renderer Fig. 4: Soft tissue simulation results.The first row exhibits real-time interaction between surgical tools and reconstructed soft tissues in NVIDIA Isaac Sim [15].The second presents a simulation example of soft tissue incision with MLS-MPM algorithm [14] implemented in Taichi [13].

Initial Application for Surgical Scene Simulation
Virtual surgical training platforms have become increasingly significant in surgery education and training [31,32].However, building a surgical education and training platform is associated with several challenges, including limited exposure to real-life surgical cases, and limited access to high-fidelity simulation.Our proposed framework can overcome these challenges by providing a reconstructed realistic environment for surgical trainees to practice and master their skills.
Real-time FEM simulation.Here we first build a real-time virtual surgery simulation in NVIDIA Isaac Sim [15], where FEM is the solver for simulating reconstructed continuum objects.In the first row of Figure 4, we import a reconstructed closed mesh into NVIDIA Isaac Sim and tune its physical properties to make it behave like soft tissues.Owing to advanced GPU acceleration, NVIDIA Isaac Sim enables real-time FEM simulation and rendering, producing high-fidelity deformations under the dissection interaction.The automatic reconstruction of the simulation environment from real surgical videos ensures that the in-vivo textures are accurately preserved, thereby enhancing the visual realism of surgical simulations.The proposed algorithm for closed mesh extraction facilitates material domain discretization for the FEM solver within Isaac Sim.If the imported meshes are not closed in Isaac Sim, the mesh tetrahedralization procedure will fail, resulting in unreasonable simulation effects.Moreover, the creation procedure for this simulation environment is highly scalable, thanks to the efficiency of the surgical reconstruction pipeline.MPM simulation.While the FEM solver in NVIDIA Isaac Sim achieves basic softbody simulation, it lacks the ability to perform damage operations on continuum objects, which is considered a crucial aspect of simulating soft tissues.In order to address this limitation, we employ the Material Point Method (MPM) [33], a hybrid grid-particle method that combines the strengths of both Eulerian and Lagrangian approaches.This method enables us to handle large deformations and complex material behavior, as demonstrated in recent papers [34,35].To specifically support damage deformations on soft bodies and achieve two-way coupling between rigid and non-rigid objects, we implement the state-of-the-art MLS-MPM [14].In Figure 4, the second row illustrates an example of soft tissue damage resulting from dissection.It is evident that MLS-MPM is capable of accurately capturing the incision behavior on the soft tissues.While MPM offers soft tissue damaging simulation, it is characterized by high computational costs and falls short of achieving real-time simulations.In the simulation stage, ∼5M particles are generated for simulation, resulting in a memory consumption of around 5GB.

Conclusion
We present an innovative and data-driven framework for constructing surgical simulation environments using endoscopic videos.Our approach introduces a new fast dynamic scene representation based on NeRF, which significantly accelerates the 3D reconstruction process of surgical scenes.Additionally, we propose a closed mesh extraction algorithm that converts reconstructed soft tissue surfaces into simulation objects.To demonstrate the versatility and applicability of our framework, we showcase multiple simulations of reconstructed surgical environments for diverse clinical applications.Our proposed methodology aims to inspire a significant advancement in the field of surgical simulation and is poised to open up new possibilities for next-generation surgical training and surgical robot learning.
Limitations and future work.There are still some under-explored problems with our current methods.First, the de-occlusion of surgical tools relies on the interpolation of radiance fields, which will cause artifacts in the textures of occluded soft tissues.This could be solved by incorporating generative models to inpaint the textures.Second, as an initial trial, our simulation is based on the naive versions of FEM and MPM.In the future, we aim to test more simulation algorithms on our reconstructed soft tissues, e.g., XFEM and XMPM, to achieve more realistic simulation effects.

Fig. 1 :
Fig. 1: Pipeline of our proposed FastEndoNeRF framework, consisting of a 4Ddecomposed motion field and dense 3D voxel grids.
∪ {};    ← True; /* Iteratively build a base plane of the soft tissue surface and connect the base with the boundary vertices along C */ while !isEmpty(C) do  ← Dequeue(C); if !    then /* Projection of the last  */  ←  ′ ; end /* Projection of  in the appended base of the soft tissue */

Fig. 2 :
Fig. 2: Reconsruction results.The first column gives the reference input image, the second column exhibits reconstructed point clouds, the third column shows the meshes obtained by Poisson surface reconstruction on the point clouds, and the last column displays the closed meshes appended with a base.

Fig. 3 :
Fig. 3: Comparisons of reconstruction quality between EndoNeRF and our method within the first 3 minutes of training.

Table 1 :
Quantitative evaluation and comparison of our method and baselines.We evaluate photometric errors and training time of the dynamic reconstruction.